本文整理汇总了PHP中Controller_Template类的典型用法代码示例。如果您正苦于以下问题:PHP Controller_Template类的具体用法?PHP Controller_Template怎么用?PHP Controller_Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Controller_Template类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
/**
* Override the before method
* check if ajax and select correct template
*/
public function before()
{
$this->auth_filter();
if (Auth::instance()->logged_in()) {
$this->acl_filter();
}
// create a new Config reader and attach to the Config instance
$config = Config::instance();
$config->attach(new Config_Database());
$this->breadcrumbs();
//check if controller is of innerpage of course and courseid is there in session
// TODO - fix for modular extensibility
if ($this->request->is_initial()) {
// check if this is initial request
$course_pages = array('document', 'flashcard', 'link', 'video', 'lesson', 'quiz', 'assignment', 'question', 'quiz', 'exercise');
$controller = $this->request->controller();
$course_id = Session::instance()->get('course_id');
if (in_array($controller, $course_pages) && !$course_id) {
$this->request->redirect('course');
} elseif (!in_array($controller, $course_pages)) {
Session::instance()->delete('course_id');
}
}
return parent::before();
}
示例2: before
public function before()
{
parent::before();
$this->template->title = 'Swiftriver';
$this->template->theme = Theming::get_theme();
$this->template->header = new View('defaults/header');
$this->template->content = '';
$this->template->rightbar = new View('defaults/rightbar');
$this->template->footer = new View('defaults/footer');
$loggedinstatus = RiverId::is_logged_in();
if (!$loggedinstatus["IsLoggedIn"]) {
$this->template->admin = new View("adminbar/user");
} else {
if ($loggedinstatus["Role"] == "sweeper") {
$this->template->admin = new View("adminbar/sweeper");
} else {
if ($loggedinstatus["Role"] == "editor") {
$this->template->admin = new View("adminbar/editor");
} else {
if ($loggedinstatus["Role"] == "admin") {
$this->template->admin = new View("adminbar/admin");
}
}
}
}
}
示例3: before
/**
* Before - Check for login
*/
public function before()
{
if ($this->request->action != 'login' and !Auth::check()) {
Reponse::redirect('admin/login');
}
return parent::before();
}
示例4: after
public function after()
{
if (!isset($this->template->heading)) {
$this->template->heading = ucfirst($this->request->controller());
}
if (!isset($this->template->subheading)) {
$this->template->subheading = ucfirst($this->request->action());
}
$session_messages = $this->session->get_once('messages');
if ($session_messages) {
$this->template->messages = array_merge($session_messages, $this->template->messages);
}
$session_errors = $this->session->get_once('errors');
if ($session_errors) {
$this->template->errors = array_merge($session_errors, $this->template->errors);
}
/* Are you logged in? */
$this->template->set_global('isLoggedIn', $this->auth->is_logged_in());
$this->template->set_global('isVerifiedAccount', isset($this->isVerifiedAccount) ? $this->isVerifiedAccount : FALSE);
/* store the user */
$this->template->set_global('account', $this->auth->getAccount());
if ($this->template->isLoggedIn) {
$this->addMenuItem(array('url' => 'convention/checkout', 'title' => 'Purchase Tickets'));
$this->addMenuItem(array('title' => 'My Account', 'url' => 'user'));
if ($this->auth->hasPermission('admin')) {
$this->addMenuItem(array('title' => 'Administration', 'url' => 'admin'));
}
$this->addMenuItem(array('url' => 'user/logout', 'title' => 'Logout'));
}
return parent::after();
}
示例5: before
public function before()
{
parent::before();
!Auth::check() and Response::redirect('/auth/login');
$this->current_user = Model_User::find_by_username(Auth::get_screen_name());
$this->template->set_global('current_user', $this->current_user);
}
示例6: before
public function before()
{
parent::before();
//許可するアクション
$action = array('login', 'index');
//アクティブなアクション
$active = Request::active()->action;
//ログインしていなくて、許可アクション以外は
if (!Auth::check() and !in_array($active, $action)) {
//ログインページへ移動
Response::redirect('pt/login');
}
// public function before(){
// parent::before();
// var_dump(Auth::check());
// if(!Auth::check()){
// Response::redirect('pt/login');
// }
//
// if(!Auth::check()){
// Response::redirect('pt/index');
// }
// $action = array('pt','login','pt/index/HTML5','pt/index/PHP','pt/index');
//
// $active = Request::active()->action;
// var_dump($action); exit;
// var_dump($active); exit;
// if(!Auth::check() and !in_array($active,$action)){
// Response::redirect('pt/index');
// exit;
// }else{
// Response::redirect('pt');
// };
}
示例7: after
public function after($response)
{
if (empty($response) or !$response instanceof Response) {
$response = \Response::forge(\Theme::instance()->render());
}
return parent::after($response);
}
示例8: after
/**
* After action
*/
public function after()
{
$this->template->breadcrumbs = $this->breadcrumbs;
$v_go_previous = View::factory('frontend/v_go_previous');
$this->template->set_global('v_go_previous', $v_go_previous);
parent::after();
}
示例9: before
public function before()
{
if (!Auth::instance()->logged_in() && $this->request->action() != 'get_login' && $this->request->action() != 'post_login') {
$this->redirect('login');
}
parent::before();
}
示例10: before
public function before()
{
// Выполняем функцию родительского класса
parent::before();
$this->template->styles = array(Kohana::$base_url . 'css/admin.css');
$this->template->title = 'Панель управления';
}
示例11: before
public function before()
{
parent::before();
// Load the configuration settings
$config = $this->_config = Kohana::config('docs')->as_array();
// The language is part of the route
if ($lang = $this->request->param('lang'))
{
// Set the language and locale
I18n::lang($lang);
setlocale(LC_ALL, $config['language']['supported'][$lang]['locale']);
// Remember the preferred language
Cookie::set('lang', $this->lang = $lang);
}
else
{
// We need a language, try the cookie or use the default
$lang = Cookie::get('lang', $config['language']['default']);
// Redirect with a chosen language
$this->request->redirect($this->request->uri(array('lang' => $lang)));
}
}
示例12: before
public function before()
{
parent::before();
// if user not connected and not on the login, 404 or session_up pages then redirect to login page
if (Request::active()->action != 'login' && !Sentry::check() && Request::active()->action != '404' && Request::active()->action != 'session_up') {
Session::set(array('redirect' => Request::active()->route->translation));
Response::redirect('login');
}
$this->current_user = self::current_user();
View::set_global('current_user', self::current_user());
if (Sentry::check()) {
// logout if banned
if (Sentry::attempts($this->current_user->username)->get() == Sentry::attempts()->get_limit()) {
Session::set_flash('Your account has been blocked');
Sentry::logout();
Response::redirect('login');
}
}
View::set_global('site_title', 'IKON Backend');
View::set_global('separator', '/');
foreach (Model_Forms::find('all') as $k => $form) {
$this->tables[$k]['cleanName'] = $form->cleanName;
$this->tables[$k]['url'] = $form->url;
$this->tables[$k]['table'] = $form->table;
}
View::set_global('tables', $this->tables);
}
示例13: before
public function before()
{
parent::before();
if (Auth::Check() === false) {
Response::Redirect(Uri::Base());
}
}
示例14: before
public function before()
{
parent::before();
if (\Settings::Get('signup_and_approve') === true && Auth::Check() === false) {
Response::Redirect(Uri::Create('signup'));
}
}
示例15: before
public function before()
{
parent::before();
I18n::lang('ru');
Cookie::$salt = 'eqw67dakbs';
Session::$default = 'cookie';
//$this->cache = Cache::instance('file');
$this->session = Session::instance();
$this->auth = Auth::instance();
$this->user = $this->auth->get_user();
// $captcha = Captcha::instance();
// Подключаем стили и скрипты
$this->template->styles = array();
$this->template->scripts = array();
//Вывод в шаблон
$this->template->title = null;
$this->template->site_name = null;
$this->template->description = null;
$this->template->page_title = null;
//Подключаем главный шаблон
$this->template->main = null;
$this->template->userarea = null;
$this->template->top_menu = View::factory('v_top_menu');
$this->template->manufactures = null;
$this->template->left_categories = null;
$this->template->slider_banner = null;
$this->template->block_left = array();
$this->template->block_center = array();
$this->template->block_right = array();
$this->template->block_footer = null;
}