Example #1
0
 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $taglist = $this->plugin->getTagList(array('plugin_type' => News::TYPE_ARCHIVE));
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), News::VIEW_DETAIL);
     // link to news tree nodes
     $treeRef = new NewsTreeRef();
     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()) {
             // get settings
             $settings = $this->getSettings();
             $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
             $detail = $this->getDetail($key);
             $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('tree_id' => $treeItemList, 'active' => true);
             if ($detail['online']) {
                 $searchcriteria['archiveonline'] = $detail['online'];
             }
             $searchcriteria['archiveoffline'] = $detail['offline'] ? $detail['offline'] : time();
             $overview = $this->getNewsOverview();
             $list = $overview->getList($searchcriteria, $settings['rows'], $page);
             foreach ($list['data'] as &$newsitem) {
                 $url->setParameter('id', $newsitem['id']);
                 $newsitem['href_detail'] = $url->getUrl(true);
                 if ($newsitem['thumbnail']) {
                     $img = new Image($newsitem['thumbnail'], $this->plugin->getContentPath(true));
                     $newsitem['thumbnail'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
                 }
             }
             $template->setVariable('news', $list);
             $template->setVariable('display', $settings['display'], false);
         }
         $this->template[$item['tag']] = $template;
     }
 }
Example #2
0
 /**
  * handle admin overview request
  */
 private function handleAdminOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $url = new Url(true);
     $url->clearParameter('id');
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::ADMIN_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_update = clone $url;
     $url_update->setParameter($view->getUrlId(), self::VIEW_UPDATE);
     $template->setVariable('href_update', $url_update->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::ADMIN_EDIT);
     $url_config = clone $url;
     $url_config->setParameter($view->getUrlId(), self::VIEW_CONFIG);
     $url_export = clone $url;
     $url_export->setParameter($view->getUrlId(), self::VIEW_EXPORT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::ADMIN_DELETE);
     $searchcriteria = array();
     $list = $this->getList(NULL, $this->pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_config->setParameter('id', $item['id']);
         $url_export->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_config'] = $url_config->getUrl(true);
         $item['href_export'] = $url_export->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         if ($item['image']) {
             try {
                 $img = new Image($item['image'], $this->getContentPath(true));
                 $item['image'] = array('src' => $this->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
             } catch (Exception $err) {
             }
         }
     }
     $template->setVariable('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Example #3
0
 /**
  * handle tree edit
  */
 private function handleTreeEditGet($retrieveFields = true)
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_EDIT);
     if (!$request->exists('id')) {
         throw new Exception('Link is missing.');
     }
     $id = intval($request->getValue('id'));
     $template->setVariable('id', $id, false);
     $key = array('id' => $id);
     if ($retrieveFields) {
         $fields = $this->getDetail($key);
     } else {
         $fields = $this->getFields(SqlParser::MOD_UPDATE);
         $detail = $this->getDetail($key);
         $fields['image'] = $detail['image'];
     }
     $this->setFields($fields);
     if ($fields['image']) {
         $img = new Image($fields['image'], $this->getContentPath(true));
         $fields['image'] = array('src' => $this->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
     }
     $template->setVariable($fields, NULL, false);
     $this->handleTreeSettings($template);
     $template->setVariable('fckBox', $this->getEditor($fields['text']), false);
     // get all tree nodes which have plugin modules
     $site = new SystemSite();
     $tree = $site->getTree();
     $treelist = $tree->getList();
     foreach ($treelist as &$item) {
         $item['name'] = $tree->toString($item['id'], '/', 'name');
     }
     $template->setVariable('cbo_tree_id', Utils::getHtmlCombo($treelist, $fields['ref_tree_id'], '...'));
     // get crop settings
     $settings = $this->plugin->getObject(Links::TYPE_SETTINGS)->getSettings($fields['tag'], $fields['tree_id']);
     //only crop if both width and height defaults are set
     if ($fields['image'] && $settings['image_width'] && $settings['image_height'] && ($fields['image']['width'] > $settings['image_width'] || $fields['image']['height'] > $settings['image_height'])) {
         $theme = $this->director->theme;
         $parseFile = new ParseFile();
         $parseFile->setVariable($fields, NULL, false);
         $parseFile->setVariable('imgTag', 'imgsrc', false);
         $parseFile->setVariable($settings, NULL, false);
         $parseFile->setSource($this->getHtdocsPath(true) . "js/cropinit.js.in");
         //$parseFile->setDestination($this->getCachePath(true)."cropinit_tpl_content.js");
         //$parseFile->save();
         $theme->addJavascript($parseFile->fetch());
         //$this->headers[] = '<script type="text/javascript" src="'.$this->getCachePath().'cropinit_tpl_content.js"></script>';
         $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/cropper.js"></script>');
         $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/mint.js"></script>');
     }
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Example #4
0
 private function handlePluginList($tag, $parameters)
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $searchcriteria = isset($parameters) && array_key_exists('searchcriteria', $parameters) ? $parameters['searchcriteria'] : array();
     $keys = isset($parameters) && array_key_exists('keys', $parameters) ? $parameters['keys'] : array();
     $searchcriteria['id'] = $keys;
     $settings = $this->plugin->getSettings();
     $template->setVariable('settings', $settings);
     $systemSite = new SystemSite();
     $tree = $systemSite->getTree();
     $list = $this->getList($searchcriteria, $pagesize, $page);
     foreach ($list['data'] as &$item) {
         //TODO get url from caller plugin (newsletter) to track visits
         $url = new Url();
         $url->setPath($request->getProtocol() . $request->getDomain() . $tree->getPath($item['tree_id']));
         $url->setParameter('id', $item['id']);
         $url->setParameter(ViewManager::URL_KEY_DEFAULT, Calendar::VIEW_DETAIL);
         $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());
         }
     }
     $template->setVariable('calendar', $list);
     $this->template[$tag] = $template;
 }
Example #5
0
 /**
  * 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;
     }
 }
Example #6
0
 /**
  * handle tree edit
  */
 private function handleTreeEditGet($retrieveFields = true)
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(Calendar::VIEW_IMAGE_EDIT);
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $template->setVariable('tree_id', $tree_id, false);
     $template->setVariable('tag', $tag, false);
     if (!$request->exists('id')) {
         throw new Exception('Bestand is missing.');
     }
     $id = intval($request->getValue('id'));
     $template->setVariable('id', $id, false);
     $key = array('id' => $id);
     if ($retrieveFields) {
         $fields = $this->getDetail($key);
     } else {
         $fields = $this->getFields(SqlParser::MOD_UPDATE);
         $detail = $this->getDetail($key);
         $fields['file'] = $detail['file'];
     }
     $this->setFields($fields);
     if ($fields['image']) {
         $img = new Image($fields['image'], $this->plugin->getContentPath(true));
         $fields['image'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
     }
     $template->setVariable($fields);
     $this->handleTreeSettings($template);
     // get crop settings
     $settings = $this->plugin->getSettings();
     //only crop if both width and height defaults are set
     if ($fields['image'] && $settings['image_width'] && $settings['image_height'] && ($fields['image']['width'] > $settings['image_width'] || $fields['image']['height'] > $settings['image_height'])) {
         $theme = $this->director->theme;
         $parseFile = new ParseFile();
         $parseFile->setVariable($fields);
         $parseFile->setVariable('imgTag', 'imgsrc');
         $parseFile->setVariable($settings);
         $parseFile->setSource($this->plugin->getHtdocsPath(true) . "js/cropinit.js.in");
         //$parseFile->setDestination($this->plugin->getCachePath(true)."cropinit_tpl_content.js");
         //$parseFile->save();
         $theme->addJavascript($parseFile->fetch());
         $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/cropper.js"></script>');
         $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/mint.js"></script>');
         //$theme->addHeader('<script type="text/javascript" src="'.$this->plugin->getCachePath().'cropinit_tpl_content.js"></script>');
     }
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Example #7
0
 /**
  * handle tree edit
  */
 private function handleeditget($retrieveFields = true)
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_EDIT);
     if (!$request->exists('id')) {
         throw new Exception('Nieuwsbericht ontbreekt.');
     }
     $id = intval($request->getValue('id'));
     $key = array('id' => $id);
     $template->setVariable($key);
     if ($retrieveFields) {
         $fields = $this->getDetail($key);
         $fields['online'] = $fields['online'] ? strftime('%Y-%m-%d', $fields['online']) : '';
         $fields['offline'] = $fields['offline'] ? strftime('%Y-%m-%d', $fields['offline']) : '';
         $fields['date'] = $fields['date'] ? strftime('%Y-%m-%d', $fields['date']) : '';
     } else {
         $fields = $this->getFields(SqlParser::MOD_UPDATE);
         $detail = $this->getDetail($key);
         $fields['image'] = $detail['image'];
     }
     $this->setFields($fields);
     if ($fields['image']) {
         $img = new Image($fields['image'], $this->plugin->getContentPath(true));
         $fields['image'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
     }
     $template->setVariable($fields);
     $this->handleTreeSettings($template);
     $template->setVariable('fckBox', $this->getEditor($fields['text']));
     $datefields = array();
     $datefields[] = array('dateField' => 'online', 'triggerElement' => 'online');
     $datefields[] = array('dateField' => 'offline', 'triggerElement' => 'offline');
     $datefields[] = array('dateField' => 'date', 'triggerElement' => 'date');
     Utils::getDatePicker($this->director->theme, $datefields);
     // get crop settings
     $settings = $this->plugin->getSettings();
     //only crop if both width and height defaults are set
     if ($fields['image'] && $settings['image_width'] && $settings['image_height'] && ($fields['image']['width'] > $settings['image_width'] || $fields['image']['height'] > $settings['image_height'])) {
         $theme = $this->director->theme;
         $parseFile = new ParseFile();
         $parseFile->setVariable($fields);
         $parseFile->setVariable('imgTag', 'imgsrc');
         $parseFile->setVariable($settings);
         $parseFile->setSource($this->plugin->getHtdocsPath(true) . "js/cropinit.js.in");
         //$parseFile->setDestination($this->plugin->getCachePath(true)."cropinit_tpl_content.js");
         //$parseFile->save();
         $theme->addJavascript($parseFile->fetch());
         $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/cropper.js"></script>');
         $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/mint.js"></script>');
         //$theme->addHeader('<script type="text/javascript" src="'.$this->plugin->getCachePath().'cropinit_tpl_content.js"></script>');
     }
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Example #8
0
 public function getRandom($search)
 {
     if (!array_key_exists('tree_id', $search)) {
         throw new Exception('Tree node not set');
     }
     if (!array_key_exists('tag', $search)) {
         throw new Exception('Template tag not set');
     }
     if (!array_key_exists('current', $search)) {
         throw new Exception('Current item not set');
     }
     $search['activated'] = true;
     $search['no_id'] = $search['current'];
     // fix searchcriteria if only 1 image is in the list
     if (!$this->exists($search)) {
         unset($search['no_id']);
     }
     $detail = $this->getDetail($search, BannerView::ORDER_RANDOM);
     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());
     }
     $detail['url'] = $detail['url'] ? $this->getDetailUrl($detail['id'], $detail['tree_id'], $detail['tag'], false) : '';
     // register view
     $this->addView($detail);
     return $detail;
 }
Example #9
0
 /**
  * handle detail request
  */
 private function handleDetail()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     // it makes no sense to have multiple tags for this plugin.
     // if someone did it, you get strange results and he probably can figure out why.. no multiple detail stuff in 1 page supported!
     // so take a shot and get the first tag to set the content
     $taglist = $this->plugin->getTagList(array('plugin_type' => Calendar::TYPE_ARCHIVE));
     if (!$taglist) {
         return;
     }
     $taginfo = current($taglist);
     // process attachments
     $attachment = $this->plugin->getObject(Calendar::TYPE_ATTACHMENT);
     $attachment->handleHttpGetRequest();
     // process images
     $image = $this->plugin->getObject(Calendar::TYPE_IMAGE);
     $image->handleHttpGetRequest();
     // clear subtitle
     $view->setName('');
     if (!$request->exists('id')) {
         throw new Exception('Calendar id is missing.');
     }
     $id = intval($request->getValue('id'));
     $key = array('id' => $id, 'active' => true, 'finished' => true);
     $overview = $this->plugin->getObject(Calendar::TYPE_DEFAULT);
     if (!$overview->exists($key)) {
         return;
     }
     $detail = $overview->getDetail($key);
     // check if tree node of cal item is accessable
     $tree = $this->director->tree;
     if (!$tree->exists($detail['tree_id'])) {
         throw new HttpException('404');
     }
     $objSettings = $this->plugin->getObject(Calendar::TYPE_SETTINGS);
     $settings = $objSettings->getSettings($detail['tree_id'], $detail['tag']);
     if ($detail['thumbnail']) {
         $img = new Image($detail['thumbnail'], $this->plugin->getContentPath(true));
         $detail['thumbnail'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
     }
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $template->setPostfix($detail['tag']);
     // disable cache because we want to count visits
     $template->setCacheable(false);
     Cache::disableCache();
     // update view counter
     $overview->updateCount($key);
     // overwrite default naming
     $template->setVariable('pageTitle', $detail['name'], false);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter($view->getUrlId(), ViewManager::OVERVIEW);
     $template->setVariable('href_back', $url->getUrl(true), false);
     $breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true));
     $this->director->theme->addBreadcrumb($breadcrumb);
     $template->setVariable('cal', $detail, false);
     $template->setVariable('settings', $settings);
     $template->setVariable('calsettings', $settings, false);
     // get settings
     if ($settings['comment']) {
         // process comments
         $comment = $this->plugin->getObject(Calendar::TYPE_COMMENT);
         $comment->setSettings($settings);
         $comment->handleHttpGetRequest();
     }
     $this->template[$taginfo['tag']] = $template;
 }
Example #10
0
 /**
  * handle settings edit
  */
 private function handleSettingsGet($retrieveFields = true)
 {
     viewManager::getInstance()->setType(self::VIEW_SETTINGS);
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     if (!$request->exists('tree_id')) {
         throw new Exception('Node ontbreekt.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag ontbreekt.');
     }
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('tree_id' => $tree_id, 'tag' => $tag);
     $fields = array();
     if ($retrieveFields) {
         $fields = $this->exists($key) ? $this->getDetail($key) : $this->getFields(SqlParser::MOD_INSERT);
         if (!array_key_exists('image', $fields)) {
             $fields['image'] = '';
         }
     } else {
         $fields = $this->getFields(SqlParser::MOD_UPDATE);
         $detail = $this->getDetail($key);
         $fields['image'] = $detail['image'];
     }
     if ($fields['image']) {
         $img = new Image($fields['image'], $this->getContentPath(true));
         $fields['image'] = array('src' => $this->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
     }
     $fields['tree_id'] = $tree_id;
     $fields['tag'] = $tag;
     $this->setFields($fields);
     $template->setVariable($fields);
     $template->setVariable('cbo_display', Utils::getHtmlCombo($this->getDisplayTypeList(), $fields['display']));
     $template->setVariable('cbo_display_order', Utils::getHtmlCombo($this->getDisplayOrderList(), $fields['display_order']));
     // add breadcrumb item
     $this->director->theme->handleAdminLinks($template);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Example #11
0
 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $view = ViewManager::getInstance();
     $taglist = $this->plugin->getTagList(array('plugin_type' => News::TYPE_HEADLINES));
     if (!$taglist) {
         return;
     }
     $tree = $this->director->tree;
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), News::VIEW_DETAIL);
     // link to news tree nodes
     $treeRef = new NewsTreeRef();
     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
             //$settings = $this->getSettings();
             $key = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag']);
             $detail = $this->getDetail($key);
             $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->getNewsOverview();
             $list = $overview->getList($searchcriteria, $detail['rows']);
             // skip if empty
             if ($list['totalItems'] < 1) {
                 continue;
             }
             foreach ($list['data'] as &$item) {
                 $url->setPath($tree->getPath($item['tree_id']));
                 $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());
                 }
             }
             $template->setVariable('news', $list);
             $template->setVariable('settings', $detail);
         }
         $this->template[$tag['tag']] = $template;
     }
 }