本文整理汇总了PHP中PageUtil类的典型用法代码示例。如果您正苦于以下问题:PHP PageUtil类的具体用法?PHP PageUtil怎么用?PHP PageUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PageUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}
示例2: filter
/**
* Inject header assets into the head of the raw source of a page (before </head>)
* Inject footer assets into the foot of the raw source of a page (before </body>)
*
* @param string $source
* @param array $js
* @param array $css
* @return string
*/
public function filter($source, $js = array(), $css = array())
{
if (!empty($css)) {
$this->cssResolver->getBag()->add($css);
}
if (!empty($js)) {
$this->jsResolver->getBag()->add($js);
}
// compile and replace head
$header = $this->cssResolver->compile();
$header .= \JCSSUtil::getJSConfig();
// must be included before other scripts because it defines `Zikula` JS namespace
$header .= $this->scriptPosition == 'head' ? $this->jsResolver->compile() : '';
$header .= implode("\n", $this->headers->all()) . "\n";
$header .= trim(implode("\n", \PageUtil::getVar('header')) . "\n");
// @todo legacy - remove at Core-2.0
if (strripos($source, '</head>')) {
$source = str_replace('</head>', $header . "\n</head>", $source);
}
// compile and replace foot
$footer = $this->scriptPosition == 'foot' ? $this->jsResolver->compile() : '';
$footer .= trim(implode("\n", $this->footers->all()) . "\n");
$footer .= trim(implode("\n", \PageUtil::getVar('footer')) . "\n");
// @todo legacy - remove at Core-2.0
if (false === empty($footer)) {
$source = str_replace('</body>', $footer . "\n</body>", $source);
}
return $source;
}
示例3: 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();
}
}
示例4: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'filter' => array('checkActive' => false), 'includeContent' => false));
if ($page === false) {
throw new Zikula_Exception_Fatal($this->__('Page not found'));
}
// Only allow subpages if edit access on parent page
if (!SecurityUtil::checkPermission('Content:page:', $page['id'] . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
PageUtil::setVar('title', $this->__('Clone page') . ' : ' . $page['title']);
$this->view->assign('page', $page);
Content_Util::contentAddAccess($this->view, $this->pageId);
return true;
}
示例5: 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));
}
示例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/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;
}
}
示例7: actionIndex
public function actionIndex()
{
if (isset($_GET["pagesize"])) {
$this->setListPageSize($_GET["pagesize"]);
}
$key = StringUtil::filterCleanHtml(EnvUtil::getRequest("keyword"));
$fields = array("frp.runid", "frp.processid", "frp.flowprocess", "frp.flag", "frp.opflag", "frp.processtime", "ft.freeother", "ft.flowid", "ft.name as typeName", "ft.type", "ft.listfieldstr", "fr.name as runName", "fr.beginuser", "fr.begintime", "fr.endtime", "fr.focususer");
$sort = "frp.processtime";
$group = "frp.runid";
$condition = array("and", "fr.delflag = 0", "frp.childrun = 0", sprintf("frp.uid = %d", $this->uid), sprintf("FIND_IN_SET(fr.focususer,'%s')", $this->uid));
if ($key) {
$condition[] = array("like", "fr.runid", "%{$key}%");
$condition[] = array("or like", "fr.name", "%{$key}%");
}
$count = Ibos::app()->db->createCommand()->select("count(*) as count")->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->group($group)->queryScalar();
$pages = PageUtil::create($count, $this->getListPageSize());
if ($key && $count) {
$pages->params = array("keyword" => $key);
}
$offset = $pages->getOffset();
$limit = $pages->getLimit();
$list = Ibos::app()->db->createCommand()->select($fields)->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->order($sort)->group($group)->offset($offset)->limit($limit)->queryAll();
$data = array_merge(array("pages" => $pages), $this->handleList($list));
$this->setPageTitle(Ibos::lang("My focus"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang(Ibos::lang("My focus")), "url" => $this->createUrl("focus/index")), array("name" => Ibos::lang("List"))));
$this->render("index", $data);
}
示例8: 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;
}
示例9: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
$offset = (int) FormUtil::getPassedValue('offset');
if ((bool) $this->getVar('inheritPermissions', false) === true) {
if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
} else {
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => false, 'filter' => array('checkActive' => false), 'enableEscape' => true, 'translate' => false, 'includeContent' => false, 'includeCategories' => false));
if ($page === false) {
return $this->view->registerError(null);
}
$versionscnt = ModUtil::apiFunc('Content', 'History', 'getPageVersionsCount', array('pageId' => $this->pageId));
$versions = ModUtil::apiFunc('Content', 'History', 'getPageVersions', array('pageId' => $this->pageId, 'offset' => $offset));
if ($versions === false) {
return $this->view->registerError(null);
}
$this->view->assign('page', $page);
$this->view->assign('versions', $versions);
Content_Util::contentAddAccess($this->view, $this->pageId);
// Assign the values for the smarty plugin to produce a pager
$this->view->assign('numitems', $versionscnt);
PageUtil::setVar('title', $this->__("Page history") . ' : ' . $page['title']);
if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
$this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
}
return true;
}
示例10: pageAddVar
public function pageAddVar($name, $value = null)
{
if (in_array($name, array('stylesheet', 'javascript'))) {
$value = explode(',', $value);
}
\PageUtil::addVar($name, $value);
}
示例11: actionIndex
public function actionIndex()
{
$catId = intval(EnvUtil::getRequest("catid"));
if (EnvUtil::submitCheck("search")) {
$key = $_POST["keyword"];
$list = Position::model()->fetchAll("`posname` LIKE '%{$key}%'");
} else {
$catContidion = empty($catId) ? "" : "catid = {$catId}";
$count = Position::model()->count($catContidion);
$pages = PageUtil::create($count);
$list = Position::model()->fetchAllByCatId($catId, $pages->getLimit(), $pages->getOffset());
$data["pages"] = $pages;
}
foreach ($list as $k => $pos) {
$list[$k]["num"] = User::model()->count("positionid = :positionid AND status != 2", array(":positionid" => $pos["positionid"]));
}
$data["catid"] = $catId;
$catData = PositionUtil::loadPositionCategory();
$data["catData"] = $catData;
$data["list"] = $list;
$data["category"] = StringUtil::getTree($catData, $this->selectFormat);
$this->setPageTitle(Ibos::lang("Position manager"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("Position manager"))));
$this->render("index", $data, false, array("category"));
}
示例12: 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));
}
示例13: 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();
}
示例14: initialize
public function initialize(Zikula_Form_View $view)
{
$this->contentId = (int) FormUtil::getPassedValue('cid', isset($this->args['cid']) ? $this->args['cid'] : -1);
$this->language = ZLanguage::getLanguageCode();
$content = ModUtil::apiFunc('Content', 'Content', 'getContent', array('id' => $this->contentId, 'language' => $this->language, 'translate' => false));
if ($content === false) {
return $this->view->registerError(null);
}
$this->contentType = ModUtil::apiFunc('Content', 'Content', 'getContentType', $content);
if ($this->contentType === false) {
return $this->view->registerError(null);
}
$this->pageId = $content['pageId'];
if ((bool) $this->getVar('inheritPermissions', false) === true) {
if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
} else {
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'includeContent' => false, 'filter' => array('checkActive' => false)));
if ($page === false) {
return $this->view->registerError(null);
}
if ($this->language == $page['language']) {
return $this->view->registerError(LogUtil::registerError($this->__f('Sorry, you cannot translate an item to the same language as it\'s default language ("%1$s"). Change the current site language ("%2$s") to some other language on the <a href="%3$s">localisation settings</a> page.<br /> Another way is to add, for instance, <strong>&lang=de</strong> to the url for changing the current site language to German and after that the item can be translated to German.', array($page['language'], $this->language, ModUtil::url('Settings', 'admin', 'multilingual')))));
}
$translationInfo = ModUtil::apiFunc('Content', 'Content', 'getTranslationInfo', array('contentId' => $this->contentId));
if ($translationInfo === false) {
return $this->view->registerError(null);
}
PageUtil::setVar('title', $this->__("Translate content item") . ' : ' . $page['title']);
$templates = $this->contentType['plugin']->getTranslationTemplates();
$this->view->assign('translationtemplates', $templates);
$this->view->assign('page', $page);
$this->view->assign('data', $content['data']);
$this->view->assign('isTranslatable', $content['isTranslatable']);
$this->view->assign('translated', isset($content['translated']) ? $content['translated'] : array());
$this->view->assign('translationInfo', $translationInfo);
$this->view->assign('translationStep', $this->contentId);
$this->view->assign('language', $this->language);
$this->view->assign('contentType', $this->contentType);
Content_Util::contentAddAccess($this->view, $this->pageId);
if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
$this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
}
if ($this->backref != null) {
$returnUrl = $this->backref;
} else {
$returnUrl = ModUtil::url('Content', 'admin', 'editpage', array('pid' => $this->pageId));
}
ModUtil::apiFunc('PageLock', 'user', 'pageLock', array('lockName' => "contentTranslateContent{$this->contentId}", 'returnUrl' => $returnUrl));
return true;
}
示例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 ($varname != 'header' && $varname != 'footer') {
throw new Zikula_Exception_Fatal(__f('Invalid page variable name: \'%1$s\'.', array($varname)));
}
PageUtil::addVar($varname, $content);
}
}