/** * Get list of service templates * * @param string $searchStr * @param int $objectId The self id to skip * @return array */ public static function getFormList($searchStr = "", $objectId = null) { $listServiceTemplate = parent::getFormList($searchStr, $objectId); foreach ($listServiceTemplate as $key => $serviceTemplate) { if ($serviceTemplate['id'] == $objectId) { unset($listServiceTemplate[$key]); } } $listServiceTemplate = array_values($listServiceTemplate); return $listServiceTemplate; }
/** * Update user * * @param array $givenParameters */ public static function update($givenParameters) { /* Do not perform update if password is empty */ if (isset($givenParameters['contact_passwd']) && $givenParameters['contact_passwd'] == '') { unset($givenParameters['contact_passwd']); } elseif (isset($givenParameters['contact_passwd'])) { /* Let's md5() the password */ $givenParameters['contact_passwd'] = md5($givenParameters['contact_passwd']); } parent::update($givenParameters); }
/** * Poller update function * * @param array $givenParameters The parameters for update a poller */ public static function update($params, $origin = "", $route = "", $validate = true, $validateMandatory = true) { if ($validate) { self::validateForm($params, "form", $route, $validateMandatory); } $di = Di::getDefault(); NodeRepository::update($params); parent::update($params, $origin, $route, $validate, $validateMandatory); }
/** * * @param type $givenParameters * @param type $origin * @param type $route * @param type $validate * @param type $validateMandatory */ public static function update($givenParameters, $origin = "", $route = "", $validate = true, $validateMandatory = true) { parent::update($givenParameters, $origin, $route, $validateMandatory); }
/** * Host update action * * @param array $givenParameters * @throws \Centreon\Internal\Exception */ public static function update($givenParameters, $origin = "", $route = "", $validate = true, $validateMandatory = true) { if ($origin == 'api' && !isset($givenParameters['command_command_id'])) { $givenParameters['command_command_id'] = " "; } parent::update($givenParameters, $origin, $route, $validate, $validateMandatory); if (isset($givenParameters['object_id'])) { self::deployServices($givenParameters['object_id']); if (isset($givenParameters['host_name'])) { self::updateSlugServices($givenParameters['object_id'], $givenParameters['host_name']); } } }
/** * Generic update function * * @param type $givenParameters * @param type $origin * @param type $route * @param type $validate * @param type $validateMandatory * * @throws \Centreon\Internal\Exception */ public static function update($givenParameters, $origin = "", $route = "", $validate = true, $validateMandatory = true) { $id = null; $db = Di::getDefault()->get('db_centreon'); $class = static::$objectClass; $pk = $class::getPrimaryKey(); $columns = $class::getColumns(); if (isset($givenParameters['service_hosts'])) { $sField = $class::getUniqueLabelField(); $aHostId = explode(",", $givenParameters['service_hosts']); $aHostId = array_filter($aHostId, 'strlen'); if (count($aHostId) > 0) { $sHostName = Host::get(current($aHostId), 'host_name'); if (isset($sField) && isset($givenParameters[$sField]) && !is_null($class::getSlugField()) && (isset($givenParameters[$class::getSlugField()]) && is_null($givenParameters[$class::getSlugField()]) or !isset($givenParameters[$class::getSlugField()]))) { $oSlugify = new CentreonSlugify($class, get_called_class()); $sString = $sHostName['host_name'] . " " . $givenParameters[$sField]; $sSlug = $oSlugify->slug($sString); $givenParameters[$class::getSlugField()] = $sSlug; } } } parent::update($givenParameters, $origin, $route, $validate, $validateMandatory); }