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


PHP Gallery::getTagList方法代码示例

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


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

示例1: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $view = ViewManager::getInstance();
     $taglist = $this->plugin->getTagList(array('plugin_type' => Gallery::TYPE_HEADLINES));
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     $url = new Url(true);
     //$url->setParameter($view->getUrlId(), Gallery::VIEW_DETAIL);
     // link to gallery tree nodes
     $treeRef = new GalleryTreeRef();
     foreach ($taglist as $tag) {
         $key = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag']);
         $detail = $this->getDetail($key);
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $cacheable = $detail['display_order'] != Gallery::ORDER_RANDOM;
         $template->setCacheable($cacheable);
         if (!$cacheable) {
             Cache::disableCache();
         }
         $template->setVariable($detail);
         // include lightbox if needed
         if ($detail['display'] == self::DISP_LIGHTBOX) {
             $theme = $this->director->theme;
             $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/prototype.js"></script>');
             $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/scriptaculous.js"></script>');
             $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/lightbox.js"></script>');
             $theme->addHeader('<link rel="stylesheet" href="' . DIF_VIRTUAL_WEB_ROOT . 'css/lightbox.css" type="text/css" media="screen" />');
         }
         // check if template is in cache
         if (!$template->isCached()) {
             // get settings
             $settings = $this->getSettings();
             $treeRefList = $treeRef->getList($key);
             $treeItemList = array();
             foreach ($treeRefList['data'] as $treeRefItem) {
                 if (!$tree->exists($treeRefItem['ref_tree_id'])) {
                     continue;
                 }
                 $treeItemList[] = $treeRefItem['ref_tree_id'];
             }
             if (!$treeItemList) {
                 continue;
             }
             $searchcriteria = array('activated' => true, 'tree_id' => $treeItemList);
             $overview = $this->getGalleryOverview();
             $list = $overview->getList($searchcriteria, $detail['rows'], 1, $detail['display_order']);
             // skip if empty
             if ($list['totalItems'] < 1) {
                 continue;
             }
             foreach ($list['data'] as &$item) {
                 $url->setPath($tree->getPath($item['tree_id']));
                 // go to detail if requested
                 if ($detail['display'] == self::DISP_DETAIL) {
                     $url->setParameter('id', $item['id']);
                 }
                 $item['href_detail'] = $url->getUrl(true);
                 if ($item['image']) {
                     $img = new Image($item['image'], $this->plugin->getContentPath(true));
                     $item['image'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
                 if ($item['thumbnail']) {
                     $img = new Image($item['thumbnail'], $this->plugin->getContentPath(true));
                     $item['thumbnail'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
             }
             $template->setVariable('gallery', $list);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:77,代码来源:GalleryHeadlines.php

示例2: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // retrieve tags that are linked to this plugin
     $taglist = $this->plugin->getTagList(array('plugin_type' => Gallery::TYPE_DEFAULT));
     if (!$taglist) {
         return;
     }
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), Gallery::VIEW_DETAIL);
     $htdocsPathAbs = $this->plugin->getContentPath(true);
     $htdocsPath = $this->plugin->getContentPath(false);
     foreach ($taglist as $tag) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $template->setCacheable(true);
         // get settings
         $settings = $this->getSettings($tag['tree_id'], $tag['tag']);
         $this->handleDisplaySettings($settings['display']);
         $template->setVariable('settings', $settings);
         // check if template is in cache
         if (!$template->isCached()) {
             $pagesize = $settings['rows'];
             $searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'activated' => true);
             $imageSelect = array();
             $list = $this->getList($searchcriteria, $pagesize, $page);
             foreach ($list['data'] as &$item) {
                 $imageSelect[] = $item['id'];
                 $url->setParameter('id', $item['id']);
                 $item['href_detail'] = $url->getUrl(true);
                 if ($item['image']) {
                     $img = new Image($item['image'], $htdocsPathAbs);
                     $item['image'] = array('src' => $htdocsPath . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
                 if ($item['thumbnail']) {
                     $img = new Image($item['thumbnail'], $htdocsPathAbs);
                     $item['thumbnail'] = array('src' => $htdocsPath . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
             }
             if ($settings['display'] == Gallery::DISP_LIGHTBOX) {
                 // retrieve all images for lightbox
                 $all = $this->getList($searchcriteria);
                 $pregallery = array();
                 $postgallery = array();
                 $pre = true;
                 foreach ($all['data'] as $allImg) {
                     if (in_array($allImg['id'], $imageSelect)) {
                         // image is in selection, skip image and change array to post
                         $pre = false;
                         continue;
                     }
                     if ($allImg['image']) {
                         $img = new Image($allImg['image'], $htdocsPathAbs);
                         $allImg['image'] = array('src' => $htdocsPath . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                     }
                     // add to right array
                     $pre ? $pregallery[] = $allImg : ($postgallery[] = $allImg);
                 }
                 $template->setVariable('pregallery', $pregallery);
                 $template->setVariable('postgallery', $postgallery);
             }
             $template->setVariable('gallery', $list);
             $template->setVariable('display', $settings['display'], false);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:73,代码来源:GalleryOverview.php


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