本文整理汇总了PHP中Application::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::setTitle方法的具体用法?PHP Application::setTitle怎么用?PHP Application::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::setTitle方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newApplication
/**
* Helper function to create a new application with a new keypair.
* @param type $title
* @return \IdnoPlugins\OAuth2\Application
*/
public static function newApplication($title)
{
$app = new Application();
$app->setTitle($title);
$app->generateKeypair();
return $app;
}
示例2: permissions
/**
* The method which displays the permissions so they could be setup. This
* method is called by the application and it performs recursive calls to
* the drawPermissions() method.
*
* @param $params array Passes the role_id through an array.
* @return String
*/
public function permissions($params)
{
if ($_POST["is_sent"] == "yes") {
//Save the permission values
$this->permissions = Model::load(".permissions");
$permissions = $_POST;
array_pop($permissions);
foreach ($permissions as $permission => $value) {
$this->permissions->delete("role_id = '{$params[0]}' AND permission = '{$permission}'");
$this->permissions->setData(array("role_id" => $params[0], "permission" => $permission, "value" => $value[0], "module" => $value[1]));
$this->permissions->save();
}
//Generate a new side menu for this role
$menu = $this->generateMenus($params[0]);
$flatened = $this->flatenMenu($menu);
$sideMenu = Controller::load(array("system", "side_menu", "generate", serialize($menu)));
file_put_contents("app/cache/menus/side_menu_{$params[0]}.html", $sideMenu->content);
file_put_contents("app/cache/menus/menu_{$params[0]}.object", serialize($flatened));
User::log("Set permissions");
//, $permissions);
}
$path = $params;
array_shift($path);
$accum = Application::$prefix . "/system/roles/permissions/{$params[0]}";
$menu = "<a href='{$accum}'>Permissions</a>";
foreach ($path as $section) {
$accum .= "/{$section}";
$menu .= " > <a href='{$accum}'>" . ucfirst($section) . "</a>";
}
$path = implode("/", $path);
$ret .= "<form class='fapi-form' method='post'>" . $menu . "<br/><hr/>" . $this->drawPermissions($this->getPermissionList("app/modules/{$path}", "app/modules"), $params[0]) . "<input type='hidden' name='is_sent' value='yes'/>" . $this->save . "</div></form>";
Application::setTitle("Role Permissions");
return $ret;
}
示例3: permissions
/**
* The method which displays the permissions so they could be setup. This
* method is called by the application and it performs recursive calls to
* the drawPermissions() method.
*
* @param $params Passes the role_id through an array.
* @return String
*/
public function permissions($params)
{
if ($_POST["is_sent"] == "yes") {
self::insertIntoRoleValidity($params);
//Save the permission values
$this->permissions = Model::load("system.permissions");
$permissions = $_POST;
array_pop($permissions);
foreach ($permissions as $permission => $value) {
$this->permissions->delete(array("filter" => "role_id = ? AND permission = ?", "bind" => array($params[0], $permission)));
$this->permissions->setData(array("role_id" => $params[0], "permission" => $permission, "value" => $value[0], "module" => $value[1]));
$this->permissions->save();
}
}
$path = $params;
array_shift($path);
$accum = "/auth/roles/permissions/{$params[0]}";
$menu = "<a href='{$accum}'>Permissions</a>";
foreach ($path as $section) {
$accum .= "/{$section}";
$menu .= " > <a href='{$accum}'>" . ucfirst($section) . "</a>";
}
$path = implode("/", $path);
$ret .= "<form class='fapi-form' method='post'>" . $menu . "<br/><hr/>" . $this->drawPermissions($this->getPermissionList("app/modules/{$path}", "app/modules"), $params[0]) . "<input type='hidden' name='is_sent' value='yes'/>" . $this->save . "</div></form>";
Application::setTitle("Role Permissions");
return $ret;
}
示例4: 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();
}
示例5: __construct
/**
* Loads an XML file and set's up the class to generate reports based on
* the description of the class.
* @param string $report A path to the xml file which contains the
* description of this report
*/
public function __construct($report, $redirected = false)
{
parent::__construct();
$this->xml = simplexml_load_file(($redirected ? "" : "app/modules") . $report);
$path = $this->xml["name"] . "/generate/pdf";
$this->name = (string) $this->xml["name"];
$this->label = $this->xml["label"];
Application::setTitle($this->label);
$baseModel = $this->xml["baseModel"];
$this->basePackage = isset($this->xml["basePackage"]) ? (string) $this->xml["basePackage"] : reset(explode(".", (string) $this->xml["baseModel"]));
try {
$baseModel = Model::load((string) $baseModel);
} catch (Exception $e) {
throw new Exception("Base model (" . (string) $baseModel . ") could not be loaded ({$e->getMessage()})");
}
$this->referencedFields = array();
foreach ($baseModel->referencedFields as $field) {
$this->referencedFields[] = $field["referencing_field"];
}
}
示例6: 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();
}
示例7: 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());
}
}
}
示例8: 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());
}
}
}
示例9: __construct
/**
* Constructor for the ModelController.
* @param $model An instance of the Model class which represents the model
* to be used.
*/
public function __construct($model = "")
{
$this->modelName = $this->modelName == "" ? $model : $this->modelName;
$this->model = Model::load($this->modelName);
$this->name = $this->model->name;
$this->urlPath = Application::$prefix . "/" . str_replace(".", "/", $this->modelName);
$this->permissionPrefix = $this->permissionPrefix == '' ? str_replace(".", "_", $this->modelName) : $this->permissionPrefix;
$this->label = $this->model->label;
$this->description = $this->model->description;
Application::setTitle($this->label);
$this->_showInMenu = $this->model->showInMenu === "false" ? false : true;
$this->wyfWrapper = new WyfWrapper();
}
示例10: __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");
}
}
示例11: 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);
}
}
示例12: setLabel
public function setLabel($label)
{
Application::setTitle($label);
$this->label = $label;
}
示例13: __construct
public function __construct()
{
Application::setTitle("Access Restricted");
$this->label = "Error";
$this->description = "There was an error loading the content that you requested.";
}