MainController.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. Doo::loadClass('auth');
  3. Doo::loadClass('attfile');
  4. Doo::loadClass('profile');
  5. /**
  6. * MainController
  7. * Feel free to delete the methods and replace them with your own code.
  8. *
  9. * @author darkredz
  10. */
  11. class MainController extends DooController {
  12. private $data, $auth, $attfile, $profile;
  13. public function __construct() {
  14. $this->auth = new Auth();
  15. $this->attfile = new attFile();
  16. $this->profile = new Profile();
  17. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  18. $this->data['currChannle'] = 'p';
  19. }
  20. public function welcome() {
  21. // if (!$this->auth->isLoggedIn())
  22. // return Doo::conf()->APP_URL;
  23. if ($this->profile->getProWithUid($_SESSION['uid'])['userid'])
  24. return Doo::conf()->APP_URL . 'project/index';
  25. if (isset($_POST['welform'])) {
  26. $profileUserArray = $_POST;
  27. $profileUserArray['userid'] = $_SESSION['uid'];
  28. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  29. return Doo::conf()->APP_URL . 'project/list';
  30. }
  31. $this->render('welcome', $this->data);
  32. }
  33. public function prolist() {
  34. // if (!$this->auth->isLoggedIn())
  35. // return Doo::conf()->APP_URL;
  36. $proArray = new stdClass();
  37. // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  38. // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  39. // if ($handle = opendir($extPathdir)) {
  40. // while (false !== ($file = readdir($handle))) {
  41. // $filename = pathinfo($file);
  42. // if ($filename['extension'] == 'json')
  43. // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
  44. // }
  45. // closedir($handle);
  46. // }
  47. $this->data['proArray'] = $proArray;
  48. $this->render('s-project', $this->data);
  49. }
  50. }
  51. ?>