Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(Calendar::VIEW_IMAGE_OVERVIEW);
     if (!$request->exists('cal_id')) {
         throw new Exception('Calendar is missing.');
     }
     if (!$request->exists('tree_id')) {
         throw new Exception('Node is missing.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag is missing.');
     }
     $cal_id = intval($request->getValue('cal_id'));
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('cal_id' => $cal_id);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('cal_id', $cal_id);
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // add breadcrumb item
     $this->director->theme->handleAdminLinks($template);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), Calendar::VIEW_IMAGE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_import = clone $url;
     $url_import->setParameter($view->getUrlId(), Calendar::VIEW_IMAGE_IMPORT);
     $template->setVariable('href_import', $url_import->getUrl(true), false);
     $url_resize = clone $url;
     $url_resize->setParameter($view->getUrlId(), Calendar::VIEW_IMAGE_RESIZE);
     $template->setVariable('href_resize', $url_resize->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), Calendar::VIEW_IMAGE_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), Calendar::VIEW_IMAGE_DELETE);
     $list = $this->getList($key);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->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('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #3
0
 /**
  * handle breadcrumb
  */
 private function handleBreadcrumb($template)
 {
     $view = ViewManager::getInstance();
     $request = Request::getInstance();
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $template->setVariable('tree_id', $tree_id);
     $template->setVariable('tag', $tag);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter($view->getUrlId(), NewsLetter::VIEW_GROUP_OVERVIEW);
     $breadcrumb = array('name' => $view->getName(NewsLetter::VIEW_GROUP_OVERVIEW), 'path' => $url->getUrl(true));
     $this->director->theme->addBreadcrumb($breadcrumb);
     $this->director->theme->handleAdminLinks($template);
 }
Exemple #4
0
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 20;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(Calendar::VIEW_COMMENT_OVERVIEW);
     $page = $this->getPage();
     if (!$request->exists('cal_id')) {
         throw new Exception('Nieuwsbericht ontbreekt.');
     }
     if (!$request->exists('tree_id')) {
         throw new Exception('Node ontbreekt.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag ontbreekt.');
     }
     $cal_id = intval($request->getValue('cal_id'));
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('cal_id' => $cal_id);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $searchcriteria = array_merge($searchcriteria, $key);
     // add breadcrumb item
     $this->director->theme->handleAdminLinks($template);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('cal_id', $cal_id);
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), Calendar::VIEW_COMMENT_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), Calendar::VIEW_COMMENT_DELETE);
     $list = $this->getList($searchcriteria, $pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
     }
     $template->setVariable('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 20;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     $page = $this->getPage();
     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);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_import = clone $url;
     $url_import->setParameter($view->getUrlId(), Attachment::VIEW_FILE_IMPORT);
     $template->setVariable('href_import', $url_import->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::TREE_DELETE);
     // get settings
     $settings = $this->getSettings();
     $list = $this->getList($key, $pagesize, $page, $settings['display_order']);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         if ($item['file']) {
             $item['file_url'] = $this->plugin->getFileUrl($item['id']);
         }
     }
     $template->setVariable('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #6
0
 /**
  * handle overview request
  */
 private function handleOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $view->setType(self::VIEW_OVERVIEW);
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $template->setVariable('pageTitle', $this->description);
     if (!$request->exists('ext_id')) {
         throw new Exception('Extension is missing.');
     }
     $ext_id = intval($request->getValue('ext_id'));
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->setParameter('ext_id', $ext_id);
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $url = new Url(true);
     $url->clearParameter('ip');
     $url->setParameter('ext_id', $ext_id);
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), self::VIEW_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true));
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), self::VIEW_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), self::VIEW_DELETE);
     $list = $this->getList($searchcriteria, $this->pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('ip', $item['ip']);
         $url_del->setParameter('ip', $item['ip']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         if ($item['suspect']) {
             $item['state'] = 'suspect';
         } elseif (!$item['activated']) {
             $item['state'] = 'expired';
         } else {
             $item['state'] = 'intruder';
         }
     }
     $template->setVariable('list', $list);
     $template->setVariable('searchparam', $search->getMandatoryParameterList());
     $template->setVariable('searchcriteria', $searchcriteria);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 20;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     $page = $this->getPage();
     if (!$request->exists('tree_id')) {
         throw new Exception('Node is missing.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag is missing.');
     }
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('tree_id' => $tree_id, 'tag' => $tag);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $searchcriteria = array_merge($searchcriteria, $key);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->clearParameter('res_id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_conf = clone $url;
     $url_conf->setParameter($view->getUrlId(), Reservation::VIEW_CONFIG);
     $template->setVariable('href_conf', $url_conf->getUrl(true), false);
     $url_period = clone $url;
     $url_period->setParameter($view->getUrlId(), Reservation::VIEW_BLOCK_PERIOD_OVERVIEW);
     $template->setVariable('href_period', $url_period->getUrl(true), false);
     $url_usergroup = clone $url;
     $url_usergroup->setParameter($view->getUrlId(), Reservation::VIEW_USER_GROUP_OVERVIEW);
     $template->setVariable('href_usergroup', $url_usergroup->getUrl(true), false);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::TREE_DELETE);
     $list = $this->getList($searchcriteria, $pagesize, $page, self::ORDER_TIME_DESC | SqlParser::ORDER_DESC);
     foreach ($list['data'] as &$item) {
         $url_del->setParameter('id', $item['id']);
         $item['href_del'] = $url_del->getUrl(true);
     }
     $template->setVariable('list', $list, false);
     $template->setVariable('searchparam', $search->getMandatoryParameterList(), false);
     $template->setVariable('searchcriteria', $searchcriteria, 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);
 }
Exemple #9
0
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 20;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     $page = $this->getPage();
     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);
     $template->setVariable($key);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // add breadcrumb item
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_import = clone $url;
     $url_import->setParameter($view->getUrlId(), Gallery::VIEW_IMPORT);
     $template->setVariable('href_import', $url_import->getUrl(true), false);
     $url_resize = clone $url;
     $url_resize->setParameter($view->getUrlId(), Gallery::VIEW_RESIZE);
     $template->setVariable('href_resize', $url_resize->getUrl(true), false);
     $url_conf = clone $url;
     $url_conf->setParameter($view->getUrlId(), Gallery::VIEW_CONFIG);
     $template->setVariable('href_conf', $url_conf->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::TREE_DELETE);
     $url_com = clone $url;
     $url_com->setParameter($view->getUrlId(), Gallery::VIEW_COMMENT_OVERVIEW);
     $list = $this->getList($key, $pagesize, $page, null, clone $url);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $url_com->setParameter('gal_id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         $item['href_com'] = $url_com->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('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #10
0
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 10;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $record = $this->plugin->getObject(Form::TYPE_RECORD);
     $recordItem = $this->plugin->getObject(Form::TYPE_RECORD_ITEM);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     $page = $this->getPage();
     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);
     $template->setVariable($key);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // store updated pager url to record object
     $record->setPagerUrl($this->pagerUrl);
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $searchcriteria = array_merge($searchcriteria, $key);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_conf = clone $url;
     $url_conf->setParameter($view->getUrlId(), Form::VIEW_CONFIG);
     $template->setVariable('href_conf', $url_conf->getUrl(true), false);
     $url_elem = clone $url;
     $url_elem->setParameter($view->getUrlId(), Form::VIEW_ELEMENT_OVERVIEW);
     $template->setVariable('href_elem', $url_elem->getUrl(true), false);
     $url_del_all = clone $url;
     $url_del_all->setParameter($view->getUrlId(), Form::VIEW_RECORD_DEL_ALL);
     $template->setVariable('href_del_all', $url_del_all->getUrl(true), false);
     $url_export = clone $url;
     $url_export->setParameter($view->getUrlId(), Form::VIEW_RECORD_EXPORT);
     $template->setVariable('href_export', $url_export->getUrl(true), false);
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     // get columns and create template column list because not every record may have all the columns.
     $recordTemplate = array();
     $columns = $recordItem->getColumns($tree_id, $tag);
     $columns[] = 'timestamp';
     $columns[] = 'host';
     foreach ($columns as $column) {
         $recordTemplate[$column] = '';
     }
     $template->setVariable('columns', $columns);
     $themeVars = $this->director->theme->getFileVars();
     $img_edit = $themeVars['img_edit'];
     $editString = '<a href="%s">' . sprintf('<img class="noborder" src="%s" width="%s" height="%s" alt="edit" title="edit" /></a>', $img_edit['src'], $img_edit['width'], $img_edit['height']);
     $delString = '<input type="checkbox" name="id[]" value="%d" class="noborder" />';
     // retrieve all records within this tree node
     // array[record id] => timestamp
     $searchcriteria = array_merge($searchcriteria, $key);
     $searchcriteria['optin'] = '';
     $recordlist = array();
     $records = $record->getList($searchcriteria, $pagesize, $page);
     foreach ($records['data'] as $item) {
         $recordlist[$item['id']] = $item;
     }
     $template->setVariable('records', $records);
     $recordItemListFinal = array();
     if ($recordlist) {
         // search for all form elements within the specified records
         $elemsearch = array('rcd_id' => array_keys($recordlist));
         $recordItemList = $recordItem->getItems($elemsearch);
         foreach ($recordItemList as $rcd_id => $recordElement) {
             // set values to all the columns
             $element = $recordTemplate;
             foreach ($recordElement as $recordColumn) {
                 // columnames are forced to lowercase, do the same for this result to merge case sensitive versions of columns
                 $element[strtolower($recordColumn['name'])] = $recordColumn['value'];
             }
             $element['timestamp'] = strftime('%c', $recordlist[$rcd_id]['createdate']);
             $element['host'] = $recordlist[$rcd_id]['host'];
             $url_edit->setParameter('rcd_id', $rcd_id);
             $urls = array();
             $urls[] = sprintf($delString, $rcd_id);
             $urls[] = sprintf($editString, $url_edit->getUrl(true));
             array_unshift($element, join('', $urls));
             $recordItemListFinal[] = $element;
         }
     }
     $template->setVariable('list', $recordItemListFinal);
     $template->setVariable('searchparam', $search->getMandatoryParameterList(), false);
     $template->setVariable('searchcriteria', $searchcriteria, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
 /**
  * handle overview
  */
 private function handleEdit($template)
 {
     $request = Request::getInstance();
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $template->setVariable('tree_id', $tree_id, false);
     $template->setVariable('tag', $tag, false);
     // 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_BLOCK_PERIOD_OVERVIEW);
     $breadcrumb = array('name' => $view->getName(Reservation::VIEW_BLOCK_PERIOD_OVERVIEW), 'path' => $url->getUrl(true));
     $this->director->theme->addBreadcrumb($breadcrumb);
     // create up & back links and create breadcrumb
     $this->director->theme->handleAdminLinks($template);
     $datefields = array();
     $datefields[] = array('dateField' => 'date_start', 'triggerElement' => 'date_start');
     $datefields[] = array('dateField' => 'date_stop', 'triggerElement' => 'date_stop');
     Utils::getDatePicker($this->director->theme, $datefields);
 }
Exemple #12
0
 /**
  * handle overview
  */
 private function handleEdit($template, $grp_used)
 {
     $request = Request::getInstance();
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $template->setVariable('tree_id', $tree_id, false);
     $template->setVariable('tag', $tag, false);
     // 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(), NewsLetter::VIEW_USER_OVERVIEW);
     $breadcrumb = array('name' => $view->getName(NewsLetter::VIEW_USER_OVERVIEW), 'path' => $url->getUrl(true));
     $this->director->theme->addBreadcrumb($breadcrumb);
     // create up & back links and create breadcrumb
     $this->director->theme->handleAdminLinks($template);
     // create user groups comboboxes
     $userGroup = new NewsLetterGroup($this->plugin);
     $search_used = $grp_used ? array('id' => $grp_used) : NULL;
     $search_free = $grp_used ? array('no_id' => $grp_used, 'tree_id' => $tree_id, 'tag' => $tag) : array('tree_id' => $tree_id, 'tag' => $tag);
     $group_used = $grp_used ? $userGroup->getList($search_used) : array('data' => '');
     $group_free = $userGroup->getList($search_free);
     $template->setVariable('cbo_grp_used', Utils::getHtmlCombo($group_used['data']), false);
     $template->setVariable('cbo_grp_free', Utils::getHtmlCombo($group_free['data']), false);
 }
Exemple #13
0
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 20;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     $page = $this->getPage();
     if (!$request->exists('tree_id')) {
         throw new Exception('Node is missing.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag is missing.');
     }
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('tree_id' => $tree_id, 'tag' => $tag);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $searchcriteria = array_merge($searchcriteria, $key);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->clearParameter('nl_id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_conf = clone $url;
     $url_conf->setParameter($view->getUrlId(), NewsLetter::VIEW_CONFIG);
     $template->setVariable('href_conf', $url_conf->getUrl(true), false);
     $url_user = clone $url;
     $url_user->setParameter($view->getUrlId(), NewsLetter::VIEW_USER_OVERVIEW);
     $template->setVariable('href_user', $url_user->getUrl(true), false);
     $url_group = clone $url;
     $url_group->setParameter($view->getUrlId(), NewsLetter::VIEW_GROUP_OVERVIEW);
     $template->setVariable('href_group', $url_group->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::TREE_DELETE);
     $url_att = clone $url;
     $url_att->setParameter($view->getUrlId(), NewsLetter::VIEW_FILE_OVERVIEW);
     $url_preview = clone $url;
     $url_preview->setParameter($view->getUrlId(), NewsLetter::VIEW_PREVIEW);
     $url_send = clone $url;
     $url_send->setParameter($view->getUrlId(), NewsLetter::VIEW_SEND);
     $url_plugin = clone $url;
     $url_plugin->setParameter($view->getUrlId(), NewsLetter::VIEW_PLUGIN_OVERVIEW);
     $list = $this->getList($searchcriteria, $pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $url_att->setParameter('nl_id', $item['id']);
         $url_plugin->setParameter('nl_id', $item['id']);
         $url_preview->setParameter('nl_id', $item['id']);
         $url_send->setParameter('nl_id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         $item['href_att'] = $url_att->getUrl(true);
         $item['href_plugin'] = $url_plugin->getUrl(true);
         $item['href_preview'] = $url_preview->getUrl(true);
         $item['href_send'] = $url_send->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('list', $list, false);
     $template->setVariable('searchparam', $search->getMandatoryParameterList(), false);
     $template->setVariable('searchcriteria', $searchcriteria, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #14
0
 /**
  * handle tree overview
  */
 private function handleTreeOverviewGet($retrieveFields = true)
 {
     $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);
     // add breadcrumb item
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), Form::VIEW_ELEMENT_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true));
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), Form::VIEW_ELEMENT_EDIT);
     $url_mv_prev = clone $url;
     $url_mv_prev->setParameter($view->getUrlId(), Form::VIEW_MV_PREC);
     $url_mv_next = clone $url;
     $url_mv_next->setParameter($view->getUrlId(), Form::VIEW_MV_FOL);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), Form::VIEW_ELEMENT_DELETE);
     $list = $this->getList($key, 0, 1, SqlParser::ORDER_ASC);
     $counter = 0;
     $maxcount = $list['totalItems'];
     foreach ($list['data'] as &$item) {
         $counter++;
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $url_mv_prev->setParameter('id', $item['id']);
         $url_mv_next->setParameter('id', $item['id']);
         $item['type_id'] = $this->getTypeId($item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         if ($counter > 1) {
             $item['href_mv_prev'] = $url_mv_prev->getUrl(true);
         }
         if ($counter < $maxcount) {
             $item['href_mv_next'] = $url_mv_next->getUrl(true);
         }
     }
     $template->setVariable('list', $list);
     //$this->handleTreeSettings($template);
     $this->director->theme->handleAdminLinks($template);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #15
0
 /**
  * handle element overview
  */
 private function handleElementOverview($template)
 {
     $reference = $this->getObject(self::TYPE_ELEMENT);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     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);
     // add breadcrumb item
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true));
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::TREE_DELETE);
     $list = $reference->getList($key);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['type_id'] = $reference->getTypeId($item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
     }
     $template->setVariable('list', $list);
     return $template;
 }
Exemple #16
0
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 20;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     $page = $this->getPage();
     if (!$request->exists('tree_id')) {
         throw new Exception('Node is missing.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag is missing.');
     }
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('tree_id' => $tree_id, 'tag' => $tag);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $searchcriteria = array_merge($searchcriteria, $key);
     // add breadcrumb item
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_conf = clone $url;
     $url_conf->setParameter($view->getUrlId(), Links::VIEW_CONFIG);
     $template->setVariable('href_conf', $url_conf->getUrl(true), false);
     $url_import = clone $url;
     $url_import->setParameter($view->getUrlId(), Links::VIEW_IMPORT);
     $template->setVariable('href_import', $url_import->getUrl(true), false);
     $url_resize = clone $url;
     $url_resize->setParameter($view->getUrlId(), Links::VIEW_RESIZE);
     $template->setVariable('href_resize', $url_resize->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $url_mv_prev = clone $url;
     $url_mv_prev->setParameter($view->getUrlId(), Links::VIEW_MV_PREC);
     $url_mv_next = clone $url;
     $url_mv_next->setParameter($view->getUrlId(), Links::VIEW_MV_FOL);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::TREE_DELETE);
     $counter = 0;
     $list = $this->getList($searchcriteria, $pagesize, $page);
     $maxcount = $list['totalItems'];
     foreach ($list['data'] as &$item) {
         $counter++;
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $url_mv_prev->setParameter('id', $item['id']);
         $url_mv_next->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         if ($counter > 1) {
             $item['href_mv_prev'] = $url_mv_prev->getUrl(true);
         }
         if ($counter < $maxcount) {
             $item['href_mv_next'] = $url_mv_next->getUrl(true);
         }
         if ($item['url']) {
             $item['link'] = $item['url'];
         } elseif ($item['ref_tree_id']) {
             $item['link'] = $this->director->tree->getPath($item['ref_tree_id']);
         } else {
             $item['link'] = "link detailed page";
         }
         if ($item['thumbnail']) {
             $img = new Image($item['thumbnail'], $this->getContentPath(true));
             $item['thumbnail'] = array('src' => $this->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
         }
     }
     $template->setVariable('list', $list, false);
     $template->setVariable('searchparam', $search->getMandatoryParameterList(), false);
     $template->setVariable('searchcriteria', $searchcriteria, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #17
0
 /**
  * handle admin overview request
  */
 private function handleAdminOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // check if there are sites. If not, redirect to new site script
     if (!$this->exists(NULL)) {
         $view->setType(ViewManager::ADMIN_NEW);
         $this->handleHttpGetRequest();
     }
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $url = new Url(true);
     $url->clearParameter('id');
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::ADMIN_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::ADMIN_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::ADMIN_DELETE);
     $searchcriteria = array();
     $list = $this->getList(NULL, $this->pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         $item['language_name'] = $this->getLanguageDesc($item['language']);
     }
     $template->setVariable('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #18
0
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $pagesize = 20;
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     // different order (oldest at the bottom)
     $this->orderStatement = array('order by a.cal_start desc, a.cal_start_time desc');
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(ViewManager::TREE_OVERVIEW);
     $page = $this->getPage();
     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);
     $template->setVariable($key);
     $this->pagerUrl->addParameters($key);
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $searchcriteria = array_merge($searchcriteria, $key);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->clearParameter('cal_id');
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::TREE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_conf = clone $url;
     $url_conf->setParameter($view->getUrlId(), Calendar::VIEW_CONFIG);
     $template->setVariable('href_conf', $url_conf->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::TREE_DELETE);
     $url_att = clone $url;
     $url_att->setParameter($view->getUrlId(), Calendar::VIEW_FILE_OVERVIEW);
     $url_com = clone $url;
     $url_com->setParameter($view->getUrlId(), Calendar::VIEW_COMMENT_OVERVIEW);
     $url_img = clone $url;
     $url_img->setParameter($view->getUrlId(), Calendar::VIEW_IMAGE_OVERVIEW);
     $list = $this->getList($searchcriteria, $pagesize, $page, SqlParser::ORDER_ASC);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $url_att->setParameter('cal_id', $item['id']);
         $url_com->setParameter('cal_id', $item['id']);
         $url_img->setParameter('cal_id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         $item['href_att'] = $url_att->getUrl(true);
         $item['href_com'] = $url_com->getUrl(true);
         $item['href_img'] = $url_img->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('list', $list, false);
     $template->setVariable('searchparam', $search->getMandatoryParameterList(), false);
     $template->setVariable('searchcriteria', $searchcriteria, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #19
0
 /**
  * handle admin overview request
  */
 public function handleAdminOverview($id = NULL)
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     if (!isset($id)) {
         if ($request->exists('tree_id')) {
             $id = $request->getValue('tree_id');
         } elseif ($request->exists('id')) {
             $id = $request->getValue('id');
         } else {
             $id = $this->tree->getRootId();
         }
     }
     $this->setMenuId($id);
     $tree_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();
     $authentication = Authentication::getInstance();
     $acl = new Acl();
     $isAdmin = $authentication->isRole(SystemUser::ROLE_ADMIN);
     $canCreate = $authentication->canCreate($id);
     $canModify = $authentication->canModify($id);
     $canDelete = $authentication->canDelete($id);
     // add link to sitegroup to add / modify / delete websites
     $adminTree = $this->director->adminManager->tree;
     $pluginAdminId = $adminTree->getIdFromClassname('PluginHandler');
     $canEditPluginAdmin = $adminTree->exists($pluginAdminId);
     $themeAdminId = $adminTree->getIdFromClassname('ThemeHandler');
     $canEditThemeAdmin = $adminTree->exists($themeAdminId);
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->clearParameter('tree_id');
     $url->clearParameter('tag');
     $detail = $this->getDetail(array('id' => $id));
     $template->setVariable($detail, NULL, false);
     $template->setVariable('isAdmin', $isAdmin, false);
     if ($isAdmin) {
         $aclList = $acl->getList(array('tree_id' => $id));
         if ($aclList['data']) {
             $template->setVariable('acl', $aclList, false);
         }
     }
     $parent_id = $this->tree->getParentId($id);
     $root_id = $this->tree->getRootId();
     // root node is only usefull to create main nodes
     $rootnode = $id == $root_id;
     if ($rootnode) {
         $template->setVariable('root', true, false);
         if ($isAdmin) {
             $url_acl = clone $url;
             $url_acl->setParameter($view->getUrlId(), self::VIEW_ROOT_ACL);
             $url_acl->setParameter('id', $id);
             $template->setVariable('href_acl', $url_acl->getUrl(true), false);
         }
     }
     // only if create rights on parent
     if ($authentication->canCreate($parent_id)) {
         // add link to create a child page if location is root, or sibling page if not root
         $url_new = clone $url;
         $url_new->setParameter($view->getUrlId(), ViewManager::ADMIN_NEW);
         $url_new->setParameter('parent', $parent_id);
         $url_new->setParameter('weight', $detail['weight'] + 10);
         $template->setVariable('href_new', $url_new->getUrl(true), false);
     }
     if ($canCreate) {
         // add link to create child page
         $url_sub_new = clone $url;
         $url_sub_new->setParameter($view->getUrlId(), ViewManager::ADMIN_NEW);
         $url_sub_new->setParameter('parent', $id);
         $template->setVariable('href_sub_new', $url_sub_new->getUrl(true), false);
     }
     if (!$rootnode && $canDelete) {
         $url_del = clone $url;
         $url_del->setParameter($view->getUrlId(), ViewManager::ADMIN_DELETE);
         $url_del->setParameter('id', $id);
         $template->setVariable('href_del', $url_del->getUrl(true), false);
     }
     if (!$rootnode && $canModify) {
         $url_edit = clone $url;
         $url_edit->setParameter($view->getUrlId(), ViewManager::ADMIN_EDIT);
         $url_edit->setParameter('id', $id);
         $template->setVariable('href_edit', $url_edit->getUrl(true), false);
         $url_mv_prev = clone $url;
         $url_mv_prev->setParameter($view->getUrlId(), self::VIEW_MV_PREC);
         $url_mv_prev->setParameter('id', $id);
         $template->setVariable('href_mv_prev', $url_mv_prev->getUrl(true), false);
         $url_mv_next = clone $url;
         $url_mv_next->setParameter($view->getUrlId(), self::VIEW_MV_FOL);
         $url_mv_next->setParameter('id', $id);
         $template->setVariable('href_mv_next', $url_mv_next->getUrl(true), false);
         if ($parent_id != $root_id) {
             $url_mv_up = clone $url;
             $url_mv_up->setParameter($view->getUrlId(), self::VIEW_MV_UP);
             $url_mv_up->setParameter('id', $id);
             $template->setVariable('href_mv_up', $url_mv_up->getUrl(true), false);
         }
         if ($this->tree->getFollowingSiblingId($id) != $root_id) {
             $url_mv_down = clone $url;
             $url_mv_down->setParameter($view->getUrlId(), self::VIEW_MV_DOWN);
             $url_mv_down->setParameter('id', $id);
             $template->setVariable('href_mv_down', $url_mv_down->getUrl(true), false);
         }
     }
     $url_up = clone $url;
     $url_up->setParameter('id', $parent_id);
     $template->setVariable('href_up', $url_up->getUrl(true), false);
     $url_preview = new Url();
     $url_preview->setPath($this->tree->getPath($id));
     $template->setVariable('href_preview', $url_preview->getUrl(true), false);
     // check if page is link to external page. if so: cut the crap
     if (!$rootnode && $detail['external']) {
         $this->template[$this->director->theme->getConfig()->main_tag] = $template;
         return;
     }
     // retrieve selected theme
     $themeSearch = array('tree_id' => $id);
     $theme = $this->getTheme($themeSearch);
     if ($canModify) {
         $url_theme = clone $url;
         $url_theme->setParameter($view->getUrlId(), self::VIEW_THEME);
         $url_theme->setParameter('tree_id', $id);
         $template->setVariable('href_theme', $url_theme->getUrl(true), false);
     }
     if (!$theme || !$theme['activated']) {
         // no default theme or user defined theme found, create link to themes module to select 1 as default
         if ($theme && !$theme['activated'] && $canModify) {
             $url_theme_admin = new Url();
             $url_theme_admin->setPath($adminTree->getPath($themeAdminId));
             $url_theme_admin->setParameter($view->getUrlId(), 5);
             $url_theme_admin->setParameter('id', $theme['theme_id']);
             $theme['name'] .= ' (incompatible version)';
             $template->setVariable('href_theme_admin', $url_theme_admin->getUrl(true));
             $template->setVariable('theme_name', $theme['name']);
         } else {
             $template->setVariable('theme_name', 'no theme specified', false);
         }
     } elseif ($authentication->canEdit($id) && (!$rootnode || $isAdmin)) {
         // if user can not edit the page, he is only authorized to view the menu item (to get to another node he can edit)
         // default theme or user defined theme found, create edit link
         $template->setVariable('theme_name', $theme['name']);
         $template->setVariable('theme', $theme);
         // create default urls
         $url_plugin_admin = new Url();
         $url_plugin_admin->setPath($adminTree->getPath($pluginAdminId));
         $url_plugin_admin->setParameter($view->getUrlId(), 5);
         // create default urls
         $url_plugin = clone $url;
         $url_plugin->setParameter('tree_id', $id);
         $url_conf = clone $url_plugin;
         $url_conf->setParameter($view->getUrlId(), self::VIEW_PLUGIN_CONF);
         $url_move = clone $url_plugin;
         $url_move->setParameter($view->getUrlId(), self::VIEW_PLUGIN_MOVE);
         $url_edit = clone $url_plugin;
         $url_edit->setParameter($view->getUrlId(), ViewManager::TREE_OVERVIEW);
         $url_del = clone $url_plugin;
         $url_del->setParameter($view->getUrlId(), self::VIEW_PLUGIN_DEL);
         $url_data_source = clone $url;
         $url_data_source->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW);
         // get theme tag list and user defined tag list
         $searchcriteria = array('tree_id' => $id);
         $taglist = $this->getTagList($searchcriteria);
         // retrieve linked used tag list with the related plugins
         $sitePlugin = $this->getSitePlugin();
         $pluginList = $sitePlugin->getTagList($searchcriteria);
         // store virtual tags in separate list
         $virtualTaglist = array();
         // process active tags
         foreach ($taglist as $key => &$item) {
             $url_conf->setParameter('tag', $item['id']);
             $url_move->setParameter('tag', $item['id']);
             $url_edit->setParameter('tag', $item['id']);
             $url_del->setParameter('tag', $item['id']);
             $pluginExists = array_key_exists($item['id'], $pluginList);
             $item['has_plugin'] = $pluginExists;
             if ($canModify && !$pluginExists) {
                 $item['href_conf'] = $url_conf->getUrl(true);
             }
             // default settings
             $item['plugin_name'] = '';
             $item['plugin_type'] = '';
             $item['virtual_type'] = SystemSitePlugin::TYPE_NORMAL;
             if ($pluginExists) {
                 $thisplugin = $pluginList[$item['id']];
                 // copy settings from plugin to tag item
                 $item['virtual_type'] = $thisplugin['virtual_type'];
                 $item['plugin_name'] = $thisplugin['plugin_name'];
                 $item['activated'] = $thisplugin['activated'];
                 if ($canEditPluginAdmin) {
                     $url_plugin_admin->setParameter('id', $thisplugin['plugin_id']);
                     $item['href_plugin_admin'] = $url_plugin_admin->getUrl(true);
                 }
                 // plugin is active
                 if ($item['activated']) {
                     $objPlugin = $this->director->pluginManager->getPlugin($thisplugin['classname']);
                     $item['plugin_type'] = $objPlugin->getTypeDesc($thisplugin['plugin_type']);
                     switch ($item['virtual_type']) {
                         case SystemSitePlugin::TYPE_VIRTUAL:
                             $item['href_conf'] = $url_conf->getUrl(true);
                             $item['href_new'] = $url_edit->getUrl(true);
                             break;
                         case SystemSitePlugin::TYPE_VIRTUAL_OVERRIDE_SETTINGS:
                             $item['href_conf'] = $url_conf->getUrl(true);
                             $item['href_new'] = $url_edit->getUrl(true);
                             $item['href_del'] = $url_del->getUrl(true);
                             break;
                         case SystemSitePlugin::TYPE_VIRTUAL_OVERRIDE:
                         case SystemSitePlugin::TYPE_NORMAL:
                             $item['href_edit'] = $url_edit->getUrl(true);
                             $item['href_del'] = $url_del->getUrl(true);
                             $item['href_move'] = $url_move->getUrl(true);
                     }
                 } else {
                     $item['plugin_type'] = '<em class="error">incompatible version</em>';
                 }
                 // provide additional info for virtual tags and add item to virtual taglist
                 if ($canModify && !$rootnode && $item['virtual_type'] != SystemSitePlugin::TYPE_NORMAL) {
                     // last tree id is where the plugin has modified tree settings, not necessarily the tree id where the plugin itself was modified
                     $item['data_source'] = substr($this->tree->getTreeName() . $this->tree->getPath($thisplugin['last_tree_id'], " &raquo; "), 0, 0 - strlen("&raquo; "));
                     $url_data_source->setParameter('id', $thisplugin['last_tree_id']);
                     $item['url_data_source'] = $url_data_source->getUrl(true);
                     $virtualTaglist[] = $item;
                 }
                 // clear existing plugin from list
                 unset($pluginList[$item['id']]);
             }
         }
         $template->setVariable('taglist', $taglist);
         $template->setVariable('virtualTaglist', $virtualTaglist);
         // process inactive tags
         $hiddenPlugin = array();
         if ($canModify) {
             foreach ($pluginList as $tag => $pluginItem) {
                 // skip missing virtual plugins
                 if ($pluginItem['virtual_type'] == SystemSitePlugin::TYPE_VIRTUAL) {
                     continue;
                 }
                 $url_move->setParameter('tag', $tag);
                 $url_edit->setParameter('tag', $tag);
                 $url_del->setParameter('tag', $tag);
                 $url_plugin_admin->setParameter('id', $pluginItem['plugin_id']);
                 if ($canEditPluginAdmin) {
                     $pluginItem['href_plugin_admin'] = $url_plugin_admin->getUrl(true);
                 }
                 // plugin is linked to tag
                 if ($pluginItem['activated']) {
                     $objPlugin = $this->director->pluginManager->getPlugin($pluginItem['classname']);
                     $pluginItem['plugin_type'] = $objPlugin->getTypeDesc($pluginItem['plugin_type']);
                     $pluginItem['href_edit'] = $url_edit->getUrl(true);
                     $pluginItem['href_move'] = $url_move->getUrl(true);
                     $pluginItem['href_del'] = $url_del->getUrl(true);
                 } else {
                     $pluginItem['plugin_type'] = '<em class="error">incompatible version</em>';
                 }
                 $pluginItem['name'] = $tag;
                 $hiddenPlugin[] = $pluginItem;
             }
         }
         $template->setVariable('hiddentaglist', $hiddenPlugin);
     }
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #20
0
 /**
  * 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;
 }
Exemple #21
0
 /**
  * handle admin overview request
  */
 private function handleAdminOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $url = new Url(true);
     $url->clearParameter('id');
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::ADMIN_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_import = clone $url;
     $url_import->setParameter($view->getUrlId(), self::VIEW_IMPORT);
     $template->setVariable('href_import', $url_import->getUrl(true), false);
     $url_export = clone $url;
     $url_export->setParameter($view->getUrlId(), self::VIEW_EXPORT);
     $template->setVariable('href_export', $url_export->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::ADMIN_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::ADMIN_DELETE);
     // handle searchcriteria
     $search = new SearchManager();
     $search->setUrl($this->pagerUrl);
     $search->setExclude($this->pagerKey);
     $search->setParameter('search');
     $search->saveList();
     $searchcriteria = $search->getSearchParameterList();
     $list = $this->getList($searchcriteria, $this->pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
     }
     $template->setVariable('list', $list, false);
     $template->setVariable('searchparam', $search->getMandatoryParameterList(), false);
     $template->setVariable('searchcriteria', $searchcriteria, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
 /**
  * handle tree overview
  */
 private function handleTreeOverview()
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(NewsLetter::VIEW_FILE_OVERVIEW);
     if (!$request->exists('nl_id')) {
         throw new Exception('Newsletter is missing.');
     }
     if (!$request->exists('tree_id')) {
         throw new Exception('Node ontbreekt.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag ontbreekt.');
     }
     $nl_id = intval($request->getValue('nl_id'));
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('nl_id' => $nl_id);
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('nl_id', $nl_id);
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // add breadcrumb item
     $this->director->theme->handleAdminLinks($template);
     // create urls
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), NewsLetter::VIEW_FILE_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_import = clone $url;
     $url_import->setParameter($view->getUrlId(), NewsLetter::VIEW_FILE_IMPORT);
     $template->setVariable('href_import', $url_import->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), NewsLetter::VIEW_FILE_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), NewsLetter::VIEW_FILE_DELETE);
     $list = $this->getList($key);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         if ($item['file']) {
             $item['file_url'] = $this->plugin->getFileUrl($item['id']);
         }
     }
     $template->setVariable('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #23
0
 /**
  * handle  overview
  */
 private function handleOverview()
 {
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $view->setType(NewsLetter::VIEW_PLUGIN_OVERVIEW);
     if (!$request->exists('nl_id')) {
         throw new Exception('Newsletter is missing.');
     }
     if (!$request->exists('tree_id')) {
         throw new Exception('Node is missing.');
     }
     if (!$request->exists('tag')) {
         throw new Exception('Tag is missing.');
     }
     $nl_id = intval($request->getValue('nl_id'));
     $tree_id = intval($request->getValue('tree_id'));
     $tag = $request->getValue('tag');
     $key = array('nl_id' => $nl_id);
     //$objOverview = $this->plugin->getObject(NewsLetter::TYPE_DEFAULT);
     //$detail = $objOverview->getDetail($key);
     //$theme = $this->director->themeManager->getThemeFromId(array('id' => $detail['theme_id']));
     //if(!$theme) throw new Exception("Theme does not exists. Select theme in Config section first.");
     //$template->setVariable('theme',  $theme->getDescription());
     $url = new Url(true);
     $url->clearParameter('id');
     $url->setParameter('nl_id', $nl_id);
     $url->setParameter('tree_id', $tree_id);
     $url->setParameter('tag', $tag);
     // create urls
     $url_config = clone $url;
     $url_config->setParameter('id', $nl_id);
     $url_config->setParameter($view->getUrlId(), ViewManager::TREE_EDIT);
     $template->setVariable('href_config', $url_config->getUrl(true));
     $url_att = clone $url;
     $url_att->setParameter($view->getUrlId(), NewsLetter::VIEW_FILE_OVERVIEW);
     $template->setVariable('href_att', $url_att->getUrl(true));
     $url_preview = clone $url;
     $url_preview->setParameter($view->getUrlId(), NewsLetter::VIEW_PREVIEW);
     $template->setVariable('href_preview', $url_preview->getUrl(true));
     $url_send = clone $url;
     $url_send->setParameter($view->getUrlId(), NewsLetter::VIEW_SEND);
     $template->setVariable('href_send', $url_send->getUrl(true));
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), NewsLetter::VIEW_PLUGIN_EDIT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), NewsLetter::VIEW_PLUGIN_DELETE);
     $url_conf = clone $url;
     $url_conf->setParameter($view->getUrlId(), NewsLetter::VIEW_PLUGIN_CONFIG);
     $url_move = clone $url;
     $url_move->setParameter($view->getUrlId(), NewsLetter::VIEW_PLUGIN_MOVE);
     $url_tag_edit = clone $url;
     $url_tag_edit->setParameter($view->getUrlId(), NewsLetter::VIEW_TAG_EDIT);
     $url_tag_del = clone $url;
     $url_tag_del->setParameter($view->getUrlId(), NewsLetter::VIEW_TAG_DELETE);
     // get theme tag list and user defined tag list
     $newsLetterTag = $this->plugin->getObject(NewsLetter::TYPE_TAG);
     $alltags = $newsLetterTag->getTagList($key);
     $taglist = array();
     $splitTaglist = array();
     // retrieve linked used tag list with the related plugins
     $list = $this->getList($key);
     $pluginlist = array();
     foreach ($list['data'] as $item) {
         $pluginlist[$item['nl_tag']] = $item;
     }
     // process active tags
     foreach ($alltags as $key => $item) {
         $url_conf->setParameter('nl_tag', $item['id']);
         $url_move->setParameter('nl_tag', $item['id']);
         $url_edit->setParameter('nl_tag', $item['id']);
         $url_del->setParameter('nl_tag', $item['id']);
         $url_tag_edit->setParameter('parent_tag', $item['id']);
         $url_tag_del->setParameter('parent_tag', $item['id']);
         $pluginExists = array_key_exists($item['id'], $pluginlist);
         if ($pluginExists) {
             // plugin is linked to tag
             if ($pluginlist[$item['id']]['type'] == self::TYPE_PLUGIN) {
                 $objPlugin = $this->director->pluginManager->getPluginFromId(array('id' => $pluginlist[$item['id']]['plugin_id']));
                 $item['plugin_name'] = $objPlugin->getDescription();
             } else {
                 $item['plugin_name'] = self::$types[$pluginlist[$item['id']]['type']];
             }
             $item['href_del'] = $url_del->getUrl(true);
             $item['href_edit'] = $url_edit->getUrl(true);
             $item['href_move'] = $url_move->getUrl(true);
             // clear existing plugin from list
             unset($pluginlist[$item['id']]);
         } else {
             $item['href_conf'] = $url_conf->getUrl(true);
             $item['plugin_name'] = '';
         }
         // handle split tags. Move parent tags to different list
         $item['href_tag'] = $url_tag_edit->getUrl(true);
         $item['href_tag_del'] = $url_tag_del->getUrl(true);
         if ($item['type'] == NewsLetterTag::TYPE_PARENT) {
             $splitTaglist[] = $item;
         } else {
             $taglist[] = $item;
         }
     }
     $template->setVariable('taglist', $taglist);
     $template->setVariable('splitTaglist', $splitTaglist);
     // process inactive tags
     foreach ($pluginlist as $tag => &$pluginItem) {
         $url_move->setParameter('nl_tag', $tag);
         $url_edit->setParameter('nl_tag', $tag);
         $url_del->setParameter('nl_tag', $tag);
         if ($pluginlist[$item['id']]['type'] == self::TYPE_PLUGIN) {
             // plugin is linked to tag
             $objPlugin = $this->director->pluginManager->getPluginFromId(array('id' => $pluginItem['plugin_id']));
             $pluginItem['plugin_name'] = $objPlugin->getDescription();
         } else {
             $pluginItem['plugin_name'] = self::$types[$pluginItem['type']];
         }
         $pluginItem['name'] = $tag;
         $pluginItem['href_move'] = $url_move->getUrl(true);
         $pluginItem['href_edit'] = $url_edit->getUrl(true);
         $pluginItem['href_del'] = $url_del->getUrl(true);
     }
     $template->setVariable('hiddentaglist', $pluginlist);
     // add breadcrumb item
     $objOverview = $this->plugin->getObject(NewsLetter::TYPE_DEFAULT);
     $this->director->theme->handleAdminLinks($template, $objOverview->getName($key));
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #24
0
 /**
  * handle admin overview request
  */
 private function handleAdminOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $url = new Url(true);
     $url->clearParameter('id');
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::ADMIN_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_update = clone $url;
     $url_update->setParameter($view->getUrlId(), self::VIEW_UPDATE);
     $template->setVariable('href_update', $url_update->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::ADMIN_EDIT);
     $url_extension = clone $url;
     $url_extension->setParameter($view->getUrlId(), self::VIEW_EXT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::ADMIN_DELETE);
     $searchcriteria = array();
     $list = $this->getList(NULL, $this->pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_extension->setParameter('ext_id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_extension'] = $url_extension->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
     }
     $template->setVariable('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #25
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('Poll 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);
     }
     $this->setFields($fields);
     $template->setVariable($fields, NULL, false);
     $url_item = new Url(true);
     $url_item->clearParameter('id');
     $url_item->setParameter('poll_id', $id);
     $url_item->setParameter($view->getUrlId(), Poll::VIEW_ITEM_OVERVIEW);
     $template->setVariable('href_item', $url_item->getUrl(true), 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;
 }
Exemple #26
0
 /**
  * handle admin overview request
  */
 private function handleAdminOverview()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $page = $this->getPage();
     $this->pagerUrl->setParameter($view->getUrlId(), $view->getType());
     $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
     $url = new Url(true);
     $url->clearParameter('id');
     $url_new = clone $url;
     $url_new->setParameter($view->getUrlId(), ViewManager::ADMIN_NEW);
     $template->setVariable('href_new', $url_new->getUrl(true), false);
     $url_update = clone $url;
     $url_update->setParameter($view->getUrlId(), self::VIEW_UPDATE);
     $template->setVariable('href_update', $url_update->getUrl(true), false);
     $url_edit = clone $url;
     $url_edit->setParameter($view->getUrlId(), ViewManager::ADMIN_EDIT);
     $url_config = clone $url;
     $url_config->setParameter($view->getUrlId(), self::VIEW_CONFIG);
     $url_export = clone $url;
     $url_export->setParameter($view->getUrlId(), self::VIEW_EXPORT);
     $url_del = clone $url;
     $url_del->setParameter($view->getUrlId(), ViewManager::ADMIN_DELETE);
     $searchcriteria = array();
     $list = $this->getList(NULL, $this->pagesize, $page);
     foreach ($list['data'] as &$item) {
         $url_edit->setParameter('id', $item['id']);
         $url_config->setParameter('id', $item['id']);
         $url_export->setParameter('id', $item['id']);
         $url_del->setParameter('id', $item['id']);
         $item['href_edit'] = $url_edit->getUrl(true);
         $item['href_config'] = $url_config->getUrl(true);
         $item['href_export'] = $url_export->getUrl(true);
         $item['href_del'] = $url_del->getUrl(true);
         if ($item['image']) {
             try {
                 $img = new Image($item['image'], $this->getContentPath(true));
                 $item['image'] = array('src' => $this->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
             } catch (Exception $err) {
             }
         }
     }
     $template->setVariable('list', $list, false);
     $this->template[$this->director->theme->getConfig()->main_tag] = $template;
 }
Exemple #27
0
 private function handlePluginPost()
 {
     $request = Request::getInstance();
     $template = new TemplateEngine();
     $view = ViewManager::getInstance();
     if (!$request->exists('plug_id')) {
         throw new Exception('Plugin ontbreekt.');
     }
     $id = intval($request->getValue('plug_id'));
     $template->setVariable('plug_id', $id, false);
     $plugin = $this->director->pluginManager->getPluginFromId(array('id' => $id));
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW);
     $url->clearParameter('plug_id');
     $this->director->theme->handleAdminLinks($template, $this->getName(array('id' => $id)), $url);
     $plugin->setReferer($this);
     $plugin->handleHttpPostRequest();
 }