public function edit() { $nro = SomeRequest::getInt("nro", 0); $type = SomeRequest::getString("type", 0); $model = $this->getModel('profile'); //!!!! $model->getProfile($nro, $type); $view = $this->getView('default'); $view->setModel($model); $user = SomeFactory::getUser(); $role = $user->getUserrole(); //Muokataan jonkun muun profiilia if ($nro != 0 && $nro != $user->getUsername()) { //MikŠli kyseessŠ opiskelijan profiili, oltava opettaja tai ylituutori if ($type === SomeUser::ROLE_STUDENT && ($role === SomeUser::ROLE_TEACHER || $role === SomeUser::ROLE_HEADTEACHER)) { $view->display('edit_student'); } else { if ($type === SomeUser::ROLE_TEACHER && $role === SomeUser::ROLE_HEADTEACHER) { $view->display('edit_teacher'); } } } else { if ($role === SomeUser::ROLE_STUDENT) { $view->display('edit_student'); } else { if ($role === SomeUser::ROLE_TEACHER || $role === SomeUser::ROLE_HEADTEACHER) { $view->display('edit_teacher'); } } } }
public function showFilled() { //Täytetyn hopsin tarkastelu $lukuvuosi = SomeRequest::getInt("lv", 0); $vuositaso = SomeRequest::getInt("vt", 0); $model = $this->getModel('hops'); $model->getFilled($lukuvuosi, $vuositaso); $view = $this->getView('hops'); $view->setModel($model); $view->display('showFilled'); }
protected function changeRole() { $id = SomeRequest::getInt('id', 0); if ($id) { $ur = SomeRequest::getCmd('newrole'); $user = new SomeUser(); $user->setId($id); $user->read(); $user->setUserrole($ur); $user->update(); } }
public function prepare() { //do we even have $installtables = SomeRequest::getInt('ist', 0); if ($installtables && $this->confOk()) { if (!$this->hasUsertable()) { $this->createUserTable(); } if (!$this->hasSessiontable()) { $this->createSessionTable(); } } //get the information on tables needes and what is installed if (!$this->hasUsertable()) { $this->errors[] = "No someuser database table installed!"; } if (!$this->hasSessiontable()) { $this->errors[] = "No somesession database table installed!"; } if (!$this->confOk()) { $this->errors[] = "Check you configuration.xml on database values."; } }