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


PHP TemplateEngine::isCached方法代码示例

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


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

示例1: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview($tree_id = NULL, $tag = NULL)
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $active_id = NULL;
     // retrieve tags that are linked to this plugin
     if (!isset($tree_id) && !isset($tag)) {
         $taglist = $this->plugin->getTagList();
         if (!$taglist) {
             return;
         }
     } else {
         $taglist = array(array('tree_id' => $tree_id, 'tag' => $tag));
         $active_id = intval($request->getValue('id'));
     }
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), Links::VIEW_DETAIL);
     foreach ($taglist as $tag) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $template->setCacheable(true);
         $template->setVariable('active_id', $active_id);
         if (isset($active_id)) {
             $template->setVariable('currentView', ViewManager::OVERVIEW);
         }
         // check if template is in cache
         if (!$template->isCached()) {
             // get settings
             $settings = $this->plugin->getObject(Links::TYPE_SETTINGS)->getSettings($tag['tag'], $tag['tree_id']);
             $pagesize = $settings['rows'];
             $searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'activated' => true);
             $list = $this->getList($searchcriteria, $pagesize, $page);
             foreach ($list['data'] as &$item) {
                 if ($item['url']) {
                     $item['href_detail'] = $item['url'];
                 } elseif ($item['ref_tree_id']) {
                     $item['href_detail'] = $this->director->tree->getPath($item['ref_tree_id']);
                 } else {
                     $url->setParameter('id', $item['id']);
                     $item['href_detail'] = $url->getUrl(true);
                 }
                 if ($item['thumbnail']) {
                     $img = new Image($item['thumbnail'], $this->getContentPath(true));
                     $item['thumbnail'] = array('src' => $this->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
             }
             $template->setVariable('links', $list);
             $template->setVariable('settings', $settings);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:57,代码来源:LinksOverview.php

示例2: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     // retrieve tags that are linked to this plugin
     $taglist = $this->plugin->getTagList();
     if (!$taglist) {
         return;
     }
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), Poll::VIEW_DETAIL);
     Cache::disableCache();
     foreach ($taglist as $tag) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         //$template->setPostfix($tag['tag']);
         $template->setCacheable(false);
         // check if template is in cache
         if (!$template->isCached()) {
             // get settings
             $settings = array_merge($this->getPollSettings()->getSettings($tag['tag'], $tag['tree_id']), $this->plugin->getSettings());
             $template->setVariable('settings', $settings);
             $searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'activated' => true);
             if (!$this->exists($searchcriteria)) {
                 continue;
             }
             $poll = $this->getDetail($searchcriteria);
             $searchcriteria['poll_id'] = $poll['id'];
             $voted = $this->hasVoted($poll['id']);
             $template->setVariable('voted', $voted);
             $template->setVariable('poll', $poll);
             $itemlist = $this->getPollResult($poll['id'], $tag['tag'], $settings, $voted);
             $template->setVariable('tpl_poll_result', $itemlist);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:39,代码来源:PollOverview.php

示例3: getImageTemplate

 public function getImageTemplate($cal_id, $tag)
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $template->setPostfix($tag . $cal_id);
     $template->setCacheable(true);
     // check if template is in cache
     if (!$template->isCached()) {
         $searchcriteria = array('cal_id' => $cal_id, 'activated' => true);
         $imageSelect = array();
         $htdocsPathAbs = $this->plugin->getContentPath(true);
         $htdocsPath = $this->plugin->getContentPath(false);
         $list = $this->getList($searchcriteria);
         foreach ($list['data'] as &$item) {
             $imageSelect[] = $item['id'];
             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());
             }
         }
         $template->setVariable('calendarimage', $list);
     }
     $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" />');
     return $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:32,代码来源:CalendarImage.php

示例4: getAttachmentTemplate

 public function getAttachmentTemplate($nl_id, $tag)
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $template->setPostfix($tag . $nl_id);
     $template->setCacheable(true);
     // check if template is in cache
     if (!$template->isCached()) {
         $searchcriteria = array('nl_id' => $nl_id, 'activated' => true);
         $list = $this->getList($searchcriteria);
         foreach ($list['data'] as &$item) {
             $item['href_detail'] = $item['file'] ? $this->plugin->getFileUrl($item['id']) : '';
         }
         $template->setVariable('attachment', $list);
     }
     return $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:16,代码来源:NewsLetterAttachment.php

示例5: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $taglist = $this->plugin->getTagList(array('plugin_type' => Calendar::TYPE_ARCHIVE));
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), Calendar::VIEW_ARCHIVE);
     // link to cal tree nodes
     $treeRef = new CalendarTreeRef();
     foreach ($taglist as $item) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($item['tag']);
         $template->setCacheable(true);
         // check if template is in cache
         if (!$template->isCached()) {
             $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
             $detail = $this->getDetail($key);
             $template->setVariable('settings', $detail);
             $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;
             }
             // get active items between a period x and y.
             // cal_start must by less or equal to end of period
             // cal_stop must by greater or equeal to start of period
             $searchcriteria = array('tree_id' => $treeItemList, 'finished' => true, 'active' => true);
             if ($detail['stop'] && !$detail['start']) {
                 // end period defined; limit result to start en end period
                 $searchcriteria['archive_stop'] = $detail['stop'];
             } elseif (!$detail['stop'] && $detail['start']) {
                 // only start period defined; limit result to inactive items from startperiod
                 $searchcriteria['archive_start'] = $detail['start'];
             } elseif ($detail['stop'] && $detail['start']) {
                 $searchcriteria['archive_start'] = $detail['start'];
                 $searchcriteria['archive_stop'] = $detail['stop'];
             }
             $overviewObj = $this->plugin->getObject(Calendar::TYPE_DEFAULT);
             $template->setVariable('tpl_list', $overviewObj->getOverviewList($searchcriteria, $detail, $url));
         }
         $this->template[$item['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:57,代码来源:CalendarArchive.php

示例6: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $taglist = $this->getTagList();
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     foreach ($taglist as $item) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setCacheable(true);
         $template->setPostfix($item['tag']);
         // check if template is in cache
         if (!$template->isCached()) {
             $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
             $detail = $this->getDetail($key);
             $currentId = $tree->getCurrentId();
             if (!$detail['type'] || $detail['type'] == self::TYPE_SKIP_TOP && $tree->getParentId($currentId) == $tree->getRootId() || $detail['type'] == self::TYPE_LAST && !$tree->isLeafNode($currentId)) {
                 continue;
             }
             $parentId = $tree->getParentId($currentId);
             $sibling = array();
             $siblinglist = $tree->getChildList($parentId);
             foreach ($siblinglist as $sibitem) {
                 if (isset($sibitem['visible']) && !$sibitem['visible']) {
                     continue;
                 }
                 $sibitem['path'] = isset($sibitem['external']) && $sibitem['external'] ? $sibitem['url'] : $tree->getPath($sibitem['id']);
                 $sibling[] = $sibitem;
             }
             // skip if no sibling present
             if (sizeof($sibling) <= 1) {
                 return;
             }
             if ($detail['show_name']) {
                 $template->setVariable('currentmenuname', $tree->getName($parentId));
             }
             $template->setVariable('currentmenu', $sibling);
             $template->setVariable('currentId', $currentId);
         }
         $this->template[$item['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:45,代码来源:CurrentMenu.php

示例7: 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();
     if (!$taglist) {
         return;
     }
     // get settings
     $settings = $this->getSettings();
     foreach ($taglist as $tag) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $template->setCacheable(true);
         $template->setVariable($settings, NULL, false);
         // check if template is in cache
         if (!$template->isCached()) {
             $pagesize = $settings['rows'];
             $searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'activated' => true);
             $list = $this->getList($searchcriteria, $pagesize, $page, $settings['display_order']);
             foreach ($list['data'] as &$item) {
                 $item['href_detail'] = $item['file'] ? $this->plugin->getFileUrl($item['id']) : '';
             }
             $template->setVariable('attachment', $list);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:34,代码来源:AttachmentOverview.php

示例8: handleDetail

 /**
  * handle detail request
  */
 private function handleDetail()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     // clear subtitle
     $view->setName('');
     // check security
     if (!$request->exists('id')) {
         throw new Exception('Reservation item is missing.');
     }
     $id = intval($request->getValue('id'));
     $key = array('id' => $id, 'activated' => true);
     if (!$this->exists($key)) {
         throw new HttpException('404');
     }
     $detail = $this->getDetail($key);
     // check if tree node of reservation item is accessable
     $tree = $this->director->tree;
     if (!$tree->exists($detail['tree_id'])) {
         throw new HttpException('404');
     }
     // process request
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $template->setPostfix($detail['tag']);
     $template->setCacheable(true);
     // overwrite default naming
     $template->setVariable('pageTitle', $detail['name'], false);
     // add breadcrumb item
     $url = new Url(true);
     $url->clearParameter('id');
     $breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true));
     $this->director->theme->addBreadcrumb($breadcrumb);
     // check if template is in cache
     if (!$template->isCached()) {
         $template->setVariable('reservation', $detail);
     }
     $objSettings = $this->plugin->getObject(Reservation::TYPE_SETTINGS);
     $settings = $objSettings->getSettings($detail['tree_id'], $detail['tag']);
     $template->setVariable('reservationsettings', $settings, false);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter($view->getUrlId(), ViewManager::OVERVIEW);
     $template->setVariable('href_back', $url->getUrl(true), false);
     $this->template[$detail['tag']] = $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:48,代码来源:ReservationOverview.php

示例9: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $taglist = $this->getTagList();
     if (!$taglist) {
         return;
     }
     foreach ($taglist as $item) {
         $template = new TemplateEngine();
         $template->setPostfix($item['tag']);
         $template->setCacheable(true);
         // check if template is in cache
         if (!$template->isCached()) {
             $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
             $detail = $this->getDetail($key);
             $template->setFile($detail['text']);
             $template->setIncludeFile(false);
         }
         $this->template[$item['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:23,代码来源:Source.php

示例10: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $taglist = $this->getTagList();
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     foreach ($taglist as $item) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setCacheable(true);
         $template->setPostfix($item['tag']);
         $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
         // check if template is in cache
         if (!$template->isCached()) {
             $siteGroup = $this->getSiteGroup();
             $id = $siteGroup->getCurrentId();
             $detail = $this->exists($key) ? $this->getDetail($key) : $this->getFields(SqlParser::MOD_INSERT);
             $template->setVariable('detail', $detail);
             $url = new Url();
             $url->setPath('/');
             $grouplist = $siteGroup->getList(array('active' => true));
             if ($grouplist['totalItems'] < 2) {
                 continue;
             }
             foreach ($grouplist['data'] as &$list) {
                 $url->setParameter(SystemSiteGroup::CURRENT_ID_KEY, $list['id']);
                 $list['path'] = $url->getUrl(true);
                 $list['selected'] = $list['id'] == $id;
                 $list['img'] = $this->getImage($list['language']);
             }
             $template->setVariable('sitegroup', $grouplist, false);
             $template->setVariable('sitegroupId', $id);
         }
         $this->template[$item['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:39,代码来源:SiteSelect.php

示例11: handleTreeNewGet

 /**
  * handle overview request
  */
 private function handleTreeNewGet()
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_NEW);
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('tree_id' => $tree_id, 'tag' => $tag);
     // get settings
     $settings = $this->plugin->getSettings($tree_id, $tag);
     $templateItem = new TemplateEngine($this->getPath() . "templates/formoverviewitem.tpl");
     $template->setPostfix($tag);
     $template->setCacheable(true);
     // check if template is in cache
     if (!$template->isCached()) {
         $templateItem->setVariable('settings', $settings);
         $searchcriteria = array('tree_id' => $tree_id, 'tag' => $tag, 'active' => true);
         $element = $this->plugin->getObject(Form::TYPE_ELEMENT);
         $list = $element->getList($searchcriteria, 0, 1, SqlParser::ORDER_ASC);
         foreach ($list['data'] as &$item) {
             $obj = $element->getObject($item['type'], $item);
             $obj->setId($element->getTypeId($item['id']));
             $request->getRequestType() == Request::POST ? $obj->handlePostRequest() : $obj->handleGetRequest();
             $item['html'] = $obj->getHtml();
             $item['class'] = get_class($obj);
         }
         $templateItem->setVariable('fields', $list);
         $template->setVariable('tag', $tag);
         $template->setVariable('settings', $settings);
         $template->setVariable('tpl_element_item', $templateItem);
     }
     $this->handleTreeSettings($template);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:38,代码来源:FormOverview.php

示例12: handleDetail

 /**
  * handle detail request
  */
 private function handleDetail()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     // clear subtitle
     $view->setName('');
     if (!$request->exists('id')) {
         throw new Exception('Galerij ontbreekt.');
     }
     $id = intval($request->getValue('id'));
     $key = array('id' => $id, 'activated' => true);
     if (!$this->exists($key)) {
         throw new HttpException('404');
     }
     $detail = $this->getDetail($key);
     // check if tree node of gallery item is accessable
     $tree = $this->director->tree;
     if (!$tree->exists($detail['tree_id'])) {
         throw new HttpException('404');
     }
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $template->setCacheable(true);
     // overwrite default naming
     $template->setVariable('pageTitle', $detail['name'], false);
     // add breadcrumb item
     $url = new Url(true);
     $url->clearParameter('id');
     $breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true));
     $this->director->theme->addBreadcrumb($breadcrumb);
     // check if template is in cache
     if (!$template->isCached()) {
         // add image
         if ($detail['image']) {
             $img = new Image($detail['image'], $this->plugin->getContentPath(true));
             $detail['image'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
         }
         $template->setVariable('gallery', $detail, false);
         // previous and next
         $url = new Url(true);
         $search = array('activated' => true, 'previous' => $detail['id']);
         $prev_id = $this->getId($search);
         if ($prev_id) {
             $url->setParameter('id', $prev_id);
             $template->setVariable('href_previous', $url->getUrl(true), false);
         }
         $search = array('activated' => true, 'next' => $detail['id']);
         $next_id = $this->getId($search);
         if ($next_id) {
             $url->setParameter('id', $next_id);
             $template->setVariable('href_next', $url->getUrl(true), false);
         }
         // comment
         $settings = $this->getSettings($detail['tree_id'], $detail['tag']);
         $template->setVariable('gallerysettings', $settings);
         // get settings
         if ($settings['comment']) {
             // process comments
             $comment = $this->plugin->getObject(Gallery::TYPE_COMMENT);
             $comment->setSettings($settings);
             $comment->handleHttpGetRequest();
         }
     }
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter($view->getUrlId(), ViewManager::OVERVIEW);
     $template->setVariable('href_back', $url->getUrl(true), false);
     $this->template[$detail['tag']] = $template;
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:71,代码来源:GalleryOverview.php

示例13: 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' => News::TYPE_DEFAULT));
     if (!$taglist) {
         return;
     }
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), News::VIEW_DETAIL);
     $newsSettings = $this->plugin->getObject(News::TYPE_SETTINGS);
     foreach ($taglist as $tag) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $template->setCacheable(true);
         // check if template is in cache
         if (!$template->isCached()) {
             // get settings
             $globalSettings = $this->plugin->getSettings();
             $settings = array_merge($globalSettings, $newsSettings->getSettings($tag['tree_id'], $tag['tag']));
             $template->setVariable('settings', $settings);
             // parse stylesheet
             if ($settings['template']) {
                 $template->setFile($settings['template']);
                 $template->setIncludeFile(false);
             }
             $pagesize = $settings['rows'] ? $settings['rows'] : $globalSettings['rows'];
             $searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'activated' => true);
             $list = $this->getList($searchcriteria, $pagesize, $page);
             if (!$list['data']) {
                 continue;
             }
             foreach ($list['data'] as &$item) {
                 $url->setParameter('id', $item['id']);
                 $item['href_detail'] = $url->getUrl(true);
                 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());
                 }
                 // retrieve attachments
                 if ($settings['display'] == News::DISP_FULL) {
                     $attachmentTag = 'newsattachment';
                     $attachment = $this->plugin->getObject(News::TYPE_ATTACHMENT);
                     $item[$attachmentTag] = $attachment->getAttachmentTemplate($item['id'], $attachmentTag);
                     $imageTag = 'template_newsimage';
                     $image = $this->plugin->getObject(News::TYPE_IMAGE);
                     $item[$imageTag] = $image->getImageTemplate($item['id'], $imageTag);
                 }
             }
             $template->setVariable('news', $list);
         }
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:60,代码来源:NewsOverview.php

示例14: handleOverviewGet

 /**
  * handle overview request
  */
 private function handleOverviewGet()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $values = $request->getRequest(Request::POST);
     // retrieve tags that are linked to this plugin
     $taglist = $this->plugin->getTagList(array('plugin_type' => NewsLetter::TYPE_DEFAULT));
     if (!$taglist) {
         return;
     }
     $objSettings = $this->plugin->getObject(NewsLetter::TYPE_SETTINGS);
     $objUser = $this->plugin->getObject(NewsLetter::TYPE_USER);
     $objGroup = $this->plugin->getObject(NewsLetter::TYPE_GROUP);
     $group = is_array($request->getValue('group')) ? array_keys($request->getValue('group')) : array();
     foreach ($taglist as $tag) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setPostfix($tag['tag']);
         $template->setCacheable(true);
         // check if template is in cache
         if (!$template->isCached()) {
             // get settings
             $globalSettings = $this->plugin->getSettings();
             $settings = array_merge($globalSettings, $objSettings->getSettings($tag['tree_id'], $tag['tag']));
             $template->setVariable('settings', $settings);
             $searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag']);
             $groupList = $objGroup->getList($searchcriteria);
             $template->setVariable('groupList', $groupList);
             $template->setVariable('cbo_gender', $groupList);
             $template->setVariable('cbo_gender', Utils::getHtmlCombo($objUser->getGenderTypeList(), array_key_exists('gender', $values) ? $values['gender'] : ''));
             $template->setVariable('name', array_key_exists('name', $values) ? $values['name'] : '');
             $template->setVariable('email', array_key_exists('email', $values) ? $values['email'] : '');
             $template->setVariable($searchcriteria);
         }
         $template->setVariable('group', $group);
         $this->template[$tag['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:40,代码来源:NewsLetterOverview.php

示例15: handleOverview

 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $taglist = $this->getTagList();
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     foreach ($taglist as $item) {
         $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
         $template->setCacheable(true);
         $template->setPostfix($item['tag']);
         // check if template is in cache
         if (!$template->isCached()) {
             $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
             $detail = $this->exists($key) ? $this->getDetail($key) : $this->getFields(SqlParser::MOD_INSERT);
             $currentId = $tree->getCurrentId();
             if (!$detail['type'] || $detail['type'] == self::TYPE_SKIP_TOP && $tree->getParentId($currentId) == $tree->getRootId()) {
                 continue;
             }
             $childs = array();
             $childlist = $tree->getChildList($currentId);
             foreach ($childlist as $subitem) {
                 if (isset($subitem['visible']) && !$subitem['visible']) {
                     continue;
                 }
                 $subitem['path'] = isset($subitem['external']) && $subitem['external'] ? $subitem['url'] : $tree->getPath($subitem['id']);
                 $childs[] = $subitem;
             }
             // skip if no submenu
             if (!$childs) {
                 return;
             }
             if ($detail['show_name']) {
                 $template->setVariable('submenuname', $tree->getName($currentId));
             }
             $template->setVariable('submenu', $childs);
         }
         $this->template[$item['tag']] = $template;
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:43,代码来源:SubMenu.php


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