public static function getInstance($courseObj)
 {
     self::$course = $courseObj;
     //singleton
     if (self::$instance === NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
     }
     if ($range == $numberOfAssignments && $r > 0) {
         $rest = 21 - $range % 20;
         $table .= "<td colspan=\"" . $rest . "\"></td>";
     }
     if ($r < $rows - 1) {
         $table .= "<tr height='10'>";
         $table .= "<td colspan='21'></td>";
         $table .= "</tr>";
     }
 }
 $table .= "</tr>";
 $table .= "</table>";
 //end create table
 // get max points for each assignment
 $examObject = exam_organization_exam_object_data::getInstance($course);
 $assignments = $examObject->getAssignmentMaxPoints($examTerm);
 $assignmentPoints = "";
 foreach ($assignments as $assignment) {
     $assignmentPoints .= $assignment . ',';
 }
 $assignmentPoints = substr($assignmentPoints, 0, -1);
 $content->setVariable("ASSIGNMENT_ARRAY", $assignmentPoints);
 $content->setVariable("EXAM_INFORMATION", gettext("exam term:") . " " . $examChoosen);
 $content->setVariable("INFO_NAME", 'Student');
 $content->setVariable("FIELD_NAME", '<b>' . $value_student . '</b>');
 $content->setVariable("INFO_BARCODE", gettext("Barcode / Matriculation number"));
 $content->setVariable("FIELD_BARCODE", '<input tabindex="1" type="text" onblur="submitOnBlur();" onfocus="updateFocus(-1);" ' . $barcodeDisabled . ' name="input_result_barcode_matnr" value="' . $value_matnr . '"/>');
 $content->setVariable("CHECKBOX_NT", '<input type="checkbox" onclick="updateTextfieldStatus(this.checked); updateCheckboxes(this);" name="checkbox" value="NT" id="checkbox_nt" ' . $NTchecked . ' /><label for="checkbox_nt">NT</label>');
 $content->setVariable("CHECKBOX_BV", '<input type="checkbox" onclick="updateTextfieldStatus(this.checked); updateCheckboxes(this);" name="checkbox" value="BV" id="checkbox_bv" ' . $BVchecked . ' /><label for="checkbox_bv">' . gettext('attempt to fraud') . '</label>');
 $content->setVariable("CHECKBOX_SICK", '<input type="checkbox" onclick="updateTextfieldStatus(this.checked); updateCheckboxes(this);" name="checkbox" value="SICK" id="checkbox_sick" ' . $SICKchecked . ' /><label for="checkbox_sick">' . gettext('sick') . '</label>');
 function handle_path($path, $owner = FALSE, $portal = FALSE)
 {
     $course = $owner;
     //the course was given by the owner parameter
     $isAdmin = $course->is_admin(lms_steam::get_current_user());
     //parse the url path into an array
     if (is_string($path)) {
         $path = url_parse_rewrite_path($path);
     }
     if (!is_object($owner) || !$owner instanceof koala_group_course) {
         throw new Exception("No owner (course) provided.", E_PARAMETER);
     }
     //choose and save last exam term
     if (isset($path[0])) {
         switch ($path[0]) {
             case "exam1":
                 $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 1);
                 break;
             case "exam2":
                 $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 2);
                 break;
             case "exam3":
                 $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 3);
                 break;
             default:
                 //do nothing
         }
     }
     $examTerm = $course->get_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED");
     if ($examTerm != 1 && $examTerm != 2 && $examTerm != 3) {
         $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 1);
         $examTerm = 1;
     }
     /*
     //test case
     if (isset($path[0]) && $path[0]=="test"){include( self::$PATH . "test.php" );die();}
     if (isset($path[0]) && $path[0]=="setup"){include( self::$PATH . "setup_exam.php" );die();}
     if (isset($path[0]) && $path[0]=="cleanup"){include( self::$PATH . "cleanup_database.php" );die();}
     */
     //security check - do no advanced functions if not admin
     if (!$isAdmin) {
         include self::$PATH . "exam_organization.php";
         exit;
     }
     //check if password is set
     $examObject = exam_organization_exam_object_data::getInstance($course);
     if ($examObject->isSetMasterPassword()) {
         if (isset($_SESSION["password"]) && $examObject->checkMasterPassword($_SESSION["password"])) {
             //correct pw entered
         } else {
             //enter password dialog
             include_once self::$PATH . "initialize_portal.php";
             include self::$PATH . "enter_password.php";
         }
     } else {
         //no password set for this course
     }
     if ($path[0] == "newexam") {
         include_once self::$PATH . "initialize_portal.php";
         include self::$PATH . "new_term.php";
     }
     if ($path[0] == "removeexam") {
         include_once self::$PATH . "initialize_portal.php";
         include self::$PATH . "remove_last_term.php";
     }
     if ($path[0] == "geticon") {
         include_once self::$PATH . "initialize_portal.php";
         include self::$PATH . "get_icon.php";
         exit(0);
     }
     if ($path[0] == "directaccess") {
         include_once self::$PATH . "initialize_portal.php";
         include self::$PATH . "ajax_update_data.php";
         exit(0);
     }
     if ($path[0] == "password") {
         include_once self::$PATH . "initialize_portal.php";
         include self::$PATH . "setup_password.php";
     }
     if (isset($path[1])) {
         switch ($path[1]) {
             case "show_and_import_participants":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "show_and_import_participants.php";
                 die;
             case "show_participants_and_points":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "show_participants_and_points.php";
                 die;
             case "setplaces":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "set_places_for_participants.php";
                 break;
             case "resetplaces":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "reset_places_for_participants.php";
                 break;
             case "createplaceslist":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "create_places_list.php";
                 die;
             case "createparticipantslist":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "create_participants_list_by_name.php";
                 die;
             case "createparticipantslistbyname":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "create_participants_list_by_name.php";
                 die;
             case "createparticipantslistbyplace":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "create_participants_list_by_place.php";
                 die;
             case "createlabels":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "create_exam_labels.php";
                 die;
             case "importbonus":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "import_bonus_points.php";
                 break;
             case "examkey":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "setup_exam_examkey.php";
                 die;
             case "assignments":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "setup_exam_assignments.php";
                 die;
             case "time":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "setup_exam_date_time.php";
                 die;
             case "date":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "setup_exam_date_time.php";
                 die;
             case "room":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "setup_exam_room.php";
                 die;
             case "enterpoints":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "input_exam_results.php";
                 die;
             case "excelexamoffice":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "export_results_examoffice_excel.php";
                 die;
             case "excelexamoffice_hislsf":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "export_results_examoffice_excel_hislsf.php";
                 die;
             case "excelstatistics":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "export_results_and_statistics_excel.php";
                 die;
             case "pdfstatistics":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "export_results_and_statistics_pdf.php";
                 die;
             case "freetext":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "setup_exam_freetext.php";
                 break;
             case "deletedata":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "delete_term_data.php";
                 break;
             case "deleteterm":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "delete_term.php";
                 break;
             case "mail":
                 include_once self::$PATH . "initialize_portal.php";
                 include self::$PATH . "mail.php";
                 break;
             default:
                 //do nothing
         }
     }
     include self::$PATH . "exam_organization.php";
     return TRUE;
 }