$sections = new sections(); // инициализация списка регионов $regions = new regions(); // передаем массив селекта "Раздел" $smarty->assign('sections', $sections->retCategorys()); // передаем массив селекта "Регион" $smarty->assign('regions', $regions->retCategorys()); // если массив подписок не пустой // формируем списки для вывода городов и профессий if ($arrSubscr) { $arrProfId = array(); $arrCitysId = array(); foreach ($arrSubscr as $value) { $value['id_profession'] ? $arrProfId[] = $value['id_profession'] : null; $value['id_city'] ? $arrCitysId[] = $value['id_city'] : null; } // формируем и передаем массив необходимых профессий $professions = new professions(); $smarty->assign('professions', $professions->retCategorysByIds($arrProfId)); // формируем и передаем массив необходимых городов $citys = new citys(); $smarty->assign('citys', $citys->retCategorysByIds($arrCitysId)); } $smarty->assign('return_data', $return_data); // значения, возвращаемые в форму } // передаем массив селекта "Периодичность рассылки" // он нужен нам часто, поэтому передаем его без условий //$smarty -> assignByRef('arrSubscriptionPeriod', $arrSysDict['SubscriptionPeriod']['values']); $smarty->assignByRef('errors', $arrErrors); $smarty->assignByRef('action', $arrActions);
// ошибка: объявление не существует } else { $chpu = new chpu(); $smarty->assignByRef('chpu', $chpu); $return_data = $objAnnounce->retAnnSubj(); $sections = new sections(); $arrDataSections = $sections->retCategorys(); $smarty->assignByRef('sections', $arrDataSections); $professions = new professions(); $arrDataProfession = $professions->retCategorysByIds($return_data['id_profession']); $smarty->assignByRef('professions', $arrDataProfession); $regions = new regions(); $arrDataRegions = $regions->retCategorys(); $smarty->assignByRef('regions', $arrDataRegions); $citys = new citys(); $arrDataCity = $citys->retCategorysByIds($return_data['id_city']); $smarty->assignByRef('citys', $arrDataCity); $smarty->assignByRef('return_data', $return_data); echo $smarty->fetch($_GET['getAnnounceData'] . '.responce.tpl'); } } elseif (isset($_POST['addComment']) && isset($_POST['newsId'])) { if (!empty($_POST['addComment']) && !empty($_POST['newsId'])) { $news = new news(); $newsComments = new newsComments(); $_POST['addComment'] = strings::htmlEncode($_POST['addComment']); // проверяем наличие новости if (!$news->issetNews("id=" . secure::escQuoteData($_POST['newsId']))) { echo ajax::sdgJSONencode(array('error' => ERROR_COMMENT_NEWS_NOT_FOUND)); } else { $securimage = new securimage(); // если добавление комментариев доступно только для зарегистрированных пользователей
// необязательные поля if (empty($_POST['arrNoBindFields']['capital'])) { $_POST['arrNoBindFields']['capital'] = 0; } $citys->arrNoBindFields = $_POST['arrNoBindFields']; $citys->recCategory(); // производим запись messages::messageChangeSaved(MESSAGE_CITY_ADDED, false, CONF_ADMIN_FILE . '?m=dictionary&s=regions&action=citys&pid=' . $pid); } } } elseif (isset($_POST['action'])) { if ('edit' === $_POST['action'] && isset($_POST['city']) && is_array($_POST['city']) && !empty($_POST['city'])) { $arrActRegions['edit'] = true; // инициируем "Наименование страницы" отображаемое в форме $arrNamePage = array(array('name' => MENU_ADMIN_MAIN, 'link' => CONF_ADMIN_FILE), array('name' => MENU_DICTIONARY_REGIONS, 'link' => CONF_ADMIN_FILE . '?m=dictionary&s=regions'), array('name' => $region[$pid]['name'], 'link' => CONF_ADMIN_FILE . '?m=dictionary&s=regions&action=citys&pid=' . $pid), array('name' => FORM_ACTION_EDIT, 'link' => false)); $smarty->assign('arrCitys', $citys->retCategorysByIds(array_keys($_POST['city']))); if (isset($_POST['save_citys'])) { // проверяем на пустоту, поля обязательные для заполнения foreach ($_POST['city'] as $value) { if (!validate::arrDataNotEmpty($value['arrBindFields'])) { $arrErrors[] = ERROR_EMPTY_NAME; break; } } isset($_POST['capital_city']) ? $_POST['city']['capital_city'] = $_POST['capital_city'] : null; empty($arrErrors) ? $citys->actionCitys($_POST['action'], $_POST['city'], $region[$pid]['id']) : null; } } elseif ('setcapital' === $_POST['action'] && isset($_POST['capital_city']) && !empty($_POST['capital_city'])) { $citys->actionCitys($_POST['action'], array($_POST['capital_city']), $region[$pid]['id']); } elseif ('resetcapital' === $_POST['action']) { $citys->actionCitys($_POST['action'], array($region[$pid]['id']), $region[$pid]['id']);