• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Controller_Template类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Controller_Template的典型用法代码示例。如果您正苦于以下问题:PHP Controller_Template类的具体用法?PHP Controller_Template怎么用?PHP Controller_Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Controller_Template类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
 }
开发者ID:hemsinfotech,项目名称:kodelearn,代码行数:29,代码来源:base.php


示例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");
                 }
             }
         }
     }
 }
开发者ID:Bridgeborn,项目名称:Swiftriver,代码行数:26,代码来源:master.php


示例3: before

 /**
  * Before - Check for login
  */
 public function before()
 {
     if ($this->request->action != 'login' and !Auth::check()) {
         Reponse::redirect('admin/login');
     }
     return parent::before();
 }
开发者ID:hfroemmel,项目名称:populu,代码行数:10,代码来源:admin.php


示例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();
 }
开发者ID:halkeye,项目名称:ecmproject,代码行数:31,代码来源:maintemplate.php


示例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);
 }
开发者ID:nobuhiko,项目名称:mylogbook,代码行数:7,代码来源:setting.php


示例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');
     //		};
 }
开发者ID:amemiya0222,项目名称:ameken,代码行数:34,代码来源:pt.php


示例7: after

 public function after($response)
 {
     if (empty($response) or !$response instanceof Response) {
         $response = \Response::forge(\Theme::instance()->render());
     }
     return parent::after($response);
 }
开发者ID:khoapossible,项目名称:vision_system,代码行数:7,代码来源:common.php


示例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();
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:10,代码来源:Frontend.php


示例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();
 }
开发者ID:DavBfr,项目名称:BlogMVC,代码行数:7,代码来源:Admin.php


示例10: before

 public function before()
 {
     // Выполняем функцию родительского класса
     parent::before();
     $this->template->styles = array(Kohana::$base_url . 'css/admin.css');
     $this->template->title = 'Панель управления';
 }
开发者ID:chernogolov,项目名称:blank,代码行数:7,代码来源:Auth.php


示例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)));
		}
	}
开发者ID:nexeck,项目名称:docs,代码行数:26,代码来源:docs.php


示例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);
 }
开发者ID:roine,项目名称:wawaw,代码行数:27,代码来源:base.php


示例13: before

 public function before()
 {
     parent::before();
     if (Auth::Check() === false) {
         Response::Redirect(Uri::Base());
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:7,代码来源:dashboard.php


示例14: before

 public function before()
 {
     parent::before();
     if (\Settings::Get('signup_and_approve') === true && Auth::Check() === false) {
         Response::Redirect(Uri::Create('signup'));
     }
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:7,代码来源:url.php


示例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;
 }
开发者ID:raku,项目名称:mykohana,代码行数:31,代码来源:base.php


示例16: before

 public function before()
 {
     parent::before();
     if (empty(Session::get(self::LOGIN))) {
         return Response::redirect('client/auth');
     }
 }
开发者ID:OICTH1,项目名称:DeliverySupport,代码行数:7,代码来源:client.php


示例17: before

 public function before()
 {
     parent::before();
     if (!Auth::check()) {
         Response::redirect('login');
     }
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:7,代码来源:changeregistration.php


示例18: before

	/**
	 * Loads test suite
	 */
	public function before()
	{
		parent::before();

		if( ! Kohana_Tests::enabled())
		{
			// Pretend this is a normal 404 error...
			$this->status = 404;

			throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri',
				array(':uri' => $this->request->uri));
		}

		// Prevent the whitelist from being autoloaded, but allow the blacklist
		// to be laoded
		Kohana_Tests::configure_enviroment(FALSE);

		$this->config = Kohana::$config->load('phpunit');

		// This just stops some very very long lines
		$route = Route::get('unittest');
		$this->report_uri	= $route->uri(array('controller' => 'phpunit', 'action' => 'report'));
		$this->run_uri		= $route->uri(array('controller' => 'phpunit', 'action' => 'run'));

		// Switch used to disable cc settings
		$this->xdebug_loaded = extension_loaded('xdebug');
		$this->template->set_global('xdebug_enabled', $this->xdebug_loaded);
	}
开发者ID:nike-17,项目名称:unittest,代码行数:31,代码来源:phpunit.php


示例19: before

 /**
  * before create
  */
 public function before()
 {
     parent::before();
     $this->template->content = '';
     $this->template->styles = array('main');
     $this->template->scripts = '';
 }
开发者ID:alex-bro,项目名称:test-vezom,代码行数:10,代码来源:Appcontroller.php


示例20: before

 /**
  * Construct controller
  */
 public function before()
 {
     parent::before();
     if (!Visitor::instance()->logged_in('admin')) {
         throw new Permission_Exception(new Model_Role());
     }
 }
开发者ID:netbiel,项目名称:core,代码行数:10,代码来源:roles.php



注:本文中的Controller_Template类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Conversation类代码示例发布时间:2022-05-23
下一篇:
PHP Controller_Base类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap