/**
  * {@inheritdoc}
  */
 public function whereToSql($col, $sign, $expression)
 {
     if ($col === 'UNIX_TIMESTAMP(sch.comment_time)') {
         return 'sch.comment_time ' . $sign . ' ' . $this->timestampForSql($this->valueToTimestamp($expression));
     } else {
         return parent::whereToSql($col, $sign, $expression);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function whereToSql($col, $sign, $expression)
 {
     if ($col === 'UNIX_TIMESTAMP(sh.state_time)') {
         return 'sh.state_time ' . $sign . ' ' . $this->timestampForSql($this->valueToTimestamp($expression));
     } elseif ($col === $this->columnMap['history']['type'] && !is_array($expression) && array_key_exists($expression, $this->types)) {
         return 'sh.state_type ' . $sign . ' ' . $this->types[$expression];
     } else {
         return parent::whereToSql($col, $sign, $expression);
     }
 }
Ejemplo n.º 3
0
 public function where($expression, $parameters = null)
 {
     $types = array('host' => 1, 'service' => 2, 'contact' => 10);
     if ($expression === 'object_type') {
         parent::where('object_type_id', $types[$parameters]);
     } else {
         parent::where($expression, $parameters);
     }
     return $this;
 }
Ejemplo n.º 4
0
 protected function joinBaseTables()
 {
     parent::joinBaseTables();
     if (version_compare($this->getIdoVersion(), '1.11.7', '<')) {
         $this->columnMap['programstatus']['endpoint_name'] = '(0)';
     }
     if (version_compare($this->getIdoVersion(), '1.11.8', '<')) {
         $this->columnMap['programstatus']['program_version'] = '(NULL)';
     }
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function getGroup()
 {
     $group = parent::getGroup();
     if (!empty($group) && $this->ds->getDbType() === 'pgsql') {
         foreach ($this->columnMap as $table => $columns) {
             $pk = ($table === 'objects' ? 'cvo.' : 'cvs.') . $this->getPrimaryKeyColumn($table);
             foreach ($columns as $alias => $_) {
                 if (!in_array($pk, $group, true) && in_array($alias, $group, true)) {
                     $group[] = $pk;
                     break;
                 }
             }
         }
     }
     return $group;
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 protected function registerGroupColumns($alias, $table, array &$groupedColumns, array &$groupedTables)
 {
     if ($alias === 'service_handled' || $alias === 'service_severity' || $alias === 'service_unhandled') {
         if (!isset($groupedTables['hoststatus'])) {
             $groupedColumns[] = 'hs.hoststatus_id';
             $groupedTables['hoststatus'] = true;
         }
         if (!isset($groupedTables['servicestatus'])) {
             $groupedColumns[] = 'ss.servicestatus_id';
             $groupedTables['servicestatus'] = true;
         }
     } else {
         parent::registerGroupColumns($alias, $table, $groupedColumns, $groupedTables);
     }
 }