Exemple #1
0
 public function update($values, $prefix = '')
 {
     $id = $this->id;
     $options = array();
     foreach (self::$_properties as $k => $v) {
         if ($k == 'street') {
             $v = clearTextData($values[$k]);
             $db_res = Street::getListLink('name="' . $v . '" AND city_id=' . intval($values['city_id']) . ' AND status=1');
             $row = $db_res->fetchRow();
             if ($row) {
                 $options['street_id'] = $row['id'];
             } else {
                 $street_id = Street::createStatic(array('name' => $v, 'status' => 0));
                 $options['street_id'] = $street_id;
             }
         } elseif ($k != 'city') {
             $options[$k] = $values[$prefix . $k];
         }
     }
     parent::update($options, '');
 }
Exemple #2
0
 public function update($values)
 {
     $id = $this->id;
     $options = array();
     $values['price_h'] = intval($values['price'] / $values['area']);
     foreach (self::$_properties as $k => $v) {
         if ($k != 'city') {
             $options[$k] = $values[$k];
         }
     }
     parent::update($options);
 }
Exemple #3
0
 public function update($values)
 {
     $id = $this->id;
     $options = array();
     $values['price_m'] = intval($values['price'] / $values['total_area']);
     foreach (self::$_properties as $k => $v) {
         if ($k == 'street') {
             $v = clearTextData($values[$k]);
             $db_res = Street::getListLink('name="' . $v . '" AND city_id=' . intval($values['city_id']) . ' AND status=' . REALTY_STATUS_ACTIVE);
             $row = $db_res->fetchRow();
             if ($row) {
                 $options['street_id'] = $row['id'];
             } else {
                 $street_id = Street::create(array('name' => $v, 'status' => 0));
                 $options['street_id'] = $street_id;
             }
         } elseif ($k != 'city') {
             $options[$k] = $values[$k];
         }
     }
     parent::update($options);
 }
Exemple #4
0
 public function update($values)
 {
     $id = $this->id;
     $options = array();
     $values['price_m'] = intval($values['price'] / $values['total_area']);
     foreach (self::$_properties as $k => $v) {
         if ($k != 'city' && $k != 'street' && $k != 'number') {
             $options[$k] = $values[$k];
         } else {
             if ($k == 'number') {
                 $options[$k] = clearTextData(strtolower($values[$k]));
             }
         }
     }
     parent::update($options);
 }
Exemple #5
0
 public function update($values, $prefix = '')
 {
     $values[$prefix . 'price_m'] = intval($values[$prefix . 'price'] / $values[$prefix . 'total_area']);
     if (!isset($values[$prefix . 'type_bathroom'])) {
         $values[$prefix . 'type_bathroom'] = 0;
     }
     if (User::isGuest()) {
         $values[$prefix . 'show_address'] = 1;
     }
     // Заплатка - принудительно устанавливает признак отображения адреса на объяве гостя
     parent::update($values, $prefix);
 }