public function init($category_id = null, $current_tuid = null) { parent::init(); global $js_file; $js_file['tservices/tservices_catalog'] = 'tservices/tservices_catalog.js'; if (isset($this->options['limit'])) { $this->limit = $this->options['limit']; } if (isset($this->options['prof_group_id'], $this->options['prof_id']) && !$category_id) { require_once ABS_PATH . '/classes/tservices/tservices_categories.php'; $tservices_categories = new tservices_categories(); $category_data = $tservices_categories->getCategoryByFreelancersCatalog($this->options['prof_group_id'], $this->options['prof_id']); if ($category_data) { $category_id = $category_data['id']; $this->options['category_title'] = $category_data['title']; $this->options['category_stitle'] = $category_data['link']; } } $tservicesCatalogModel = new tservices_catalog(); $tservicesCatalogModel->setPage($this->limit, 1); if (isset($this->options['user_id']) && $this->options['user_id'] > 0) { $tservicesCatalogModel->user_id = $this->options['user_id']; } elseif ($category_id) { $tservicesCatalogModel->category_id = $category_id; } $exclude_ids = $current_tuid ? array($current_tuid) : array(); $list = $tservicesCatalogModel->cache($this->ttl_cache)->getList($exclude_ids); $this->tservices = $list['list']; if ($this->tservices) { //расширение сведений о типовых услугах $tserviceModel = new TServiceModel(); $tserviceModel->addOwnerInfo()->extend($this->tservices, 'id'); } }
/** * Инициализация тизера. * * @global array $js_file * * @param array $options [kind, uid] */ public function init($options = array()) { global $js_file; $js_file[] = 'tservices/tservices_binds.js'; if ($options) { $this->kind = (int) $options['kind']; $this->uid = (int) $options['uid']; } $time_to = time() + 7 * 86400; $use_bind_popup = false; $tu_bind_teaser = array('date' => date('j', $time_to) . ' ' . monthtostr(date('n', $time_to), true), 'href' => 'javascript:void(0);'); $tservices_binds = new tservices_binds($this->kind); $tservices_class = new tservices($this->uid); $profs = array(); if ($this->kind == tservices_binds::KIND_SPEC) { $profs[] = $this->prof_id; } elseif ($this->kind == tservices_binds::KIND_GROUP) { $tservices_categories = new tservices_categories(); $categories = $tservices_categories->getCategoriesByParent($this->prof_id); foreach ($categories as $category) { $profs[] = $category['id']; } } if ($countBindedTu = $tservices_binds->countBindedTu($this->uid, (int) $this->prof_id)) { $binded_text = ending($countBindedTu, 'ваша услуга', 'ваши услуги', 'ваших услуг'); $tu_bind_teaser['subtitle'] = $countBindedTu . ' ' . $binded_text . ' уже <br>закреплен' . ($countBindedTu > 1 ? 'ы' : 'а') . ' в этом разделе'; if ($tservices_class->hasUnbindedTservices($this->kind, $this->uid, $profs)) { $use_bind_popup = true; $tu_bind_teaser['title'] = 'Закрепите еще одну услугу'; $tu_bind_teaser['btn_text'] = 'Закрепить'; } else { $tu_bind_teaser['title'] = 'Добавьте еще одну услугу<br>и закрепите ее здесь'; $tu_bind_teaser['href'] = '/users/' . $_SESSION['login'] . '/tu/new/'; $tu_bind_teaser['btn_text'] = 'Добавить'; } } else { if ($tservices_class->hasUserTservice(true, $profs)) { $use_bind_popup = true; $tu_bind_teaser['title'] = 'Закрепите здесь услугу'; $tu_bind_teaser['btn_text'] = 'Закрепить'; } else { $tu_bind_teaser['title'] = 'Добавьте свою услугу<br>и закрепите ее здесь'; $tu_bind_teaser['href'] = '/users/' . $_SESSION['login'] . '/tu/new/'; $tu_bind_teaser['btn_text'] = 'Добавить'; } } if ($use_bind_popup) { quickPaymentPopupTservicebind::getInstance()->init(array('uid' => $this->uid, 'kind' => $this->kind, 'prof_id' => $this->prof_id)); $tu_bind_teaser['popup_id'] = quickPaymentPopupTservicebind::getInstance()->getPopupId(0); $tu_bind_teaser['popup'] = quickPaymentPopupTservicebind::getInstance()->render(); } $this->data = $tu_bind_teaser; $this->data['price'] = $tservices_binds->getPrice(false, $this->uid, $this->prof_id); $this->data['main_div_class'] = $this->kind == tservices_binds::KIND_LANDING ? 'b-layout__tu-cols b-layout__tu-cols_height_330' : 'i-pic i-pic_port i-pic_width_225 i-pic_margbot_30'; }
public function run() { $tservicesCategoriesModel = new tservices_categories(); $categories = array(); if ($this->category_group) { $categories = $tservicesCategoriesModel->getCategoriesByParent($this->category_group); } else { $categories = $tservicesCategoriesModel->getParents(); } $this->render('t-service-catalog-categories', array('categories' => $categories, 'get_params' => $this->filter_get_params)); }
public function run() { $cur_category_group = $cur_category = $categories = array(); $model = new tservices_categories(); if ($this->category_group) { $cur_category_group = $model->getCategoryById($this->category_group); if ($this->category) { $cur_category = $model->getCategoryById($this->category); } } //собираем шаблон $this->render('t-service-navigation', array('is_crumbs' => $this->category_group, 'cur_cat' => $cur_category, 'cur_cat_group' => $cur_category_group, 'get_params' => $this->filter_get_params)); }
public function init($params) { $kind = $params['kind'] ?: 1; //По умолчанию ставим лендинг $prof_id = (int) $params['prof_id']; $profs = array(); if ($kind == tservices_binds::KIND_SPEC) { $profs[] = $prof_id; } elseif ($kind == tservices_binds::KIND_GROUP) { $tservices_categories = new tservices_categories(); $categories = $tservices_categories->getCategoriesByParent($prof_id); foreach ($categories as $category) { $profs[] = $category['id']; } } $tservices = new tservices($params['uid']); $data = $tservices->getNotBindedList($kind, $profs); $tservices_text = $tservices_cur_text = ''; $tservices_cur = 0; if ($data) { foreach ($data as $tservice) { if (!$tservices_cur) { $tservices_cur = $tservice['id']; } if (!$tservices_cur_text) { $tservices_cur_text = $tservice['title']; } $tservices_list[] = $tservice['id'] . ": '" . addslashes($tservice['title']) . "'"; } $tservices_text = '{' . implode(', ', $tservices_list) . '}'; } else { $tservices_text = '{}'; } $this->setBuyPopupTemplate('buy_popup_tservicebind.tpl.php'); $tservices_binds = new tservices_binds($kind); $promoCodes = new PromoCodes(); $options = array('popup_title_class_bg' => 'b-fon_bg_po', 'popup_title_class_icon' => 'b-icon__po', 'popup_title' => $is_prolong ? 'Продление закрепления' : 'Закрепление услуги', 'popup_subtitle' => $is_prolong ? 'Срок продления закрепления' : 'Срок закрепления услуги', 'popup_id' => $this->getPopupId(0), 'unic_name' => $this->UNIC_NAME, 'payments_title' => 'Сумма и способ оплаты', 'payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'ac_sum' => round($_SESSION['ac_sum'], 2), 'payment_account' => self::PAYMENT_TYPE_ACCOUNT, 'kind' => $kind, 'profession' => $tservices_binds->getProfessionText(false, $prof_id), 'tservices' => $tservices_text, 'tservices_cur' => $tservices_cur, 'tservices_cur_text' => $tservices_cur_text, 'ammount' => $tservices_binds->getPrice(false, $params['uid'], $prof_id), 'disable_tservices' => false, 'prof_id' => $prof_id, 'promo_code' => $promoCodes->render(PromoCodes::SERVICE_TSERVICEBIND)); //Обязательно передаем родителю parent::init($options); //Добавляем свойство к одному способу оплаты $this->options['payments'][self::PAYMENT_TYPE_CARD]['wait'] = 'Ждите ....'; $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'закрепление'); $this->inited = true; }
$mail->remindFreelancerbindsProlong(); //После того, как закрепление опустилось ниже середины списка закреплений (и в списке больше одного закрепления) $mail->remindFreelancerbindsUp(); //------------------------------------------------------------------------------ /* * Обновление количества пользователей в разделах каталога фрилансеров */ $catalog = new FreelancerCatalog(); $log->TRACE($catalog->recalcCounters()); //------------------------------------------------------------------------------ /* * Пересчет количества пользователей ТУ в данной категории */ if (date('H') == 2) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_categories.php'; tservices_categories::ReCalcCategoriesCount(); } //------------------------------------------------------------------------------ if (date('H') == 6) { $log->TRACE(professions::ReCalcProfessionsCount()); $hh = new hh(); $log->TRACE($hh->delOldFilters()); $log->TRACE($mail->employerHelpInfo()); } $log->TRACE(professions::PaidSpecsEndingReminder()); // ban $usr = new users(); $log->TRACE($usr->GetBanTimeout()); //выкидываем неактивных юзеров $log->TRACE($usr->UpdateInactive()); if (date('H') == 0 || date('H') == 6 || date('H') == 12 || date('H') == 18) {
/** * Проверка данных из формы. */ function tu_validation(&$tservice, $is_exist_feedbacks = 0) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_categories.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/validation.php'; $errors = array(); $validator = new validation(); $tservices_categories = new tservices_categories(); //--- //$tservice->title = trim(htmlspecialchars(InPost('title'),ENT_QUOTES,'cp1251')); //$tservice->title = antispam(__paramInit('string', NULL, 'name', NULL, 60, TRUE)); $tservice->title = sentence_case(__paramInit('html', null, 'title', null, 100, true)); $title = trim(stripslashes(InPost('title'))); if (!$validator->required($title)) { $errors['title'] = validation::VALIDATION_MSG_REQUIRED; } elseif (!$validator->symbols_interval($title, 4, 100)) { $errors['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 100); } //--- $tservice->price = intval(trim(InPost('price'))); if (!$validator->is_natural_no_zero($tservice->price)) { $errors['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE; } elseif (!$validator->greater_than_equal_to($tservice->price, 300)) { $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_GREATER_THAN_EQUAL_TO, '300 р.'); } elseif (!$validator->less_than_equal_to($tservice->price, 999999)) { $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_LESS_THAN_EQUAL_TO, '999 999 р.'); } //--- $days_db_id = intval(trim(InPost('days_db_id'))); if (!$validator->is_natural_no_zero($days_db_id) || !in_array($days_db_id, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90))) { $errors['days'] = validation::VALIDATION_MSG_FROM_LIST; $days_db_id = 1; } $tservice->days = $days_db_id; //--- //Если есть отзывы то не даем изменить категорию if (!(InPost('action') == 'save' && $is_exist_feedbacks > 0)) { $category_id = intval(trim(InPost('category_db_id'))); $parent_category_id = $tservices_categories->getCategoryParentId($category_id); if ($parent_category_id === false) { $errors['category'] = validation::VALIDATION_MSG_CATEGORY_FROM_LIST; } else { $tservice->category_id = $category_id; //$this->property()->parent_category_id = $parent_category_id; } } //--- $str_tags = trim(preg_replace('/\\s+/s', ' ', strip_tags(InPost('tags')))); $tags = strlen($str_tags) > 0 ? array_unique(array_map('trim', explode(',', $str_tags))) : array(); $tags = array_filter($tags, function ($el) { $len = strlen(stripslashes($el)); return $len < 80 && $len > 2; }); $tags_cnt = count(array_unique(array_map('strtolower', $tags))); $tags = array_map(function ($value) { return htmlspecialchars($value, ENT_QUOTES, 'cp1251'); }, $tags); $tservice->tags = $tags; if (!$validator->required($str_tags)) { $errors['tags'] = validation::VALIDATION_MSG_REQUIRED; } elseif ($tags_cnt > 10) { $errors['tags'] = sprintf(validation::VALIDATION_MSG_MAX_TAGS, 10); } //--- $videos = __paramInit('array', null, 'videos', array()); $videos = is_array($videos) ? array_values($videos) : array(); if (count($videos)) { $tservice->videos = null; foreach ($videos as $key => $video) { if ($validator->required($video)) { $_video_data = array('url' => $video, 'video' => false, 'image' => false); //$_video = $validator->video_validate($video); $_video = $validator->video_validate($video); $is_error = true; if ($_video) { $_video_data['url'] = $_video; if ($_video_meta = $validator->video_validate_with_thumbs($_video, 0)) { $_video_data = array_merge($_video_data, $_video_meta); $is_error = false; } } if ($is_error) { $errors['videos'][$key] = validation::VALIDATION_MSG_BAD_LINK; } $tservice->videos[$key] = $_video_data; } } } //--- //$tservice->description = trim(htmlspecialchars(InPost('description'),ENT_QUOTES, "cp1251")); //$description = trim(InPost('description')); $tservice->description = trim(__paramInit('html', null, 'description', null, 5000, true)); $description = trim(stripslashes(InPost('description'))); if (!$validator->required($description)) { $errors['description'] = validation::VALIDATION_MSG_REQUIRED; } elseif (!$validator->symbols_interval($description, 4, 5000)) { $errors['description'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000); } //--- //$tservice->requirement = trim(htmlspecialchars(InPost('requirement'),ENT_QUOTES, "cp1251")); //$requirement = trim(InPost('requirement')); $tservice->requirement = trim(__paramInit('html', null, 'requirement', null, 5000, true)); $requirement = trim(stripslashes(InPost('requirement'))); if (!$validator->required($requirement)) { $errors['requirement'] = validation::VALIDATION_MSG_REQUIRED; } elseif (!$validator->symbols_interval($requirement, 4, 5000)) { $errors['requirement'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000); } //--- $extra = __paramInit('array', null, 'extra', array()); $extra = is_array($extra) ? array_values($extra) : array(); $total_extra_price = 0; if (count($extra)) { $key = 0; $tservice->extra = null; foreach ($extra as $el) { if (isset($el['title'], $el['price'], $el['days_db_id'])) { $el['title'] = stripslashes($el['title']); $title = trim(htmlspecialchars($el['title'], ENT_QUOTES, 'cp1251')); $title_native = trim($el['title']); $price = trim($el['price']); if (!$validator->required($title_native) && !$validator->required($price)) { continue; } $is_title = $validator->min_length($title_native, 4) && $validator->max_length($title_native, 255); $is_price = $validator->is_integer_no_zero($price) && $validator->numeric_interval($price, -999999, 999999); if (!$is_price) { $errors['extra'][$key]['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE; } if (!$is_title) { $errors['extra'][$key]['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 255); } $days = trim($el['days_db_id']); $is_days = $validator->is_natural($days) && $validator->less_than_equal_to($days, 5); if (!$is_days) { $errors['extra'][$key]['days'] = sprintf(validation::VALIDATION_MSG_INTERVAL, '0', '5 дней'); $days = 1; } $price = intval($price); $days = intval($days); $tservice->extra[$key] = array('title' => $title, 'price' => $price, 'days' => $days); ++$key; if ($price < 0) { $total_extra_price += $price; } } } } //--- $tservice->is_express = 'f'; $tservice->express_price = 0; $tservice->express_days = 1; if (InPost('express_activate') == 1 && $tservice->days > 1) { $express = InPost('express'); $price = trim($express['price']); if (!$validator->is_natural_no_zero($price) || !$validator->less_than_equal_to($price, 999999)) { $errors['express']['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE; } $days_db_id = intval(trim($express['days_db_id'])); if (!$validator->is_natural_no_zero($days_db_id) || !in_array($days_db_id, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90))) { $errors['express']['days'] = validation::VALIDATION_MSG_FROM_LIST; $days_db_id = 1; } $tservice->is_express = 't'; $tservice->express_price = intval($price); $tservice->express_days = $days_db_id; } //--- //Проверка общей суммы с учетом скидок, опций (срочность не учитываю так как она выбирается по желанию) if (!isset($errors['price']) && !$validator->greater_than_equal_to($tservice->price + $total_extra_price, 300)) { $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_MIN_TOTAL, '300 р.'); } //--- //TODO: Есть проблема с контроллом выпадающего списка // он не отрабатывает новое значение укзанное по умолчанию if (!in_array(intval(InPost('distance')), array(1, 2))) { $errors['distance'] = validation::VALIDATION_MSG_FROM_RADIO; } elseif (intval(InPost('distance')) == 2) { $city_db_id = intval(InPost('city_db_id')); $city = new city(); if ($city_db_id <= 0 || !$city->getCityName($city_db_id)) { $errors['distance'] = validation::VALIDATION_MSG_CITY_FROM_LIST; } else { $tservice->city = intval(InPost('city_db_id')); $tservice->is_meet = 't'; } } else { $tservice->is_meet = 'f'; } //--- $tservice->agree = InPost('agree') == 1 ? 't' : 'f'; if ($tservice->agree === 'f') { $errors['agree'] = validation::VALIDATION_MSG_ONE_REQUIRED; } //--- if (in_array(InPost('active'), array(0, 1))) { $tservice->active = intval(InPost('active')) == 1 ? 't' : 'f'; if ($tservice->is_angry) { $tservice->active = 't'; } } //--- //Вырезаем слеши если ошибка if (count($errors) > 0) { $attrs = array('title', 'description', 'requirement', 'tags'); foreach ($attrs as $attr) { if (is_array($tservice->{$attr})) { foreach ($tservice->{$attr} as &$value) { $value = stripslashes($value); } } else { $tservice->{$attr} = stripslashes($tservice->{$attr}); } } } return $errors; }
<?php ini_set('display_errors', 1); error_reporting(E_ALL ^ E_NOTICE); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_categories.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_tags.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices.php'; $tservices_categories = new tservices_categories(); $result = $tservices_categories->getTitleAndSubtitle(10); assert('$result == array("spec_title" => "Веб-программирование", "group_title" => "Разработка сайтов")'); $result = $tservices_categories->getCategoryParentId(10); assert('$result == 7'); $tservices_tags = new tservices_tags(); $result = $tservices_tags->getsByTServiceId(39); assert('$result == array( 0 => "альбом", 1 => "бронировать", 2 => "забронировать", 3 => "заказать", 4 => "заказывать", 5 => "зарезервировать" )'); $tservices = new tservices(2); $result = $tservices->isExistFeedbacks(27); assert('$result == 2'); $result = $tservices->getTotalCount(); assert('$result == array("plus" => 2, "minus" => 2)'); $result = $tservices->getNearBy('next', 38); $result = $tservices->getNearBy('prev', 38); $result = $tservices->getCountCompleteSbrServices(); assert('$result == 5'); $result = $tservices->deleteById(750); assert('$result == TRUE'); $result = $tservices->isExists(749); $result = $tservices->getFeedbacks(36); $result = $tservices->getCard(36); $result = $tservices->setPage(5)->getShortList();
/** * Получение 3х смежных по категориям ТУ. * * @param type $cat_group * @param type $cat * * @return \xajaxResponse */ function getRelativeTU($cat_group, $cat) { $objResponse = new xajaxResponse(); $cat_group = intval($cat_group); $cat = intval($cat); if (!$cat_group) { return $objResponse; } require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/yii/tinyyii.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/widgets/TServiceFilter.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_catalog.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_categories.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_helper.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/template.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/models/TServiceModel.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/models/FreelancerModel.php'; $tservices_categories = new tservices_categories(); $category_group = $tservices_categories->getIdByGid($cat_group); $category = $tservices_categories->getIdByPid($cat); $limit = 3; $tservicesCatalogModel = new tservices_catalog(); $tservicesCatalogModel->category_id = $category ? (int) $category : (int) $category_group; $tservicesCatalogModel->setPage($limit); // поиск записей $list = $tservicesCatalogModel->cache(300)->getList(); $tservices = $list['list']; // расширение сведений о типовых услугах $tserviceModel = TServiceModel::model(); $tserviceModel->extend($tservices, 'id')->readVideos($tservices, 'videos', 'videos'); // во всех строках "распаковать" массив видео-клипов // расширение сведений о пользователях $freelancerModel = FreelancerModel::model(); $freelancerModel->extend($tservices, 'user_id', 'user'); if (($cat_group || $cat) && count($tservices)) { $html = Template::render(ABS_PATH . '/templates/recomend_tu.php', array('tservices' => $tservices)); $objResponse->script("\$('otherprojects').addClass('b-layout_hide');"); $objResponse->assign('recomend_tu', 'innerHTML', $html); } else { $objResponse->script("\$('otherprojects').removeClass('b-layout_hide');"); $objResponse->assign('recomend_tu', 'innerHTML', ''); } return $objResponse; }
public function run() { $tservicesCategoriesModel = new tservices_categories(); $categoriesTree = $tservicesCategoriesModel->getAllCategories(true); $this->render('t-service-catalog', array('categoriesTree' => $categoriesTree)); }
/** * Разбирает параметры, переданные через URL или форму фильтра и инициализирует параметры фильтра. */ protected function setFilterAttributes() { // виджету не запрещено обращаться к URL запроса $attributes = $def_attributes = array('category' => '', 'category_group' => '', 'city' => '', 'country' => '', 'prices' => array(), 'keywords' => '', 'order' => self::ORDER_RELEVANT, 'price_max' => 0); if ($category_link = __paramInit('string', 'category', null, 0)) { // параметр "категория" из URL '/tu/<category>/' $categoryModel = new tservices_categories(); $category = $categoryModel->getCategoryByLink($category_link); if (!$category) { header('Location: /404.php'); exit; } if ($category['parent_id']) { $attributes['category'] = $category['id']; $attributes['category_group'] = $category['parent_id']; } else { $attributes['category'] = null; $attributes['category_group'] = $category['id']; } } if ($city_id = __paramInit('int', 'city', null, 0)) { // TODO ? 404 Not Found $attributes['city'] = $city_id; } if ($country_id = __paramInit('int', 'country', null, 0)) { // TODO ? 404 Not Found $attributes['country'] = $country_id; } if ($prices = __paramInit('array_int', 'prices', null, array())) { // TODO ? 404 Not Found $attributes['prices'] = $prices; } if ($price_max = __paramInit('int', 'price_max', null, 0)) { $_SESSION['new_project_cost'] = abs($price_max); $attributes['price_max'] = abs($price_max); } if ($keywords = __paramInit('string', 'keywords', null, '')) { $keywords = stripslashes($keywords); $keywords = iconv('UTF-8', 'CP1251', urldecode(strip_tags($keywords))); $_SESSION['new_project_name'] = $keywords; // TODO ? 500 Internal Server Error $attributes['keywords'] = $keywords; } if ($order = __paramInit('string', 'order', null, '')) { // TODO ? 404 Not Found $attributes['order'] = in_array($order, $this->getAllowedOrders()) ? $order : self::ORDER_RELEVANT; } $this->filter->attributes($attributes); // override URL parameters // если данные прислали методом POST, то они имеют выше приоритет на параметрами GET if ('' != __paramInit('string', null, 'action')) { // что-то прислали "постом" $attributes = $def_attributes; /* $_POST = array ( [category_id_columns] => Array ( [1] => 0 [0] => 1 ) [category_id_column_id] => 0 [category_id_db_id] => 1 [category_id] => Менеджмент [price] => Array ( [3] => 3 [5] => 5 ) [location_id_columns] => Array ( [1] => 0 [0] => 1 ) [location_id_column_id] => 0 [location_id_db_id] => 1 [location_id] => Россия [keywords] => 'альбом, наклейки' ) */ /* * Логично юзать эти поля еслибы контрол работал корректно :) if (isset($_POST['category_id_columns'])) { $_category_id_columns = (array)$_POST['category_id_columns']; if (isset($_category_id_columns[1])) { $attributes['category'] = +$_category_id_columns[1]; } if(isset($_category_id_columns[0])) { $attributes['category_group'] = +$_category_id_columns[0]; } } */ if (isset($_POST['category_id_db_id'])) { $attributes['category'] = +$_POST['category_id_db_id']; } if (isset($_POST['location_id_columns'])) { $_location_id_columns = (array) $_POST['location_id_columns']; if (isset($_location_id_columns[1])) { $attributes['city'] = +$_location_id_columns[1]; } if (isset($_location_id_columns[0])) { $attributes['country'] = +$_location_id_columns[0]; } } /* * Тут тоже самое но сложность в том чтобы понять какое ID города или страны? * if (isset($_POST['location_id_db_id'])) { $attributes['city'] = +$_POST['location_id_db_id']; } */ if (isset($_POST['price'])) { $_prices = (array) $_POST['price']; foreach ($_prices as $_price_id => $_price_value) { $attributes['prices'][+$_price_id] = true; } } $price_max = abs(__paramInit('int', null, 'price_max', 0)); $_SESSION['new_project_cost'] = $price_max; $attributes['price_max'] = $price_max; if (isset($_POST['keywords'])) { $attributes['keywords'] = strip_tags($_POST['keywords']); $price_max = strip_tags($_POST['keywords']); } if (isset($_POST['order'])) { $attributes['order'] = in_array($_POST['order'], $this->getAllowedOrders()) ? strip_tags($_POST['order']) : self::ORDER_RELEVANT; } $this->filter->attributes($attributes); $url = $this->getUserFriendlyUrl(); header('HTTP/1.0 205 Reset Content'); header('Location: ' . $url); exit; } }
/** * Формирует строку с названием раздела, где будет закрепление. * * @param type $kind * * @return string */ public function getProfessionText($for_history = false, $prof_id = 0) { if (in_array($this->kind, array(self::KIND_GROUP, self::KIND_SPEC))) { $tservices_categories = new tservices_categories(); $category = $tservices_categories->getCategoryById($prof_id); $part_name = ''; if ($this->kind == self::KIND_SPEC) { $cat_group = $tservices_categories->getCategoryById($category['parent_id']); $part_name .= $cat_group['title'] . ' — '; } $part_name .= $category['title']; if ($for_history) { return 'в разделе ' . $part_name . ' каталога ТУ'; } else { return $part_name; } } elseif ($for_history) { if ($this->kind == self::KIND_LANDING) { return 'на главной странице'; } elseif ($this->kind == self::KIND_ROOT) { return 'в общем разделе каталога ТУ'; } } else { if ($this->kind == self::KIND_LANDING) { return 'Главная страница'; } elseif ($this->kind == self::KIND_ROOT) { return 'Общий раздел каталога'; } } }
/** * Уведомление фрилансеру за 1 день до окончания * размещения закрепления ТУ */ public function remind24hEndBinds() { require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/tservices/tservices_binds.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/quick_payment/quickPaymentPopupTservicebind.php"; $tservices_categories = new tservices_categories(); //Базовый шаблон письма $layout = Template::render(TSERVICES_BINDS_TPL_BASE_LAYOUT, array('params' => '', 'content' => '%CONTENT%')); $this->message = nl2br($layout); $count = 0; $page = 0; while ($binds = tservices_binds::getExpiring(++$page, 200)) { $bind_ids = array(); foreach ($binds as $el) { $kind_txt = ''; $link = '/?' . quickPaymentPopupTservicebind::getPopupId($el['tservice_id']) . '=1'; switch ($el['kind']) { case tservices_binds::KIND_LANDING: $kind_txt = 'на главной странице сайта'; break; case tservices_binds::KIND_ROOT: $kind_txt = 'в общем разделе каталога услуг'; $link = '/tu' . $link; break; case tservices_binds::KIND_GROUP: $category = $tservices_categories->getCategoryById($el['prof_id']); $kind_txt = sprintf("в разделе %s каталога услуг", @$category['title']); $link = sprintf("/tu/%s%s", @$category['link'], $link); break; case tservices_binds::KIND_SPEC: $category = $tservices_categories->getCategoryById($el['prof_id']); $kind_txt = sprintf("в подразделе %s каталога услуг", @$category['title']); $link = sprintf("/tu/%s%s", @$category['link'], $link); break; } //Шаблон уведомления $content = Template::render(TSERVICES_BINDS_TPL_MAIL_PATH . "remind_prolong.tpl.php", array('smail' => $this, 'time' => dateFormat('H:i', $el['date_stop']), 'kind' => $kind_txt, 'title' => $el['title'], 'link' => $link)); $this->recipient[] = array('email' => $this->_formatFullname($el, true), 'extra' => array('CONTENT' => nl2br($content))); $bind_ids[] = $el['id']; } $count += count($bind_ids); $massId = $this->send('text/html'); if ($massId) { tservices_binds::markSent('prolong', $bind_ids); } } return $count; }
/** * Получает ИД профессии по ИД категории услуг. */ private function getRealProfId($tservice_prof_id) { $tservice_categories = new tservices_categories(); $category = $tservice_categories->getCategoryById((int) $tservice_prof_id); $prof_id = $category['pid'] ? $category['pid'] : $category['gid']; return $prof_id; }
disallow_null"> <input tabindex="3" class="b-combo__input-text b-combo__input-text_pointer" value="" id="days" name="days" type="text" size="80" readonly="readonly"/> <label for="days" class="b-combo__label"></label> <span class="b-combo__arrow"></span> </div> </div> <?php echo tservices_helper::input_element_error('days', @$errors['days']); ?> </td> </tr> <?php $value = 'Выберите категорию'; if ($tservice->category_id > 0) { $category = new tservices_categories(); $titles = $category->getTitleAndSubtitle($tservice->category_id); if ($titles) { $value = (!empty($titles['group_title']) ? $titles['group_title'] . ': ' : '') . $titles['spec_title']; } } ?> <tr class="b-layout__tr"> <td class="b-layout__td b-layout__td_padbot_30"> <h3 class="b-txt__h3">Категория <span class="b-txt_color_de2c2c">*</span></h3> <div class="b-combo"> <div class=" b-combo__input b-combo__input_multi_dropdown b-combo__input_resize b-combo__input_width_160