<?php
//THIS OBJECT WILL SHOW A LIST OF RESOURCES AND UP RO 5 NOTES ATTACHED TO IT
//TO VIEW ALL THE NOTES THE USER MUST GO INTO DETAILS VIEW
//SET PAGE NUMBER
include("../includes/setPAGEnumber.inc.php");
//SET GROUP ID LOCALLY
$THISuserGROUPID = $_SESSION["userGROUPID"];
echo("<table width=\"650\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">");
echo("<tr>");
echo("<td bgcolor=\"#C0C0C0\" class=\"16pix\" height=\"15\">");
echo("<b>My resources overview</b>");
echo("</td>");
echo("</tr>");
if ($_SESSION["ADMINISTRATE"] == 1){
//SHOW ALL PROJECTS
$getUSERSresrc = mysql_query("SELECT * FROM ath_resrc LIMIT $start, $LIMIT");
//REPORT ERRORS
if (!$getUSERSresrc){
echo("<p class=\"red\">getUSERSresrc failed in objects/showRESRC.php</p>");
echo(mysql_error());
exit();
}
}
else{
//SHOW ONLY RESOURCES IN THE GROUP
$getUSERSresrc = mysql_query("SELECT * FROM ath_resrc WHERE ath_resrc_ownerGROUPID=$THISuserGROUPID LIMIT $start, $LIMIT");
//REPORT ERRORS
if (!$getUSERSresrc){
echo("<p class=\"red\">getUSERSresrc failed in objects/showRESRC.php</p>");
echo(mysql_error());
exit();
}
}
//SHOW PAGE NUMBERS
//showPAGEnumbers($LIMIT, $page, $userGROUPID, $db, $where, $action)
showPAGEnumbers($LIMIT, $page, $_SESSION["userGROUPID"], 'ath_resrc', 'ath_resrc_ownerGROUPID', 'viewresrc');
while ($ROWgetUSERSresrc = mysql_fetch_array($getUSERSresrc)){
echo("<tr>");
echo("<td>");
//IF FIRST OR LAST EMPTY GET RID OF THE COMMA
if (convert_na_to_dash($ROWgetUSERSresrc["ath_resrc_authorLAST"]) == ""){
$comma = "";
}
else{
$comma = ", ";
}
//IF FIRST OR LAST EMPTY GET RID OF THE COMMA
if (convert_na_to_dash($ROWgetUSERSresrc["ath_resrc_authorFIRST"]) == "" and convert_na_to_dash($ROWgetUSERSresrc["ath_resrc_authorFIRST"]) == ""){
$dot = "";
}
else{
$dot = ".";
}
$first = convert_na_to_dash($ROWgetUSERSresrc["ath_resrc_authorFIRST"]);
$last = convert_na_to_dash($ROWgetUSERSresrc["ath_resrc_authorLAST"]);
//SHOW RESOURCE LINK/INFO
if ($ALLOWEDIT == 1){
echo( //"<a href=\"#\" onClick=\"openwinSMALL('../objects/showSINGLEresrc.php?id=" . $ROWgetUSERSresrc["ath_resrc_id"] . "', 'popNote" . $ROWgetUSERSresrc["ath_resrc_id"] . "', 300, 300);\" class=\"edits\">" . $OPEN . "</a> " .
"<a href=\"#\" onClick=\"openwinSMALL('../objects/editSINGLE.php?type=resrc&id=" . $ROWgetUSERSresrc["ath_resrc_id"] . "', 'popNote" . $ROWgetUSERSresrc["ath_resrc_id"] . "', 300, 300);\" class=\"edits\">" . $EDIT . "</a> ");
}
echo( "<b>" .
$first .
$comma . $last .
$dot . "</b> <i>" .
"<a href=\"main.php?menu=viewresrc&act=details&valign=top&type=res&id=" . $ROWgetUSERSresrc["ath_resrc_id"] . "\">" .
$ROWgetUSERSresrc["ath_resrc_title"] . "</i>.</a><br>");
//GET NOTES BELONGING TO RESPECTIVE PROJECTS
$noteownerGROUPID = $ROWgetUSERSresrc["ath_resrc_id"];
$getNOTES = mysql_query("SELECT * FROM ath_notes WHERE ath_notes_resourceID=$noteownerGROUPID");
if (!$getNOTES){
echo("<p class=\"red\">getNOTES failed in viewresrc.php</p>");
echo(mysql_error());
exit();
}
else{
//OPEN LIST
echo("<ul>");
}
//PRINT NOTES
while ($ROWgetNOTES = mysql_fetch_array($getNOTES)){
//SHOW NOTE INFO
echo(" <li>");
if ($ALLOWEDIT == 1){
echo( //"<a href=\"#\" onClick=\"openwinNOTE('../objects/showSINGLEnote.php?id=" . $ROWgetNOTES["ath_notes_id"] . "', 'popNote" . $ROWgetNOTES["ath_notes_id"] . "', 300, 300);\" class=\"edits\">" . $OPEN . "</a> " .
"<a href=\"#\" onClick=\"openwinSMALL('../objects/editSINGLE.php?type=note&id=" . $ROWgetNOTES["ath_notes_id"] . "', 'popNote" . $ROWgetNOTES["ath_notes_id"] . "', 300, 300);\" class=\"edits\">" . $EDIT . "</a> ");
}
echo($ROWgetNOTES["ath_notes_heading"] . ".</a>");
}
//CLOSE LIST
if ($getNOTES){
echo("</ul>");
}
echo("<hr>");
echo("</td>");
echo("</tr>");
}
echo("</table>");
?>