예제 #1
0
파일: jobs.php 프로젝트: lxthien/batdongsan
 function updatePosition()
 {
     $positionList = $this->input->post('positionList');
     $idList = $this->input->post('idList');
     $jobsmethods = new Jobsmethod();
     for ($i = 0; $i < count($idList); $i++) {
         $jobsmethods->where("id", $idList[$i]);
         $jobsmethods->get();
         $jobsmethods->position = $positionList[$i];
         $jobsmethods->save();
         $jobsmethods->clear();
     }
     redirect("admin/jobsmethods/listAll/");
 }
예제 #2
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new Jobsmethod();
         $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);
 }