本文整理汇总了PHP中PageUtil::addVar方法的典型用法代码示例。如果您正苦于以下问题:PHP PageUtil::addVar方法的具体用法?PHP PageUtil::addVar怎么用?PHP PageUtil::addVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageUtil
的用法示例。
在下文中一共展示了PageUtil::addVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pageLock
public function pageLock($args)
{
$lockName = $args['lockName'];
$returnUrl = (array_key_exists('returnUrl', $args) ? $args['returnUrl'] : null);
$ignoreEmptyLock = (array_key_exists('ignoreEmptyLock', $args) ? $args['ignoreEmptyLock'] : false);
$uname = UserUtil::getVar('uname');
$lockedHtml = '';
if (!empty($lockName) || !$ignoreEmptyLock) {
PageUtil::AddVar('javascript', 'zikula.ui');
PageUtil::AddVar('javascript', 'system/PageLock/javascript/pagelock.js');
PageUtil::AddVar('stylesheet', ThemeUtil::getModuleStylesheet('pagelock'));
$lockInfo = ModUtil::apiFunc('pagelock', 'user', 'requireLock',
array('lockName' => $lockName,
'lockedByTitle' => $uname,
'lockedByIPNo' => $_SERVER['REMOTE_ADDR']));
$hasLock = $lockInfo['hasLock'];
if (!$hasLock) {
$view = Zikula_View::getInstance('pagelock');
$view->assign('lockedBy', $lockInfo['lockedBy']);
$lockedHtml = $view->fetch('PageLock_lockedwindow.tpl');
}
} else {
$hasLock = true;
}
$html = "<script type=\"text/javascript\">/* <![CDATA[ */ \n";
if (!empty($lockName)) {
if ($hasLock) {
$html .= "document.observe('dom:loaded', PageLock.UnlockedPage);\n";
} else {
$html .= "document.observe('dom:loaded', PageLock.LockedPage);\n";
}
}
$lockedHtml = str_replace("\n", "", $lockedHtml);
$lockedHtml = str_replace("\r", "", $lockedHtml);
// Use "PageLockLifetime*2/3" to add a good margin to lock timeout when pinging
// disabled due to #2556 and #2745
// $returnUrl = DataUtil::formatForDisplayHTML($returnUrl);
$html .= "
PageLock.LockName = '$lockName';
PageLock.ReturnUrl = '$returnUrl';
PageLock.PingTime = " . (PageLockLifetime*2/3) . ";
PageLock.LockedHTML = '" . $lockedHtml . "';
/* ]]> */</script>";
PageUtil::addVar('header', $html);
return true;
}
示例2: smarty_function_AddressShowGmap
/**
* AddressBook
*
* @copyright (c) AddressBook Development Team
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package AddressBook
*/
function smarty_function_AddressShowGmap($params, &$smarty)
{
$dom = ZLanguage::getModuleDomain('AddressBook');
$assign = isset($params['assign']) ? $params['assign'] : null;
$directions = '';
if (isset($params['directions'])) {
$directions = '<a href="http://maps.google.com/maps?f=d&daddr=' . $params['lat_long'];
if (isset($params['zoomlevel'])) {
$directions .= '&z=' . $params['zoomlevel'];
}
$directions .= '" target="_blank">' . __('Get directions to this location', $dom) . '</a>';
}
if (!empty($directions)) {
$directions = '<div>' . $directions . '</div>';
}
include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php';
$map_id = 'googlemap';
if (isset($params['mapid'])) {
$map_id .= $params['mapid'];
}
$app_id = 'ZikulaAddressBook';
$map = new GoogleMapAPI($map_id, $app_id);
if (isset($params['maptype'])) {
$map->setMapType($params['maptype']);
// hybrid, satellite, terrain, roadmap
}
if (isset($params['zoomlevel'])) {
$map->setZoomLevel($params['zoomlevel']);
}
$map->setTypeControlsStyle('dropdown');
$map->setWidth(isset($params['width']) && $params['width'] ? $params['width'] : '100%');
$map->setHeight(isset($params['height']) && $params['height'] ? $params['height'] : '400px');
// handle one (center) point
if (isset($params['lat_long'])) {
$arrLatLong = explode(',', $params['lat_long']);
$map->setCenterCoords($arrLatLong[1], $arrLatLong[0]);
$map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $params['title'], $params['html'], $params['tooltip'], $params['icon'], $params['iconshadow']);
}
// API key
if (isset($params['api_key'])) {
$map->setApiKey($params['api_key']);
}
// handle array of points
if (isset($params['points'])) {
foreach ($params['points'] as $point) {
$arrLatLong = explode(',', $point['lat_long']);
$map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $point['title'], $point['html'], $point['tooltip'], $point['icon'], $point['iconshadow']);
}
}
// load the map
$map->enableOnLoad();
if ($assign) {
$result = $map->getHeaderJS() . $map->getMapJS() . $directions . $map->printMap() . $map->printOnLoad();
$smarty->assign($assign, $result);
} else {
PageUtil::addVar('rawtext', $map->getHeaderJS());
PageUtil::addVar('rawtext', $map->getMapJS());
return $directions . $map->printMap() . $map->printOnLoad();
}
}
示例3: managerAction
/**
* This function generate
*
* @return RedirectResponse
*/
public function managerAction(Request $request, $obj_reference = null, $mode = 'info')
{
// Permission check
if (!$this->get('kaikmedia_gallery_module.access_manager')->hasPermission()) {
throw new AccessDeniedException();
}
$gallerySettings = ['mode' => $mode, 'obj_reference' => $obj_reference];
$masterRequest = $this->get('request_stack')->getMasterRequest();
$gallerySettings['obj_name'] = $masterRequest->attributes->get('_zkModule');
/*
$addMediaForm = $this->createForm(
new AddMediaType(), null , ['allowed_mime_types' => $this->get('kaikmedia_gallery_module.settings_manager')->getAllowedMimeTypesForObject($gallerySettings['obj_name']),
'isXmlHttpRequest' => $request->isXmlHttpRequest()]
);
*/
//$gallerySettings['mediaTypes'] = $this->get('kaikmedia_gallery_module.media_handlers_manager')->getSupportedMimeTypes();
$gallerySettings['settings'] = $this->get('kaikmedia_gallery_module.settings_manager')->getSettingsArray();
\PageUtil::addVar('javascript', "@KaikmediaGalleryModule/Resources/public/js/Kaikmedia.Gallery.settings.js");
\PageUtil::addVar('javascript', "@KaikmediaGalleryModule/Resources/public/js/Kaikmedia.Gallery.mediaItem.js");
\PageUtil::addVar('javascript', "@KaikmediaGalleryModule/Resources/public/js/Kaikmedia.Gallery.Manager.js");
\PageUtil::addVar('stylesheet', "@KaikmediaGalleryModule/Resources/public/css/gallery.manager.css");
\PageUtil::addVar('stylesheet', "@KaikmediaGalleryModule/Resources/public/css/gallery.mediaItem.css");
$request->attributes->set('_legacy', true);
// forces template to render inside old theme
return $this->render('KaikmediaGalleryModule:Plugin:manager.html.twig', array('gallerySettings' => $gallerySettings));
}
示例4: smarty_function_admincategorymenu
/**
* Smarty function to display the category menu for admin links. This also adds the
* navtabs.css to the page vars array for stylesheets.
*
* Admin
* {admincategorymenu}
*
* @see function.admincategorymenu.php::smarty_function_admincategoreymenu()
* @param array $params All attributes passed to this function from the template
* @param object $view Reference to the Zikula_View object
* @return string the results of the module function
*/
function smarty_function_admincategorymenu($params, $view)
{
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
$modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
$acid = ModUtil::apiFunc('AdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
return ModUtil::func('AdminModule', 'admin', 'categorymenu', array('acid' => $acid));
}
示例5: pageAddVar
public function pageAddVar($name, $value = null)
{
if (in_array($name, array('stylesheet', 'javascript'))) {
$value = explode(',', $value);
}
\PageUtil::addVar($name, $value);
}
示例6: smarty_block_form
/**
* Smarty function to wrap Zikula_Form_View generated form controls with suitable form tags.
*
* @param array $params Parameters passed in the block tag.
* @param string $content Content of the block.
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output.
*/
function smarty_block_form($params, $content, $view)
{
if ($content) {
PageUtil::addVar('stylesheet', 'system/Theme/style/form/style.css');
$action = htmlspecialchars(System::getCurrentUri());
$classString = '';
if (isset($params['cssClass'])) {
$classString = "class=\"{$params['cssClass']}\" ";
}
$enctype = array_key_exists('enctype', $params) ? $params['enctype'] : null;
// if enctype is not set directly, check whenever upload plugins were used;
// if so - set proper enctype for file upload
if (is_null($enctype)) {
$uploadPlugins = array_filter($view->plugins, function ($plugin) {
return $plugin instanceof Zikula_Form_Plugin_UploadInput;
});
if (!empty($uploadPlugins)) {
$enctype = 'multipart/form-data';
}
}
$encodingHtml = !is_null($enctype) ? " enctype=\"{$enctype}\"" : '';
$view->postRender();
$formId = $view->getFormId();
$out = "\n<form id=\"{$formId}\" {$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}>\n {$content}\n <div>\n {$view->getStateHTML()}\n {$view->getStateDataHTML()}\n {$view->getIncludesHTML()}\n {$view->getCsrfTokenHtml()}\n <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n <script type=\"text/javascript\">\n <!--\n function FormDoPostBack(eventTarget, eventArgument)\n {\n var f = document.getElementById('{$formId}');\n if (!f.onsubmit || f.onsubmit()) {\n f.FormEventTarget.value = eventTarget;\n f.FormEventArgument.value = eventArgument;\n f.submit();\n }\n }\n // -->\n </script>\n </div>\n</form>\n";
return $out;
}
}
示例7: smarty_function_admincategorymenu
/**
* Smarty function to display the category menu for admin links. This also adds the
* navtabs.css to the page vars array for stylesheets.
*
* Admin
* {admincategorymenu}
*
* @see function.admincategorymenu.php::smarty_function_admincategorymenu()
* @param array $params All attributes passed to this function from the template
* @param \Zikula_View $view Reference to the Zikula_View object
* @return string the results of the module function
*/
function smarty_function_admincategorymenu($params, \Zikula_View $view)
{
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('ZikulaAdminModule'));
$modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
$acid = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
$path = array('_controller' => 'ZikulaAdminModule:Admin:categorymenu', 'acid' => $acid);
$subRequest = $view->getRequest()->duplicate(array(), null, $path);
return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
}
示例8: display
function display()
{
if (ModUtil::available('BBCode') && $this->codeFilter == 'bbcode') {
$code = '[code]' . $this->text . '[/code]';
PageUtil::addVar('stylesheet', 'modules/BBCode/style/style.css');
return ModUtil::apiFunc('BBCode', 'User', 'transform', array('message' => $code));
} else {
return $this->transformCode($this->text, true);
}
}
示例9: __construct
/**
* Sends an event via the EventDispatcher to allow other code to extend the toolbar.
*
* @param EventDispatcher $dispatcher Core event manager.
*/
function __construct(EventDispatcher $dispatcher)
{
$this->dispatcher = $dispatcher;
\PageUtil::addVar('javascript', 'prototype');
\PageUtil::addVar('javascript', 'javascript/debugtoolbar/main.js');
\PageUtil::addVar('stylesheet', 'style/debugtoolbar.css');
// allow modules and plugins to extend the toolbar
$event = new GenericEvent($this);
$this->dispatcher->dispatch('debugtoolbar.init', $event);
}
示例10: __construct
/**
* Sends an event via the EventManager to allow other code to extend the toolbar.
*
* @param Zikula_EventManager $eventManager Core event manager.
*/
public function __construct(Zikula_EventManager $eventManager)
{
$this->eventManager = $eventManager;
PageUtil::addVar('javascript', 'prototype');
PageUtil::addVar('javascript', 'javascript/debugtoolbar/main.js');
PageUtil::addVar('stylesheet', 'style/debugtoolbar.css');
// allow modules and plugins to extend the toolbar
$event = new Zikula_Event('debugtoolbar.init', $this);
$this->eventManager->notify($event);
}
示例11: smarty_function_modulestylesheet
/**
* Smarty function to provide easy access to a stylesheet.
*
* This function provides an easy way to include a stylesheet. The function will add the stylesheet
* file to the 'stylesheet' pagevar by default
*
* This plugin is obsolete since Zikula 1.1.0. The stylesheets are loaded automatically whenever a module
* or block is loaded. We keep this file for the sake of backwards compatibility so that themes do not break.
*
* @param array $params All attributes passed to this function from the template.
* @param object &$smarty Reference to the Smarty object.
*
* @return void But Add Js header if admin
*/
function smarty_function_modulestylesheet($params, &$smarty)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('modulestylesheet')), E_USER_DEPRECATED);
// do nothing unless we are admin
if (SecurityUtil::checkPermission('::', '::', ACCESS_ADMIN)) {
PageUtil::addVar('javascript', 'javascript/ajax/prototype.js');
PageUtil::addVar('header', '<script type="text/javascript">/* <![CDATA[ */ Event.observe(window, "load", function() { alert("' . __('You can safely remove the modulestylesheet plugin from your theme. It is obsolete since Zikula 1.1.0. The adding of stylesheet files has been automated and does not need user interference. This note is shown to Administrators only.') . '");}); /* ]]> */</script>');
}
return;
}
示例12: smarty_block_pageaddvarblock
/**
* Zikula_View function to add the contents of a block to either the header or footer multicontent page variable
*
* This function adds the content of the block to either the end of the <head> portion of the page (using 'header') or to
* a position just prior to the closing </body> tag (using 'footer').
*
* Available parameters:
* - name: The name of the page variable to set, either 'header' or 'footer'; optional, default is 'header'
*
* Examples:
*
* This inline stylesheet will appear in the page's <head> section just before the closing </head>:
* <code>
* {pageaddvarblock name='header'}
* <style type="text/css">
* p { font-size: 1.5em; }
* </style>
* {/pageaddvarblock}
* </code>
*
* This inline script will appear in the page's <body> section just before the closing </body>:
* <code>
* {pageaddvarblock name='footer'}
* <script language="javascript" type="text/javascript">
* alert ('The closing </body> tag is coming.');
* </style>
* {/pageaddvarblock}
* </code>
*
* @param array $params All attributes passed to this function from the template.
* @param string $content The content of the block.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string
*/
function smarty_block_pageaddvarblock($params, $content, Zikula_View $view)
{
if ($content) {
$varname = isset($params['name']) ? $params['name'] : 'header';
if ($varname != 'header' && $varname != 'footer') {
throw new Zikula_Exception_Fatal(__f('Invalid page variable name: \'%1$s\'.', array($varname)));
}
PageUtil::addVar($varname, $content);
}
}
示例13: smarty_function_ms_greyboxheader
function smarty_function_ms_greyboxheader($params, &$smarty)
{
PageUtil::addVar('stylesheet', 'modules/mediashare/pnincludes/greybox/gb_styles.css');
$script = '<script type="text/javascript">
var GB_ROOT_DIR = "' . pnGetBaseURL() . 'modules/mediashare/greybox/";
</script>';
PageUtil::addVar('rawtext', $script);
PageUtil::addVar('javascript', 'modules/mediashare/pnincludes/greybox/AJS.js');
PageUtil::addVar('javascript', 'modules/mediashare/pnincludes/greybox/AJS_fx.js');
PageUtil::addVar('javascript', 'modules/mediashare/pnincludes/greybox/gb_scripts.js');
}
示例14: smarty_block_muboardform
/**
* Smarty function to wrap MUBoard_Form_View generated form controls with suitable form tags.
*
* @param array $params Parameters passed in the block tag.
* @param string $content Content of the block.
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output.
*/
function smarty_block_muboardform($params, $content, $view)
{
if ($content) {
PageUtil::addVar('stylesheet', 'system/Theme/style/form/style.css');
$encodingHtml = array_key_exists('enctype', $params) ? " enctype=\"{$params['enctype']}\"" : '';
$action = htmlspecialchars(System::getCurrentUri());
$classString = '';
if (isset($params['cssClass'])) {
$classString = "class=\"{$params['cssClass']}\" ";
}
$request = new Zikula_Request_Http();
$id = $request->getGet()->filter('id', 0, FILTER_SANITIZE_NUMBER_INT);
$forumid = $request->getGet()->filter('forum', 0, FILTER_SANITIZE_NUMBER_INT);
// we check if the entrypoint is part of the url
$stripentrypoint = ModUtil::getVar('ZConfig', 'shorturlsstripentrypoint');
// get url name
$tables = DBUtil::getTables();
$modcolumn = $tables['modules_column'];
$module = 'MUBoard';
$where = "{$modcolumn['name']} = '" . DataUtil::formatForStore($module) . "'";
$module = DBUtil::selectObject('modules', $where);
$urlname = $module['url'];
if (ModUtil::getVar('ZConfig', 'shorturls') == 0) {
if (strpos($action, "func=display") !== false) {
$action = 'index.php?module=' . $urlname . '&type=user&func=edit&ot=posting&answer=1';
}
if (strpos($action, "func=edit&ot=posting") !== false && $forumid > 0) {
$action = 'index.php?module=' . $urlname . '&type=user&func=edit&ot=posting&forum' . $forumid;
}
} else {
if (strpos($action, $urlname . "/posting/id.") !== false) {
if ($stripentrypoint == 1) {
$action = $urlname . '/edit/ot/posting/answer/1';
} elseif ($stripentrypoint == 0) {
$action = 'index.php/' . $urlname . '/edit/ot/posting/answer/1';
}
}
if (strpos($action, "edit/ot/posting/forum/") !== false && $forumid > 0) {
if ($stripentrypoint == 1) {
$action = $urlname . '/edit/ot/posting/forum/' . $forumid;
} elseif ($stripentrypoint == 0) {
$action = 'index.php/' . $urlname . '/edit/ot/posting/forum/' . $forumid;
}
}
}
$view->postRender();
$formId = $view->getFormId();
$out = "\n <form id=\"{$formId}\" {$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}>\n {$content}\n <div>\n {$view->getStateHTML()}\n {$view->getStateDataHTML()}\n {$view->getIncludesHTML()}\n {$view->getCsrfTokenHtml()}\n <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n <script type=\"text/javascript\">\n <!--\n function FormDoPostBack(eventTarget, eventArgument)\n {\n var f = document.getElementById('{$formId}');\n if (!f.onsubmit || f.onsubmit())\n {\n f.FormEventTarget.value = eventTarget;\n f.FormEventArgument.value = eventArgument;\n f.submit();\n }\n }\n // -->\n </script>\n </div>\n </form>\n ";
return $out;
}
}
示例15: smarty_block_pageaddvarblock
/**
* Zikula_View function to add the contents of a block to either the header or footer multicontent page variable
*
* This function adds the content of the block to either the end of the <head> portion of the page (using 'header') or to
* a position just prior to the closing </body> tag (using 'footer').
*
* Available parameters:
* - name: The name of the page variable to set, either 'header' or 'footer'; optional, default is 'header'
*
* Examples:
*
* This inline stylesheet will appear in the page's <head> section just before the closing </head>:
* <code>
* {pageaddvarblock name='header'}
* <style type="text/css">
* p { font-size: 1.5em; }
* </style>
* {/pageaddvarblock}
* </code>
*
* This inline script will appear in the page's <body> section just before the closing </body>:
* <code>
* {pageaddvarblock name='footer'}
* <script language="javascript" type="text/javascript">
* alert ('The closing </body> tag is coming.');
* </style>
* {/pageaddvarblock}
* </code>
*
* @param array $params All attributes passed to this function from the template.
* @param string $content The content of the block.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string
*/
function smarty_block_pageaddvarblock($params, $content, Zikula_View $view)
{
if ($content) {
$varname = isset($params['name']) ? $params['name'] : 'header';
if (System::isLegacyMode() && $varname == 'rawtext') {
LogUtil::log(__f('Warning! The page variable %1$s is deprecated. Please use %2$s instead.', array('rawtext', 'header')), E_USER_DEPRECATED);
$varname = 'header';
}
if ($varname != 'header' && $varname != 'footer') {
throw new Zikula_Exception_Fatal(__f('Invalid page variable name: \'%1$s\'.', array($varname)));
}
PageUtil::addVar($varname, $content);
}
}