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;
 }
 /**
  * wraps up additional host information in html table
  * @param   array       $hostData               information for a certain host
  * @return  string                              host information as html table
  * @author  Christian Doebler <*****@*****.**>
  */
 private function getHostDataTable($hostData)
 {
     $hostTable = null;
     $hostObjectId = false;
     foreach ($hostData as $key => $value) {
         if ($key == 'HOST_OBJECT_ID') {
             $hostObjectId = $value;
             continue;
         }
         switch ($key) {
             case 'HOST_CURRENT_STATE':
                 $value = IcingaHostStateInfo::Create($value)->getCurrentStateAsText();
                 break;
             case 'HOST_NAME':
                 $value = sprintf($this->scriptTemplate, $hostObjectId, $value, $value);
                 break;
         }
         $hostTable .= sprintf($this->tableRowTemplate, $this->tm->_($key), $value);
     }
     $hostTable = sprintf($this->tableTemplate, $hostTable);
     return $hostTable;
 }
 public function hostStatus($val, AgaviParameterHolder $method_params, AgaviParameterHolder $row)
 {
     return (string) IcingaHostStateInfo::Create($val)->getCurrentStateAsHtml();
 }