/**
  * Creates a generic html format and returns an stringable xml node
  * @return AppKitXmlTag
  */
 public function getCurrentStateAsHtml($wrap = null)
 {
     $span = AppKitXmlTag::create('span', $this->getCurrentStateAsText($wrap));
     $div = AppKitXmlTag::create('div', $span)->addAttribute('class', sprintf('icinga-status icinga-status-%s', strtolower($this->getStateText($this->getCurrentState()))));
     return $div;
 }
 private function rewriteColumn($key, &$val)
 {
     if (isset($this->resultColumns[$key]['type'])) {
         switch (strtolower($this->resultColumns[$key]['type'])) {
             case 'url':
                 if (isset($val) && strlen($val)) {
                     $val = (string) AppKitXmlTag::create('a', $val)->addAttribute('href', $val)->addAttribute('target', '_blank');
                 }
                 break;
             case 'boolean':
             case 'bool':
                 $val = (bool) $val == true ? $this->tm->_('True') : $this->tm->_('False');
                 break;
             case 'timestamp':
             case 'datetime':
                 $check = strtotime($val);
                 if ($check <= 0) {
                     $val = '(null)';
                 } else {
                     $val = $this->tm->_d($val, 'date-tstamp');
                 }
                 break;
             case 'hoststate':
                 $val = (string) IcingaHostStateInfo::Create((int) $val)->getCurrentStateAsHtml();
                 break;
             case 'servicestate':
                 $val = (string) IcingaServiceStateInfo::Create((int) $val)->getCurrentStateAsHtml();
                 break;
             case 'checktype':
                 $val = $this->tm->_(IcingaConstantResolver::activeCheckType($val));
                 break;
             case 'float':
                 $val = sprintf('%.2f', $val);
                 break;
         }
     }
     return $val;
 }
 public function jsGetCode($with_tags = true, $flush = false)
 {
     if (count($this->js_code)) {
         $content = "\n" . implode("\n\n", $this->js_code) . "\n";
         if ($with_tags == true) {
             $content = "\n" . (string) AppKitXmlTag::create('script', $content)->addAttribute('type', 'text/javascript') . "\n";
         }
         if ($flush) {
             $this->jsFlushData();
         }
         return $content;
     }
 }