예제 #1
0
 function updatePosition()
 {
     $positionList = $this->input->post('positionList');
     $idList = $this->input->post('idList');
     $o = new Estateprice();
     for ($i = 0; $i < count($idList); $i++) {
         $o->where("id", $idList[$i]);
         $o->get();
         $o->position = $positionList[$i];
         $o->save();
         $o->clear();
     }
     redirect("admin/estateprices/list_all");
 }
예제 #2
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new Estateprice();
         $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);
 }
예제 #3
0
 function getPriceByType()
 {
     $type = new Estatetype($this->input->post('typeId'));
     $category = new Estatecatalogue($type->estatecatalogue_id);
     $prices = new Estateprice();
     $prices->where('estatecatalogue_id', $category->id);
     $prices->order_by('position', 'asc');
     $prices->get();
     $option = '<option value="">Chọn Mức giá</option>';
     $option .= '<option value="-1">Thỏa thuận</option>';
     foreach ($prices as $row) {
         if ($row->id == $this->input->post('priceSelected')) {
             $option .= '<option selected="selected" value=' . $row->id . '>' . $row->label . '</option>';
         } else {
             $option .= '<option value=' . $row->id . '>' . $row->label . '</option>';
         }
     }
     echo $option;
     die;
 }