public function start() { \org\equinox\utils\debug\DebugBarFactory::init(); //$this->request->analyseAskedRequest(); $controller = $this->getController($this->request->getModule(), $this->request->getController()); try { try { $action = $controller->doActionRequested($this->request->action, 'main'); } catch (\org\equinox\exception\AccessDeniedException $e) { if ($controller->getReturnType() == \org\equinox\controller\Controller::RETURN_TYPE_HTML) { $controller = $this->getController($this->request->accessDeniedModule, $this->request->accessDeniedController); $controller->doActionRequested($this->request->accessDeniedAction, 'main'); } else { echo $this->getJsonException($e); } } } catch (\Exception $e) { if ($controller->getReturnType() == \org\equinox\controller\Controller::RETURN_TYPE_HTML) { $this->request->exception = $e; $controller = $this->getController($this->request->errorModule, $this->request->errorController); $controller->doActionRequested($this->request->errorAction, 'main'); } else { echo $this->getJsonException($e); } } if ($controller->getReturnType() == \org\equinox\controller\Controller::RETURN_TYPE_HTML) { $layout = $this->getController($this->request->layoutModule, $this->request->layoutController); echo $layout->genereLayout(); } else { echo json_encode($action->getAllAssigns()); } return true; }
/** * initialize the factory */ public static function initialize($configFile, $includePath, $cacheFile = null) { self::$container = new IocContainerImpl($configFile, $includePath, $cacheFile); self::$container->initializeNotLazyBeans(); \org\equinox\utils\debug\DebugBarFactory::add(self::$container->getPlaceHoldersData(), 'Config'); //var_dump(self::$container); }
public function render($blockName, $moduleName, $controllerName, $actionName, $dataHolder = null, $defaultDir = null) { $smartyData = $this->smarty->createData($this->smarty); if ($dataHolder != null) { foreach ($dataHolder as $key => $value) { $smartyData->assign($key, $value); } } \org\equinox\utils\debug\DebugBarFactory::add($smartyData->getTemplateVars(), 'Smarty', $blockName); $this->smarty->setTemplateDir(ROOT . '/' . $this->templateDir); $template = $moduleName . '/' . $controllerName . '/' . $actionName; if (!$this->smarty->templateExists($template . '.tpl')) { // check the default template if ($defaultDir != null) { $this->smarty->setTemplateDir($defaultDir); $template = $controllerName . '/' . $actionName; if (!$this->smarty->templateExists($template . '.tpl')) { throw new \org\equinox\exception\EquinoxException("Cannot find ({$template}.tpl) template in (" . ROOT . '/' . $this->templateDir . ") nor in default directory ({$defaultDir})"); } } else { throw new \org\equinox\Exception\EquinoxException("Cannot find ({$template}.tpl) template in (" . $this->smarty->template_dir . ") and no default directory provided"); } } $html = $this->smarty->fetch($template . '.tpl', $smartyData); \org\equinox\utils\debug\DebugBarFactory::add($html, 'Smarty', $blockName . '_html'); return $html; }
public function getHtml(FormDefinition $definition) { $dataHolder = array(); $dataHolder['base'] = $this->request->base; $dataHolder['index'] = $this->request->index; $dataHolder['formDefinition'] = $definition; \org\equinox\utils\debug\DebugBarFactory::add($dataHolder, 'Smarty', 'form'); return $this->view->fetch('form.tpl', $dataHolder, dirname(__FILE__) . '/tpl'); }
public function errorAction() { try { //gestion des erreurs (envoi de mail, bdd,...) } catch (\Exception $e) { // do nothing : nullify this exception } $this->assign('isDebug', \org\equinox\utils\debug\DebugBarFactory::isDebug()); $this->assign('exception', $this->request->exception); $this->assign('exceptionName', get_class($this->request->exception)); }
public function listRightsByModule() { $list = array(); foreach ($this->modulesLoaded as $module) { $xmlRight = $this->loadModuleRight($module); if ($xmlRight != null) { $module = new RightModuleDto(); $module->setCode((string) $xmlRight['code']); $module->setTitle((string) $xmlRight->title); $module->setDescription((string) $xmlRight->description); foreach ($xmlRight->right as $r) { $right = new RightDto(); $right->setCode((string) $r['code']); $right->setTitle((string) $r->title); $right->setDescription((string) $r->description); $module->addRight($right); } $list[] = $module; } } $list[] = $this->getSuperRight(); Debug::add($list, 'right'); return $list; }
/** * @param $pdo PDO * @param $query string * @return PDOStatement */ private function prepareStmt($query, $params) { if (\org\equinox\utils\debug\DebugBarFactory::isDebug()) { $this->debugQuery = new QueryDebug($query, $params); $debugArray = debug_backtrace(); if (sizeof($debugArray) >= 2) { $debugArray = $debugArray[1]; $this->debugQuery->file = $debugArray['file']; $this->debugQuery->line = $debugArray['line']; } \org\equinox\utils\debug\DebugBarFactory::add($this->debugQuery, 'Sql'); } try { $pdo = $this->getConnection(); $stmt = $pdo->prepare($query); $stmt->execute($params); } catch (\PDOException $e) { \org\equinox\utils\debug\DebugBarFactory::add($query, 'SqlDump'); \org\equinox\utils\debug\DebugBarFactory::add($params, 'SqlDump'); throw $e; } return $stmt; }
protected function jsonAction() { \org\equinox\utils\debug\DebugBarFactory::noDebug(); $this->setNoRender(); $this->returnType = self::RETURN_TYPE_JSON; }
public function analyseAskedRequest() { \org\equinox\utils\debug\DebugBarFactory::add($this, 'Request', 'current'); $this->processPost($_POST); if (array_key_exists('PATH_INFO', $_SERVER)) { $ar = @explode('/', $_SERVER["PATH_INFO"]); } else { $ar = array(); // Then calling the root of the site eg : http://www.mysite.com, PATH_INFO is not defined } $size = sizeof($ar); if ($size > 0) { array_shift($ar); // first value is alway empty // \org\equinox\utils\debug\DebugBarFactory::add($ar, 'debug', 'params'); $aliasRoute = @$ar[0]; if (array_key_exists($aliasRoute, $this->aliasRoute)) { array_shift($ar); // we remove the alias route from the liste of parameters $route = $this->aliasRoute[$aliasRoute]; $this->module = $route['module']; $this->controller = $route['controller']; $this->action = $route['action']; $this->processGetParams($ar); } elseif (sizeof($ar) >= 3) { $param1 = $ar[0]; $param2 = $ar[1]; $potentialControllerName = $param1 . '_' . $param2 . 'Controller'; if (\org\equinox\ioc\ContainerFactory::hasBean($potentialControllerName)) { $this->module = array_shift($ar); $this->controller = array_shift($ar); $this->action = array_shift($ar); } else { \org\equinox\utils\debug\DebugBarFactory::add("Cannot find the controller '{$potentialControllerName}'", 'debug', 'Notice'); } $this->processGetParams($ar); } else { $this->processGetParams($ar); } } // else we use the default value defined in the configurations files $this->index = $_SERVER["SCRIPT_NAME"]; $this->base = trim(dirname($_SERVER["SCRIPT_NAME"])); if ($this->base == '/') { $this->base = ''; } if ($this->base == '\\') { $this->base = ''; } }
function debugToolBarFunction($params, $smarty) { $pos = $params['position']; $newDebug = \org\equinox\utils\debug\DebugBarFactory::getInstance(); if ($newDebug != null) { if ($pos == 'header') { //var_dump($newDebug->getStyle()); return $newDebug->getStyle(); } if ($pos == 'bottom') { return $newDebug->show(); } } }
/** * initialize the factory */ public static function initialize($configFile, $includePath, $cacheFile = null) { $container = Container::getInstance(); $container->loadContext($configFile, $includePath, $cacheFile); \org\equinox\utils\debug\DebugBarFactory::add(array('ini var to fille here'), 'Config'); }