~ubuntu-branches/ubuntu/utopic/moodle/utopic

« back to all changes in this revision

Viewing changes to mod/assign/feedback/offline/locallib.php

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (36.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140512161038-puyqf65k4e0s8ytz
Tags: 2.6.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 */
37
37
class assign_feedback_offline extends assign_feedback_plugin {
38
38
 
 
39
    /** @var boolean|null $activecache Cached lookup of advanced grading */
 
40
    private $activecache = null;
 
41
 
39
42
    /**
40
43
     * Get the name of the file feedback plugin
41
44
     * @return string
80
83
 
81
84
        $gradeimporter = new assignfeedback_offline_grade_importer($importid, $this->assignment);
82
85
 
83
 
        $context = get_context_instance(CONTEXT_USER, $USER->id);
 
86
        $context = context_user::instance($USER->id);
84
87
        $fs = get_file_storage();
85
88
        if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
86
89
            redirect(new moodle_url('view.php',
373
376
     * @return bool
374
377
     */
375
378
    public function is_enabled() {
376
 
        $gradingmanager = get_grading_manager($this->assignment->get_context(), 'mod_assign', 'submissions');
377
 
        $controller = $gradingmanager->get_active_controller();
378
 
        $active = !empty($controller);
 
379
        if ($this->activecache === null) {
 
380
            $gradingmanager = get_grading_manager($this->assignment->get_context(), 'mod_assign', 'submissions');
 
381
            $controller = $gradingmanager->get_active_controller();
 
382
            $this->activecache = !empty($controller);
 
383
        }
379
384
 
380
 
        if ($active) {
 
385
        if ($this->activecache) {
381
386
            return false;
 
387
        } else {
 
388
            return parent::is_enabled();
382
389
        }
383
 
        return parent::is_enabled();
384
390
    }
385
391
 
386
392
    /**