Public Member Functions | |
ilObjGroup ($a_id=0, $a_call_by_reference=true) | |
Constructor public. | |
join ($a_user_id, $a_mem_role="") | |
join Group, assigns user to role private | |
getDefaultMemberRole () | |
returns object id of created default member role public | |
getDefaultAdminRole () | |
returns object id of created default adminstrator role public | |
addMember ($a_user_id, $a_mem_role) | |
add Member to Group public | |
getNewRegistrations () | |
displays list of applicants public | |
deleteApplicationListEntry ($a_userId) | |
deletes an Entry from application list public | |
leaveGroup () | |
is called when a member decides to leave group public | |
leave ($a_user_id) | |
deassign member from group role private | |
removeMember ($a_user_id, $a_grp_id="") | |
removes Member from group public | |
getGroupMemberIds () | |
get all group Member ids regardless of role public | |
getGroupMemberData ($a_mem_ids) | |
get all group Members regardless of group role. | |
getCountMembers () | |
getGroupAdminIds ($a_grpId="") | |
get Group Admin Id public | |
getDefaultGroupRoles ($a_grp_id="") | |
get default group roles, returns the defaultlike create roles il_grp_member, il_grp_admin public | |
getLocalGroupRoles () | |
get ALL local roles of group, also those created and defined afterwards only fetch data once from database. | |
getGrpStatusClosedTemplateId () | |
get group status closed template public | |
getGrpStatusOpenTemplateId () | |
get group status open template public | |
setRegistrationFlag ($a_regFlag="") | |
set Registration Flag public | |
getRegistrationFlag () | |
get Registration Flag public | |
getPassword () | |
get Password public | |
setPassword ($a_password="") | |
set Password public | |
setExpirationDateTime ($a_date) | |
set Expiration Date and Time public | |
getExpirationDateTime () | |
get Expiration Date and Time public | |
registrationPossible () | |
setGroupStatus ($a_grpStatus) | |
set group status | |
getGroupStatus () | |
get group status, redundant method because public | |
getMemberRoles ($a_user_id) | |
get group member status public | |
getMemberRolesTitle ($a_user_id) | |
get group member status public | |
setMemberStatus ($a_user_id, $a_member_role) | |
set member status public | |
isMember ($a_userId="") | |
is Member public | |
isAdmin ($a_userId) | |
is Admin public | |
ilClone ($a_parent_ref) | |
copy all properties and subobjects of a group. | |
delete () | |
delete group and all related data | |
initDefaultRoles () | |
init default roles settings public | |
notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0) | |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts. | |
isUserRegistered ($a_user_id=0) | |
Static Public Member Functions | |
_search (&$a_search_obj) | |
STATIC METHOD search for group data. | |
_getLinkToObject ($a_id) | |
STATIC METHOD create a link to the object. | |
Data Fields | |
$m_grpStatus | |
$m_roleMemberId | |
$m_roleAdminId |
Definition at line 39 of file class.ilObjGroup.php.
ilObjGroup::_getLinkToObject | ( | $ | a_id | ) | [static] |
STATIC METHOD create a link to the object.
int | uniq id |
Definition at line 1037 of file class.ilObjGroup.php.
Referenced by ilSearchGUI::__formatGroupResult(), and ilSearchResult::createLink().
{ return array("repository.php?ref_id=".$a_id."&set_mode=flat&cmdClass=ilobjgroupgui",""); }
ilObjGroup::_search | ( | &$ | a_search_obj | ) | [static] |
STATIC METHOD search for group data.
This method is called from class.ilSearch This method used by class.ilSearchGUI.php to a link to the results
object | object of search class public |
Definition at line 998 of file class.ilObjGroup.php.
References $counter, $ilBench, $query, $res, and $row.
Referenced by ilSearch::performSearch().
{ global $ilBench; // NO CLASS VARIABLES IN STATIC METHODS $where_condition = $a_search_obj->getWhereCondition("like",array("title","description")); $in = $a_search_obj->getInStatement("ore.ref_id"); $query = "SELECT ore.ref_id AS ref_id FROM object_data AS od, object_reference AS ore ". $where_condition." ". $in." ". "AND od.obj_id = ore.obj_id ". "AND od.type = 'grp' "; $ilBench->start("Search", "ilObjGroup_search"); $res = $a_search_obj->ilias->db->query($query); $ilBench->stop("Search", "ilObjGroup_search"); $counter = 0; while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $result_data[$counter++]["id"] = $row->ref_id; #$result_data[$counter]["link"] = "group.php?cmd=view&ref_id=".$row->ref_id; #$result_data[$counter++]["target"] = ""; } return $result_data ? $result_data : array(); }
ilObjGroup::addMember | ( | $ | a_user_id, | |
$ | a_mem_role | |||
) |
add Member to Group public
integer | user_id | |
integer | member role_id of local group_role |
Definition at line 117 of file class.ilObjGroup.php.
References $rbacadmin, and join().
Referenced by setMemberStatus().
{ global $rbacadmin; if (isset($a_user_id) && isset($a_mem_role) ) { $this->join($a_user_id,$a_mem_role); return true; } else { $this->ilias->raiseError(get_class($this)."::addMember(): Missing parameters !",$this->ilias->error_obj->WARNING); return false; } }
ilObjGroup::delete | ( | ) |
delete group and all related data
public
Reimplemented from ilObject.
Definition at line 895 of file class.ilObjGroup.php.
References $query.
ilObjGroup::deleteApplicationListEntry | ( | $ | a_userId | ) |
deletes an Entry from application list public
Definition at line 155 of file class.ilObjGroup.php.
References $q, $res, and ilObject::getId().
{ $q = "DELETE FROM grp_registration WHERE user_id=".$a_userId." AND grp_id=".$this->getId(); $res = $this->ilias->db->query($q); }
ilObjGroup::getCountMembers | ( | ) |
Definition at line 313 of file class.ilObjGroup.php.
References getGroupMemberIds().
{ return count($this->getGroupMemberIds()); }
ilObjGroup::getDefaultAdminRole | ( | ) |
returns object id of created default adminstrator role public
Definition at line 104 of file class.ilObjGroup.php.
References getLocalGroupRoles().
{ $local_group_Roles = $this->getLocalGroupRoles(); return $local_group_Roles["il_grp_admin_".$this->getRefId()]; }
ilObjGroup::getDefaultGroupRoles | ( | $ | a_grp_id = "" |
) |
get default group roles, returns the defaultlike create roles il_grp_member, il_grp_admin public
returns | the obj_ids of group specific roles(il_grp_member,il_grp_admin) |
Definition at line 353 of file class.ilObjGroup.php.
References $rbacadmin, $rbacreview, $role_id, and ilObject::getRefId().
Referenced by getGroupAdminIds(), getGroupStatus(), isAdmin(), and setGroupStatus().
{ global $rbacadmin, $rbacreview; if (strlen($a_grp_id) > 0) { $grp_id = $a_grp_id; } else { $grp_id = $this->getRefId(); } $rolf = $rbacreview->getRoleFolderOfObject($grp_id); $role_arr = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]); foreach ($role_arr as $role_id) { $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id); $grp_Member ="il_grp_member_".$grp_id; $grp_Admin ="il_grp_admin_".$grp_id; if (strcmp($role_Obj->getTitle(), $grp_Member) == 0 ) { $arr_grpDefaultRoles["grp_member_role"] = $role_Obj->getId(); } if (strcmp($role_Obj->getTitle(), $grp_Admin) == 0) { $arr_grpDefaultRoles["grp_admin_role"] = $role_Obj->getId(); } } return $arr_grpDefaultRoles; }
ilObjGroup::getDefaultMemberRole | ( | ) |
returns object id of created default member role public
Definition at line 93 of file class.ilObjGroup.php.
References getLocalGroupRoles().
{ $local_group_Roles = $this->getLocalGroupRoles(); return $local_group_Roles["il_grp_member_".$this->getRefId()]; }
ilObjGroup::getExpirationDateTime | ( | ) |
get Expiration Date and Time public
return | array(0=>date, 1=>time) |
Definition at line 552 of file class.ilObjGroup.php.
References $q, $res, $row, and ilFormat::fdateDB2dateDE().
Referenced by registrationPossible().
{ $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'"; $res = $this->ilias->db->query($q); $row = $res->fetchRow(DB_FETCHMODE_ASSOC); $datetime = $row["expiration"]; $date = ilFormat::fdateDB2dateDE($datetime); $time = substr($row["expiration"], -8); $datetime = array(0=>$date, 1=>$time); return $datetime; }
ilObjGroup::getGroupAdminIds | ( | $ | a_grpId = "" |
) |
get Group Admin Id public
integer | group id | |
returns | userids that are assigned to a group administrator! role |
Definition at line 324 of file class.ilObjGroup.php.
References $rbacreview, $roles, getDefaultGroupRoles(), and ilObject::getRefId().
Referenced by leaveGroup(), and removeMember().
{ global $rbacreview; if (!empty($a_grpId)) { $grp_id = $a_grpId; } else { $grp_id = $this->getRefId(); } $usr_arr = array(); $roles = $this->getDefaultGroupRoles($this->getRefId()); foreach ($rbacreview->assignedUsers($this->getDefaultAdminRole()) as $member_id) { array_push($usr_arr,$member_id); } return $usr_arr; }
ilObjGroup::getGroupMemberData | ( | $ | a_mem_ids | ) |
get all group Members regardless of group role.
fetch all users data in one shot to improve performance public
array | of user ids |
Definition at line 289 of file class.ilObjGroup.php.
References $ilBench, $q, $rbacadmin, $rbacreview, and $row.
{ global $rbacadmin, $rbacreview, $ilBench, $ilDB; $usr_arr= array(); $q = "SELECT login,firstname,lastname,title,usr_id,last_login ". "FROM usr_data ". "WHERE usr_id IN (".implode(',',$a_mem_ids).")"; $r = $ilDB->query($q); while($row = $r->fetchRow(DB_FETCHMODE_OBJECT)) { $mem_arr[] = array("id" => $row->usr_id, "login" => $row->login, "firstname" => $row->firstname, "lastname" => $row->lastname, "last_login" => $row->last_login ); } return $mem_arr ? $mem_arr : array(); }
ilObjGroup::getGroupMemberIds | ( | ) |
get all group Member ids regardless of role public
Definition at line 261 of file class.ilObjGroup.php.
References $rbacadmin, $rbacreview, and getLocalGroupRoles().
Referenced by getCountMembers(), isMember(), leaveGroup(), and removeMember().
{ global $rbacadmin, $rbacreview; $usr_arr= array(); $rol = $this->getLocalGroupRoles(); foreach ($rol as $value) { foreach ($rbacreview->assignedUsers($value) as $member_id) { array_push($usr_arr,$member_id); } } $mem_arr = array_unique($usr_arr); return $mem_arr ? $mem_arr : array(); }
ilObjGroup::getGroupStatus | ( | ) |
get group status, redundant method because public
return | group status[0=public|2=closed] |
Definition at line 683 of file class.ilObjGroup.php.
References $rbacreview, $rbacsystem, getDefaultGroupRoles(), and ilObject::getRefId().
Referenced by ilClone().
{ global $rbacsystem,$rbacreview; $role_folder = $rbacreview->getRoleFolderOfObject($this->getRefId()); $local_roles = $rbacreview->getRolesOfRoleFolder($role_folder["ref_id"]); //get Rolefolder of group $rolf_data = $rbacreview->getRoleFolderOfObject($this->getRefId()); //get all relevant roles $arr_globalRoles = array_diff($local_roles, $this->getDefaultGroupRoles()); //if one global role has no permission to join the group is officially closed ! foreach ($arr_globalRoles as $globalRole) { $ops_of_role = $rbacreview->getOperationsOfRole($globalRole,"grp", ROLE_FOLDER_ID); if ($rbacsystem->checkPermission($this->getRefId(), $globalRole ,"join")) { return 0; } } return 1; }
ilObjGroup::getGrpStatusClosedTemplateId | ( | ) |
get group status closed template public
return | obj_id of roletemplate containing permissionsettings for a closed group |
Definition at line 424 of file class.ilObjGroup.php.
References $q, $res, and $row.
Referenced by setGroupStatus().
{ $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_closed'"; $res = $this->ilias->db->query($q); $row = $res->fetchRow(DB_FETCHMODE_ASSOC); return $row["obj_id"]; }
ilObjGroup::getGrpStatusOpenTemplateId | ( | ) |
get group status open template public
return | obj_id of roletemplate containing permissionsettings for an open group |
Definition at line 438 of file class.ilObjGroup.php.
References $q, $res, and $row.
Referenced by setGroupStatus().
{ $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_open'"; $res = $this->ilias->db->query($q); $row = $res->fetchRow(DB_FETCHMODE_ASSOC); return $row["obj_id"]; }
ilObjGroup::getLocalGroupRoles | ( | ) |
get ALL local roles of group, also those created and defined afterwards only fetch data once from database.
info is stored in object variable public
Definition at line 396 of file class.ilObjGroup.php.
References $rbacadmin, $rbacreview, $role_id, and ilObject::getRefId().
Referenced by getDefaultAdminRole(), getDefaultMemberRole(), getGroupMemberIds(), getMemberRoles(), and getMemberRolesTitle().
{ global $rbacadmin,$rbacreview; if (empty($this->local_roles)) { $this->local_roles = array(); $rolf = $rbacreview->getRoleFolderOfObject($this->getRefId()); $role_arr = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]); foreach ($role_arr as $role_id) { if ($rbacreview->isAssignable($role_id,$rolf["ref_id"]) == true) { $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id); $this->local_roles[$role_Obj->getTitle()] = $role_Obj->getId(); } } } return $this->local_roles; }
ilObjGroup::getMemberRoles | ( | $ | a_user_id | ) |
get group member status public
integer | user_id |
Definition at line 715 of file class.ilObjGroup.php.
References $ilBench, $rbacadmin, $rbacreview, and getLocalGroupRoles().
Referenced by leave().
{ global $rbacadmin, $rbacreview,$ilBench; $ilBench->start("Group", "getMemberRoles"); $arr_assignedRoles = array(); $arr_assignedRoles = array_intersect($rbacreview->assignedRoles($a_user_id),$this->getLocalGroupRoles()); $ilBench->stop("Group", "getMemberRoles"); return $arr_assignedRoles; }
ilObjGroup::getMemberRolesTitle | ( | $ | a_user_id | ) |
get group member status public
integer | user_id |
Definition at line 736 of file class.ilObjGroup.php.
References $ilBench, $q, $row, and getLocalGroupRoles().
{ global $ilDB,$ilBench; $ilBench->start("Group", "getMemberRolesTitle"); $str_member_roles =""; $q = "SELECT title ". "FROM object_data ". "LEFT JOIN rbac_ua ON object_data.obj_id=rbac_ua.rol_id ". "WHERE object_data.type = 'role' ". "AND rbac_ua.usr_id = ".$ilDB->quote($a_user_id)." ". "AND rbac_ua.rol_id IN (".implode(',',$this->getLocalGroupRoles()).")"; $r = $ilDB->query($q); while($row = $r->fetchRow(DB_FETCHMODE_ASSOC)) { $str_member_roles .= $row["title"].", "; } $ilBench->stop("Group", "getMemberRolesTitle"); return substr($str_member_roles,0,-2); }
ilObjGroup::getNewRegistrations | ( | ) |
displays list of applicants public
Definition at line 137 of file class.ilObjGroup.php.
ilObjGroup::getPassword | ( | ) |
get Password public
return | password |
Definition at line 493 of file class.ilObjGroup.php.
ilObjGroup::getRegistrationFlag | ( | ) |
get Registration Flag public
return | flag => [ 0 = no registration| 1 = registration] |
Definition at line 479 of file class.ilObjGroup.php.
ilObjGroup::ilClone | ( | $ | a_parent_ref | ) |
copy all properties and subobjects of a group.
Does not copy the settings in the group's local role folder. Instead a new local role folder is created from the template settings (same process as creating a new group manually)
public
Reimplemented from ilObject.
Definition at line 841 of file class.ilObjGroup.php.
References $rbacadmin, $roles, getGroupStatus(), ilUtil::groupNameExists(), and ilObjUser::updateActiveRoles().
{ global $rbacadmin; // always call parent ilClone function first!! $new_ref_id = parent::ilClone($a_parent_ref); // get object instance of cloned group $groupObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id); // find a free number for ($n = 1;$n < 99;$n++) { $groupname_copy = $groupObj->getTitle()."_(copy_".$n.")"; if (!ilUtil::groupNameExists($groupname_copy)) { $groupObj->setTitle($groupname_copy); $groupObj->update(); break; } } // setup rolefolder & default local roles (admin & member) $roles = $groupObj->initDefaultRoles(); // ...finally assign groupadmin role to creator of group object $rbacadmin->assignUser($roles[0], $groupObj->getOwner(), "n"); ilObjUser::updateActiveRoles($groupObj->getOwner()); // TODO: function getGroupStatus returns integer but setGroupStatus expects a string. // I disabled this function. Please investigate // shofmann@databay.de 4.7.03 // copy group status // 0=public/visible for all,1=closed/invisible for all $groupObj->setGroupStatus($this->getGroupStatus()); // always destroy objects in ilClone method because clone() is recursive and creates instances for each object in subtree! unset($groupObj); unset($rfoldObj); unset($roleObj); // ... and finally always return new reference ID!! return $new_ref_id; }
ilObjGroup::ilObjGroup | ( | $ | a_id = 0 , |
|
$ | a_call_by_reference = true | |||
) |
Constructor public.
integer | reference_id or object_id | |
boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 53 of file class.ilObjGroup.php.
References $tree, ilObject::ilObject(), and ilObject::setRegisterMode().
{ global $tree; $this->tree =& $tree; $this->type = "grp"; $this->ilObject($a_id,$a_call_by_reference); $this->setRegisterMode(true); }
ilObjGroup::initDefaultRoles | ( | ) |
init default roles settings public
Reimplemented from ilObject.
Definition at line 914 of file class.ilObjGroup.php.
References $ops, $q, $rbacadmin, $rbacreview, $roles, ilObject::createRoleFolder(), ilObject::getId(), and ilObject::getRefId().
{ global $rbacadmin, $rbacreview; // create a local role folder $rfoldObj =& $this->createRoleFolder(); // ADMIN ROLE // create role and assign role to rolefolder... $roleObj = $rfoldObj->createRole("il_grp_admin_".$this->getRefId(),"Groupadmin of group obj_no.".$this->getId()); $this->m_roleAdminId = $roleObj->getId(); //set permission template of new local role $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_admin'"; $r = $this->ilias->db->getRow($q, DB_FETCHMODE_OBJECT); $rbacadmin->copyRolePermission($r->obj_id,ROLE_FOLDER_ID,$rfoldObj->getRefId(),$roleObj->getId()); // set object permissions of group object $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"grp",$rfoldObj->getRefId()); $rbacadmin->grantPermission($roleObj->getId(),$ops,$this->getRefId()); // set object permissions of role folder object $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"rolf",$rfoldObj->getRefId()); $rbacadmin->grantPermission($roleObj->getId(),$ops,$rfoldObj->getRefId()); // MEMBER ROLE // create role and assign role to rolefolder... $roleObj = $rfoldObj->createRole("il_grp_member_".$this->getRefId(),"Groupmember of group obj_no.".$this->getId()); $this->m_roleMemberId = $roleObj->getId(); //set permission template of new local role $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_member'"; $r = $this->ilias->db->getRow($q, DB_FETCHMODE_OBJECT); $rbacadmin->copyRolePermission($r->obj_id,ROLE_FOLDER_ID,$rfoldObj->getRefId(),$roleObj->getId()); // set object permissions of group object $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"grp",$rfoldObj->getRefId()); $rbacadmin->grantPermission($roleObj->getId(),$ops,$this->getRefId()); // set object permissions of role folder object $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"rolf",$rfoldObj->getRefId()); $rbacadmin->grantPermission($roleObj->getId(),$ops,$rfoldObj->getRefId()); unset($rfoldObj); unset($roleObj); $roles[] = $this->m_roleAdminId; $roles[] = $this->m_roleMemberId; return $roles ? $roles : array(); }
ilObjGroup::isAdmin | ( | $ | a_userId | ) |
is Admin public
integer | user_id | |
boolean,true | if user is group administrator |
Definition at line 817 of file class.ilObjGroup.php.
References $rbacreview, and getDefaultGroupRoles().
Referenced by leaveGroup(), and removeMember().
{ global $rbacreview; $grp_Roles = $this->getDefaultGroupRoles(); if (in_array($a_userId,$rbacreview->assignedUsers($grp_Roles["grp_admin_role"]))) { return true; } else { return false; } }
ilObjGroup::isMember | ( | $ | a_userId = "" |
) |
is Member public
integer | user_id | |
return | true if user is member |
Definition at line 784 of file class.ilObjGroup.php.
References $user_id, getGroupMemberIds(), and ilObject::getType().
Referenced by isUserRegistered(), and removeMember().
{ if (strlen($a_userId) == 0) { $user_id = $this->ilias->account->getId(); } else { $user_id = $a_userId; } if ($this->getType() == "grp") { $arr_members = $this->getGroupMemberIds(); if (in_array($user_id, $arr_members)) { return true; } else { return false; } } }
ilObjGroup::isUserRegistered | ( | $ | a_user_id = 0 |
) |
Reimplemented from ilObject.
Definition at line 1042 of file class.ilObjGroup.php.
References $_SESSION, $rbacsystem, and isMember().
{ global $rbacsystem; // exclude system role from check if (in_array(SYSTEM_ROLE_ID,$_SESSION["RoleId"])) { return true; } if (!$this->isMember() or !$rbacsystem->checkAccess("join", $this->ref_id)) { return false; } return true; }
ilObjGroup::join | ( | $ | a_user_id, | |
$ | a_mem_role = "" | |||
) |
join Group, assigns user to role private
integer | member status = obj_id of local_group_role |
Definition at line 69 of file class.ilObjGroup.php.
References $rbacadmin, and ilObjUser::updateActiveRoles().
Referenced by addMember().
{ global $rbacadmin; if (is_array($a_mem_role)) { foreach ($a_mem_role as $role) { $rbacadmin->assignUser($role,$a_user_id, false); } } else { $rbacadmin->assignUser($a_mem_role,$a_user_id, false); } ilObjUser::updateActiveRoles($a_user_id); return true; }
ilObjGroup::leave | ( | $ | a_user_id | ) |
deassign member from group role private
Definition at line 198 of file class.ilObjGroup.php.
References $rbacadmin, getMemberRoles(), and ilObjUser::updateActiveRoles().
Referenced by leaveGroup(), and removeMember().
{ global $rbacadmin; $arr_groupRoles = $this->getMemberRoles($a_user_id); if (is_array($arr_groupRoles)) { foreach ($arr_groupRoles as $groupRole) { $rbacadmin->deassignUser($groupRole, $a_user_id); } } else { $rbacadmin->deassignUser($arr_groupRoles, $a_user_id); } ilObjUser::updateActiveRoles($a_user_id); return true; }
ilObjGroup::leaveGroup | ( | ) |
is called when a member decides to leave group public
integer | user-Id | |
integer | group-Id |
Definition at line 167 of file class.ilObjGroup.php.
References $rbacadmin, $rbacreview, getGroupAdminIds(), getGroupMemberIds(), ilObject::getRefId(), isAdmin(), and leave().
{ global $rbacadmin, $rbacreview; $member_ids = $this->getGroupMemberIds(); if (count($member_ids) <= 1 || !in_array($this->ilias->account->getId(), $member_ids)) { return 2; } else { if (!$this->isAdmin($this->ilias->account->getId())) { $this->leave($this->ilias->account->getId()); $member = new ilObjUser($this->ilias->account->getId()); $member->dropDesktopItem($this->getRefId(), "grp"); return 0; } else if (count($this->getGroupAdminIds()) == 1) { return 1; } } }
ilObjGroup::notify | ( | $ | a_event, | |
$ | a_ref_id, | |||
$ | a_parent_non_rbac_id, | |||
$ | a_node_id, | |||
$ | a_params = 0 | |||
) |
notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
public
string | event | |
integer | reference id of object where the event occured | |
array | passes optional parameters if required |
Reimplemented from ilObject.
Definition at line 975 of file class.ilObjGroup.php.
References $tree.
{ global $tree; $parent_id = (int) $tree->getParentId($a_node_id); if ($parent_id != 0) { $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id); $obj_data->notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$parent_id,$a_params); } return true; }
ilObjGroup::registrationPossible | ( | ) |
Definition at line 565 of file class.ilObjGroup.php.
References ilFormat::dateDE2timestamp(), ilFormat::getDateDE(), and getExpirationDateTime().
{ $datetime = $this->getExpirationDateTime(); $today_date = ilFormat::getDateDE(); $today_time = date("H:i:s"); $ts_exp_date = ilFormat::dateDE2timestamp($datetime[0]); $ts_today_date = ilFormat::dateDE2timestamp($today_date); $ts_exp_time = substr($datetime[1], 0, 2). substr($datetime[1], 3, 2). substr($datetime[1], 6, 2); $ts_today_time = substr($today_time, 0, 2). substr($today_time, 3, 2). substr($today_time, 6, 2); if ($ts_today_date < $ts_exp_date) { return true; } elseif (($ts_today_date == $ts_exp_date) and (strcmp($ts_exp_time,$ts_today_time) >= 0)) { return true; } else { return false; } }
ilObjGroup::removeMember | ( | $ | a_user_id, | |
$ | a_grp_id = "" | |||
) |
removes Member from group public
Definition at line 225 of file class.ilObjGroup.php.
References getGroupAdminIds(), getGroupMemberIds(), ilObject::getRefId(), isAdmin(), isMember(), and leave().
Referenced by setMemberStatus().
{ if (isset($a_user_id) && isset($a_grp_id) && $this->isMember($a_user_id)) { if (count($this->getGroupMemberIds()) > 1) { if ($this->isAdmin($a_user_id) && count($this->getGroupAdminIds()) < 2) { return "grp_err_administrator_required"; } else { $this->leave($a_user_id); $member = new ilObjUser($a_user_id); $member->dropDesktopItem($this->getRefId(), "grp"); return ""; } } else { return "grp_err_last_member"; } } else { $this->ilias->raiseError(get_class($this)."::removeMember(): Missing parameters !",$this->ilias->error_obj->WARNING); } }
ilObjGroup::setExpirationDateTime | ( | $ | a_date | ) |
set Expiration Date and Time public
date |
Definition at line 529 of file class.ilObjGroup.php.
References $q, $res, ilObject::getId(), and ilFormat::input2date().
{ $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'"; $res = $this->ilias->db->query($q); $date = ilFormat::input2date($a_date); if ($res->numRows() == 0) { $q = "INSERT INTO grp_data (grp_id, expiration) VALUES(".$this->getId().",'".$date."')"; $res = $this->ilias->db->query($q); } else { $q = "UPDATE grp_data SET expiration='".$date."' WHERE grp_id=".$this->getId().""; $res = $this->ilias->db->query($q); } }
ilObjGroup::setGroupStatus | ( | $ | a_grpStatus | ) |
set group status
Grants permissions on the group object for all parent roles. Each permission is granted by computing the intersection of the role template il_grp_status_open/_closed and the permission template of the parent role.
Creates linked roles in the local role folder object for all parent roles and initializes their permission templates. Each permission template is initialized by computing the intersection of the role template il_grp_status_open/_closed and the permission template of the parent role.
public
integer | group id (optional) | |
integer | group status (0=public|1=private|2=closed) |
Definition at line 614 of file class.ilObjGroup.php.
References $rbacadmin, $rbacreview, $rbacsystem, getDefaultGroupRoles(), getGrpStatusClosedTemplateId(), getGrpStatusOpenTemplateId(), and ilObject::getRefId().
{ global $rbacadmin, $rbacreview, $rbacsystem; //get Rolefolder of group $rolf_data = $rbacreview->getRoleFolderOfObject($this->getRefId()); //define all relevant roles that rights are needed to be changed $arr_parentRoles = $rbacreview->getParentRoleIds($this->getRefId()); $arr_relevantParentRoleIds = array_diff(array_keys($arr_parentRoles),$this->getDefaultGroupRoles()); //group status open (aka public) or group status closed if ($a_grpStatus == 0 || $a_grpStatus == 1) { if ($a_grpStatus == 0) { $template_id = $this->getGrpStatusOpenTemplateId(); } else { $template_id = $this->getGrpStatusClosedTemplateId(); } //get defined operations from template $template_ops = $rbacreview->getOperationsOfRole($template_id, 'grp', ROLE_FOLDER_ID); foreach ($arr_relevantParentRoleIds as $parentRole) { $granted_permissions = array(); // Delete the linked role for the parent role // (just in case if it already exists). $rbacadmin->deleteLocalRole($parentRole,$rolf_data["child"]); // Grant permissions on the group object for // the parent role. In the foreach loop we // compute the intersection of the role // template il_grp_status_open/_closed and the // permission template of the parent role. $current_ops = $rbacreview->getRoleOperationsOnObject($parentRole, $this->getRefId()); $rbacadmin->revokePermission($this->getRefId(), $parentRole); foreach ($template_ops as $template_op) { if (in_array($template_op,$current_ops)) { array_push($granted_permissions,$template_op); } } if (!empty($granted_permissions)) { $rbacadmin->grantPermission($parentRole, $granted_permissions, $this->getRefId()); } // Create a linked role for the parent role and // initialize it with the intersection of // il_grp_status_open/_closed and the permission // template of the parent role $rbacadmin->copyRolePermissionIntersection( $template_id, ROLE_FOLDER_ID, $parentRole, $arr_parentRoles[$parentRole]['parent'], $rolf_data["child"], $parentRole ); $rbacadmin->assignRoleToFolder($parentRole,$rolf_data["child"],"false"); }//END foreach } }
ilObjGroup::setMemberStatus | ( | $ | a_user_id, | |
$ | a_member_role | |||
) |
set member status public
integer | user id | |
integer | member role id |
Definition at line 769 of file class.ilObjGroup.php.
References addMember(), and removeMember().
{ if (isset($a_user_id) && isset($a_member_role)) { $this->removeMember($a_user_id); $this->addMember($a_user_id, $a_member_role); } }
ilObjGroup::setPassword | ( | $ | a_password = "" |
) |
set Password public
password |
Definition at line 507 of file class.ilObjGroup.php.
References $q, $res, and ilObject::getId().
{ $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'"; $res = $this->ilias->db->query($q); if ($res->numRows() == 0) { $q = "INSERT INTO grp_data (grp_id, password) VALUES(".$this->getId().",'".$a_password."')"; $res = $this->ilias->db->query($q); } else { $q = "UPDATE grp_data SET password='".$a_password."' WHERE grp_id=".$this->getId().""; $res = $this->ilias->db->query($q); } }
ilObjGroup::setRegistrationFlag | ( | $ | a_regFlag = "" |
) |
set Registration Flag public
integer | [ 0 = no registration| 1 = registration] |
Definition at line 452 of file class.ilObjGroup.php.
References $q, $res, and ilObject::getId().
{ $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'"; $res = $this->ilias->db->query($q); if (!isset($a_regFlag)) { $a_regFlag = 0; } if ($res->numRows() == 0) { $q = "INSERT INTO grp_data (grp_id, register) VALUES(".$this->getId().",".$a_regFlag.")"; $res = $this->ilias->db->query($q); } else { $q = "UPDATE grp_data SET register=".$a_regFlag." WHERE grp_id=".$this->getId().""; $res = $this->ilias->db->query($q); } }
ilObjGroup::$m_grpStatus |
Definition at line 41 of file class.ilObjGroup.php.
ilObjGroup::$m_roleAdminId |
Definition at line 45 of file class.ilObjGroup.php.
ilObjGroup::$m_roleMemberId |
Definition at line 43 of file class.ilObjGroup.php.