コード例 #1
0
ファイル: HostController.php プロジェクト: rk4an/centreon
 /**
  * Get inheritance value
  *
  * @method get
  * @route /host/[i:id]/inheritance
  */
 public function getInheritanceAction()
 {
     $router = Di::getDefault()->get('router');
     $requestParam = $this->getParams('named');
     $inheritanceValues = HostRepository::getInheritanceValues($requestParam['id']);
     array_walk($inheritanceValues, function (&$item, $key) {
         if (false === is_null($item)) {
             $item = HostTemplateRepository::getTextValue($key, $item);
         }
     });
     $router->response()->json(array('success' => true, 'values' => $inheritanceValues));
 }
コード例 #2
0
 /**
  * Get inheritance value from a list of template
  *
  * @method post
  * @route /hosttemplate/inheritance
  */
 public function getInheritanceTmplAction()
 {
     $router = Di::getDefault()->get('router');
     $params = $this->getParams('post');
     $tmpls = $params['tmpl'];
     if (false === is_array($tmpls)) {
         $tmpls = array($tmpls);
     }
     $values = array();
     foreach ($tmpls as $tmpl) {
         if ($tmpl != "") {
             $inheritanceValues = HostTemplateRepository::getInheritanceValues($tmpl, true);
             $values = array_merge($inheritanceValues, $values);
         }
     }
     array_walk($values, function (&$item, $key) {
         if (false === is_null($item)) {
             $item = HostTemplateRepository::getTextValue($key, $item);
         }
     });
     $router->response()->json(array('success' => true, 'values' => $values));
 }
コード例 #3
0
 /**
  * Get inheritance value from a list of template
  *
  * @method post
  * @route /servicetemplate/inheritance
  */
 public function getInheritanceTmplAction()
 {
     $router = Di::getDefault()->get('router');
     $params = $this->getParams('post');
     $tmpl = $params['tmpl'];
     if ($tmpl == "") {
         $router->response()->json(array('success' => true, 'values' => array()));
     } else {
         $values = ServicetemplateRepository::getInheritanceValues($tmpl, true);
         array_walk($values, function (&$item, $key) {
             if (false === is_null($item)) {
                 $item = HostTemplateRepository::getTextValue($key, $item);
             }
         });
         $router->response()->json(array('success' => true, 'values' => $values));
     }
 }