/** * 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; }
/** * 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(Form::VIEW_ELEMENT_EDIT); if (!$request->exists('id')) { throw new Exception('Element 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); } $this->setFields($fields); $this->handleTreeSettings($template); $template->setVariable('cbo_type', Utils::getHtmlCombo($this->getTypeList(), $fields['type'])); $template->setVariable($fields, NULL, false); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle user */ private function handleUserGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); if (!$request->exists('id')) { throw new Exception('User group is missing.'); } $id = intval($request->getValue('id')); $template->setVariable('id', $id, false); $key = array('id' => $id); $user = $this->director->adminManager->getPlugin('User'); $usr_used = $request->getValue('usr_used'); if ($retrieveFields) { $searchcriteria = array('grp_id' => $id); $tmp = $user->getList($searchcriteria); $usr_used = $tmp['data']; } $search_used = $usr_used ? array('id' => $usr_used) : NULL; $search_free = $usr_used ? array('no_id' => $usr_used) : NULL; $user_used = $usr_used ? $user->getList($search_used) : array('data' => ''); $user_free = $user->getList($search_free); $template->setVariable('cbo_usr_used', Utils::getHtmlCombo($user_used['data'], NULL, NULL, 'id', 'formatName')); $template->setVariable('cbo_usr_free', Utils::getHtmlCombo($user_free['data'], NULL, NULL, 'id', 'formatName')); $view = ViewManager::getInstance(); $url = new Url(true); $breadcrumb = array('name' => $view->getName(), 'path' => $url->getUrl(true)); $this->director->theme->addBreadcrumb($breadcrumb); $url->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW); $template->setVariable('href_back', $url->getUrl(true), false); $template->setVariable('title', $this->getName($key), false); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle conf edit */ private function handleConfEditGet($retrieveFields = true) { viewManager::getInstance()->setType(ViewManager::CONF_EDIT); $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setVariable('pageTitle', $this->description); $request = Request::getInstance(); $view = ViewManager::getInstance(); $detail = $this->getDetail(array()); $fields = array(); if ($retrieveFields) { $fields = $this->exists(array()) ? $detail : $this->getFields(SqlParser::MOD_INSERT); } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $this->setFields($fields); $template->setVariable($fields); $template->setVariable('id', $detail ? $detail['id'] : ''); // get theme list $themeManager = new ThemeManager(); $searchcriteria = array('active' => true); $themelist = $themeManager->getList($searchcriteria); $template->setVariable('cbo_theme', Utils::getHtmlCombo($themelist['data'], $fields['theme_id'])); $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); } $this->setFields($fields); $template->setVariable($fields, NULL, false); $template->setVariable('tree_id', $tree_id, false); $template->setVariable('tag', $tag, false); $template->setVariable('cbo_type', Utils::getHtmlCombo($this->getMenuTypeList(), $fields['type'], 'geen submenu')); $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 $site = new SystemSite(); $tree = $site->getTree(); $treelist = $tree->getList($tree_id); foreach ($treelist as &$item) { $item['name'] = $tree->toString($item['id'], '/', 'name'); } $template->setVariable('cbo_tree_id', Utils::getHtmlCombo($treelist, $fields['ref_tree_id'])); $this->setFields($fields); $template->setVariable($this->getFields(SqlParser::MOD_UPDATE), NULL, false); $template->setVariable('tree_id', $tree_id, false); $template->setVariable('tag', $tag, false); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle tree edit */ private function handleConfigGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); $view = ViewManager::getInstance(); $view->setType(Links::VIEW_CONFIG); 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) { if ($this->exists($key)) { $fields = $this->getDetail($key); } else { $defaultSettings = $this->plugin->getSettings(); $fields = $this->getFields(SqlParser::MOD_INSERT); $fields = array_merge($fields, $defaultSettings); } } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $template->setVariable('cbo_display', Utils::getHtmlCombo(self::getDisplayTypeList(), $fields['display'])); // get theme tag list and user defined tag list $searchcriteria = array('tree_id' => $id); $systemSite = $this->plugin->getReferer(); $taglist = $systemSite->getTagList($searchcriteria); // remove own tag unset($taglist[$tag]); $template->setVariable('cbo_target', Utils::getHtmlCombo($taglist, $fields['target'], 'Current tag')); $fields['tree_id'] = $tree_id; $fields['tag'] = $tag; $this->setFields($fields); $template->setVariable($fields); // add breadcrumb item $this->director->theme->handleAdminLinks($template); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle settings edit */ private function handleSettingsGet($retrieveFields = true) { viewManager::getInstance()->setType(self::VIEW_CONFIG); $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); } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $fields['tree_id'] = $tree_id; $fields['tag'] = $tag; $this->setFields($fields); $template->setVariable($fields); // 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'])); $template->setVariable('cbo_optin_tree_id', Utils::getHtmlCombo($treelist, $fields['optin_tree_id'])); // get action type $template->setVariable('cbo_action', Utils::getHtmlCombo($this->actionList, $fields['action'], '...')); // add breadcrumb item $this->director->theme->handleAdminLinks($template); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
public function getHtml() { $default = $this->getDefault(); $mandatory = $this->getMandatory(); // create default optional value $optional = $mandatory ? '' : '...'; // check if default value is set and if it is part of the option list, if not part of optionlist, create empty value if ($default && !array_key_exists(md5($default), $this->getOptionList())) { $optional = $default; } return sprintf('<select size="1" name="%s">%s</select>', $this->getId(), Utils::getHtmlCombo($this->getOptionList(), $this->getKeyValue(), $optional)); }
private function getUserCombo($tree_id, $usr_id) { $acl = new Acl(); $aclList = $acl->getAclGroupList($tree_id); $groupList = array(); foreach ($aclList as $grp_id => $rights) { if (!in_array(Acl::VIEW, $rights)) { continue; } $groupList[] = $grp_id; } $userList = $this->director->systemUser->getList(array('grp_id' => $groupList)); return Utils::getHtmlCombo($userList['data'], $usr_id, NULL, 'id', 'formatName'); }
/** * handle tree edit */ private function handleConfigGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); $view = ViewManager::getInstance(); $view->setType(NewsLetter::VIEW_CONFIG); 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); } $template->setVariable('cbo_display', Utils::getHtmlCombo(NewsLetter::getDisplayTypeList(), $fields['display'])); $fields['tree_id'] = $tree_id; $fields['tag'] = $tag; $this->setFields($fields); $template->setVariable($fields); // add breadcrumb item $this->director->theme->handleAdminLinks($template); $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('id')) { throw new Exception('Newsletter is missing.'); } $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['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); // get theme list $themeManager = new ThemeManager(); $searchcriteria = array('active' => true); $themelist = $themeManager->getList($searchcriteria); $template->setVariable('cbo_theme', Utils::getHtmlCombo($themelist['data'], $fields['theme_id'])); $this->handleTreeSettings($template); $datefields = array(); $datefields[] = array('dateField' => 'online', 'triggerElement' => 'online'); $datefields[] = array('dateField' => 'offline', 'triggerElement' => 'offline'); 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>'); } $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle tree edit */ private function handleConfigGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); $view = ViewManager::getInstance(); $view->setType(Reservation::VIEW_CONFIG); $key = $this->getKey(); $fields = array(); if ($retrieveFields) { $key_exists = $this->exists($key); $fields = $key_exists ? $this->getDetail($key) : $this->getFields(SqlParser::MOD_INSERT); if (!$key_exists) { $settings = $this->plugin->getSettings(); $fields['schedule_times'] = $settings['schedule_times']; } } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $this->setFields($fields); $template->setVariable($fields); $template->setVariable($key); $schedule = $this->plugin->getTimes($fields['schedule_times']); $template->setVariable('schedule_times', $schedule); $template->setVariable('cbo_display', Utils::getHtmlCombo(Reservation::getDisplayTypeList(), $fields['display'])); $usergroup = $this->director->systemUser->getUserGroupObject(); $usergrouplist = $usergroup->getList(); $template->setVariable('cbo_vip_grp', Utils::getHtmlCombo($usergrouplist['data'], $fields['vip_grp_id'])); // add breadcrumb item $this->director->theme->handleAdminLinks($template); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle conf edit */ private function handleConfEditGet($retrieveFields = true) { viewManager::getInstance()->setType(ViewManager::CONF_EDIT); $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setVariable('pageTitle', $this->description); $request = Request::getInstance(); $view = ViewManager::getInstance(); $detail = $this->getDetail(array()); $fields = array(); if ($retrieveFields) { $fields = $this->exists(array()) ? $detail : $this->getFields(SqlParser::MOD_INSERT); } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $this->setFields($fields); $template->setVariable($this->getFields(SqlParser::MOD_UPDATE)); $template->setVariable('id', $detail ? $detail['id'] : ''); $template->setVariable('cbo_display', Utils::getHtmlCombo($this->getDisplayTypeList(), $fields['display'])); $template->setVariable('cbo_display_overview', Utils::getHtmlCombo($this->getDisplayOverviewList(), $fields['display_overview'])); $template->setVariable('cbo_comment_display', Utils::getHtmlCombo(GalleryComment::getDisplayTypeList(), $fields['comment_display'])); // add source code editor $theme = $this->director->theme; $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/editarea/edit_area/edit_area_full.js"></script>'); $theme->addJavascript(' editAreaLoader.init({ id: "area1", start_highlight: true, allow_toggle: true, allow_resize: true, language: "en", syntax: "php", syntax_selection_allow: "css,html,js,php", }); '); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle edit */ private function handleAdminEditGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); if (!$request->exists('id')) { throw new Exception('Gebruikersgroep ontbreekt.'); } $id = intval($request->getValue('id')); $template->setVariable('id', $id, false); if ($retrieveFields) { $this->setFields($this->getDetail(array('id' => $id))); } $fields = $this->getFields(SqlParser::MOD_UPDATE); $template->setVariable($fields, NULL, false); $template->setVariable('cbo_language', Utils::getHtmlCombo($this->getLanguageList(), $fields['language']), false); $view = ViewManager::getInstance(); $url = new Url(true); $url->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW); $template->setVariable('href_back', $url->getUrl(true), false); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle overview */ private function handleEdit($template, $usr_id) { $request = Request::getInstance(); $view = ViewManager::getInstance(); $tree_id = intval($request->getValue('tree_id')); $tag = $request->getValue('tag'); $template->setVariable('tree_id', $tree_id, false); $template->setVariable('tag', $tag, false); $user = $this->director->systemUser; $usr_used = $request->getValue('usr_used'); // get list of users that have access to the reservation module $groupList = $this->getGroupList($tree_id); $theme = $this->director->theme; $theme->addJavascript(file_get_contents($this->plugin->getHtdocsPath(true) . 'js/multibox.js')); // get list of group owners if ($view->isType(Reservation::VIEW_USER_GROUP_NEW)) { $userList = $user->getList(array('grp_id' => $groupList)); $template->setVariable('cbo_user', Utils::getHtmlCombo($userList['data'], $usr_id, 'select a user...', 'id', 'formatName')); $theme->addFileVar('reservation_htdocs_path', $this->plugin->getHtdocsPath()); // parse rpc file to set variables $rpcfile_src = $this->plugin->getHtdocsPath(true) . "js/rpc.js.in"; $theme->addJavascript($theme->fetchFile($rpcfile_src)); $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/jsxmlrpc/lib/xmlrpc_lib.js"></script>'); $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/jsxmlrpc/lib/xmlrpc_wrappers.js"></script>'); } if ($view->isType(Reservation::VIEW_USER_GROUP_EDIT) || $request->getRequestType() == Request::POST) { $grp_id = intval($request->getValue('id')); $template->setVariable('tpl_userselect', $this->getUserSelection($tree_id, $usr_id, $grp_id, $usr_used)); } // add overview link $view = ViewManager::getInstance(); $url = new Url(true); $url->clearParameter('id'); $url->setParameter('tree_id', $tree_id); $url->setParameter('tag', $tag); $url->setParameter($view->getUrlId(), Reservation::VIEW_USER_GROUP_OVERVIEW); $breadcrumb = array('name' => $view->getName(Reservation::VIEW_USER_GROUP_OVERVIEW), 'path' => $url->getUrl(true)); $this->director->theme->addBreadcrumb($breadcrumb); // create up & back links and create breadcrumb $this->director->theme->handleAdminLinks($template); }
/** * handle edit */ private function handleAdminEditGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); if (!$request->exists('id')) { throw new Exception(__FUNCTION__ . ' Node ontbreekt.'); } $id = intval($request->getValue('id')); $template->setVariable('id', $id, false); $key = array('id' => $id); // check if node exists if ($id != $this->tree->getRootId() && !$this->tree->exists($id)) { throw new HttpException('404'); } $this->tree->setCurrentId($id); $this->renderBreadcrumb(); // check if user has execute rights $auth = Authentication::getInstance(); if (!$auth->canModify($id)) { throw new HttpException('403'); } $groupSelect = array(); $fields = array(); 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']) : ''; if ($auth->isRole(SystemUser::ROLE_ADMIN)) { $acl = new Acl(); $groupSelect = $acl->getAclGroupList($id); } } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); $groupSelect = $request->getValue('acl'); } if (!is_array($groupSelect)) { $groupSelect = array(); } $template->setVariable('groupSelect', $groupSelect, false); $this->setFields($fields); $template->setVariable($fields, NULL, false); $this->handleEdit($template, $fields); $template->setVariable('cbo_parent', Utils::getHtmlCombo($this->getSafeTreeList($id), $fields['parent'])); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle conf */ private function handleConfGet($retrieveFields = true) { viewManager::getInstance()->setType(ViewManager::CONF_EDIT); $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $template->setVariable('pageTitle', $this->description); $request = Request::getInstance(); $view = ViewManager::getInstance(); $detail = $this->getDetail(array()); $fields = array(); if ($retrieveFields) { $fields = $this->exists(array()) ? $detail : $this->getFields(SqlParser::MOD_INSERT); } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $template->setVariable('cbo_display', Utils::getHtmlCombo(self::getDisplayTypeList(), $fields['display'])); $this->setFields($fields); $template->setVariable($this->getFields(SqlParser::MOD_UPDATE)); $template->setVariable('id', $detail ? $detail['id'] : ''); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle edit */ private function handleAdminEditGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); if (!$request->exists('id')) { throw new Exception('Gebruiker ontbreekt.'); } $id = intval($request->getValue('id')); $template->setVariable('id', $id, false); $key = array('id' => $id); $grp_used = $request->getValue('grp_used'); if ($retrieveFields) { $this->setFields($this->getDetail($key)); $grp_used = $this->getGroup(array('usr_id' => $id)); } $fields = $this->getFields(SqlParser::MOD_UPDATE); $template->setVariable($fields, NULL, false); $template->setVariable('cbo_role', Utils::getHtmlCombo($this->getRoleList(), $fields['role'])); $this->handleEdit($template, $grp_used); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle tree edit */ private function handleConfigGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); $view = ViewManager::getInstance(); $view->setType(News::VIEW_CONFIG); $key = $this->getKey(); $fields = array(); if ($retrieveFields) { if ($this->exists($key)) { $fields = $this->getDetail($key); } else { $fields = array_merge($this->getFields(SqlParser::MOD_INSERT), $this->plugin->getSettings()); } } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } $template->setVariable('cbo_display', Utils::getHtmlCombo(News::getDisplayTypeList(), $fields['display'])); $template->setVariable('cbo_comment_display', Utils::getHtmlCombo(NewsComment::getDisplayTypeList(), $fields['comment_display'])); $this->setFields($fields); $template->setVariable($fields); $template->setVariable($key); // add source code editor $theme = $this->director->theme; $theme->addHeader('<script type="text/javascript" src="' . DIF_VIRTUAL_WEB_ROOT . 'js/editarea/edit_area/edit_area_full.js"></script>'); $theme->addJavascript(' editAreaLoader.init({ id: "area1", start_highlight: true, allow_toggle: true, allow_resize: true, language: "en", syntax: "php", syntax_selection_allow: "css,html,js,php", }); '); // add breadcrumb item $this->director->theme->handleAdminLinks($template); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle Theme request */ private function handleMoveGet() { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); $view = ViewManager::getInstance(); $view->setType(NewsLetter::VIEW_PLUGIN_MOVE); $objTag = $this->plugin->getObject(NewsLetter::TYPE_TAG); $key = $this->getKey(); $fields = $this->getDetail($key); // plugin is linked to tag if ($fields['type'] == self::TYPE_PLUGIN) { $objPlugin = $this->director->pluginManager->getPluginFromId(array('id' => $fields['plugin_id'])); $fields['plugin_name'] = $objPlugin->getDescription(); } else { $fields['plugin_name'] = self::$types[$fields['type']]; } $template->setVariable($fields); // get all tags $key = array('nl_id' => $key['nl_id']); $taglist = array(); $alltags = $objTag->getTagList($key); foreach ($alltags as $item) { if ($item['type'] == NewsLetterTag::TYPE_PARENT || $item['id'] == $fields['nl_tag']) { continue; } $taglist[] = $item; } $template->setVariable('cbo_tag', Utils::getHtmlCombo($taglist, $request->getValue('newtag'))); $this->handleSettings($template); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * handle tree edit */ private function handleConfigGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); $view = ViewManager::getInstance(); $view->setType(Form::VIEW_CONFIG); $key = $this->getKey(); $fields = array(); if ($retrieveFields) { if ($this->exists($key)) { $fields = $this->getDetail($key); } else { $fields = array_merge($this->getFields(SqlParser::MOD_INSERT), $this->plugin->getGlobalSettings()); } } else { $fields = $this->getFields(SqlParser::MOD_UPDATE); } // 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'])); $template->setVariable('cbo_optin_tree_id', Utils::getHtmlCombo($treelist, $fields['optin_tree_id'])); // get action type $template->setVariable('cbo_action', Utils::getHtmlCombo($this->plugin->actionList, $fields['action'], '...')); $this->setFields($fields); $template->setVariable($fields); $template->setVariable($key); // add breadcrumb item $this->director->theme->handleAdminLinks($template); $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' => 'Gallery', 'plugin_type' => Gallery::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 GalleryTreeRef(); $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 />')); $template->setVariable('cbo_display_order', Utils::getHtmlCombo($this->plugin->getDisplayOrderList(), $fields['display_order'])); $template->setVariable('cbo_display', Utils::getHtmlCombo($this->getDisplayTypeList(), $fields['display'])); $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; }
/** * handle user */ private function handleUserGet($retrieveFields = true) { $view = ViewManager::getInstance(); $request = Request::getInstance(); $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); if (!$request->exists('id')) { throw new Exception('User group is missing.'); } $id = intval($request->getValue('id')); $template->setVariable('id', $id, false); $key = array('id' => $id); $tree_id = intval($request->getValue('tree_id')); $tag = $request->getValue('tag'); $user = new NewsLetterUser($this->plugin); $usr_used = $request->getValue('usr_used'); if ($retrieveFields) { $searchcriteria = array('grp_id' => $id); $tmp = $user->getList($searchcriteria); $usr_used = $tmp['data']; } $search_used = $usr_used ? array('id' => $usr_used) : NULL; $search_free = $usr_used ? array('no_id' => $usr_used, 'tree_id' => $tree_id, 'tag' => $tag) : array('tree_id' => $tree_id, 'tag' => $tag); $user_used = $usr_used ? $user->getList($search_used) : array('data' => ''); $user_free = $user->getList($search_free); $template->setVariable('cbo_usr_used', Utils::getHtmlCombo($user_used['data'], NULL, NULL, 'id', 'formatName')); $template->setVariable('cbo_usr_free', Utils::getHtmlCombo($user_free['data'], NULL, NULL, 'id', 'formatName')); $this->handleBreadcrumb($template); $template->setVariable('title', $this->getName($key), false); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
/** * 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; }