当前位置: 首页>>代码示例>>PHP>>正文


PHP ModUtil::getName方法代码示例

本文整理汇总了PHP中ModUtil::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP ModUtil::getName方法的具体用法?PHP ModUtil::getName怎么用?PHP ModUtil::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModUtil的用法示例。


在下文中一共展示了ModUtil::getName方法的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);
         }
     }
 }
开发者ID:rmaiwald,项目名称:Scribite,代码行数:41,代码来源:Listeners.php

示例2: smarty_function_manuallink

/**
 * Zikula_View function to create  manual link.
 *
 * This function creates a manual link from some parameters.
 *
 * Available parameters:
 *   - manual:    name of manual file, manual.html if not set
 *   - chapter:   an anchor in the manual file to jump to
 *   - newwindow: opens the manual in a new window using javascript
 *   - width:     width of the window if newwindow is set, default 600
 *   - height:    height of the window if newwindow is set, default 400
 *   - title:     name of the new window if newwindow is set, default is modulename
 *   - class:     class for use in the <a> tag
 *   - assign:    if set, the results ( array('url', 'link') are assigned to the corresponding variable instead of printed out
 *
 * Example
 * {manuallink newwindow=1 width=400 height=300 title=rtfm }
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string|void
 */
function smarty_function_manuallink($params, Zikula_View $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('manuallink')), E_USER_DEPRECATED);
    $userlang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
    $stdlang = System::getVar('language_i18n');
    $title = isset($params['title']) ? $params['title'] : 'Manual';
    $manual = isset($params['manual']) ? $params['manual'] : 'manual.html';
    $chapter = isset($params['chapter']) ? '#' . $params['chapter'] : '';
    $class = isset($params['class']) ? 'class="' . $params['class'] . '"' : '';
    $width = isset($params['width']) ? $params['width'] : 600;
    $height = isset($params['height']) ? $params['height'] : 400;
    $modname = ModUtil::getName();
    $possibleplaces = array("modules/{$modname}/docs/{$userlang}/manual/{$manual}", "modules/{$modname}/docs/{$stdlang}/manual/{$manual}", "modules/{$modname}/docs/en/manual/{$manual}", "modules/{$modname}/docs/{$userlang}/{$manual}", "modules/{$modname}/docs/{$stdlang}/{$manual}", "modules/{$modname}/docs/lang/en/{$manual}");
    foreach ($possibleplaces as $possibleplace) {
        if (file_exists($possibleplace)) {
            $url = $possibleplace . $chapter;
            break;
        }
    }
    if (isset($params['newwindow'])) {
        $link = "<a {$class} href='#' onclick=\"window.open( '" . DataUtil::formatForDisplay($url) . "' , '" . DataUtil::formatForDisplay($modname) . "', 'status=yes,scrollbars=yes,resizable=yes,width={$width},height={$height}'); picwin.focus();\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    } else {
        $link = "<a {$class} href=\"" . DataUtil::formatForDisplay($url) . "\">" . DataUtil::formatForDisplayHTML($title) . "</a>";
    }
    if (isset($params['assign'])) {
        $ret = array('url' => $url, 'link' => $link);
        $view->assign($params['assign'], $ret);
        return;
    } else {
        return $link;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:55,代码来源:function.manuallink.php

示例3: smarty_function_modulejavascript

/**
 * Zikula_View function to include module specific javascripts
 *
 * Available parameters:
 *  - modname     module name (if not set, the current module is assumed)
 *                if modname="" than we will look into the main javascript folder
 *  - script      name of the external javascript file (mandatory)
 *  - modonly     javascript will only be included when the the current module is $modname
 *  - onload      function to be called with onLoad handler in body tag, makes sense with assign set only, see example #2
 *  - assign      if set, the tag and the script filename are returned
 *
 * Example: {modulejavascript modname=foobar script=module_admin_config.js modonly=1 }
 * Output:  <script type="text/javascript" src="modules/foobar/javascript/module_admin_config.js">
 *
 * Example: {modulejavascript modname=foobar script=module_admin_config.js modonly=1 onload="dosomething()" assign=myjs }
 * Output: nothing, but assigns a variable containing several values:
 *      $myjs.scriptfile = "modules/foobar/javascript/module_admin_config.js"
 *      $myjs.tag = "<script type=\"text/javascript\" src=\"modules/foobar/javascript/module_admin_config.js\"></script>"
 *      $myjs.onload = "onLoad=\"dosomething()\"";
 *      Possible code in master.tpl would be:
 *
 *      ...
 *      { $myjs.tag }
 *      </head>
 *      <body { $myjs.onload } >
 *      ...
 *
 *      which results in
 *
 *      ...
 *      <script type="text/javascript" src="modules/foobar/javascript/module_admin_config.js"></script>
 *      </head>
 *      <body onLoad="dosomething()" >
 *      ...
 *
 *      if foobar is the current module.
 *
 * @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 tag.
 */
function smarty_function_modulejavascript($params, Zikula_View $view)
{
    // check if script is set (mandatory)
    if (!isset($params['script'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modulejavascript', 'script')));
        return false;
    }
    // check if modname is set and if not, if $modonly is set
    if (!isset($params['modname'])) {
        if (isset($params['modonly'])) {
            // error - we want $modonly only with $modname
            $view->trigger_error(__f('Error! in %1$s: parameter \'%2$s\' only supported together with \'%3$s\' set.', array('modulejavascript', 'modonly', 'modname')));
            return;
        }
        // we use the current module name
        $params['modname'] = ModUtil::getName();
    }
    if (isset($params['modonly']) && $params['modname'] != ModUtil::getName()) {
        // current module is not $modname - do nothing and return silently
        return;
    }
    // if modname is empty, we will search the main javascript folder
    if ($params['modname'] == '') {
        $searchpaths = array('javascript', 'javascript/ajax');
    } else {
        // theme directory
        $theme = DataUtil::formatForOS(UserUtil::getTheme());
        $osmodname = DataUtil::formatForOS($params['modname']);
        $themepath = "themes/{$theme}/Resources/public/js/{$osmodname}";
        // module directory
        $modinfo = ModUtil::getInfoFromName($params['modname']);
        $osmoddir = DataUtil::formatForOS($modinfo['directory']);
        $modpath = "modules/{$osmoddir}/Resources/public/js";
        $syspath = "system/{$osmoddir}/Resources/public/js";
        $searchpaths = array($themepath, $modpath, $syspath);
    }
    $osscript = DataUtil::formatForOS($params['script']);
    // search for the javascript
    $scriptsrc = '';
    foreach ($searchpaths as $path) {
        if (is_readable("{$path}/{$osscript}")) {
            $scriptsrc = "{$path}/{$osscript}";
            break;
        }
    }
    // if no module javascript has been found then return no content
    $tag = empty($scriptsrc) ? '' : '<script type="text/javascript" src="' . $scriptsrc . '"></script>';
    // onLoad event handler used?
    $onload = isset($params['onload']) ? 'onLoad="' . $params['onload'] . '"' : '';
    if (isset($params['assign'])) {
        $return = array();
        $return['scriptfile'] = $scriptsrc;
        $return['tag'] = $tag;
        $return['onload'] = $onload;
        $view->assign($params['assign'], $return);
    } else {
        return $tag;
    }
//.........这里部分代码省略.........
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:101,代码来源:function.modulejavascript.php

示例4: smarty_function_moduleadminlinks

/**
 * Zikula_View function to display admin links for a module.
 *
 * Example:
 * {moduleadminlinks modname=Example start="[" end="]" seperator="|" class="z-menuitem-title"}
 *
 * Available parameters:
 *   - modname   Module name to display links for.
 *   - start     Start string (optional).
 *   - end       End string (optional).
 *   - seperator Link seperator (optional).
 *   - class     CSS class (optional).
 *
 * @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_moduleadminlinks($params, $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('moduleadminlinks', 'modulelinks')), E_USER_DEPRECATED);

    // set some defaults
    $start     = isset($params['start'])    ? $params['start']    : '[';
    $end       = isset($params['end'])      ? $params['end']      : ']';
    $seperator = isset($params['seperator'])? $params['seperator']: '|';
    $class     = isset($params['class'])    ? $params['class']    : 'z-menuitem-title';

    $modname = $params['modname'];
    unset ($params['modname']);

    if (!isset($modname) || !ModUtil::available($modname)) {
        $modname = ModUtil::getName();
    }

    // check our module name
    if (!ModUtil::available($modname)) {
        $view->trigger_error('moduleadminlinks: '.__f("Error! The '%s' module is not available.", DataUtil::formatForDisplay($modname)));
        return false;
    }

    // get the links from the module API
    $links = ModUtil::apiFunc($modname, 'admin', 'getlinks', $params);

    // establish some useful count vars
    $linkcount = count($links);

    $adminlinks = "<span class=\"$class\">$start ";
    foreach ($links as $key => $link) {
        $id = '';
        if (isset($link['id'])) {
            $id = 'id="' . $link['id'] . '"';
        }
        if (!isset($link['title'])) {
            $link['title'] = $link['text'];
        }
        if (isset($link['disabled']) && $link['disabled'] == true) {
            $adminlinks .= "<span $id>" . '<a class="z-disabledadminlink" title="' . DataUtil::formatForDisplay($link['title']) . '">' . DataUtil::formatForDisplay($link['text']) . '</a> ';
        } else {
            $adminlinks .= "<span $id><a href=\"" . DataUtil::formatForDisplay($link['url']) . '" title="' . DataUtil::formatForDisplay($link['title']) . '">' . DataUtil::formatForDisplay($link['text']) . '</a> ';
        }
        if ($key == $linkcount-1) {
            $adminlinks .= '</span>';
            continue;
        }
        // linebreak
        if (isset($link['linebreak']) && $link['linebreak'] == true) {
            $adminlinks .= "</span>\n ";
            $adminlinks .= "$end</span><br /><span class=\"$class\">$start ";
        } else {
            $adminlinks .= "$seperator</span>\n ";
        }
    }
    $adminlinks .= "$end</span>\n";

    return $adminlinks;
}
开发者ID:,项目名称:,代码行数:77,代码来源:

示例5: __construct

 /**
  * Constructor.
  *
  * @param mixed $message Response status/error message, may be string or array.
  * @param mixed $payload Payload.
  */
 public function __construct($message, $payload = null)
 {
     $this->messages = (array) $message;
     $this->payload = $payload;
     if ($this->newCsrfToken) {
         $this->authid = SecurityUtil::generateAuthKey(ModUtil::getName());
         $this->csrfToken = SecurityUtil::generateCsrfToken();
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:15,代码来源:Error.php

示例6: smarty_function_modgetname

/**
 * Zikula_View function to the topmost module name
 *
 * This function currently returns the name of the current top-level
 * module, false if not in a module.
 *
 *
 * Available parameters:
 *   - assign:   If set, the results are assigned to the corresponding
 *               variable instead of printed out
 *
 * Example
 *   {modgetname|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 module variable.
 */
function smarty_function_modgetname($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $result = ModUtil::getName();
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        return $result;
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:29,代码来源:function.modgetname.php

示例7: 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;
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:33,代码来源:function.modgetimage.php

示例8: smarty_insert_generateauthkey

/**
 * Zikula_View insert function to dynamically generated an authorisation key
 *
 * Available parameters:
 *   - module:   The well-known name of a module to execute a function from (required)
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *
 * Example
 * <input type="hidden" name="authid" value="{insert name='generateauthkey' module='Users'}" />
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string
 */
function smarty_insert_generateauthkey($params, $view)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('insert name="secgenauthkey" ...', "insert name='csrftoken' ...")), E_USER_DEPRECATED);
    $module = isset($params['module']) ? $params['module'] : null;
    if (!$module) {
        $module = ModUtil::getName();
    }
    $result = SecurityUtil::generateAuthKey($module);
    // NOTE: assign parameter is handled by the smarty_core_run_insert_handler(...) function in lib/vendor/Smarty/internals/core.run_insert_handler.php
    return $result;
}
开发者ID:planetenkiller,项目名称:core,代码行数:26,代码来源:insert.generateauthkey.php

示例9: __construct

 /**
  * Constructor.
  *
  * @param mixed $payload Application data.
  * @param mixed $message Response status/error message, may be string or array.
  * @param array $options Options.
  */
 public function __construct($payload, $message = null, array $options = array())
 {
     $this->payload = $payload;
     $this->messages = (array) $message;
     $this->options = $options;
     if ($this->newCsrfToken) {
         if (System::isLegacyMode()) {
             $this->authid = SecurityUtil::generateAuthKey(ModUtil::getName());
         }
         $this->csrfToken = SecurityUtil::generateCsrfToken();
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:19,代码来源:Ajax.php

示例10: __construct

 /**
  * Constructor.
  *
  * @param mixed $payload Application data.
  * @param mixed $message Response status/error message, may be string or array.
  * @param array $options Options.
  */
 public function __construct($payload, $message = null, array $options = array())
 {
     $this->payload = $payload;
     $this->messages = (array) $message;
     $this->options = $options;
     if ($this->newCsrfToken) {
         $this->csrfToken = \SecurityUtil::generateCsrfToken();
     }
     if (\System::isLegacyMode()) {
         $this->authid = \SecurityUtil::generateAuthKey(\ModUtil::getName());
     }
     parent::__construct('', $this->statusCode);
 }
开发者ID:Silwereth,项目名称:core,代码行数:20,代码来源:AjaxResponse.php

示例11: smarty_function_secgenauthkey

/**
 * Smarty function to generate a unique key to secure forms content as unique.
 *
 * Note that you must not cache the outputs from this function, as its results
 * change aech time it is called. The Zikula developers are looking for ways to
 * automise this.
 *
 *
 * Available parameters:
 *   - module:   The well-known name of a module to execute a function from (required)
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *
 * Example
 *   <input type="hidden" name="authid" value="{secgenauthkey module="MyModule"}">
 *
 * @todo         prevent this function from being cached (Smarty 2.6.0)
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      $smarty     Reference to the Smarty object
 * @return       string      the authentication key
 * @deprecated
 */
function smarty_function_secgenauthkey($params, $smarty)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('secgenauthkey', 'insert name="csrftoken"')), E_USER_DEPRECATED);
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $module = isset($params['module']) ? $params['module'] : null;
    if (!$module) {
        $module = ModUtil::getName();
    }
    $result = SecurityUtil::generateAuthKey($module);
    if ($assign) {
        $smarty->assign($assign, $result);
    } else {
        return $result;
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:36,代码来源:function.secgenauthkey.php

示例12: smarty_function_adminonlinemanual

/**
 * Smarty function to displaya modules online manual
 *
 * Admin
 * {adminonlinemanual}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategoreymenu()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      $smarty     Reference to the Smarty object
 * @param        int         xhtml        if set, the link to the navtabs.css will be xhtml compliant
 * @return       string      the results of the module function
 */
function smarty_function_adminonlinemanual($params, $smarty)
{
    LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated.', array('adminonlinemanual')), E_USER_DEPRECATED);
    $lang = ZLanguage::transformFS(ZLanguage::getLanguageCode());
    $modinfo = ModUtil::getInfoFromName(ModUtil::getName());
    $modpath = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules';
    $file = DataUtil::formatForOS("{$modpath}/{$modinfo['directory']}/lang/{$lang}/manual.html");
    $man_link = '';
    if (is_readable($file)) {
        PageUtil::addVar('javascript', 'zikula.ui');
        $man_link = '<div style="margin-top: 20px; text-align:center">[ <a id="online_manual" href="' . $file . '">' . __('Online manual') . '</a> ]</div>' . "\n";
        $man_link .= '<script type="text/javascript">var online_manual = new Zikula.UI.Window($(\'online_manual\'),{resizable: true})</script>' . "\n";
    }
    return $man_link;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:27,代码来源:function.adminonlinemanual.php

示例13: applyDefaultFilters

 /**
  * Adds default filters as where clauses.
  *
  * @param Doctrine\ORM\QueryBuilder $qb         Query builder to be enhanced.
  * @param array                     $parameters List of determined filter options.
  *
  * @return Doctrine\ORM\QueryBuilder Enriched query builder instance.
  */
 protected function applyDefaultFilters(QueryBuilder $qb, $parameters = array())
 {
     $currentModule = ModUtil::getName();
     //FormUtil::getPassedValue('module', '', 'GETPOST');
     $currentType = FormUtil::getPassedValue('type', 'user', 'GETPOST');
     if ($currentType == 'admin' && ($currentModule == 'Reviews' || $currentModule == 'Extensions')) {
         return $qb;
     }
     if (!in_array('workflowState', array_keys($parameters)) || empty($parameters['workflowState'])) {
         // per default we show approved reviews only
         $onlineStates = array('approved');
         $qb->andWhere('tbl.workflowState IN (:onlineStates)')->setParameter('onlineStates', $onlineStates);
     }
     return $qb;
 }
开发者ID:rmaiwald,项目名称:Reviews,代码行数:23,代码来源:Review.php

示例14: 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');
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:68,代码来源:function.moduleheader.php

示例15: smarty_function_zdebug

/**
 * Zikula_View function to display a Zikula specific debug Zikula.UI.Window
 *
 * This function shows a Zikula debug window if the user has sufficient access rights
 *
 * You need the following permission to see this:
 *   ModuleName::debug | .* | ACCESS_ADMIN
 *
 * This plugin is basing on the original debug plugin written by Monte Ohrt <monte@ispi.net>
 *
 * Examples
 *   { zdebug }
 *   { zdebug width='400' }
 *
 * Parameters:
 *  width:      Width of the console UI.Window (default: 580)
 *  height:     Height of the console UI.Window (default: 600)
 *  checkpermission: If false, then a security check is not performed, allowing debug information to
 *              be displayed, for example, when there is no user logged in. Development mode
 *              must also be enabled. Defaults to true;
 *  template Specify different debug template, default zdebug.tpl,
 *              must be stored in system/Theme/templates.
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string Debug output.
 */
function smarty_function_zdebug($params, Zikula_View $view)
{
    $zdebug = '';
    $thismodule = ModUtil::getName();
    $skipPermissionCheck = System::isDevelopmentMode() && isset($params['checkpermission']) && !$params['checkpermission'];

    if ($skipPermissionCheck || SecurityUtil::checkPermission($thismodule.'::debug', '::', ACCESS_ADMIN)) {
        // backup and modify the view attributes
        $_template_dir_orig = $view->template_dir;
        $_default_resource_type_orig = $view->default_resource_type;
        $_compile_id_orig   = $view->_compile_id;

        $view->template_dir = 'system/Theme/templates';
        $view->default_resource_type = 'file';
        $view->_plugins['outputfilter'] = null;
        $view->_compile_id  = null;

        $width  = isset($params['width']) && is_integer($params['width']) ? $params['width'] : 580;
        $height = isset($params['height']) && is_integer($params['height']) ? $params['height'] : 600;
        $popup  = isset($params['popup']) ? (bool)$params['popup'] : false;

        // figure out the template to use
        if (isset($params['template']) && !empty($params['template'])) {
            if (is_readable($view->template_dir . '/' . $params['template'])) {
                $view->debug_tpl = $params['template'];
            }
        } else {
            $view->debug_tpl = $popup ? 'zpopup.tpl' : 'zdebug.tpl';
        }

        // get the zdebug output
        $zdebug = $view->assign('zdebugwidth', $width)
                       ->assign('zdebugheight', $height)
                       ->assign('zdebugpopup', $popup)
                       ->_fetch($view->debug_tpl);

        // restore original values
        $view->_compile_id = $_compile_id_orig;
        $view->template_dir = $_template_dir_orig;
        $view->default_resource_type = $_default_resource_type_orig;
    }

    return $zdebug;
}
开发者ID:,项目名称:,代码行数:72,代码来源:


注:本文中的ModUtil::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。