Location: PHPKode > projects > NCD Toolkit > ncdtoolkit1.2/ncd/browse_person.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 = "browse";
?>
<!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 - Browse persons</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
	{*/

		echo "<h1>Browse persons</h1>\n";
		echo "<p>Browse through all persons in the NCD toolkit.</p>";
		
		$switch_name = "institutions";
		$switch_url = "browse_person.php?";
		include ("language_switch.inc.php");

		$select = "SELECT DISTINCT t1.ID, t1.Title, t1.GivenNames, t1.OtherNames, t1.FamilyName, ".
				  "IF (t3.Name IS NULL OR t3.Name = '', 1, 0) AS empty ";
		$from = "FROM Persons t1 ";
		$join = "LEFT JOIN PersonToInstitutions t2 ON t1.ID = t2.PersonID ".
				"LEFT JOIN InstitutionDataByLanguage t3 ON t3.InstitutionID = t2.InstitutionID AND t3.LanguageID = '$mdb_lang_id' ";

		// sort
		if (isset($_GET["sort"])) {
			$sort = $_GET["sort"];
			$_SESSION["sort"] = $sort;
		} else if (isset($_SESSION["sort"])) {
			$sort = $_SESSION["sort"];
		} else {
			$sort = 1;
		}
		
		if ($sort == 1) {
			$order = "ORDER BY LOWER(t1.FamilyName), LOWER(t1.GivenNames) ";
		} else if ($sort == 2) {
			$order = "ORDER BY LOWER(t1.FamilyName) DESC, LOWER(t1.GivenNames) DESC ";
		} else if ($sort == 3) {
			$order = "ORDER BY empty, LOWER(t3.Name), LOWER(t1.FamilyName), LOWER(t1.GivenNames) ";
		} else if ($sort == 4) {
			$order = "ORDER BY LOWER(t3.Name) DESC, LOWER(t1.FamilyName) DESC, LOWER(t1.GivenNames) DESC ";
		}

		$limit = "LIMIT ".(int) $start.", $max_per_page";
		$query = str_replace("*", "%", $select.$from.$join.$order.$limit);
		show_results($query, "browse_person", "person_detail");
			
	// }
?>


</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