本文整理匯總了PHP中stdClass::get_user_submission方法的典型用法代碼示例。如果您正苦於以下問題:PHP stdClass::get_user_submission方法的具體用法?PHP stdClass::get_user_submission怎麽用?PHP stdClass::get_user_submission使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stdClass
的用法示例。
在下文中一共展示了stdClass::get_user_submission方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
/**
* Setup all the various parts of an assignment activity including creating an onlinetext submission.
*/
protected function setUp()
{
$this->user = $this->getDataGenerator()->create_user();
$this->course = $this->getDataGenerator()->create_course();
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
$params['course'] = $this->course->id;
$instance = $generator->create_instance($params);
$this->cm = get_coursemodule_from_instance('assign', $instance->id);
$this->context = context_module::instance($this->cm->id);
$this->assign = new testable_assign($this->context, $this->cm, $this->course);
$this->setUser($this->user->id);
$this->submission = $this->assign->get_user_submission($this->user->id, true);
$this->data = new stdClass();
$this->data->onlinetext_editor = array('itemid' => file_get_unused_draft_itemid(), 'text' => 'Submission text', 'format' => FORMAT_PLAIN);
}
示例2: setUp
/**
* Setup all the various parts of an assignment activity including creating a file submission.
*/
protected function setUp()
{
$this->user = $this->getDataGenerator()->create_user();
$this->course = $this->getDataGenerator()->create_course();
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
$params['course'] = $this->course->id;
$instance = $generator->create_instance($params);
$this->cm = get_coursemodule_from_instance('assign', $instance->id);
$this->context = context_module::instance($this->cm->id);
$this->assign = new testable_assign($this->context, $this->cm, $this->course);
$this->setUser($this->user->id);
$this->submission = $this->assign->get_user_submission($this->user->id, true);
$fs = get_file_storage();
$dummy = (object) array('contextid' => $this->context->id, 'component' => 'assignsubmission_onenote', 'filearea' => \local_onenote\api\base::ASSIGNSUBMISSION_ONENOTE_FILEAREA, 'itemid' => $this->submission->id, 'filepath' => '/', 'filename' => 'myassignmnent.pdf');
$this->fi = $fs->create_file_from_string($dummy, 'Content of ' . $dummy->filename);
$dummy = (object) array('contextid' => $this->context->id, 'component' => 'assignsubmission_onenote', 'filearea' => \local_onenote\api\base::ASSIGNSUBMISSION_ONENOTE_FILEAREA, 'itemid' => $this->submission->id, 'filepath' => '/', 'filename' => 'myassignmnent.png');
$this->fi2 = $fs->create_file_from_string($dummy, 'Content of ' . $dummy->filename);
$this->files = $fs->get_area_files($this->context->id, 'assignsubmission_onenote', \local_onenote\api\base::ASSIGNSUBMISSION_ONENOTE_FILEAREA, $this->submission->id, 'id', false);
}