Private GIT

Skip to content
Snippets Groups Projects
Commit f122b5d1 authored by Guillaume28's avatar Guillaume28
Browse files

Select2 for metric fixed

parent 162436a2
Branches select2
No related tags found
No related merge requests found
......@@ -47,16 +47,16 @@ class CentreonMetrics
{
$metrics = array();
$filters = '';
if (count($values) > 0) {
$filters = 'm.metric_id IN (' . join(', ', $values) . ') AND';
if (count($values) == 0) {
return array();
}
$queryService = "SELECT SQL_CALC_FOUND_ROWS m.metric_id, CONCAT(h.name,' - ', s.description, ' - ', m.metric_name) AS fullname "
."FROM metrics m, hosts h, services s, index_data i "
."WHERE "
. $filters . " "
. "i.id = m.index_id AND "
."h.host_id = i.host_id "
. $filters = 'm.metric_id IN (' . join(', ', $values) . ')'. " "
."AND i.id = m.index_id "
."AND h.host_id = i.host_id "
."AND s.service_id = i.service_id "
."ORDER BY fullname COLLATE utf8_general_ci";
$res = $this->dbo->query($queryService);
......
......@@ -51,7 +51,6 @@ abstract class CentreonWidgetParams implements CentreonWidgetParamsInterface
'serviceMulti'
);
/**
* Constructor
*
......@@ -136,6 +135,35 @@ abstract class CentreonWidgetParams implements CentreonWidgetParamsInterface
$this->params = $params;
}
/**
* Set Value
*
* @param array $params
* @return void
*/
public function setValue($params)
{
$userPref = $this->getUserPreferences($params);
if (isset($userPref)) {
if (in_array($params['ft_typename'], $this->multiType) && strpos($userPref, ',')) {
$userPref = explode(',', $userPref);
}
$this->quickform->setDefaults(array('param_' . $params['parameter_id'] => $userPref));
} elseif (isset($params['default_value']) && $params['default_value'] != "") {
$this->quickform->setDefaults(array('param_' . $params['parameter_id'] => $params['default_value']));
}
}
/**
* Get Element
*
* @return HTML_Quickform
*/
public function getElement()
{
return $this->element;
}
/**
* Get List Values
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment