/** * @param Localizer $locator */ public function __construct($locale) { $this->_view = \Xily\Bean::create($locale->replace(file_get_contents(MODULE_DIR . 'holidays' . DIRECTORY_SEPARATOR . 'holidays.xml'))); $api = APIFactory::get('domain'); $xmlFilterDomain = $this->_view->getNodeById('selFilterDomain'); if ($xmlFilterDomain) { $xmlFilterDomain->addChild(new \Xily\Bean('option', '--- ' . ucfirst($locale->get('common.all')) . ' ---', array('value' => ''))); foreach ($api->do_list() as $arrDomain) { $xmlFilterDomain->addChild(new \Xily\Bean('option', $arrDomain['Name'], array('value' => $arrDomain['Id']))); } } }
public function load_view() { $view = array_key_exists('view', $_REQUEST) ? $_REQUEST['view'] : 'login'; if (!in_array($view, $noauth) && !array_key_exists('user', $_SESSION) && !(isset($_REQUEST['user']) && API::validateUser($_REQUEST['user'], isset($_REQUEST['password']) ? $_REQUEST['password'] : ''))) { $view = 'login'; } elseif ($view == 'login') { // If logged-in go directly to the home screen $view = 'home'; } // Check, if there is a controller for the view if (file_exists('controllers/' . $view . '.php')) { include 'controllers/' . $view . '.php'; } $controllerClass = $view . 'Controller'; if (class_exists($controllerClass)) { $controller = new $controllerClass($locator); $xlyPage = $controller->getView(); } else { $file = 'views/' . $view . '.xml'; if (!file_exists($file)) { $file = 'views/404.xml'; } $xlyPage = \Xily\Bean::create($locator->insert(file_get_contents($file))); } if (!$xlyPage->hasAttribute('id')) { $xlyPage->setAttribute('id', $view); } $xlyPage->setDataset($_GET, 'get'); $xlyPage->setDataset(\Xily\Config::getDir('app.url'), 'url'); $xlyPage->setDataset($_POST, 'post'); $xlyPage->setDataset($_REQUEST, 'request'); $xlyPage->locator = $locator; echo $xlyPage->run(); }
// Check if the module has a controller if (file_exists(MODULE_DIR . $view . '/' . $view . '.php')) { include_once MODULE_DIR . $view . '/' . $view . '.php'; } if (class_exists($controllerClass)) { $controller = new $controllerClass($locale); $xlyPage = $controller->getView(); } else { if (file_exists(MODULE_DIR . $view . '/' . $view . '.xml')) { $xlyPage = \Xily\Bean::create($locale->replace(file_get_contents(MODULE_DIR . $view . '/' . $view . '.xml'))); } } } if (!isset($xlyPage)) { $xlyPage = \Xily\Bean::create($locale->replace(file_get_contents(VIEW_DIR . (file_exists(VIEW_DIR . $view . '.xml') ? $view : '404') . '.xml'))); } } if (!$xlyPage->id()) { $xlyPage->setAttribute('id', $view); } $xlyPage->setDataset($_GET, 'get'); $xlyPage->setDataset(\Xily\Config::getDir('app.url'), 'url'); $xlyPage->setDataset($_POST, 'post'); $xlyPage->setDataset($_REQUEST, 'request'); $xlyPage->setAttribute('lang', $locale->getCurrent()); echo $xlyPage->run($xmlMeta); } } catch (Exception $e) { $xlyError = \Xily\Bean::create($locale->replace(file_get_contents(VIEW_DIR . 'error.xml'))); echo $xlyError->run(array('message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'code' => $e->getCode(), 'trace' => str_replace("\n", '<br />', htmlentities(KickstartErrorTrace($e))))); }
/** * @param locator $locator */ public function __construct($locale) { APIFactory::getAuthenticator()->setUserSession(); $this->_view = \Xily\Bean::create($locale->replace(file_get_contents(VIEW_DIR . 'login.xml'))); }