示例#1
0
 function down_position()
 {
     $min = new configgroup();
     $min->select_min('position');
     $min->where('position >', $this->position);
     $min->get();
     $o = new configgroup();
     $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;
     }
 }
示例#2
0
 function edit()
 {
     $configgroup_id = $this->uri->segment(4);
     //if request is GET
     $configgroup = new configgroup($configgroup_id);
     if ($_SERVER['REQUEST_METHOD'] == "GET") {
         //do no-thing
     } else {
         $rel = $configgroup->from_array($_POST, array('name', 'for_webmaster'));
         if ($configgroup->save($rel)) {
             redirect($this->admin . 'cauhinhs/list_all/');
         }
     }
     $dis['base_url'] = base_url();
     $dis['menu_active'] = "Cấu hình hệ thống";
     $dis['title'] = "Thêm/sửa thông tin group";
     $dis['object'] = $configgroup;
     $dis['view'] = 'configgroup/edit';
     $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay lại", "link" => "{$this->admin_url}cauhinhs/", "onclick" => ""));
     $this->viewadmin($dis);
 }