当前位置: 首页>>代码示例>>PHP>>正文


PHP DefaultController类代码示例

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


在下文中一共展示了DefaultController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 public function handle($params)
 {
     if ($this->_cName == null) {
         // above parseRoute() failed (controller not found) => run Default Controller (if specified)
         global $app_i;
         $def = trim($app_i['default_controller']);
         if ($def != '' && file_exists(BASE . $def)) {
             require_once BASE . $def;
             $ctr = new DefaultController();
             $ctr->handle(null);
             $this->log->debug('Invalid URI. DefaultController called.');
             return;
         }
     }
     // URI parsed OK!
     $fullpath = '/app/' . $this->_cPath . '/' . $this->_cName . '.php';
     $this->log->debug('handle() route: ' . $fullpath);
     $fullpath = BASE . $fullpath;
     if (file_exists($fullpath)) {
         // load parsed Controller
         require_once $fullpath;
         $ctr = new $this->_cName();
         $ctr->handle($this->_cParams);
     } else {
         die('MainController: Error: Controller not found!');
     }
     $this->log->debug('handle() ended');
 }
开发者ID:rsanaie,项目名称:Thin-PHP-Framework,代码行数:28,代码来源:MainController.php

示例2: __construct

 public function __construct()
 {
     $this->splitUrl();
     if (!$this->url_controller) {
         require APP . 'controller/DefaultController.php';
         $page = new DefaultController();
         $page->index();
     } elseif (file_exists(APP . 'controller/' . ucfirst($this->url_controller) . 'Controller.php')) {
         $this->url_controller = ucfirst($this->url_controller) . 'Controller';
         require APP . 'controller/' . $this->url_controller . '.php';
         $this->url_controller = new $this->url_controller();
         if (method_exists($this->url_controller, $this->url_action)) {
             if (!empty($this->url_params)) {
                 call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
             } else {
                 $this->url_controller->{$this->url_action}();
             }
         } else {
             if (strlen($this->url_action) == 0) {
                 $this->url_controller->index();
             } else {
                 header('location: ' . URL . 'error');
             }
         }
     } else {
         header('location: ' . URL . 'error');
     }
 }
开发者ID:robStack,项目名称:prototype-mvc,代码行数:28,代码来源:App.php

示例3: testIndexAction

 public function testIndexAction()
 {
     $view = $this->getServiceMockBuilder('FooView')->getMock();
     $view->expects($this->once())->method('setTemplate')->with('FooBundle:Default:index.twig')->will($this->returnValue(null));
     $view->expects($this->once())->method('handle')->with()->will($this->returnValue('success'));
     $controller = new DefaultController($view);
     $this->assertEquals('success', $controller->indexAction());
 }
开发者ID:nicolas-grekas,项目名称:workshop-symfony3,代码行数:8,代码来源:ExampleHtml5Test.php

示例4: testHelloWorld

 public function testHelloWorld()
 {
     /**
      * @var \Waddle\Classes\App $app
      */
     $app = $this->getMockBuilder('Waddle\\Classes\\App')->disableOriginalConstructor()->getMock();
     $controller = new DefaultController($app);
     $this->expectOutputRegex('/<h1>Hello, World!<\\/h1>/');
     $controller->indexAction('World!');
 }
开发者ID:boggad,项目名称:waddle-mvc,代码行数:10,代码来源:DefaultControllerTest.php

示例5: socialLogin

 public static function socialLogin($uid, $name, $email, $password, $hash)
 {
     $model = UsersModel::model()->where("`social_uid`='{$uid}'  OR `email`='" . $email . "'")->findRow();
     if (!$model) {
         $random_password = rand(10000, 99999);
         $model = new UsersModel();
         $name = trim($name);
         $email = trim($email);
         $password = trim($password);
         $model->name = $name;
         $model->login = $email;
         $model->password = md5($password);
         $model->email = $email;
         $model->is_admin = 0;
         $model->status = 1;
         $model->card_main_id = 1;
         $model->card_main_new_id = 2;
         $model->social_uid = $uid;
         $model->hash = $hash;
         $model->type = 2;
         $model->save();
         DefaultController::sendEmailToUser($model->email, $password, $model->hash, $model->password);
     } else {
         if ($model->status != 0) {
             self::setFields($model);
         } else {
             header("Location: /deactivate");
             exit;
         }
         header("Location: /");
     }
     self::setFields($model);
     header("Location: /");
 }
开发者ID:bionicle12,项目名称:testsite,代码行数:34,代码来源:Auth.php

示例6: connectToController

 /**
  * Trigger a controller according the act param from the url
  * 
  * @param   string $act
  */
 public function connectToController($act)
 {
     $act = ucfirst($act);
     if (!empty($act)) {
         $controllerName = __NAMESPACE__ . '\\' . $act . 'Controller';
         if (!$controllerName && !class_exists($controllerName)) {
             return;
         }
         //  instantiate the view specific controller
         $objController = new $controllerName($this->getSystemComponentController(), $this->cx);
     } else {
         // instantiate the default View Controller
         $objController = new DefaultController($this->getSystemComponentController(), $this->cx);
     }
     $objController->parsePage($this->template);
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:21,代码来源:BackendController.class.php

示例7: confirmarSenha

 public static function confirmarSenha($pwd1, $pwd2)
 {
     $pass = $pwd1 == $pwd2;
     if (!$pass) {
         DefaultController::defineException("senha", "Não foi possível confirmar sua senha!");
     }
     return $pass;
 }
开发者ID:DaniloEpic,项目名称:slast,代码行数:8,代码来源:DefaultController.php

示例8: dispatch

 public function dispatch()
 {
     $flag = false;
     if (isset($_GET['ctrl'], $_GET['act'])) {
         $ctrlName = "Imie\\Controllers\\" . ucfirst($_GET['ctrl']) . 'Controller';
         if (class_exists($ctrlName)) {
             $ctrl = new $ctrlName();
             $actName = $_GET['act'] . 'Action';
             if (method_exists($ctrl, $actName)) {
                 $ctrl->{$actName}();
                 $flag = true;
             }
         }
     }
     if (!$flag) {
         $controller = new DefaultController();
         $controller->indexAction();
     }
 }
开发者ID:MarieYu,项目名称:tp_mvc,代码行数:19,代码来源:Router.php

示例9: display

 /**
  * 
  */
 function display()
 {
     if (!$this->site_template) {
         return parent::display();
     }
     return parent::display($this->site_template);
 }
开发者ID:Barthak,项目名称:voodoo,代码行数:10,代码来源:WikiController.php

示例10: error_404

 public function error_404()
 {
     parent::setLayout('defaultLayout');
     parent::setView('404');
     $this->data['parameters'] = $this->parameters;
     parent::renderLayout();
 }
开发者ID:jezekl,项目名称:logger,代码行数:7,代码来源:Error.class.php

示例11: __construct

 public function __construct()
 {
     parent::__construct();
     # initialize the Perms controller
     $this->_model = new Perms();
     $this->activeSection = 'perms';
 }
开发者ID:uberlinuxguy,项目名称:certis,代码行数:7,代码来源:controller.php

示例12: frmAction

 public function frmAction($id = NULL)
 {
     $disque = $this->getInstance($id);
     //TODO 4.4.1
     $this->view->setVars(array("disque" => $disque, "siteUrl" => $this->url->getBaseUri(), "baseHref" => $this->dispatcher->getControllerName()));
     parent::frmAction($id);
 }
开发者ID:leoarmand,项目名称:Framework_Phalcon,代码行数:7,代码来源:DisquesController.php

示例13: frmAction

 public function frmAction($id = NULL)
 {
     $message = $this->getInstance($id);
     $projects = Projet::find();
     $users = User::find();
     $this->view->setVars(array("message" => $message, "users" => $users, "projects" => $projects));
     parent::frmAction($id);
 }
开发者ID:aleboisselier,项目名称:Increase,代码行数:8,代码来源:MessagesController.php

示例14: display

 function display()
 {
     if (!$this->print_preview) {
         return parent::display();
     }
     $this->addStyleSheet('sheetgen/print.css');
     return parent::display('sheet_template', SHEETGEN_TEMPLATES);
 }
开发者ID:Barthak,项目名称:voodoo-sheetgen,代码行数:8,代码来源:SheetgenController.php

示例15: skate

 public function skate()
 {
     parent::isAllowedToAccess();
     parent::setLayout('defaultLayout');
     parent::setView('skate');
     $this->data['parameters'] = $this->parameters;
     $this->data['orders'] = Statistics::getOrdersOverview(1, '2015-12-02', '2015-12-15');
     parent::renderLayout();
 }
开发者ID:jezekl,项目名称:logger,代码行数:9,代码来源:Dashboard.class.php


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