public function initialize() { parent::initialize(); $this->tag->prependTitle(' - 家长'); self::$service = new ParentService($this); $this->user = self::$service->getUserInfo($this->user->id, new User()); $this->assign('user', $this->user); //获取他的孩纸 $this->son_student = self::$service->getStudentForParentId($this->user->id); $this->assign('son_student', $this->son_student); //当前的孩子 if (count($this->son_student) > 0) { $son_now_id = $this->dispatcher->getParam('sid', 'int'); if ($son_now_id) { foreach ($this->son_student as $std) { if ($std->getId() == $son_now_id) { $this->son_now_id = $std->getId(); $this->son_now_student = $std; break; } } } if (!$this->son_now_id) { $this->son_now_student = $this->son_student->getFirst(); $this->son_now_id = $this->son_now_student->getId(); } $this->assign('son_now_student', $this->son_now_student); $this->assign('son_now_id', $this->son_now_id); } else { $this->flash->error('没有孩子'); $this->forward('error/message', '', '\\ST\\Apps\\Home\\Controllers'); return false; } }
public function initialize() { parent::initialize(); $this->tag->prependTitle(' - 学生'); self::$service = new StudentService($this); $this->user = self::$service->getUserInfo($this->user->id, new User()); $this->assign('user', $this->user); //通过get方式或者post方式获取classes_id,并传值到view $this->classes_id = $this->user->getClassesId(); $this->assign('classes_id', $this->classes_id); }
public function initialize() { parent::initialize(); $this->tag->prependTitle(' - 教师端'); self::$service = new TeacherService($this); $this->user = self::$service->getUserInfo($this->user->id, new User()); $this->assign('user', $this->user); //通过get方式或者post方式获取classes_id,并传值到view $this->classes_id = $this->dispatcher->getParam('classes_id', 'int') ? $this->dispatcher->getParam('classes_id', 'int') : ($this->request->getPost('classes_id', 'int') ? $this->request->getPost('classes_id', 'int') : $this->user->getClassesId()[0]); if (!in_array($this->classes_id, $this->user->getClassesId())) { $this->classes_id = $this->user->getClassesId()[0]; } $this->assign('classes_id', $this->classes_id); }
public function initialize() { parent::initialize(); $this->tag->prependTitle(' - 校长端'); self::$service = new RectorService($this); $this->user = self::$service->getUserInfo($this->user->id, new User()); $this->assign('user', $this->user); $this->grades = st_school_type($this->user->getSchoolId()); $this->assign('grades', $this->grades); if (count($this->grades) == 3) { $this->assign('school_type', 2); //中学 } else { $this->assign('school_type', 1); //小学 } }
public function initialize() { parent::initialize(); self::$service = new CommonServices($this); //根据身份的不同,实例化的user对象也是不一样的(主要是区分classes_id) if ($this->user->type == 1) { $this->user = self::$service->getUserInfo($this->user->id, new StudentUser()); } else { if ($this->user->type == 2) { $this->user = self::$service->getUserInfo($this->user->id, new TeacherUser()); } else { if ($this->user->type > 2) { $this->user = self::$service->getUserInfo($this->user->id, new User()); } else { $this->redirect('home/error/show500'); } } } $this->assign('user', $this->user); }
public function initialize() { parent::initialize(); $this->objBase = new \ST\Common\Controllers\ErrorController($this); }
public function __construct(FrontendController $controllerClass = null) { $this->thisController = $controllerClass; $this->di = $this->thisController->getDI(); self::$cache = new CacheServices(); }