Exemplo n.º 1
0
 /**
  * View submissions page (contains details of current submission).
  *
  * @return string
  */
 protected function view_submission_page()
 {
     global $CFG, $DB, $USER, $PAGE;
     $instance = $this->get_instance();
     $o = '';
     $postfix = '';
     if ($this->has_visible_attachments()) {
         $postfix = $this->render_area_files('mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA, 0);
     }
     $o .= $this->get_renderer()->render(new assign_header($instance, $this->get_context(), $this->show_intro(), $this->get_course_module()->id, '', '', $postfix));
     // Display plugin specific headers.
     $plugins = array_merge($this->get_submission_plugins(), $this->get_feedback_plugins());
     foreach ($plugins as $plugin) {
         if ($plugin->is_enabled() && $plugin->is_visible()) {
             $o .= $this->get_renderer()->render(new assign_plugin_header($plugin));
         }
     }
     if ($this->can_view_grades()) {
         $draft = ASSIGN_SUBMISSION_STATUS_DRAFT;
         $submitted = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
         // Group selector will only be displayed if necessary.
         $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id));
         $o .= groups_print_activity_menu($this->get_course_module(), $currenturl->out(), true);
         $activitygroup = groups_get_activity_group($this->get_course_module());
         if ($instance->teamsubmission) {
             $defaultteammembers = $this->get_submission_group_members(0, true);
             $warnofungroupedusers = count($defaultteammembers) > 0 && $instance->preventsubmissionnotingroup;
             $summary = new assign_grading_summary($this->count_teams($activitygroup), $instance->submissiondrafts, $this->count_submissions_with_status($draft), $this->is_any_submission_plugin_enabled(), $this->count_submissions_with_status($submitted), $instance->cutoffdate, $instance->duedate, $this->get_course_module()->id, $this->count_submissions_need_grading(), $instance->teamsubmission, $warnofungroupedusers);
             $o .= $this->get_renderer()->render($summary);
         } else {
             // The active group has already been updated in groups_print_activity_menu().
             $countparticipants = $this->count_participants($activitygroup);
             $summary = new assign_grading_summary($countparticipants, $instance->submissiondrafts, $this->count_submissions_with_status($draft), $this->is_any_submission_plugin_enabled(), $this->count_submissions_with_status($submitted), $instance->cutoffdate, $instance->duedate, $this->get_course_module()->id, $this->count_submissions_need_grading(), $instance->teamsubmission, false);
             $o .= $this->get_renderer()->render($summary);
         }
     }
     $grade = $this->get_user_grade($USER->id, false);
     $submission = $this->get_user_submission($USER->id, false);
     if ($this->can_view_submission($USER->id)) {
         $o .= $this->view_student_summary($USER, true);
     }
     $o .= $this->view_footer();
     \mod_assign\event\submission_status_viewed::create_from_assign($this)->trigger();
     return $o;
 }
Exemplo n.º 2
0
 /**
  * Trigger the submission status viewed event.
  *
  * @param int $assignid assign instance id
  * @return array of warnings and status result
  * @since Moodle 3.1
  */
 public static function view_submission_status($assignid)
 {
     $warnings = array();
     $params = array('assignid' => $assignid);
     $params = self::validate_parameters(self::view_submission_status_parameters(), $params);
     list($assign, $course, $cm, $context) = self::validate_assign($params['assignid']);
     \mod_assign\event\submission_status_viewed::create_from_assign($assign)->trigger();
     $result = array();
     $result['status'] = true;
     $result['warnings'] = $warnings;
     return $result;
 }
Exemplo n.º 3
0
 /**
  * View submissions page (contains details of current submission).
  *
  * @return string
  */
 protected function view_submission_page()
 {
     global $CFG, $DB, $USER, $PAGE;
     $instance = $this->get_instance();
     $o = '';
     $o .= $this->get_renderer()->render(new assign_header($instance, $this->get_context(), $this->show_intro(), $this->get_course_module()->id));
     // Display plugin specific headers.
     $plugins = array_merge($this->get_submission_plugins(), $this->get_feedback_plugins());
     foreach ($plugins as $plugin) {
         if ($plugin->is_enabled() && $plugin->is_visible()) {
             $o .= $this->get_renderer()->render(new assign_plugin_header($plugin));
         }
     }
     if ($this->can_view_grades()) {
         $draft = ASSIGN_SUBMISSION_STATUS_DRAFT;
         $submitted = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
         if ($instance->teamsubmission) {
             $summary = new assign_grading_summary($this->count_teams(), $instance->submissiondrafts, $this->count_submissions_with_status($draft), $this->is_any_submission_plugin_enabled(), $this->count_submissions_with_status($submitted), $instance->cutoffdate, $instance->duedate, $this->get_course_module()->id, $this->count_submissions_need_grading(), $instance->teamsubmission);
             $o .= $this->get_renderer()->render($summary);
         } else {
             $summary = new assign_grading_summary($this->count_participants(0), $instance->submissiondrafts, $this->count_submissions_with_status($draft), $this->is_any_submission_plugin_enabled(), $this->count_submissions_with_status($submitted), $instance->cutoffdate, $instance->duedate, $this->get_course_module()->id, $this->count_submissions_need_grading(), $instance->teamsubmission);
             $o .= $this->get_renderer()->render($summary);
         }
     }
     $grade = $this->get_user_grade($USER->id, false);
     $submission = $this->get_user_submission($USER->id, false);
     if ($this->can_view_submission($USER->id)) {
         $o .= $this->view_student_summary($USER, true);
     }
     $o .= $this->view_footer();
     \mod_assign\event\submission_status_viewed::create_from_assign($this)->trigger();
     return $o;
 }
Exemplo n.º 4
0
    /**
     * View submissions page (contains details of current submission).
     *
     * @return string
     */
    protected function view_submission_page() {
        global $CFG, $DB, $USER, $PAGE;

        $instance = $this->get_instance();

        $o = '';

        $postfix = '';
        if ($this->has_visible_attachments()) {
            $postfix = $this->render_area_files('mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA, 0);
        }
        $o .= $this->get_renderer()->render(new assign_header($instance,
                                                      $this->get_context(),
                                                      $this->show_intro(),
                                                      $this->get_course_module()->id,
                                                      '', '', $postfix));

        // Display plugin specific headers.
        $plugins = array_merge($this->get_submission_plugins(), $this->get_feedback_plugins());
        foreach ($plugins as $plugin) {
            if ($plugin->is_enabled() && $plugin->is_visible()) {
                $o .= $this->get_renderer()->render(new assign_plugin_header($plugin));
            }
        }

        if ($this->can_view_grades()) {
            // Group selector will only be displayed if necessary.
            $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id));
            $o .= groups_print_activity_menu($this->get_course_module(), $currenturl->out(), true);

            $summary = $this->get_assign_grading_summary_renderable();
            $o .= $this->get_renderer()->render($summary);
        }
        $grade = $this->get_user_grade($USER->id, false);
        $submission = $this->get_user_submission($USER->id, false);

        if ($this->can_view_submission($USER->id)) {
            $o .= $this->view_student_summary($USER, true);
        }

        $o .= $this->view_footer();

        \mod_assign\event\submission_status_viewed::create_from_assign($this)->trigger();

        return $o;
    }
Exemplo n.º 5
0
 /**
  * Trigger the submission status viewed event.
  *
  * @param int $assignid assign instance id
  * @return array of warnings and status result
  * @since Moodle 3.1
  */
 public static function view_submission_status($assignid)
 {
     global $DB, $CFG;
     require_once "{$CFG->dirroot}/mod/assign/locallib.php";
     $warnings = array();
     $params = array('assignid' => $assignid);
     $params = self::validate_parameters(self::view_submission_status_parameters(), $params);
     // Request and permission validation.
     $assign = $DB->get_record('assign', array('id' => $params['assignid']), 'id', MUST_EXIST);
     list($course, $cm) = get_course_and_cm_from_instance($assign, 'assign');
     $context = context_module::instance($cm->id);
     // Please, note that is not required to check mod/assign:view because is done by validate_context->require_login.
     self::validate_context($context);
     $assign = new assign($context, $cm, $course);
     \mod_assign\event\submission_status_viewed::create_from_assign($assign)->trigger();
     $result = array();
     $result['status'] = true;
     $result['warnings'] = $warnings;
     return $result;
 }