예제 #1
0
파일: Source.php 프로젝트: rverbrugge/dif
 /**
  * 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;
     }
 }
예제 #2
0
 public function getOverviewList($searchcriteria, $settings, $url)
 {
     $view = ViewManager::getInstance();
     $template = new TemplateEngine($this->getPath() . "templates/calendaroverviewlist.tpl");
     $template->setPostfix($searchcriteria['tag']);
     $template->setCacheable(true);
     // check if template is in cache
     if ($template->isCached()) {
         return $template;
     }
     // get settings
     $template->setVariable('settings', $settings);
     // parse template
     if ($settings['template']) {
         $template->setFile($settings['template']);
         $template->setIncludeFile(false);
     }
     $list = $this->getList($searchcriteria, $settings['rows'], $this->getPage(), SqlParser::ORDER_ASC);
     if (!$list['data']) {
         return;
     }
     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'] == Calendar::DISP_FULL) {
             $attachmentTag = 'calattachment';
             $attachment = $this->plugin->getObject(Calendar::TYPE_ATTACHMENT);
             $item[$attachmentTag] = $attachment->getAttachmentTemplate($item['id'], $attachmentTag);
             $imageTag = 'template_calimage';
             $image = $this->plugin->getObject(Calendar::TYPE_IMAGE);
             $item[$imageTag] = $image->getImageTemplate($item['id'], $imageTag);
         }
     }
     $template->setVariable('cal', $list);
     return $template;
 }
예제 #3
0
 /**
  * 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;
     }
 }