<?php switch ($action) { case 'index': $themeManager = new ThemeManager($bdd); $themes = $themeManager->getList(); $pageTitle = "page d'acceuil"; ob_start(); require_once 'view/home/index.php'; $content = ob_get_contents(); ob_end_clean(); require_once 'view/layout/layout.php'; break; default: break; }
/** * 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('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; }