當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FrontController::getInstance方法代碼示例

本文整理匯總了PHP中FrontController::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrontController::getInstance方法的具體用法?PHP FrontController::getInstance怎麽用?PHP FrontController::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FrontController的用法示例。


在下文中一共展示了FrontController::getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateACL

 /**
  * save User ACL settings
  */
 public function updateACL($section = '')
 {
     $id = $this->obj->getUid();
     if (!$id) {
         return false;
     }
     $objLst = new AclModel();
     $objLst->connectDb();
     if (is_string($section)) {
         $objLst->where("section='{$section}'");
     }
     if (!$objLst->loadList()) {
         return false;
     }
     $i = 0;
     $fc = FrontController::getInstance();
     $db = DbConnector::getConnection();
     $table = $objLst->dbTable('acl_user');
     while ($objLst->next()) {
         if ($fc->getReqVar('acl_' . $objLst->get('name'))) {
             $db->query('INSERT IGNORE INTO `' . $table . '` SET `user_id`=' . $id . ', `acl_id`=' . $objLst->getUid());
         } else {
             $db->query('DELETE IGNORE FROM `' . $table . '` WHERE `user_id`=' . $id . ' AND `acl_id`=' . $objLst->getUid());
         }
         $i++;
     }
     return $i;
 }
開發者ID:jaeko44,項目名稱:time-tracking,代碼行數:31,代碼來源:auth_acl.php

示例2: indexAction

 function indexAction()
 {
     if (!$this->postAds) {
         $view = new installView();
         $result = $view->render();
         //показываем форму установки
     } else {
         $errMes = $this->postConfig($this->postAds);
         //получаем результат после проверки пост данных
         if (!empty($errMes)) {
             $view = new installView();
             $result = $view->render($errMes);
             //показываем форму установки
         } else {
             $this->db = DB::Conn();
             if (!is_object($this->db)) {
                 $view = new installView();
                 $result = $view->render($this->db);
                 //показываем форму установки
             } else {
                 header('Location: http://' . $_SERVER['HTTP_HOST']);
             }
         }
     }
     $fc = FrontController::getInstance();
     $fc->setBody($result);
 }
開發者ID:slimko,項目名稱:test,代碼行數:27,代碼來源:InstallController.php

示例3: 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

示例4: 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

示例5: __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

示例6: __construct

 public function __construct()
 {
     $fc = FrontController::getInstance();
     $this->params = $fc->getParams();
     $this->format = $fc->getFormat();
     $this->makeObj();
 }
開發者ID:andrianoUkr,項目名稱:webden,代碼行數:7,代碼來源:IndexController.php

示例7: 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

示例8: 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

示例9: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $view = new DefaultModel();
     $out = $view->showIndexPage();
     $fc->setBody($out);
 }
開發者ID:onpavlov,項目名稱:Auto_Playlist_v2,代碼行數:7,代碼來源:IndexController.php

示例10: 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

示例11: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $view = new LoginModel();
     $out = $view->showLoginPage();
     $view->status = $fc->status;
     $fc->setBody($out);
 }
開發者ID:onpavlov,項目名稱:Auto_Playlist_v2,代碼行數:8,代碼來源:LoginController.php

示例12: indexAction

 function indexAction()
 {
     $fc = FrontController::getInstance();
     $model = new TestModel();
     $model->name = $fc->getParams();
     $output = $model->render('../views/index.php');
     $fc->setBody($output);
 }
開發者ID:ralf000,項目名稱:PHP4,代碼行數:8,代碼來源:IndexController.class.php

示例13: init

 /**
  * Initialise application
  */
 public function init()
 {
     $this->_paths = self::$_mainCfg['application']['paths'];
     $this->setIncludePath($this->_paths);
     $this->setAutoload();
     $this->_fc = FrontController::getInstance();
     ErSession::startSession();
 }
開發者ID:G-Grand,項目名稱:webosen2014_diplom,代碼行數:11,代碼來源:ErApplication.php

示例14: getUserRole

 function getUserRole()
 {
     $fc = FrontController::getInstance();
     $usersList = $this->getUsersList();
     $userName = key($this->user);
     if (array_key_exists($userName, $usersList)) {
         return [$userName => $usersList[$userName]];
     }
 }
開發者ID:ralf000,項目名稱:PHP4,代碼行數:9,代碼來源:UserModel.class.php

示例15: getAction

 function getAction()
 {
     $fc = FrontController::getInstance();
     $model = new UserModel();
     $model->user = $fc->getParams();
     $model->userRole = $model->getUserRole();
     $output = $model->render('../views/userRole.php');
     $fc->setBody($output);
 }
開發者ID:ralf000,項目名稱:PHP4,代碼行數:9,代碼來源:UserController.class.php


注:本文中的FrontController::getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。