protected function initialize() { \Phalcon\Tag::prependTitle('PRIME | '); $this->view->setViewsDir('../app/views/'); $this->view->setLayoutsDir('/layouts/'); $this->view->setTemplateAfter('main'); }
/** * 初始化 */ protected function initialize() { parent::initialize(); //Prepend the application name to the title \Phalcon\Tag::prependTitle('Blog | '); $this->view->setTemplateAfter('common'); }
public function statisticAction() { $id = $this->dispatcher->getParam('id'); $banner = Banners::findFirst($id); if ($id && $banner && $banner->advertiser_id == $this->auth->get_user()->id) { $this->assets->collection('bottom-js')->addJs('js/moment/moment.min.js')->addJs('js/moment/ru.js')->addJs('js/datetimepicker/js/bootstrap-datetimepicker.js'); $this->assets->collection('css')->addCss('js/datetimepicker/css/bootstrap-datetimepicker.min.css'); if (!$this->request->getQuery('start_date')) { if (!empty($banner->start_date)) { $start_date = $banner->start_date; } else { $first_view = $banner->views->getFirst()->date; if (!empty($first_view)) { $start_date = $first_view; } else { $start_date = 0; } } } else { $start_date = date_parse_from_format('d.m.Y H:i', $this->request->getQuery('start_date')); $start_date = mktime($start_date['hour'], $start_date['minute'], 0, $start_date['month'], $start_date['day'], $start_date['year']); } if (!$this->request->getQuery('end_date')) { if (!empty($banner->end_date)) { if ($banner->end_date > time()) { $end_date = time(); } else { $end_date = $banner->end_date; } } else { $end_date = time(); } } else { $end_date = date_parse_from_format('d.m.Y H:i', $this->request->getQuery('end_date')); $end_date = mktime($end_date['hour'], $end_date['minute'], 0, $end_date['month'], $end_date['day'], $end_date['year']); } $days = floor(($end_date + 10800) / 86400) - floor(($start_date + 10800) / 86400) + 1; $days_arr = []; if ($days > 0) { for ($i = 0; $i < $days; $i++) { $day = floor(($start_date + 10800) / 86400) * 86400 + $i * 86400 - 10800; if ((!empty($banner->start_date) ? $day >= floor(($banner->start_date + 10800) / 86400) * 86400 - 10800 : true) && $day < (!empty($banner->end_date) ? $banner->end_date : time())) { $days_arr[] = array('date' => $day, 'views' => $banner->countViews("date >= {$day} AND date < " . ($day + 86400)), 'clicks' => $banner->countViews("date >= {$day} AND date < " . ($day + 86400) . " AND clicked = 1")); } } } $this->view->days = $days_arr; $q = "date >= {$start_date} AND date <= {$end_date}"; $this->view->views = $banner->countViews(array($q)); $q .= " AND clicked = 1"; $this->view->clicks = $banner->countViews(array($q)); $this->view->start_date = $start_date; $this->view->end_date = $end_date; $this->view->banner = $banner; $this->view->title = "Статистика для баннера \"{$banner->name}\""; \Phalcon\Tag::prependTitle("Статистика для баннера \"{$banner->name}\""); } else { $this->dispatcher->forward(array("namespace" => 'App\\Controllers', "controller" => "error", "action" => "notFound")); } }
public function initialize() { Tag::prependTitle('Fireball | '); $this->assets->collection('style')->addCss('third-party/css/bootstrap.min.css', false, false)->addCss('css/style.css')->setTargetPath('css/production.css')->setTargetUri('css/production.css')->join(true)->addFilter(new \Phalcon\Assets\Filters\Cssmin()); //takes the js or css files and combines / minifies them for faster page loads $this->assets->collection('js')->addJs('third-party/js/jquery-1.12.0.min.js', false, false)->addJs('third-party/js/bootstrap.min.js', false, false)->setTargetPath('js/production.js')->setTargetUri('js/production.js')->join(true)->addFilter(new \Phalcon\Assets\Filters\Jsmin()); }
/** * Initializes the controller */ public function initialize() { Tag::prependTitle('HHF G&KB Awards | '); $this->_bc = new Breadcrumbs(); $this->view->setVar('config', $this->config); $this->view->setVar('session', $this->session); $this->view->setVar('breadcrumbs', $this->_bc->generate()); }
public function initialize() { Tag::prependTitle("Capelli Haarmode"); // CSS imports $this->assets->collection('header')->addCss('https://fonts.googleapis.com/css?family=EB+Garamond')->addCss('css/datepicker.css')->addCss('css/materialize.min.css')->addCss('http://fonts.googleapis.com/icon?family=Material+Icons')->addCss('css/style.css'); // JS imports $this->assets->collection('footer')->addJs('js/materialize.min.js')->addJs('js/script.js')->addJs('js/picker.js')->addJs('js/picker.date.js')->addJs('js/picker.time.js'); }
public function uncaughtExceptionAction() { $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->view->pick('error/error'); \Phalcon\Tag::prependTitle('500'); $this->view->title = "500 - внутренняя ошибка"; $this->response->setStatusCode(500, 'Internal Server Error'); }
protected function initialize() { \Phalcon\Tag::prependTitle('PRIME | '); $this->view->setViewsDir('../app/views/'); $this->view->setLayoutsDir('/layouts/'); $this->view->setTemplateAfter('main'); if ($this->session->has("auth")) { //Retrieve its value $auth = $this->session->get("auth"); $this->organisation_id = $auth['organisation_id']; } }
/** * 初始化 */ protected function initialize() { parent::initialize(); //Prepend the application name to the title \Phalcon\Tag::prependTitle('Blog | '); if ($this->checkIsLogin()) { $this->admin = $this->session->get('admin'); } else { $this->response->redirect('/login', true); } $this->view->setTemplateAfter('common'); }
public function indexAction() { if ($this->request->getPost('txt')) { $content = $this->request->getPost('txt'); copy('robots.txt', 'robots.txt.bak'); file_put_contents('robots.txt', $content); $this->flashSession->success("Файл успешно сохранён"); } $txt = file_get_contents('robots.txt'); $this->view->txt = $txt; $this->view->title = "Редактирование файла robots.txt"; Tag::prependTitle("Редактирование файла robots.txt"); }
public function testSetTitleSeparator() { Tag::setTitle('Title'); Tag::appendTitle('Class'); $this->assertEquals(Tag::getTitle(), '<title>TitleClass</title>' . PHP_EOL); Tag::setTitle('Title'); Tag::setTitleSeparator('|'); Tag::appendTitle('Class'); $this->assertEquals(Tag::getTitle(), '<title>Title|Class</title>' . PHP_EOL); $this->assertEquals(Tag::getTitleSeparator(), '|'); Tag::setTitle('Title'); Tag::setTitleSeparator('|'); Tag::prependTitle('Class'); $this->assertEquals(Tag::getTitle(), '<title>Class|Title</title>' . PHP_EOL); }
public function profileAction() { $id = $this->dispatcher->getParam('id'); $user = Users::findFirst($id); if ($user && $id) { if ($this->request->isPost()) { $action = $this->request->getPost('action'); if ($action == "change_info") { if ($user->update($this->request->getPost(), array('fname', 'lname', 'thname'))) { $this->auth->refresh_user(); $this->flashSession->success("Информация о рекламодателе обновлена"); } else { foreach ($user->getMessages() as $message) { $this->flashSession->error($message->getMessage()); } } } elseif ($action == "change_email") { if ($user->update($this->request->getPost(), array('email'))) { $this->auth->refresh_user(); $this->flashSession->success("E-mail рекламодателя изменён"); } else { foreach ($user->getMessages() as $message) { $this->flashSession->error($message->getMessage()); } } } elseif ($action == "change_password") { if ($this->request->getPost('password') === $this->request->getPost('password_confirm')) { if ($user->update(array('password' => $this->auth->hash($this->request->getPost('password'))))) { $this->auth->refresh_user(); $this->flashSession->success('Пароль рекламодателя успешно изменён'); } else { foreach ($user->getMessages() as $message) { $this->flashSession->error($message->getMessage()); } } } else { $this->flashSession->error('Пароль и повтор пароля должны совпадать.'); } } } $this->view->user = $user; $this->view->title = $user->getUsername() . " - Управление"; \Phalcon\Tag::prependTitle($user->getUsername() . " - Управление"); } else { $this->dispatcher->forward(array("namespace" => 'App\\Controllers', "controller" => "error", "action" => "notFound")); } }
/** * Everything a growing controller needs */ protected function initialize() { // Page title $pageTitle = 'Talon | ' . $this->utilities->camelSeparate($this->dispatcher->getControllerName()); $action = $this->dispatcher->getActionName(); if ($action !== 'index') { $pageTitle .= ' | ' . $this->utilities->camelSeparate($action); } $this->view->setVar('page_title', $pageTitle); Tag::prependTitle($pageTitle); // Assets $this->assets->addCss('css/talon.css'); $this->assets->addJs('js/talon.js'); $this->view->setVar('jQuery', $this->includeJquery()); $this->view->setVar('modernizr', $this->includeModernizr()); $this->view->setTemplateAfter('main'); }
public function initialize(){ Tag::prependTitle("Fireball | "); $this->assets->collection('style') ->addCss('css/bootstrap.min.css',false,false) ->addCss('css/style.css') ->setTargetPath('css/production.css') ->setTargetUri('css/production.css') ->join(true) ->addFilter(new \Phalcon\Assets\Filters\Cssmin()); $this->assets->collection('js') ->addJs('js/jquery.min.js',false,false) ->addJs('js/bootstrap.min.js',false,false) ->setTargetPath('js/production.js') ->setTargetUri('js/production.js') ->join(true) ->addFilter(new \Phalcon\Assets\Filters\Jsmin()); }
public function loginAction() { $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); if ($this->router->getMatchedRoute()->getName() != 'auth') { $this->dispatcher->forward(array("controller" => "error", "action" => "notFound")); } \Phalcon\Tag::prependTitle('Вход'); $this->view->title = "Вход"; if ($this->auth->logged_in()) { return $this->response->redirect(""); } if ($this->request->isPost()) { $auth = $this->auth->login($this->request->getPost('username'), $this->request->getPost('password'), (bool) $this->request->get('remember')); if ($auth) { return $this->response->redirect(""); } else { $this->flashSession->error(':('); } } /*$user=new \App\Models\Users(); $user->fname='Тест'; $user->lname='Тестов'; $user->thname=''; $user->email='*****@*****.**'; $user->password='******'; if(!$user->create()) foreach($user->getMessages() as $message) { $this->flashSession->error($message->getMessage()); } else{ $role = new \App\Models\RolesUsers(); $role->user_id = $user->id; $role->role_id = \App\Models\Roles::findFirst(array('name="login"'))->id; $role->create(); $role->role_id = \App\Models\Roles::findFirst(array('name="admin"'))->id; $role->create(); }*/ /*$admin = \App\Models\Users::findFirst(1); $admin->password = $this->auth->hash('ghfdbkj'); $admin->save();*/ }
public function editAction() { $id = $this->dispatcher->getParam('id'); $zone = Zones::findFirst($id); if ($zone && $id) { if ($this->request->isPost()) { if ($zone->save($this->request->getPost(), array('name'))) { $this->flashSession->success("Зона отредактирована"); return $this->response->redirect(array('for' => 'controller', 'controller' => 'zones')); } else { foreach ($zone->getMessages() as $message) { $this->flashSession->error($message->getMessage()); } } } $this->view->zone = $zone; $this->view->title = "Редактирование зоны"; \Phalcon\Tag::prependTitle("Редактирование зоны"); } else { $this->dispatcher->forward(array("namespace" => 'App\\Controllers', "controller" => "error", "action" => "notFound")); } }
protected function initialize() { Tag::prependTitle('Управление проектом | '); }
public function _initPageTitle($dispatcher) { $pageTitle = $this->_siteConfig['pageTitle'][$dispatcher]; switch ($dispatcher) { case 'PageController-xtList': case 'PageController-list': case 'PageController-xtSingle': case 'PageController-single': foreach ($this->_params['nodeParents'] as $key => $nodeParent) { if ($nodeParent->lvl >= 2) { $pageTitle[] = $nodeParent->TreeData->title; } } $pageTitle[] = $this->_params['node']->TreeData->title; break; case 'PageController-tagSingle': $pageTitle[] = $this->_params['tag']->name; break; case 'PageController-search': $kw = $this->_params['search_keyword']; $pageTitle[] = $kw ? $kw : '搜索'; break; default: break; } foreach ($pageTitle as $value) { if ($value) { Tag::prependTitle($value); } } }
protected function initialize() { Tag::prependTitle('Наш чудесный город | '); }
protected function initialize() { Tag::prependTitle('Blog Admin | '); }
public static function prependTitle($title) { parent::prependTitle($title); }
/** * Tests prependTitle * * @author Nikos Dimopoulos <*****@*****.**> * @since 2012-09-05 */ public function testPrependTitle() { $value = 'This is my title'; \Phalcon\Tag::setTitle($value); $prepend = 'PhalconPHP -'; \Phalcon\Tag::prependTitle($prepend); $expected = "<title>{$prepend}{$value}</title>" . PHP_EOL; $actual = \Phalcon\Tag::getTitle(); $this->assertEquals($expected, $actual, sprintf($this->message, 'prependTitle')); }