Location: PHPKode > projects > Athena Research Assistant > athena-dev-0.1pre-alpha/objects/showPROJECTS.php
<?php

//SET PAGE NUMBER
include("../includes/setPAGEnumber.inc.php");

	if ($_SESSION["ADMINISTRATE"] == 1){	//SHOW ALL PROJECTS (ADMIN MODE)
		$getUSERSprojects = mysql_query("SELECT * FROM ath_projects");
		
		if (!$getUSERSprojects){
			echo("<p class=\"red\">getUSERSprojects failed in viewPROJECTS.php</p>");
			echo(mysql_error());
			exit();
		}
	}
	else{	//SHOW ONLY projects IN THE GROUP
		$THISuserGROUPID = $_SESSION["userGROUPID"];
		$getUSERSprojects = mysql_query("SELECT * FROM ath_projects WHERE ath_projects_groupID=$THISuserGROUPID");
		
		if (!$getUSERSprojects){
			echo("<p class=\"red\">getUSERSprojects failed in viewPROJECTS.php</p>");
			echo(mysql_error());
			exit();
		}
	}
	
		//BEGIN SHOW PROJECTS
		echo("<table width=\"650\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">");
		
		echo("<tr>");
		echo("<td bgcolor=\"#C0C0C0\" class=\"16pix\" height=\"15\">");
		echo("<b>My projects overview</b>");
		echo("</td>");
		echo("</tr>");
		
		//SHOW PAGE NUMBERS
		//showPAGEnumbers($LIMIT, $page, $userGROUPID, $db, $where, $action)
		showPAGEnumbers($LIMIT, $page, $_SESSION["userGROUPID"], 'ath_projects', 'ath_projects_groupID', 'viewprojects');
		
		
		while ($ROWgetUSERSprojects = mysql_fetch_array($getUSERSprojects)){
			echo("<tr>");
				echo("<td>");
			
					//PRINT PROJECTS
					echo(	"<b><a href=\"#\">" . 
							stripslashes($ROWgetUSERSprojects["ath_projects_name"]) . "</a></b> &gt;&gt;&gt; <i>" . 
							stripslashes($ROWgetUSERSprojects["ath_projects_shortdesc"]) . "</i>");
		
					//GET RESORCES ATTECHED TO THE PROJECT
					$projectID = $ROWgetUSERSprojects["ath_projects_id"];
					$getRESOURCES = mysql_query("SELECT * FROM ath_resrc WHERE ath_resrc_WITHproject=$projectID ORDER BY ath_resrc_authorLAST ASC");
			
					if (!$getRESOURCES){
						echo("<p class=\"red\">getRESOURCES failed in viewPROJECTS.php</p>");
						echo(mysql_error());
						exit();
					}
					else{
						echo("<ul>"); //START LIST
					}
					
					//PRINT RESOURCES IN A LIST
					while ($ROWgetRESOURCES = mysql_fetch_array($getRESOURCES)){
						echo(	"<li>" . 
								stripslashes($ROWgetRESOURCES["ath_resrc_authorLAST"]) . ", " . stripslashes($ROWgetRESOURCES["ath_resrc_authorFIRST"]) . ": <i>" .
								"<a href=\"main.php?menu=viewresrc&act=details&valign=top&type=res&id=" . $ROWgetRESOURCES["ath_resrc_id"] . "\">" . 
								stripslashes($ROWgetRESOURCES["ath_resrc_title"]) . "</a></i>");
					}
					
					if ($getRESOURCES){ //END LIST
						echo("</ul><hr>");	
					}
			
				echo("</td>");
			echo("</tr>");
		}
		echo("</table>");
?>
Return current item: Athena Research Assistant