home *** CD-ROM | disk | FTP | other *** search
/ Practice Anatomy Lab / PAL.ISO / pc / PAL.swf / scripts / __Packages / com / argosy / PALReporting.as next >
Encoding:
Text File  |  2007-03-19  |  2.0 KB  |  53 lines

  1. class com.argosy.PALReporting
  2. {
  3.    static var q_array;
  4.    static var t_elapsed;
  5.    static var t_total;
  6.    static var timestamp;
  7.    static var correct;
  8.    static var total;
  9.    function PALReporting()
  10.    {
  11.    }
  12.    static function setData(testID, stop_time, questions, time_elapsed, duration)
  13.    {
  14.       com.argosy.PALReporting.q_array = questions;
  15.       if(time_elapsed)
  16.       {
  17.          com.argosy.PALReporting.t_elapsed = time_elapsed;
  18.       }
  19.       if(duration)
  20.       {
  21.          com.argosy.PALReporting.t_total = duration;
  22.       }
  23.       com.argosy.PALReporting.timestamp = stop_time;
  24.       com.argosy.PALReporting.correct = 0;
  25.       com.argosy.PALReporting.total = 0;
  26.       var _loc1_ = 0;
  27.       while(_loc1_ < com.argosy.PALReporting.q_array.length)
  28.       {
  29.          if(com.argosy.PALReporting.q_array[_loc1_].isCorrect != undefined && com.argosy.PALReporting.q_array[_loc1_].isCorrect != null && com.argosy.PALReporting.q_array[_loc1_].isCorrect)
  30.          {
  31.             com.argosy.PALReporting.correct = com.argosy.PALReporting.correct + 1;
  32.          }
  33.          com.argosy.PALReporting.total = com.argosy.PALReporting.total + 1;
  34.          _loc1_ = _loc1_ + 1;
  35.       }
  36.       trace("NEW DATA SET:");
  37.       trace("Correct Answers: " + com.argosy.PALReporting.correct + " / " + com.argosy.PALReporting.total);
  38.       trace("Completed on: " + com.argosy.PALReporting.timestamp.toString());
  39.       trace("Completed in: " + time_elapsed + " milliseconds");
  40.       trace("Out of a total of: " + duration + " milliseconds");
  41.    }
  42.    static function sendData(returnSet)
  43.    {
  44.       var _loc1_ = new LoadVars();
  45.       _loc1_.correct = com.argosy.PALReporting.correct;
  46.       _loc1_.total = com.argosy.PALReporting.total;
  47.       _loc1_.elapsed = com.argosy.PALReporting.t_elapsed;
  48.       _loc1_.duration = com.argosy.PALReporting.t_total;
  49.       _loc1_.timestamp = com.argosy.PALReporting.timestamp.toString();
  50.       _loc1_.sendAndLoad("testsubmit.php",returnSet,"POST");
  51.    }
  52. }
  53.