~ubuntu-branches/ubuntu/trusty/moodle/trusty

« back to all changes in this revision

Viewing changes to mod/assign/locallib.php

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-01-21 13:40:52 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20140121134052-ym2qvsp2cd9vq0p6
Tags: 2.5.4-1
* New upstream release, fixing security issues:
  - MSA-14-0001 Config passwords visibility issue [CVE-2014-0008]
  - MSA-14-0002 Group constraints lacking in "login as" [CVE-2014-0009]
  - MSA-14-0003 CSRF vulnerability in profile fields [CVE-2014-0010]
* Move /var/lib/moodle directory into package.
* Revert back to bundled yui3. Unfortunately, version in Debian and
  of upstream are not compatible (closes: #735312).

Show diffs side-by-side

added added

removed removed

Lines of Context:
428
428
                // Save changes button.
429
429
                $action = 'grade';
430
430
                if ($this->process_save_grade($mform)) {
431
 
                    $message = get_string('gradingchangessaved', 'assign');
432
 
                    $action = 'savegradingresult';
 
431
                    $action = 'redirect';
 
432
                    $nextpageparams['action'] = 'savegradingresult';
433
433
                }
434
434
            } else {
435
435
                // Cancel button.
465
465
            redirect($nextpageurl);
466
466
            return;
467
467
        } else if ($action == 'savegradingresult') {
 
468
            $message = get_string('gradingchangessaved', 'assign');
468
469
            $o .= $this->view_savegrading_result($message);
469
470
        } else if ($action == 'quickgradingresult') {
470
471
            $mform = null;
785
786
            $event = new stdClass();
786
787
 
787
788
            $params = array('modulename'=>'assign', 'instance'=>$instance->id);
788
 
            $event->id = $DB->get_field('event',
789
 
                                        'id',
790
 
                                        $params);
 
789
            $event->id = $DB->get_field('event', 'id', $params);
 
790
            $event->name = $instance->name;
 
791
            $event->timestart = $instance->duedate;
 
792
 
 
793
            // Convert the links to pluginfile. It is a bit hacky but at this stage the files
 
794
            // might not have been saved in the module area yet.
 
795
            $intro = $instance->intro;
 
796
            if ($draftid = file_get_submitted_draft_itemid('introeditor')) {
 
797
                $intro = file_rewrite_urls_to_pluginfile($intro, $draftid);
 
798
            }
 
799
 
 
800
            // We need to remove the links to files as the calendar is not ready
 
801
            // to support module events with file areas.
 
802
            $intro = strip_pluginfile_content($intro);
 
803
            $event->description = array(
 
804
                'text' => $intro,
 
805
                'format' => $instance->introformat
 
806
            );
791
807
 
792
808
            if ($event->id) {
793
 
                $event->name        = $instance->name;
794
 
                $event->description = format_module_intro('assign', $instance, $coursemoduleid);
795
 
                $event->timestart   = $instance->duedate;
796
 
 
797
809
                $calendarevent = calendar_event::load($event->id);
798
810
                $calendarevent->update($event);
799
811
            } else {
800
 
                $event = new stdClass();
801
 
                $event->name        = $instance->name;
802
 
                $event->description = format_module_intro('assign', $instance, $coursemoduleid);
 
812
                unset($event->id);
803
813
                $event->courseid    = $instance->course;
804
814
                $event->groupid     = 0;
805
815
                $event->userid      = 0;
806
816
                $event->modulename  = 'assign';
807
817
                $event->instance    = $instance->id;
808
818
                $event->eventtype   = 'due';
809
 
                $event->timestart   = $instance->duedate;
810
819
                $event->timeduration = 0;
811
 
 
812
820
                calendar_event::create($event);
813
821
            }
814
822
        } else {
1935
1943
            return $o;
1936
1944
        }
1937
1945
 
1938
 
        $strsectionname  = get_string('sectionname', 'format_'.$course->format);
 
1946
        $strsectionname = '';
1939
1947
        $usesections = course_format_uses_sections($course->format);
1940
1948
        $modinfo = get_fast_modinfo($course);
1941
1949
 
1942
1950
        if ($usesections) {
 
1951
            $strsectionname = get_string('sectionname', 'format_'.$course->format);
1943
1952
            $sections = $modinfo->get_section_info_all();
1944
1953
        }
1945
1954
        $courseindexsummary = new assign_course_index_summary($usesections, $strsectionname);
2765
2774
                                                  $this->get_course_module()->id,
2766
2775
                                                  $this->get_return_action(),
2767
2776
                                                  $this->get_return_params(),
2768
 
                                                  true);
 
2777
                                                  true,
 
2778
                                                  $useridlistid,
 
2779
                                                  $rownum);
2769
2780
 
2770
2781
            $o .= $this->get_renderer()->render($history);
2771
2782
        }
3451
3462
                                                      $this->get_course_module()->id,
3452
3463
                                                      $this->get_return_action(),
3453
3464
                                                      $this->get_return_params(),
3454
 
                                                      false);
 
3465
                                                      false,
 
3466
                                                      0,
 
3467
                                                      0);
3455
3468
 
3456
3469
                $o .= $this->get_renderer()->render($history);
3457
3470
            }
3954
3967
 
3955
3968
        $graders = array();
3956
3969
        if (groups_get_activity_groupmode($this->get_course_module()) == SEPARATEGROUPS) {
3957
 
            if ($groups = groups_get_all_groups($this->get_course()->id, $userid)) {
 
3970
            if ($groups = groups_get_all_groups($this->get_course()->id, $userid, $this->get_course_module()->groupingid)) {
3958
3971
                foreach ($groups as $group) {
3959
3972
                    foreach ($potentialgraders as $grader) {
3960
3973
                        if ($grader->id == $userid) {