"ge:Hier der Titel", "Author"=>"Hier der Autor")); echo $objrec."\n"; $objrec .= "\nTitle=en:Here the title"; echo "Add another title and convert it back to an object array\n"; $objarr = hw_objrec2array($objrec); list_attr($objarr); } if($test_4 == "yes") { echo "TEST 4 ----------------------------------------------\n"; echo "Get the object array of document with id 0x".dechex($id)."\n"; $objrec = hw_getobject($connect, $id); if(hw_error($connect)) { echo "ERROR: ".hw_errormsg($connect)."\n"; exit; } $objarr = hw_objrec2array($objrec); list_attr($objarr); } if($test_5 == "yes") { echo "TEST 5 ----------------------------------------------\n"; echo "List the children of collection 0x".dechex($collid)."\n"; $children = hw_childrenobj($connect, $collid); if(hw_error($connect)) { echo "ERROR: ".hw_errormsg($connect)."\n"; exit; } $c_children = count($children) - 1; for($i=0; $i<$c_children; $i++) { $objarr = hw_objrec2array($children[$i]); list_attr($objarr); } list_attr($children[$c_children]); } if($test_6 == "yes") { echo "TEST 6 ----------------------------------------------\n"; echo "List the parents of object 0x".dechex($id)."\n"; $parents = hw_getparentsobj($connect, $collid); if(hw_error($connect)) { echo "ERROR: ".hw_errormsg($connect)."\n"; exit; } $c_parents = count($parents) - 1; for($i=0; $i<$c_parents; $i++) { $objarr = hw_objrec2array($parents[$i]); list_attr($objarr); } list_attr($parents[$c_parents]); } if($test_7 == "yes") { echo "TEST 7 ----------------------------------------------\n"; echo "Inserting a new text document into 0x".dechex($collid)."\n"; $objrec = "Type=Document\nDocumentType=text\nName=HWTest\nTitle=en:Component\nMimeType=text/plain\nAuthor=".$username; $contents = "Ein bischen Text"; $doc = hw_new_document($objrec, $contents, strlen($contents)+1); $objid = hw_insertdocument($connect, $collid, $doc); if(hw_error($connect)) { echo "ERROR: ".hw_errormsg($connect)."\n"; exit; } $objrec = hw_getobject($connect, $objid); if(hw_error($connect)) { echo "ERROR: ".hw_errormsg($connect)."\n"; exit; } $objarr = hw_objrec2array($objrec); list_attr($objarr); } if($test_8 == "yes") { echo "TEST 8 ----------------------------------------------\n"; echo "Removing text document just inserted\n"; $kk[0] = (int) $objid; hw_mv($connect, $kk, $collid, 0); if(hw_error($connect)) { echo "ERROR: ".hw_errormsg($connect)."\n"; exit; } echo "If the document was really deleted you should see an error now\n"; $objrec = hw_getobject($connect, $objid); if(hw_error($connect)) { echo "ERROR: ".hw_errormsg($connect)."\n"; } else { $objarr = hw_objrec2array($objrec); list_attr($objarr); } } if($test_9 == "yes") { echo "TEST 9 ----------------------------------------------\n"; echo "Searching for objects with $query\n"; $objrecs = hw_getobjectbyqueryobj($connect, $query, -1); $c_objrecs = count($objrecs) - 1; echo "$c_objrecs found\n"; for($i=0; $i<$c_objrecs; $i++) { $objarr = hw_objrec2array($objrecs[$i]); list_attr($objarr); } list_attr($objrecs[$c_objrecs]); } if($test_10 == "yes") { $anchors = hw_getanchorsobj($connect, $id); $countanchors = count($anchors) - 1; echo "$countanchors Anchors of Object $id\n"; for($i=0; $i<$countanchors; $i++) { $arr = hw_objrec2array($anchors[$i]); list_attr($arr); } } if($test_11 == "yes") { $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt"); hw_output_document($doc); } if($test_12 == "yes") { $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt"); hw_insertanchors($doc, array("Position=0x2 0x7\nObjectID=0x3\nTAnchor=Src\nDest=0x5"), array("ObjectID=0x5\nName=DestDoc")); hw_output_document($doc); } hw_close($connect); ?>