本文整理汇总了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;
}
示例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);
}
示例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>";
}
}
示例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();
}
示例5: __construct
public function __construct($obj)
{
parent::__construct($obj);
$this->fc = FrontController::getInstance();
$this->error = '';
$this->isLoggedIn = $this->isLoggingOut = false;
}
示例6: __construct
public function __construct()
{
$fc = FrontController::getInstance();
$this->params = $fc->getParams();
$this->format = $fc->getFormat();
$this->makeObj();
}
示例7: indexAction
public function indexAction()
{
$fc = FrontController::getInstance();
$admin = new Admin();
$output = $admin->render(ADMIN_TEMPLATE, ADMIN_LOGIN);
$fc->setBody($output);
}
示例8: indexAction
public function indexAction()
{
$fc = FrontController::getInstance();
$model = new PageModel();
header('HTTP/1.0 Not Found');
$fc->setBody($model->render('404.php', TEMPLATE));
}
示例9: indexAction
public function indexAction()
{
$fc = FrontController::getInstance();
$view = new DefaultModel();
$out = $view->showIndexPage();
$fc->setBody($out);
}
示例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");
}
}
示例11: indexAction
public function indexAction()
{
$fc = FrontController::getInstance();
$view = new LoginModel();
$out = $view->showLoginPage();
$view->status = $fc->status;
$fc->setBody($out);
}
示例12: indexAction
function indexAction()
{
$fc = FrontController::getInstance();
$model = new TestModel();
$model->name = $fc->getParams();
$output = $model->render('../views/index.php');
$fc->setBody($output);
}
示例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();
}
示例14: getUserRole
function getUserRole()
{
$fc = FrontController::getInstance();
$usersList = $this->getUsersList();
$userName = key($this->user);
if (array_key_exists($userName, $usersList)) {
return [$userName => $usersList[$userName]];
}
}
示例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);
}