function addLink($from_struct, $from_object, $to_struct, $to_object) { // <object name="Heater control" id="3" type="linkFrom">T24 45</object> global $error; // Not possible to link to smae structure if ($from_struct == $to_struct) { return; } //echo("Create link: $from_struct,$from_object,$to_struct,$to_object<br>"); if ($from_struct && $from_object && $to_struct && $to_object) { $object_name_from = getObjectName($from_struct, $from_object); $object_name_to = getObjectName($to_struct, $to_object); //$lid = createNode('generate',$from_struct,$from_object,$object_name_from,$from_object,'linkFrom'); createNode($from_struct, $from_object, $to_struct, $to_object, 'linkOut'); $value = $to_struct . " " . $object_name_to . " " . $to_object; setNodeValue($from_struct, $from_object, 'type', 'linkFrom', $value); // echo("new lid = $lid<br>"); createNode($to_struct, $to_object, $from_struct, $from_object, 'linkIn'); $value = $from_struct . " " . $object_name_from . " " . $from_object; setNodeValue($to_struct, $to_object, 'type', 'linkTo', $value); } else { echo "Unable to create link: {$from_struct},{$from_object},{$to_struct},{$to_object}"; } }
function setObjectFile($db, $object_id, $value) { //echo("$db,$object_id,'type','file',$value"); setNodeValue($db, $object_id, 'type', 'file', $value); }