/** * Create user * * @param array $givenParameters */ public static function create($givenParameters) { if (isset($givenParameters['contact_passwd']) && $givenParameters['contact_passwd']) { $givenParameters['contact_passwd'] = md5($givenParameters['contact_passwd']); } parent::create($givenParameters); }
/** * Host create action * * @param array $givenParameters * @return int id of created object */ public static function create($givenParameters, $origin = "", $route = "", $validate = true, $validateMandatory = true) { if ($origin == 'api' && !isset($givenParameters['command_command_id'])) { $givenParameters['command_command_id'] = " "; } $id = parent::create($givenParameters, $origin, $route, $validate, $validateMandatory); self::deployServices($id); return $id; }
/** * Create a poller * * @param array $params The parameters for create a poller * @return int The id of poller created */ public static function create($params, $origin = "", $route = "", $validate = true, $validateMandatory = true) { try { if ($validate) { self::validateForm($params, $origin, $route, $validateMandatory); } $di = Di::getDefault(); $orgId = $di->get('organization'); $nodeId = NodeRepository::create($params); $params['node_id'] = $nodeId; $params['organization_id'] = $orgId; $params['port'] = 0; $pollerId = parent::create($params, $origin, $route, true, false); return $pollerId; } catch (Exception $e) { throw new Exception($e->getMessage(), 255); } }
/** * * @param type $givenParameters * @param type $origin * @param type $route * @param type $validate * @param type $validateMandatory */ public static function create($givenParameters, $origin = "", $route = "", $validate = true, $validateMandatory = true) { $id = parent::create($givenParameters, $origin, $route, $validate, $validateMandatory); return $id; }
/** * Generic create action * * @param type $givenParameters * @param type $origin * @param type $route * @param type $validate * @param type $validateMandatory */ public static function create($givenParameters, $origin = "", $route = "", $validate = true, $validateMandatory = true) { $id = null; $db = Di::getDefault()->get('db_centreon'); $class = static::$objectClass; $pk = $class::getPrimaryKey(); $columns = $class::getColumns(); $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; } } $givenParameters['inherited'] = 0; return parent::create($givenParameters, $origin, $route, $validate, $validateMandatory); }