Ejemplo n.º 1
0
 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');
             }
         }
     }
 }
Ejemplo n.º 2
0
 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');
 }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
 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.";
     }
 }