当前位置: 首页>>代码示例>>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;未经允许,请勿转载。