Exemplo n.º 1
0
 /**
  *
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $aAddFilters = array();
     $tablesString = null;
     $aGroup = array();
     // Filter by kpi name
     if (isset($filters['object']) && !empty($filters['object'])) {
         $indicatorsName = IndicatorRepository::getIndicatorsName($filters['object']);
         if (count($indicatorsName)) {
             foreach ($indicatorsName as $indicatorName) {
                 $filters['kpi_id'][] = $indicatorName['id'];
             }
         } else {
             $count = 0;
         }
         unset($filters['object']);
     }
     return parent::getListBySearch($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters, $aGroup);
 }
Exemplo n.º 2
0
 /**
  * @cmdForm /centreon-bam/indicator/update map
  * @cmdObject string ba the ba
  * @cmdObject string indicator-ba the indicator-ba kpi
  * @cmdObject string service the service kpi
  * @cmdObject string boolean the boolean kpi 
  */
 public function showAction($object)
 {
     IndicatorRepository::transco($object);
     $kpi = Indicator::getKpi($this->parseObjectParams($object));
     $this->normalizeSingleSet($kpi);
     $result = '';
     foreach ($kpi as $key => $value) {
         $result .= $key . ': ' . $value . "\n";
     }
     echo $result;
 }
 /**
  * Get indicators for a specific business activity
  *
  * @method get
  * @route /business-activity/[i:id]/indicators
  */
 public function indicatorBaAction()
 {
     $params = $this->getParams();
     $indicators = array('service' => array(), 'metaservice' => array(), 'ba' => array(), 'boolean' => array());
     $listIndicator = IndicatorRepository::getIndicatorsName("", $params['id']);
     foreach ($listIndicator as $indicator) {
         $indicators[$indicator['type']][] = $indicator['text'];
     }
     $this->router->response()->json(array('indicators' => $indicators, 'success' => true));
 }
Exemplo n.º 4
0
 /**
  *
  * @method get
  * @route /indicator/formlist
  */
 public function formListIndicatorAction()
 {
     $di = Di::getDefault();
     $router = $di->get('router');
     $finalList = IndicatorRepository::getIndicatorsName();
     $router->response()->json($finalList);
 }
Exemplo n.º 5
0
 /**
  * 
  * @param type $sModule
  * @param type $sNameObject
  * @param array $aDatas
  * @param string $value
  */
 public static function validateDataIndicator($sModule, $sNameObject, $aDatas, $value)
 {
     $iObjectId = '';
     $return = '';
     $sLabel = '';
     $oRepository = $sModule . "\\Repository\\" . ucfirst($sNameObject . "Repository");
     if (isset($aDatas['extraParams']['kpi_type']) && !empty($value)) {
         if ($aDatas['extraParams']['kpi_type'] == '0' && isset($aDatas['extraParams']['service_id']) && $aDatas['extraParams']['service_id'] == $value) {
             $serviceId = "";
             if (isset($aDatas['extraParams']['service_id'])) {
                 $serviceId = $aDatas['extraParams']['service_id'];
             }
             $aParams['id_ba'] = $aDatas['extraParams']['id_ba'];
             $aParams['serviceIndicator'] = $serviceId;
         } elseif ($aDatas['extraParams']['kpi_type'] == '2' && isset($aDatas['extraParams']['id_indicator_ba']) && $aDatas['extraParams']['id_indicator_ba'] == $value) {
             if (isset($aDatas['extraParams']['id_indicator_ba'])) {
                 $sLabel = $aDatas['extraParams']['id_indicator_ba'];
             }
             $aParams['id_ba'] = $aDatas['extraParams']['id_ba'];
             $aParams['baIndicator'] = $sLabel;
         } elseif ($aDatas['extraParams']['kpi_type'] == '3' && isset($aDatas['extraParams']['boolean_name']) && $aDatas['extraParams']['boolean_name'] == $value) {
             if (isset($aDatas['extraParams']['boolean_name'])) {
                 $sLabel = $aDatas['extraParams']['boolean_name'];
             }
             $aParams['boolean'] = $sLabel;
         }
         try {
             $idReturned = IndicatorRepository::getIdFromUnicity($aParams, $aDatas['extraParams']['kpi_type']);
             $iObjectId = '';
             if (isset($aDatas['extraParams']['object_id']) && !empty($aDatas['extraParams']['object_id'])) {
                 $iObjectId = $aDatas['extraParams']['object_id'];
             }
             $return[] = self::compareResponse($iObjectId, $idReturned);
         } catch (MissingParameterException $e) {
             $return[] = 0;
         }
     }
     return $return;
 }