name = $name; } /** * creates the xml for this object and its child objects * * @param string $offset string used for formatting the output * @return string containing the xml-fragment */ function generateXml($offset = "") { $temp = $offset."name.">\n"; foreach($this->operations as $operation) { $temp .= $operation->generateXml($offset." "); } $temp .= $offset."name.">\n"; return $temp; } /** * creates the html-form-fragment for this object * * @param $id string containing a prefix that should be used to identify this * object's html fields. This must be done, so that the generateObjectFromPost(...) * function can address the fields belonging to this object in the http-post. * * @param string $offset string used for formatting the output * @return string containing the html-form-fragment */ function generateHtmlForm($id = "", $offset = "") { $temp = ""; $temp .= $offset."\n"; $temp .= $offset." \n"; $temp .= $offset." \n"; $temp .= $offset." name."\">\n"; $temp .= $offset." ".$this->name."
\n"; $number = split("_", $id); $number = $number[count($number)-1]; $temp .= $offset." parent."&number=".$number."\">"; $temp .= " löschen\n"; $temp .= $offset." \n"; $temp .= $offset." \n"; $temp .= $offset." \n"; $displayOperationModule = new DisplayOperationModule(); $temp .= $displayOperationModule->generateHtmlForm($offset." ", $this->operations, $id); if(count($this->operations) == 1) { $temp .= $offset."\n"; $temp .= $offset." \n"; $temp .= $offset."\n"; } //Only 2 Operations //if (count($this->operations) < 2) // why should there be only 2 operations? Nothing in the specs ... $temp .= $offset."\n"; $temp .= $offset." \n"; $temp .= $offset."\n"; $temp .= $offset."
\n"; $temp .= $offset."
\n"; $temp .= $offset."
\n"; $addOperationModule = new AddOperationModule($this->id, $id); $temp .= $addOperationModule->generateHtmlForm($offset." "); $temp .= $offset."
\n"; $temp .= $offset." \n"; $temp .= $offset."\n"; return $temp; } /** * populates the member fields of a new object from the data in the http-post-request * to rebuild the object after the submission of the html-form. * * creates its own child objects from the post parameters and calls their * generateObjectFromPost(...) function * * @param string $id string that contains a prefix for the html-form-fields * that is common to all of the fields belonging to this object */ function generateObjectFromPost($id = "") { $this->name = $_REQUEST[$id."_name"]; $countOperations = 0; while (isset($_REQUEST[$id."_operation_".$countOperations])) { if ($_REQUEST[$id."_operation_".$countOperations] == "binaryComparisonOp") { $operation = new BinaryComparisonOp(); } if ($_REQUEST[$id."_operation_".$countOperations] == "binaryLogicOp") { $operation = new BinaryLogicOp(); } if ($_REQUEST[$id."_operation_".$countOperations] == "unaryLogicOp") { $operation = new UnaryLogicOp(); } if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsLike") { $operation = new PropertyIsLike(); } if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsNull") { $operation = new PropertyIsNull(); } if ($_REQUEST[$id."_operation_".$countOperations] == "propertyIsBetween") { $operation = new PropertyIsBetween(); } $operation->generateObjectFromPost($id."_operation_".$countOperations); $this->operations[] = $operation; $countOperations++; } } /** * deletes the rule with the given index from the $operations array * @param int $index index of the operation that has to be deleted */ function deleteOperation($index) { array_splice($this->operations, $index, 1); } } ?>