本文整理汇总了PHP中ThemeUtil::getModuleStylesheet方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeUtil::getModuleStylesheet方法的具体用法?PHP ThemeUtil::getModuleStylesheet怎么用?PHP ThemeUtil::getModuleStylesheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThemeUtil
的用法示例。
在下文中一共展示了ThemeUtil::getModuleStylesheet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: 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;
}
示例3: 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();
}
示例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: render
/**
* Render event handler.
*
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output
*/
public function render(Zikula_Form_View $view)
{
static $firstTime = true;
if ($firstTime) {
PageUtil::addVar('javascript', 'prototype');
PageUtil::addVar('javascript', 'Zikula.UI');
// imageviewer
PageUtil::addVar('javascript', 'modules/Reviews/javascript/Reviews_finder.js');
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Reviews'));
}
$firstTime = false;
if (!SecurityUtil::checkPermission('Reviews:' . ucwords($this->objectType) . ':', '::', ACCESS_COMMENT)) {
return false;
}
$categorisableObjectTypes = array('review');
$catIds = array();
if (in_array($this->objectType, $categorisableObjectTypes)) {
// fetch selected categories to reselect them in the output
// the actual filtering is done inside the repository class
$catIds = ModUtil::apiFunc('Reviews', 'category', 'retrieveCategoriesFromRequest', array('ot' => $this->objectType));
}
$this->selectedItemId = $this->text;
$entityClass = 'Reviews_Entity_' . ucwords($this->objectType);
$serviceManager = ServiceUtil::getManager();
$entityManager = $serviceManager->getService('doctrine.entitymanager');
$repository = $entityManager->getRepository($entityClass);
$sort = $repository->getDefaultSortingField();
$sdir = 'asc';
// convenience vars to make code clearer
$where = '';
$sortParam = $sort . ' ' . $sdir;
$entities = $repository->selectWhere($where, $sortParam);
$view = Zikula_View::getInstance('Reviews', false);
$view->assign('objectType', $this->objectType)->assign('items', $entities)->assign('selectedId', $this->selectedItemId);
// assign category properties
$properties = null;
if (in_array($this->objectType, $categorisableObjectTypes)) {
$properties = ModUtil::apiFunc('Reviews', 'category', 'getAllProperties', array('ot' => $this->objectType));
}
$view->assign('properties', $properties)->assign('catIds', $catIds);
return $view->fetch('external/' . $this->objectType . '/select.tpl');
}
示例6: bbsmiles
/**
* bbsmiles
* returns a html snippet with buttons for inserting bbsmiles into a text
*
* @param $args['textfieldid'] id of the textfield for inserting smilies
*/
public function bbsmiles($args)
{
if (!isset($args['textfieldid']) || empty($args['textfieldid'])) {
return LogUtil::registerArgsError();
}
// if we have more than one textarea we need to distinguish them, so we simply use
// a counter stored in a session var until we find a better solution
$counter = SessionUtil::getVar('bbsmile_counter', 0);
$counter++;
SessionUtil::setVar('bbsmile_counter', $counter);
$this->view->assign('counter', $counter);
$this->view->assign('textfieldid', $args['textfieldid']);
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('BBSmile'));
$templatefile = DataUtil::formatForOS(ModUtil::getName()) . '.tpl';
if ($this->view->template_exists($templatefile)) {
return $this->view->fetch($templatefile);
}
$this->view->add_core_data();
return $this->view->fetch('bbsmile_user_bbsmiles.tpl');
}
示例7: initialize
public function initialize(Zikula_Form_View $view)
{
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
// Include categories only when 2nd category enabled in settings
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', array('editing' => true, 'filter' => array('checkActive' => false, 'expandedPageIds' => SessionUtil::getVar('contentExpandedPageIds', array())), 'enableEscape' => true, 'translate' => false, 'includeLanguages' => true, 'includeCategories' => $this->getVar('categoryUsage') < 3, 'orderBy' => 'setLeft'));
if ($pages === false) {
return $this->view->registerError(null);
}
// Get categories names if enabled
if ($this->getVar('$categoryUsage') < 4) {
$lang = ZLanguage::getLanguageCode();
$categories = array();
foreach ($pages as $page) {
$cat = CategoryUtil::getCategoryByID($page['categoryId']);
$categories[$page['id']] = array();
$categories[$page['id']][] = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
if (isset($page['categories']) && is_array($page['categories'])) {
foreach ($page['categories'] as $pageCat) {
$cat = CategoryUtil::getCategoryByID($pageCat['categoryId']);
$categories[$page['id']][] = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
}
}
}
$this->view->assign('categories', $categories);
}
PageUtil::setVar('title', $this->__('Page list and content structure'));
$csssrc = ThemeUtil::getModuleStylesheet('admin', 'admin.css');
PageUtil::addVar('stylesheet', $csssrc);
$this->view->assign('pages', $pages);
$this->view->assign('multilingual', ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual'));
$this->view->assign('enableVersioning', $this->getVar('enableVersioning'));
$this->view->assign('language', ZLanguage::getLanguageCode());
Content_Util::contentAddAccess($this->view, null);
return true;
}
示例8: 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;
}
示例9: display
/**
* display block
*
* @param array $blockinfo a blockinfo structure
* @return output the rendered bock
*/
public function display($blockinfo)
{
// security check
if (!SecurityUtil::checkPermission('ExtendedMenublock::', $blockinfo['bid'] . '::', ACCESS_READ)) {
return;
}
// Break out options from our content field
$vars = BlockUtil::varsFromContent($blockinfo['content']);
// template to use
if (empty($vars['template'])) {
$vars['template'] = 'blocks_block_extmenu.tpl';
}
// stylesheet to use
if (empty($vars['stylesheet'])) {
$vars['stylesheet'] = 'extmenu.css';
}
// add the stylesheet to the header
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Blocks', $vars['stylesheet']));
// if cache is enabled, checks for a cached output
if ($this->view->getCaching()) {
// set the cache id
$this->view->setCacheId($blockinfo['bkey'] . '/bid' . $blockinfo['bid'] . '/' . UserUtil::getGidCacheString());
// check out if the contents are cached
if ($this->view->is_cached($vars['template'])) {
$blockinfo['content'] = $this->view->fetch($vars['template']);
return BlockUtil::themeBlock($blockinfo);
}
}
// create default block variables
if (!isset($vars['blocktitles'])) {
$vars['blocktitles'] = array();
}
if (!isset($vars['links'])) {
$vars['links'] = array();
}
if (!isset($vars['stylesheet'])) {
$vars['stylesheet'] = '';
}
if (!isset($vars['menuid'])) {
$vars['menuid'] = 0;
}
// get language and default to en
$thislang = ZLanguage::getLanguageCode();
if (!array_key_exists($thislang, $vars['links'])) {
$thislang = 'en';
}
// if specific blocktitle for selected language exists, use it
if (array_key_exists($thislang, $vars['blocktitles']) && !empty($vars['blocktitles'][$thislang])) {
$blockinfo['title'] = $vars['blocktitles'][$thislang];
}
// Content
$menuitems = array();
if (!empty($vars['links'][$thislang])) {
$blocked = array();
foreach ($vars['links'][$thislang] as $linkid => $link) {
$link['parentid'] = isset($link['parentid']) ? $link['parentid'] : null;
$denied = !SecurityUtil::checkPermission('ExtendedMenublock::', $blockinfo['bid'] . ':' . $linkid . ':', ACCESS_READ);
if ($denied || !is_null($link['parentid']) && in_array($link['parentid'], $blocked)) {
$blocked[] = $linkid;
} elseif (!isset($link['active']) || $link['active'] != '1') {
$blocked[] = $linkid;
} else {
// pre zk1.2 check
if (!isset($link['id'])) {
$link['id'] = $linkid;
}
$link['url'] = ModUtil::apiFunc('Blocks', 'user', 'encodebracketurl', $link['url']);
// check for multiple options in image
$this->checkImage($link);
$menuitems[] = $link;
}
}
}
// Modules
if (!empty($vars['displaymodules'])) {
$newmods = ModUtil::getUserMods();
$mods = array();
foreach ($newmods as $module) {
if (!preg_match('#(?:error|blocks)#', strtolower($module['name']))) {
$mods[] = $module;
}
}
// Separate from current content, if any
if (count($menuitems) > 0) {
$menuitems[] = array('name' => ' ', 'url' => '', 'title' => '', 'level' => 0, 'parentid' => null, 'image' => '');
if (SecurityUtil::checkPermission('ExtendedMenublock::', $blockinfo['bid'] . '::', ACCESS_ADMIN)) {
$menuitems[] = array('name' => $this->__('--Installed modules--'), 'url' => ModUtil::url('Blocks', 'admin', 'modify', array('bid' => $blockinfo['bid'])), 'title' => '', 'level' => 0, 'parentid' => null, 'image' => '');
}
}
foreach ($mods as $mod) {
// prepare image
if (SecurityUtil::checkPermission("{$mod['name']}::", '::', ACCESS_OVERVIEW)) {
$menuitems[] = array('name' => $mod['displayname'], 'url' => ModUtil::url($mod['name'], 'user', 'main'), 'title' => $mod['description'], 'level' => 0, 'parentid' => null, 'image' => '');
}
//.........这里部分代码省略.........
示例10: _loadStyleSheets
/**
* Add stylesheet to the page vars.
*
* This makes the modulestylesheet plugin obsolete,
* but only for non-api loads as we would pollute the stylesheets
* not during installation as the Theme engine may not be available yet and not for system themes
* TODO: figure out how to determine if a userapi belongs to a hook module and load the
* corresponding css, perhaps with a new entry in modules table?
*
* @param string $modname Module name.
* @param boolean $api Whether or not it's a api load.
* @param string $type Type.
*
* @return void
*/
private static function _loadStyleSheets($modname, $api, $type)
{
if (!System::isInstalling() && !$api) {
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet($modname));
if (strpos($type, 'admin') === 0) {
// load special admin stylesheets for administrator controllers
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
}
}
}
示例11: finder
/**
* Popup selector for Scribite plugins.
* Finds items of a certain object type.
*
* @param string $objectType The object type.
* @param string $editor Name of used Scribite editor.
* @param string $sort Sorting field.
* @param string $sortdir Sorting direction.
* @param int $pos Current pager position.
* @param int $num Amount of entries to display.
*
* @return output The external item finder page
*/
public function finder()
{
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Reviews'));
$getData = $this->request->query;
$controllerHelper = new Reviews_Util_Controller($this->serviceManager);
$objectType = $getData->filter('objectType', 'review', FILTER_SANITIZE_STRING);
$utilArgs = array('controller' => 'external', 'action' => 'finder');
if (!in_array($objectType, $controllerHelper->getObjectTypes('controller', $utilArgs))) {
$objectType = $controllerHelper->getDefaultObjectType('controllerType', $utilArgs);
}
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Reviews:' . ucwords($objectType) . ':', '::', ACCESS_COMMENT), LogUtil::getErrorMsgPermission());
$entityClass = 'Reviews_Entity_' . ucwords($objectType);
$repository = $this->entityManager->getRepository($entityClass);
$repository->setControllerArguments(array());
$editor = $getData->filter('editor', '', FILTER_SANITIZE_STRING);
if (empty($editor) || !in_array($editor, array('xinha', 'tinymce'))) {
return $this->__('Error: Invalid editor context given for external controller action.');
}
// fetch selected categories to reselect them in the output
// the actual filtering is done inside the repository class
$categoryIds = ModUtil::apiFunc('Reviews', 'category', 'retrieveCategoriesFromRequest', array('ot' => $objectType, 'source' => 'GET'));
$sort = $getData->filter('sort', '', FILTER_SANITIZE_STRING);
if (empty($sort) || !in_array($sort, $repository->getAllowedSortingFields())) {
$sort = $repository->getDefaultSortingField();
}
$sortdir = $getData->filter('sortdir', '', FILTER_SANITIZE_STRING);
$sdir = strtolower($sortdir);
if ($sdir != 'asc' && $sdir != 'desc') {
$sdir = 'asc';
}
$sortParam = $sort . ' ' . $sdir;
// the current offset which is used to calculate the pagination
$currentPage = (int) $getData->filter('pos', 1, FILTER_VALIDATE_INT);
// the number of items displayed on a page for pagination
$resultsPerPage = (int) $getData->filter('num', 0, FILTER_VALIDATE_INT);
if ($resultsPerPage == 0) {
$resultsPerPage = $this->getVar('pageSize', 20);
}
$where = '';
list($entities, $objectCount) = $repository->selectWherePaginated($where, $sortParam, $currentPage, $resultsPerPage);
foreach ($entities as $k => $entity) {
$entity->initWorkflow();
}
$view = Zikula_View::getInstance('Reviews', false);
$view->assign('editorName', $editor)->assign('objectType', $objectType)->assign('items', $entities)->assign('sort', $sort)->assign('sortdir', $sdir)->assign('currentPage', $currentPage)->assign('pager', array('numitems' => $objectCount, 'itemsperpage' => $resultsPerPage));
// assign category properties
$properties = null;
if (in_array($objectType, $this->categorisableObjectTypes)) {
$properties = ModUtil::apiFunc('Reviews', 'category', 'getAllProperties', array('ot' => $objectType));
}
$view->assign('properties', $properties)->assign('catIds', $categoryIds);
return $view->display('external/' . $objectType . '/find.tpl');
}
示例12: load
/**
* Load a block.
*
* @param string $modname Module name.
* @param string $block Name of the block.
*
* @throws LogicException Uf OO-Block is not a Zikula_Controller_AbstractBlock object.
* @return bool True on successful load, false otherwise.
*/
public static function load($modname, $block)
{
$sm = ServiceUtil::getManager();
$modinfo = ModUtil::getInfoFromName($modname);
$serviceId = strtolower('block.' . $modinfo['name'] . '_' . 'Block_' . $block);
if ($sm->hasService($serviceId)) {
return $sm->getService($serviceId);
}
if ($modinfo['type'] == ModUtil::TYPE_MODULE) {
ZLanguage::bindModuleDomain($modinfo['name']);
}
$basedir = ($modinfo['type'] == ModUtil::TYPE_SYSTEM) ? 'system' : 'modules';
$moddir = DataUtil::formatForOS($modinfo['directory']);
$blockdir = "$basedir/$moddir/lib/$moddir/Block";
$ooblock = "$blockdir/" . ucwords($block) . '.php';
ModUtil::load($modname);
$isOO = ModUtil::isOO($modname);
if (!$isOO) {
$blockdirOld = $moddir . '/pnblocks';
$incfile = DataUtil::formatForOS($block . '.php');
if (file_exists("$basedir/$blockdirOld/$incfile")) {
include_once "$basedir/$blockdirOld/$incfile";
} else {
return false;
}
}
// get the block info
if ($isOO) {
$className = ucwords($modinfo['name']) . '_' . 'Block_' . ucwords($block);
$r = new ReflectionClass($className);
$blockInstance = $r->newInstanceArgs(array($sm));
try {
if (!$blockInstance instanceof Zikula_Controller_AbstractBlock) {
throw new LogicException(sprintf('Block %s must inherit from Zikula_Controller_AbstractBlock', $className));
}
} catch (LogicException $e) {
if (System::isDevelopmentMode()) {
throw $e;
} else {
LogUtil::registerError('A fatal error has occured which can be viewed only in development mode.', 500);
return false;
}
}
$sm->attachService($serviceId, $blockInstance);
}
$result = ($isOO ? $blockInstance : true);
if ($isOO) {
$blocks_modules[$block] = call_user_func(array($blockInstance, 'info'));
} else {
$infofunc = "{$modname}_{$block}block_info";
$blocks_modules[$block] = $infofunc();
}
// set the module and keys for the new block
$blocks_modules[$block]['bkey'] = $block;
$blocks_modules[$block]['module'] = $modname;
$blocks_modules[$block]['mid'] = ModUtil::getIdFromName($modname);
// merge the blockinfo in the global list of blocks
if (!isset($GLOBALS['blocks_modules'])) {
$GLOBALS['blocks_modules'] = array();
}
$GLOBALS['blocks_modules'][$blocks_modules[$block]['mid']][$block] = $blocks_modules[$block];
// Initialise block if required (new-style)
if ($isOO) {
call_user_func(array($blockInstance, 'init'));
} else {
$initfunc = "{$modname}_{$block}block_init";
$initfunc();
}
// add stylesheet to the page vars, this makes manual loading obsolete
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet($modname));
return $result;
}
示例13: load
/**
* Load a block.
*
* @param string $modname Module name.
* @param string $block Name of the block.
*
* @throws LogicException Uf OO-Block is not a Zikula_Controller_AbstractBlock object.
* @return bool True on successful load, false otherwise.
*/
public static function load($modname, $block)
{
$sm = ServiceUtil::getManager();
$modinfo = ModUtil::getInfoFromName($modname);
if ($modinfo['state'] != \ModUtil::STATE_ACTIVE) {
return false;
}
$serviceId = strtolower('block.' . $modinfo['name'] . '_' . 'Block_' . $block);
if ($sm->has($serviceId)) {
return $sm->get($serviceId);
}
if ($modinfo['type'] == ModUtil::TYPE_MODULE) {
ZLanguage::bindModuleDomain($modinfo['name']);
}
$basedir = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules';
$moddir = DataUtil::formatForOS($modinfo['directory']);
$blockdir = "{$basedir}/{$moddir}/lib/{$moddir}/Block";
$ooblock = "{$blockdir}/" . ucwords($block) . '.php';
ModUtil::load($modname);
// get the block info
$kernel = $sm->get('kernel');
$module = null;
try {
/** @var $module \Zikula\Core\AbstractModule */
$module = $kernel->getModule($modinfo['name']);
$className = $module->getNamespace() . '\\Block\\' . ucwords($block);
$className = preg_match('/.*Block$/', $className) ? $className : $className . 'Block';
} catch (\InvalidArgumentException $e) {
}
if (!isset($className)) {
$className = ucwords($modinfo['name']) . '\\' . 'Block\\' . ucwords($block);
$className = preg_match('/.*Block$/', $className) ? $className : $className . 'Block';
$classNameOld = ucwords($modinfo['name']) . '_' . 'Block_' . ucwords($block);
$className = class_exists($className) ? $className : $classNameOld;
}
$r = new ReflectionClass($className);
$instanceArgs = array();
if (is_subclass_of($className, 'Zikula_Controller_AbstractBlock')) {
$instanceArgs = array($sm, $module);
} elseif (is_subclass_of($className, 'Zikula\\Core\\Controller\\AbstractBlockController')) {
$instanceArgs = array($module);
}
$blockInstance = $r->newInstanceArgs($instanceArgs);
if (!$blockInstance instanceof Zikula_Controller_AbstractBlock && !$blockInstance instanceof AbstractBlockController) {
throw new LogicException(sprintf('Block %s must inherit from Zikula_Controller_AbstractBlock or Zikula\\Core\\Controller\\AbstractBlockController', $className));
}
$sm->set($serviceId, $blockInstance);
if ($blockInstance instanceof \Symfony\Component\DependencyInjection\ContainerAwareInterface) {
$blockInstance->setContainer($sm);
}
$result = $blockInstance;
$blocks_modules[$block] = call_user_func(array($blockInstance, 'info'));
// set the module and keys for the new block
$blocks_modules[$block]['bkey'] = $block;
$blocks_modules[$block]['module'] = $modname;
$blocks_modules[$block]['mid'] = ModUtil::getIdFromName($modname);
// merge the blockinfo in the global list of blocks
if (!isset($GLOBALS['blocks_modules'])) {
$GLOBALS['blocks_modules'] = array();
}
$GLOBALS['blocks_modules'][$blocks_modules[$block]['mid']][$block] = $blocks_modules[$block];
// Initialise block if required (new-style)
call_user_func(array($blockInstance, 'init'));
// add stylesheet to the page vars, this makes manual loading obsolete
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet($modname));
return $result;
}
示例14: display
function display()
{
$csssrc = ThemeUtil::getModuleStylesheet('mediashare');
PageUtil::addVar('stylesheet', $csssrc);
return pnModFunc('mediashare', 'user', 'simplethumbnails', array('aid' => $this->albumId, 'template' => $this->template, 'count' => $this->itemCount));
}
示例15: load
/**
* Load a block.
*
* @param string $modname Module name.
* @param string $block Name of the block.
*
* @throws LogicException Uf OO-Block is not a Zikula_Controller_AbstractBlock object.
* @return bool True on successful load, false otherwise.
*/
public static function load($modname, $block)
{
$sm = ServiceUtil::getManager();
$modinfo = ModUtil::getInfoFromName($modname);
$serviceId = strtolower('block.' . $modinfo['name'] . '\\Block\\' . $block . 'Block');
if ($sm->has($serviceId)) {
return $sm->get($serviceId);
}
if ($modinfo['type'] == ModUtil::TYPE_MODULE) {
ZLanguage::bindModuleDomain($modinfo['name']);
}
ModUtil::load($modname);
// get the block info
$className = ucwords($modinfo['name']) . '\\Block\\' . ucwords($block) . 'Block';
$r = new ReflectionClass($className);
$blockInstance = $r->newInstanceArgs(array($sm));
$sm->set($serviceId, $blockInstance);
$result = $blockInstance;
$blocks_modules[$block] = call_user_func(array($blockInstance, 'info'));
// set the module and keys for the new block
$blocks_modules[$block]['bkey'] = $block;
$blocks_modules[$block]['module'] = $modname;
$blocks_modules[$block]['mid'] = ModUtil::getIdFromName($modname);
// merge the blockinfo in the global list of blocks
if (!isset($GLOBALS['blocks_modules'])) {
$GLOBALS['blocks_modules'] = array();
}
$GLOBALS['blocks_modules'][$blocks_modules[$block]['mid']][$block] = $blocks_modules[$block];
// Initialise block if required (new-style)
call_user_func(array($blockInstance, 'init'));
// add stylesheet to the page vars, this makes manual loading obsolete
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet($modname));
return $result;
}