Пример #1
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(NewsLetter::VIEW_FILE_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 ontbreekt.');
     }
     $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);
     // get path to file
     if ($fields['file']) {
         $template->setVariable('file_url', $this->plugin->getFileUrl($id), false);
     }
     $template->setVariable($fields, NULL, false);
     $this->handleTreeSettings($template);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Пример #2
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('Bestand ontbreekt.');
     }
     $id = intval($request->getValue('id'));
     $template->setVariable('id', $id, false);
     $key = array('id' => $id);
     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']) : '';
     } else {
         $fields = $this->getFields(SqlParser::MOD_UPDATE);
         $detail = $this->getDetail($key);
         $fields['file'] = $detail['file'];
     }
     $this->setFields($fields);
     // get path to file
     if ($fields['file']) {
         $template->setVariable('file_url', $this->plugin->getFileUrl($id), false);
     }
     $template->setVariable($fields, NULL, false);
     $this->handleTreeSettings($template);
     $datefields = array();
     $datefields[] = array('dateField' => 'online', 'triggerElement' => 'online');
     $datefields[] = array('dateField' => 'offline', 'triggerElement' => 'offline');
     Utils::getDatePicker($this->director->theme, $datefields);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Пример #3
0
 /**
  * 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;
     }
 }
Пример #4
0
 /**
  * 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;
     }
 }