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


PHP FrontController类代码示例

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


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

示例1: handleException

 public static function handleException($e)
 {
     $fc = new FrontController();
     $page = new Page('error/500', $fc);
     $page->process();
     $fc->getResponse()->send();
 }
开发者ID:sikhlana,项目名称:micro-framework,代码行数:7,代码来源:App.php

示例2: testExecute

 /**
  * Configure ACL to deny everything, thus the request must be dispatched
  * to the authentication controller.
  * 
  * @covers spriebsch\MVC\FrontController
  */
 public function testExecute()
 {
     $this->request = $this->getMock('spriebsch\\MVC\\Request', array(), array(), '', false, false);
     $this->response = $this->getMock('spriebsch\\MVC\\Response', array(), array(), '', false, false);
     $this->session = $this->getMock('spriebsch\\MVC\\Session', array(), array(), '', false, false);
     $this->authAdapter = $this->getMock('spriebsch\\MVC\\AuthenticationAdapter', array(), array(), '', false, false);
     $this->controllerFactory = $this->getMock('spriebsch\\MVC\\ControllerFactory', array(), array(), '', false, false);
     $this->viewFactory = $this->getMock('spriebsch\\MVC\\ViewFactory', array(), array(), '', false, false);
     $this->acl = $this->getMock('spriebsch\\MVC\\Acl', array(), array(), '', false, false);
     $this->appController = $this->getMock('spriebsch\\MVC\\ApplicationController', array(), array(), '', false, false);
     $this->view = $this->getMock('spriebsch\\MVC\\View', array(), array(), '', false, false);
     $this->controller = $this->getMock('spriebsch\\MVC\\Controller', array(), array(), '', false, false);
     // Controller's execute method must be called once and return 'success'.
     $this->controller->expects($this->once())->method('execute')->will($this->returnValue('success'));
     // View's render method must be called once.
     $this->view->expects($this->once())->method('render');
     // ->with($this->equalTo());
     // @todo request and response as parameters
     // The controller factory returns the controller object.
     $this->controllerFactory->expects($this->once())->method('getController')->will($this->returnValue($this->controller));
     // The application controller returns a controller name, class, and
     // method that we ignore anyway.
     $this->appController->expects($this->once())->method('getControllerName')->will($this->returnValue('controller'));
     $this->appController->expects($this->once())->method('getClass')->will($this->returnValue('class'));
     $this->appController->expects($this->once())->method('getMethod')->will($this->returnValue('method'));
     $this->appController->expects($this->once())->method('getView')->will($this->returnValue($this->view));
     $fc = new FrontController($this->request, $this->response, $this->session, $this->authAdapter, $this->acl, $this->appController, $this->controllerFactory);
     $fc->execute();
 }
开发者ID:huanganxin,项目名称:MVC,代码行数:35,代码来源:FrontControllerTest.php

示例3: testDispatchingWorksCorrectly

 /**
  * @covers FrontController::__construct
  * @covers FrontController::dispatch
  */
 public function testDispatchingWorksCorrectly()
 {
     $request = new Request(array('REQUEST_URI' => '/test'));
     $response = new Response();
     $router = new Router();
     $router->set('test', 'TestController');
     $frontController = new FrontController($request, $response, $router, new ControllerFactory(new MapperFactory(new PDO('sqlite::memory:'))), new ViewFactory());
     $this->assertInstanceOf('TestView', $frontController->dispatch($router));
 }
开发者ID:le-toan-mulodo,项目名称:bankaccount,代码行数:13,代码来源:FrontControllerTest.php

示例4: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $view = new DefaultModel();
     $out = $view->showIndexPage();
     $fc->setBody($out);
 }
开发者ID:onpavlov,项目名称:Auto_Playlist_v2,代码行数:7,代码来源:IndexController.php

示例5: getInstance

 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new FrontController();
     }
     return self::$_instance;
 }
开发者ID:OPL,项目名称:Open-Power-Template,代码行数:7,代码来源:mvc.php

示例6: run

 public function run()
 {
     if ($this->getConfigFolder() == null) {
         $this->setConfigFolder('../config');
     }
     $this->frontController = FrontController::getInstance();
     if ($this->router == null) {
         $this->router = new DefaultRouter();
     }
     $this->frontController->setRouter($this->router);
     $sess = $this->config->app['session'];
     if (isset($sess['autostart'])) {
         if ($sess['type'] == 'native') {
             $s = new NativeSession($sess['name'], $sess['lifetime'], $sess['path'], $sess['domain'], $sess['secure']);
             $http = new HttpContext(null, $s);
         }
         $this->setHttpContext($http ?? new HttpContext());
     }
     if (isset($this->config->app['identity']['userClass'])) {
         $userConfigClass = $this->config->app['identity']['userClass'];
         $this->identity = new Identity($userConfigClass, new SimpleDB());
     } else {
         $this->identity = new Identity(new IdentityUser(null, null), new SimpleDB());
     }
     $this->frontController->dispatch();
 }
开发者ID:ksevery,项目名称:MVCEndProject,代码行数:26,代码来源:Application.php

示例7: __construct

 public function __construct()
 {
     $fc = FrontController::getInstance();
     $this->params = $fc->getParams();
     $this->format = $fc->getFormat();
     $this->makeObj();
 }
开发者ID:andrianoUkr,项目名称:webden,代码行数:7,代码来源:IndexController.php

示例8: getInstance

 /**
  * Returns an instance of FrontController object
  * @return FrontController
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:11,代码来源:FrontController.php

示例9: getSubCategories

 public static function getSubCategories($id_lang, $active = true, $id_category = 2, $p = 0, $n = 6)
 {
     $sql_groups_where = '';
     $sql_groups_join = '';
     if (Group::isFeatureActive()) {
         $sql_groups_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'category_group` cg ON (cg.`id_category` = c.`id_category`)';
         $groups = FrontController::getCurrentCustomerGroups();
         $sql_groups_where = 'AND cg.`id_group` ' . (count($groups) ? 'IN (' . pSQL(implode(',', $groups)) . ')' : '=' . (int) Group::getCurrent()->id);
     }
     $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
     SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
     FROM `' . _DB_PREFIX_ . 'category` c
     ' . Shop::addSqlAssociation('category', 'c') . '
     LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category` 
 		AND `id_lang` = ' . (int) $id_lang . ' ' . Shop::addSqlRestrictionOnLang('cl') . ')
     ' . $sql_groups_join . '
     WHERE `id_parent` = ' . (int) $id_category . '
     ' . ($active ? 'AND `active` = 1' : '') . '
     ' . $sql_groups_where . '
     GROUP BY c.`id_category`
     ORDER BY `level_depth` ASC, category_shop.`position` ASC
     LIMIT ' . (int) $p . ', ' . (int) $n);
     foreach ($result as &$row) {
         $row['id_image'] = Tools::file_exists_cache(_PS_CAT_IMG_DIR_ . $row['id_category'] . '.jpg') ? (int) $row['id_category'] : Language::getIsoById($id_lang) . '-default';
         $row['legend'] = 'no picture';
     }
     return $result;
 }
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:28,代码来源:subcategories.php

示例10: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $admin = new Admin();
     $output = $admin->render(ADMIN_TEMPLATE, ADMIN_LOGIN);
     $fc->setBody($output);
 }
开发者ID:TimaVox,项目名称:First-MVC,代码行数:7,代码来源:AdminController.php

示例11: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $model = new PageModel();
     header('HTTP/1.0 Not Found');
     $fc->setBody($model->render('404.php', TEMPLATE));
 }
开发者ID:OzoneRPC,项目名称:mvc.ozone.project,代码行数:7,代码来源:NotFoundController.php

示例12: run

 public static function run($request)
 {
     if (!$request instanceof Request) {
         $request = new Request($request);
     }
     $file = $request->getFile();
     $class = $request->getClass();
     $method = $request->getMethod();
     $args = $request->getArgs();
     $front = FrontController::getInstance();
     $registry = $front->getRegistry();
     $registry->oRequest = $request;
     $front->setRegistry($registry);
     if (file_exists($file)) {
         require_once $file;
         $rc = new ReflectionClass($class);
         // if the controller exists and implements IController
         //			if($rc->implementsInterface('IController'))
         if ($rc->isSubclassOf('BaseController')) {
             try {
                 $controller = $rc->newInstance();
                 $classMethod = $rc->getMethod($method);
                 return $classMethod->invokeArgs($controller, $args);
             } catch (ReflectionException $e) {
                 throw new MvcException($e->getMessage());
             }
         } else {
             //				throw new MvcException("Interface iController must be implemented");
             throw new MvcException("abstract class BaseController must be extended");
         }
     } else {
         throw new MvcException("Controller file not found");
     }
 }
开发者ID:ngukho,项目名称:mvc-cms,代码行数:34,代码来源:Module.class.php

示例13: showAll

 public function showAll()
 {
     $fc = FrontController::getInstance();
     $dbh = $fc->connect();
     $sql = "\n\t\t\tSELECT listenerName, listenerTitle, status, moderatedTime\n\t\t\t\tFROM listener \n\t\t\t\t\tORDER by moderatedTime\n\t\t";
     $sth = $dbh->prepare($sql);
     $sth->execute();
     $result = $sth->fetchAll(PDO::FETCH_ASSOC);
     foreach ($result as $item) {
         switch ($item['status']) {
             case 0:
                 $status = "На модерации";
                 break;
             case 1:
                 $status = "<span class='text-success'>Одобрено</span>";
                 break;
             case 2:
                 $status = "<span class='text-danger'>Отклонено</span>";
                 break;
             case 3:
                 $status = "<span class='text-info'>В архиве</span>";
                 break;
         }
         echo "<tr>\n\t\t\t\t\t<td>{$item['listenerName']}</td>\n\t\t\t\t\t<td>{$item['listenerTitle']}</td>\n\t\t\t\t\t<td>{$status}</td>\n\t\t\t\t\t<td>";
         echo $item[moderatedTime] != 0 ? date("d-m-Y H:i:s", $item[moderatedTime]) : "";
         echo "</td>\n\t\t\t\t</tr>";
     }
 }
开发者ID:sarmaGit,项目名称:orbis,代码行数:28,代码来源:StatisticModel.php

示例14: getInstance

 public static function getInstance()
 {
     if (self::$instance == false) {
         self::$instance = new FrontController();
     }
     return self::$instance;
 }
开发者ID:ruxon,项目名称:framework,代码行数:7,代码来源:FrontController.class.php

示例15: __construct

 public function __construct($obj)
 {
     parent::__construct($obj);
     $this->fc = FrontController::getInstance();
     $this->error = '';
     $this->isLoggedIn = $this->isLoggingOut = false;
 }
开发者ID:TheSoul75,项目名称:time-tracking,代码行数:7,代码来源:auth.php


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