本文整理汇总了PHP中Template_Controller::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Template_Controller::__construct方法的具体用法?PHP Template_Controller::__construct怎么用?PHP Template_Controller::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template_Controller
的用法示例。
在下文中一共展示了Template_Controller::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$this->template->links = array('Home' => 'home', 'Browse' => 'folders', 'Search' => 'search', 'About' => 'about', 'Contact' => 'contact');
$this->db = Database::instance();
// makes database object available to all controllers
$this->session = Session::instance();
$authentic = new Auth();
if ($authentic->logged_in() || $authentic->auto_login()) {
$this->user = $authentic->get_user();
} else {
$this->session->set("requested_url", "/" . url::current());
// this will redirect from the login page back to this page
url::redirect('/auth/login');
}
// if ($authentic->auto_login()) {
// $this->user = $authentic->get_user();
// url::redirect('/document/view/1');
// }
// if (!$authentic->logged_in()) {
//
// $this->session->set("requested_url","/".url::current()); // this will redirect from the login page back to this page
// url::redirect('/auth/login');
// } else {
// $this->user = $authentic->get_user(); //now you have access to user information stored in the database
// }
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->session = new Session();
// $profiler = new Profiler;
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->administrator_model = new Administrator_Model();
$this->search = array('display' => '');
$this->_get_session_msg();
}
示例4: __construct
public function __construct()
{
parent::__construct();
// Load cache
$this->cache = new Cache();
// Load session
$this->session = new Session();
// Load database
$this->db = new Database();
$this->auth = new Auth();
$this->session = Session::instance();
$this->auth->auto_login();
if (!$this->auth->logged_in('admin') && !$this->auth->logged_in('login')) {
url::redirect('login');
}
//fetch latest version of ushahidi
$version_number = $this->_fetch_core_version();
$this->template->version = $this->_find_core_version($version_number);
// Get Session Information
$user = new User_Model($_SESSION['auth_user']->id);
$this->template->admin_name = $user->name;
// Retrieve Default Settings
$this->template->site_name = Kohana::config('settings.site_name');
$this->template->mapstraction = Kohana::config('settings.mapstraction');
$this->template->api_url = Kohana::config('settings.api_url');
// Javascript Header
$this->template->map_enabled = FALSE;
$this->template->flot_enabled = FALSE;
$this->template->protochart_enabled = FALSE;
$this->template->colorpicker_enabled = FALSE;
$this->template->editor_enabled = FALSE;
$this->template->js = '';
// Load profiler
// $profiler = new Profiler;
}
示例5: View
function __construct()
{
parent::__construct();
$session = Session::instance();
// Load Header & Footer
$this->template->header = new View('mhi/mhi_header');
$this->template->footer = new View('mhi/mhi_footer');
$this->template->footer->ushahidi_stats = Stats_Model::get_javascript();
$this->template->header->site_name = Kohana::config('settings.site_name');
// Initialize JS variables. js_files is an array of ex: html::script('media/js/jquery.validate.min');
// Add the sign in box javascript
$this->template->header->js = new View('mhi/mhi_js_signin');
$this->template->header->js_files = array();
// Google Analytics
$google_analytics = Kohana::config('settings.google_analytics');
$this->template->footer->google_analytics = $this->_google_analytics($google_analytics);
// If we aren't at the top level MHI site or MHI isn't enabled, don't allow access to any of this jazz
/*
if (Kohana::config('config.enable_mhi') == FALSE OR Kohana::config('settings.subdomain') != '')
throw new Kohana_User_Exception('MHI Access Error', "MHI disabled for this site.");
*/
// Login Form variables
$this->template->header->errors = '';
$this->template->header->form = array('username' => '');
$this->template->header->form_error = '';
$this->template->header->mhi_user_id = $session->get('mhi_user_id');
}
示例6: __construct
public function __construct()
{
parent::__construct();
$active = $this->uri->segment(2) ? $this->uri->segment(2) : 'core';
// Add the menu to the template
$this->template->menu = new View('kodoc/menu', array('active' => $active));
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/index');
$this->articles_model = new Articles_Model();
//View
}
示例8: __construct
public function __construct()
{
$this->test_model = new Test_Model();
$this->payment_model = new Payment_Model();
parent::__construct();
$this->_get_session_msg();
}
示例9: __construct
public function __construct()
{
parent::__construct();
// Create a custom 404 handler for this controller
Event::clear('system.404', array('Kohana_404_Exception', 'trigger'));
Event::add('system.404', array($this, 'error'));
// Do we have anything cached?
if (Kohana::config('userguide.cache')) {
$this->cache = Cache::instance();
}
if (Router::$method === 'media') {
// Do not template media files
$this->auto_render = FALSE;
}
// Use customized Markdown parser
define('MARKDOWN_PARSER_CLASS', 'Kodoc_Markdown');
// Load Markdown support
require Kohana::find_file('vendor', 'markdown', TRUE);
// Set the base URL for links and images
Kodoc_Markdown::$base_url = url::site('userguide') . '/';
Kodoc_Markdown::$image_url = url::site('userguide/media') . '/';
// Disable eAccelerator, it messes with the ReflectionClass->getDocComments() calls
ini_set('eaccelerator.enable', 0);
// Bind the breadcrumb
$this->template->bind('breadcrumb', $this->breadcrumb);
// Add the breadcrumb
$this->breadcrumb = array();
$this->breadcrumb['userguide'] = 'User Guide';
if ($this->package = URI::instance()->segment(3)) {
$this->breadcrumb['userguide/guide/' . $this->package] = ucfirst($this->package);
}
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/home');
// Init session
$this->_get_session_template();
$this->questionnaires_model = new Questionnaires_Model();
$this->answer_model = new Answer_Model();
$this->category_model = new Category_Model();
$this->test_model = new Test_Model();
$this->testing_model = new Testing_Model();
$this->payment_model = new Payment_Model();
$this->testingdetail_model = new Testingdetail_Model();
$this->testing_category_model = new Testingcategory_Model();
$this->promotion_model = new Promotion_Model();
$this->courses_model = new Courses_Model();
$this->study_model = new Study_Model();
$this->lesson_model = new Lesson_Model();
$this->lesson_annotation_model = new Lesson_annotation_Model();
$this->member_certificate_model = new Member_certificate_Model();
$this->certificate_model = new Certificate_Model();
$this->data_template_model = new Data_template_Model();
if ($this->sess_cus == "") {
url::redirect(url::base());
die;
}
}
示例11: __construct
public function __construct()
{
parent::__construct();
$this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/user');
$this->_get_session_template();
$this->Data_template_Model = new Data_template_Model();
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->auth = Auth::instance();
$this->template->app_name = Kohana::config('bc.bc');
$this->template->page_title = __('Login');
}
示例13: __construct
public function __construct()
{
parent::__construct();
// This must be included
$this->search = array('keyword' => '');
$this->_get_submit();
}
示例14: __construct
public function __construct()
{
parent::__construct();
if ($this->is_ajax_request() == TRUE) {
$this->template = new View('layout/default_json');
}
}
示例15: __construct
public function __construct()
{
parent::__construct();
// Inicio de Session
$this->session = Session::instance();
// Si la variable cat no está definida, definirla
if (!isset($_SESSION['cat'])) {
$_SESSION['cat'] = 0;
}
if (!isset($_SESSION['localidad'])) {
$_SESSION['localidad'] = 0;
}
$this->template->links = array('Acerca de IMGListados' => 'about', 'Datos' => 'datos', 'Rubros' => 'rubros', 'Exportar Listados' => 'listados');
$this->template->footer = 'Copyright ' . $this->thiYear($this->y) . ' - ' . html::anchor('http://www.imgdigital.com.ar', 'IMG Digital', array('target' => '_blank')) . '- ' . html::anchor('http://www.imgdigital.com.ar/imglistados', 'IMGListados', array('target' => '_blank'));
$this->template->login = new View('login');
// Da acceso a todos los controladores la base de datos
$this->db = Database::instance();
//Listado de Categorías
$this->categorias = ORM::factory('categoria')->select_list();
//$this->template->cats = $this->categorias;
//Listado de Localidades
$this->localidades = ORM::factory('localidad')->select_list();
//$this->template->localidades = $this->localidades;
//$this->profiler = new Profiler;
}