/** * Retrieves the raw new property data from a portal request and submit it * to the service group layer's property functions. * @param \User $user current user * @return null */ function submit(\User $user = null) { $newValues = getSerGroupPropDataFromWeb(); $serviceGroupID = $newValues['SERVICEGROUPPROPERTIES']['SERVICEGROUP']; if ($newValues['SERVICEGROUPPROPERTIES']['NAME'] == null || $newValues['SERVICEGROUPPROPERTIES']['VALUE'] == null) { show_view('error.php', "A property name and value must be provided."); die; } $serv = \Factory::getServiceGroupService(); $sp = $serv->addProperty($newValues, $user); show_view("service_group/added_service_group_property.php", $serviceGroupID); }
/** * Processes an edit service group property request from a web request * @param \User $user current user * return null */ function submit(\User $user = null) { try { $newValues = getSerGroupPropDataFromWeb(); $serviceGroupID = $newValues['SERVICEGROUPPROPERTIES']['SERVICEGROUP']; $propID = $newValues['SERVICEGROUPPROPERTIES']['PROP']; if ($newValues['SERVICEGROUPPROPERTIES']['NAME'] == null || $newValues['SERVICEGROUPPROPERTIES']['VALUE'] == null) { show_view('error.php', "A property name and value must be provided."); die; } $property = \Factory::getServiceGroupService()->getProperty($propID); $serviceGroup = \Factory::getServiceGroupService()->getServiceGroup($serviceGroupID); $serviceGroup = \Factory::getServiceGroupService()->editServiceGroupProperty($serviceGroup, $user, $property, $newValues); $params['serviceGroupId'] = $serviceGroupID; show_view('service_group/service_group_property_updated.php', $params); } catch (Exception $e) { show_view('error.php', $e->getMessage()); die; } }