예제 #1
0
파일: Launch.php 프로젝트: csev/tsugi-php
 /**
  * Dump out the internal data structures associated with the
  * current launch.  Best if used within a pre tag.
  */
 public function var_dump()
 {
     var_dump($this);
     echo "\n<hr/>\n";
     echo "Session data (low level):\n";
     if (!isset($_SESSION)) {
         echo "Not set\n";
     } else {
         echo Output::safe_var_dump($_SESSION);
     }
 }
예제 #2
0
파일: Result.php 프로젝트: csev/tsugi-php
 /**
  * Send a grade applying the due date logic and only increasing grades
  *
  * Puts messages in the session for a redirect.
  *
  * @param $gradetosend - The grade in the range 0.0 .. 1.0
  * @param $oldgrade - The previous grade in the range 0.0 .. 1.0 (optional)
  * @param $dueDate - The due date for this assignment
  */
 public function gradeSendDueDate($gradetosend, $oldgrade = false, $dueDate = false)
 {
     if ($gradetosend == 1.0) {
         $scorestr = "Your answer is correct, score saved.";
     } else {
         $scorestr = "Your score of " . $gradetosend * 100.0 . "% has been saved.";
     }
     if ($dueDate && $dueDate->penalty > 0) {
         $gradetosend = $gradetosend * (1.0 - $dueDate->penalty);
         $scorestr = "Effective Score = " . $gradetosend * 100.0 . "% after " . $dueDate->penalty * 100.0 . " percent late penalty";
     }
     if ($oldgrade && $oldgrade > $gradetosend) {
         $scorestr = "New score of " . $gradetosend * 100.0 . "% is < than previous grade of " . $oldgrade * 100.0 . "%, previous grade kept";
         $gradetosend = $oldgrade;
     }
     // Use LTIX to store the grade in out database send the grade back to the LMS.
     $debug_log = array();
     $retval = $this->gradeSend($gradetosend, false, $debug_log);
     $_SESSION['debug_log'] = $debug_log;
     if ($retval === true) {
         $_SESSION['success'] = $scorestr;
     } else {
         if ($retval === false) {
             // Stored locally
             $_SESSION['success'] = $scorestr;
         } else {
             if (is_string($retval)) {
                 $_SESSION['error'] = "Grade not sent: " . $retval;
             } else {
                 $svd = Output::safe_var_dump($retval);
                 error_log("Grade sending error:" . $svd);
                 $_SESSION['error'] = "Grade sending error: " . substr($svd, 0, 100);
             }
         }
     }
 }
예제 #3
0
파일: LTIX.php 프로젝트: csev/tsugi-php
 /**
  * Dump out the internal data structures adssociated with the
  * current launch.  Best if used within a pre tag.
  */
 public static function var_dump()
 {
     global $USER, $CONTEXT, $LINK, $RESULT;
     echo '$USER:'******'$CONTEXT:' . "\n";
     if (!isset($CONTEXT)) {
         echo "Not set\n";
     } else {
         var_dump($CONTEXT);
     }
     echo '$LINK:' . "\n";
     if (!isset($LINK)) {
         echo "Not set\n";
     } else {
         var_dump($LINK);
     }
     echo '$RESULT:' . "\n";
     if (!isset($RESULT)) {
         echo "Not set\n";
     } else {
         var_dump($RESULT);
     }
     echo "\n<hr/>\n";
     echo "Session data (low level):\n";
     if (!isset($_SESSION)) {
         echo "Not set\n";
     } else {
         echo Output::safe_var_dump($_SESSION);
     }
 }