Location: PHPKode > projects > NCD Toolkit > ncdtoolkit1.2/ncd/organisation_detail.php
<?php
	session_start();
	require_once ("connect.inc.php");
	require_once ("library.inc.php");
	require_once ("authentification.inc.php");
	require_once ("language.inc.php");
	require_once ("search_variables.inc.php");

	$menu = substr($_SESSION["result_url"], 0, strpos($_SESSION["result_url"], "_"));
	$id = $_GET["id"];
	
	$switch_name = "institution data and collections";
	if (isset($_GET["back"]))
		$switch_url = "organisation_detail.php?back=".stripslashes(urldecode($_GET["back"]))."&amp;id=$id&amp;";
	else
		$switch_url = "organisation_detail.php?id=$id&amp;";
	include ("language_switch.inc.php");

	$test = mysql_query("SELECT ID FROM Institutions WHERE id = '$id'");
	if (mysql_num_rows($test) == 1) {
		$query = "SELECT * FROM Institutions WHERE ID = $id";
		$result = mysql_query($query);
		while($row = mysql_fetch_array($result))
		{
			$parentid = $row["ParentInstitutionID"];
			$postalstreet = str_replace("\"", "&quot;", $row["Street"]);
			$postalpostbox = str_replace("\"", "&quot;", $row["Pobox"]);
			$postaladdressext = str_replace("\"", "&quot;", $row["Extadd"]);
			$postalzip = str_replace("\"", "&quot;", $row["Pcode"]);
			$postallocality = str_replace("\"", "&quot;", $row["Locality"]);
			$postalregion = str_replace("\"", "&quot;", $row["Region"]);
			$country_id = str_replace("\"", "&quot;", $row["CountryID"]);
			$visitorstreet = str_replace("\"", "&quot;", $row["VisitorStreet"]);
			$visitoraddressext = str_replace("\"", "&quot;", $row["VisitorExtadd"]);
			$visitorzip = str_replace("\"", "&quot;", $row["VisitorPcode"]);
			$visitortown = str_replace("\"", "&quot;", $row["VisitorLocality"]);
			$visitorregion = str_replace("\"", "&quot;", $row["VisitorRegion"]);
			$telephone = str_replace("\"", "&quot;", $row["Telephone"]);
			$fax = str_replace("\"", "&quot;", $row["Fax"]);
			$email = str_replace("\"", "&quot;", $row["Email"]);
			$logourl = str_replace("\"", "&quot;", $row["LogoURL"]);
			$websiteurl = str_replace("\"", "&quot;", $row["WebsiteURL"]);
			$organisation_access_rights = str_replace("\"", "&quot;", $row["AccessRights"]);
			$organisation_rights = str_replace("\"", "&quot;", $row["Rights"]);
			$organisation_usage_restrictions = str_replace("\"", "&quot;", $row["UsageRestrictions"]);
		}

		$query = "SELECT Name, SubUnitName, Description FROM InstitutionDataByLanguage WHERE InstitutionID = $id AND LanguageID = '$mdb_lang_id'";
		$row = mysql_fetch_array(mysql_query($query));
		$subunit = str_replace("\"", "&quot;", $row["SubUnitName"]);
		$name = str_replace("\"", "&quot;", $row["Name"]);
		$abstract = str_replace("\"", "&quot;", $row["Description"]);
		
		$acronyms = "";
		$query = "SELECT AcronymOrCoden FROM InstitutionAcronyms WHERE InstitutionID = $id ORDER BY ID";
		$result = mysql_query($query);
		while($row = mysql_fetch_array($result))
		{
			$selected_acronym = str_replace("\"", "&quot;", $row["AcronymOrCoden"]);
			if ($acronyms == "")
				$acronyms = $selected_acronym;
			else
				$acronyms .= ", ".$selected_acronym;
		}
	
		$organisation_types = "";
		$query = "SELECT t2.InstitutionType FROM InstitutionTypeToInstitution t1, InstitutionTypes t2 WHERE t1.InstitutionID = $id AND t1.InstitutionTypeID = t2.ID ORDER BY t2.InstitutionType";
		$result = mysql_query($query);
		while($row = mysql_fetch_array($result))
		{
			$selected_institution_type = str_replace("\"", "&quot;", $row["InstitutionType"]);
			if ($organisation_types == "")
				$organisation_types = $selected_institution_type;
			else
				$organisation_types .= ", ".$selected_institution_type;
		}
		
		if ($parentid != "" && $parentid != 0) {
			$query = "SELECT Name, SubUnitName FROM InstitutionDataByLanguage WHERE InstitutionID = $parentid AND LanguageID = '$mdb_lang_id'";
			$result = mysql_query($query);
			while($row = mysql_fetch_array($result)) {
				$parent_name = str_replace("\"", "&quot;", $row["Name"]);
				$parent_subunit = str_replace("\"", "&quot;", $row["SubUnitName"]);
			}				
			if ($parent_subunit != "")
				$parent_name .= " - $parent_subunit";
		} else {
			$parent_name = "No parent institution";
		}
		
		$collections = "";
		$query = "SELECT t2.CollectionID, t2.Title, t2.AlternativeTitle FROM CollectionsToInstitutions t1, CollectionDataByLanguage t2 WHERE t1.CollectionId = t2.CollectionID AND t1.InstitutionID = $id AND t2.LanguageID = '$mdb_lang_id' ORDER BY t2.Title";
		$result = mysql_query($query);
		while($row = mysql_fetch_array($result)) {
			$collection_id = $row["CollectionID"];
			$collections .= "<tr><td></td><td><a href=\"collection_detail.php?id=$collection_id&amp;back=".urlencode($name)."\">".$row["Title"];
			if ($row["AlternativeTitle"] != "")
				$collections .= " - ".$row["AlternativeTitle"];
			$collections .= "</a></td></tr>\n";
		}
	
		$persons = "";
		$query = "SELECT t2.ID, t2.Title, t2.GivenNames, t2.OtherNames, t2.FamilyName FROM PersonToInstitutions t1, Persons t2 WHERE t1.PersonID = t2.ID AND t1.InstitutionID = $id ORDER BY t2.FamilyName, t2.GivenNames";
		$result = mysql_query($query);
		while($row = mysql_fetch_array($result)) {
			$personid = $row["ID"];
			$title = $row["Title"];
			$first_name = $row["GivenNames"];
			$other_name = $row["OtherNames"];
			$last_name = $row["FamilyName"];
			
			$persons .= "<tr><td></td><td><a href=\"person_detail.php?id=$personid&amp;back=".urlencode($name)."\">";
			if ($title != "")
				$persons .= $title." ";
			$persons .= $first_name." ";
			if ($other_name != "")
				$persons .= $other_name." ";
			$persons .= $last_name;
			$persons .= "</a></td></tr>\n";
		}
	}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <link href="ncd.css" rel="stylesheet" media="screen" type="text/css">
  <script type="text/javascript" src="library.js"></script>

  <title>NCD toolkit - Details for <?php echo $name; ?></title>
</head>
<body>
<div id="main_container">
<div id="banner"><?php include("banner.inc.php"); ?></div>
<div id="content_container">
<div id="content">

<?php
	/*if ($auth != "authenticated")
		include ("login.inc.php");
	else
	{*/

		// Check if id is valid institution id
		if (mysql_num_rows($test) == 1) {
			echo "<h1>Details for $name</h1>\n";
			if (isset($_GET["back"]))
				echo "<p>Click 'Back' at the bottom of this page to return to ".stripslashes(urldecode($_GET["back"])).".</p>\n<br>\n";
			else 
				echo "<p>You can browse through the results by using the &lt;&lt; and &gt;&gt; buttons.</p>\n<br>\n";
		
			echo "<br>\n<table class=\"summary_table\" width=\"700\">\n";
			echo "<tr><td class=\"label\"></td><td height=\"40\" class=\"title\">Name</td></tr>\n";
			echo "<tr><td class=\"label\" width=\"150\">Name</td><td>$name</td></tr>\n";
			echo "<tr><td class=\"label\">Subunit name</td><td>$subunitk</td></tr>\n";
			echo "<tr><td class=\"label\">Acronym(s)</td><td>$acronym</td></tr>\n";
		
			echo "<tr><td class=\"label\"></td><td height=\"40\" class=\"title\">Address</td></tr>\n";
			echo "<tr><td class=\"label\">Street</td><td>$postalstreet</td></tr>\n";
			echo "<tr><td class=\"label\">Address extension</td><td>$postaladdressext</td></tr>\n";
			echo "<tr><td class=\"label\">Postbox</td><td>$postalpostbox</td></tr>\n";
			echo "<tr><td class=\"label\">Postal code</td><td>$postalzip</td></tr>\n";
			echo "<tr><td class=\"label\">City</td><td>$postallocality</td></tr>\n";
			echo "<tr><td class=\"label\">State/region</td><td>$postalregion</td></tr>\n";
			echo "<tr><td class=\"label\">Country</td><td>";
			echo_country($country_id);
			echo "</td></tr>\n";
		
			echo "<tr><td class=\"label\"></td><td height=\"40\" class=\"title\">Visitor address</td></tr>\n";
			echo "<tr><td class=\"label\">Street</td><td>$visitorstreet</td></tr>\n";
			echo "<tr><td class=\"label\">Address extension</td><td>$visitoraddressext</td></tr>\n";
			echo "<tr><td class=\"label\">Postal code</td><td>$visitorzip</td></tr>\n";
			echo "<tr><td class=\"label\">City</td><td>$visitortown</td></tr>\n";
			echo "<tr><td class=\"label\">State/region</td><td>$visitorregion</td></tr>\n";
		
			echo "<tr><td class=\"label\"></td><td height=\"40\" class=\"title\">Contact details</td></tr>\n";
			echo "<tr><td class=\"label\">Telephone</td><td>$telephone</td></tr>\n";
			echo "<tr><td class=\"label\">Fax</td><td>$fax</td></tr>\n";
			echo "<tr><td class=\"label\">General email address</td><td>$email</td></tr>\n";
			echo "<tr><td class=\"label\">Logo URL</td><td>";
			if ($logourl != "")
				echo "<img src=\"$logourl\">";
			echo "</td></tr>\n";
			echo "<tr><td class=\"label\">Web site URL</td><td>";
		
			if ($websiteurl != "" && $websiteurl != "http://")
				echo "<a href=\"$websiteurl\" target=\"_blank\">$websiteurl</a>";
		
			echo "</td></tr>\n";
			echo "<tr><td></td><td height=\"40\" class=\"title\">Description</td></tr>\n";
			echo "<tr><td class=\"label\">Description</td><td>".str_replace("\n", "<br>", $abstract)."</td></tr>\n";
		
			echo "<tr><td></td><td height=\"40\" class=\"title\">Selected institution types</td></tr>\n";
			echo "<tr><td></td><td>$organisation_types</td></tr>\n";
			echo "<tr><td></td><td height=\"45\" class=\"title\">Rights</td></tr>\n";
			echo "<tr><td class=\"label\">Collection rights</td><td>".str_replace("\n", "<br>", $organisation_rights)."</td></tr>\n";
			echo "<tr><td class=\"label\">Access rights</td><td>".str_replace("\n", "<br>", $organisation_access_rights)."</td></tr>\n";
			echo "<tr><td class=\"label\">Usage restrictions</td><td>".str_replace("\n", "<br>", $organisation_usage_restrictions)."</td></tr>\n";
			echo "<tr><td></td><td height=\"40\" class=\"title\">Related to</td></tr>\n";
			if($parent_name != "No parent institution"){
				echo "<tr><td></td><td><a href=\"organisation_detail.php?id=$parentid\">$parent_name</a></td></tr>";
			}else{
				echo "<tr><td></td><td>$parent_name</td></tr>";
			}
			if ($collections != "") {
				echo "<tr><td></td><td height=\"75\" class=\"title\">Collections</td></tr>\n".$collections;
			}
			
			if ($persons != "") {
				echo "<tr><td></td><td height=\"75\" class=\"title\">Persons</td></tr>\n".$persons;
			}
		
			navigatie($id, "organisation_detail");

			echo "</table>";
		} else {
			echo "<h1>Institution details</h1>\n";
			echo "<p>An error has occurred, please <a href=\"".$menu."_organisation.php\">return to the $menu page</a>.</p>\n";
		}
	// }
?>


</div>
</div>
<div id="menu"><?php include("menu.inc.php"); ?></div>
<div id="footer"><?php include("footer.inc.php"); ?></div>
</div>
<div id="infotextbox" style="visibility: hidden; left: 0px; top: 0px;"></div>
</body>
</html>
Return current item: NCD Toolkit