本文整理汇总了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;
}