本文整理汇总了PHP中PageUtil::AddVar方法的典型用法代码示例。如果您正苦于以下问题:PHP PageUtil::AddVar方法的具体用法?PHP PageUtil::AddVar怎么用?PHP PageUtil::AddVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageUtil
的用法示例。
在下文中一共展示了PageUtil::AddVar方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_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/ThemeModule/Resources/public/css/form/style.css');
$action = htmlspecialchars(System::getCurrentUri());
$classString = '';
$roleString = '';
if (isset($params['cssClass'])) {
$classString = "class=\"{$params['cssClass']}\" ";
}
if (isset($params['role'])) {
$roleString = "role=\"{$params['role']}\" ";
}
$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}\"" : '';
$onSubmit = isset($params['onsubmit']) ? " onSubmit=\"{$params['onsubmit']}\"" : '';
$view->postRender();
$formId = $view->getFormId();
$out = "\n<form id=\"{$formId}\" {$roleString}{$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}{$onSubmit}>\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;
}
}
示例3: coreinit
/**
* Event listener for 'core.postinit' event.
*
* @param Zikula_Event $event
*
* @return void
*/
public static function coreinit(Zikula_Event $event)
{
// get the module name
$args = array();
$args['modulename'] = ModUtil::getName();
$module = $args['modulename'];
// exit if Content module active - to avoid double loadings if user has given ids and functions
if ($args['modulename'] == 'content') {
return;
}
// Security check if user has COMMENT permission for scribite
if (!SecurityUtil::checkPermission('Scribite::', "{$module}::", ACCESS_COMMENT)) {
return;
}
// get passed func
$func = FormUtil::getPassedValue('func', isset($args['func']) ? $args['func'] : null, 'GET');
// get config for current module
$modconfig = array();
$modconfig = ModUtil::apiFunc('Scribite', 'user', 'getModuleConfig', array('modulename' => $args['modulename']));
// return if module is not supported or editor is not set
if (!$modconfig['mid'] || $modconfig['modeditor'] == '-') {
return;
}
// check if current func is fine for editors or funcs is empty (or all funcs)
if (is_array($modconfig['modfuncs']) && (in_array($func, $modconfig['modfuncs']) || $modconfig['modfuncs'][0] == 'all')) {
$args['areas'] = $modconfig['modareas'];
$args['editor'] = $modconfig['modeditor'];
$scribite = ModUtil::apiFunc('Scribite', 'user', 'loader', array('modulename' => $args['modulename'], 'editor' => $args['editor'], 'areas' => $args['areas']));
// add the scripts to page header
if ($scribite) {
PageUtil::AddVar('header', $scribite);
}
}
}
示例4: smarty_function_cotypeEditor
/**
* CoType
*
* @copyright (C) 2007, Jorn Wildt
* @link http://www.elfisk.dk
* @version $Id$
* @license See license.txt
*/
function smarty_function_cotypeEditor($params, &$render)
{
$inputId = $params['inputId'];
$documentId = (int) $params['documentId'];
static $firstTime = true;
if ($firstTime) {
PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
$moduleStylesheet = '../../../../' . ThemeUtil::getModuleStylesheet('cotype', 'editor.css');
$url = System::getBaseUrl();
$head = "<script type=\"text/javascript\">\nCoTypeStylesheet = '{$moduleStylesheet}';\nCoTypeDocumentId = {$documentId};\n</script>";
PageUtil::AddVar('header', $head);
}
$firstTime = false;
$html = "";
return $html;
}
示例5: uiEdit
/**
* Display a html snippet with buttons for inserting Scribites into a textarea
* NOTE:
* Zikula_DisplayHook extends Zikula\Core\Hook\DisplayHook
* SO - this method SHOULD be backward compatible with old hooks.
*
* @param DisplayHook $hook
*
* @return void
*/
public function uiEdit(DisplayHook $hook)
{
// get the module name
$module = $hook->getCaller();
// Security check if user has COMMENT permission for scribite
if (!SecurityUtil::checkPermission('Scribite::', "{$module}::", ACCESS_COMMENT)) {
return;
}
// load the editor
$scribiteheader = $this->loader(array('modulename' => $module));
// add the scripts to page header
if ($scribiteheader) {
PageUtil::AddVar('header', $scribiteheader);
}
$response = new Zikula_Response_DisplayHook(Scribite_Version::PROVIDER_UIAREANAME, $this->view, 'hook/scribite.tpl');
$hook->setResponse($response);
}
示例6: render
function render(&$render)
{
$dom = ZLanguage::getModuleDomain('mediashare');
PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
PageUtil::AddVar('javascript', 'javascript/ajax/scriptaculous.js');
PageUtil::AddVar('javascript', 'javascript/ajax/pnajax.js');
PageUtil::AddVar('javascript', 'javascript/ajax/lightbox.js');
PageUtil::AddVar('stylesheet', 'javascript/ajax/lightbox/lightbox.css');
PageUtil::AddVar('javascript', 'modules/mediashare/pnjavascript/finditem.js');
PageUtil::AddVar('stylesheet', ThemeUtil::getModuleStylesheet('mediashare'));
$thumbnailSize = (int) pnModGetVar('mediashare', 'thumbnailSize') + 10;
$html = "<div class=\"mediashareItemSelector\">\n<table><tr>\n";
$mediadir = pnModAPIFunc('mediashare', 'user', 'getRelativeMediadir');
if (!($albums = pnModAPIFunc('mediashare', 'user', 'getAllAlbums', array('albumId' => 1)))) {
return false;
}
if ($this->selectedItemId != null) {
$mediaItem = pnModAPIFunc('mediashare', 'user', 'getMediaItem', array('mediaId' => $this->selectedItemId));
if ($mediaItem === false) {
return false;
}
$selectedMediaId = $mediaItem['id'];
$selectedAlbumId = $mediaItem['parentAlbumId'];
} else {
$mediaItem = null;
$selectedMediaId = null;
$selectedAlbumId = count($albums) > 0 ? $albums[0]['id'] : null;
}
$imgSrc = null;
$itemOptionsHtml = '';
if ($selectedAlbumId != null) {
$items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => $selectedAlbumId));
foreach ($items as $item) {
if ($selectedMediaId == null) {
$selectedMediaId = $item['id'];
}
if ($selectedMediaId == $item['id']) {
$imgSrc = $mediadir . $item['thumbnailRef'];
$selected = ' selected="selected"';
} else {
$selected = '';
}
$itemOptionsHtml .= "<option value=\"{$item['id']}\"{$selected}>" . DataUtil::formatForDisplay($item['title']) . "</option>\n";
}
}
$html .= "<td class=\"img\" style=\"height: {$thumbnailSize}px; width: {$thumbnailSize}px;\">\n";
if ($imgSrc != null) {
$imgStyle = '';
} else {
$imgStyle = ' style="display: none"';
}
$html .= "<img id=\"{$this->id}_img\" src=\"{$imgSrc}\" alt=\"\"{$imgStyle}/><br/>\n";
$html .= "</td>\n";
$html .= "<td class=\"selector\">\n";
$html .= "<label for=\"{$this->id}_album\">" . __('Album', $dom) . "</label><br/>";
$html .= "<select id=\"{$this->id}_album\" name=\"{$this->inputName}_album\" onchange=\"mediashare.itemSelector.albumChanged(this,'{$this->id}', '" . $mediadir . "')\">\n";
foreach ($albums as $album) {
$title = '';
for ($i = 1, $cou = (int) $album['nestedSetLevel']; $i < $cou; ++$i) {
$title .= '+ ';
}
if ($selectedAlbumId == $album['id']) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
$html .= "<option value=\"{$album['id']}\"{$selected}>" . $title . DataUtil::formatForDisplay($album['title']) . "</option>\n";
}
$html .= "</select><br/>\n";
$html .= "<label for=\"{$this->id}_item\">" . __('Media item', $dom) . "</label><br/> ";
$html .= "<select id=\"{$this->id}_item\" name=\"{$this->inputName}\" onchange=\"mediashare.itemSelector.itemChanged(this,'{$this->id}', '" . $mediadir . "')\">\n";
if ($selectedAlbumId != null) {
$items = pnModAPIFunc('mediashare', 'user', 'getMediaItems', array('albumId' => $selectedAlbumId));
$html .= $itemOptionsHtml;
}
$html .= "</select>";
$html .= "</td></tr>\n";
if ($this->enableUpload) {
$html .= "<tr><td colspan=\"2\"><a href=\"javascript:void(0)\" id=\"mediashare_upload_collapse\">" . __('Upload', $dom) . "</a><div id=\"mediashare_upload\">\n";
$html .= __('Select an item or upload a file directly', $dom) . '<br/>';
$html .= "<label for=\"{$this->id}_upload\">" . __('Upload', $dom) . "</label>\n";
$html .= "<input type=\"file\" id=\"{$this->id}_upload\" name=\"{$this->inputName}_upload\" class=\"file\"/>\n";
if ($this->enableAddAlbum) {
$html .= '<br/>' . __('Optional name of a new album to place the upload in', $dom) . '<br/>';
$html .= "<label for=\"{$this->id}_newalbum\">" . __('Album', $dom) . "</label>\n";
$html .= "<input type=\"text\" id=\"{$this->id}_newalbum\" name=\"{$this->inputName}_newalbum\"/>\n";
}
$html .= "</div></td></tr>\n";
}
$html .= "</table>\n";
$html .= "<script type=\"text/javascript\">Event.observe(window,'load',function(){mediashare.itemSelector.onLoad('{$this->id}');});\n</script>\n";
$html .= "</div>\n";
return $html;
}
示例7: postInitialize
public function postInitialize()
{
PageUtil::AddVar('javascript', 'prototype');
$this->view->setCaching(false);
}
示例8: dataBound
/**
* DataBound event handler.
*
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
* @param array &$params Parameters passed from the Zikula_View plugin function.
*
* @see Zikula_Form_AbstractPlugin
* @return void
*/
public function dataBound(Zikula_Form_View $view, &$params)
{
PageUtil::AddVar('javascript', 'system/ThemeModule/Resources/public/js/form/form.js');
PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
}
示例9: getFiles
/**
* List the files in server folder
* @author: Albert Pérez Monfort
* @param: args the folder name where to list the files and subfolders
* @return: The list of files and folders
*/
public function getFiles($args)
{
$hook = FormUtil::getPassedValue('hook', isset($args['hook']) ? $args['hook'] : 0, 'GET');
$editor = FormUtil::getPassedValue('editor', isset($args['editor']) ? $args['editor'] : false, 'GET');
PageUtil::AddVar('javascript', 'modules/Files/javascript/getFiles.js');
// get arguments
$root = FormUtil::getPassedValue('root', isset($args['root']) ? $args['root'] : null, 'REQUEST');
$lastFolder = isset($_SESSION['filesModuleLastFolder']) ? $_SESSION['filesModuleLastFolder'] : null;
$folder = FormUtil::getPassedValue('folder', isset($args['folder']) ? $args['folder'] : null, 'REQUEST');
$folder = (is_null($folder) && !is_null($lastFolder) && is_null($root)) ? $lastFolder : $folder;
$_SESSION['filesModuleLastFolder'] = $folder;
$folder = str_replace("|", "/", $folder);
// security check
if (!SecurityUtil::checkPermission( 'Files::', '::', ACCESS_ADD) || !UserUtil::isLoggedIn()) {
$errorMsg = $this->__('Sorry! You have not been granted access to this page.');
$this->view->assign('errorMsg', $errorMsg);
$this->view->assign('external', 1);
$this->view->display('Files_user_errorMsg.tpl');
exit;
}
$oFolder = $folder;
// gets root folder for the user
$check = ModUtil::func('Files', 'user', 'checkingModule');
if ($check['status'] != 'ok') {
$this->view->assign('check', $check);
return $this->view->fetch('Files_user_failedConf.tpl');
}
$initFolderPath = $check['initFolderPath'];
// check if the root folder exists
if(!file_exists($initFolderPath)){
$errorMsg = $this->__('The server directory does not exist. Contact with the website administrator to solve this problem.');
$this->view->assign('errorMsg', $errorMsg);
$this->view->assign('external', 1);
$this->view->display('Files_user_errorMsg.tpl');
exit;
}
// protection. User can not navigate out their root folder
if($folder == ".." || $folder == "."){
$errorMsg = $this->__('Invalid folder') . ': ' . $folder;
$this->view->assign('errorMsg', $errorMsg);
$this->view->assign('external', 1);
$this->view->display('Files_user_errorMsg.tpl');
exit;
}
// get folder name
$folderName = str_replace($initFolderPath . '/' , '', $folder);
$folder = $initFolderPath . '/' . $folder;
// users can not browser the thumbnails folders
if(strpos($folder, '.tbn') !== false) {
LogUtil::registerError($this->__('It is not possible to browse this folder'));
return System::redirect(ModUtil::url('Files', 'external', 'getFiles',
array('folder' => substr($folderName, 0, strrpos($folderName, '/')))));
}
// needed arguments
// check if the folder exists
if(!file_exists($folder)){
$errorMsg = $this->__('Invalid folder').': '.$folderName;
$this->view->assign('errorMsg', $errorMsg);
$this->view->assign('external', 1);
$this->view->display('Files_user_errorMsg.tpl');
exit;
}
// get user's disk use
$userDiskUse = ModUtil::apiFunc('Files', 'user', 'get');
$usedSpace = $userDiskUse['diskUse'];
// get user's allowed space
$userAllowedSpace = ModUtil::func('Files', 'user', 'getUserQuota');
$maxDiskSpace = round($userAllowedSpace * 1024 * 1024);
$percentage = round($usedSpace * 100 / $maxDiskSpace);
$widthUsage = ($percentage > 100) ? 100 : $percentage;
$usedSpaceArray = array('maxDiskSpace' => ModUtil::func('Files', 'user', 'diskUseFormat',
array('value' => $maxDiskSpace)),
'percentage' => $percentage,
'usedDiskSpace' => ModUtil::func('Files', 'user', 'diskUseFormat',
array('value' => $usedSpace)),
'widthUsage' => $widthUsage);
// create output object
$this->view = Zikula_View::getInstance('Files', false);
// get folder files and subfolders
$fileList = ModUtil::func('Files', 'user', 'dir_list',
array('folder' => $folder,
'external' => 1,
'hook' => $hook,
'editor' => $editor));
sort($fileList['dir']);
sort($fileList['file']);
$notwriteable = (!is_writable($folder)) ? true : false;
// check if it is a public directori
$is_public = (!file_exists($folder.'/.locked')) ? true : false ;
$this->view->assign('publicFolder', $is_public);
$this->view->assign('folderPrev', substr($folderName, 0 , strrpos($folderName, '/')));
$folderPath = (SecurityUtil::checkPermission( 'Files::', '::', ACCESS_ADMIN)) ? $folderName : ModUtil::getVar('Files', 'usersFolder') . '/' . strtolower(substr(UserUtil::getVar('uname'), 0 , 1)) . '/' . UserUtil::getVar('uname') . '/' .$folderName;
$imagesArray = array();
//.........这里部分代码省略.........
示例10: loader
/**
* Initialise scribite for requested areas.
*
* @param array $args Text area: 'area', Module name: 'modulename'.
*
* @return string
*/
public static function loader($args)
{
$dom = ZLanguage::getModuleDomain('Scribite');
// Argument checks
if (!isset($args['areas'])) {
return LogUtil::registerError(__('Error! Scribite_Api_User::loader() "area" argument was empty.', $dom));
}
if (!isset($args['modulename'])) {
$args['modulename'] = ModUtil::getName();
}
$module = $args['modulename'];
// Security check if user has COMMENT permission for scribite and module
if (!SecurityUtil::checkPermission('Scribite::', "{$module}::", ACCESS_COMMENT)) {
return;
}
// check for editor argument, if none given the default editor will be used
if (!isset($args['editor']) || empty($args['editor'])) {
// get default editor from config
$defaulteditor = ModUtil::getVar('Scribite', 'DefaultEditor');
if ($defaulteditor == '-') {
return;
// return if no default is set and no arg is given
// id given editor doesn't exist use default editor
} else {
$args['editor'] = $defaulteditor;
}
}
// check if editor argument exists, load default if not given
if (ModUtil::apiFunc('Scribite', 'user', 'getEditors', array('editorname' => $args['editor']))) {
// set some general parameters
$zBaseUrl = rtrim(System::getBaseUrl(), '/');
$zikulaThemeBaseURL = "{$zBaseUrl}/themes/" . DataUtil::formatForOS(UserUtil::getTheme());
$zikulaBaseURI = rtrim(System::getBaseUri(), '/');
$zikulaBaseURI = ltrim($zikulaBaseURI, '/');
$zikulaRoot = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
// prepare view instance
$view = Zikula_View::getInstance('Scribite');
$view->setCaching(false);
$view->assign(ModUtil::getVar('Scribite'));
$view->assign('modname', $args['modulename']);
$view->assign('zBaseUrl', $zBaseUrl);
$view->assign('zikulaBaseURI', $zikulaBaseURI);
$view->assign('zikulaRoot', $zikulaRoot);
$view->assign('editor_dir', $args['editor']);
$view->assign('zlang', ZLanguage::getLanguageCode());
// check for modules installed providing plugins and load specific javascripts
if (ModUtil::available('photoshare')) {
PageUtil::AddVar('javascript', 'modules/photoshare/javascript/findimage.js');
}
if (ModUtil::available('mediashare')) {
PageUtil::AddVar('javascript', 'modules/mediashare/javascript/finditem.js');
}
if (ModUtil::available('pagesetter')) {
PageUtil::AddVar('javascript', 'modules/pagesetter/javascript/findpub.js');
}
if (ModUtil::available('folder')) {
PageUtil::AddVar('javascript', 'modules/folder/javascript/selector.js');
}
if (ModUtil::available('MediaAttach')) {
PageUtil::AddVar('javascript', 'modules/MediaAttach/javascript/finditem.js');
}
if (ModUtil::available('Files')) {
PageUtil::AddVar('javascript', 'modules/Files/javascript/getFiles.js');
}
// main switch for choosen editor
switch ($args['editor']) {
case 'xinha':
// get xinha config if editor is active
// get plugins for xinha
$xinha_listplugins = ModUtil::getVar('Scribite', 'xinha_activeplugins');
if ($xinha_listplugins != '') {
$xinha_listplugins = unserialize($xinha_listplugins);
/* if (in_array('ExtendedFileManager', $xinha_listplugins)) {
$view->assign('EFMConfig', true);
} else { */
$view->assign('EFMConfig', false);
//}
$xinha_listplugins = '\'' . DataUtil::formatForDisplay(implode('\', \'', $xinha_listplugins)) . '\'';
}
// prepare areas for xinha
if ($args['areas'][0] == "all") {
$modareas = 'all';
} elseif ($args['areas'][0] == "PagEd") {
$modareas = 'PagEd';
} else {
$modareas = '\'' . DataUtil::formatForDisplay(implode('\', \'', $args['areas'])) . '\'';
}
// load Prototype
PageUtil::AddVar('javascript', 'prototype');
// set parameters
$view->assign('modareas', $modareas);
$view->assign('xinha_listplugins', $xinha_listplugins);
// end xinha
//.........这里部分代码省略.........
示例11: loader
/**
* Initialise Scribite for requested areas.
*
* @param array $args Module name: 'modulename'.
*
* @return string
*/
private function loader($args)
{
// Argument checks
$module = (isset($args['modulename'])) ? $args['modulename'] : ModUtil::getName();
$overrides = ModUtil::getVar('Scribite', 'overrides');
$editor = (isset($overrides[$module]['editor'])) ? $overrides[$module]['editor'] : ModUtil::getVar('Scribite', 'DefaultEditor');
// check for modules providing helpers and load them into the page
$event = new Zikula_Event('module.scribite.editorhelpers', new Scribite_EditorHelper(), array('editor' => $editor));
$helpers = EventUtil::getManager()->notify($event)->getSubject()->getHelpers();
foreach ($helpers as $helper) {
if (ModUtil::available($helper['module'])) {
PageUtil::AddVar($helper['type'], $helper['path']);
}
}
// check for allowed html
$AllowableHTML = System::getVar('AllowableHTML');
$disallowedhtml = array();
while (list($key, $access) = each($AllowableHTML)) {
if ($access == 0) {
$disallowedhtml[] = DataUtil::formatForDisplay($key);
}
}
// fetch additonal editor specific parameters.
$classname = 'ModulePlugin_Scribite_' . $editor . '_Util';
$additionalEditorParameters = array();
if (method_exists($classname, 'addParameters')) {
$additionalEditorParameters = $classname::addParameters();
}
// fetch external editor plugins
$additionalExternalEditorPlugins = array();
if (method_exists($classname, 'addExternalPlugins')) {
$additionalExternalEditorPlugins = $classname::addExternalPlugins();
}
// assign disabled textareas to template as a javascript array
$javascript = "var disabledTextareas=[";
if (isset($overrides[$module])) {
foreach (array_keys($overrides[$module]) as $area) {
if ($area == 'editor') continue;
if ((isset($overrides[$module][$area]['disabled'])) && ($overrides[$module][$area]['disabled'] == "true")) {
$javascript .= "'" . $area . "',";
}
}
}
$javascript = rtrim($javascript, ",");
$javascript .= "];";
PageUtil::addVar("footer", "<script type='text/javascript'>$javascript</script>");
// assign override parameters to javascript object
$javascript = "";
$paramOverrides = false;
if (isset($overrides[$module])) {
foreach ($overrides[$module] as $area => $config) {
if ($area == 'editor') continue;
if (!empty($config['params'])) {
$paramOverrides = true;
$javascript .= "var paramOverrides_$area = {";
foreach ($config['params'] as $param => $value) {
$javascript .= "\n $param: '$value',";
}
$javascript .= "\n}";
}
}
}
PageUtil::addVar("footer", "<script type='text/javascript'>\n$javascript\n</script>");
// insert notify function
PageUtil::addVar('javascript', 'modules/Scribite/javascript/function-insertnotifyinput.js');
$view = Zikula_View_Plugin::getPluginInstance("Scribite", $editor, Zikula_View::CACHE_DISABLED);
// assign to template in Scribite 'namespace'
$templateVars = array('editorVars' => ModUtil::getVar("moduleplugin.scribite." . strtolower($editor)),
'modname' => $module,
'disallowedhtml' => $disallowedhtml,
'paramOverrides' => $paramOverrides);
if (!empty($additionalEditorParameters)) {
$templateVars['editorParameters'] = $additionalEditorParameters;
}
if (!empty($additionalExternalEditorPlugins)) {
$templateVars['addExtEdPlugins'] = $additionalExternalEditorPlugins;
}
$view->assign('Scribite', $templateVars);
return $view->fetch("editorheader.tpl");
}
示例12: dataBound
/**
* DataBound event handler.
*
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
* @param array &$params Parameters passed from the Zikula_View plugin function.
*
* @see Zikula_Form_AbstractPlugin
* @return void
*/
function dataBound(Zikula_Form_View $view, &$params)
{
PageUtil::AddVar('javascript', 'system/Theme/javascript/form/form.js');
PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
}