/** * 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; } }
/** * 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() { $request = Request::getInstance(); $view = ViewManager::getInstance(); // retrieve tags that are linked to this plugin $taglist = $this->plugin->getTagList(); if (!$taglist) { return; } foreach ($taglist as $tag) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'current' => $request->exists("bnr{$tag['tag']}", Request::SESSION) ? $request->getValue("bnr{$tag['tag']}", Request::SESSION) : 0, 'activated' => true); // skip if no images available if (!$this->exists($searchcriteria)) { continue; } Cache::disableCache(); // get settings $settings = $this->getSettings($searchcriteria); $template->setVariable('settings', $settings, false); switch ($settings['display_order']) { case Banner::DISP_ORDER_LINEAR: $banner = $this->getLinear($searchcriteria); break; default: $banner = $this->getRandom($searchcriteria); } $template->setVariable('banner', $banner); // save current id in session for next banner retrieval $request->setValue("bnr{$banner['tag']}", $banner['id']); // register view $this->addView($banner); $theme = $this->director->theme; // add javascript start script // skip if transition speed is insane fast if ($settings['display'] != Banner::DISP_SINGLE && $banner['transition_speed'] > 1) { $theme->addJavascript(sprintf('setTimeout("getNextBanner(%d, %d, \'%s\', %d)", %d*1000);', $banner['id'], $banner['tree_id'], $banner['tag'], $banner['display_order'], $banner['transition_speed'])); } // parse unique stylesheet // retrieve tag to postfix scripts and stylesheets for uniqueness (there can be more than 1 banner in a single page) $parseFile = new ParseFile(); $parseFile->setVariable('banner', $banner, false); $parseFile->setSource($this->plugin->getHtdocsPath(true) . "css/banner.css.in"); //$parseFile->setDestination($this->plugin->getCachePath(true)."banner_{$tag['tree_id']}{$tag['tag']}.css"); //$parseFile->save(); $theme->addStylesheet($parseFile->fetch()); $this->template[$tag['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; } }