當前位置: 首頁>>代碼示例>>PHP>>正文


PHP assign::submit_for_grading方法代碼示例

本文整理匯總了PHP中assign::submit_for_grading方法的典型用法代碼示例。如果您正苦於以下問題:PHP assign::submit_for_grading方法的具體用法?PHP assign::submit_for_grading怎麽用?PHP assign::submit_for_grading使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在assign的用法示例。


在下文中一共展示了assign::submit_for_grading方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_get_participant_no_user

 /**
  * get_participant should return a summarised list of details if requested.
  */
 public function test_get_participant_no_user()
 {
     global $DB;
     $this->resetAfterTest(true);
     $result = $this->create_assign_with_student_and_teacher();
     $assignmodule = $result['assign'];
     $student = $result['student'];
     $teacher = $result['teacher'];
     $course = $result['course'];
     $context = context_course::instance($course->id);
     $teacherrole = $DB->get_record('role', array('shortname' => 'teacher'));
     // Create an assign instance to save a submission.
     set_config('submissionreceipts', 0, 'assign');
     $cm = get_coursemodule_from_instance('assign', $assignmodule->id);
     $context = context_module::instance($cm->id);
     $assign = new assign($context, $cm, $course);
     $this->setUser($student);
     // Simulate a submission.
     $data = new stdClass();
     $data->onlinetext_editor = array('itemid' => file_get_unused_draft_itemid(), 'text' => 'Student submission text', 'format' => FORMAT_MOODLE);
     $notices = array();
     $assign->save_submission($data, $notices);
     $data = new stdClass();
     $data->userid = $student->id;
     $assign->submit_for_grading($data, array());
     $this->setUser($teacher);
     $result = mod_assign_external::get_participant($assignmodule->id, $student->id, false);
     $this->assertEquals($student->id, $result['id']);
     $this->assertEquals(fullname($student), $result['fullname']);
     $this->assertTrue($result['submitted']);
     $this->assertTrue($result['requiregrading']);
     $this->assertFalse($result['blindmarking']);
     // Make sure we don't get any additional info.
     $this->assertTrue(empty($result['user']));
 }
開發者ID:jackdaniels79,項目名稱:moodle,代碼行數:38,代碼來源:externallib_test.php

示例2: submit_for_grading

 /**
  * Submit the logged in users assignment for grading.
  *
  * @param int $assignmentid The id of the assignment
  * @return array of warnings to indicate any errors.
  * @since Moodle 2.6
  */
 public static function submit_for_grading($assignmentid, $acceptsubmissionstatement)
 {
     global $CFG, $USER;
     require_once "{$CFG->dirroot}/mod/assign/locallib.php";
     $params = self::validate_parameters(self::submit_for_grading_parameters(), array('assignmentid' => $assignmentid, 'acceptsubmissionstatement' => $acceptsubmissionstatement));
     $cm = get_coursemodule_from_instance('assign', $params['assignmentid'], 0, false, MUST_EXIST);
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     $assignment = new assign($context, $cm, null);
     $warnings = array();
     $data = new stdClass();
     $data->submissionstatement = $params['acceptsubmissionstatement'];
     $notices = array();
     if (!$assignment->submit_for_grading($data, $notices)) {
         $detail = 'User id: ' . $USER->id . ', Assignment id: ' . $params['assignmentid'] . ' Notices:' . implode(', ', $notices);
         $warnings[] = self::generate_warning($params['assignmentid'], 'couldnotsubmitforgrading', $detail);
     }
     return $warnings;
 }
開發者ID:rushi963,項目名稱:moodle,代碼行數:26,代碼來源:externallib.php


注:本文中的assign::submit_for_grading方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。