本文整理汇总了PHP中ModUtil::getModuleImagePath方法的典型用法代码示例。如果您正苦于以下问题:PHP ModUtil::getModuleImagePath方法的具体用法?PHP ModUtil::getModuleImagePath怎么用?PHP ModUtil::getModuleImagePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModUtil
的用法示例。
在下文中一共展示了ModUtil::getModuleImagePath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_modgetimage
/**
* Zikula_View function to the admin image path of a module
*
* This function returns the path to the admin image of the current top-level
* module if $modname is not set. Otherwise it returns the path to the admin
* image of the given module.
*
*
* Available parameters:
* - assign: If set, the results are assigned to the corresponding
* variable instead of printed out
* - modname: The module to return the image path for
* (defaults to top-level module)
*
* Example
* {modgetimage|safetext}
*
* @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 path to the module's admin image
*/
function smarty_function_modgetimage($params, Zikula_View $view)
{
$assign = isset($params['assign']) ? $params['assign'] : null;
$modname = isset($params['modname']) ? $params['modname'] : ModUtil::getName();
$path = ModUtil::getModuleImagePath($modname);
if ($assign) {
$view->assign($assign, $path);
} else {
return $path;
}
}
示例2: smarty_function_moduleheader
/**
* Smarty function build module header in user content page.
*
* {moduleheader}
*
* Available parameters:
* modname Module name to display header for (optional, defaults to current module)
* type Type for module links (defaults to 'user')
* title Title to display in header (optional, defaults to module name)
* titlelink Link to attach to title (optional, defaults to none)
* setpagetitle If set to true, {pagesetvar} is used to set page title
* insertstatusmsg If set to true, {insert name='getstatusmsg'} is put in front of template
* menufirst If set to true, menu is first, then title
* putimage If set to true, module image is also displayed next to title
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string A formatted string containing navigation for the module admin panel.
*/
function smarty_function_moduleheader($params, $view)
{
if (!isset($params['modname']) || !ModUtil::available($params['modname'])) {
$params['modname'] = ModUtil::getName();
}
if (empty($params['modname'])) {
return false;
}
$type = isset($params['type']) ? $params['type'] : 'user';
$assign = isset($params['assign']) ? $params['assign'] : null;
$menufirst = isset($params['menufirst']) ? $params['menufirst'] : false;
$putimage = isset($params['putimage']) ? $params['putimage'] : false;
$setpagetitle = isset($params['setpagetitle']) ? $params['setpagetitle'] : false;
$insertstatusmsg = isset($params['insertstatusmsg']) ? $params['insertstatusmsg'] : false;
$cutlenght = isset($params['cutlenght']) ? $params['cutlenght'] : 20;
if ($putimage) {
$image = isset($params['image']) ? $params['image'] : ModUtil::getModuleImagePath($params['modname']);
} else {
$image = '';
}
if (!isset($params['title'])) {
$modinfo = ModUtil::getInfoFromName($params['modname']);
if (isset($modinfo['displayname'])) {
$params['title'] = $modinfo['displayname'];
} else {
$params['title'] = ModUtil::getName();
}
}
$titlelink = isset($params['titlelink']) ? $params['titlelink'] : false;
$renderer = Zikula_View::getInstance('Theme');
$renderer->setCaching(Zikula_View::CACHE_DISABLED);
$renderer->assign('userthemename', UserUtil::getTheme());
$renderer->assign('modname', $params['modname']);
$renderer->assign('type', $params['type']);
$renderer->assign('title', $params['title']);
$renderer->assign('titlelink', $titlelink);
$renderer->assign('truncated', mb_strlen($params['title']) > $cutlenght);
$renderer->assign('titletruncated', mb_substr($params['title'], 0, $cutlenght) . '...');
$renderer->assign('setpagetitle', $setpagetitle);
$renderer->assign('insertstatusmsg', $insertstatusmsg);
$renderer->assign('menufirst', $menufirst);
$renderer->assign('image', $image);
if ($assign) {
$view->assign($assign, $renderer->fetch('moduleheader.tpl'));
} else {
return $renderer->fetch('moduleheader.tpl');
}
}
示例3: adminpanel
/**
* Display main admin panel for a category
*
* @param int $args['acid'] the id of the category to be displayed
* @return string HTML string
*/
public function adminpanel($args)
{
if (!SecurityUtil::checkPermission('::', '::', ACCESS_EDIT)) {
// suppress admin display - return to index.
$this->redirect(System::getHomepageUrl());
}
if (!$this->getVar('ignoreinstallercheck') && System::getVar('development') == 0) {
// check if the Zikula Recovery Console exists
$zrcexists = file_exists('zrc.php');
// check if upgrade scripts exist
if ($zrcexists == true) {
return $this->view->assign('zrcexists', $zrcexists)
->assign('adminpanellink', ModUtil::url('Admin','admin', 'adminpanel'))
->fetch('admin_admin_warning.tpl');
}
}
// Now prepare the display of the admin panel by getting the relevant info.
// Get parameters from whatever input we need.
$acid = FormUtil::getPassedValue('acid', (isset($args['acid']) ? $args['acid'] : null), 'GET');
// cid isn't set, so go to the default category
if (empty($acid)) {
$acid = $this->getVar('startcategory');
}
// Add category menu to output
$this->view->assign('menu', $this->categorymenu(array('acid' => $acid)));
// Check to see if we have access to the requested category.
if (!SecurityUtil::checkPermission("Admin::", "::$acid", ACCESS_ADMIN)) {
$acid = -1;
}
// Get Details on the selected category
if ($acid > 0) {
$category = ModUtil::apiFunc('Admin', 'admin', 'get', array('cid' => $acid));
} else {
$category = null;
}
if (!$category) {
// get the default category
$acid = $this->getVar('startcategory');
// Check to see if we have access to the requested category.
if (!SecurityUtil::checkPermission("Admin::", "::$acid", ACCESS_ADMIN)) {
return LogUtil::registerPermissionError(System::getHomepageUrl());
}
$category = ModUtil::apiFunc('Admin', 'admin', 'get', array('cid' => $acid));
}
// assign the category
$this->view->assign('category', $category);
$displayNameType = $this->getVar('displaynametype', 1);
// get admin capable modules
$adminmodules = ModUtil::getAdminMods();
$adminlinks = array();
foreach ($adminmodules as $adminmodule) {
if (SecurityUtil::checkPermission("{$adminmodule['name']}::", 'ANY', ACCESS_EDIT)) {
$catid = ModUtil::apiFunc('Admin', 'admin', 'getmodcategory',
array('mid' => ModUtil::getIdFromName($adminmodule['name'])));
$order = ModUtil::apiFunc('Admin', 'admin', 'getSortOrder',
array('mid' => ModUtil::getIdFromName($adminmodule['name'])));
if (($catid == $acid) || (($catid == false) && ($acid == $this->getVar('defaultcategory')))) {
$modinfo = ModUtil::getInfoFromName($adminmodule['name']);
$menutexturl = ModUtil::url($modinfo['name'], 'admin', 'main');
$modpath = ($modinfo['type'] == ModUtil::TYPE_SYSTEM) ? 'system' : 'modules';
if ($displayNameType == 1) {
$menutext = $modinfo['displayname'];
} elseif ($displayNameType == 2) {
$menutext = $modinfo['name'];
} elseif ($displayNameType == 3) {
$menutext = $modinfo['displayname'] . ' (' . $modinfo['name'] . ')';
}
$menutexttitle = $modinfo['description'];
$adminicon = ModUtil::getModuleImagePath($adminmodule['name']);
$adminlinks[] = array('menutexturl' => $menutexturl,
'menutext' => $menutext,
'menutexttitle' => $menutexttitle,
'modname' => $modinfo['name'],
'adminicon' => $adminicon,
'id' => $modinfo['id'],
'order'=> $order);
}
}
//.........这里部分代码省略.........
示例4: smarty_function_adminpanelmenu
/**
* Inserts a hidden admin panel controlled by permissions.
*
* Inserts required javascript and css files for a hidden admin panel that is triggered by a rendered link.
* Builds and renders an unordered list of admin-capable modules and their adminLinks using the
* jQuery.mmenu library <@see http://mmenu.frebsite.nl>
*
* This plugin currently has NO configuration options.
*
* Examples:
*
* <samp>{adminpanelmenu}</samp>
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the {@link Zikula_View} object.
*
* @return string
*/
function smarty_function_adminpanelmenu($params, Zikula_View $view)
{
if (!SecurityUtil::checkPermission('ZikulaAdminModule::', "::", ACCESS_EDIT)) {
return '';
// Since no permission, return empty
}
// add required scritps and stylesheets to page
PageUtil::addVar('javascript', '@ZikulaAdminModule/Resources/public/js/jQuery.mmenu-5.5.1/dist/core/js/jquery.mmenu.min.all.js');
PageUtil::addVar('stylesheet', '@ZikulaAdminModule/Resources/public/js/jQuery.mmenu-5.5.1/dist/core/css/jquery.mmenu.all.css');
// add override for panel width created from .scss file
PageUtil::addVar('stylesheet', '@ZikulaAdminModule/Resources/public/css/mmenu-hiddenpanel-customwidth.css');
$router = $view->getContainer()->get('router');
$modules = ModUtil::getModulesCapableOf('admin');
// sort modules by displayname
$moduleNames = array();
foreach ($modules as $key => $module) {
$moduleNames[$key] = $module['displayname'];
}
array_multisort($moduleNames, SORT_ASC, $modules);
// create unordered list of admin-capable module links
$htmlContent = '<nav id="zikula-admin-hiddenpanel-menu">';
$htmlContent .= '<div class="text-left">';
$htmlContent .= '<h1><img src="images/logo.gif" alt="Logo" style="height: 32px"> ' . __('Administration') . '</h1>';
$htmlContent .= '<ul>';
foreach ($modules as $module) {
if (SecurityUtil::checkPermission("module[name]::", '::', ACCESS_EDIT)) {
// first-level list - list modules with general 'index' link
$img = ModUtil::getModuleImagePath($module['name']);
$url = isset($module['capabilities']['admin']['url']) ? $module['capabilities']['admin']['url'] : $router->generate($module['capabilities']['admin']['route']);
$moduleSelected = empty($moduleSelected) && strpos($view->getRequest()->getUri(), $module['url']) ? " class='Selected'" : "";
$htmlContent .= "<li{$moduleSelected}><a href=\"" . DataUtil::formatForDisplay($url) . "\"><img src=\"{$img}\" alt=\"\" style=\"height: 18px\" /> " . $module['displayname'] . "</a>";
$links = $view->getContainer()->get('zikula.link_container_collector')->getLinks($module['name'], 'admin');
if (empty($links)) {
$links = (array) ModUtil::apiFunc($module['name'], 'admin', 'getLinks');
}
if (count($links) > 0 && $links[0] != false) {
// create second-level list from module adminLinks
$htmlContent .= '<ul class="text-left">';
foreach ($links as $link) {
if (isset($link['icon'])) {
$img = '<i class="fa fa-' . $link['icon'] . '"></i>';
} elseif (isset($link['class'])) {
$img = '<span class="' . $link['class'] . '"></span>';
} else {
$img = '';
}
$linkSelected = empty($linkSelected) && strpos($view->getRequest()->getUri(), $link['url']) ? " class='Selected'" : "";
$htmlContent .= "<li{$linkSelected}><a href=\"" . DataUtil::formatForDisplay($link['url']) . "\">{$img} " . $link['text'] . '</a>';
// create third-level list from adminLinks subLinks
if (isset($link['links']) && count($link['links']) > 0) {
$htmlContent .= '<ul class="text-left">';
foreach ($link['links'] as $sublink) {
$htmlContent .= '<li><a href="' . DataUtil::formatForDisplay($sublink['url']) . '">' . $sublink['text'] . '</a></li>';
}
$htmlContent .= '</ul>';
}
$htmlContent .= '</li>';
}
$htmlContent .= '</ul>';
}
$htmlContent .= '</li>';
}
}
$htmlContent .= '</ul>';
$htmlContent .= '</div>';
$htmlContent .= '</nav>';
$htmlContent .= '
<script type="text/javascript">
jQuery(document).ready(function( $ ){
$("#zikula-admin-hiddenpanel-menu").mmenu({
extensions: ["hiddenpanel-customwidth"],
"header": {
"title": "' . __('Zikula Administration') . '",
"add": true,
"update": true
},
"searchfield": true
});
});
</script>';
// the the html content before </body>
PageUtil::addVar('footer', $htmlContent);
//.........这里部分代码省略.........