Пример #1
0
 /**
  * Shows a form that allows the allocated marker 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
  */
 public function view_batch_markingallocation($mform)
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/mod/assign/batchsetallocatedmarkerform.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);
     list($sort, $params) = users_order_by_sql();
     $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade', '', $sort);
     $markerlist = array();
     foreach ($markers as $marker) {
         $markerlist[$marker->id] = fullname($marker);
     }
     $formparams['markers'] = $markerlist;
     $mform = new mod_assign_batch_set_allocatedmarker_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('setmarkingallocation', '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_marker_allocation_viewed::create_from_assign($this)->trigger();
     return $o;
 }