本文整理匯總了PHP中ilCourseParticipants::getInstanceByObjId方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilCourseParticipants::getInstanceByObjId方法的具體用法?PHP ilCourseParticipants::getInstanceByObjId怎麽用?PHP ilCourseParticipants::getInstanceByObjId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilCourseParticipants
的用法示例。
在下文中一共展示了ilCourseParticipants::getInstanceByObjId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handleGroupCreation
/**
* Handle group creation inside main course
* @param type $a_obj_id
*/
protected function handleGroupCreation($a_node_ref_id, $a_node_obj_id, $a_node_obj_type)
{
if ($a_node_obj_type != 'grp') {
$GLOBALS['ilLog']->write(__METHOD__ . ': New node not of type grp for ref_id ' . $a_node_ref_id);
return false;
}
if (!$a_node_ref_id) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No ref_id given. Aborting!');
return false;
}
$parent_id = $GLOBALS['tree']->getParentId($a_node_ref_id);
if (ilObject::_lookupType($parent_id, true) != 'crs') {
$GLOBALS['ilLog']->write(__METHOD__ . ': Parent type is not of type "crs"');
return false;
}
if (!$this->isMainCourse($parent_id)) {
$GLOBALS['ilLog']->write(__METHOD__ . ': Parent course is not main course for group ref_id ' . $a_node_ref_id);
return false;
}
// determine default group role
$group_role_id = 0;
foreach ($GLOBALS['rbacreview']->getRolesOfObject($a_node_ref_id, TRUE) as $role_id) {
$role_title = ilObject::_lookupTitle($role_id);
if (substr($role_title, 0, 8) == 'il_grp_m') {
$group_role_id = $role_id;
}
}
if (!$group_role_id) {
$GLOBALS['ilLog']->write(__METHOD__ . ': Did not found default group member role for group obj_id ' . $a_node_obj_id);
return false;
}
// now assign all members of the parent course to the new group
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$part = ilCourseParticipants::getInstanceByObjId(ilObject::_lookupObjectId($parent_id));
foreach ($part->getMembers() as $member_id) {
// do not assign user if he/she is admin or tutor
if ($part->isAdmin($member_id) || $part->isTutor($member_id)) {
continue;
}
$GLOBALS['rbacadmin']->assignUser($group_role_id, $member_id);
}
return true;
}