function list_all($offset = 0, $limit = 5) { $khachhang = new khachhang(); $khachhang->order_by('position', 'asc'); $khachhang->get(); $dis['base_url'] = base_url(); $dis['view'] = 'khachhang/list'; $dis['menu_active'] = 'Đối tác'; $dis['title'] = "Danh sách đối tác"; $dis['khachhang'] = $khachhang; $dis['nav_menu'] = array(array("type" => "add", "text" => "Thêm đối tác", "link" => "{$this->admin_url}partner/edit/", "onclick" => "")); $this->viewadmin($dis); }
function down_position() { $min = new khachhang(); $min->select_min('position'); $min->where('position >', $this->position); $min->get(); $o = new khachhang(); $o->where('position', $min->position); $o->get(); if ($o->result_count() > 0) { $tg = $this->position; $this->position = $o->position; $o->position = $tg; $o->save(); $this->save(); return true; } else { return false; } }