/** * 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); $key = $this->getKey(); $fields = array(); if ($retrieveFields) { if ($this->exists($key)) { $fields = $this->getDetail($key); $fields['start'] = $fields['start'] ? strftime('%Y-%m-%d', $fields['start']) : ''; $fields['stop'] = $fields['stop'] ? strftime('%Y-%m-%d', $fields['stop']) : ''; } else { $fields = $this->getFields(SqlParser::MOD_INSERT); } } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $template->setVariable('cbo_group', Utils::getHtmlCombo(Calendar::getGroupTypeList(), $fields['group_type'])); $template->setVariable('cbo_display', Utils::getHtmlCombo(Calendar::getDisplayTypeList(), $fields['display'])); // get all tree nodes which have plugin modules $sitePlugin = $this->director->siteManager->systemSite->getSitePlugin(); $tree = $this->plugin->getReferer()->getTree(); $searchcriteria = array('classname' => 'Calendar', 'plugin_type' => Calendar::TYPE_DEFAULT); $treeplugin = $sitePlugin->getList($searchcriteria); $treelist = array(); foreach ($treeplugin['data'] as $item) { if (!$tree->exists($item['tree_id'])) { continue; } $treelist[] = array('id' => $item['tree_id'], 'name' => $tree->toString($item['tree_id'], '/', 'name')); } // get all selected tree node connections $treeRef = new CalendarTreeRef(); $treeRefTmp = $treeRef->getList($key); $treeRefLink = array(); foreach ($treeRefTmp['data'] as $item) { $treeRefLink[] = $item['ref_tree_id']; } $template->setVariable('ref_tree_id', Utils::getHtmlCheckbox($treelist, $treeRefLink, 'ref_tree_id', '<br />')); $datefields = array(); $datefields[] = array('dateField' => 'start', 'triggerElement' => 'start'); $datefields[] = array('dateField' => 'stop', 'triggerElement' => 'stop'); Utils::getDatePicker($this->director->theme, $datefields); $this->setFields($fields); $template->setVariable($fields); $template->setVariable($key); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * 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('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); } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } // get all tree nodes which have plugin modules $sitePlugin = $this->director->siteManager->systemSite->getSitePlugin(); $tree = $this->plugin->getReferer()->getTree(); $searchcriteria = array('classname' => 'Calendar', 'plugin_type' => Calendar::TYPE_DEFAULT); $treeplugin = $sitePlugin->getList($searchcriteria); $treelist = array(); foreach ($treeplugin['data'] as $item) { if (!$tree->exists($item['tree_id'])) { continue; } $treelist[] = array('id' => $item['tree_id'], 'name' => $tree->toString($item['tree_id'], '/', 'name')); } // get all selected tree node connections $treeRef = new CalendarTreeRef(); $treeRefTmp = $treeRef->getList($key); $treeRefLink = array(); foreach ($treeRefTmp['data'] as $item) { $treeRefLink[] = $item['ref_tree_id']; } $template->setVariable('ref_tree_id', Utils::getHtmlCheckbox($treelist, $treeRefLink, 'ref_tree_id', '<br />')); $this->setFields($fields); $template->setVariable($fields, NULL, false); $template->setVariable('tree_id', $tree_id, false); $template->setVariable('tag', $tag, false); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }