本文整理汇总了PHP中enrol_plugin::enrol_user方法的典型用法代码示例。如果您正苦于以下问题:PHP enrol_plugin::enrol_user方法的具体用法?PHP enrol_plugin::enrol_user怎么用?PHP enrol_plugin::enrol_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enrol_plugin
的用法示例。
在下文中一共展示了enrol_plugin::enrol_user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enrol_user
/**
* Enrol user into course via enrol instance.
*
* @param stdClass $instance
* @param int $userid
* @param int $roleid optional role id
* @param int $timestart 0 means unknown
* @param int $timeend 0 means forever
* @param int $status default to ENROL_USER_ACTIVE for new enrolments, no change by default in updates
* @param bool $recovergrades restore grade history
* @return void
*/
public function enrol_user(stdClass $instance, $userid, $roleid = null, $timestart = 0, $timeend = 0, $status = null, $recovergrades = null)
{
parent::enrol_user($instance, $userid, null, $timestart, $timeend, $status, $recovergrades);
if ($roleid) {
$context = context_course::instance($instance->courseid, MUST_EXIST);
role_assign($roleid, $userid, $context->id, 'enrol_' . $this->get_name(), $instance->id);
}
}