本文整理汇总了PHP中company::remove_user_from_shared_course方法的典型用法代码示例。如果您正苦于以下问题:PHP company::remove_user_from_shared_course方法的具体用法?PHP company::remove_user_from_shared_course怎么用?PHP company::remove_user_from_shared_course使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类company
的用法示例。
在下文中一共展示了company::remove_user_from_shared_course方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unenrol
/**
* Unenrol a user from a courses
* @param object $user
* @param array $courseids
* @param int $companyid
* @return void
*/
public static function unenrol($user, $courseids, $companyid = null)
{
global $DB, $PAGE;
foreach ($courseids as $courseid) {
if (!$DB->get_record('iomad_courses', array('courseid' => $courseid, 'shared' => 0))) {
$shared = true;
} else {
$shared = false;
}
$course = $DB->get_record('course', array('id' => $courseid));
$courseenrolmentmanager = new course_enrolment_manager($PAGE, $course);
$ues = $courseenrolmentmanager->get_user_enrolments($user->id);
foreach ($ues as $ue) {
if ($ue->enrolmentinstance->courseid == $courseid) {
$courseenrolmentmanager->unenrol_user($ue);
if ($shared) {
if (!empty($companyid)) {
company::remove_user_from_shared_course($courseid, $user->id, $companyid);
}
}
}
}
}
}