public function getHtml() { $activeTab = $this->getActiveTab(); $code = '<div class=\'tab_header\'>'; foreach ($this->tabs as $key => $value) { $link = FajrUtils::linkUrl(array_merge($this->urlParams, array($this->name => $key))); if ($key == $activeTab['name']) { $class = 'tab_selected'; } else { $class = 'tab'; } $code .= '<span class=\'' . $class . '\'><a href="' . $link . '">' . $value['title'] . '</a></span>'; } $code .= '</div>'; try { $code .= $activeTab['content']->getHtml(); } catch (Exception $e) { DisplayManager::addException($e); } return $code; }
/** * Runs the whole logic. It is fajr's main() * * @returns void */ public function run() { $this->injector->getInstance('SessionInitializer.class')->startSession(); $timer = new SystemTimer(); // TODO(ppershing): use injector here! $trace = new NullTrace(); if (FajrConfig::get('Debug.Trace') === true) { $trace = new HtmlTrace($timer, "--Trace--"); } try { Input::prepare(); $this->regenerateSessionOnLogin(); $connection = $this->provideConnection(); $this->runLogic($trace, $connection); } catch (LoginException $e) { if ($connection) { FajrUtils::logout($connection); } DisplayManager::addException($e); } catch (Exception $e) { DisplayManager::addException($e); } DisplayManager::setBase(hescape(FajrUtils::basePath())); $trace->tlog("everything done, generating html"); if (FajrConfig::get('Debug.Trace') === true) { $traceHtml = $trace->getHtml(); DisplayManager::addContent('<div class="span-24">' . $traceHtml . '<div> Trace size:' . sprintf("%.2f", strlen($traceHtml) / 1024.0 / 1024.0) . ' MB</div></div>'); } echo DisplayManager::display(); }