public function toHtml()
 {
     $topPanel = new TopPanelControl(null, 'debugTopPanel');
     $topPanel->setCaption('
             <div class="debug-block">
                 <span class="glyphicon glyphicon-flash"></span> &nbsp;&nbsp;' . QueryLog::count() . '
             </div>
             <div class="debug-block">
                 <span class="glyphicon glyphicon-time"></span> &nbsp;&nbsp;' . Profiler::getTotalTime() . ' ms
             </div>
             <div class="debug-block">
                 <span class="glyphicon glyphicon-oil"></span> &nbsp;&nbsp;' . round(memory_get_peak_usage() / 1024 / 1024, 1) . ' MB
             </div>
             ')->setOpened(Logging::isError());
     if ($this->mode === self::MODE_LARGE) {
         $tabControl = new TabControl(null, 'debugTabControl');
         $tabControl->addTab('Log (' . count(Logging::getLogItems()) . ')')->add($this->showLog());
         $tabControl->addTab('SQL-Queries (' . QueryLog::count() . ')')->add($this->showQueryLog());
         $tabControl->addTab('Request')->add($this->showNfsRequest());
         $tabControl->addTab('REQUEST-Array (' . count($_REQUEST) . ')')->add($this->showRequest());
         if (Configuration::get('logging.showServerVar') === 'true') {
             $tabControl->addTab('SERVER-Array (' . count($_SERVER) . ')')->add($this->showServer());
         }
         $tabControl->addTab('FILES-Array (' . count($_FILES) . ')')->add($this->showFiles());
         $tabControl->addTab('Profiler')->add($this->showProfilerInfo());
         $tabControl->addTab('Cache')->add($this->showTabInfo());
         $tabControl->addTab('Debug')->add($this->showDebugTab());
         $topPanel->add($tabControl);
     }
     Javascript::addJs($topPanel->getJavascript());
     return $topPanel->toHtml();
 }
 /**
  * Übergibt den benötigten Javascript-Code an den JS-Manager und echoed
  * das HTML des Controls. Wird eigentlich nur bei Controls, die direkt
  * in der default.php des Templates stehen eingesetzt.
  *
  * @return string
  */
 public function display()
 {
     Javascript::addJs($this->getJavascript());
     echo $this->toHtml();
 }
 /**
  * @covers \NewFrontiers\Framework\Output\Javascript::addJs
  * @covers \NewFrontiers\Framework\Output\Javascript::render
  * @covers \NewFrontiers\Framework\Output\Javascript::clear
  * @covers \NewFrontiers\Framework\Output\Javascript::display
  */
 public function testJS()
 {
     Javascript::addJs('alert("test");');
     Javascript::addJs(["test2", "test3"]);
     $renderResult = Javascript::render();
     $dom = new \DOMDocument();
     $dom->validateOnParse = true;
     $isValid = $dom->loadHTML($renderResult);
     $this->assertTrue($isValid);
     //check that every script got included
     $this->assertContains('alert("test");', $renderResult);
     $this->assertContains("test2", $renderResult);
     $this->assertContains("test3", $renderResult);
     $newRenderResult = Javascript::render();
     $this->assertEmpty($newRenderResult);
     Javascript::addJs('alert("test");');
     Javascript::addJs(["test2", "test3"]);
     Javascript::display();
     $this->expectOutputString($renderResult);
 }
Esempio n. 4
0
 public function render()
 {
     Profiler::startSection(get_called_class());
     $this->createControls();
     $mainControl = $this->controls;
     if ($this->formControl !== null) {
         $mainControl = $this->formControl;
         $this->formControl->add($this->controls);
     }
     $temp = $mainControl->toHtml();
     Javascript::addJs($mainControl->getJavascript());
     Profiler::endSection(get_called_class());
     return $temp;
 }