function __construct() { parent::__construct(); if (!$this->is_admin) { header('Location: /'); } }
public function __construct($file, $values = array()) { $file = explode('/', $file); $file[count($file) - 1] = '-' . $file[count($file) - 1]; $file = implode('/', $file); parent::__construct($file, $values); }
function __construct($viewfile = NULL) { parent::__construct(); if (!is_null($viewfile)) { $this->viewfile = $viewfile; } }
/** * Constructor for ThemeView sets $this->theme. * * @param Controller $controller Controller object to be rendered. */ public function __construct($controller) { parent::__construct($controller); if ($controller) { $this->theme = $controller->theme; } }
public function __construct() { parent::__construct(); // Если передан id варианта, добавим его в корзину if ($variant_id = $this->request->get('variant', 'integer')) { $this->cart->add_item($variant_id, $this->request->get('amount', 'integer')); header('location: ' . $this->config->root_url . '/cart/'); } // Удаление товара из корзины if ($delete_variant_id = intval($this->request->get('delete_variant'))) { $this->cart->delete_item($delete_variant_id); if (!isset($_POST['submit_order']) || $_POST['submit_order'] != 1) { header('location: ' . $this->config->root_url . '/cart/'); } } // Если нажали оформить заказ if ($this->request->post('checkout')) { $order->delivery_id = $this->request->post('delivery_id', 'integer'); $order->name = $this->request->post('name'); //$order->email = $this->request->post('email'); //$order->address = $this->request->post('address'); $order->phone = $this->request->post('phone'); $order->comment = $this->request->post('comment'); // Скидка $order->discount = empty($this->user->discount) ? 0 : $this->user->discount; if (!empty($this->user->id)) { $order->user_id = $this->user->id; } if (empty($order->name)) { $this->design->assign('error', 'empty_name'); } else { // Добавляем заказ в базу $order_id = $this->orders->add_order($order); $_SESSION['order_id'] = $order_id; // Добавляем товары к заказу foreach ($this->request->post('amounts') as $variant_id => $amount) { $this->orders->add_purchase(array('order_id' => $order_id, 'variant_id' => intval($variant_id), 'amount' => intval($amount))); } $order = $this->orders->get_order($order_id); // Стоимость доставки $delivery = $this->delivery->get_delivery($order->delivery_id); if (!empty($delivery) && $delivery->free_from > $order->total_price) { $this->orders->update_order($order->id, array('delivery_price' => $delivery->price, 'separate_delivery' => $delivery->separate_payment)); } // Отправляем письмо пользователю // $this->notify->email_order_user($order->id); // Отправляем письмо администратору $this->notify->email_order_admin($order->id); // Очищаем корзину (сессию) $this->cart->empty_cart(); // Перенаправляем на страницу заказа header('Location: ' . $this->config->root_url . '/order/' . $order->url); } } elseif ($amounts = $this->request->post('amounts')) { foreach ($amounts as $variant_id => $amount) { $this->cart->update_item($variant_id, $amount); } header('location: ' . $this->config->root_url . '/cart/'); } }
function __construct() { parent::__construct(); if (!$this->user_id) { header('Location: /'); } }
function __construct(&$controller) { parent::__construct($controller); $this->Haml = new HamlParser(VIEWS, TMP . 'haml'); $this->Haml->assign_by_ref('__haml', $this->Haml); $this->ext = '.haml'; }
/** * Attempts to load a view and pre-load view data. * * @throws Kohana_Exception if the requested view cannot be found * @param string $name view name * @param string $page_type page type: album, photo, tags, etc * @param string $theme_name view name * @return void */ public function __construct($name, $page_type) { $theme_name = module::get_var("gallery", "active_site_theme"); if (!file_exists("themes/{$theme_name}")) { module::set_var("gallery", "active_site_theme", "default"); theme::load_themes(); Kohana::log("error", "Unable to locate theme '{$theme_name}', switching to default theme."); } parent::__construct($name); $this->theme_name = module::get_var("gallery", "active_site_theme"); if (user::active()->admin) { $this->theme_name = Input::instance()->get("theme", $this->theme_name); } $this->item = null; $this->tag = null; $this->set_global("theme", $this); $this->set_global("user", user::active()); $this->set_global("page_type", $page_type); $this->set_global("page_title", null); if ($page_type == "album") { $this->set_global("thumb_proportion", $this->thumb_proportion()); } $maintenance_mode = Kohana::config("core.maintenance_mode", false, false); if ($maintenance_mode) { message::warning(t("This site is currently in maintenance mode")); } }
/** * Class constructor * * @param AppController $controller */ public function __construct($controller) { Sl::getInstance()->view = $this; parent::__construct($controller); $this->theme =& $controller->theme; $this->id =& $controller->id; }
public function __construct() { parent::__construct(); global $config; $this->_url = $config['url']; $this->_siteName = $config['name']; }
/** * Constructor * * @param Controller $controller */ public function __construct($controller) { parent::__construct($controller); if (isset($controller->response) && $controller->response instanceof CakeResponse) { $controller->response->type('json'); } }
/** * Constructor * * @return SmartyView */ function __construct(&$controller) { parent::__construct($controller); $this->subDir = 'smarty'; $this->ext = '.tpl'; $this->layoutPath = 'smarty'; //ver. 1.2's property $this->smarty =& new Smarty(); $this->smarty->plugins_dir[] = VENDORS . 'smarty' . DS . 'plugins' . DS; $this->smarty->compile_dir = TMP . 'smarty' . DS . 'templates_c' . DS; $this->smarty->cache_dir = TMP . 'smarty' . DS . 'cache' . DS; $this->smarty->error_reporting = 'E_ALL & ~E_NOTICE'; if (!is_null(Configure::read('Smarty.subDir'))) { $this->subDir = Configure::read('Smarty.subDir'); if (empty($this->subDir)) { $this->subDir = null; } } if (!is_null(Configure::read('Smarty.ext'))) { $this->ext = Configure::read('Smarty.ext'); } if (!is_null(Configure::read('Smarty.layoutPath'))) { $this->layoutPath = Configure::read('Smarty.layoutPath'); if (empty($this->layoutPath)) { $this->layoutPath = null; } } if (!is_null(Configure::read('Smarty.left_delimiter'))) { $this->left_delimiter = Configure::read('Smarty.left_delimiter'); } if (!is_null(Configure::read('Smarty.right_delimiter'))) { $this->right_delimiter = Configure::read('Smarty.right_delimiter'); } }
function __construct($context) { $action_parts = explode('_', $context->getAction()); $root = $action_parts[0]; $this->createXml($root); parent::__construct($context); }
/** * Constructs View from Resource, initializes XSLT processor and creates URI resolver. * @param Resource $resource Resource */ public function __construct(Resource $resource = null) { parent::__construct($resource); $this->doc = new DOMDocument(); $this->template = new DOMDocument(); $this->proc = new XSLTProcessor(); }
public function __construct() { parent::__construct(); $this->template_dir = 'templates/templates/'; $this->compile_dir = 'templates/templates_c/'; $this->config_dir = 'templates/configs/'; $this->cache_dir = 'templates/cache/'; }
public function __construct($name, array $data = array()) { $options = array_filter(explode(':', $name)); parent::__construct(array_shift($options), $data); foreach ($options as $opt) { $this->{$opt} = 1; } }
public function __construct($file, $data = null) { $this->HTTPCSS = $data['HTTPCSS']; $this->HTTPJS = $data['HTTPJS']; $data['HTTPCSS'] = $this->HTTPCSS($data['HTTPCSS']); $data['HTTPJS'] = $this->HTTPJS($data['HTTPJS']); parent::__construct($file, $data); }
public function __construct($lesson, $course) { parent::__construct(); $this->lesson = $lesson; $this->course = $course; $this->question = "<>"; // dummy }
function __construct() { global $_entry; parent::__construct(); if (!$this->is_admin && $_entry != 'entry_login') { header('Location: /admin/index.php?view=user&entry=login'); } }
function __construct(&$controller) { $this->Smarty = SmartySingleton::instance(); parent::__construct($controller); //$this->subDir = 'smarty'.DS; $this->ext = '.tpl'; $this->viewVars['params'] = $this->params; }
/** * Constructor * * @param Controller $controller The controller with viewVars */ public function __construct($controller = null) { parent::__construct($controller); if (is_object($controller) && isset($controller->response)) { $this->response = $controller->response; } else { $this->response = new CakeResponse(); } }
public function __construct($filename) { parent::__construct($filename); $this->xmldoc = NULL; $xsltobj = new DOMDocument(); $xsltobj->load($this->filename); $this->processor = new XSLTProcessor(); $this->processor->importStylesheet($xsltobj); }
/** * PHPTALView constructor * * @param Controller $controller */ public function __construct($controller) { parent::__construct($controller); $this->Phptal = new PHPTAL(); $this->Phptal->setEncoding(Configure::read('App.encoding')); $this->Phptal->setPhpCodeDestination(CACHE . 'views'); $this->_createUrlModifier(); $this->_registerNamespace(); }
public function __construct($controller = null) { /* if (!Configure::load('layout', 'default', false)) throw new Exception('CakeLayout configuration not found'); $this->_layoutConfig = Configure::read('CakeLayout'); */ parent::__construct($controller); }
/** * Constructor * * @param object $controller The controller with viewVars */ function __construct($controller = null) { parent::__construct($controller); if (is_object($controller) && isset($controller->response)) { $this->response = $controller->response; } else { App::import('Core', 'CakeRequest'); $this->response = new CakeResponse(); } }
/** * * The view constructor for the user page * * Loaded up in the user controller to establish * base local variables * * @access public [Used in the User Controller] * @param array ["$model"; the sql array values] * */ public function __construct($model, $url) { parent::__construct(); // MODEL INFO $this->model = $model; // URL INFO $this->url = $url; // USER INFO $this->user = $this->model->table["users"]; }
/** * constructor. copies all needed variables from the controller * @param object controller that uses this view */ function __construct(&$controller) { /** * include smarty. a smarty-installation must be in your include path! */ require_once 'Smarty.class.php'; parent::__construct(); $this->smarty = new Smarty(); $this->smarty->register_function('helper', array('SmartyView', 'smarty_helper')); }
/** * Constructor * * @param string $view The view to use for this layout */ public function __construct($title,$description,$view) { parent::__construct(PATH_APP.'layout/',$view); $this->title=$title; $this->description=$description; if (self::$_master==null) self::$_master=$this; }
/** * Constructor * Overridden to provide Twig loading * * @param Controller $Controller Controller */ public function __construct(Controller $Controller = null) { $this->Twig = new Twig_Environment(new Twig_Loader_Cakephp(array()), array('cache' => Configure::read('TwigView.Cache'), 'charset' => strtolower(Configure::read('App.encoding')), 'auto_reload' => Configure::read('debug') > 0, 'autoescape' => false, 'debug' => Configure::read('debug') > 0)); CakeEventManager::instance()->dispatch(new CakeEvent('Twig.TwigView.construct', $this, array('TwigEnvironment' => $this->Twig))); parent::__construct($Controller); if (isset($Controller->theme)) { $this->theme = $Controller->theme; } $this->ext = self::EXT; }
public function __construct($info, $model, $device) { parent::__construct($info, $model, $device); if (isset($_GET['catNum'])) { // has the page number been passed in the url? $this->catNum = $_GET['catNum']; } else { $this->catNum = 1; } }