本文整理汇总了PHP中Layout::plug方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::plug方法的具体用法?PHP Layout::plug怎么用?PHP Layout::plug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layout
的用法示例。
在下文中一共展示了Layout::plug方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadNavBar
public static function loadNavBar()
{
$auth = \Current_User::getAuthorization();
$vars['is_admin'] = \Current_User::allow('election');
$vars['logout_uri'] = $auth->logout_link;
$vars['username'] = \Current_User::getDisplayName();
$template = new \Template($vars);
$template->setModuleTemplate('election', 'navbar.html');
$content = $template->get();
\Layout::plug($content, 'NAV_LINKS');
}
示例2: plug
public static function plug()
{
$tpl = array();
$tpl['HOME_LINK'] = PHPWS_Text::moduleLink('Menu', 'intern');
$tpl['ADD_LINK'] = PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'edit_internship'));
$tpl['SEARCH_LINK'] = PHPWS_Text::moduleLink('Search', 'intern', array('action' => 'search'));
$auth = Current_User::getAuthorization();
$tpl['USER_FULL_NAME'] = Current_User::getDisplayName();
$tpl['LOGOUT_URI'] = $auth->logout_link;
$adminOptions = array();
// Edit list of majors
if (Current_User::allow('intern', 'edit_major')) {
$adminOptions['EDIT_MAJORS_LINK'] = PHPWS_Text::secureLink('Edit Undergraduate Majors', 'intern', array('action' => MAJOR_EDIT));
}
// Edit list grad programs
if (Current_User::allow('intern', 'edit_grad_prog')) {
$adminOptions['EDIT_GRAD_LINK'] = PHPWS_Text::secureLink('Edit Graduate Programs', 'intern', array('action' => GRAD_PROG_EDIT));
}
// Edit departments
if (Current_User::allow('intern', 'edit_dept')) {
$adminOptions['EDIT_DEPARTMENTS_LINK'] = PHPWS_Text::secureLink('Edit Departments', 'intern', array('action' => DEPT_EDIT));
}
// Edit list of states
if (Current_User::allow('intern', 'edit_states')) {
$adminOptions['EDIT_STATES_LINK'] = PHPWS_Text::secureLink('Edit States', 'intern', array('action' => STATE_EDIT));
}
if (Current_User::isDeity()) {
$adminOptions['CONTROL_PANEL'] = PHPWS_Text::secureLink('Control Panel', 'controlpanel');
$adminOptions['EDIT_ADMINS_LINK'] = PHPWS_Text::secureLink('Edit Administrators', 'intern', array('action' => 'edit_admins'));
}
// If any admin options were added, them show the dropdown and merge those
// links into the main set of template tags
if (sizeof($adminOptions) > 0) {
$tpl['ADMIN_OPTIONS'] = '';
// dummy var to show dropdown menu in template
$tpl = array_merge($tpl, $adminOptions);
}
Layout::plug(PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS');
}
示例3: javascript
<?php
javascript('jquery');
Layout::plug(Layout::getPageTitle(TRUE), 'SITE_TITLE');
Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'themes/bootstrap/js/bootstrap.min.js"></script>', 'bootstrap');
Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'themes/bootstrap/js/modal_fix.js"></script>', 'fix');
$key = Key::getCurrent();
if (!is_null($key)) {
Layout::plug('active', 'CONTENT_PAGE');
}
示例4: addNavLinks
/**
* This function adds links to the navigation bar at the top of the page.
* This function assumes that there is a NAV_LINKS tag in the main theme template.
*/
private function addNavLinks()
{
// Link to the pages. One nav button for each link.
$viewStats = array("LINK" => "index.php?module=faxmaster&op=show_stats", "TEXT" => "View Statistics");
$viewArchive = array("LINK" => "index.php?module=faxmaster&op=show_archive", "TEXT" => "View Archive");
$settings = array("LINK" => "index.php?module=faxmaster&op=settings", "TEXT" => "Settings");
$actionLog = array("LINK" => "index.php?module=faxmaster&op=showActionLog", "TEXT" => "Action Log");
// Fill the links array
$links = array();
$links['repeat_nav_links'][] = $viewStats;
// view stats button
// Only show 'View Archive' button if user has permission to view the archive
if (Current_User::allow('faxmaster', 'viewArchive')) {
$links['repeat_nav_links'][] = $viewArchive;
// view archive button
}
// Only show 'Settings' button if user has proper permissions
if (Current_User::allow('faxmaster', 'settings')) {
$links['repeat_nav_links'][] = $settings;
// settings button
}
$links['repeat_nav_links'][] = $actionLog;
$links['BRAND'] = 'Fax Server';
$links['BRAND_LINK'] = 'index.php';
if (Current_User::isDeity()) {
$links['CONTROL_PANEL'] = PHPWS_Text::secureLink('Control Panel', 'controlpanel');
$links['ADMIN_OPTIONS'] = '';
//dummy tag to show dropdown menu in template
}
$links['USER_FULL_NAME'] = Current_User::getDisplayName();
$auth = Current_User::getAuthorization();
$links['LOGOUT_URI'] = $auth->logout_link;
// Plug the navlinks into the navbar
$navLinks = PHPWS_Template::process($links, 'faxmaster', 'navLinks.tpl');
Layout::plug($navLinks, 'NAV_LINKS');
}
示例5: loadAdminBar
public static function loadAdminBar()
{
$auth = \Current_User::getAuthorization();
$nav_vars['is_deity'] = \Current_user::isDeity();
$nav_vars['logout_uri'] = $auth->logout_link;
$nav_vars['username'] = \Current_User::getDisplayName();
if (\Current_User::allow('systemsinventory', 'edit')) {
$nav_vars['add'] = '<a href="systemsinventory/system/add"><i class="fa fa-plus"></i> Add System</a>';
}
if (\Current_User::allow('systemsinventory', 'view')) {
$nav_vars['search'] = '<a href="systemsinventory/search"><i class="fa fa-search"></i> Search Systems</a>';
}
if (\Current_User::allow('systemsinventory', 'reports')) {
$nav_vars['reports'] = '<a href="systemsinventory/reports"><i class="fa fa-area-chart"></i> Reports</a>';
}
if (\Current_User::allow('systemsinventory', 'settings')) {
$nav_vars['settings'] = '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"><i class="fa fa-cog"></i> Settings</a>';
}
$nav_bar = new \Template($nav_vars);
$nav_bar->setModuleTemplate('systemsinventory', 'navbar.html');
$content = $nav_bar->get();
\Layout::plug($content, 'NAV_LINKS');
}