public function index() { $this->language->load('information/news'); $this->load->model('catalog/news'); $this->document->setTitle($this->language->get('heading_title')); $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home')); $data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('information/news')); $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } $filter_data = array('page' => $page, 'limit' => 10, 'start' => 10 * ($page - 1)); $total = $this->model_catalog_news->getTotalNews(); $pagination = new Pagination(); $pagination->total = $total; $pagination->page = $page; $pagination->limit = 10; $pagination->url = $this->url->link('information/news', 'page={page}'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), $total ? ($page - 1) * 10 + 1 : 0, ($page - 1) * 10 > $total - 10 ? $total : ($page - 1) * 10 + 10, $total, ceil($total / 10)); $data['heading_title'] = $this->language->get('heading_title'); $data['text_title'] = $this->language->get('text_title'); $data['text_description'] = $this->language->get('text_description'); $data['text_date'] = $this->language->get('text_date'); $data['text_view'] = $this->language->get('text_view'); $all_news = $this->model_catalog_news->getAllNews($filter_data); $data['all_news'] = array(); $this->load->model('tool/image'); foreach ($all_news as $news) { if ($news['image']) { $image = $this->model_tool_image->resize($news['image'], 373, 240, 'h'); } else { $image = $this->model_tool_image->resize('placeholder.png', 373, 240, 'h'); } $data['all_news'][] = array('title' => html_entity_decode($news['title'], ENT_QUOTES), 'image' => $image, 'description' => strlen(strip_tags(html_entity_decode($news['short_description'], ENT_QUOTES))) > 100 ? mb_substr(strip_tags(html_entity_decode($news['short_description'], ENT_QUOTES)), 0, 150) . '...' : strip_tags(html_entity_decode($news['short_description'], ENT_QUOTES)), 'view' => $this->url->link('information/news/news', 'news_id=' . $news['news_id']), 'date_added' => rus_date($this->language->get('date_day_date_format'), strtotime($news['date_added']))); } $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/news_list.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/news_list.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/information/news_list.tpl', $data)); } }
public function index() { $this->document->setTitle($this->config->get('config_meta_title')); $this->document->setDescription($this->config->get('config_meta_description')); $this->document->setKeywords($this->config->get('config_meta_keyword')); if (isset($this->request->get['route'])) { $this->document->addLink(HTTP_SERVER, 'canonical'); } //подтянем новости пока все сразу $this->load->model('catalog/news'); $this->load->model('tool/image'); $filter_data = array(); $results_news = $this->model_catalog_news->getAllNews($filter_data); $data['news'] = array(); foreach ($results_news as $news) { if ($news['image']) { $image = $this->model_tool_image->resize($news['image'], 500, 322, 'w'); } else { $image = $this->model_tool_image->resize('placeholder.png', 500, 322, 'w'); } $data['news'][] = array('news_id' => $news['news_id'], 'title' => html_entity_decode($news['title'], ENT_QUOTES), 'image' => $image, 'description' => strlen(strip_tags(html_entity_decode($news['short_description'], ENT_QUOTES))) > 100 ? mb_substr(strip_tags(html_entity_decode($news['short_description'], ENT_QUOTES)), 0, 150) . '...' : strip_tags(html_entity_decode($news['short_description'], ENT_QUOTES)), 'date_added' => rus_date($this->language->get('date_day_date_format'), strtotime($news['date_added']))); } //подтянем точки для карты $this->load->model('catalog/place'); $this->load->model('tool/image'); $filter_data = array('filter_status' => 1); $places = $this->model_catalog_place->getPlaces($filter_data); $data['places'] = array(); foreach ($places as $place) { $data['places'][] = array('place_id' => $place['place_id'], 'place_type_id' => $place['type_id'], 'latitude_longitude' => $place['latitude_longitude']); } $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/home.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/common/home.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/common/home.tpl', $data)); } }
echo count($chel); echo "<hr>"; $name = "Дмитрий"; var_dump($name); echo $name; unset($name); echo $name; var_dump($name); echo "<hr>"; $name = "545"; if (isset($name)) { echo 'переменная $name существует и ее значени равняется - ' . $name; } else { echo 'Переменной $name не существует'; } echo "<hr>"; $name = ""; if (empty($name)) { echo 'переменная $name пуста'; } else { echo 'Переменная $name имеет значение ' . $name; } echo "<hr>"; echo rus_date(); echo "<br> количество дней в месяце - " . date(t); echo "<br>"; echo "Текущее время " . date("H:i:s"); ?> </body> </html>
public function index() { $this->language->load('module/occasion'); $this->load->model('catalog/occasion'); $this->load->model('catalog/season'); $this->load->model('catalog/occasion_group'); $this->load->model('catalog/place'); $this->load->model('tool/image'); $this->load->model('catalog/metro'); //получим активный сезон $season_active = $this->model_catalog_season->getActiveSeason(); $data['heading_title'] = sprintf($this->language->get('heading_title'), $season_active['title']); $data['button_play'] = $this->language->get('button_play'); $data['text_metro'] = $this->language->get('text_metro'); $data['text_place'] = $this->language->get('text_place'); $data['text_best_price'] = $this->language->get('text_best_price'); //вынести в конфиг //получаем активные форматы $occasion_group_active = $this->model_catalog_occasion_group->getActiveOccasionGroup(); $data['occasion_groups'] = array(); foreach ($occasion_group_active as $occasion_group) { $data['occasion_groups'][] = array('occasion_group_id' => $occasion_group['occasion_group_id'], 'occasion_title' => $occasion_group['title']); } //получим списко метро $city_id = 1; //москва $metro_results = $this->model_catalog_metro->getList($city_id); $data['metro_results'] = array(); foreach ($metro_results as $metro_result) { $data['metro_results'][$metro_result['id']] = array('metro_id' => $metro_result['id'], 'metro_title' => $metro_result['name']); } //получим активные места проведения $filter_data = array(); $occasion_places = $this->model_catalog_place->getPlaces($filter_data); $data['places'] = array(); foreach ($occasion_places as $place) { $data['places'][$place['place_id']] = array('place_id' => $place['place_id'], 'place_title' => $place['title'], 'place_metro_id' => $place['metro_id'], 'place_href' => $this->url->link('information/place/view', 'place_id=' . $place['place_id'])); } //получаем список с occasion_to_occasion_group $occasions_to_occasion_groups = $this->model_catalog_occasion->getOccasionsToOccasionGroups(); $data['occasion_to_group'] = array(); foreach ($occasions_to_occasion_groups as $occasion_to_group) { $data['occasion_to_group'][] = array('occasion_id' => $occasion_to_group['occasion_id'], 'occasion_group_id' => $occasion_to_group['occasion_group_id']); } //получим активные события (надо добавить зависимость от сезона мб?) //date_default_timezone_set('UTC'); date_default_timezone_set('Europe/Moscow'); $current_date = date($this->language->get('datetime_sql_format'), strtotime("today", time())); //date($this->language->get('datetime_sql_format')); $final_end = date($this->language->get('datetime_sql_format'), strtotime("+1 month", time())); $filter_data = array('filter_status' => 1, 'filter_begin_date' => $current_date, 'filter_end_date' => $final_end, 'sort' => 'd.occasion_date', 'order' => 'ASC'); $occasions = $this->model_catalog_occasion->getOccasions($filter_data); $data['occasions'] = array(); foreach ($occasions as $occasion) { foreach ($data['occasion_to_group'] as $occasion_to_group_val) { if ($occasion['occasion_id'] == $occasion_to_group_val['occasion_id']) { $isset_best_price = (int) $occasion['best_price'] > 0 ? true : false; $data['occasions'][] = array('occasion_id' => $occasion['occasion_id'], 'title' => html_entity_decode($occasion['title'], ENT_QUOTES), 'occasion_time' => $occasion['occasion_time'], 'occasion_date_day' => rus_date($this->language->get('occasion_date_day_format'), strtotime($occasion['occasion_date'])), 'occasion_date' => rus_date($this->language->get('occasion_date_day_date_format'), strtotime($occasion['occasion_date'])), 'occasion_place_id' => $occasion['occasion_place_id'], 'occasion_group_id' => $occasion_to_group_val['occasion_group_id'], 'price' => sprintf($this->language->get('text_price_format'), $occasion['price']), 'best_price' => sprintf($this->language->get('text_price_format'), $occasion['best_price']), 'isset_best_price' => $isset_best_price, 'href' => $this->url->link('information/occasion/view', 'occasion_id=' . $occasion['occasion_id'])); } } } $data['href_list_occasions'] = $this->url->link('information/occasion'); $data['text_list_occasions'] = $this->language->get('text_list_occasions'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/occasions/occasions.tpl')) { return $this->load->view($this->config->get('config_template') . '/template/module/occasions/occasions.tpl', $data); } else { return $this->load->view('default/template/module/occasions/occasions.tpl', $data); } }
<?php foreach ($subscriptions as $sub) { $user = get_userdata($sub['user_id']); ?> <tr> <td ><p><?php echo $sub['order_num']; ?> </p></td> <td ><p><?php echo $user->user_login; ?> </p></td> <td ><p> <?php echo rus_date("j F Y", $sub['duration']); ?> </p> </td> <td ><p><?php echo $sub['type']; ?> мес.</p></td> <td ><p><?php if ($sub['status'] == 0) { echo "Не оплачено"; } elseif ($sub['status'] == 1) { echo "Оплачено"; } ?> </p></td>
мес.</p></div> <div class="col-lg-3"><p><?php echo $sub['price']; ?> р.</p></div> <div class="col-lg-2"><p><?php if ($sub['status'] == 0) { echo "Не оплачено"; } elseif ($sub['status'] == 1) { echo "Оплачено"; } ?> </p></div> </div> <?php } ?> <div class="row"> <div class="col-lg-12"> <?php $duration = get_user_meta($subscriptions[0]['user_id'], 'subscription_duration', 1); ?> <h4>Подписка оформлена до: <span><?php echo rus_date("j F Y", $duration); ?> </span></h4> </div> </div>
<h1><?php echo $cont[name]; ?> </h1> <p class="article-page-date"><?echo rus_date("j F Y", strtotime($cont[date]));?></p> <div class="separator"></div> <p class="article-page-description"><?php echo $cont[text]; ?> </p> </section> <? if($cont[more]):?> <section class="article-page-sidebar shadow"> <h1>Последние акции</h1> <? foreach($cont[more] as $value): ?> <p class="article-sidebar-date"><?echo rus_date("j F Y", strtotime($value[date]));?></p> <p class="article-sidebar-name"><a href="/news/article/<?php echo $value[id]; ?> "><?php echo $value[name]; ?> </a></p> <? endforeach; ?> <div class="separator"></div> <p class="article-sidebar-link"><a href="/news">Все акции</a></p> </section> <?endif;?> </section>
protected function getForm() { $data['heading_title'] = $this->language->get('heading_title'); $data['text_form'] = !isset($this->request->get['customer_id']) ? $this->language->get('text_add') : $this->language->get('text_edit'); $data['text_default'] = $this->language->get('text_default'); $data['text_enabled'] = $this->language->get('text_enabled'); $data['text_disabled'] = $this->language->get('text_disabled'); $data['text_archive'] = $this->language->get('text_archive'); $data['text_active'] = $this->language->get('text_active'); $data['text_draft'] = $this->language->get('text_draft'); $data['text_none'] = $this->language->get('text_none'); $data['text_select_all'] = $this->language->get('text_select_all'); $data['text_unselect_all'] = $this->language->get('text_unselect_all'); $data['entry_title'] = $this->language->get('entry_title'); $data['entry_stats_date_begin'] = $this->language->get('entry_stats_date_begin'); $data['entry_stats_date_end'] = $this->language->get('entry_stats_date_end'); $data['entry_status'] = $this->language->get('entry_status'); $data['entry_visibility'] = $this->language->get('entry_visibility'); $data['button_add'] = $this->language->get('button_add'); $data['button_save'] = $this->language->get('button_save'); $data['button_remove'] = $this->language->get('button_remove'); $data['tab_general'] = $this->language->get('tab_general'); $data['tab_data'] = $this->language->get('tab_data'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } if (isset($this->error['title'])) { $data['error_title'] = $this->error['title']; } else { $data['error_title'] = array(); } if (isset($this->error['occasion'])) { $data['error_occasion'] = $this->error['occasion']; } else { $data['error_occasion'] = array(); } if (isset($this->error['season'])) { $data['error_season'] = $this->error['season']; } else { $data['error_season'] = array(); } if (isset($this->error['occasion_group'])) { $data['error_occasion_group'] = $this->error['occasion_group']; } else { $data['error_occasion_group'] = array(); } $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')); $data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('catalog/stats', 'token=' . $this->session->data['token'] . $url, 'SSL')); if (!isset($this->request->get['customer_id'])) { $data['action'] = $this->url->link('catalog/stats/add', 'token=' . $this->session->data['token'] . $url, 'SSL'); } else { $data['action'] = $this->url->link('catalog/stats/edit', 'token=' . $this->session->data['token'] . '&customer_id=' . $this->request->get['customer_id'] . $url, 'SSL'); } $data['cancel'] = $this->url->link('catalog/stats', 'token=' . $this->session->data['token'] . $url, 'SSL'); $this->load->model('localisation/language'); $data['languages'] = $this->model_localisation_language->getLanguages(); if (isset($this->request->get['customer_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') { $stats_info = $this->model_sale_customer->getCustomer($this->request->get['customer_id']); } $data['token'] = $this->session->data['token']; if (isset($this->request->get['customer_id'])) { $data['customer_id'] = $this->request->get['customer_id']; } else { $data['customer_id'] = 0; } //подтянем сезоны $this->load->model('catalog/season'); $data['seasons'] = array(); $seasons = array(); $seasons = $this->model_catalog_season->getSeasons(); foreach ($seasons as $season) { $data['seasons'][] = array('season_id' => $season['season_id'], 'title' => $season['title']); } //подтянем список форматов $this->load->model('catalog/occasion_group'); $data['occasion_groups'] = array(); $occasion_groups = array(); $occasion_groups = $this->model_catalog_occasion_group->getOccasionGroups(); foreach ($occasion_groups as $occasion_group) { $data['occasion_groups'][] = array('occasion_group_id' => $occasion_group['occasion_group_id'], 'title' => $occasion_group['title']); } //получить список игр $this->load->model('catalog/occasion'); $filter_data = array(); $results = $this->model_catalog_occasion->getOccasions($filter_data); foreach ($results as $result) { $data['occasions'][] = array('occasion_id' => $result['occasion_id'], 'title' => $result['title'], 'occasion_date' => $result['occasion_date'], 'occasion_date_day' => rus_date($this->language->get('occasion_date_day_format'), strtotime($result['occasion_date'])), 'occasion_date' => rus_date($this->language->get('occasion_date_day_date_format'), strtotime($result['occasion_date'])), 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'edit' => $this->url->link('catalog/occasion/edit', 'token=' . $this->session->data['token'] . '&occasion_id=' . $result['occasion_id'] . $url, 'SSL')); } if (isset($this->request->post['stats'])) { $stats = $this->request->post['stats']; } elseif (isset($this->request->get['customer_id'])) { $stats = $this->model_sale_customer->getStats($this->request->get['customer_id']); } else { $stats = array(); } $data['stats'] = array(); foreach ($stats as $stat) { $data['stats'][] = array('occasion_id' => $stat['occasion_id'], 'occasion_group_id' => $stat['occasion_group_id'], 'season_id' => $stat['season_id'], 'goal' => $stat['goal'], 'pass' => $stat['pass'], 'mvp' => $stat['mvp']); } /* print_r('<pre>'); print_r($data['occasions']); print_r('</pre>'); die(); */ $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('catalog/stats/stats_form.tpl', $data)); }
private function getView() { //подгрузим язык $this->load->language('contest/send'); //SEO $this->document->setTitle($this->language->get('entry_title')); //$this->document->setDescription(substr(strip_tags(html_entity_decode($contest_info['meta_description'], ENT_QUOTES)), 0, 150) . '...'); //$this->document->setKeywords($contest_info['meta_keyword']); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } //подгрузим модели $this->load->model('account/customer'); $this->load->model('contest/contest'); $this->load->model('project/project'); $this->load->model('group/group'); $this->load->model('tool/upload'); $this->load->model('tool/image'); $this->load->model('localisation/category_request'); //*************************** проверки ********************************// //проверка на сушествование пользователя и логина в системе if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->url->link('account/account', '', 'SSL'); $this->response->redirect($this->url->link('account/account', '', 'SSL')); } $customer_id = $this->customer->getId(); //проверка на сушествование конкурса $contest_info = array(); if (isset($this->request->get['contest_id'])) { $contest_info = $this->model_contest_contest->getContest($this->request->get['contest_id']); } if (empty($contest_info)) { //редиректим на список конкурсов $this->session->data['redirect'] = $this->url->link('contest/contest', '', 'SSL'); $this->response->redirect($this->url->link('contest/contest', '', 'SSL')); } //если конкурс в статусе работа - редирект //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //проверка на сушествование проекта $project_info = array(); if (isset($this->request->get['project_id'])) { $project_info = $this->model_project_project->getProject($this->request->get['project_id']); } if (empty($project_info)) { //редиректим на список проектов $this->session->data['redirect'] = $this->url->link('project/project', '', 'SSL'); $this->response->redirect($this->url->link('project/project', '', 'SSL')); } $admin_project_id = $project_info['customer_id']; //проверка на админа группы if ($admin_project_id != $customer_id) { //редиректим на список проектов $this->session->data['redirect'] = $this->url->link('project/project', '', 'SSL'); $this->response->redirect($this->url->link('project/project', '', 'SSL')); } //*************************** проверки ********************************// if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) { //$this->model_contest_contest->addRequest($this->request->post,$customer_id); $this->session->data['success'] = $this->language->get('text_contest_success'); // Add to activity log $this->load->model('account/activity'); $activity_data = array('customer_id' => $customer_id, 'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()); $this->model_account_activity->addActivity('add project to contest', $activity_data); $this->response->redirect($this->url->link('account/account', '', 'SSL')); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home')); $data['breadcrumbs'][] = array('text' => $this->language->get('text_contests'), 'href' => $this->url->link('contest/contest', '', 'SSL')); $data['breadcrumbs'][] = array('text' => $contest_info['title'], 'href' => $this->url->link('contest/view', 'contest_id=' . $this->request->get['contest_id'], 'SSL')); $data['entry_title'] = $this->language->get('entry_title'); $data['entry_description'] = $this->language->get('entry_description'); $data['entry_image'] = $this->language->get('entry_image'); $data['entry_contest_birthday'] = $this->language->get('entry_contest_birthday'); $data['entry_contest_email'] = $this->language->get('entry_contest_email'); $data['entry_contest_dates'] = $this->language->get('entry_contest_dates'); $data['entry_contest_date_start'] = $this->language->get('entry_contest_date_start'); $data['entry_contest_datetime_end'] = $this->language->get('entry_contest_datetime_end'); $data['entry_contest_date_rate'] = $this->language->get('entry_contest_date_rate'); $data['entry_contest_date_result'] = $this->language->get('entry_contest_date_result'); $data['entry_contest_date_finalist'] = $this->language->get('entry_contest_date_finalist'); $data['entry_contest_organizer'] = $this->language->get('entry_contest_organizer'); $data['entry_contest_budget'] = $this->language->get('entry_contest_budget'); $data['entry_contest_propose'] = $this->language->get('entry_contest_propose'); $data['entry_contest_location'] = $this->language->get('entry_contest_location'); $data['entry_contest_members'] = $this->language->get('entry_contest_members'); $data['entry_contest_contacts'] = $this->language->get('entry_contest_contacts'); $data['entry_contest_timeline_text'] = $this->language->get('entry_contest_timeline_text'); $data['entry_contest_budget'] = $this->language->get('entry_contest_budget'); $data['entry_contest_maxprice'] = $this->language->get('entry_contest_maxprice'); $data['entry_contest_totalprice'] = $this->language->get('entry_contest_totalprice'); $data['text_create'] = $this->language->get('text_create'); $data['text_member'] = $this->language->get('text_member'); $data['text_submit'] = $this->language->get('text_submit'); $data['text_select'] = $this->language->get('text_select'); $data['contest_title'] = html_entity_decode($contest_info['title'], ENT_QUOTES, 'UTF-8'); $data['contest_description'] = html_entity_decode($contest_info['description'], ENT_QUOTES, 'UTF-8'); $data['contest_organizer'] = html_entity_decode($contest_info['organizer'], ENT_QUOTES, 'UTF-8'); $data['contest_propose'] = html_entity_decode($contest_info['propose'], ENT_QUOTES, 'UTF-8'); $data['contest_location'] = html_entity_decode($contest_info['location'], ENT_QUOTES, 'UTF-8'); $data['contest_members'] = html_entity_decode($contest_info['members'], ENT_QUOTES, 'UTF-8'); $data['contest_contacts'] = html_entity_decode($contest_info['contacts'], ENT_QUOTES, 'UTF-8'); $data['contest_timeline_text'] = html_entity_decode($contest_info['timeline_text'], ENT_QUOTES, 'UTF-8'); $data['contest_date_start'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_start'])); $data['contest_datetime_end'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['datetime_end'])); $data['contest_date_rate'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_rate'])); $data['contest_date_result'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_result'])); $data['contest_date_finalist'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_finalist'])); $data['image'] = ''; if (!empty($contest_info['image'])) { $data['image'] = $this->model_tool_image->resize($contest_info['image'], 800, 460, 'w'); } else { $data['image'] = $this->model_tool_image->resize('no-image.png', 800, 460, 'w'); } //************************* информация о пользователе *************************// $customer_info = $this->model_account_customer->getCustomer($customer_id); //стандартные поля $data['firstname'] = $customer_info['firstname']; $data['lastname'] = $customer_info['lastname']; $data['email'] = $customer_info['email']; $data['telephone'] = $customer_info['telephone']; // Custom Fields $this->load->model('account/custom_field'); $data['custom_fields'] = $this->model_account_custom_field->getCustomFields($this->config->get('config_customer_group_id')); $data['account_custom_field'] = unserialize($customer_info['custom_field']); if (!empty($customer_info) && !empty($customer_info['image'])) { if (preg_match('/http/', $customer_info['image'])) { $data['avatar'] = $customer_info['image']; } else { $upload_info = $this->model_tool_upload->getUploadByCode($customer_info['image']); $filename = $upload_info['filename']; $data['avatar'] = $this->model_tool_upload->resize($filename, 360, 490, 'h'); } } else { $data['avatar'] = $this->model_tool_image->resize('account.jpg', 360, 490, 'h'); } //************************* информация о группах *************************// //подтянем все активные группы //сделать рефактор заменить на IN () как getInfoCustomersForGroups $results_groups = $this->model_group_group->getGroups(); $data['init_groups'] = array(); foreach ($results_groups as $result_g) { if (!empty($result_g['image'])) { $upload_info = $this->model_tool_upload->getUploadByCode($result_g['image']); $filename = $upload_info['filename']; $image = $this->model_tool_upload->resize($filename, 300, 300, 'h'); } else { $image = $this->model_tool_image->resize('no-image.png', 300, 300, 'h'); } $filter_data = array(); $filter_data = array('filter_status' => 1, 'filter_init_group_id' => $result_g['init_group_id']); $results_count_customer_in_group = array(); $results_count_customer_in_group = $this->model_group_group->getInviteGroups($filter_data); $count = count($results_count_customer_in_group) + 1; $actions = array('view' => $this->url->link('group/view', 'group_id=' . $result_g['init_group_id'], 'SSL'), 'edit' => $this->url->link('group/edit', 'group_id=' . $result_g['init_group_id'], 'SSL'), 'invite' => $this->url->link('group/invite', 'group_id=' . $result_g['init_group_id'], 'SSL'), 'agree' => $this->url->link('group/invite/agree', 'group_id=' . $result_g['init_group_id'], 'SSL')); $data['init_groups'][$result_g['init_group_id']] = array('group_id' => $result_g['init_group_id'], 'group_title' => $result_g['title'], 'group_image' => $image, 'group_customer_count' => $count, 'action' => $actions); } //группы где пользователь администратор $results_admin_groups = $this->model_group_group->getGroupsForAdmin($customer_id); $data['admin_init_groups'] = array(); foreach ($results_admin_groups as $result) { $data['admin_init_groups'][] = array('group_id' => $result['init_group_id']); } //************************* информация о проекте *************************// $project_id = $this->request->get['project_id']; $data['project_title'] = html_entity_decode($project_info['title'], ENT_QUOTES, 'UTF-8'); $data['project_description'] = html_entity_decode($project_info['description'], ENT_QUOTES, 'UTF-8'); $data['image'] = ''; if (!empty($project_info['image'])) { $upload_info = $this->model_tool_upload->getUploadByCode($project_info['image']); $filename = $upload_info['filename']; $data['image'] = $this->model_tool_upload->resize($filename, 800, 460, 'w'); } else { $data['image'] = $this->model_tool_image->resize('no-image.png', 800, 460, 'w'); } $data['project_birthday'] = rus_date($this->language->get('date_day_date_format'), strtotime($project_info['project_birthday'])); //подтянем администратора группы $admin_id = $project_info['customer_id']; //************************* информация о конкурсе *************************// $contest_id = $this->request->get['contest_id']; //подтянем поля для заполнения $data['contest_field_system']['customer'] = array(); //поля пользователя $data['contest_field_system']['customer']['firstname'] = array('field_value' => $customer_info['firstname'], 'field_type' => 'text'); $data['contest_field_system']['customer']['lastname'] = array('field_value' => $customer_info['lastname'], 'field_type' => 'text'); $data['contest_field_system']['customer']['email'] = array('field_value' => $customer_info['email'], 'field_type' => 'text'); $data['contest_field_system']['customer']['telephone'] = array('field_value' => $customer_info['telephone'], 'field_type' => 'text'); //подтянем список доступных категорий $data['custom_fields'] = unserialize($contest_info["contest_fields"]); $data['category_requestes'] = array(); $filter_data = array('order' => 'ASC'); $category_request_results = $this->model_localisation_category_request->getCategoryRequestes($filter_data); foreach ($category_request_results as $crr) { $data['category_requestes'][] = array('category_request_id' => $crr['category_request_id'], 'name' => $crr['name']); } //подтянуть список полей для кактегорий $this->load->model('contest/contest_field'); $filter_data = array('order' => 'ASC'); $contest_fields_results = $this->model_contest_contest_field->getContestFields($filter_data); //получим список все полей $data['contest_fields'] = array(); foreach ($contest_fields_results as $cfr) { if (!empty($data['custom_fields'][$cfr['location']])) { foreach ($data['custom_fields'][$cfr['location']] as $cvalue) { if ($cvalue['contest_field_id'] == $cfr['contest_field_id']) { $status = $cvalue['status']; $sort_order = $cvalue['sort_order']; } } } else { $status = 0; $sort_order = 0; } //если пречисляемый тип и не системны $contest_fields_value = ''; if (($cfr['type'] == 'select' || $cfr['type'] == 'radio' || $cfr['type'] == 'checkbox') && $cfr['field_system'] == 'custom') { $contest_fields_value = $this->model_contest_contest_field->getContestFieldValues($cfr['contest_field_id']); $type = $cfr['type']; } elseif ($cfr['field_system'] != 'custom') { $contest_fields_value = $data['contest_field_system'][$cfr['field_system_table']][$cfr['field_system']]['field_value']; $type = $data['contest_field_system'][$cfr['field_system_table']][$cfr['field_system']]['field_type']; } else { $contest_fields_value = ''; $type = $cfr['type']; } $data['contest_fields'][$cfr['location']][] = array('contest_field_id' => $cfr['contest_field_id'], 'contest_field_title' => $cfr['name'], 'contest_field_value' => $contest_fields_value, 'contest_field_type' => $type, 'contest_field_system' => $cfr['field_system'], 'contest_field_system_table' => $cfr['field_system_table'], 'contest_field_status' => $status, 'sort_order' => $sort_order); } foreach ($data['contest_fields'] as $cfr) { usort($cfr, 'sortBySortOrder'); } //пост который отсылаем $data['register_custom_field'] = array(); $data['action'] = $this->url->link('contest/send', 'contest_id=' . $contest_id . '&project_id=' . $project_id, 'SSL'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/contest/contest_send.tpl')) { $this->document->addScript('catalog/view/theme/' . $this->config->get('config_template') . '/assets/js/contest.js'); } else { $this->document->addScript('catalog/view/theme/default/assets/js/contest.js'); } $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/contest/contest_send.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/contest/contest_send.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/contest/contest_send.tpl', $data)); } }
public function view() { if (isset($this->request->get['occasion_id'])) { $occasion_id = (int) $this->request->get['occasion_id']; } else { $this->response->redirect($this->url->link('common/home', '', 'SSL')); } $this->load->language('information/occasion'); $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', '', 'SSL')); $data['button_play'] = $this->language->get('button_play'); $data['text_metro'] = $this->language->get('text_metro'); $data['text_place'] = $this->language->get('text_place'); $data['text_best_price'] = $this->language->get('text_best_price'); //вынести в конфиг $this->load->model('localisation/language'); $this->load->model('catalog/occasion'); $this->load->model('catalog/occasion_group'); $this->load->model('catalog/season'); $this->load->model('catalog/place'); $this->load->model('tool/image'); $this->load->model('catalog/metro'); $language_results = $this->model_localisation_language->getLanguages(); $language_code = $this->language->get('code'); foreach ($language_results as $result) { if ($result['code'] == $language_code) { $language_id = $result['language_id']; } } //подтянем информацию о событии $occasion_info = $this->model_catalog_occasion->getOccasion($occasion_id); //Подтянем статус $occasion_status = $occasion_info['status']; $occasion_season_id = $occasion_info['occasion_season_id']; //сезон $data['occasion_season'] = $this->model_catalog_season->getSeason($occasion_season_id); //формат $data['occasion_groups'] = array(); $occasion_groups = array(); $occasion_groups = $this->model_catalog_occasion_group->getOccasionGroups(); foreach ($occasion_groups as $occasion_group) { $data['occasion_groups'][$occasion_group['occasion_group_id']] = array('occasion_group_id' => $occasion_group['occasion_group_id'], 'title' => $occasion_group['title']); } $current_occasion_groups = $this->model_catalog_occasion->getOccasionToOccasionGroup($occasion_id); $data['current_occasion_group'] = ''; foreach ($current_occasion_groups as $group) { $data['current_occasion_group'] = $data['occasion_groups'][$group]['title']; break; } //подтянем информацию о месте $occasion_place_id = $occasion_info['occasion_place_id']; $data['occasion_place'] = $this->model_catalog_place->getPlace($occasion_place_id); $data['occasion_place']['href'] = $this->url->link('information/occasion/view', 'occasion_id=' . $occasion_id, 'SSL'); $data['occasion_place_description'] = html_entity_decode($data['occasion_place']['description'], ENT_QUOTES); $data['occasion_place_address'] = html_entity_decode($data['occasion_place']['address'], ENT_QUOTES); //получим изображения стадиона $occasion_place_images = $this->model_catalog_place->getPlaceImages($occasion_place_id); $data['occasion_place']['images'] = array(); foreach ($occasion_place_images as $occasion_place_image) { $data['occasion_place']['images'][] = array('title' => $occasion_place_image['place_image_description'][$language_id]['title'], 'image_full' => $this->model_tool_image->resize($occasion_place_image['image'], 1920, 1280, 'w'), 'image' => $this->model_tool_image->resize($occasion_place_image['image'], 950, 450, 'w')); } //получим метро $metro = $this->model_catalog_metro->getMetroDescription($data['occasion_place']['metro_id']); $data['occasion_place']['metro_title'] = $metro['name']; $data['occasion'] = $occasion_info; //получим изображения события $occasion_images = $this->model_catalog_occasion->getOccasionImages($occasion_id); foreach ($occasion_images as $occasion_image) { $data['occasion']['images'][] = array('title' => $occasion_image['occasion_image_description'][$language_id]['title'], 'image_full' => $this->model_tool_image->resize($occasion_image['image'], 1920, 1280, 'w'), 'image' => $this->model_tool_image->resize($occasion_image['image'], 950, 450, 'w')); } //получим видео для события $occasion_videos = $this->model_catalog_occasion->getOccasionVideos($occasion_id); foreach ($occasion_videos as $occasion_video) { $data['occasion']['videos'][] = array('title' => $occasion_video['occasion_video_description'][$language_id]['title'], 'link' => $occasion_video['link']); } //основное изображение if (!empty($data['occasion']['images'][0])) { $data['hero_image'] = $data['occasion']['images'][0]['image_full']; } else { $data['hero_image'] = $this->model_tool_image->resize('placeholder.png', 1920, 1280, 'h'); } $date_occasion = rus_date($this->language->get('occasion_date_day_date_format'), strtotime($occasion_info['occasion_date'])); $date_occasion_day = rus_date($this->language->get('occasion_date_day_format'), strtotime($occasion_info['occasion_date'])); if ($occasion_status != 1) { $template_name = '/template/information/report_occasion.tpl'; //seo $this->document->setTitle('Отчет - ' . $occasion_info['meta_title']); $this->document->setDescription($occasion_info['meta_description']); $this->document->setKeywords($occasion_info['meta_keyword']); $data['heading_title'] = 'Отчет - ' . sprintf($this->language->get('heading_title'), $occasion_info['title'], $date_occasion, $date_occasion_day); $data['text_description_heading'] = $this->language->get('text_description_heading'); } else { $template_name = '/template/information/occasion.tpl'; //seo $this->document->setTitle($occasion_info['meta_title']); $this->document->setDescription($occasion_info['meta_description']); $this->document->setKeywords($occasion_info['meta_keyword']); $data['heading_title'] = sprintf($this->language->get('heading_title'), $occasion_info['title'], $date_occasion, $date_occasion_day); $data['text_description_heading'] = $this->language->get('text_description_heading'); } $data['text_game_heading'] = sprintf($this->language->get('text_game_heading'), $occasion_info['title'], $data['occasion_place']['title']); $data['text_photo_place'] = $this->language->get('text_photo_place'); $data['text_description_place'] = $this->language->get('text_description_place'); $data['text_address_place'] = $this->language->get('text_address_place'); $data['text_season'] = $this->language->get('text_season'); $data['text_date'] = sprintf($this->language->get('text_date'), $date_occasion); $data['text_metro'] = $this->language->get('text_metro'); $data['text_format_group'] = $this->language->get('text_format_group'); $price = (int) $occasion_info['best_price'] > 0 ? $occasion_info['best_price'] : $occasion_info['price']; $data['text_price'] = sprintf($this->language->get('text_price'), $price); $data['description'] = html_entity_decode($occasion_info['description'], ENT_QUOTES); $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $template_name)) { $this->response->setOutput($this->load->view($this->config->get('config_template') . $template_name, $data)); } else { $this->response->setOutput($this->load->view('default' . $template_name, $data)); } }
public function view() { if (isset($this->request->get['place_id'])) { $place_id = (int) $this->request->get['place_id']; } else { $this->response->redirect($this->url->link('common/home', '', 'SSL')); } $this->load->language('information/place'); $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', '', 'SSL')); $data['button_play'] = $this->language->get('button_play'); $data['text_metro'] = $this->language->get('text_metro'); $data['text_place'] = $this->language->get('text_place'); $data['text_best_price'] = $this->language->get('text_best_price'); //вынести в конфиг $this->load->model('localisation/language'); $this->load->model('catalog/place'); $this->load->model('tool/image'); $this->load->model('catalog/metro'); $language_results = $this->model_localisation_language->getLanguages(); $language_code = $this->language->get('code'); foreach ($language_results as $result) { if ($result['code'] == $language_code) { $language_id = $result['language_id']; } } //подтянем информацию о месте $place_info = $this->model_catalog_place->getPlace($place_id); //seo $this->document->setTitle($place_info['meta_title']); $this->document->setDescription($place_info['meta_description']); $this->document->setKeywords($place_info['meta_keyword']); $data['heading_title'] = $place_info['title']; $data['description'] = html_entity_decode($place_info['description'], ENT_QUOTES); $data['place_address'] = html_entity_decode($place_info['address'], ENT_QUOTES); $data['latitude_longitude'] = $place_info['latitude_longitude']; $data['place_date'] = rus_date($this->language->get('date_day_date_format'), strtotime($place_info['place_date'])); //получим изображения стадиона $place_images = $this->model_catalog_place->getPlaceImages($place_id); $data['images'] = array(); foreach ($place_images as $place_image) { $data['images'][] = array('title' => $place_image['place_image_description'][$language_id]['title'], 'image_full' => $this->model_tool_image->resize($place_image['image'], 1920, 1280, 'w'), 'image' => $this->model_tool_image->resize($place_image['image'], 950, 450, 'w')); } //получим метро $metro = $this->model_catalog_metro->getMetroDescription($place_info['metro_id']); //основное изображение if (!empty($data['images'][0])) { $data['hero_image'] = $data['images'][0]['image_full']; } else { $data['hero_image'] = $this->model_tool_image->resize('placeholder.png', 1920, 1280, 'w'); } $data['heading_title'] = $place_info['title']; $data['text_description_heading'] = $this->language->get('text_description_heading'); $data['text_photo_place'] = $this->language->get('text_photo_place'); $data['text_description_place'] = $this->language->get('text_description_place'); $data['text_address_place'] = $this->language->get('text_address_place'); $data['text_metro'] = $this->language->get('text_metro'); $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/place.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/place.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/information/place.tpl', $data)); } }
function get_subscription_end($user_id) { $duration = 'Не оплачено'; if (get_user_meta($user_id, 'subscription_duration')) { $curr_dur = get_user_meta($user_id, 'subscription_duration', 1); // prn($curr_dur); $duration = 'Оплачено до: ' . rus_date("j F Y", $curr_dur); } return $duration; }
private function getView() { //************** проверки ***************// //если конкурс в статусе работа - редирект //подгрузим язык $this->load->language('contest/view'); //выводим инфу о текщей проекте $contest_id = $this->request->get['contest_id']; //для шифрования $data['contest_id'] = $contest_id; //подгрузим модели $this->load->model('account/customer'); $this->load->model('contest/contest'); $this->load->model('tool/upload'); $this->load->model('tool/image'); $contest_info = array(); if (isset($this->request->get['contest_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') { $contest_info = $this->model_contest_contest->getContest($this->request->get['contest_id']); } //проверим сушествоание группы if (empty($contest_info)) { //редиректим на список $this->session->data['redirect'] = $this->url->link('contest/contest', '', 'SSL'); $this->response->redirect($this->url->link('contest/contest', '', 'SSL')); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home')); $data['breadcrumbs'][] = array('text' => $this->language->get('text_contests'), 'href' => $this->url->link('contest/contest', '', 'SSL')); $data['breadcrumbs'][] = array('text' => $contest_info['title'], 'href' => $this->url->link('contest/view', 'contest_id=' . $data['contest_id'], 'SSL')); if (isset($this->session->data['success'])) { $data['success'] = $this->session->data['success']; unset($this->session->data['success']); } else { $data['success'] = ''; } $this->document->setTitle($contest_info['title']); $this->document->setDescription(substr(strip_tags(html_entity_decode($contest_info['meta_description'], ENT_QUOTES)), 0, 150) . '...'); //$this->document->setKeywords($contest_info['meta_keyword']); $data['entry_title'] = $this->language->get('entry_title'); $data['entry_description'] = $this->language->get('entry_description'); $data['entry_image'] = $this->language->get('entry_image'); $data['entry_contest_birthday'] = $this->language->get('entry_contest_birthday'); $data['entry_contest_email'] = $this->language->get('entry_contest_email'); $data['entry_contest_dates'] = $this->language->get('entry_contest_dates'); $data['entry_contest_date_start'] = $this->language->get('entry_contest_date_start'); $data['entry_contest_datetime_end'] = $this->language->get('entry_contest_datetime_end'); $data['entry_contest_date_rate'] = $this->language->get('entry_contest_date_rate'); $data['entry_contest_date_result'] = $this->language->get('entry_contest_date_result'); $data['entry_contest_date_finalist'] = $this->language->get('entry_contest_date_finalist'); $data['entry_contest_organizer'] = $this->language->get('entry_contest_organizer'); $data['entry_contest_budget'] = $this->language->get('entry_contest_budget'); $data['entry_contest_propose'] = $this->language->get('entry_contest_propose'); $data['entry_contest_location'] = $this->language->get('entry_contest_location'); $data['entry_contest_members'] = $this->language->get('entry_contest_members'); $data['entry_contest_contacts'] = $this->language->get('entry_contest_contacts'); $data['entry_contest_timeline_text'] = $this->language->get('entry_contest_timeline_text'); $data['entry_contest_budget'] = $this->language->get('entry_contest_budget'); $data['entry_contest_maxprice'] = $this->language->get('entry_contest_maxprice'); $data['entry_contest_totalprice'] = $this->language->get('entry_contest_totalprice'); $data['text_create'] = $this->language->get('text_create'); $data['text_member'] = $this->language->get('text_member'); $data['contest_title'] = html_entity_decode($contest_info['title'], ENT_QUOTES, 'UTF-8'); $data['contest_description'] = html_entity_decode($contest_info['description'], ENT_QUOTES, 'UTF-8'); $data['contest_organizer'] = html_entity_decode($contest_info['organizer'], ENT_QUOTES, 'UTF-8'); $data['contest_propose'] = html_entity_decode($contest_info['propose'], ENT_QUOTES, 'UTF-8'); $data['contest_location'] = html_entity_decode($contest_info['location'], ENT_QUOTES, 'UTF-8'); $data['contest_members'] = html_entity_decode($contest_info['members'], ENT_QUOTES, 'UTF-8'); $data['contest_contacts'] = html_entity_decode($contest_info['contacts'], ENT_QUOTES, 'UTF-8'); $data['contest_timeline_text'] = html_entity_decode($contest_info['timeline_text'], ENT_QUOTES, 'UTF-8'); $data['contest_date_start'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_start'])); $data['contest_datetime_end'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['datetime_end'])); $data['contest_date_rate'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_rate'])); $data['contest_date_result'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_result'])); $data['contest_date_finalist'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_finalist'])); $data['image'] = ''; if (!empty($contest_info['image'])) { $data['image'] = $this->model_tool_image->resize($contest_info['image'], 800, 460, 'w'); } else { $data['image'] = $this->model_tool_image->resize('no-image.png', 800, 460, 'w'); } //ссылка на участие $data['text_im_deal'] = $this->language->get('text_im_deal'); $data['im_deal'] = $this->url->link('contest/deal', 'contest_id=' . $data['contest_id'], 'SSL'); //добавм проверку на логин пользователя if (!$this->customer->isLogged()) { } else { } $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/contest/contest_view.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/contest/contest_view.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/contest/contest_view.tpl', $data)); } }
private function getView() { //подгрузим язык $this->load->language('project/view'); //выводим инфу о текщей проекте $project_id = $this->request->get['project_id']; //для шифрования $data['project_id'] = $project_id; //подгрузим модели $this->load->model('account/customer'); $this->load->model('project/project'); $this->load->model('tool/upload'); $this->load->model('tool/image'); $project_info = array(); if (isset($this->request->get['project_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') { $project_info = $this->model_project_project->getProject($this->request->get['project_id']); } //проверим сушествоание проекта if (empty($project_info)) { //редиректим на список $this->session->data['redirect'] = $this->url->link('project/project', '', 'SSL'); $this->response->redirect($this->url->link('project/project', '', 'SSL')); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home')); $data['breadcrumbs'][] = array('text' => $this->language->get('text_projects'), 'href' => $this->url->link('project/project', '', 'SSL')); $data['breadcrumbs'][] = array('text' => $project_info['title'], 'href' => $this->url->link('project/view', 'project_id=' . $data['project_id'], 'SSL')); if (isset($this->session->data['success'])) { $data['success'] = $this->session->data['success']; unset($this->session->data['success']); } else { $data['success'] = ''; } $this->document->setTitle($project_info['title']); $this->document->setDescription(substr(strip_tags(html_entity_decode($project_info['meta_description'], ENT_QUOTES)), 0, 150) . '...'); //$this->document->setKeywords($project_info['meta_keyword']); $data['entry_title'] = $this->language->get('entry_title'); $data['entry_description'] = $this->language->get('entry_description'); $data['entry_image'] = $this->language->get('entry_image'); $data['entry_project_birthday'] = $this->language->get('entry_project_birthday'); $data['entry_project_email'] = $this->language->get('entry_project_email'); $data['text_create'] = $this->language->get('text_create'); $data['text_member'] = $this->language->get('text_member'); $data['project_title'] = html_entity_decode($project_info['title'], ENT_QUOTES, 'UTF-8'); $data['project_description'] = html_entity_decode($project_info['description'], ENT_QUOTES, 'UTF-8'); $data['image'] = ''; if (!empty($project_info['image'])) { $upload_info = $this->model_tool_upload->getUploadByCode($project_info['image']); $filename = $upload_info['filename']; $data['image'] = $this->model_tool_upload->resize($filename, 800, 460, 'w'); } else { $data['image'] = $this->model_tool_image->resize('no-image.png', 800, 460, 'w'); } $data['project_birthday'] = rus_date($this->language->get('date_day_date_format'), strtotime($project_info['project_birthday'])); //подтянем администратора группы $admin_id = $project_info['customer_id']; $admin_id_hash = $admin_id; $data['admin_info'] = $this->model_account_customer->getCustomer($admin_id); $data['link_admin'] = $this->url->link('account/info', 'ch=' . $admin_id_hash, 'SSL'); $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/project/project_view.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/project/project_view.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/project/project_view.tpl', $data)); } }
private function getView() { //подгрузим язык $this->load->language('group/view'); //выводим инфу о текщей группе $group_id = $this->request->get['group_id']; //для шифтрования $data['group_id'] = $group_id; //подгрузим модели $this->load->model('account/customer'); $this->load->model('group/group'); $this->load->model('tool/upload'); $this->load->model('tool/image'); $group_info = array(); if (isset($this->request->get['group_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') { $group_info = $this->model_group_group->getGroup($this->request->get['group_id']); } //проверим сушествоание группы if (empty($group_info)) { //редиректим на список $this->session->data['redirect'] = $this->url->link('group/group', '', 'SSL'); $this->response->redirect($this->url->link('group/group', '', 'SSL')); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home')); $data['breadcrumbs'][] = array('text' => $this->language->get('text_groups'), 'href' => $this->url->link('group/group', '', 'SSL')); $data['breadcrumbs'][] = array('text' => $group_info['title'], 'href' => $this->url->link('group/view', 'group_id=' . $data['group_id'], 'SSL')); if (isset($this->session->data['success'])) { $data['success'] = $this->session->data['success']; unset($this->session->data['success']); } else { $data['success'] = ''; } $this->document->setTitle($group_info['title']); $this->document->setDescription(substr(strip_tags(html_entity_decode($group_info['meta_description'], ENT_QUOTES)), 0, 150) . '...'); //$this->document->setKeywords($group_info['meta_keyword']); $data['entry_title'] = $this->language->get('entry_title'); $data['entry_description'] = $this->language->get('entry_description'); $data['entry_image'] = $this->language->get('entry_image'); $data['entry_group_birthday'] = $this->language->get('entry_group_birthday'); $data['entry_group_email'] = $this->language->get('entry_group_email'); $data['text_create'] = $this->language->get('text_create'); $data['text_member'] = $this->language->get('text_member'); $data['group_title'] = html_entity_decode($group_info['title'], ENT_QUOTES, 'UTF-8'); $data['group_description'] = html_entity_decode($group_info['description'], ENT_QUOTES, 'UTF-8'); $data['image'] = ''; if (!empty($group_info['image'])) { $upload_info = $this->model_tool_upload->getUploadByCode($group_info['image']); $filename = $upload_info['filename']; $data['image'] = $this->model_tool_upload->resize($filename, 800, 460, 'w'); } else { $data['image'] = $this->model_tool_image->resize('no-image.png', 800, 460, 'w'); } $data['group_birthday'] = rus_date($this->language->get('date_day_date_format'), strtotime($group_info['group_birthday'])); //подтянем администратора группы $admin_id = $group_info['customer_id']; $admin_id_hash = $admin_id; $data['admin_info'] = $this->model_account_customer->getCustomer($admin_id); $data['link_admin'] = $this->url->link('account/info', 'ch=' . $admin_id_hash, 'SSL'); //подтянем остальных пользователей для данноой группы $data['customer_agree_groups'] = array(); $filter_data = array(); $filter_data = array('filter_init_group_id' => $this->request->get['group_id'], 'filter_status' => 1); $results_customer_agree_groups = array(); $results_customer_agree_groups = $this->model_group_group->getInviteGroups($filter_data); $data['customer_agree_groups'] = array(); $data['customer_agree_groups'][] = $admin_id; foreach ($results_customer_agree_groups as $result_cag) { $data['customer_agree_groups'][] = $result_cag['customer_id']; } $data['count_customers'] = count($data['customer_agree_groups']) + 1; //подтянем информацию о пользователях $results_customer_for_group = array(); $results_customer_for_group = $this->model_account_customer->getInfoCustomersForGroups($data['customer_agree_groups']); foreach ($results_customer_for_group as $result_cfg) { if (preg_match('/http/', $result_cfg['image'])) { $image = $result_cfg['image']; } else { if (!empty($result_cfg['image'])) { $upload_info = $this->model_tool_upload->getUploadByCode($result_cfg['image']); $filename = $upload_info['filename']; $image = $this->model_tool_upload->resize($filename, 300, 300, 'h'); } else { $image = $this->model_tool_image->resize('no-image.png', 300, 300, 'h'); } } $customer_id_hash = $result_cfg['customer_id']; $actions = array('info' => $this->url->link('account/info', 'ch=' . $customer_id_hash, 'SSL')); $data['customers'][] = array('customer_id' => $result_cfg['customer_id'], 'customer_id_hash' => $customer_id_hash, 'customer_name' => $result_cfg['name'], 'customer_image' => $image, 'action' => $actions); } $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/group/group_view.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/group/group_view.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/group/group_view.tpl', $data)); } }
private function getView() { //************** проверки ***************// if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->url->link('account/account', '', 'SSL'); $this->response->redirect($this->url->link('account/account', '', 'SSL')); } //если конкурс в статусе работа - редирект //подгрузим язык $this->load->language('contest/deal'); //SEO $this->document->setTitle($this->language->get('entry_title')); //$this->document->setDescription(substr(strip_tags(html_entity_decode($contest_info['meta_description'], ENT_QUOTES)), 0, 150) . '...'); //$this->document->setKeywords($contest_info['meta_keyword']); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } $data['entry_title'] = $this->language->get('entry_title'); $data['entry_description'] = $this->language->get('entry_description'); $data['entry_image'] = $this->language->get('entry_image'); $data['entry_contest_birthday'] = $this->language->get('entry_contest_birthday'); $data['entry_contest_email'] = $this->language->get('entry_contest_email'); $data['entry_contest_dates'] = $this->language->get('entry_contest_dates'); $data['entry_contest_date_start'] = $this->language->get('entry_contest_date_start'); $data['entry_contest_datetime_end'] = $this->language->get('entry_contest_datetime_end'); $data['entry_contest_date_rate'] = $this->language->get('entry_contest_date_rate'); $data['entry_contest_date_result'] = $this->language->get('entry_contest_date_result'); $data['entry_contest_date_finalist'] = $this->language->get('entry_contest_date_finalist'); $data['entry_contest_organizer'] = $this->language->get('entry_contest_organizer'); $data['entry_contest_budget'] = $this->language->get('entry_contest_budget'); $data['entry_contest_propose'] = $this->language->get('entry_contest_propose'); $data['entry_contest_location'] = $this->language->get('entry_contest_location'); $data['entry_contest_members'] = $this->language->get('entry_contest_members'); $data['entry_contest_contacts'] = $this->language->get('entry_contest_contacts'); $data['entry_contest_timeline_text'] = $this->language->get('entry_contest_timeline_text'); $data['entry_contest_budget'] = $this->language->get('entry_contest_budget'); $data['entry_contest_maxprice'] = $this->language->get('entry_contest_maxprice'); $data['entry_contest_totalprice'] = $this->language->get('entry_contest_totalprice'); $data['text_create'] = $this->language->get('text_create'); $data['text_member'] = $this->language->get('text_member'); $contest_id = $this->request->get['contest_id']; //для шифрования $data['contest_id'] = $contest_id; //подгрузим модели $this->load->model('account/customer'); $this->load->model('contest/contest'); $this->load->model('project/project'); $this->load->model('group/group'); $this->load->model('tool/upload'); $this->load->model('tool/image'); $contest_info = array(); if (isset($this->request->get['contest_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') { $contest_info = $this->model_contest_contest->getContest($this->request->get['contest_id']); } //проверим сушествоание группы if (empty($contest_info)) { //редиректим на список $this->session->data['redirect'] = $this->url->link('contest/contest', '', 'SSL'); $this->response->redirect($this->url->link('contest/contest', '', 'SSL')); } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home')); $data['breadcrumbs'][] = array('text' => $this->language->get('text_contests'), 'href' => $this->url->link('contest/contest', '', 'SSL')); $data['breadcrumbs'][] = array('text' => $contest_info['title'], 'href' => $this->url->link('contest/view', 'contest_id=' . $data['contest_id'], 'SSL')); $data['contest_title'] = html_entity_decode($contest_info['title'], ENT_QUOTES, 'UTF-8'); $data['contest_description'] = html_entity_decode($contest_info['description'], ENT_QUOTES, 'UTF-8'); $data['contest_organizer'] = html_entity_decode($contest_info['organizer'], ENT_QUOTES, 'UTF-8'); $data['contest_propose'] = html_entity_decode($contest_info['propose'], ENT_QUOTES, 'UTF-8'); $data['contest_location'] = html_entity_decode($contest_info['location'], ENT_QUOTES, 'UTF-8'); $data['contest_members'] = html_entity_decode($contest_info['members'], ENT_QUOTES, 'UTF-8'); $data['contest_contacts'] = html_entity_decode($contest_info['contacts'], ENT_QUOTES, 'UTF-8'); $data['contest_timeline_text'] = html_entity_decode($contest_info['timeline_text'], ENT_QUOTES, 'UTF-8'); $data['contest_date_start'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_start'])); $data['contest_datetime_end'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['datetime_end'])); $data['contest_date_rate'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_rate'])); $data['contest_date_result'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_result'])); $data['contest_date_finalist'] = rus_date($this->language->get('date_day_date_format'), strtotime($contest_info['date_finalist'])); $data['image'] = ''; if (!empty($contest_info['image'])) { $data['image'] = $this->model_tool_image->resize($contest_info['image'], 800, 460, 'w'); } else { $data['image'] = $this->model_tool_image->resize('no-image.png', 800, 460, 'w'); } //ссылка на участие $data['text_im_deal'] = $this->language->get('text_im_deal'); $data['im_deal'] = $this->url->link('contest/deal', 'contest_id=' . $data['contest_id'], 'SSL'); //информация о пользователе $customer_info = $this->model_account_customer->getCustomer($this->customer->getId()); $customer_id = $this->customer->getId(); //стандартные поля $data['firstname'] = $customer_info['firstname']; $data['lastname'] = $customer_info['lastname']; $data['email'] = $customer_info['email']; $data['telephone'] = $customer_info['telephone']; // Custom Fields $this->load->model('account/custom_field'); $data['custom_fields'] = $this->model_account_custom_field->getCustomFields($this->config->get('config_customer_group_id')); $data['account_custom_field'] = unserialize($customer_info['custom_field']); if (!empty($customer_info) && !empty($customer_info['image'])) { if (preg_match('/http/', $customer_info['image'])) { $data['avatar'] = $customer_info['image']; } else { $upload_info = $this->model_tool_upload->getUploadByCode($customer_info['image']); $filename = $upload_info['filename']; $data['avatar'] = $this->model_tool_upload->resize($filename, 360, 490, 'h'); } } else { $data['avatar'] = $this->model_tool_image->resize('account.jpg', 360, 490, 'h'); } //подтянем все активные группы //сделать рефактор заменить на IN () как getInfoCustomersForGroups $results_groups = $this->model_group_group->getGroups(); $data['init_groups'] = array(); foreach ($results_groups as $result_g) { if (!empty($result_g['image'])) { $upload_info = $this->model_tool_upload->getUploadByCode($result_g['image']); $filename = $upload_info['filename']; $image = $this->model_tool_upload->resize($filename, 300, 300, 'h'); } else { $image = $this->model_tool_image->resize('no-image.png', 300, 300, 'h'); } $filter_data = array(); $filter_data = array('filter_status' => 1, 'filter_init_group_id' => $result_g['init_group_id']); $results_count_customer_in_group = array(); $results_count_customer_in_group = $this->model_group_group->getInviteGroups($filter_data); $count = count($results_count_customer_in_group) + 1; $actions = array('view' => $this->url->link('group/view', 'group_id=' . $result_g['init_group_id'], 'SSL'), 'edit' => $this->url->link('group/edit', 'group_id=' . $result_g['init_group_id'], 'SSL'), 'invite' => $this->url->link('group/invite', 'group_id=' . $result_g['init_group_id'], 'SSL'), 'agree' => $this->url->link('group/invite/agree', 'group_id=' . $result_g['init_group_id'], 'SSL')); $data['init_groups'][$result_g['init_group_id']] = array('group_id' => $result_g['init_group_id'], 'group_title' => $result_g['title'], 'group_image' => $image, 'group_customer_count' => $count, 'action' => $actions); } //группы где пользователь администратор $results_admin_groups = $this->model_group_group->getGroupsForAdmin($customer_id); $data['admin_init_groups'] = array(); foreach ($results_admin_groups as $result) { $data['admin_init_groups'][] = array('group_id' => $result['init_group_id']); } //подтянем информацию ос ушествующих у пользователя проетках //информация о проектах где пользователь я вляется admin $results_projects_for_customer = $this->model_project_project->getProjectsForAdmin($customer_id); $data['projects_for_customer'] = array(); foreach ($results_projects_for_customer as $result_pfc) { if (!empty($result_pfc['image'])) { $upload_info = $this->model_tool_upload->getUploadByCode($result_pfc['image']); $filename = $upload_info['filename']; $image = $this->model_tool_upload->resize($filename, 300, 300, 'h'); } else { $image = $this->model_tool_image->resize('no-image.png', 300, 300, 'h'); } $actions = array(); $actions = array('edit' => $this->url->link('project/edit', 'project_id=' . $result_pfc['project_id'], 'SSL')); $data['projects_for_customer'][] = array('project_id' => $result_pfc['project_id'], 'project_title' => $result_pfc['title'], 'project_image' => $image, 'prject_action' => $actions); } /******************* /.проекты *******************/ $data['action'] = $this->url->link('contest/send', 'contest_id=' . $contest_id, 'SSL'); ///нужна ли группа для участия в конкурсе????? if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/contest/contest_deal.tpl')) { $this->document->addScript('catalog/view/theme/' . $this->config->get('config_template') . '/assets/js/contest.js'); } else { $this->document->addScript('catalog/view/theme/default/assets/js/contest.js'); } $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/contest/contest_deal.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/contest/contest_deal.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/contest/contest_deal.tpl', $data)); } }
protected function getList() { if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { $sort = 'd.occasion_date'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'DESC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')); $data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('catalog/occasion', 'token=' . $this->session->data['token'] . $url, 'SSL')); $data['add'] = $this->url->link('catalog/occasion/add', 'token=' . $this->session->data['token'] . $url, 'SSL'); $data['delete'] = $this->url->link('catalog/occasion/delete', 'token=' . $this->session->data['token'] . $url, 'SSL'); $data['copy'] = $this->url->link('catalog/occasion/copy', 'token=' . $this->session->data['token'] . $url, 'SSL'); $data['occasions'] = array(); $filter_data = array('sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $this->config->get('config_limit_admin'), 'limit' => $this->config->get('config_limit_admin')); $occasion_total = $this->model_catalog_occasion->getTotalOccasions(); $results = $this->model_catalog_occasion->getOccasions($filter_data); foreach ($results as $result) { $data['occasions'][] = array('occasion_id' => $result['occasion_id'], 'title' => $result['title'], 'occasion_date_day' => rus_date($this->language->get('occasion_date_day_format'), strtotime($result['occasion_date'])), 'occasion_date' => rus_date($this->language->get('occasion_date_day_date_format'), strtotime($result['occasion_date'])), 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'edit' => $this->url->link('catalog/occasion/edit', 'token=' . $this->session->data['token'] . '&occasion_id=' . $result['occasion_id'] . $url, 'SSL')); } $data['heading_title'] = $this->language->get('heading_title'); $data['text_list'] = $this->language->get('text_list'); $data['text_no_results'] = $this->language->get('text_no_results'); $data['text_confirm'] = $this->language->get('text_confirm'); $data['column_occasion_date'] = $this->language->get('column_occasion_date'); $data['column_title'] = $this->language->get('column_title'); $data['column_date_added'] = $this->language->get('column_date_added'); $data['column_action'] = $this->language->get('column_action'); $data['button_add'] = $this->language->get('button_add'); $data['button_edit'] = $this->language->get('button_edit'); $data['button_copy'] = $this->language->get('button_copy'); $data['button_delete'] = $this->language->get('button_delete'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } if (isset($this->session->data['success'])) { $data['success'] = $this->session->data['success']; unset($this->session->data['success']); } else { $data['success'] = ''; } if (isset($this->request->post['selected'])) { $data['selected'] = (array) $this->request->post['selected']; } else { $data['selected'] = array(); } $url = ''; if ($order == 'ASC') { $url .= '&order=DESC'; } else { $url .= '&order=ASC'; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } $data['sort_title'] = $this->url->link('catalog/occasion', 'token=' . $this->session->data['token'] . '&sort=dd.title' . $url, 'SSL'); $data['sort_date_added'] = $this->url->link('catalog/occasion', 'token=' . $this->session->data['token'] . '&sort=d.date_added' . $url, 'SSL'); $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $pagination = new Pagination(); $pagination->total = $occasion_total; $pagination->page = $page; $pagination->limit = $this->config->get('config_limit_admin'); $pagination->url = $this->url->link('catalog/occasion', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL'); $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), $occasion_total ? ($page - 1) * $this->config->get('config_limit_admin') + 1 : 0, ($page - 1) * $this->config->get('config_limit_admin') > $occasion_total - $this->config->get('config_limit_admin') ? $occasion_total : ($page - 1) * $this->config->get('config_limit_admin') + $this->config->get('config_limit_admin'), $occasion_total, ceil($occasion_total / $this->config->get('config_limit_admin'))); $data['sort'] = $sort; $data['order'] = $order; $data['header'] = $this->load->controller('common/header'); $data['column_left'] = $this->load->controller('common/column_left'); $data['footer'] = $this->load->controller('common/footer'); $this->response->setOutput($this->load->view('catalog/occasion/occasion_list.tpl', $data)); }
function blog2FB2($task) { global $db_conn, $rootdir; foreach ($task as $parameters) { updateTaskStatus($parameters["id"], 3); // Setting path for FB2 files // Permissions for this directory must be set to 777 if (!file_exists($rootdir . "/books/" . $parameters["id"])) { mkdir($rootdir . "/books/" . $parameters["id"]); } $fpath = $rootdir . "/books/" . $parameters["id"] . "/" . $parameters["name"] . ".fb2"; // Creating a new file with an XMLWriter instance $fb2 = new XMLWriter(); $fb2->openURI($fpath); $fb2->setIndent(true); $fb2->setIndentString("\t"); $fb2->startDocument('1.0', 'windows-1251'); // Writing annotation writeAnnotation($fb2, $parameters["site"], $parameters["author_id"], $parameters["name"], $parameters["real_name"], $parameters["real_surname"]); $sth = $db_conn->prepare("SELECT YEAR(min(time)),YEAR(max(time)) FROM gmj_posts WHERE site='" . $parameters["site"] . "' AND author='" . $parameters["author_id"] . "'"); $sth->execute(); $years = $sth->fetchAll(PDO::FETCH_ASSOC); // Setting parameters of image selection if ($parameters["images"] == 1) { $images = ",image"; } else { $images = ""; } // Selecting posts from the DB for ($i = $years[0]["YEAR(min(time))"]; $i <= $years[0]["YEAR(max(time))"]; $i++) { // Gettings posts for a specific year $i $sth = $db_conn->prepare("SELECT id,title,post,time" . $images . " FROM gmj_posts WHERE site='" . $parameters["site"] . "' AND author='" . $parameters["author_id"] . "' AND LEFT(time,4)=" . $i . " ORDER BY id ASC"); $sth->execute(); $posts = $sth->fetchAll(PDO::FETCH_ASSOC); if ($posts) { $lastElement = end($posts); $lastElement = $lastElement["id"]; $old_month = ""; // Writing an opening section for a year $fb2->startElement('section'); $fb2->startElement('title'); $fb2->writeRaw('<p>' . $i . '</p>'); $fb2->endElement(); foreach ($posts as $post) { $month = substr($post["time"], 5, 2); $message = preg_replace('/(<br \\/>)+$/', '', $post["post"]); $message = preg_replace('#(<br />)+#i', '</p> <p>', $message); $message = str_replace(' ', ' ', $message); // Removing links //$pattern = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i"; //$replacement = "[ссылка удалена]"; //$message = preg_replace($pattern, $replacement, $message); if ($month != $old_month) { // Writing an closing section for a previous month, if needed if (current($post) != $posts[0]["id"]) { $fb2->endElement(); } // Writing an opening section for a new month $fb2->startElement('section'); $fb2->startElement('title'); $fb2->writeRaw('<p>' . printMonth($month) . '</p>'); $fb2->endElement(); } // Writing post date $fb2->startElement('subtitle'); $fb2->writeAttribute('id', $post["id"]); $fb2->text(rus_date("j F, l. H:i", strtotime($post["time"]))); $fb2->endElement(); $fb2->startElement('p'); // Writing post title if ($post["title"]) { $fb2->writeRaw('<strong>' . $post["title"] . '</strong> '); } // Writing post itself $fb2->writeRaw($message); $fb2->endElement(); // Including reference to an image, if any if ($parameters["images"] == 1 && $post["image"] != 0) { if ($post["image"] == 2) { $ext = "jpg"; } if ($post["image"] == 3) { $ext = "png"; } if (isset($ext)) { $fb2->startElement('image'); $fb2->writeAttribute('xlink:href', '#image' . $post["id"] . '.' . $ext); $fb2->endElement(); } } if (current($post) == $lastElement) { // </section> for month $fb2->endElement(); // </section> for year $fb2->endElement(); if ($i == $years[0]["YEAR(max(time))"]) { // </section> for main section $fb2->endElement(); // </body> $fb2->endElement(); } } else { $old_month = $month; } $db_conn->exec("UPDATE gmj_posts SET post_in_book='1' WHERE id='" . $post["id"] . "' AND site='" . $parameters["site"] . "'"); } } } if ($parameters["images"] == 0) { // </FictionBook> $fb2->endElement(); // Closing the document $fb2->endDocument(); } // Flushing buffer $fb2->flush(); // Updating posts counter and status $sth = $db_conn->prepare("SELECT COUNT(*) FROM gmj_posts WHERE author='" . $parameters["author_id"] . "' AND site='" . $parameters["site"] . "' AND post_in_book='1'"); $sth->execute(); $postsCount = $sth->fetchColumn(); $db_conn->exec("UPDATE gmj_tasks SET posts_count='" . $postsCount . "', status='4' WHERE id='" . $parameters["id"] . "'"); } }