/** * Edits the region information * @return */ function RegionChange() { $db =& $this->db; $user =& $this->user; // ajax request handler $response = new ResponseManager(); // Vars $layoutid = Kit::GetParam('layoutid', _REQUEST, _INT, 0); $regions = Kit::GetParam('regions', _POST, _HTMLSTRING); if ($regions == '') { trigger_error(__('No regions present')); } $regions = json_decode($regions); foreach ($regions as $region) { $regionid = Kit::ValidateParam($region->regionid, _STRING); $top = Kit::ValidateParam($region->top, _DOUBLE); $left = Kit::ValidateParam($region->left, _DOUBLE); $width = Kit::ValidateParam($region->width, _DOUBLE); $height = Kit::ValidateParam($region->height, _DOUBLE); Debug::LogEntry('audit', 'Editing Region ' . $regionid); // Remove the "px" from them $width = str_replace("px", '', $width); $height = str_replace("px", '', $height); $top = str_replace("px", '', $top); $left = str_replace("px", '', $left); Kit::ClassLoader('region'); $regionObject = new region($db); $ownerId = $regionObject->GetOwnerId($layoutid, $regionid); $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutid, $regionid, true); if (!$regionAuth->del) { trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR); } if (!$regionObject->EditRegion($layoutid, $regionid, $width, $height, $top, $left)) { trigger_error($regionObject->GetErrorMessage(), E_USER_ERROR); } } $response->SetFormSubmitResponse(''); $response->hideMessage = true; $response->Respond(); }