function save($object = '', $related_field = '') { if (!$this->exists()) { $o = new Jobscat(); $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); }
/** * Jobscats::listAll() * * @return */ function listAll() { $jobscats = new Jobscat(); $jobscats->order_by('name_vietnamese', 'asc'); $searchKey = ""; if ($_SERVER['METHOD_REQUEST'] == 'GET') { } else { $searchKey = $this->input->post("search_name"); $jobscats->distinct(); $jobscats->group_start(); $jobscats->like('name_vietnamese', $searchKey); $jobscats->group_end(); } $jobscats->get()->all; $dis['base_url'] = base_url(); $dis['view'] = 'jobscat/list'; $dis['jobscats'] = $jobscats; $dis['searchKey'] = $searchKey; $dis['menu_active'] = "Danh mục công việc"; $dis['title_table'] = "Trang hiện tại"; $dis['title'] = "Tất cả danh mục công việc"; $dis['nav_menu'] = array(array("type" => "add", "text" => "Thêm danh mục", "link" => "{$this->admin_url}jobscats/edit/0", "onclick" => "")); $this->viewadmin($dis); }