/** * Get the full text of a numeric value * * @param string $name The key name * @param int $value The numeric value * @return string */ public static function getTextValue($name, $value) { switch ($name) { case 'domain_id': $domain = Domain::get($value); return $domain['name']; case 'command_command_id': case 'command_command_id2': $command = Command::get($value); return $command['command_name']; case 'timeperiod_tp_id': $timeperiod = Timeperiod::get($value); return $timeperiod['tp_name']; case 'service_is_volatile': case 'service_active_checks_enabled': case 'service_passive_checks_enabled': case 'service_obsess_over_service': case 'service_check_freshness': case 'service_event_handler_enabled': case 'service_flap_detection_enabled': if ($value == 0) { return _('No'); } else { if ($value == 1) { return _('Yes'); } else { return _('Default'); } } default: return $value; } }
public function testGetWithUnknownId() { $this->setExpectedException('\\Centreon\\Internal\\Exception', $this->errMsg); Timeperiod::get(9999); }
/** * Display side bar information of a business activity * * @method get * @route /business-activity/snapshotslide/[i:id] */ public function snapshotslideAction() { $params = $this->getParams(); $data['configurationData'] = BusinessActivity::get($params['id'], array('ba_id', 'name', 'activate', 'icon_id', 'id_reporting_period')); $data['configurationData']['icon'] = BusinessActivityRepository::getIconImage($data['configurationData']['name']); $data['configurationData']['reporting_period'] = !empty($data['configurationData']['id_reporting_period']) ? Timeperiod::get($data['configurationData']['id_reporting_period'], 'tp_name') : ""; $data['configurationData']['activate'] = YesNoDefault::toString($data['configurationData']['activate']); $data['realtimeData'] = BusinessActivityRealtime::get($params['id']); $informations = array_merge($data['configurationData'], $data['realtimeData']); $edit_url = $this->router->getPathFor("/centreon-bam/businessactivity/" . $params['id']); $this->router->response()->json(array('informations' => $informations, 'edit_url' => $edit_url, 'success' => true)); }
/** * Get the full text of a numeric value * * @param string $name The key name * @param int $value The numeric value * @return string */ public static function getTextValue($name, $value) { switch ($name) { case 'command_command_id': case 'command_command_id2': $command = Command::get($value); return $command['command_name']; case 'timeperiod_tp_id': $timeperiod = Timeperiod::get($value); return $timeperiod['tp_name']; case 'host_active_checks_enabled': case 'host_obsess_over_host': case 'host_check_freshness': case 'flap_detection_options': case 'host_event_handler_enabled': if ($value == 0) { return _('No'); } else { if ($value == 1) { return _('Yes'); } else { return _('Default'); } } default: return $value; } }