Esempio n. 1
0
 function form($id = FALSE)
 {
     $data['user'] = new User($id);
     $levels = new Level();
     $data['levels'] = $levels->get();
     $this->template->build('admin/user_form', $data);
 }
Esempio n. 2
0
 function updatePosition()
 {
     $positionList = $this->input->post('positionList');
     $idList = $this->input->post('idList');
     $levels = new Level();
     for ($i = 0; $i < count($idList); $i++) {
         $levels->where("id", $idList[$i]);
         $levels->get();
         $levels->position = $positionList[$i];
         $levels->save();
         $levels->clear();
     }
     redirect("admin/levels/listAll/");
 }
Esempio n. 3
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new Level();
         $o->select_max('position');
         $o->get();
         if (count($o->all) != 0) {
             $max = $o->position + 1;
             $this->position = $max;
         } else {
             $this->postion = 1;
         }
     }
     return parent::save($object, $related_field);
 }