本文整理汇总了PHP中View::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP View::__construct方法的具体用法?PHP View::__construct怎么用?PHP View::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
function __construct()
{
parent::__construct();
if (!$this->is_admin) {
header('Location: /');
}
}
示例2: __construct
public function __construct($file, $values = array())
{
$file = explode('/', $file);
$file[count($file) - 1] = '-' . $file[count($file) - 1];
$file = implode('/', $file);
parent::__construct($file, $values);
}
示例3:
function __construct($viewfile = NULL)
{
parent::__construct();
if (!is_null($viewfile)) {
$this->viewfile = $viewfile;
}
}
示例4: __construct
/**
* 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;
}
}
示例5: __construct
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/');
}
}
示例6: header
function __construct()
{
parent::__construct();
if (!$this->user_id) {
header('Location: /');
}
}
示例7: HamlParser
function __construct(&$controller)
{
parent::__construct($controller);
$this->Haml = new HamlParser(VIEWS, TMP . 'haml');
$this->Haml->assign_by_ref('__haml', $this->Haml);
$this->ext = '.haml';
}
示例8: __construct
/**
* 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"));
}
}
示例9: __construct
/**
* Class constructor
*
* @param AppController $controller
*/
public function __construct($controller)
{
Sl::getInstance()->view = $this;
parent::__construct($controller);
$this->theme =& $controller->theme;
$this->id =& $controller->id;
}
示例10: __construct
public function __construct()
{
parent::__construct();
global $config;
$this->_url = $config['url'];
$this->_siteName = $config['name'];
}
示例11: __construct
/**
* Constructor
*
* @param Controller $controller
*/
public function __construct($controller)
{
parent::__construct($controller);
if (isset($controller->response) && $controller->response instanceof CakeResponse) {
$controller->response->type('json');
}
}
示例12: Smarty
/**
* 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');
}
}
示例13: explode
function __construct($context)
{
$action_parts = explode('_', $context->getAction());
$root = $action_parts[0];
$this->createXml($root);
parent::__construct($context);
}
示例14: __construct
/**
* 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();
}
示例15: __construct
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/';
}