function form($id = FALSE) { $data['user'] = new User($id); $levels = new Level(); $data['levels'] = $levels->get(); $this->template->build('admin/user_form', $data); }
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/"); }
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); }