// handle ajax save request (do not show the interface) $ID = @$_REQUEST['ID']; // we posted . characters, but something converts them to _ (HTTP 1.1 standard) $r = array(); foreach ($_REQUEST as $i => $v) { $r[join('.', explode('_', $i))] = $v; //convert _ back to . } $eigenschapvanrelatie = @$r['0']; $overtredingen = array(); for ($i0 = 0; isset($r['1.' . $i0]); $i0++) { $overtredingen[$i0] = @$r['1.' . $i0 . '']; } $uitleg = @$r['2']; $pattern = @$r['3']; $Rule3 = new Rule3($ID, $eigenschapvanrelatie, $overtredingen, $uitleg, $pattern); if ($Rule3->save() !== false) { die('ok:' . serviceref($_REQUEST['content']) . '&Rule3=' . urlencode($Rule3->getId())); } else { die('Please fix errors!'); } exit; // do not show the interface } $buttons = ""; if (isset($_REQUEST['new'])) { $new = true; } else { $new = false; } if (isset($_REQUEST['edit']) || $new) {
function delRule3($id) { $tobeDeleted = new Rule3($id); if ($tobeDeleted->isNew()) { return true; } // item never existed in the first place if ($tobeDeleted->del()) { return true; } else { return $tobeDeleted; } }