本文整理汇总了PHP中assign::set_course方法的典型用法代码示例。如果您正苦于以下问题:PHP assign::set_course方法的具体用法?PHP assign::set_course怎么用?PHP assign::set_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assign
的用法示例。
在下文中一共展示了assign::set_course方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assign
/**
* Any data processing needed before the form is displayed
* (needed to set up draft areas for editor and filemanager elements)
* @param array $defaultvalues
*/
function data_preprocessing(&$defaultvalues) {
global $DB;
$ctx = null;
if ($this->current && $this->current->coursemodule) {
$cm = get_coursemodule_from_instance('assign', $this->current->id, 0, false, MUST_EXIST);
$ctx = context_module::instance($cm->id);
}
$assignment = new assign($ctx, null, null);
if ($this->current && $this->current->course) {
if (!$ctx) {
$ctx = context_course::instance($this->current->course);
}
$assignment->set_course($DB->get_record('course', array('id'=>$this->current->course), '*', MUST_EXIST));
}
$assignment->plugin_data_preprocessing($defaultvalues);
}
示例2: data_preprocessing
/**
* Any data processing needed before the form is displayed
* (needed to set up draft areas for editor and filemanager elements)
* @param array $defaultvalues
*/
public function data_preprocessing(&$defaultvalues)
{
global $DB;
$ctx = null;
if ($this->current && $this->current->coursemodule) {
$cm = get_coursemodule_from_instance('assign', $this->current->id, 0, false, MUST_EXIST);
$ctx = context_module::instance($cm->id);
}
$assignment = new assign($ctx, null, null);
if ($this->current && $this->current->course) {
if (!$ctx) {
$ctx = context_course::instance($this->current->course);
}
$course = $DB->get_record('course', array('id' => $this->current->course), '*', MUST_EXIST);
$assignment->set_course($course);
}
$draftitemid = file_get_submitted_draft_itemid('introattachments');
file_prepare_draft_area($draftitemid, $ctx->id, 'mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA, 0, array('subdirs' => 0));
$defaultvalues['introattachments'] = $draftitemid;
$assignment->plugin_data_preprocessing($defaultvalues);
}