private function createTypeDescriptor($type)
 {
     $list = array();
     if ($type === 'host') {
         $list = IcingaHostStateInfo::Create()->getStateList();
     } elseif ($type === 'service') {
         $list = IcingaServiceStateInfo::Create()->getStateList();
     } else {
         throw new AppKitModelException("Type not known: {$type}");
     }
     $out = array();
     foreach ($list as $state => $name) {
         $out[$state] = $this->createStateDescriptor($state, $name, $type);
     }
     return $out;
 }
 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 serviceStatus($val, AgaviParameterHolder $method_params, AgaviParameterHolder $row)
 {
     return (string) IcingaServiceStateInfo::Create($val)->getCurrentStateAsHtml();
 }