/** * 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)); }
/** * 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)); }
/** * 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)); } }