Ejemplo n.º 1
0
 /**
  * 
  * @param array $resultSet
  */
 protected function formatDatas(&$resultSet)
 {
     $previousType = '';
     foreach ($resultSet as &$myBaSet) {
         $sideMenuCustom = new SlideMenu($myBaSet['ba_id']);
         $events = Di::getDefault()->get('events');
         $events->emit('centreon-bam.slide.menu.business.activity', array($sideMenuCustom));
         $myBaSet['DT_RowData']['right_side_menu_list'] = $sideMenuCustom->getMenu();
         $myBaSet['DT_RowData']['right_side_default_menu'] = $sideMenuCustom->getDefaultMenu();
         // Set business activity type
         $baType = \CentreonBam\Models\BusinessActivityType::getParameters($myBaSet['ba_type_id'], array('name'));
         $myBaSet['ba_type_id'] = $baType['name'];
         if ($myBaSet['ba_type_id'] === $previousType) {
             $myBaSet['ba_type_id'] = '';
         } else {
             $previousType = $myBaSet['ba_type_id'];
         }
         // set business activity name
         $myBaSet['name'] = BusinessActivityRepository::getIconImage($myBaSet['name']) . $myBaSet['name'];
         /* Tags */
         $myBaSet['tagname'] = "";
         $aTags = TagsRepository::getList('ba', $myBaSet['ba_id'], 2);
         foreach ($aTags as $oTags) {
             $myBaSet['tagname'] .= TagsRepository::getTag('ba', $myBaSet['ba_id'], $oTags['id'], $oTags['text'], $oTags['user_id'], $oTags['template_id']);
         }
         $myBaSet['tagname'] .= TagsRepository::getAddTag('ba', $myBaSet['ba_id']);
     }
 }
 /**
  * Display side bar information of a business activity
  *
  * @method get
  * @route /business-activity/snapshotslide/[i:id]
  */
 public function snapshotslideAction()
 {
     $params = $this->getParams();
     $data['configurationData'] = BusinessActivity::get($params['id'], array('ba_id', 'name', 'activate', 'icon_id', 'id_reporting_period'));
     $data['configurationData']['icon'] = BusinessActivityRepository::getIconImage($data['configurationData']['name']);
     $data['configurationData']['reporting_period'] = !empty($data['configurationData']['id_reporting_period']) ? Timeperiod::get($data['configurationData']['id_reporting_period'], 'tp_name') : "";
     $data['configurationData']['activate'] = YesNoDefault::toString($data['configurationData']['activate']);
     $data['realtimeData'] = BusinessActivityRealtime::get($params['id']);
     $informations = array_merge($data['configurationData'], $data['realtimeData']);
     $edit_url = $this->router->getPathFor("/centreon-bam/businessactivity/" . $params['id']);
     $this->router->response()->json(array('informations' => $informations, 'edit_url' => $edit_url, 'success' => true));
 }
 /**
  * 
  * @param array $resultSet
  */
 protected function formatDatas(&$resultSet)
 {
     $previousType = '';
     foreach ($resultSet as &$myBaSet) {
         // Set business activity type
         $baType = \CentreonBam\Models\BusinessActivityType::getParameters($myBaSet['ba_type_id'], array('name'));
         $myBaSet['ba_type_id'] = $baType['name'];
         if ($myBaSet['ba_type_id'] === $previousType) {
             $myBaSet['ba_type_id'] = '';
         } else {
             $previousType = $myBaSet['ba_type_id'];
         }
         // Set business activity availability
         $myBaSet['current_level'] = $myBaSet['current_level'] . '%';
         // Set business activity name with its icon
         $myBaSet['name'] = BusinessActivityRepository::getIconImage($myBaSet['name']) . $myBaSet['name'];
         // Set human readable duration
         $myBaSet['duration'] = Datetime::humanReadable($myBaSet['duration'], Datetime::PRECISION_FORMAT, 2);
         /* Tags */
         $myBaSet['tagname'] = "";
         $aTags = TagsRepository::getList('ba', $myBaSet['ba_id'], 2);
         foreach ($aTags as $oTags) {
             $myBaSet['tagname'] .= TagsRepository::getTag('ba', $myBaSet['ba_id'], $oTags['id'], $oTags['text'], $oTags['user_id'], $oTags['template_id']);
         }
         $myBaSet['tagname'] .= TagsRepository::getAddTag('ba', $myBaSet['ba_id']);
     }
 }