/** * Shows a form that allows the workflow state for selected submissions to be changed. * * @param moodleform $mform Set to a grading batch operations form * @return string - the page to view after processing these actions */ protected function view_batch_set_workflow_state($mform) { global $CFG, $DB; require_once $CFG->dirroot . '/mod/assign/batchsetmarkingworkflowstateform.php'; $o = ''; $submitteddata = $mform->get_data(); $users = $submitteddata->selectedusers; $userlist = explode(',', $users); $formdata = array('id' => $this->get_course_module()->id, 'selectedusers' => $users); $usershtml = ''; $usercount = 0; $extrauserfields = get_extra_user_fields($this->get_context()); foreach ($userlist as $userid) { if ($usercount >= 5) { $usershtml .= get_string('moreusers', 'assign', count($userlist) - 5); break; } $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST); $usershtml .= $this->get_renderer()->render(new assign_user_summary($user, $this->get_course()->id, has_capability('moodle/site:viewfullnames', $this->get_course_context()), $this->is_blind_marking(), $this->get_uniqueid_for_user($user->id), $extrauserfields, !$this->is_active_user($userid))); $usercount += 1; } $formparams = array('userscount' => count($userlist), 'usershtml' => $usershtml, 'markingworkflowstates' => $this->get_marking_workflow_states_for_current_user()); $mform = new mod_assign_batch_set_marking_workflow_state_form(null, $formparams); $mform->set_data($formdata); // Initialises the hidden elements. $header = new assign_header($this->get_instance(), $this->get_context(), $this->show_intro(), $this->get_course_module()->id, get_string('setmarkingworkflowstate', 'assign')); $o .= $this->get_renderer()->render($header); $o .= $this->get_renderer()->render(new assign_form('setworkflowstate', $mform)); $o .= $this->view_footer(); \mod_assign\event\batch_set_workflow_state_viewed::create_from_assign($this)->trigger(); return $o; }