コード例 #1
0
ファイル: GraphTemplate.php プロジェクト: rk4an/centreon
 /**
  *
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $aAddFilters = array();
     $tablesString = null;
     $aGroup = array();
     // Filter by service template
     if (isset($filters['svc_tmpl_id']) && !empty($filters['svc_tmpl_id'])) {
         $serviceTemplateId = Servicetemplate::getIdByParameter('service_description', $filters['svc_tmpl_id'], array(), 'LIKE');
         unset($filters['svc_tmpl_id']);
         if (count($serviceTemplateId)) {
             foreach ($serviceTemplateId as $id) {
                 $filters['svc_tmpl_id'][] = $id;
             }
         } else {
             $count = 0;
         }
     }
     return parent::getListBySearch($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters, $aGroup);
 }
コード例 #2
0
 /**
  * Get values for templates
  *
  * @param integer $svcId The service id
  * @param bool $withServiceValues If the service template id is the base for get values
  * @return array
  */
 public static function getInheritanceValues($svcId, $withServiceValues = false)
 {
     $values = array();
     if ($withServiceValues) {
         $tmpl = $svcId;
     } else {
         $tmpl = Service::getParameters($svcId, array('service_template_model_stm_id'));
         $tmpl = $tmpl['service_template_model_stm_id'];
     }
     if (is_null($tmpl)) {
         return $values;
     }
     /* Get template values */
     $values = Servicetemplate::getParameters($tmpl, self::$inheritanceColumns);
     $values = array_filter($values, function ($value) {
         return !is_null($value);
     });
     $tmplNext = Servicetemplate::getParameters($tmpl, array('service_template_model_stm_id'));
     if (is_null($tmplNext['service_template_model_stm_id'])) {
         return $values;
     }
     $values = array_merge(static::getInheritanceValues($tmplNext['service_template_model_stm_id'], true), $values);
     return $values;
 }
コード例 #3
0
 public function testGetColumns()
 {
     $this->assertEquals(array('service_id', 'service_template_model_stm_id', 'command_command_id', 'timeperiod_tp_id', 'command_command_id2', 'timeperiod_tp_id2', 'service_description', 'service_alias', 'display_name', 'service_is_volatile', 'service_max_check_attempts', 'service_normal_check_interval', 'service_retry_check_interval', 'service_active_checks_enabled', 'service_passive_checks_enabled', 'initial_state', 'service_parallelize_check', 'service_obsess_over_service', 'service_check_freshness', 'service_freshness_threshold', 'service_event_handler_enabled', 'service_low_flap_threshold', 'service_high_flap_threshold', 'service_flap_detection_enabled', 'service_process_perf_data', 'service_retain_status_information', 'service_retain_nonstatus_information', 'service_notification_interval', 'service_notification_options', 'service_notifications_enabled', 'contact_additive_inheritance', 'cg_additive_inheritance', 'service_inherit_contacts_from_host', 'service_first_notification_delay', 'service_stalking_options', 'service_comment', 'command_command_id_arg', 'command_command_id_arg2', 'service_locked', 'service_register', 'service_activate', 'organization_id', 'environment_id', 'domain_id'), Servicetemplate::getColumns());
 }