Beispiel #1
0
 /**
  * 
  * @cmdForm /centreon-bam/indicator/update required 
  * @cmdParam boolean|false disable required disable 
  */
 public function createAction($params)
 {
     IndicatorRepository::transco($params);
     $params['object'] = $this->objectName;
     $id = IndicatorRepository::createIndicator($this->parseObjectParams($params), 'api', '/centreon-bam/indicator/update');
     // show slug of boolean indicator only
     if (!is_null($id)) {
         $slug = BooleanIndicatorRepository::getSlugNameById($id);
         \Centreon\Internal\Utils\CommandLine\InputOutput::display($slug, true, 'green');
     }
     \Centreon\Internal\Utils\CommandLine\InputOutput::display("Object successfully created", true, 'green');
 }
Beispiel #2
0
 /**
  * Create a new indicator
  *
  * @method post
  * @route /indicator/add
  */
 public function createAction()
 {
     $givenParameters = $this->getParams('post');
     $updateSuccessful = true;
     $updateErrorMessage = '';
     $aReturn = self::checkDatas($givenParameters);
     if (!$aReturn['success']) {
         $this->router->response()->json(array('success' => $aReturn['success'], 'error' => $aReturn['error']));
         return;
     }
     $route = $this->getUri();
     try {
         IndicatorRepository::createIndicator($givenParameters, 'wizard', $route);
         unset($_SESSION['form_token']);
         unset($_SESSION['form_token_time']);
         $this->router->response()->json(array('success' => true));
     } catch (\Centreon\Internal\Exception $e) {
         $updateSuccessful = false;
         $updateErrorMessage = $e->getMessage();
         $this->router->response()->json(array('success' => false, 'error' => $updateErrorMessage));
     }
 }