// Getting all courses this users in enrolled in as instructor.
 $courses = G\coursesas($USER->id, "teacher");
 $act = optional_param("action", null, PARAM_TEXT);
 $choosencourse = null;
 $datasaved = false;
 // If the form submited for choosing a course.
 if ($act == "choosingCourse") {
     $choosencourse = optional_param("courseID", null, PARAM_INT);
 } else {
     if ($act == "assessment") {
         // If the form submited for assessing a course.
         $teacherid = $USER->id;
         $timetaken = time() - optional_param("AssStartTime", null, PARAM_INT);
         $courseid = optional_param("course_id", null, PARAM_INT);
         // Creating a new row for course assessment.
         $assid = G\newassessment($teacherid, time(), $timetaken, $csem, "Teacher", $courseid);
         $rangeinput = optional_param_array("rangeInput", null, PARAM_NUMBER);
         $subattids = optional_param_array("subattID", null, PARAM_INT);
         // Creating a new row for each sub-attributed assessed.
         foreach ($subattids as $subattid) {
             G\newsubattassessment($assid, $subattid, current($rangeinput), "Teacher");
             next($rangeinput);
         }
         $datasaved = true;
     }
 }
 ?>
 <div  style="margin-bottom: 0px; width:1100px;" class='block_course_overview  block'>
     <div class="header">
         <div class="title">
             <h2><i class='fa fa-question-circle'></i>
 /**
  * @runInSeparateProcess
  */
 public function test_report()
 {
     $this->resetAfterTest(true);
     $user = $this->getDataGenerator()->create_user();
     $this->adduser($user->id);
     $this->setUser($user);
     $course = $this->getDataGenerator()->create_course();
     $cohort = $this->getDataGenerator()->create_cohort(array('idnumber' => 1234.56789));
     cohort_add_member($cohort->id, $user->id);
     G\addtermid('1234');
     $this->enroluserincourse($course, $cohort, 'teacher');
     $user2 = $this->getDataGenerator()->create_user();
     $this->adduser($user2->id);
     $user3 = $this->getDataGenerator()->create_user();
     $this->adduser($user3->id);
     $user4 = $this->getDataGenerator()->create_user();
     $this->adduser($user4->id);
     $cohort2 = $this->getDataGenerator()->create_cohort(array('idnumber' => 9876.54321));
     cohort_add_member($cohort2->id, $user2->id);
     cohort_add_member($cohort2->id, $user3->id);
     cohort_add_member($cohort2->id, $user4->id);
     G\addtermid('9876');
     $this->enroluserincourse($course, $cohort2, 'student');
     $year = date("Y");
     $sem = G\semOfDate(date("d"), date("m"));
     G\newassessment($user3->id, time(), 121, $sem, "Student");
     $students = G\studentsofcourse($course->id);
     $numofstudents = count($students);
     $numofstudentsdoneassessment = 0;
     if (count($students) > 0) {
         foreach ($students as $studentid) {
             if (G\doneassessment($studentid, $sem, $year)) {
                 $numofstudentsdoneassessment++;
             }
         }
     }
     $this->assertEquals(3, $numofstudents);
     $this->assertEquals(1, $numofstudentsdoneassessment);
 }
示例#3
0
 G\makenavigatorlinkactive($PAGE, "assessment");
 echo $OUTPUT->header();
 // NextCourse: function to change the course in "Contributed Courses" Coloumn
 // HighlightDescription: highliting the value description based on the range input.
 $initjs = " var formSubmitting = false;\n                var changesHappened = false;\n                var setFormSubmitting = function () {\n                    formSubmitting = true;\n                };\n                var setChanges = function () {\n                    changesHappened = true;\n                };\n                window.onload = function () {\n                    window.addEventListener('beforeunload', function (e) {\n                        if (formSubmitting || !changesHappened) {\n                            return undefined;\n                        }\n                        var confirmationMessage = 'It looks like you have been editing something. '\n                                + 'If you leave before saving, your changes will be lost.';\n\n                        (e || window.event).returnValue = confirmationMessage; //Gecko + IE\n                        return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.\n                    });\n                };\n                function ShowDes(val1, val2, num) {\n                    for (var i = 0; i < num; i++) {\n                        document.getElementById('attDes' + val1 + i).style.display = 'none';\n                    }\n                    document.getElementById('attDes' + val1 + val2).style.display = 'table';\n                }\n                function highLightDescription(id, val) {\n\n                    newId = id + val;\n                    \$('[class^=' + id + ']').removeClass('info');\n                    \$('.' + newId).addClass('info');\n                }\n                \$(document).ready(function () {\n\n                    \$('#myTabs a').click(function (e) {\n                        e.preventDefault()\n                        \$(this).tab('show')\n                      });\n\n                    \$('.rangeInput').keyup(function( event ) {\n                        id = this.id.substring(10);\n                        val = \$(this).val();\n                        if(val > 0 && val < 6)\n                            highLightDescription('descriptionRow'+id+val);\n                    });\n\n                    \$('.rangeInput').mouseup(function( event ) {\n                        id = this.id.substring(10);\n                        val = \$(this).val();\n                        if(val > 0 && val < 6)\n                            highLightDescription('descriptionRow'+id , val);\n                    });\n                });\n\n                function nextCourse(id, counter, max){\n                    if(counter == 1){\n                        var option1={direction: 'right'};\n                        var option2={direction: 'left'};\n                    }\n                    if(counter == -1){\n                        var option1={direction: 'left'};\n                        var option2={direction: 'right'};\n                    }\n                    currentID = parseInt(\$('.'+id+':visible').attr('id'));\n                    nextID = (parseInt(currentID) + counter + max)%max;\n                    \$('#'+id+currentID).toggle('slide', option1, 300);\n                    setTimeout(function(){\n                        \$('#'+id+nextID).toggle('slide', option2, 300);\n                    }, 300);\n                }";
 echo html_writer::script($initjs);
 $act = optional_param("action", null, PARAM_TEXT);
 $currentsem = G\semofdate(date("d"), date("m"));
 $datasaved = false;
 // If the form submited to save an assessment.
 if ($act == "assessment") {
     $studentid = $USER->id;
     // Variable storing the amount of time user spent on assessment.
     $timetaken = time() - optional_param("AssStartTime", null, PARAM_INT);
     // Creating a row in assessment table.
     $assid = G\newassessment($studentid, time(), $timetaken, $currentsem, "Student");
     $rangeinput = optional_param_array("rangeInput", null, PARAM_NUMBER);
     $subattids = optional_param_array("subattID", null, PARAM_INT);
     foreach ($subattids as $subattid) {
         // Creating a row for each of the sub-attributes of assessment.
         $subattassessmentid = G\newsubattassessment($assid, $subattid, current($rangeinput), "Student");
         next($rangeinput);
         $courseid = optional_param_array("CourseIDFor{$subattid}", null, PARAM_INT);
         if (count($courseid) > 0) {
             foreach ($courseid as $cids) {
                 $ccradio = optional_param("CourseRadio{$subattid}{$cids}", null, PARAM_INT);
                 $ccvalue = 0;
                 if ($ccradio != null) {
                     $ccvalue = $ccradio;
                 }
                 // Creating a row in ContributedCourses table for each of courses having impact on improvement of sub-attribute.