";
$sql = "SELECT * from hw_objects o, hw_models m where o.model_key=m.model_key and o.object_key in (" . $ids . ") order by m.model_order";
$cnt = 0;
$result = $conn->query($sql);
$modelKey = "";
$addcells = " ";
$modelEntityId = "";
$oldModelEntityId = "";
$objectEntityId = "";
$type = "base";
$extLinks = "";
$lastRecChk = 0;
$recCnt = 0;
$modelEntityNodes = "";
$addLinks = "";
$arrows = "";
$label = "";
$array_ba[1]="";
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$recCnt++;
if ($result->num_rows == $recCnt) {
$lastRecChk = 1;
} else {
$lastRecChk = 0;
}
if ($row['URI'] != "") {
if ($extLinks == "") {
$extLinks = "
Links:
";
}
$extLinks .= "
";
}
//echo $row['model_title'].'=>'.$row['object_title'].'
';
if ($modelKey != $row['model_key']) {
$modelKey = $row['model_key'];
$modelLinkLabel = "Transformed to";
$modelTypeKey = $row['model_type_key'];
if ($recCnt > 1) {
$modelEntityNodes .= ", ";
}
if ($modelTypeKey == 6) {
$modelEntityId = 'gl' . $row['model_key'];
} else {
$modelEntityId = 'mo' . $row['model_key'];
}
if ($oldModelTypeKey == 6) {
$modelLinkLabel = "Defines";
} else {
$modelLinkLabel = "Transformed to";
}
$modelEntityNodes .= addEntityObject($modelEntityId, $row['model_desc'], 'model', $modelEntityId);
if ($recCnt > 1) {
if ($addLinks != "") {
$addLinks .= " , ";
}
$addLinks .= " {from: '$oldModelEntityId', to: '$modelEntityId', arrows:'to', color: 'black', width: 2, length: 300, label:'$modelLinkLabel'}
";
}
$oldModelEntityId = $modelEntityId;
$oldModelTypeKey = $modelTypeKey;
}
if ($mode != 'basic' || $id == $row['object_key']) {
if ($id != $row['object_key']) {
$type = 'normal';
$label = "Contains";
$arrows = "to";
} else {
$type = 'normal';
$label = "Contained in";
$arrows = "from";
$modelEntityNodes .= ", ";
$modelEntityNodes .= addEntityObject('base1', 'Start', 'base', '0');
}
$modelEntityNodes .= ", ";
$objectEntityId = 'ob' . $row['object_key'];
$modelEntityNodes .= addEntityObject($objectEntityId, $row['object_title'], $type, $modelEntityId);
if ($addLinks != "") {
$addLinks .= " , ";
}
$addLinks .= " {from: '$modelEntityId', to: '$objectEntityId',arrows:'$arrows', label:'$label'}
";
$sql_ba="SELECT * FROM `hw_mappings` m, hw_business_areas ba, hw_relationships r
where m.`mapping_master_key`=ba.business_area_key and m.`mapping_relationship_key`=r.relationship_key and
`mapping_master_type` = 'business area' and `mapping_detail_type` = 'object' and mapping_detail_key=".$row['object_key'];
$result_ba = $conn->query($sql_ba);
while ($row_ba = $result_ba->fetch_assoc()) {
$BusinessAreaId='ba'.$row_ba['business_area_key'];
if (in_array($BusinessAreaId, $array_ba)) {}else{
$array_ba[$BusinessAreaId]=$BusinessAreaId;
$modelEntityNodes .= ", ";
$modelEntityNodes .= addEntityObject($BusinessAreaId, $row_ba['business_area_title'], $row_ba['mapping_master_type'], $BusinessAreaId);
}
$addLinks .= " , ";
$addLinks .= " {from: '$objectEntityId', to: '$BusinessAreaId',arrows:'$arrows', label:'".$row_ba['reverse_relationship_title']."'}
";
}
if ($id == $row['object_key']) {
if ($addLinks != "") {
$addLinks .= " , ";
}
$addLinks .= " {from: '$objectEntityId', to: 'base1',arrows:'$arrows',length: 30, label:''}
";
}
$cnt++;
}
}
}
?>
}
$conn->close();
if ($mode == 'basic') {
echo "