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)); }
/** * @return array */ public function getCategoryGroup() { if (is_null($this->_category_group)) { $this->_category_group = false; if ($this->filter->category_group) { $model = new tservices_categories(); $this->_category_group = $model->getCategoryById($this->filter->category_group); } } return $this->_category_group; }
/** * Формирует строку с названием раздела, где будет закрепление. * * @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; }