/** * Export * * @return void */ public function export() { parent::export(); $relobj = new Centreon_Object_Relation_Host_Category_Host(); $elements = $relobj->getMergedParameters(array($this->object->getUniqueLabelField()), array("host_name")); foreach ($elements as $element) { echo $this->action . $this->delim . "addmember" . $this->delim . $element[$this->object->getUniqueLabelField()] . $this->delim . $element['host_name'] . "\n"; } }
/** * Export * * @return void */ public function export() { parent::export(); $scs = $this->object->getList(array($this->object->getPrimaryKey(), $this->object->getUniqueLabelField())); $relobj = new Centreon_Object_Relation_Service_Category_Service(); $hostServiceRel = new Centreon_Object_Relation_Host_Service(); $svcObj = new Centreon_Object_Service(); foreach ($scs as $sc) { $scId = $sc[$this->object->getPrimaryKey()]; $scName = $sc[$this->object->getUniqueLabelField()]; $relations = $relobj->getTargetIdFromSourceId($relobj->getSecondKey(), $relobj->getFirstKey(), $scId); foreach ($relations as $serviceId) { $svcParam = $svcObj->getParameters($serviceId, array('service_description', 'service_register')); if ($svcParam['service_register'] == 1) { $elements = $hostServiceRel->getMergedParameters(array('host_name'), array('service_description'), -1, 0, null, null, array("service_id" => $serviceId), "AND"); foreach ($elements as $element) { echo $this->action . $this->delim . "addservice" . $this->delim . $scName . $this->delim . $element['host_name'] . "," . $element['service_description'] . "\n"; } } else { echo $this->action . $this->delim . "addservicetemplate" . $this->delim . $scName . $this->delim . $svcParam['service_description'] . "\n"; } } } }