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


PHP UserUtil::getGidCacheString方法代码示例

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


在下文中一共展示了UserUtil::getGidCacheString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 /**
  * Display block.
  *
  * @param  array  $blockInfo a blockinfo structure
  *
  * @return string html block
  */
 public function display($blockInfo)
 {
     if (!SecurityUtil::checkPermission('Dashboard::', "::", ACCESS_READ)) {
         return;
     }
     // Break out options from our content field
     $vars = BlockUtil::varsFromContent($blockInfo['content']);
     if ($this->view->getCaching()) {
         $this->view->setCacheId($blockInfo['bkey'] . '/bid' . $blockInfo['bid'] . '/' . UserUtil::getGidCacheString());
         if ($this->view->is_cached('Block/dashboard.html.tpl')) {
             $blockInfo['content'] = $this->view->fetch('Block/dashboard.html.tpl');
             return BlockUtil::themeBlock($blockInfo);
         }
     }
     $uid = $this->request->getSession()->get('uid');
     $helper = new Dashboard_Helper_WidgetHelper($this->entityManager);
     $dashboard = $helper->getUserWidgets($uid);
     $this->view->assign('userWidgets', $dashboard);
     // get the block content
     $blockInfo['content'] = $this->view->fetch('Block/dashboard.html.tpl');
     // pass the block array back to the theme for display
     return BlockUtil::themeBlock($blockInfo);
 }
开发者ID:robbrandt,项目名称:Dashboard,代码行数:30,代码来源:Dashboard.php

示例2: display

    /**
     * display block
     */
    public function display($blockinfo)
    {
        // Security check
        if (!Securityutil::checkPermission('Menutree:menutreeblock:', "{$blockinfo['bid']}::", ACCESS_READ)) {
            return false;
        }

        // Get variables from content block
        $vars = BlockUtil::varsFromContent($blockinfo['content']);

        // stylesheet
        if (file_exists($vars['menutree_stylesheet'])) {
            PageUtil::addVar('stylesheet', $vars['menutree_stylesheet']);
        }

        // template to use
        if (!isset($vars['menutree_tpl']) || empty($vars['menutree_tpl']) || !$this->view->template_exists($vars['menutree_tpl'])) {
            $vars['menutree_tpl'] = 'menutree/blocks_block_menutree_default.tpl';
        }

        // 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['menutree_tpl'])) {
                $blockinfo['content'] = $this->view->fetch($vars['menutree_tpl']);

                return BlockUtil::themeBlock($blockinfo);
            }
        }

        // set default block vars
        $vars['menutree_content']    = isset($vars['menutree_content']) ? $vars['menutree_content'] : array();
        $vars['menutree_titles']     = isset($vars['menutree_titles']) ? $vars['menutree_titles'] : array();
        $vars['menutree_stylesheet'] = isset($vars['menutree_stylesheet']) ? $vars['menutree_stylesheet'] : '';
        $vars['menutree_editlinks']  = isset($vars['menutree_editlinks']) ? $vars['menutree_editlinks'] : false;

        // set current user lang
        $lang = ZLanguage::getLanguageCode();
        $deflang = 'en';

        if (!in_array($lang, array_keys(current($vars['menutree_content'])))) {
            $lang = $deflang;
        }

        if (!empty($vars['menutree_content'])) {
            // select current lang, check permissions for each item and exclude unactive nodes
            $newTree = array();
            $blocked = array();
            foreach ($vars['menutree_content'] as $id => $item) {
                $item = $item[$lang];
                // check the permission access to the current link
                $hasperms = Securityutil::checkPermission('Menutree:menutreeblock:',"$blockinfo[bid]:$item[name]:$item[id]", ACCESS_READ);
                // checks if has no access to it or the link is not active
                if (!$hasperms || in_array($item['parent'], $blocked) || $item['state'] != 1) {
                    $blocked[] = $item['id'];
                } else {
                    // dynamic components
                    if (strpos($item['href'],'{ext:') === 0) {
                        $dynamic = explode(':', substr($item['href'], 1,  - 1));
                        $modname = $dynamic[1];
                        $func = $dynamic[2]; // plugin
                        $extrainfo = (isset($dynamic[3]) && !empty($dynamic[3])) ? $dynamic[3] : null;
                        if (!empty($modname) && !empty($func)) {
                            $args = array(
                                    'item' => $item,
                                    'lang' => $lang,
                                    'bid' => $blockinfo['bid'],
                                    'extrainfo' => $extrainfo,
                            );
                            $node = ModUtil::apiFunc($modname, 'menutree', $func, $args);
                            if (!is_array($node)) {
                                $node = array(array($lang => $item));
                            }
                        }
                    } else {
                        $node = array(array($lang => $item));
                    }
                    $newTree = array_merge($newTree,(array)$node);
                }
            }

            // bulid structured array
            $langs = array('ref' => $lang,
                           'list' => $lang,
                           'flat' => true);

            $tree = new Blocks_MenutreeTree();
            $tree->setOption('langs',(array)$langs['list']);
            $tree->setOption('flat',$langs['flat']);
            $tree->setOption('parseURL',true);
            $tree->loadArrayData($newTree);

            $newTree = $tree->getData();
        } else {
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Menutree.php

示例3: display

    /**
     * display block
     *
     * @param  array  $blockinfo a blockinfo structure
     * @return output the rendered bock
     */
    public function display($blockinfo)
    {
        // security check
        if (!SecurityUtil::checkPermission('Menublock::', "$blockinfo[title]::", ACCESS_READ)) {
            return;
        }

        // Break out options from our content field
        $vars = BlockUtil::varsFromContent($blockinfo['content']);

        // add the stylesheet to the header
        if (isset($vars['stylesheet'])) {
            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('blocks_block_menu.tpl')) {
                $blockinfo['content'] = $this->view->fetch('blocks_block_menu.tpl');

                return BlockUtil::themeBlock($blockinfo);
            }
        }

        // Styling - this is deprecated and is only to support old menu for now
        if (empty($vars['style'])) {
            $vars['style'] = 1;
        }

        // Content
        $menuitems = array();
        if (!empty($vars['content'])) {
            $contentlines = explode('LINESPLIT', $vars['content']);
            foreach ($contentlines as $contentline) {
                list($url, $title, $comment) = explode('|', $contentline);
                if (SecurityUtil::checkPermission('Menublock::', "$blockinfo[title]:$title:", ACCESS_READ)) {
                    $menuitems[] = self::addMenuItem($title, $url, $comment);
                    $content = true;
                }
            }
        }

        // Modules
        if (!empty($vars['displaymodules'])) {
            $mods = ModUtil::getUserMods();

            // Separate from current content, if any
            if ($vars['content'] == 1) {
                $menuitems[] = self::addMenuItem('', '', '');
            }

            foreach ($mods as $mod) {
                if (SecurityUtil::checkPermission("$mod[name]::", '::', ACCESS_OVERVIEW)) {
                    $menuitems[] = self::addMenuItem($mod['displayname'], ModUtil::url($mod['name'], 'user', 'main'), $mod['description']);
                    $content = true;
                }
            }
        }

        // check for any empty result set
        if (empty($menuitems)) {
            return;
        }

        // assign the items
        $this->view->assign('menuitems', $menuitems);

        // get the block content
        $blockinfo['content'] = $this->view->fetch('blocks_block_menu.tpl');

        // pass the block array back to the theme for display
        return BlockUtil::themeBlock($blockinfo);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:83,代码来源:Menu.php


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