PageRenderTime 80ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/programs/admin/myprograms/index.php

https://github.com/damanlovett/SEAHO
PHP | 220 lines | 204 code | 13 blank | 3 comment | 13 complexity | bfbf6ed8f93eab53fe6f7ef35b437aa4 MD5 | raw file
  1. <?php
  2. // technocurve arc 3 php bv block1/3 start
  3. $color1 = "#FFFFFF";
  4. $color2 = "#DEDEDE";
  5. $color = $color1;
  6. // technocurve arc 3 php bv block1/3 end
  7. ?><?php require_once('../../../Connections/Programming.php'); ?>
  8. <?php
  9. if (!function_exists("GetSQLValueString")) {
  10. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  11. {
  12. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  13. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  14. switch ($theType) {
  15. case "text":
  16. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  17. break;
  18. case "long":
  19. case "int":
  20. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  21. break;
  22. case "double":
  23. $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  24. break;
  25. case "date":
  26. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  27. break;
  28. case "defined":
  29. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  30. break;
  31. }
  32. return $theValue;
  33. }
  34. }
  35. ?>
  36. <?php require_once('../../includefiles/init.php'); ?>
  37. <?php
  38. $_POST['reviewID'] = create_guid();
  39. if (isset($_GET['review'])) {
  40. $insertSQL = sprintf("INSERT INTO reviewers (id, reviewID, userID, programID) VALUES (%s, %s, %s, %s)",
  41. GetSQLValueString($_POST['id'], "int"),
  42. GetSQLValueString($_POST['reviewID'], "text"),
  43. GetSQLValueString($_SESSION['userID'], "text"),
  44. GetSQLValueString($_GET['review'], "text"));
  45. mysql_select_db($database_Programming, $Programming);
  46. $Result1 = mysql_query($insertSQL, $Programming) or die(mysql_error());
  47. }
  48. $colname_rsReviews = "-1";
  49. if (isset($_SESSION['userID'])) {
  50. $colname_rsReviews = (get_magic_quotes_gpc()) ? $_SESSION['userID'] : addslashes($_SESSION['userID']);
  51. }
  52. mysql_select_db($database_Programming, $Programming);
  53. $query_rsReviews = sprintf("SELECT reviewers.id, reviewers.reviewID, reviewers.userID, reviewers.programID, reviewers.`read`, reviewers.vote, callforprograms.id, callforprograms.ProgramTitle, callforprograms.ProgramNumber, callforprograms.`session`, callforprograms.FirstName, callforprograms.LastName FROM reviewers, callforprograms WHERE reviewers.userID = %s AND reviewers.programID = callforprograms.id ORDER BY callforprograms.ProgramTitle", GetSQLValueString($colname_rsReviews, "text"));
  54. $rsReviews = mysql_query($query_rsReviews, $Programming) or die(mysql_error());
  55. $row_rsReviews = mysql_fetch_assoc($rsReviews);
  56. $totalRows_rsReviews = mysql_num_rows($rsReviews);
  57. $colname_rsProgramsTotals = "-1";
  58. if (isset($_SESSION['userID'])) {
  59. $colname_rsProgramsTotals = (get_magic_quotes_gpc()) ? $_SESSION['userID'] : addslashes($_SESSION['userID']);
  60. }
  61. mysql_select_db($database_Programming, $Programming);
  62. $query_rsProgramsTotals = sprintf("SELECT reviewers.id, reviewers.reviewID, reviewers.userID, COUNT(reviewers.`read`) AS t_read FROM reviewers WHERE reviewers.userID = %s GROUP by reviewers.userID", GetSQLValueString($colname_rsProgramsTotals, "text"));
  63. $rsProgramsTotals = mysql_query($query_rsProgramsTotals, $Programming) or die(mysql_error());
  64. $row_rsProgramsTotals = mysql_fetch_assoc($rsProgramsTotals);
  65. $totalRows_rsProgramsTotals = mysql_num_rows($rsProgramsTotals);
  66. $colname_rsReviewerList = "-1";
  67. if (isset($_SESSION['group'])) {
  68. $colname_rsReviewerList = $_SESSION['group'];
  69. }
  70. $colname2_rsReviewerList = "-1";
  71. if (isset($_SESSION['userID'])) {
  72. $colname2_rsReviewerList = $_SESSION['userID'];
  73. }
  74. mysql_select_db($database_Programming, $Programming);
  75. $query_rsReviewerList = sprintf("SELECT callforprograms.id AS pro_id, callforprograms.ProgramTitle, callforprograms.FirstName, callforprograms.LastName, callforprograms.TopicArea, reviewers.id AS re_id, reviewers.userID, reviewers.reviewID, reviewers.programID AS re_proid, reviewers.`read`, reviewers.vote, DATE_FORMAT(callforprograms.submission_date,'%%M %%d, %%Y at %%r') AS sub_date FROM callforprograms LEFT JOIN reviewers ON reviewers.programID = callforprograms.id AND reviewers.userID = %s WHERE callforprograms.TopicArea = %s ORDER BY callforprograms.submission_date DESC", GetSQLValueString($colname2_rsReviewerList, "int"),GetSQLValueString($colname_rsReviewerList, "text"));
  76. $rsReviewerList = mysql_query($query_rsReviewerList, $Programming) or die(mysql_error());
  77. $row_rsReviewerList = mysql_fetch_assoc($rsReviewerList);
  78. $totalRows_rsReviewerList = mysql_num_rows($rsReviewerList);
  79. ?>
  80. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  81. <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/mainTemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
  82. <head>
  83. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  84. <!-- InstanceBeginEditable name="doctitle" -->
  85. <title><?php echo $_SESSION['first_name'];?>'s Programs</title>
  86. <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" -->
  87. <script language="javascript">
  88. /*
  89. Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
  90. Permission granted to Dynamic Drive to feature script in archive
  91. For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
  92. */
  93. var win = null;
  94. function NewWindow(mypage,myname,w,h,scroll){
  95. LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  96. TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  97. settings =
  98. 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
  99. win = window.open(mypage,myname,settings)
  100. }
  101. </script>
  102. <script type="text/JavaScript">
  103. <!--
  104. function MM_openBrWindow(theURL,winName,features) { //v2.0
  105. window.open(theURL,winName,features);
  106. }
  107. function MM_goToURL() { //v3.0
  108. var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  109. for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
  110. }
  111. //-->
  112. </script><!-- InstanceEndEditable --><!-- InstanceParam name="Page Title" type="text" value="MembersPageTitle" -->
  113. <link href="../../styles/mainStyle.css" rel="stylesheet" type="text/css" />
  114. <link href="../../styles/navLeft.css" rel="stylesheet" type="text/css" />
  115. <link href="../../styles/table.css" rel="stylesheet" type="text/css" />
  116. </head>
  117. <body>
  118. <div id="header"><?php require_once('../../includefiles/userInfo.php'); ?></div>
  119. <div id="sidebar"><?php require_once('../../includefiles/navPage.php'); ?></div>
  120. <div id="mainContent">
  121. <div id="mainText">
  122. <h2><!-- InstanceBeginEditable name="PageTite" --><img src="../../images/PHuserReviews.jpg" alt="User Reviewer" width="65" height="51" /><?php echo $_SESSION['first_name'];?>'s Programs<!-- InstanceEndEditable --></h2>
  123. <!-- InstanceBeginEditable name="SectionTitle" --> <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="PageInformation" -->
  124. <div id="pageInformation">
  125. <ul>
  126. <li>Programs to Review: <strong><?php echo $totalRows_rsReviewerList ?> </strong></li>
  127. <li><img src="../../images/book_open.gif" alt="read" width="16" height="16" />Read: <strong><?php echo $row_rsProgramsTotals['t_read']; ?></strong></li>
  128. <li><img src="../../images/book.gif" alt="unread" width="16" height="16" />Unread: <strong><?php echo ($totalRows_rsReviewerList - $row_rsProgramsTotals['t_read']);?></strong></li>
  129. </ul>
  130. </div>
  131. <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="PageText" -->
  132. <?php if ($totalRows_rsReviewerList == 0) { // Show if recordset empty ?>
  133. <p class="homepageBlocks">The administrator has not assigned you any programs.</p>
  134. <?php } // Show if recordset empty ?>
  135. <?php if ($totalRows_rsReviewerList > 0) { // Show if recordset not empty ?>
  136. <table border="0" cellpadding="5" cellspacing="0" class="tableborder">
  137. <tr>
  138. <td colspan="4" class="tableTop"><strong><?php echo $row_rsReviewerList['TopicArea']; ?></strong></td>
  139. <td class="tableTop">&nbsp;</td>
  140. <td class="tableTop"><input type="button" value="Refresh List" onclick="MM_goToURL('parent','index.php');return document.MM_returnValue" /></td>
  141. <td class="tableTop">&nbsp;</td>
  142. <td class="tableTop">&nbsp;</td>
  143. </tr>
  144. <tr>
  145. <th>&nbsp;</th>
  146. <th>Vote</th>
  147. <th>&nbsp;</th>
  148. <th>Program </th>
  149. <th>&nbsp;</th>
  150. <th nowrap="nowrap">Presenter</th>
  151. <th>&nbsp;</th>
  152. <th>Submitted</th>
  153. </tr>
  154. <?php do { ?>
  155. <tr <?php
  156. // technocurve arc 3 php bv block2/3 start
  157. echo " style=\"background-color:$color\"";
  158. // technocurve arc 3 php bv block2/3 end
  159. ?> class="tableRowColor">
  160. <td nowrap="nowrap"><div align="center"><?php ImageOnOffSwitch($row_rsReviewerList['read'],"book.gif","book_open.gif")?></div></td>
  161. <td nowrap="nowrap"><?php if($row_rsReviewerList['vote']!=""){echo $row_rsReviewerList['vote'];} else { echo "----";} ?></td>
  162. <td nowrap="nowrap">&nbsp;</td>
  163. <td nowrap="nowrap">
  164. <?php if($row_rsReviewerList['read']!=0){?>
  165. <a href="#" onclick="MM_openBrWindow('details.php?recordID=<?php echo $row_rsReviewerList['reviewID']; ?>&amp;programID=<?php echo $row_rsReviewerList['pro_id']; ?>','myprograms','toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=550')"><?php echo substr($row_rsReviewerList['ProgramTitle'],0,40)."..."; ?></a>
  166. <?php } else {?>
  167. <a href="#" onclick="MM_openBrWindow('details.php?review=<?php echo $row_rsReviewerList['pro_id']; ?>&amp;programID=<?php echo $row_rsReviewerList['pro_id']; ?>','myprograms','toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=550')"><?php echo substr($row_rsReviewerList['ProgramTitle'],0,40)."..."; ?></a>
  168. <?php }?> </td>
  169. <td nowrap="nowrap">&nbsp;</td>
  170. <td><?php echo $row_rsReviewerList['FirstName']; ?> <?php echo $row_rsReviewerList['LastName']; ?></td>
  171. <td>&nbsp;</td>
  172. <td><?php echo $row_rsReviewerList['sub_date']; ?></td>
  173. </tr>
  174. <?php } while ($row_rsReviewerList = mysql_fetch_assoc($rsReviewerList)); ?>
  175. <?php
  176. // technocurve arc 3 php bv block3/3 start
  177. if ($color == $color1) {
  178. $color = $color2;
  179. } else {
  180. $color = $color1;
  181. }
  182. // technocurve arc 3 php bv block3/3 end
  183. ?>
  184. <tr>
  185. <td colspan="8" nowrap="nowrap" class="tableBottom">&nbsp;</td>
  186. </tr>
  187. </table>
  188. <?php } // Show if recordset not empty ?>
  189. <p>&nbsp;</p>
  190. <!-- InstanceEndEditable --></div>
  191. </div>
  192. <div id="footer"><?php require_once('../../includefiles/footer.php'); ?>
  193. </div>
  194. </body>
  195. <!-- InstanceEnd --></html>
  196. <?php
  197. mysql_free_result($rsReviews);
  198. mysql_free_result($rsReviews);
  199. mysql_free_result($rsProgramsTotals);
  200. mysql_free_result($rsReviewerList);
  201. ?>