/** * Initializes the controller */ public function initialize() { Tag::setTitle('Statistics'); parent::initialize(); $this->_bc->add('Statistics', 'statistics'); $this->view->setVar('menus', $this->constructMenu($this)); }
public function initialize() { $this->view->setTemplateAfter('main'); Phalcon_Tag::setTitle('Hypertext Preprocesor'); $this->loadCustomTrans('index'); parent::initialize(); }
public function initialize() { $this->view->setTemplateAfter('main'); Phalcon_Tag::setTitle('Downloads'); $this->loadCustomTrans("downloads"); parent::initialize(); }
public function registerAction() { if ($this->request->isPost()) { $name = $this->request->getPost('name', 'string'); $username = $this->request->getPost('username', 'string'); $email = $this->request->getPost('email', 'email'); $password = $this->request->getPost('password'); $repeatPassword = $this->request->getPost('repeatPassword'); if ($password != $repeatPassword) { Flash::error((string) $message, 'alert alert-error'); return false; } $name = strip_tags($name); $username = strip_tags($username); $user = new Users(); $user->username = $username; $user->password = sha1($password); $user->name = $name; $user->email = $email; $user->created_at = new Phalcon_Db_RawValue('now()'); $user->active = 'Y'; if ($user->save() == false) { foreach ($user->getMessages() as $message) { Flash::error((string) $message, 'alert alert-error'); } } else { Tag::setDefault('email', ''); Tag::setDefault('password', ''); Flash::success('Thanks for sign-up, please log-in to start generating invoices', 'alert alert-success'); return $this->_forward('session/index'); } } }
/** * Edit the active user profile * */ public function profileAction() { //Get session info $auth = Session::get('auth'); //Query the active user $user = Users::findFirst($auth['id']); if ($user == false) { $this->_forward('index/index'); } if (!$this->request->isPost()) { Tag::setDefault('name', $user->name); Tag::setDefault('email', $user->email); } else { $name = $this->request->getPost('name', 'string'); $email = $this->request->getPost('email', 'email'); $name = strip_tags($name); $user->name = $name; $user->email = $email; if ($user->save() == false) { foreach ($user->getMessages() as $message) { Flash::error((string) $message, 'alert alert-error'); } } else { Flash::success('Your profile information was updated successfully', 'alert alert-success'); } } }
public function getCategoriesLinks($translate) { $categories = array(); foreach ($this->getNewsCategories() as $newCategory) { $category = $newCategory->getCategories(); $categories[] = Phalcon_Tag::linkTo('news/tagged/' . $category->name, $translate[$category->name]); } return join(', ', $categories); }
public static function getTabs($view) { $controllerName = $view->getControllerName(); $actionName = $view->getActionName(); echo '<ul class="nav nav-tabs">'; foreach (self::$_tabs as $caption => $option) { if ($option['controller'] == $controllerName && ($option['action'] == $actionName || $option['any'])) { echo '<li class="active">'; } else { echo '<li>'; } echo Phalcon_Tag::linkTo($option['controller'] . '/' . $option['action'], $caption), '<li>'; } echo '</ul>'; }
public function taggedAction($tag) { $tag = $this->filter->sanitize($tag, "alphanum"); Phalcon_Tag::setTitle('Tagged ' . $tag); $category = Categories::findFirst("name='{$tag}'"); if ($category == false) { return $this->_forward('index/index'); } $news = array(); $newsCategories = NewsCategories::find(array("categories_id='" . $category->id . "'")); foreach ($newsCategories as $newCategory) { $news[] = $newCategory->getNews(); } $this->view->setVar("activeYear", 0); $this->view->setVar("tag", $tag); $this->view->setVar("news", $news); $this->view->setVar("years", News::count(array('group' => 'year'))); }
public function editAction($id) { $request = Phalcon_Request::getInstance(); if (!$request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $companies = Companies::findFirst('id="' . $id . '"'); if (!$companies) { Flash::error("companies was not found", "alert alert-error"); return $this->_forward("companies/index"); } $this->view->setVar("id", $companies->id); Tag::displayTo("id", $companies->id); Tag::displayTo("name", $companies->name); Tag::displayTo("telephone", $companies->telephone); Tag::displayTo("address", $companies->address); Tag::displayTo("city", $companies->city); } }
public function initialize() { Phalcon_Tag::prependTitle('PHP: '); $this->loadMainTrans(); }
public function initialize() { $this->view->setTemplateAfter('main'); Phalcon_Tag::setTitle('Links'); parent::initialize(); }
<?php foreach ($this->assets->collection('js') as $resource) { echo Phalcon_Tag::javascriptInclude($resource->getPath()); }
public function initialize() { Phalcon_Tag::prependTitle('INVO | '); }
public function initialize() { $this->view->setTemplateAfter(array('main')); Phalcon_Tag::setTitle('Copyright'); parent::initialize(); }
public function editAction($id) { $request = Phalcon_Request::getInstance(); if (!$request->isPost()) { $id = $this->filter->sanitize($id, array("int")); $producttypes = ProductTypes::findFirst('id="' . $id . '"'); if (!$producttypes) { Flash::error("product types was not found", "alert alert-error"); return $this->_forward("producttypes/index"); } $this->view->setVar("id", $producttypes->id); Tag::displayTo("id", $producttypes->id); Tag::displayTo("name", $producttypes->name); } }