Location: PHPKode > projects > Athena Research Assistant > athena-dev-0.1pre-alpha/includes/show_resources.inc.php
<?php
if ($checkUSER["ath_groups_ADMINISTRATE"] == 1){
	
	$GETresrc = mysql_query("SELECT * FROM ath_resrc");
	
	if (!$GETresrc){
			echo("<p class=\"red\">GETresrc failed in show_resources.inc.php");
			echo(mysql_error());
			exit();
	}
	
}
else{
	
	$thisUSERgroupID = $_SESSION["userGROUPID"];
	
	$GETresrc = mysql_query("SELECT * FROM ath_resrc WHEREƊath_resrc_ownerGROUPID=$thisUSERgroupID " .
							"ORDER BY ath_resrc_authorLAST");
	
	if (!$GETresrc){
			echo("<p class=\"red\">GETresrc failed in show_resources.inc.php");
			echo(mysql_error());
			exit();
	}
}

echo("<select name=\"WITHresrc\">");

	while ($ROWGETresrc = mysql_fetch_array($GETresrc)){
		
		//LIMIT TITLE TO 25 CHARACTERS
		if (strlen($ROWGETresrc["ath_resrc_title"]) > 25){
			$trailer = "...";
			$title = substr(convert_na_to_dash($ROWGETresrc["ath_resrc_title"]), 0, 25);
		}
		else{
			$trailer = "";
			$title = convert_na_to_dash($ROWGETresrc["ath_resrc_title"]);
		}
		
		//DECIDE IF COMMA TO SEPARATE NAMES IS NEEDED. AVOIDS CLUTTER IN MENUS WHEN NO AUTHOR NAME IS GIVEN
		if (convert_na_to_dash($ROWGETresrc["ath_resrc_authorLAST"]) == ""){
			$comma = "";
		}
		else{
			$comma = ", ";
		}
		
		//DECIDE IF SEMI-COLON TO SEPARATE THE TITLE FROM NAMES IS NEEDED. AVOIDS CLUTTER IN MENUS WHEN NO AUTHOR NAME IS GIVEN
		if (convert_na_to_dash($ROWGETresrc["ath_resrc_authorLAST"]) == "" and convert_na_to_dash($ROWGETresrc["ath_resrc_authorFIRST"]) == ""){
			$semi_colon = "";
		}
		else{
			$semi_colon = ": ";
		}
		
		//OUTPUT THE MENU
		if ($ROWGETresrc["ath_resrc_id"] == $_POST["WITHresrc"]){
			echo("<option value=\"" . $ROWGETresrc["ath_resrc_id"] . "\" selected>" . convert_na_to_dash($ROWGETresrc["ath_resrc_authorLAST"]) . $comma .  convert_na_to_dash($ROWGETresrc["ath_resrc_authorFIRST"]) . $semi_colon .  $title . $trailer . "</option>");
		}
		else{
			echo("<option value=\"" .  $ROWGETresrc["ath_resrc_id"] . "\">" .  convert_na_to_dash($ROWGETresrc["ath_resrc_authorLAST"]) . $comma .  convert_na_to_dash($ROWGETresrc["ath_resrc_authorFIRST"]) . $semi_colon .  $title . $trailer . "</option>");
		}
	}
echo("</select>");
?>
Return current item: Athena Research Assistant