Exemplo n.º 1
0
 /** Сохраняем данные выбранных справочников
  * @return array
  */
 public static function getCategoriesForUpdate(Apartment $ad)
 {
     if (isset($_POST['category']) && is_array($_POST['category'])) {
         $ad->references = Apartment::getCategories(null, $ad->type);
         foreach ($_POST['category'] as $cat => $categoryArray) {
             foreach ($categoryArray as $key => $value) {
                 $ad->references[$cat]['values'][$key]['selected'] = true;
             }
         }
     } else {
         $ad->references = Apartment::getCategories($ad->id, $ad->type);
     }
     return $ad->references;
 }
Exemplo n.º 2
0
 public function getCategoriesForUpdate()
 {
     if (isset($_POST['category']) && is_array($_POST['category'])) {
         $this->references = Apartment::getCategories(null, $this->type);
         foreach ($_POST['category'] as $cat => $cat_arr) {
             foreach ($cat_arr as $cat_key => $cat_value) {
                 $this->references[$cat]['values'][$cat_key]['selected'] = true;
             }
         }
     } else {
         $this->references = Apartment::getCategories($this->id, $this->type);
     }
     return $this->references;
 }