本文整理汇总了PHP中ModUtil::getModvars方法的典型用法代码示例。如果您正苦于以下问题:PHP ModUtil::getModvars方法的具体用法?PHP ModUtil::getModvars怎么用?PHP ModUtil::getModvars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModUtil
的用法示例。
在下文中一共展示了ModUtil::getModvars方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* @Route("")
* @Theme("admin")
*
* view items
*
* @param Request $request
*
* @return Response HTML output
*/
public function indexAction(Request $request)
{
// Get parameters
$startnum = $request->query->get('startnum', 1);
$orderBy = $request->query->get('orderby', 'pageid');
$currentSortDirection = $request->query->get('sdir', Column::DIRECTION_DESCENDING);
$filterForm = $this->createForm(new FilterType(), $request->query->all(), array('action' => $this->generateUrl('zikulapagesmodule_admin_index'), 'method' => 'POST', 'entityCategoryRegistries' => CategoryRegistryUtil::getRegisteredModuleCategories($this->name, 'PageEntity', 'id')));
$filterForm->handleRequest($request);
$filterData = $filterForm->isSubmitted() ? $filterForm->getData() : $request->query->all();
$sortableColumns = new SortableColumns($this->get('router'), 'zikulapagesmodule_admin_index', 'orderby', 'sdir');
$sortableColumns->addColumn(new Column('pageid'));
// first added is automatically the default
$sortableColumns->addColumn(new Column('title'));
$sortableColumns->addColumn(new Column('cr_date'));
$sortableColumns->setOrderBy($sortableColumns->getColumn($orderBy), $currentSortDirection);
$sortableColumns->setAdditionalUrlParameters(array('language' => isset($filterData['language']) ? $filterData['language'] : null, 'filtercats_serialized' => isset($filterData['categories']) ? serialize($filterData['categories']) : null));
$pages = new PageCollectionManager($this->container->get('doctrine.entitymanager'));
$pages->setStartNumber($startnum);
$pages->setItemsPerPage(\ModUtil::getVar($this->name, 'itemsperpage'));
$pages->setOrder($orderBy, $currentSortDirection);
$pages->enablePager();
$pages->setFilterBy($filterData);
$templateParameters = array();
$templateParameters['filter_active'] = isset($filterData['category']) && count($filterData['category']) > 0 || !empty($filterData['language']);
$templateParameters['sort'] = $sortableColumns->generateSortableColumns();
$templateParameters['pages'] = $pages->get();
$templateParameters['lang'] = ZLanguage::getLanguageCode();
$templateParameters['pager'] = $pages->getPager();
$templateParameters['modvars'] = \ModUtil::getModvars();
// temporary solution
$templateParameters['filterForm'] = $filterForm->createView();
// attempt to disable caching for this only
$response = new Response();
$response->expire();
return $this->render('ZikulaPagesModule:Admin:view.html.twig', $templateParameters, $response);
}
示例2: __construct
//.........这里部分代码省略.........
$this->register_resource('z', array('Zikula_View_Resource', 'z_get_template', 'z_get_timestamp', 'z_get_secure', 'z_get_trusted'));
// set 'z' as default resource type
$this->default_resource_type = 'z';
// process some plugins specially when Render cache is enabled
if (!$this instanceof Zikula_View_Theme && $this->caching) {
$this->register_nocache_plugins();
}
// register the 'nocache' block to allow dynamic zones caching templates
$this->register_block('nocache', array('Zikula_View_Resource', 'block_nocache'), false);
// For ajax requests we use the short urls filter to 'fix' relative paths
if ($this->serviceManager->get('zikula')->getStage() & Zikula_Core::STAGE_AJAX && System::getVar('shorturls')) {
$this->load_filter('output', 'shorturls');
}
// register prefilters
$this->register_prefilter('z_prefilter_add_literal');
$this->register_prefilter('z_prefilter_gettext_params');
//$this->register_prefilter('z_prefilter_notifyfilters');
// assign some useful settings
$this->assign('homepage', $this->homepage)->assign('modinfo', $this->modinfo)->assign('module', $moduleName)->assign('toplevelmodule', $this->toplevelmodule)->assign('type', $this->type)->assign('func', $this->func)->assign('lang', $this->language)->assign('themeinfo', $this->themeinfo)->assign('themepath', isset($themeBundle) ? $themeBundle->getRelativePath() : $this->baseurl . 'themes/' . $theme)->assign('baseurl', $this->baseurl)->assign('baseuri', $this->baseuri)->assign('moduleBundle', ModUtil::getModule($moduleName))->assign('themeBundle', $themeBundle);
if (isset($themeBundle)) {
$stylePath = $themeBundle->getRelativePath() . "/Resources/public/css";
$javascriptPath = $themeBundle->getRelativePath() . "/Resources/public/js";
$imagePath = $themeBundle->getRelativePath() . "/Resources/public/images";
$imageLangPath = $themeBundle->getRelativePath() . "/Resources/public/images/" . $this->language;
} else {
$stylePath = $this->baseurl . "themes/{$theme}/style";
$javascriptPath = $this->baseurl . "themes/{$theme}/javascript";
$imagePath = $this->baseurl . "themes/{$theme}/images";
$imageLangPath = $this->baseurl . "themes/{$theme}/images/" . $this->language;
}
$this->assign('stylepath', $stylePath)->assign('scriptpath', $javascriptPath)->assign('imagepath', $imagePath)->assign('imagelangpath', $imageLangPath);
// for {gt} template plugin to detect gettext domain
if ($this->modinfo['type'] == ModUtil::TYPE_MODULE) {
$this->domain = ZLanguage::getModuleDomain($this->modinfo['name']);
}
// make render object available to modifiers
parent::assign('zikula_view', $this);
// add ServiceManager, EventManager and others to all templates
parent::assign('serviceManager', $this->serviceManager);
parent::assign('eventManager', $this->eventManager);
parent::assign('zikula_core', $this->serviceManager->get('zikula'));
parent::assign('request', $this->request);
$modvars = ModUtil::getModvars();
// Get all modvars from any modules that have accessed their modvars at least once.
// provide compatibility 'alias' array keys
// @todo remove after v1.4.0
if (isset($modvars['ZikulaAdminModule'])) {
$modvars['Admin'] = $modvars['ZikulaAdminModule'];
}
if (isset($modvars['ZikulaBlocksModule'])) {
$modvars['Blocks'] = $modvars['ZikulaBlocksModule'];
}
if (isset($modvars['ZikulaCategoriesModule'])) {
$modvars['Categories'] = $modvars['ZikulaCategoriesModule'];
}
if (isset($modvars['ZikulaExtensionsModule'])) {
$modvars['Extensions'] = $modvars['ZikulaExtensionsModule'];
}
if (isset($modvars['ZikulaGroupsModule'])) {
$modvars['Groups'] = $modvars['ZikulaGroupsModule'];
}
if (isset($modvars['ZikulaMailerModule'])) {
$modvars['Mailer'] = $modvars['ZikulaMailerModule'];
}
if (isset($modvars['ZikulaPageLockModule'])) {
$modvars['PageLock'] = $modvars['ZikulaPageLockModule'];
}
if (isset($modvars['ZikulaPermissionsModule'])) {
$modvars['Permissions'] = $modvars['ZikulaPermissionsModule'];
}
if (isset($modvars['ZikulaSearchModule'])) {
$modvars['Search'] = $modvars['ZikulaSearchModule'];
}
if (isset($modvars['ZikulaSecurityCenterModule'])) {
$modvars['SecurityCenter'] = $modvars['ZikulaSecurityCenterModule'];
}
if (isset($modvars['ZikulaSettingsModule'])) {
$modvars['Settings'] = $modvars['ZikulaSettingsModule'];
}
if (isset($modvars['ZikulaThemeModule'])) {
$modvars['Theme'] = $modvars['ZikulaThemeModule'];
}
if (isset($modvars['ZikulaUsersModule'])) {
$modvars['Users'] = $modvars['ZikulaUsersModule'];
}
// end compatibility aliases
parent::assign('modvars', $modvars);
$this->add_core_data();
// metadata for SEO
if (!$this->serviceManager->hasParameter('zikula_view.metatags')) {
$this->serviceManager->setParameter('zikula_view.metatags', new ArrayObject(array()));
}
parent::assign('metatags', $this->serviceManager->getParameter('zikula_view.metatags'));
if (isset($themeBundle) && $themeBundle->isTwigBased()) {
// correct asset urls when smarty output is wrapped by twig theme
$this->load_filter('output', 'asseturls');
}
$event = new \Zikula\Core\Event\GenericEvent($this);
$this->eventManager->dispatch('view.init', $event);
}
示例3: __construct
//.........这里部分代码省略.........
// write actions should not be cached or weird things happen
if (isset($_POST) && count($_POST) != 0) {
$this->caching = Zikula_View::CACHE_DISABLED;
}
$this->compile_id = '';
$this->cache_id = '';
// template compilation
$this->compile_dir = CacheUtil::getLocalDir('view_compiled');
$this->compile_check = ModUtil::getVar('Theme', 'render_compile_check');
$this->force_compile = ModUtil::getVar('Theme', 'render_force_compile');
// template caching
$this->cache_dir = CacheUtil::getLocalDir('view_cache');
$this->cache_lifetime = ModUtil::getVar('Theme', 'render_lifetime');
$this->expose_template = (ModUtil::getVar('Theme', 'render_expose_template') == true) ? true : false;
// register resource type 'z' this defines the way templates are searched
// during {include file='my_template.tpl'} this enables us to store selected module
// templates in the theme while others can be kept in the module itself.
$this->register_resource('z', array('Zikula_View_Resource',
'z_get_template',
'z_get_timestamp',
'z_get_secure',
'z_get_trusted'));
// set 'z' as default resource type
$this->default_resource_type = 'z';
// process some plugins specially when Render cache is enabled
if (!$this instanceof Zikula_View_Theme && $this->caching) {
$this->register_nocache_plugins();
}
// register the 'nocache' block to allow dynamic zones caching templates
$this->register_block('nocache', array('Zikula_View_Resource', 'block_nocache'), false);
// For ajax requests we use the short urls filter to 'fix' relative paths
if (($this->serviceManager->getService('zikula')->getStage() & Zikula_Core::STAGE_AJAX) && System::getVar('shorturls')) {
$this->load_filter('output', 'shorturls');
}
// register prefilters
$this->register_prefilter('z_prefilter_add_literal');
if ($GLOBALS['ZConfig']['System']['legacy_prefilters']) {
$this->register_prefilter('z_prefilter_legacy');
}
$this->register_prefilter('z_prefilter_gettext_params');
//$this->register_prefilter('z_prefilter_notifyfilters');
// assign some useful settings
$this->assign('homepage', $this->homepage)
->assign('modinfo', $this->modinfo)
->assign('module', $moduleName)
->assign('toplevelmodule', $this->toplevelmodule)
->assign('type', $this->type)
->assign('func', $this->func)
->assign('lang', $this->language)
->assign('themeinfo', $this->themeinfo)
->assign('themepath', $this->baseurl . 'themes/' . $theme)
->assign('baseurl', $this->baseurl)
->assign('baseuri', $this->baseuri);
if (System::isLegacyMode()) {
$this->assign('stylepath', $this->baseurl . 'themes/' . $theme . '/style')
->assign('scriptpath', $this->baseurl . 'themes/' . $theme . '/javascript')
->assign('imagepath', $this->baseurl . 'themes/' . $theme . '/images')
->assign('imagelangpath', $this->baseurl . 'themes/' . $theme . '/images/' . $this->language);
}
// for {gt} template plugin to detect gettext domain
if ($this->modinfo['type'] == ModUtil::TYPE_MODULE) {
$this->domain = ZLanguage::getModuleDomain($this->modinfo['name']);
}
// make render object available to modifiers
parent::assign('zikula_view', $this);
// add ServiceManager, EventManager and others to all templates
parent::assign('serviceManager', $this->serviceManager);
parent::assign('eventManager', $this->eventManager);
parent::assign('zikula_core', $this->serviceManager->getService('zikula'));
parent::assign('request', $this->request);
parent::assign('modvars', ModUtil::getModvars()); // Get all modvars from any modules that have accessed their modvars at least once.
$this->add_core_data();
// metadata for SEO
if (!isset($this->serviceManager['zikula_view.metatags'])) {
$this->serviceManager['zikula_view.metatags'] = new ArrayObject(array());
}
parent::assign('metatags', $this->serviceManager['zikula_view.metatags']);
$event = new Zikula_Event('view.init', $this);
$this->eventManager->notify($event);
}
示例4: displayAction
/**
* @Route("/display/{urltitle}/{pagenum}", requirements={"pagenum" = "^[1-9]\d*$"})
*
* display page
*
* @param Request $request
* @param PageEntity $page
* @param int $pagenum
* @return Response
*/
public function displayAction(Request $request, PageEntity $page, $pagenum = 1)
{
$accessLevel = $this->getAccessLevel($page);
if ($accessLevel == ACCESS_NONE) {
throw new AccessDeniedHttpException();
}
$page->incrementCounter();
$this->get('doctrine.entitymanager')->flush($page);
// A custom template may exist for this page (based on page id)
$customTemplateName = 'ZikulaPagesModule:User:display_' . $page->getPageid() . '.html.twig';
$templateName = $this->get('templating')->exists($customTemplateName) ? $customTemplateName : 'ZikulaPagesModule:User:display.html.twig';
// Explode the page into an array of separate pages based upon the pagebreak
$allPages = explode('<!--pagebreak-->', $page->getContent());
// validates that the requested page exists
if (!isset($allPages[$pagenum - 1])) {
throw new NotFoundHttpException(__('No such page found.'));
}
// Set the item content to be the required page
// arrays are zero-based
$page->setContent(trim($allPages[$pagenum - 1]));
$numitems = count($allPages);
unset($allPages);
$templateParameters = array();
$templateParameters['displayeditlink'] = $accessLevel >= ACCESS_EDIT;
$templateParameters['page'] = $page;
$templateParameters['lang'] = ZLanguage::getLanguageCode();
$templateParameters['modvars'] = \ModUtil::getModvars();
// @todo temporary solution
$templateParameters['pager'] = array('numitems' => $numitems, 'itemsperpage' => 1);
$request->attributes->set('_legacy', true);
// forces template to render inside old theme
return $this->render($templateName, $templateParameters);
}
示例5: __construct
//.........这里部分代码省略.........
$this->language = ZLanguage::getLanguageCode();
$this->baseurl = System::getBaseUrl();
$this->baseuri = System::getBaseUri();
// system info
$this->themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
$this->theme = $this->themeinfo['directory'];
//---- Plugins handling -----------------------------------------------
// add plugin paths
switch ($this->modinfo['type']) {
case ModUtil::TYPE_MODULE:
$mpluginPath = "modules/" . $this->modinfo['directory'] . "/Resources/views/plugins";
break;
case ModUtil::TYPE_SYSTEM:
$mpluginPath = "system/" . $this->modinfo['directory'] . "/Rsources/views/plugins";
break;
default:
$mpluginPath = "system/" . $this->modinfo['directory'] . "/Rsources/views/plugins";
}
// add standard plugin search path
$this->plugins_dir = array();
$this->addPluginDir('config/Resources/plugins');
// Official override
$this->addPluginDir('config/plugins');
// Official override
$this->addPluginDir(ZIKULA_ROOT . '/../src/legacy/viewplugins');
// Core plugins
$this->addPluginDir("themes/{$this->theme}/Resources/views/plugins");
// Theme plugins
$this->addPluginDir(SMARTY_DIR . 'plugins');
// Smarty core plugins
$this->addPluginDir($mpluginPath);
// Plugins for current module
// check if the 'type' parameter in the URL is admin and if yes,
// include system/Admin/templates/plugins to the plugins_dir array
if ($type === 'admin') {
if (!$this instanceof Zikula_View_Theme) {
$this->addPluginDir('system/AdminModule/Resources/views/plugins');
} else {
$this->load_filter('output', 'admintitle');
}
}
//---- Cache handling -------------------------------------------------
if ($caching && in_array((int) $caching, array(0, 1, 2))) {
$this->caching = (int) $caching;
} else {
$this->caching = (int) ModUtil::getVar('Theme', 'render_cache');
}
$this->compile_id = '';
$this->cache_id = '';
// template compilation
$this->compile_dir = CacheUtil::getLocalDir('view_compiled');
$this->compile_check = ModUtil::getVar('Theme', 'render_compile_check');
$this->force_compile = ModUtil::getVar('Theme', 'render_force_compile');
// template caching
$this->cache_dir = CacheUtil::getLocalDir('view_cache');
$this->cache_lifetime = ModUtil::getVar('Theme', 'render_lifetime');
$this->expose_template = ModUtil::getVar('Theme', 'render_expose_template') == true ? true : false;
// register resource type 'z' this defines the way templates are searched
// during {include file='my_template.tpl'} this enables us to store selected module
// templates in the theme while others can be kept in the module itself.
$this->register_resource('z', array('Zikula_View_Resource', 'z_get_template', 'z_get_timestamp', 'z_get_secure', 'z_get_trusted'));
// set 'z' as default resource type
$this->default_resource_type = 'z';
// process some plugins specially when Render cache is enabled
if (!$this instanceof Zikula_View_Theme && $this->caching) {
$this->register_nocache_plugins();
}
// register the 'nocache' block to allow dynamic zones caching templates
$this->register_block('nocache', array('Zikula_View_Resource', 'block_nocache'), false);
// For ajax requests we use the short urls filter to 'fix' relative paths
if ($this->container->get('zikula')->getStage() & \Zikula\Core\Core::STAGE_AJAX && System::getVar('shorturls')) {
$this->load_filter('output', 'shorturls');
}
// register prefilters
$this->register_prefilter('z_prefilter_add_literal');
$this->register_prefilter('z_prefilter_gettext_params');
// assign some useful settings
$this->assign('homepage', $this->homepage)->assign('modinfo', $this->modinfo)->assign('module', $moduleName)->assign('toplevelmodule', $this->toplevelmodule)->assign('type', $this->type)->assign('func', $this->func)->assign('lang', $this->language)->assign('themeinfo', $this->themeinfo)->assign('themepath', $this->baseurl . 'themes/' . $this->theme)->assign('baseurl', $this->baseurl)->assign('baseuri', $this->baseuri);
// for {gt} template plugin to detect gettext domain
if ($this->modinfo['type'] == ModUtil::TYPE_MODULE) {
$this->domain = ZLanguage::getModuleDomain($this->modinfo['name']);
}
// make render object available to modifiers
parent::assign('zikula_view', $this);
// add ServiceManager, EventManager and others to all templates
parent::assign('container', $this->container);
parent::assign('dispatcher', $this->dispatcher);
parent::assign('zikula_core', $this->container->get('zikula'));
parent::assign('request', $this->request);
parent::assign('modvars', ModUtil::getModvars());
// Get all modvars from any modules that have accessed their modvars at least once.
$this->add_core_data();
// metadata for SEO
if (!isset($this->container['zikula_view.metatags'])) {
$this->container['zikula_view.metatags'] = new ArrayObject(array());
}
parent::assign('metatags', $this->container['zikula_view.metatags']);
$event = new GenericEvent($this);
$this->dispatcher->dispatch('view.init', $event);
}