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; }
/** * handle overview request */ private function handleOverview() { $request = Request::getInstance(); $view = ViewManager::getInstance(); // retrieve tags that are linked to this plugin $taglist = $this->plugin->getTagList(array('plugin_type' => Reservation::TYPE_LIST)); if (!$taglist) { return; } foreach ($taglist as $tag) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setPostfix($tag['tag']); $template->setCacheable(false); $template->setVariable($tag, null, false); $this->template[$tag['tag']] = $template; } $this->director->theme->addJavascript('Event.observe( window, "load", function() { getReservationList();} );'); }
/** * handle overview request */ private function handleOverview() { $taglist = $this->getTagList(); if (!$taglist) { return; } foreach ($taglist as $item) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setCacheable(true); $template->setPostfix($item['tag']); $skip = false; $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']); $detail = $this->exists($key) ? $this->getDetail($key) : $this->getFields(SqlParser::MOD_INSERT); switch ($detail['type']) { case self::TYPE_HORIZONTAL_LEVEL1: case self::TYPE_VERTICAL_LEVEL1: case self::TYPE_VERTICAL_LEVEL2: $this->handleSingleMenu($detail, $template); break; case self::TYPE_HORIZONTAL_PULLDOWN: case self::TYPE_VERTICAL_PULLDOWN: $this->handlePulldownMenu($detail, $template); break; default: $skip = true; } // skip if no type defined if ($skip) { continue; } $this->template[$item['tag']] = $template; } }
/** * handle detail request */ private function handleDetail() { $request = Request::getInstance(); $view = ViewManager::getInstance(); // process attachments $attachment = $this->getAttachment(); $attachment->handleHttpGetRequest(); // clear subtitle $view->setName(''); // check security if (!$request->exists('id')) { throw new Exception('Poll 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 poll 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']); // disable cache because we want to count visits $template->setCacheable(false); Cache::disableCache(); // update view counter $this->updateCount($key); // 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('poll', $detail, false); } */ $template->setVariable('poll', $detail, false); $settings = $this->getPollSettings(); $treeSettings = $settings->getSettings($detail['tag'], $detail['tree_id']); $template->setVariable('newssettings', $treeSettings, false); // get settings if ($treeSettings['item']) { // process items $item = $this->getItem(); $item->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; }
/** * 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; } }
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; }
/** * 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; } }
/** * handle detail request */ private function handleDetail() { $request = Request::getInstance(); $view = ViewManager::getInstance(); // 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(''); // check security if (!$request->exists('id')) { throw new Exception('Calendar id is missing.'); } $id = intval($request->getValue('id')); $key = array('id' => $id, 'activated' => $settings['history'] ? strftime('%Y-%m-%d', $settings['history']) : ''); if (!$this->exists($key)) { throw new HttpException('404'); } $detail = $this->getDetail($key); $objSettings = $this->plugin->getObject(Calendar::TYPE_SETTINGS); $settings = $objSettings->getSettings($detail['tree_id'], $detail['tag']); // check if tree node of cal item is accessable $tree = $this->director->tree; if (!$tree->exists($detail['tree_id'])) { throw new HttpException('404'); } 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()); } // process request $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 $this->updateCount($key); // 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); $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(); } $url->setParameter($view->getUrlId(), ViewManager::OVERVIEW); $template->setVariable('href_back', $url->getUrl(true), false); $this->template[$detail['tag']] = $template; }
/** * handle edit request */ private function handleTreeEditGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); $view = ViewManager::getInstance(); $view->setType(ViewManager::TREE_EDIT); $element = $this->plugin->getObject(Form::TYPE_ELEMENT); $record = $this->plugin->getObject(Form::TYPE_RECORD); $recordItem = $this->plugin->getObject(Form::TYPE_RECORD_ITEM); if (!$request->exists('rcd_id')) { throw new Exception('Record id is missing.'); } $rcd_id = intval($request->getValue('rcd_id')); $key = array('id' => $rcd_id); if (!$record->exists($key)) { throw new Exception('Record does not exist.'); } $recordDetail = $record->getDetail($key); $tree_id = $recordDetail['tree_id']; $tag = $recordDetail['tag']; // get record items if ($request->getRequestType() == Request::GET) { $recordItemList = $recordItem->getRecordElementList($rcd_id); } else { $recordItemList = array(); } // get settings $settings = $this->plugin->getSettings($tree_id, $tag); $templateItem = new TemplateEngine($this->getPath() . "templates/formoverviewitem.tpl"); $template->setPostfix($tag); $template->setCacheable(true); $templateItem->setVariable('settings', $settings); $searchcriteria = array('tree_id' => $tree_id, 'tag' => $tag, 'active' => true); $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'])); if ($request->getRequestType() == Request::POST) { $obj->handlePostRequest(); } elseif (array_key_exists($obj->getId(), $recordItemList)) { $obj->handleSetValue($recordItemList[$obj->getId()]['value']); } $item['html'] = $obj->getHtml(); $item['class'] = get_class($obj); } $templateItem->setVariable('fields', $list); $template->setVariable('rcd_id', $rcd_id); $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; }
/** * handle overview request */ private function handleOverview() { $request = Request::getInstance(); $view = ViewManager::getInstance(); $tag = 'poll_item'; if (!$request->exists('id')) { throw new Exception('Poll is missing.'); } $poll_id = intval($request->getValue('id')); $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setPostfix($tag); $template->setCacheable(true); // add item if requested if ($request->exists(self::VIEW_KEY)) { $this->handleItemAdd($template); } // check if template is in cache if (!$template->isCached()) { // retrieve items $searchcriteria = array('poll_id' => $poll_id, 'activated' => true); $list = $this->getList($searchcriteria); $template->setVariable('item', $list); } $this->template[$tag] = $template; }
/** * 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; } }
/** * 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; } }
/** * 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; }
/** * 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('Link 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 thumb 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']); // overwrite default naming $template->setVariable('pageTitle', $detail['name'], false); // add breadcrumb item $url = new Url(true); $breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true)); $this->director->theme->addBreadcrumb($breadcrumb); $template->setVariable('links', $detail, false); $url = new Url(true); $url->clearParameter('id'); $url->setParameter($view->getUrlId(), ViewManager::OVERVIEW); $template->setVariable('href_back', $url->getUrl(true), false); $settings = $this->plugin->getObject(Links::TYPE_SETTINGS)->getSettings($detail['tag'], $detail['tree_id']); $tag = $detail['tag']; if ($settings['target']) { $tag = $settings['target']; $this->overrideTag[] = $tag; $this->handleOverview($detail['tree_id'], $detail['tag']); } $this->template[$tag] = $template; }
/** * handle overview request */ private function handleOverview() { $view = ViewManager::getInstance(); $taglist = $this->plugin->getTagList(); if (!$taglist) { return; } $tree = $this->director->tree; // link to attachment tree nodes $treeRef = new AttachmentTreeRef(); foreach ($taglist as $item) { $key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']); $detail = $this->getDetail($key); $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setPostfix($item['tag']); $template->setCacheable($detail['display_order'] != Attachment::ORDER_RAND); // 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); $display_order = $detail['display_order'] ? $detail['display_order'] : $settings['display_order']; $overview = $this->getAttachmentOverview(); $list = $overview->getList($searchcriteria, $detail['rows'], 1, $display_order); // skip if empty if ($list['totalItems'] < 1) { continue; } foreach ($list['data'] as &$att) { $att['href_detail'] = $att['file'] ? $this->plugin->getFileUrl($att['id']) : ''; } $template->setVariable('attachment', $list); $template->setVariable('name', $detail['name']); $template->setVariable('display', $settings['display_hdl']); } $this->template[$item['tag']] = $template; } }
/** * 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; } }
/** * 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; } }
/** * 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; } }
public function getImageTemplate($news_id, $tag) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setPostfix($tag . $news_id); $template->setCacheable(true); // check if template is in cache if (!$template->isCached()) { $searchcriteria = array('news_id' => $news_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()); } } /* // 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 ? $prenewsimage[] = $allImg : $postnewsimage[] = $allImg; } $template->setVariable('prenewsimage', $prenewsimage); $template->setVariable('postnewsimage', $postnewsimage); */ $template->setVariable('newsimage', $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; }
/** * 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' => News::TYPE_ARCHIVE)); if (!$taglist) { return; } $taginfo = current($taglist); // process attachments $attachment = $this->getAttachment(); $attachment->handleHttpGetRequest(); // clear subtitle $view->setName(''); if (!$request->exists('id')) { continue; } $id = intval($request->getValue('id')); $key = array('id' => $id, 'active' => true); $overview = $this->getNewsOverview(); if (!$overview->exists($key)) { throw new HttpException('404'); } $detail = $overview->getDetail($key); // check if tree node of news 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->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); $template->setVariable('news', $detail, 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); $this->template[$taginfo['tag']] = $template; }
/** * handle overview request */ private function handleOverview() { $view = ViewManager::getInstance(); $taglist = $this->plugin->getTagList(); if (!$taglist) { return; } $tree = $this->director->tree; // link to attachment tree nodes $treeRef = new AttachmentTreeRef(); 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->getAttachmentOverview(); $list = $overview->getList($searchcriteria, $settings['rows']); foreach ($list['data'] as &$item) { $item['href_detail'] = $item['file'] ? $this->plugin->getFileUrl($item['id']) : ''; } $template->setVariable('attachment', $list); $template->setVariable('display', $settings['display'], false); } $this->template[$detail['tag']] = $template; } }
public function getOverview($cal_id) { $cal_id = intval($cal_id); $tag = 'calendarcomment'; $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setPostfix($tag); $template->setCacheable(true); $template->setVariable('cal_id', $cal_id); // check if template is in cache if (!$template->isCached()) { // retrieve comments $searchcriteria = array('cal_id' => $cal_id, 'activated' => true); $settings = $this->getSettings(); $order = array_key_exists('comment_order_asc', $settings) && $settings['comment_order_asc'] ? SqlParser::ORDER_ASC : SqlParser::ORDER_DESC; $list = $this->getList($searchcriteria, 0, 1, $order); $template->setVariable('calendarsettings', $settings); $template->setVariable('comment', $list); } return $template; }
/** * 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; } }