/**
  * Tests that the events_fetch_event_attendance_for_user function returns the expected
  * results.
  *
  */
 public function test_events_fetch_event_attendance_for_user()
 {
     //expected
     $data_set = $this->getDataSet()->getTable("event_attendance")->getRow(0);
     //actual
     $event_attendance = events_fetch_event_attendance_for_user(1, 1);
     $this->assertEquals($data_set, $event_attendance, "The expected event attendance for user did not match the actual results.");
 }
Esempio n. 2
0
 echo "\t\t\t\t<td class=\"title sortedASC\"><div class=\"noLink\">Quiz Title</div></td>\n";
 echo "\t\t\t\t<td class=\"date\">Quiz Expires</td>\n";
 echo "\t\t\t</tr>\n";
 echo "\t\t</thead>\n";
 echo "\t\t<tbody>\n";
 if ($event_quizzes) {
     foreach ($event_quizzes as $quiz_record) {
         $quiz_attempts = 0;
         $total_questions = quiz_count_questions($quiz_record["quiz_id"]);
         $query = "\tSELECT *\n                                                FROM `quiz_progress`\n                                                WHERE `aquiz_id` = " . $db->qstr($quiz_record["aquiz_id"]) . "\n                                                AND `proxy_id` = " . $db->qstr($ENTRADA_USER->getID());
         $progress_record = $db->GetAll($query);
         if ($progress_record) {
             $quiz_attempts = count($progress_record);
         }
         $exceeded_attempts = (int) $quiz_record["quiz_attempts"] === 0 || $quiz_attempts < $quiz_record["quiz_attempts"] ? false : true;
         if (isset($quiz_record["require_attendance"]) && $quiz_record["require_attendance"] && !events_fetch_event_attendance_for_user($EVENT_ID, $ENTRADA_USER->getID())) {
             $allow_attempt = false;
         } elseif ((!(int) $quiz_record["release_date"] || $quiz_record["release_date"] <= time()) && (!(int) $quiz_record["release_until"] || $quiz_record["release_until"] >= time()) && !$exceeded_attempts) {
             $allow_attempt = true;
         } else {
             $allow_attempt = false;
         }
         echo "\t<tr id=\"quiz-" . $quiz_record["aquiz_id"] . "\">\n";
         echo "\t\t<td class=\"modified\" style=\"vertical-align: top\">" . ((int) $quiz_record["last_visited"] ? (int) $quiz_record["last_visited"] >= (int) $quiz_record["updated_date"] ? "<img src=\"" . ENTRADA_RELATIVE . "/images/checkmark.gif\" width=\"20\" height=\"20\" alt=\"You have previously completed this quiz.\" title=\"You have previously completed this quiz.\" style=\"vertical-align: middle\" />" : "<img src=\"" . ENTRADA_RELATIVE . "/images/exclamation.gif\" width=\"20\" height=\"20\" alt=\"This attached quiz has been updated since you last completed it.\" title=\"This attached quiz has been updated since you last completed it.\" style=\"vertical-align: middle\" />" : "") . "</td>\n";
         echo "\t\t<td class=\"title\" style=\"vertical-align: top; white-space: normal; overflow: visible\">\n";
         if ($allow_attempt) {
             echo "\t\t<a href=\"javascript: beginQuiz(" . $quiz_record["aquiz_id"] . ")\" title=\"Take " . html_encode($quiz_record["quiz_title"]) . "\" style=\"font-weight: bold\">" . html_encode($quiz_record["quiz_title"]) . "</a>";
         } else {
             echo "\t\t<span style=\"color: #666666; font-weight: bold\">" . html_encode($quiz_record["quiz_title"]) . "</span>";
         }
         echo "\t\t\t<div class=\"content-small\" style=\"margin-top: 3px; margin-bottom: 5px\">\n";