SetCommonFooter($tpl); $tpl->setVariable("ITEM_ID", $itemId); $tpl->setVariable("UNIT_ID", $itemInfos["UnitId"]); $tpl->setVariable("ITEM_NAME", $itemInfos["Name"]); $baseclass = trim(substr($itemInfos["Name"], 0, strpos($itemInfos["Name"], "."))); // Assign data to the various variables $tpl->setVariable("SUMMARY", EncodeString(UnescapeCharsFromMySQL($itemInfos["Summary"]))); $tpl->setVariable("PARAMETERS", UnescapeCharsFromMySQL($itemInfos["Parameters"])); $tpl->setVariable("RETURN_VALUE", UnescapeCharsFromMySQL($itemInfos["ReturnValue"])); $tpl->setVariable("DESCRIPTION", EncodeString(UnescapeCharsFromMySQL($itemInfos["Description"]))); $tpl->setVariable("EXTRAS", UnescapeCharsFromMySQL($itemInfos["Extras"])); $tpl->setVariable("SEE_ALSO_LIST", UnescapeCharsFromMySQL($itemInfos["SeeAlsoList"])); $tpl->setVariable("JVCL_INFO", UnescapeCharsFromMySQL($itemInfos["JVCLInfo"])); // Set values from the original item (if any) if ($originalItemId > 0) { $originalItemInfos = GetItemInfos($originalItemId); $baseclass = trim(substr($originalItemInfos["Name"], 0, strpos($originalItemInfos["Name"], "."))); $tpl->setVariable("ORIGINAL_ITEM_ID", $originalItemId); $tpl->setVariable("ORIGINAL_ITEM_NAME", $originalItemInfos["Name"]); $tpl->setVariable("ORIGINAL_SUMMARY", EncodeString(FormatEndLines($originalItemInfos["Summary"]))); $tpl->setVariable("ORIGINAL_PARAMETERS", FormatEndLines($originalItemInfos["Parameters"])); $tpl->setVariable("ORIGINAL_RETURN_VALUE", FormatEndLines($originalItemInfos["ReturnValue"])); $tpl->setVariable("ORIGINAL_DESCRIPTION", EncodeString(FormatEndLines($originalItemInfos["Description"]))); $tpl->setVariable("ORIGINAL_EXTRAS", FormatEndLines(ProcessExtras($originalItemInfos["Extras"], $baseclass))); // build the see also information $seeAlsoList = ""; if ($originalItemInfos["SeeAlsoInternal"] != "") { // start with the internal: the value in the DB is a comma separated list // of IDs, so we get the required infos from the database $sa_items = GetListOfItems($originalItemInfos["SeeAlsoInternal"]); foreach ($sa_items as $sa_item) {
$value = str_replace("\"", """, $value); return $value; } StartAccessToDB(); if (array_key_exists("edit", $_GET)) { $edit = $_GET["edit"] == 1; } else { $edit = false; } if (array_key_exists("Id", $_GET)) { $itemId = $_GET["Id"]; } else { $itemId = ""; } if (is_numeric($itemId)) { $itemInfos = GetItemInfos($_GET["Id"]); if (!is_array($itemInfos)) { if ($itemInfos == "") { echo "Item {$itemId} does not exist in the database"; } else { echo $itemInfos; } exit; } $unitInfos = GetUnitInfos($itemInfos["UnitId"]); } else { $itemInfos = array(); $unitInfos = array(); if (!$edit) { // we may have a name here, so that the user can access an item directly if (array_key_exists("Name", $_GET)) {
if (is_string($itemsByName)) { $msg = $itemsByName; EndAccessToDB(); break; } $externalItems = GetExternalItemsOrderedByName(); if (is_string($externalItems)) { $msg = $externalItems; EndAccessToDB(); break; } $NumItems = 0; // Now process all the items that have undefined See Alsos if (is_array($undefSAItemsIDs)) { while (count($undefSAItemsIDs) > 0 && $NumItems < ITEMS_PER_ITERATION) { $undefSAItem = GetItemInfos($undefSAItemsIDs[0]); if (is_string($undefSAItem)) { $msg = $undefSAItem; EndAccessToDB(); break; } $undefs = ""; $internals = ""; $externals = ""; $baseclass = trim(substr($undefSAItem["Name"], 0, strpos($undefSAItem["Name"], "."))); $SeeAlsos = explode(",", $undefSAItem["SeeAlsoUndefined"]); foreach ($SeeAlsos as $SeeAlso) { // try to find the see also in the external list $item = BinarySearchColumnCompare($externalItems, trim($SeeAlso), "Name"); if (is_array($item)) { $externals .= "," . $item["Id"];