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