/** * Get an ini configuration * @param Request $param * @param string $term An php ini key * @return string */ public static function ini(Request $param, $term = null) { $str = CString::pick(self::getParams($param, "q"), $term); return $term . " : " . ini_get($str); }
/** * Render template view of module * @param null $template * @return string * @throws CException */ public function render($template = null) { if (empty($this->defaultTemplate)) { return ""; } $template = CString::pick($template, $this->defaultTemplate); $templatePath = null; if (file_exists(MODULES_PATH . $this::$module_path . "templates/" . $template)) { // Si le template existe dans le module $templatePath = MODULES_PATH . $this::$module_path . "templates/" . $template; } else { // Sinon parcours les class parent pour trouver le template (cas d'un user extends) $class = new \ReflectionClass(get_class($this)); while ($parent = $class->getParentClass()) { $cls = $parent->getName(); $p = $parent->getDefaultProperties(); if (isset($p["module_path"]) && !empty($p["module_path"]) && file_exists(MODULES_PATH . $p["module_path"] . "templates/" . $template)) { $templatePath = MODULES_PATH . $p["module_path"] . "templates/" . $template; break; } $class = $parent; } } if (!empty($templatePath)) { return View::render($templatePath, $this->params, $this); } throw new CException("Module " . get_class($this) . " : template {$template} not found"); }