Jump to content

Complete Newbie Needing Some Help


djhamer

Recommended Posts

One of my co-workers (the php guy) has designed a report.  The report tracks all of our users that have completed certain course modules/assessments.  At the end of the report it shows the total number of users.  There is a request to add a piece to that.  They want to show the total number of users that have completed all required modules right before the actual total number of users.  I can see the way he displays this.  However, I'm not sure how he sets the variable, etc.  Here's the pieces of code:

 

This is where he actually displays the number of users:

echo '<p> </p><p>'.count($MasterArray).' Users Total</p>';
		// Close Connection*/
		odbc_close($dbcnx); 

 

This is where he sets the variable:

$MasterArray = Array();
$datetime = date('n/j/y g:i:s A');

 

I'm not sure if this is enough to go off, but I can provide more if necessary.  Any help with this would be greatly appreciated, as he is out on vacation and I cannot reach him.  Thanks so much!!!

Link to comment
https://forums.phpfreaks.com/topic/109573-complete-newbie-needing-some-help/
Share on other sites

Thanks a lot guys.  I'm taking a PHP class soon.  Here's the entire script:

 

  <?php 
  	//SET CONSTANTS FOR THIS REPORT

  	$beginFrom = "4/1/2008 1:00:00 AM";  //This value sets how far to go back
//Show or hide columns by changing these values:
$showScore=true;
$showPassedFailed=true;
$showWrong=true;
$showTimesTaken=true;

//Determine how many optional rows there will be in the detailed report
    $numOptionalColumns = $showScore + (2*$showPassedFailed) + $showWrong + $showTimesTaken;

include '../physed_dbcnx.inc.php'; // database connection code - ** variable $dbcnx **

//Function for retrieving data into an array
function QueryIntoArray($db, $query) {
	$queryresults = odbc_exec($db, $query);
	$row = array();
	$tempArray = array();
	while ($row=odbc_fetch_array($queryresults)) {
		array_push($tempArray,$row);
	}
	return $tempArray;
}

function EchoBlankColumns($numColumns) {
	for($count=0;$count<$numColumns;$count++) {
	  echo '<td class=contract>&nbsp</td>'."\n";
	}
}
$MasterArray = Array();
$datetime = date('n/j/y g:i:s A');

if (isset($_GET['filter'])){ // looking for filter request
	$filter = $_GET['filter'];
		if ($filter == 'Med Student') {
			$qry_insert = 'WHERE (assess_registered_users.roleid = 5)';
		} elseif ($filter == 'Resident/Intern') {
			$qry_insert = 'WHERE (assess_registered_users.roleid = 2 OR assess_registered_users.roleid = 3)';
		} elseif ($filter == 'Staff Physician') {
			$qry_insert = 'WHERE (assess_registered_users.roleid = 1)';
		} elseif ($filter == 'Mid-Level Provider') {
			$qry_insert = 'WHERE (assess_registered_users.roleid = 4)';
		} else {
			$qry_insert = '';
		}
} else {
	$filter = 'All';
	$qry_insert = '';
}
if (isset($_GET['detail'])){ // looking for filter request
	$showDetails = $_GET['detail'];
	} else {
	$showDetails = "off";
	}

//Buttons for filtering results


echo '<form name="filter" method="get" action='.$_SERVER['PHP_SELF'].'>';
echo '<table><tr><td> </td><td>';
	if ($showDetails == 'on') {
	echo '<input type="checkbox" name="detail" CHECKED>';
	} else {
	echo '<input type="checkbox" name="detail">';
	}
echo ' detailed view</td></tr>
<tr><td align=right>See: </td><td><input type="submit" name="filter" value=" All ">';
echo '<input type="submit" name="filter" value="Med Student">';
echo '<input type="submit" name="filter" value="Resident/Intern">';
echo '<input type="submit" name="filter" value="Staff Physician">';
echo '<input type="submit" name="filter" value="Mid-Level Provider"></td></tr>
       <tr><td> </td><td>';
echo '</table></form>';

/* QUERY THE DATABASE FOR THE DATA NEEDED IN THIS REPORT ########################################################################### */

$qry_usersToReport = "SELECT assess_registered_users.id, responsibility.acknowledged, responsibility.timestamp, assess_registered_users.lname, assess_registered_users.fname, assess_registered_users.mi, assess_registered_users.email, assess_role.role
		FROM (assess_role INNER JOIN assess_registered_users ON assess_role.id = assess_registered_users.roleid) LEFT JOIN responsibility ON assess_registered_users.id = responsibility.reguserid 
		".$qry_insert."
		ORDER BY responsibility.timestamp DESC , assess_registered_users.lname, assess_registered_users.fname;";
$usersToReportArray = QueryIntoArray($dbcnx,$qry_usersToReport);

$max = count($usersToReportArray);
for($userIndex = 0; $userIndex < $max; $userIndex++){  //Loop through the records and build an array that contains all of the needed information

	$user_id_num = $usersToReportArray[$userIndex]['id'];

	//LIST OF SQL QUERIES
	//Gets a list of the assessments assigned to a student based on his/her role:
	$qry_assignedAssessments = "SELECT assess_user.assessid AS AssignedAssessid, assess_user.isrequired, assessment.title
		FROM assess_registered_users INNER JOIN (assessment INNER JOIN assess_user ON assessment.id = assess_user.assessid) ON assess_registered_users.roleid = assess_user.roleid
		WHERE (((assess_registered_users.id)=".$user_id_num.")
		 AND ((assess_user.isrequired) = '1'))
		ORDER BY assessment.listorder;";
	//Gets a list of the assessments attempted (taken at least once) by a student			
	$qry_attemptedAssessments = "SELECT assess_scores.*, assessment.*
		FROM assessment INNER JOIN assess_scores ON assessment.id = assess_scores.assessid
		WHERE (((assess_scores.reguserid)=".$user_id_num.")
		 AND ((assess_scores.timestamp)>'".$beginFrom."'))
		ORDER BY assessment.listorder;";
	//Gets a list of the modules (presentations) assigned to a student based on his/her role:
	$qry_assignedModules = "SELECT module.title, module.markers_inc, module.id AS AssignedModuleid
		FROM assess_registered_users INNER JOIN ([module] INNER JOIN module_user ON module.id = module_user.modid) ON assess_registered_users.roleid = module_user.roleid
		WHERE (((assess_registered_users.id)=".$user_id_num.") 
		   AND ((module_user.isrequired) = '1'))
		ORDER BY module.title;";
	//Gets a list of the modules (presentations) acknolwedged by a student	
	$qry_attemptedModules = "SELECT module.id As AttemptedModuleid, module.title, module_scores.markers, module_scores.timestamp, module_scores.acknowledged
		FROM [module] INNER JOIN module_scores ON module.id = module_scores.modid
		WHERE (((module_scores.reguserid)=".$user_id_num.")
		  AND  ((module_scores.timestamp)>'".$beginFrom."'));";		

	//Read the SQL queries into Arrays for later manipulation
	$attemptedArray = Array();
	$attemptedMArray = Array();
    $assignedArray = Array();
	$assignedMArray = Array();
	$responsibilityArray = Array();

	$attemptedArray = QueryIntoArray($dbcnx, $qry_attemptedAssessments);
	$attemptedMArray = QueryIntoArray($dbcnx, $qry_attemptedModules);
	//If the current user has not attempted any required assessments or modules, move on to the next user
	if(($attemptedArray[0] == false) and ($attemptedMArray[0] == false)) {
		continue; // Skip the rest of the loop because we don't need to report on this user if they haven't completed any assessments or modules.
	}

	//Only continue the rest of this loop if the user has attempted an assessment or module:

	$assignedArray = QueryIntoArray($dbcnx, $qry_assignedAssessments);
	$assignedMArray = QueryIntoArray($dbcnx, $qry_assignedModules);


	//put all of these arrays into one master array
	$userRecordArray = Array();
	$userRecordArray['assignedArray'] = $assignedArray;
	$userRecordArray['attemptedArray'] = $attemptedArray;
	$userRecordArray['assignedMArray'] = $assignedMArray;	
	$userRecordArray['attemptedMArray'] = $attemptedMArray;
	$userRecordArray['usersToReportArray'] = $usersToReportArray[$userIndex];
	array_push($MasterArray,$userRecordArray);

}
/* CREATE THE REPORT ########################################################################### */

//Create the report header
echo '<p class="viewtitle">Assessment Report 2008 ('.$filter.')      <span class=contract>'.$datetime.'     </span><input type=button value="Refresh" onClick="window.location.reload( false )"></p>';
//Start the table with user information
echo "<table>";

// First, make sure that this role has assigned assessments and/or modules
    $anyAssignedAssessments = false;
$anyAssignedModules = false;

$max = count($MasterArray);
if ($max == 0) {  //If there are no users at all, exit here
     exit('<br><br>There are no users in this role that have taken assessments or modules.</TABLE></BODY></HTML>');
}

for($userIndex = 0; $userIndex < $max; $userIndex++){  //loop through each user record
	if((count($MasterArray[$userIndex]['assignedArray']) > 0)) {
		$anyAssignedAssessments = true;
		break;
	}
}
for($userIndex = 0; $userIndex < $max; $userIndex++){  //loop through each user record
	if((count($MasterArray[$userIndex]['assignedMArray']) > 0)) {
		$anyAssignedModules = true;
		break;
	}
}

//If there are no requirements for the users selected in the report, EXIT the report and indicate that there were no requirements:
if(!($anyAssignedAssessments) AND !($anyAssignedModules)) {
exit('<br><br>There are no requirements for the selected role.</TABLE></BODY></HTML>');
}
//////////////////////////////////////////////////
//Begin the loop to create the body of the report/
//////////////////////////////////////////////////

$max = count($MasterArray);
for($userIndex = 0; $userIndex < $max; $userIndex++){  //loop through each user record

    //Gather data about the current user record
	$user_id_num = $MasterArray[$userIndex]['usersToReportArray']['id'];
	$fname =       $MasterArray[$userIndex]['usersToReportArray']['fname'];
	$lname =       $MasterArray[$userIndex]['usersToReportArray']['lname'];
	$mi =          $MasterArray[$userIndex]['usersToReportArray']['mi'];
	$fullname =    strtoupper(trim($lname)).', '.strtoupper(trim($fname)).' '.strtoupper(trim($mi));
	$email =       $MasterArray[$userIndex]['usersToReportArray']['email'];
	$role =        $MasterArray[$userIndex]['usersToReportArray']['role'];

	//***********************
	//DEAL FIRST WITH MODULES
	//***********************

	//pull in the data from the MasterArray
	$assignedMArray =  $MasterArray[$userIndex]['assignedMArray'];
	$attemptedMArray = $MasterArray[$userIndex]['attemptedMArray'];
	$assignedTotal =   0;
	$attemptedTotal =  0;
	$assignedTotal =   count($assignedMArray);
	$attemptedTotal =  count($attemptedMArray);
	$num_passed =      0;

	$reportArray = Array();

	if ($showDetails=="on") {
	   echo     '<tr class="line0"><td>Name</td>
		 					           <td>Email</td>
							           <td>Role</td>
							           <td>Module</td>';
	   if ($showScore)       {echo'<td class="line0" align=right>Viewed</td>';}
	   if ($showPassedFailed){echo'<td class="line0" align=right colspan =2>Acknowledged</td>';}
	   if ($showWrong)       {echo'<td class="line0">Markers Viewed</td>';}
	   if ($showTimesTaken)  {echo'<td class="line0">Total Markers</td>';}
	   echo    '<td class="line0" align=right><b>Last Accessed</b></td></tr>'."\n";
	   } else { //Only show the abbreviated header row if using the less detailed report
			If ($userIndex == 0) { 
				echo '<tr class="line0"><td>Name</td>
										<td>Email</td>
										<td>Role</td>
										<td class=contract> </td>
										<td align=right>Completions</td></tr>'."\n";
			}
		}
	   
	for ($assignedCounter = 0; $assignedCounter < $assignedTotal; $assignedCounter++) {
		$reportArray[$assignedCounter]=$assignedMArray[$assignedCounter]; //store the assigned array in a new array for the report
		$reportArray[$assignedCounter]['wasAttempted']=false; //Set it to false unless it is found below
		for ($attemptedCounter = 0; $attemptedCounter < $attemptedTotal; $attemptedCounter++) {
			if ($assignedMArray[$assignedCounter]['AssignedModuleid'] == $attemptedMArray[$attemptedCounter]['AttemptedModuleid'])  { //check to see if the assigned course is also a course that was taken
				$reportArray[$assignedCounter]['wasAttempted']=true;
				$reportArray[$assignedCounter]['timestamp']=$attemptedMArray[$attemptedCounter]['timestamp'];
				$reportArray[$assignedCounter]['markers']=$attemptedMArray[$attemptedCounter]['markers'];
				//determine if the person viewed all of the required markers
				$markers_inc = $reportArray[$assignedCounter]['markers_inc'];
				$markersArray = Array();
				$markersArray = explode(',',$reportArray[$assignedCounter]['markers']);
				switch ($markers_inc) {
					case null:
					case 0:
						$reportArray[$assignedCounter]['wasViewed']='n/a';
						break;
					default:
						If(count($markersArray) >= $markers_inc) {
							$reportArray[$assignedCounter]['wasViewed']='yes';
						} else {
						$reportArray[$assignedCounter]['wasViewed']='no';
						}
				}
				$reportArray[$assignedCounter]['acknowledged']=$attemptedMArray[$attemptedCounter]['acknowledged'];
				$acknowledged = $reportArray[$assignedCounter]['acknowledged'];
				if ($acknowledged > 0) { $num_passed++;}
			}
		}
	}
	If (($assignedTotal > 0) AND ($showDetails=='on')) {  //Only Display Modules IF there are assigned modules
		for ($i = 0; $i < $assignedTotal; $i++) {
			$title =        $reportArray[$i]['title'];
			$wasAttempted = $reportArray[$i]['wasAttempted'];
			$wasViewed =    $reportArray[$i]['wasViewed'];
			$timeStamp =    $reportArray[$i]['timestamp'];
			$acknowledged = $reportArray[$i]['acknowledged'];
			$markers =      $reportArray[$i]['markers'];
			$markers_inc = $reportArray[$i]['markers_inc'];
			//if there are no included markers, set the output to n/a
				if ($markers_inc < 1) { 
					$markers = "n/a";
					$markers_inc = "n/a";
				}

			$r = fmod($i, 2);
			if ($r > 0){
				echo '<tr class="line1">';
				} else {
				echo '<tr class="line2">';
			}
			//Show the user's name only on the first row
			$fullNameLink = '<A HREF="assess_report_individual.php?id='.$user_id_num.'">'.$fullname.'</A>';
			if ($i == 0) {
				echo '<td class=contract><span class=bold>'.$fullNameLink.'</span></td>
				      <td class=contract>'.strtolower(trim($email)).'</td>
					  <td class=contract>'.trim($role).'</td>';
				} else {
					EchoBlankColumns(3);
			}
			if ($wasAttempted == true) {
					echo '<td class=contract>'.trim($title).'</td>';
					if ($showScore) {echo'<td class=contract align=right>'.$wasViewed.'</td>';}
					if ($showPassedFailed) {
						if ($acknowledged > 0) {
							echo '<td class=contract align=center><img src="../images/icon_greenflag.gif" height=12 width=12></td>
								  <td class=contract> </td>';
							} else {
								echo '<td class=contract> </td>
									  <td class=contract align=center><img src="../images/icon_redflag.gif" height=12 width=12></td>';
							}
					}
					if($showWrong) {echo'<td class=contract>'.$markers.'</td>';}
					if($showTimesTaken) {echo'<td class=contract>'.$markers_inc.'</td>';}
					echo  '<td class=contract align=right>'.$timeStamp.'</td>'."</td>\n";
			} else {  //wasn't attempted so only show the title

					echo '<td class=contract><b>'.trim($title).'</b></td>';
					EchoBlankColumns($numOptionalColumns);
					echo  '<td class=contract align=right>n/a</td>'."</td>\n";
				    }

		    }

		if ($num_passed >= $assignedTotal){
							$modulesAreComplete = true;
							echo '<tr class="line3">';
						} else {
							$modulesAreComplete = false;
							echo '<tr class="line4">';
						}
						EchoBlankColumns(3);
						EchoBlankColumns($numOptionalColumns);
						echo '<td colspan=2 align=right class=contract><span class=complete>Completed '.$num_passed.' of '.$assignedTotal."</span></td>\n";
						echo "</tr>\n";
	} ELSE { // If there aren't any assigned modules, or if we are looking at a non-detailed report, do this:

	  if ($num_passed >= $assignedTotal){
							$modulesAreComplete = true;
							echo '<tr class="line3">';
						} else {
							$modulesAreComplete = false;
							echo '<tr class="line4">';
	  }
	  echo '<td class=contract><span class=bold><A HREF="assess_report_individual.php?id='.$user_id_num.'">'.$fullname.'</A></span></td>
		    <td class=contract>'.strtolower(trim($email)).'</td>
		    <td class=contract>'.trim($role).'</td>';
	  // Do this regardless if there were or were not assigned modules:
	  if ($showDetails=="on") {
		      EchoBlankColumns($numOptionalColumns);
	  } // If this is a non-detailed report, add the module completion information here:
	    echo '<td align=right class=contract><b>Modules:</b></td>';
		echo '<td align=right class=contract>'.$num_passed.' of '.$assignedTotal.' Complete</td>';
	    echo "</tr>\n";
	}
    //////////////////////////////
	//DEAL NEXT WITH ASSESSMENTS//
	//////////////////////////////

		if ($showDetails=="on") { 
		   echo     '<tr class="line1"><td> </td>
	                                   <td> </td>
							           <td> </td>
						               <td class="line0">Assessment</td>';
		   if ($showScore)       {echo'<td class="line0" align=right>Score</td>';}
		   if ($showPassedFailed){echo'<td class="line0">Passed</td>
							           <td class="line0">Failed</td>';}
               if ($showWrong)       {echo'<td class="line0">Wrong (Q# : A#)</td>';}
	       if ($showTimesTaken)  {echo'<td class="line0"># Taken</td>';}
		   echo                       '<td class="line0" align=right>Last Taken</td></tr>'."\n";
		} 

	//pull in the data from the MasterArray
	$assignedArray =  $MasterArray[$userIndex]['assignedArray'];
	$attemptedArray = $MasterArray[$userIndex]['attemptedArray'];
	//reset counters
	$assignedTotal =  0;
	$attemptedTotal = 0;
	$assignedTotal =  count($assignedArray);
	$attemptedTotal = count($attemptedArray);
	$num_passed =     0;


	//Loop through the assigned and attempted arrays to see if the current assessment (attempted) is on the assigned list
	$reportArray = Array();
	for ($assignedCounter = 0; $assignedCounter < $assignedTotal; $assignedCounter++) {
		$reportArray[$assignedCounter]=$assignedArray[$assignedCounter]; //store the assigned array in a new array for the report
		$reportArray[$assignedCounter]['wasAttempted']=false; //Set it to false unless it is found below
			for ($attemptedCounter = 0; $attemptedCounter < $attemptedTotal; $attemptedCounter++) {
				//check to see if the assigned course is also a course that was taken
				if ($assignedArray[$assignedCounter]['AssignedAssessid'] ==$attemptedArray[$attemptedCounter]['id']) { 
				//If there was a match, transfer in the information into the report array
					$reportArray[$assignedCounter]['numCorrect']=$attemptedArray[$attemptedCounter]['numCorrect'];
					$reportArray[$assignedCounter]['numTotal']=$attemptedArray[$attemptedCounter]['numTotal'];
					$reportArray[$assignedCounter]['wrongAnswers']=$attemptedArray[$attemptedCounter]['wrongAnswers'];
					$reportArray[$assignedCounter]['timesTaken']=$attemptedArray[$attemptedCounter]['timesTaken'];
					$reportArray[$assignedCounter]['timestamp']=$attemptedArray[$attemptedCounter]['timestamp'];
					$reportArray[$assignedCounter]['wasAttempted']=true;

					//Calculate if passing
					$correct = $reportArray[$assignedCounter]['numCorrect'];
					$total = $reportArray[$assignedCounter]['numTotal'];
					$passing = 85;
					$score = round($correct / $total * 100);	
					$reportArray[$assignedCounter]['score']=$score;
					if ($score < $passing) {
						$reportArray[$assignedCounter]['passed']=false;
					} else {
						$reportArray[$assignedCounter]['passed']=true;
						$num_passed++;
					}
				}
			}
		}

	If (($assignedTotal > 0) AND ($showDetails=="on")) {  //Only Display Assessments IF there are assigned assessments

		// Loop through each assessment and display a new table row.
		for ($i = 0; $i < $assignedTotal; $i++) {

			$title =        $reportArray[$i]['title'];
			$wasAttempted = $reportArray[$i]['wasAttempted'];
			$wrongAnswers = "";
			$timesTaken =   "";
			$timestamp =    "";
			$score =        "";
			$passed =       "";

			if($wasAttempted) {
				$wrongAnswers = $reportArray[$i]['wrongAnswers'];
				$timesTaken =   $reportArray[$i]['timesTaken'];
				$timestamp =    $reportArray[$i]['timestamp'];
				$score =        $reportArray[$i]['score'];
				$passed =       $reportArray[$i]['passed'];
			} 

			//alternate between gray and white rows
			$r = fmod($i, 2);
			if ($r > 0){
				echo '<tr class="line1">';
				} else {
				  echo '<tr class="line2">';
			}
                EchoBlankColumns(3);
			//If the assessment was attempted then display its information
			if ($wasAttempted == true) {
			            echo '<td class=contract>'.trim($title).'</td>';
						if ($showScore) {echo '<td class=contract align=right>'.$score.'</td>';}
						if ($showPassedFailed) {
							if ($passed) { //If passed show a green flag, otherwise show a red flag
								echo '<td class=contract align=center><img src="../images/icon_greenflag.gif" height=12 width=12></td>
									  <td class=contract> </td>'; //Green Flag
							} else {
								echo '<td class=contract> </td>
									  <td class=contract align=center><img src="../images/icon_redflag.gif" height=12 width=12></td>'; //Red Flag
							}
					    } 
					if ($showWrong) {echo '<td class=contract>'.trim($wrongAnswers).'</td>';} 
					if ($showTimesTaken) {echo '<td class=contract>'.trim($timesTaken).'</td>';}	
			}  else { //Did not attempt the assessment yet - only show the title and make the timestamp "n/a"
					echo '<td class=contract><b>'.trim($title)."</b>";
					EchoBlankColumns($numOptionalColumns);
					$timestamp = "n/a";
	        } 
			//in either case, show the timestamp
			echo '<td class=contract align=right>'.$timestamp."</td></tr>\n";
	} //END of LOOP For each Assessment Item

		if ($num_passed >= $assignedTotal) {
							$assessmentsAreComplete = true;
							echo '<tr class="line3">'; //green row
						} else {
							$assessmentsAreComplete = false;
							echo '<tr class="line4">'; //red row
						}
						EchoBlankColumns(3);
						EchoBlankColumns($numOptionalColumns);
						echo '<td colspan=2 align=right class=contract><span class=complete>Completed '.$num_passed.' of '.$assignedTotal.'</span></td>';
						echo "</tr>\n";
}  
ELSE {  //If there aren't any assigned assessments, or if we are looking at a non-detailed report
		if ($num_passed >= $assignedTotal) {
			$assessmentsAreComplete = true;
			echo '<tr class="line3">'; //green row
		} else {
			$assessmentsAreComplete = false;
			echo '<tr class="line4">'; //red row
		}
    EchoBlankColumns(3);
    if ($showDetails == "on") { 
		  EchoBlankColumns($numOptionalColumns);
	}
	//List the number of completed assessments in the non-detailed report format (just a summary)
    echo ' <td align=right class=contract><b>Assessments:</b></td>';
	echo '<td align=right class=contract>'.$num_passed.' of '.$assignedTotal.' Complete</td>';
	echo "</tr>\n";

}  //End of IF statement that checks to see if there are any assigned assessments



	//RESPONSIBILITY STATEMENT
    //Show status on whether the user has acknowledged responsibility statement
	$acknowledged = $MasterArray[$userIndex]['usersToReportArray']['acknowledged'];  
	$dateAcknowledged = $MasterArray[$userIndex]['usersToReportArray']['timestamp'];
	if ($dateAcknowledged == null) {$dateAcknowledged = "n/a";}
	//Header
	if ($showDetails=="on") { //show the extra header line
		echo '<tr class=line1>
			  <td> </td>
			  <td> </td>
			  <td> </td>
			  <td class="line0">Responsibility</td>';
	   if ($showScore)       {echo'<td class="line0" align=right> </td>';}
	   if ($showPassedFailed){echo'<td class="line0" align=right colspan =2>&nbsp</td>';}
	   if ($showWrong)       {echo'<td class="line0"> </td>';}
	   if ($showTimesTaken)  {echo'<td class="line0"> </td>';}
			echo '<td class="line0" align=right><b>Date</b></td></tr>'."\n";
	 }
	 //color code the row depending on whether the user completed things
	 switch ($acknowledged) {
	 case null:	
	     echo '<tr class="line4">';
		 if (($assessmentsAreComplete) and ($modulesAreComplete)) {
		 	$overallStatus = "Not Acknowledged";
		 } else {
		 	$overallStatus = "Requirements Not Met";
		 }
		 break;
	 case 0: 	
	 	  echo '<tr class="line4">';
		 $overallStatus = "Declined Acknowledgement";
		 break;
	 case 1:
	 	  echo '<tr class="line3">';
		 $overallStatus = "Acknowledged";
		 break;
          }
         
	 If ($showDetails=="on") {   
		  EchoBlankColumns(3);
		  echo '<td class=contract>'.$overallStatus.'</td>';
		  //EchoBlankColumns(1);
		  
		  switch ($acknowledged) {
		  	case null: // no response on responsibility quuestion
				EchoBlankColumns($numOptionalColumns);		
				echo '<td class=contract align=right>'.$dateAcknowledged.'</td></tr>'."\n";
				break;
			case 0:
				if ($showScore) {EchoBlankColumns(1);}	
			    if ($showPassedFailed) {
					echo '<td class=contract> </td>
						  <td class=contract align=center><img src="../images/icon_redflag.gif" height=12 width=12></td>';		
				}
					if ($showWrong) {EchoBlankColumns(1);}	
				    if ($showTimesTaken) {EchoBlankColumns(1);}	
					echo  '<td class=contract align=right>'.$dateAcknowledged.'</td></tr>'."\n";
						//If acknowledged show a green flag, otherwise show a red flag
				 break;
			case 1:
				if ($showScore) {EchoBlankColumns(1);}	
				if ($showPassedFailed) {
					echo '<td class=contract align=center><img src="../images/icon_greenflag.gif" height=12 width=12></td>
						  <td class=contract> </td>';
				}
					if ($showWrong) {EchoBlankColumns(1);}	
				    if ($showTimesTaken) {EchoBlankColumns(1);}	
				    echo '<td class=contract align=right>'.$dateAcknowledged.'</td></tr>'."\n";
					break;
		    }

	   } else { //not showing details
				switch ($acknowledged) {
					case null:
					case 0:
						echo '<tr class="line4">';
						EchoBlankColumns(3);
						echo '<td class=contract><b>Responsibility:</b></td>
						<td class=contract align=right>'.$overallStatus.'</td></tr>'."\n";
						break;
					case 1:
						echo '<tr class="line3">';
						EchoBlankColumns(3);
						echo '<td class=contract align=right><b>Responsibility:</b></td>'."\n";
						echo '<td class=contract align=right>Acknowledged<br> '.$dateAcknowledged.'</td></tr>'."\n";
						break;
				} 
		} //End of ShowDetails If statement
						echo '<tr><td colspan=10 class="lastline"> </td></tr>'."\n";
	}

	echo "</table>";
	echo '<p> </p><p>'.count($MasterArray).' Users Total</p>';
		// Close Connection*/
		odbc_close($dbcnx); 

	?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.