Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Mon Oct 13, 2008 11:49 am Reply with quote

What I have is a medical student peer evaluation form for team based learning that each team mate fills out on each other.

They are asked a series of questions to "rate" their team mates on.

Never - Sometimes - Often - Always

The first series are Cooperative Learning Skills.

Arrives on time and remains with team during activites.
Demonstrates a good balance of active listening and participation.
Asks useful or probing questions.
Shares information and personal understanding.

Each team mate will fill out the form and select a value by choosing one of the radio buttons for Never - Sometimes - Often - Always.

So 3 series with 4 questions each for 12 overall.

What I need is a way to display the results of this evaluation to each student. I wanted something like this which is hard coded as an example. I'm using an image such as "<img src='modules/$module_name/images/3stars.gif'>";

to represent how many scores for that question.

Here is what the table looks like hard coded..
Code:


OpenTable();
    echo "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n";
    echo "<tr><td colspan='5' width='100%' align='center'>Term $Term</td></tr>\n";
    echo"<tr><td align=\"center\"><b>Cooperative Learning Skills</b></td><td align=\"center\"><b>Never</b></td><td align=\"center\"><b>Sometimes</b></td><td align=\"center\"><b>Often</b></td><td align=\"center\"><b>Always</b></td></tr>"       
          ."<tr><td width = '50%'>Arrives on time and remains with team during activites.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$onestar</td><td align=\"center\">$fourstars</td></tr>"
        ."<tr><td width = '50%'>Demonstrates a good balance of active listening and participation.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$twostars</td><td align=\"center\">$threestars</td></tr>"
        ."<tr><td width = '50%'>Asks useful or probing questions.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$twostars</td><td align=\"center\">$threestars</td></tr>"
        ."<tr><td width = '50%'>Shares information and personal understanding.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$onestar</td><td align=\"center\">$fourstars</td></tr>";             
          echo"</table>";   
        echo"<table width=\"100%\" border=\"1\" cellpadding=\"2\">"
        ." <tr><td align=\"center\"><b>Self-Directed Learning</b></td><td align=\"center\"><b>Never</b></td><td align=\"center\"><b>Sometimes</b></td><td align=\"center\"><b>Often</b></td><td align=\"center\"><b>Always</b></td></tr>"       
          ."<tr><td width = '50%'>Is well prepared for team activities.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$onestar</td><td align=\"center\">$fourstars</td></tr>"
        ."<tr><td width = '50%'>Shows appropriate depth of knowledge.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$onestar</td><td align=\"center\">$fourstars</td></tr>"
        ."<tr><td width = '50%'>Identifies limits of personal knowledge.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$onestar</td><td align=\"center\">$fourstars</td></tr>"
        ."<tr><td width = '50%'>Is clear when explaining things to others.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$fivestars</td></tr>";             
          echo"</table>";   
        echo"<table width=\"100%\" border=\"1\" cellspacing='0' cellpadding=\"2\">"
        ." <tr><td align=\"center\"><b>Interpersonal Skills</b></td><td align=\"center\"><b>Never</b></td><td align=\"center\"><b>Sometimes</b></td><td align=\"center\"><b>Often</b></td><td align=\"center\"><b>Always</b></td></tr>"       
          ."<tr><td width = '50%'>Gives useful feedback to others.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$fivestars</td></tr>"
        ."<tr><td width = '50%'>Accepts useful feedback from others.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$fivestars</td></tr>"
        ."<tr><td width = '50%'>Is able to listen and understand what others are saying.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$onestar</td><td align=\"center\">$fourstars</td></tr>"
        ."<tr><td width = '50%'>Shows respect to the opinion and feelings of others.</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$nostar</td><td align=\"center\">$fivestars</td></tr>";             
          echo"</table>";   
        CloseTable();


My table looks like this:
Code:


`UID` varchar(9) NOT NULL,
  `clskill_1` set('0','1','2','3') NOT NULL,
  `clskill_2` set('0','1','2','3') NOT NULL,
  `clskill_3` set('0','1','2','3') NOT NULL,
  `clskill_4` set('0','1','2','3') NOT NULL,
  `sdskill_1` set('0','1','2','3') NOT NULL,
  `sdskill_2` set('0','1','2','3') NOT NULL,
  `sdskill_3` set('0','1','2','3') NOT NULL,
  `sdskill_4` set('0','1','2','3') NOT NULL,
  `ipskill_1` set('0','1','2','3') NOT NULL,
  `ipskill_2` set('0','1','2','3') NOT NULL,
  `ipskill_3` set('0','1','2','3') NOT NULL,
  `ipskill_4` set('0','1','2','3') NOT NULL,
  `qa_1_text` text NOT NULL,
  `qa_2_text` text NOT NULL,
  `rater` varchar(10) NOT NULL,
  `qa_1_rating` tinyint(1) unsigned NOT NULL,
  `qa_2_rating` tinyint(1) unsigned NOT NULL,
  `datesubmit` date NOT NULL,
  `Academic_Year` varchar(5) NOT NULL


and a dump of the data looks like this..
Code:


INSERT INTO `atlas_tl_M2peereval` (`UID`, `clskill_1`, `clskill_2`, `clskill_3`, `clskill_4`, `sdskill_1`, `sdskill_2`, `sdskill_3`, `sdskill_4`, `ipskill_1`, `ipskill_2`, `ipskill_3`, `ipskill_4`, `qa_1_text`, `qa_2_text`, `rater`, `qa_1_rating`, `qa_2_rating`, `datesubmit`, `Academic_Year`) VALUES
('U00583382', '0', '0', '0', '0', '1', '1', '1', '1', '0', '0', '0', '0', 'Shows respect to the opinion and feelings of others.', 'Gives useful feedback to others.', 'w002sfd', 0, 0, '2008-10-10', '0809'),
('U00583382', '0', '0', '0', '0', '2', '0', '0', '0', '0', '0', '1', '0', 'Shows appropriate depth of knowledge. Shows appropriate depth of knowledge. Shows appropriate depth of knowledge.', 'Demonstrates a good balance of active listening and participation. Demonstrates a good balance of active listening and participation. Demonstrates a good balance of active listening and participation.', 'w01asd', 0, 0, '2008-10-10', '0809'),
('U00583382', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '1', 'Shows respect to the opinion and feelings of others. Shows respect to the opinion and feelings of others.', 'Is able to listen and understand what others are saying. Is able to listen and understand what others are saying.Is able to listen and understand what others are saying.', 'w002dfg', 0, 0, '2008-10-10', '0809'),
('U00583382', '0', '0', '0', '0', '0', '0', '1', '2', '0', '0', '1', '0', 'blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah  ', 'blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah ', 'w003ttt', 0, 0, '2008-10-12', '0809'),
('U00583382', '1', '1', '0', '0', '1', '0', '0', '0', '0', '1', '0', '0', 'test test test test test test test test test test test test test test test test test test test test test test test test test test  ', 'test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test ', 'w003uuu', 0, 0, '2008-10-13', '0809');


How do I count the values in each field to determine how many stars should display in the result?

How do I set up the loop to break on each of the skills?

Cooperative Learning Skills
Self-Directed Learning
Interpersonal Skills

Off the top of my head, but I'm not 100% on this.

Code:


//All the radio buttons
   $skills = array("clskill_1", "clskill_2", "clskill_3", "clskill_4", "sdskill_1", "sdskill_2", "sdskill_3", "sdskill_4", "ipskill_1", "ipskill_2", "ipskill_3", "ipskill_4");
      
   for($i=0;$i<count($skills);$i++) {
    // values for Always, Often, Sometimes and Never.
   $scores = array("0", "1", "2", "3");   
   
    foreach($scores as $value) {
     $getstarcount = $db->sql_query("SELECT COUNT($skills[i]) AS starcount FROM ".$prefix."_tl_M2peereval
   WHERE UID ='$UID'
   AND scores[] = $value
   AND Academic_Year = '$Academic_Year'
   GROUP BY UID");   
                        }
                           }   


If I could just get the counts working for each question then I could try and display the table.

One loop for each input (radio button) and another for each value (0,1,2,3) Sum all these values per input and assign it a graphical representation to display:

Code:


$nostar = "<img src='modules/$module_name/images/pixel.gif'>";
   $onestar = "<img src='modules/$module_name/images/1star.gif'>";
   $twostars = "<img src='modules/$module_name/images/2stars.gif'>";
   $threestars = "<img src='modules/$module_name/images/3stars.gif'>";
   $fourstars = "<img src='modules/$module_name/images/4stars.gif'>";
   $fivestars = "<img src='modules/$module_name/images/5stars.gif'>";
   $sixstars = "<img src='modules/$module_name/images/6stars.gif'>";
 
View user's profile Send private message Visit poster's website ICQ Number
Donovan







PostPosted: Tue Oct 14, 2008 11:35 am Reply with quote

Ok well here is what I've done. Since I could not figure out nested loops for the whole thing I broke it out like so.

The first four questions had to do with Cooperative Learning Skills.

So I make my table and list the first question.

Code:
echo"<tr><td align=\"center\"><b>Cooperative Learning Skills</b></td><td align=\"center\"><b>Never</b></td><td align=\"center\"><b>Sometimes</b></td><td align=\"center\"><b>Often</b></td><td align=\"center\"><b>Always</b></td></tr>";   

   echo"<tr><td width = '50%'>Arrives on time and remains with team during activites.</td>";


I have five columns.

Under the first column I list all my questions then subsequent columns have Never - Sometimes - Often - Always

I then do the following.
Code:


 // values for Always, Often, Sometimes and Never.
   $scores = array("0", "1", "2", "3");       
      foreach($scores as $value) {   
      //foreach($clskills as $skill) {
    $getskillcount = $db->sql_query("SELECT COUNT(clskill_1) AS skillcount FROM ".$prefix."_tl_M2peereval
   WHERE clskill_1 = '$value'
   AND Academic_Year = '$Academic_Year'
   AND UID = '$UID'
   GROUP BY UID");   
   $info = $db->sql_fetchrow($getskillcount);
   $skillcount = $info['skillcount'];   
   
   if ($skillcount == 0) {
         $starimage = "<img src='modules/$module_name/images/pixel.gif'>";
      } elseif ($skillcount == 1) {
         $starimage = "<img src='modules/$module_name/images/1star.gif'>";
      } elseif ($skillcount == 2)  {
         $starimage = "<img src='modules/$module_name/images/2stars.gif'>";
      } elseif ($skillcount == 3)  {
         $starimage = "<img src='modules/$module_name/images/3stars.gif'>";
      } elseif ($skillcount == 4)  {
         $starimage = "<img src='modules/$module_name/images/4stars.gif'>";
      } elseif ($skillcount == 5)  {
         $starimage = "<img src='modules/$module_name/images/5stars.gif'>";
      }      
   
                        //}
                        echo"<td align=\"center\">$starimage</td>";   
                        }      
        echo"</tr>";


This gives me the correct number of stars to display but i don't know how to make them appear in the correct column.

I then go onto the next question and count those values.

Code:


echo"<tr><td width = '50%'>Demonstrates a good balance of active listening and participation.</td>";
      // values for Always, Often, Sometimes and Never.
   $scores = array("0", "1", "2", "3");       
      foreach($scores as $value) {         
    $getskillcount = $db->sql_query("SELECT COUNT(clskill_2) AS skillcount FROM ".$prefix."_tl_M2peereval
   WHERE clskill_2 = '$value'
   AND Academic_Year = '$Academic_Year'
   AND UID = '$UID'
   GROUP BY UID");   
   $info = $db->sql_fetchrow($getskillcount);
   $skillcount = $info['skillcount'];   
   
   if ($skillcount == 0) {
         $starimage = "<img src='modules/$module_name/images/pixel.gif'>";
      } elseif ($skillcount == 1) {
         $starimage = "<img src='modules/$module_name/images/1star.gif'>";
      } elseif ($skillcount == 2)  {
         $starimage = "<img src='modules/$module_name/images/2stars.gif'>";
      } elseif ($skillcount == 3)  {
         $starimage = "<img src='modules/$module_name/images/3stars.gif'>";
      } elseif ($skillcount == 4)  {
         $starimage = "<img src='modules/$module_name/images/4stars.gif'>";
      } elseif ($skillcount == 5)  {
         $starimage = "<img src='modules/$module_name/images/5stars.gif'>";
      }      
   
                        //}
                        echo"<td align=\"center\">$starimage</td>";   
                        }      
        echo"</tr>";   


How can I ensure that $starimage appears in the proper column?
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©