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


PHP Application::template方法代码示例

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


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

示例1: error

 private function error($errors)
 {
     Application::$template = false;
     header("Content-Type: application/json");
     echo json_encode(array('error' => $errors));
     die;
 }
开发者ID:ekowabaka,项目名称:cfx,代码行数:7,代码来源:SystemApi2Controller.php

示例2: getContents

 public function getContents()
 {
     User::log("Logged out");
     $_SESSION = array();
     Application::$template = "login.tpl";
     Application::redirect("/");
 }
开发者ID:ekowabaka,项目名称:cfx,代码行数:7,代码来源:CfxLogout.php

示例3: getContents

 public function getContents()
 {
     User::log("Logged out");
     $_SESSION = array();
     header("Location: " . Application::getLink("/"));
     Application::$template = "login.tpl";
     return "You have been logged out.";
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:8,代码来源:SystemLogoutController.php

示例4: get

 public function get($params)
 {
     ntentan\logger\Logger::info("Reading Notifications " . print_r($_SESSION['notifications'], true));
     Application::$template = false;
     header('Content-Type: application/json');
     $response = json_encode($_SESSION['notifications']);
     $_SESSION['notifications'] = array();
     return $response;
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:9,代码来源:SystemNotificationsController.php

示例5: __construct

 public function __construct()
 {
     if (substr($_REQUEST["q"], 0, 10) == "system/api") {
         Application::$template = "";
     }
     $this->format = isset($_REQUEST["__api_format"]) ? $_REQUEST["__api_format"] : $this->format;
     unset($_REQUEST["__api_format"]);
     unset($_REQUEST["q"]);
     if ($_SESSION["logged_in"] == false && $_GET["q"] != "system/api/login") {
         print $this->format(array("success" => false, "status" => 101, "message" => "Not authenticated"));
         die;
     }
 }
开发者ID:rocksyne,项目名称:wyf,代码行数:13,代码来源:SystemApiController.php

示例6: getContents

 /**
  * The default page which shows the login form.
  * @see lib/controllers/Controller#getContents()
  */
 public function getContents()
 {
     Application::addStylesheet("css/login.css");
     Application::$template = "login.tpl";
     Application::setTitle("Login");
     if ($_SESSION["logged_in"]) {
         Application::redirect(Application::getLink("/"));
     }
     $form = new Form();
     $form->setRenderer("default");
     $username = new TextField("Username", "username");
     $form->add($username);
     $password = new PasswordField("Password", "password");
     $form->add($password);
     $form->setSubmitValue("Login");
     $form->setCallback("{$this->getClassName()}::callback", $this);
     return $form->render();
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:22,代码来源:SystemLoginController.php

示例7: __construct

 public function __construct()
 {
     ini_set('html_errors', 'Off');
     if (substr($_REQUEST["q"], 0, 10) == "system/api") {
         Application::$template = "";
     }
     $this->format = isset($_REQUEST["__api_format"]) ? $_REQUEST["__api_format"] : $this->format;
     unset($_REQUEST["__api_format"]);
     unset($_REQUEST["q"]);
     if (isset($_REQUEST['__api_key']) && isset($_REQUEST['__api_signature'])) {
         foreach ($_POST as $key => $value) {
             $aggregatedKey .= $key . substr($_POST[$key], 0, 15);
         }
         foreach ($_GET as $key => $value) {
             if ($key == '__api_key' || $key == '__api_signature' || $key == '__api_format' || $key == '__api_session_id' || $key == 'q') {
                 continue;
             }
             $aggregatedKey .= $key . substr($_GET[$key], 0, 15);
         }
         try {
             @($apiKey = reset(Model::load('system.api_keys')->setQueryResolve(false)->getWithField2('key', $_REQUEST['__api_key'])));
             if ($apiKey['active'] == 't') {
                 $signature = sha1($aggregatedKey . $apiKey['secret']);
                 if ($signature == $_GET['__api_signature']) {
                     $_SESSION['logged_in'] = true;
                     $_SESSION['user_id'] = $apiKey['user_id'];
                 }
             }
         } catch (Exception $e) {
             print $this->format(array("success" => false, "message" => $e->getMessage()));
             die;
         }
     }
     if ($_SESSION["logged_in"] == false && $_GET["q"] != "api/login") {
         print $this->format(array("success" => false, "status" => 101, "message" => "Not authenticated"));
         die;
     }
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:38,代码来源:SystemApiController.php

示例8: getContents

 public function getContents()
 {
     //          if(Configuration::get('attempt_counter') == null || Configuration::get('attempt_counter') === '0')
     //        {
     //            Configuration::set('attempt_counter',0);
     //        }
     Application::addStylesheet("css/login.css");
     Application::$template = "login.tpl";
     Application::setTitle("Login");
     if ($_SESSION["logged_in"]) {
         Application::redirect("/");
     }
     $form = new Form();
     $form->setRenderer("default");
     $username = new TextField("Username", "username");
     $form->add($username);
     $password = new PasswordField("Password", "password");
     $password->setEncrypted(false);
     $form->add($password);
     $form->setSubmitValue("Login");
     $form->setValidatorCallback("{$this->getClassName()}::callback");
     $form->setShowClear(false);
     return $form->render();
 }
开发者ID:ekowabaka,项目名称:cfx,代码行数:24,代码来源:CfxAuthLoginController.php

示例9: render

 /**
  * Outputs the application. This calls all the template files and outputs the
  * final application in HTML.
  */
 public static function render()
 {
     $t = Application::$templateEngine;
     if ($_GET["q"] == "") {
         $_GET["q"] = "dashboard";
     }
     $path = explode("/", $_GET["q"]);
     Application::$template = "main.tpl";
     require SOFTWARE_HOME . "app/bootstrap.php";
     $t->assign('prefix', Application::$prefix);
     Application::setTitle();
     $module = Controller::load($path);
     if (Application::$cli) {
         ob_start();
     }
     if (Application::$template == "") {
         print $module->content;
     } else {
         $t->assign('content', $module->content);
         $t->assign('module_name', $module->label);
         $t->assign('module_description', $module->description);
         foreach (array_keys(Application::$menus) as $key) {
             $t->assign($key, Menu::getContents($key));
         }
         $t->assign('stylesheets', Application::$stylesheets);
         $t->assign('styles', $t->fetch('stylesheets.tpl'));
         $t->assign('javascripts', Application::$javascripts);
         $t->assign('scripts', $t->fetch('javascripts.tpl'));
         $t->assign('title', Application::$title);
         $t->display(Application::$template);
     }
     if (Application::$cli) {
         if (Application::$cliOutput == "") {
             print ob_get_clean();
         } else {
             file_put_contents(Application::$cliOutput, ob_get_clean());
         }
     }
 }
开发者ID:rocksyne,项目名称:wyf,代码行数:43,代码来源:Application.php

示例10: render

 /**
  * Outputs the application. This method is the final stage in the application
  * lifecyle which calls all the template files and outputs the
  * final application in HTML. 
  */
 public static function render()
 {
     $t = Application::$templateEngine;
     if ($_GET["q"] == "") {
         $_GET["q"] = Application::$defaultRoute;
     }
     $path = explode("/", $_GET["q"]);
     Application::$template = "main.tpl";
     $t->assign('prefix', Application::$prefix);
     Application::setTitle();
     $module = Controller::load($path);
     if (Application::$cli) {
         ob_start();
     }
     if (Application::$template == "") {
         print $module->content;
     } else {
         $t->assign('content', $module->content);
         $t->assign('module_name', $module->label);
         $t->assign('module_description', $module->description);
         $t->assign('side_menu_hidden', self::$sideMenuHidden);
         foreach (array_keys(Application::$menus) as $key) {
             $t->assign($key, Menu::getContents($key));
         }
         $t->assign('stylesheets', Application::$stylesheets);
         $t->assign('styles', $t->fetch('stylesheets.tpl'));
         $t->assign('javascripts', Application::$javascripts);
         $t->assign('scripts', $t->fetch('javascripts.tpl'));
         $t->assign('title', Application::$title);
         $t->assign('session', $_SESSION);
         $t->assign('info', array_merge(is_array($_SESSION['notes']) ? $_SESSION['notes'] : array(), self::$notes));
         $t->display(Application::$template);
     }
     if (Application::$cli) {
         if (Application::$cliOutput == "") {
             print ob_get_clean();
         } else {
             file_put_contents(Application::$cliOutput, ob_get_clean());
         }
     }
 }
开发者ID:9naQuame,项目名称:wyf,代码行数:46,代码来源:Application.php

示例11: __construct

 /**
  * Constructor for the ModelController.
  * @param $model An instance of the Model class which represents the model
  *               to be used.
  */
 public function __construct($model = "")
 {
     global $redirectedPackage;
     $this->modelName = $this->modelName == "" ? $model : $this->modelName;
     $this->model = Model::load($this->modelName);
     $this->name = $this->model->name;
     $this->t = $t;
     $this->path = $path;
     $this->urlBase = $this->urlBase == '' ? ($redirectedPackage != '' ? "{$redirectedPackage}" : '') . $this->modelName : $this->urlBase;
     $this->urlPath = Application::$prefix . "/" . str_replace(".", "/", $this->urlBase);
     $this->permissionPrefix = $redirectedPackage . str_replace(".", "_", $this->modelName);
     $this->localPath = "app/modules/" . str_replace(".", "/", $this->urlBase);
     if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || $_REQUEST["__api_mode"] == "yes") {
         Application::$template = "";
         $this->apiMode = true;
         unset($_REQUEST["__api_mode"]);
         unset($_REQUEST["q"]);
     } else {
         $this->label = $this->model->label;
         $this->description = $this->model->description;
         Application::setTitle($this->label);
         $this->toolbar = new Toolbar();
         $this->table = new MultiModelTable(Application::$prefix . "/" . str_replace(".", "/", $this->urlBase) . "/");
         $this->table->useAjax = true;
     }
     $this->_showInMenu = $this->model->showInMenu == "false" ? false : true;
     if (file_exists($this->localPath . "/app.xml")) {
         $this->app = simplexml_load_file($this->localPath . "/app.xml");
     }
 }
开发者ID:rocksyne,项目名称:wyf,代码行数:35,代码来源:ModelController.php

示例12: makeSourceResponse

{
    if (!in_array($field, $existFields) || !isset($query)) {
        return [];
    }
    return makeSourceResponse($source::retrieveByField($field, "%" . urldecode($query) . "%", SimpleOrm::FETCH_MANY));
}
// главная страница
Macaw::get('/', function () {
    Application::sendHTMLString(Application::template(dirname(__FILE__) . "/templates/index.html", ['user' => checkAuth()]));
});
Macaw::get('/sign', function () {
    $user = getUser();
    if ($user) {
        redirect("/");
    } else {
        Application::sendHTMLString(Application::template(dirname(__FILE__) . "/templates/signin.html", []));
    }
});
Macaw::post('/sign', function () {
    $user = getUser();
    if ($user) {
        redirect("/");
    } else {
        $gump = new GUMP();
        $data = $gump->sanitize($_POST);
        $gump->validation_rules(array('password' => 'required', 'username' => 'required'));
        $validated_data = $gump->run($data);
        if ($validated_data && authUser($validated_data['username'], $validated_data['password'])) {
            redirect("/");
        } else {
            redirectToLogin();
开发者ID:vugluskr86,项目名称:_autoservice,代码行数:31,代码来源:index.php

示例13: render

 /**
  * Outputs the application. This method is the final stage in the application
  * lifecyle which calls all the template files and outputs the
  * final application in HTML. 
  */
 public static function render()
 {
     $t = Application::$templateEngine;
     if ($_GET["q"] == "") {
         $_GET["q"] = Application::$defaultRoute;
     }
     $path = explode("/", $_GET["q"]);
     Application::$template = "main.tpl";
     $t->assign('prefix', Application::$prefix);
     Application::setTitle();
     $module = Controller::load($path);
     if (Application::$cli) {
         ob_start();
     }
     if (Application::$template == "" || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
         header("x-controller-label: {$module->label}");
         header("x-controller-description: {$module->description}");
         echo $module->content;
     } else {
         $t->assign('content', $module->content);
         $t->assign('module_name', $module->label);
         $t->assign('module_description', $module->description);
         $t->assign('side_menu_hidden', self::$sideMenuHidden);
         foreach (array_keys(Application::$menus) as $key) {
             $t->assign($key, Menu::getContents($key));
         }
         $t->assign('stylesheets', Application::$stylesheets);
         $t->assign('styles', $t->fetch('stylesheets.tpl'));
         $t->assign('javascripts', Application::$javascripts);
         $t->assign('scripts', $t->fetch('javascripts.tpl'));
         $t->assign('title', Application::$title);
         $t->assign('session', $_SESSION);
         $t->assign('info', array_merge(is_array($_SESSION['notes']) ? $_SESSION['notes'] : array(), self::$notes));
         $t->display(Application::$template);
     }
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:41,代码来源:Application.php


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