00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00035
00036
00037 require_once "class.ilObject.php";
00038
00039 class ilObjGroup extends ilObject
00040 {
00041 var $m_grpStatus;
00042
00043 var $m_roleMemberId;
00044
00045 var $m_roleAdminId;
00046
00053 function ilObjGroup($a_id = 0,$a_call_by_reference = true)
00054 {
00055 global $tree;
00056
00057 $this->tree =& $tree;
00058
00059 $this->type = "grp";
00060 $this->ilObject($a_id,$a_call_by_reference);
00061 $this->setRegisterMode(true);
00062 }
00063
00069 function join($a_user_id, $a_mem_role="")
00070 {
00071 global $rbacadmin;
00072
00073 if (is_array($a_mem_role))
00074 {
00075 foreach ($a_mem_role as $role)
00076 {
00077 $rbacadmin->assignUser($role,$a_user_id, false);
00078 }
00079 }
00080 else
00081 {
00082 $rbacadmin->assignUser($a_mem_role,$a_user_id, false);
00083 }
00084
00085 ilObjUser::updateActiveRoles($a_user_id);
00086 return true;
00087 }
00088
00093 function getDefaultMemberRole()
00094 {
00095 $local_group_Roles = $this->getLocalGroupRoles();
00096
00097 return $local_group_Roles["il_grp_member_".$this->getRefId()];
00098 }
00099
00104 function getDefaultAdminRole()
00105 {
00106 $local_group_Roles = $this->getLocalGroupRoles();
00107
00108 return $local_group_Roles["il_grp_admin_".$this->getRefId()];
00109 }
00110
00117 function addMember($a_user_id, $a_mem_role)
00118 {
00119 global $rbacadmin;
00120
00121 if (isset($a_user_id) && isset($a_mem_role) )
00122 {
00123 $this->join($a_user_id,$a_mem_role);
00124 return true;
00125 }
00126 else
00127 {
00128 $this->ilias->raiseError(get_class($this)."::addMember(): Missing parameters !",$this->ilias->error_obj->WARNING);
00129 return false;
00130 }
00131 }
00132
00137 function getNewRegistrations()
00138 {
00139 $appList = array();
00140 $q = "SELECT * FROM grp_registration WHERE grp_id=".$this->getId();
00141 $res = $this->ilias->db->query($q);
00142
00143 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00144 {
00145 array_push($appList,$row);
00146 }
00147
00148 return ($appList) ? $appList : false;
00149 }
00150
00155 function deleteApplicationListEntry($a_userId)
00156 {
00157 $q = "DELETE FROM grp_registration WHERE user_id=".$a_userId." AND grp_id=".$this->getId();
00158 $res = $this->ilias->db->query($q);
00159 }
00160
00167 function leaveGroup()
00168 {
00169 global $rbacadmin, $rbacreview;
00170
00171 $member_ids = $this->getGroupMemberIds();
00172
00173 if (count($member_ids) <= 1 || !in_array($this->ilias->account->getId(), $member_ids))
00174 {
00175 return 2;
00176 }
00177 else
00178 {
00179 if (!$this->isAdmin($this->ilias->account->getId()))
00180 {
00181 $this->leave($this->ilias->account->getId());
00182 $member = new ilObjUser($this->ilias->account->getId());
00183 $member->dropDesktopItem($this->getRefId(), "grp");
00184
00185 return 0;
00186 }
00187 else if (count($this->getGroupAdminIds()) == 1)
00188 {
00189 return 1;
00190 }
00191 }
00192 }
00193
00198 function leave($a_user_id)
00199 {
00200 global $rbacadmin;
00201
00202 $arr_groupRoles = $this->getMemberRoles($a_user_id);
00203
00204 if (is_array($arr_groupRoles))
00205 {
00206 foreach ($arr_groupRoles as $groupRole)
00207 {
00208 $rbacadmin->deassignUser($groupRole, $a_user_id);
00209 }
00210 }
00211 else
00212 {
00213 $rbacadmin->deassignUser($arr_groupRoles, $a_user_id);
00214 }
00215
00216 ilObjUser::updateActiveRoles($a_user_id);
00217
00218 return true;
00219 }
00220
00225 function removeMember($a_user_id, $a_grp_id="")
00226 {
00227 if (isset($a_user_id) && isset($a_grp_id) && $this->isMember($a_user_id))
00228 {
00229 if (count($this->getGroupMemberIds()) > 1)
00230 {
00231 if ($this->isAdmin($a_user_id) && count($this->getGroupAdminIds()) < 2)
00232 {
00233 return "grp_err_administrator_required";
00234 }
00235 else
00236 {
00237 $this->leave($a_user_id);
00238 $member = new ilObjUser($a_user_id);
00239 $member->dropDesktopItem($this->getRefId(), "grp");
00240
00241 return "";
00242 }
00243 }
00244 else
00245 {
00246 return "grp_err_last_member";
00247 }
00248 }
00249 else
00250 {
00251 $this->ilias->raiseError(get_class($this)."::removeMember(): Missing parameters !",$this->ilias->error_obj->WARNING);
00252 }
00253 }
00254
00261 function getGroupMemberIds()
00262 {
00263 global $rbacadmin, $rbacreview;
00264
00265 $usr_arr= array();
00266
00267 $rol = $this->getLocalGroupRoles();
00268
00269 foreach ($rol as $value)
00270 {
00271 foreach ($rbacreview->assignedUsers($value) as $member_id)
00272 {
00273 array_push($usr_arr,$member_id);
00274 }
00275 }
00276
00277 $mem_arr = array_unique($usr_arr);
00278
00279 return $mem_arr ? $mem_arr : array();
00280 }
00281
00289 function getGroupMemberData($a_mem_ids)
00290 {
00291 global $rbacadmin, $rbacreview, $ilBench, $ilDB;
00292
00293 $usr_arr= array();
00294
00295 $q = "SELECT login,firstname,lastname,title,usr_id,last_login ".
00296 "FROM usr_data ".
00297 "WHERE usr_id IN (".implode(',',$a_mem_ids).")";
00298 $r = $ilDB->query($q);
00299
00300 while($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
00301 {
00302 $mem_arr[] = array("id" => $row->usr_id,
00303 "login" => $row->login,
00304 "firstname" => $row->firstname,
00305 "lastname" => $row->lastname,
00306 "last_login" => $row->last_login
00307 );
00308 }
00309
00310 return $mem_arr ? $mem_arr : array();
00311 }
00312
00313 function getCountMembers()
00314 {
00315 return count($this->getGroupMemberIds());
00316 }
00317
00324 function getGroupAdminIds($a_grpId="")
00325 {
00326 global $rbacreview;
00327
00328 if (!empty($a_grpId))
00329 {
00330 $grp_id = $a_grpId;
00331 }
00332 else
00333 {
00334 $grp_id = $this->getRefId();
00335 }
00336
00337 $usr_arr = array();
00338 $roles = $this->getDefaultGroupRoles($this->getRefId());
00339
00340 foreach ($rbacreview->assignedUsers($this->getDefaultAdminRole()) as $member_id)
00341 {
00342 array_push($usr_arr,$member_id);
00343 }
00344
00345 return $usr_arr;
00346 }
00347
00353 function getDefaultGroupRoles($a_grp_id="")
00354 {
00355 global $rbacadmin, $rbacreview;
00356
00357 if (strlen($a_grp_id) > 0)
00358 {
00359 $grp_id = $a_grp_id;
00360 }
00361 else
00362 {
00363 $grp_id = $this->getRefId();
00364 }
00365
00366 $rolf = $rbacreview->getRoleFolderOfObject($grp_id);
00367 $role_arr = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]);
00368
00369 foreach ($role_arr as $role_id)
00370 {
00371 $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id);
00372
00373 $grp_Member ="il_grp_member_".$grp_id;
00374 $grp_Admin ="il_grp_admin_".$grp_id;
00375
00376 if (strcmp($role_Obj->getTitle(), $grp_Member) == 0 )
00377 {
00378 $arr_grpDefaultRoles["grp_member_role"] = $role_Obj->getId();
00379 }
00380
00381 if (strcmp($role_Obj->getTitle(), $grp_Admin) == 0)
00382 {
00383 $arr_grpDefaultRoles["grp_admin_role"] = $role_Obj->getId();
00384 }
00385 }
00386
00387 return $arr_grpDefaultRoles;
00388 }
00389
00396 function getLocalGroupRoles()
00397 {
00398 global $rbacadmin,$rbacreview;
00399
00400 if (empty($this->local_roles))
00401 {
00402 $this->local_roles = array();
00403 $rolf = $rbacreview->getRoleFolderOfObject($this->getRefId());
00404 $role_arr = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]);
00405
00406 foreach ($role_arr as $role_id)
00407 {
00408 if ($rbacreview->isAssignable($role_id,$rolf["ref_id"]) == true)
00409 {
00410 $role_Obj =& $this->ilias->obj_factory->getInstanceByObjId($role_id);
00411 $this->local_roles[$role_Obj->getTitle()] = $role_Obj->getId();
00412 }
00413 }
00414 }
00415
00416 return $this->local_roles;
00417 }
00418
00424 function getGrpStatusClosedTemplateId()
00425 {
00426 $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_closed'";
00427 $res = $this->ilias->db->query($q);
00428 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
00429
00430 return $row["obj_id"];
00431 }
00432
00438 function getGrpStatusOpenTemplateId()
00439 {
00440 $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_status_open'";
00441 $res = $this->ilias->db->query($q);
00442 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
00443
00444 return $row["obj_id"];
00445 }
00446
00452 function setRegistrationFlag($a_regFlag="")
00453 {
00454 $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'";
00455 $res = $this->ilias->db->query($q);
00456
00457 if (!isset($a_regFlag))
00458 {
00459 $a_regFlag = 0;
00460 }
00461
00462 if ($res->numRows() == 0)
00463 {
00464 $q = "INSERT INTO grp_data (grp_id, register) VALUES(".$this->getId().",".$a_regFlag.")";
00465 $res = $this->ilias->db->query($q);
00466 }
00467 else
00468 {
00469 $q = "UPDATE grp_data SET register=".$a_regFlag." WHERE grp_id=".$this->getId()."";
00470 $res = $this->ilias->db->query($q);
00471 }
00472 }
00473
00479 function getRegistrationFlag()
00480 {
00481 $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'";
00482 $res = $this->ilias->db->query($q);
00483 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
00484
00485 return $row["register"];
00486 }
00487
00493 function getPassword()
00494 {
00495 $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'";
00496 $res = $this->ilias->db->query($q);
00497 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
00498
00499 return $row["password"];
00500 }
00501
00507 function setPassword($a_password="")
00508 {
00509 $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'";
00510 $res = $this->ilias->db->query($q);
00511
00512 if ($res->numRows() == 0)
00513 {
00514 $q = "INSERT INTO grp_data (grp_id, password) VALUES(".$this->getId().",'".$a_password."')";
00515 $res = $this->ilias->db->query($q);
00516 }
00517 else
00518 {
00519 $q = "UPDATE grp_data SET password='".$a_password."' WHERE grp_id=".$this->getId()."";
00520 $res = $this->ilias->db->query($q);
00521 }
00522 }
00523
00529 function setExpirationDateTime($a_date)
00530 {
00531 $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'";
00532 $res = $this->ilias->db->query($q);
00533 $date = ilFormat::input2date($a_date);
00534
00535 if ($res->numRows() == 0)
00536 {
00537 $q = "INSERT INTO grp_data (grp_id, expiration) VALUES(".$this->getId().",'".$date."')";
00538 $res = $this->ilias->db->query($q);
00539 }
00540 else
00541 {
00542 $q = "UPDATE grp_data SET expiration='".$date."' WHERE grp_id=".$this->getId()."";
00543 $res = $this->ilias->db->query($q);
00544 }
00545 }
00546
00552 function getExpirationDateTime()
00553 {
00554 $q = "SELECT * FROM grp_data WHERE grp_id='".$this->getId()."'";
00555 $res = $this->ilias->db->query($q);
00556 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
00557 $datetime = $row["expiration"];
00558 $date = ilFormat::fdateDB2dateDE($datetime);
00559 $time = substr($row["expiration"], -8);
00560 $datetime = array(0=>$date, 1=>$time);
00561
00562 return $datetime;
00563 }
00564
00565 function registrationPossible()
00566 {
00567 $datetime = $this->getExpirationDateTime();
00568 $today_date = ilFormat::getDateDE();
00569 $today_time = date("H:i:s");
00570
00571 $ts_exp_date = ilFormat::dateDE2timestamp($datetime[0]);
00572 $ts_today_date = ilFormat::dateDE2timestamp($today_date);
00573
00574 $ts_exp_time = substr($datetime[1], 0, 2).
00575 substr($datetime[1], 3, 2).
00576 substr($datetime[1], 6, 2);
00577
00578 $ts_today_time = substr($today_time, 0, 2).
00579 substr($today_time, 3, 2).
00580 substr($today_time, 6, 2);
00581
00582 if ($ts_today_date < $ts_exp_date)
00583 {
00584 return true;
00585 }
00586 elseif (($ts_today_date == $ts_exp_date) and (strcmp($ts_exp_time,$ts_today_time) >= 0))
00587 {
00588 return true;
00589 }
00590 else
00591 {
00592 return false;
00593 }
00594 }
00595
00614 function setGroupStatus($a_grpStatus)
00615 {
00616 global $rbacadmin, $rbacreview, $rbacsystem;
00617
00618
00619 $rolf_data = $rbacreview->getRoleFolderOfObject($this->getRefId());
00620
00621
00622 $arr_parentRoles = $rbacreview->getParentRoleIds($this->getRefId());
00623 $arr_relevantParentRoleIds = array_diff(array_keys($arr_parentRoles),$this->getDefaultGroupRoles());
00624
00625
00626 if ($a_grpStatus == 0 || $a_grpStatus == 1)
00627 {
00628 if ($a_grpStatus == 0)
00629 {
00630 $template_id = $this->getGrpStatusOpenTemplateId();
00631 } else {
00632 $template_id = $this->getGrpStatusClosedTemplateId();
00633 }
00634
00635 $template_ops = $rbacreview->getOperationsOfRole($template_id, 'grp', ROLE_FOLDER_ID);
00636
00637 foreach ($arr_relevantParentRoleIds as $parentRole)
00638 {
00639 $granted_permissions = array();
00640
00641
00642
00643 $rbacadmin->deleteLocalRole($parentRole,$rolf_data["child"]);
00644
00645
00646
00647
00648
00649
00650 $current_ops = $rbacreview->getRoleOperationsOnObject($parentRole, $this->getRefId());
00651 $rbacadmin->revokePermission($this->getRefId(), $parentRole);
00652 foreach ($template_ops as $template_op)
00653 {
00654 if (in_array($template_op,$current_ops))
00655 {
00656 array_push($granted_permissions,$template_op);
00657 }
00658 }
00659 if (!empty($granted_permissions))
00660 {
00661 $rbacadmin->grantPermission($parentRole, $granted_permissions, $this->getRefId());
00662 }
00663
00664
00665
00666
00667
00668 $rbacadmin->copyRolePermissionIntersection(
00669 $template_id, ROLE_FOLDER_ID,
00670 $parentRole, $arr_parentRoles[$parentRole]['parent'],
00671 $rolf_data["child"], $parentRole
00672 );
00673 $rbacadmin->assignRoleToFolder($parentRole,$rolf_data["child"],"false");
00674 }
00675 }
00676 }
00677
00683 function getGroupStatus()
00684 {
00685 global $rbacsystem,$rbacreview;
00686
00687 $role_folder = $rbacreview->getRoleFolderOfObject($this->getRefId());
00688 $local_roles = $rbacreview->getRolesOfRoleFolder($role_folder["ref_id"]);
00689
00690
00691 $rolf_data = $rbacreview->getRoleFolderOfObject($this->getRefId());
00692
00693 $arr_globalRoles = array_diff($local_roles, $this->getDefaultGroupRoles());
00694
00695
00696 foreach ($arr_globalRoles as $globalRole)
00697 {
00698 $ops_of_role = $rbacreview->getOperationsOfRole($globalRole,"grp", ROLE_FOLDER_ID);
00699
00700 if ($rbacsystem->checkPermission($this->getRefId(), $globalRole ,"join"))
00701 {
00702 return 0;
00703 }
00704 }
00705
00706 return 1;
00707 }
00708
00715 function getMemberRoles($a_user_id)
00716 {
00717 global $rbacadmin, $rbacreview,$ilBench;
00718
00719 $ilBench->start("Group", "getMemberRoles");
00720
00721 $arr_assignedRoles = array();
00722
00723 $arr_assignedRoles = array_intersect($rbacreview->assignedRoles($a_user_id),$this->getLocalGroupRoles());
00724
00725 $ilBench->stop("Group", "getMemberRoles");
00726
00727 return $arr_assignedRoles;
00728 }
00729
00736 function getMemberRolesTitle($a_user_id)
00737 {
00738 global $ilDB,$ilBench;
00739
00740 $ilBench->start("Group", "getMemberRolesTitle");
00741
00742 $str_member_roles ="";
00743
00744 $q = "SELECT title ".
00745 "FROM object_data ".
00746 "LEFT JOIN rbac_ua ON object_data.obj_id=rbac_ua.rol_id ".
00747 "WHERE object_data.type = 'role' ".
00748 "AND rbac_ua.usr_id = ".$ilDB->quote($a_user_id)." ".
00749 "AND rbac_ua.rol_id IN (".implode(',',$this->getLocalGroupRoles()).")";
00750
00751 $r = $ilDB->query($q);
00752
00753 while($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
00754 {
00755 $str_member_roles .= $row["title"].", ";
00756 }
00757
00758 $ilBench->stop("Group", "getMemberRolesTitle");
00759
00760 return substr($str_member_roles,0,-2);
00761 }
00762
00769 function setMemberStatus($a_user_id, $a_member_role)
00770 {
00771 if (isset($a_user_id) && isset($a_member_role))
00772 {
00773 $this->removeMember($a_user_id);
00774 $this->addMember($a_user_id, $a_member_role);
00775 }
00776 }
00777
00784 function isMember($a_userId = "")
00785 {
00786 if (strlen($a_userId) == 0)
00787 {
00788 $user_id = $this->ilias->account->getId();
00789 }
00790 else
00791 {
00792 $user_id = $a_userId;
00793 }
00794
00795 if ($this->getType() == "grp")
00796 {
00797
00798 $arr_members = $this->getGroupMemberIds();
00799
00800 if (in_array($user_id, $arr_members))
00801 {
00802 return true;
00803 }
00804 else
00805 {
00806 return false;
00807 }
00808 }
00809 }
00810
00817 function isAdmin($a_userId)
00818 {
00819 global $rbacreview;
00820
00821 $grp_Roles = $this->getDefaultGroupRoles();
00822
00823 if (in_array($a_userId,$rbacreview->assignedUsers($grp_Roles["grp_admin_role"])))
00824 {
00825 return true;
00826 }
00827 else
00828 {
00829 return false;
00830 }
00831 }
00832
00841 function ilClone($a_parent_ref)
00842 {
00843 global $rbacadmin;
00844
00845
00846 $new_ref_id = parent::ilClone($a_parent_ref);
00847
00848
00849 $groupObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);
00850
00851
00852 for ($n = 1;$n < 99;$n++)
00853 {
00854 $groupname_copy = $groupObj->getTitle()."_(copy_".$n.")";
00855
00856 if (!ilUtil::groupNameExists($groupname_copy))
00857 {
00858 $groupObj->setTitle($groupname_copy);
00859 $groupObj->update();
00860 break;
00861 }
00862 }
00863
00864
00865 $roles = $groupObj->initDefaultRoles();
00866
00867
00868 $rbacadmin->assignUser($roles[0], $groupObj->getOwner(), "n");
00869 ilObjUser::updateActiveRoles($groupObj->getOwner());
00870
00871
00872
00873
00874
00875
00876 $groupObj->setGroupStatus($this->getGroupStatus());
00877
00878
00879 unset($groupObj);
00880 unset($rfoldObj);
00881 unset($roleObj);
00882
00883
00884 return $new_ref_id;
00885 }
00886
00895 function delete()
00896 {
00897
00898 if (!parent::delete())
00899 {
00900 return false;
00901 }
00902
00903 $query = "DELETE FROM grp_data WHERE grp_id=".$this->getId();
00904 $this->ilias->db->query($query);
00905
00906 return true;
00907 }
00908
00914 function initDefaultRoles()
00915 {
00916 global $rbacadmin, $rbacreview;
00917
00918
00919 $rfoldObj =& $this->createRoleFolder();
00920
00921
00922
00923 $roleObj = $rfoldObj->createRole("il_grp_admin_".$this->getRefId(),"Groupadmin of group obj_no.".$this->getId());
00924 $this->m_roleAdminId = $roleObj->getId();
00925
00926
00927 $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_admin'";
00928 $r = $this->ilias->db->getRow($q, DB_FETCHMODE_OBJECT);
00929 $rbacadmin->copyRolePermission($r->obj_id,ROLE_FOLDER_ID,$rfoldObj->getRefId(),$roleObj->getId());
00930
00931
00932 $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"grp",$rfoldObj->getRefId());
00933 $rbacadmin->grantPermission($roleObj->getId(),$ops,$this->getRefId());
00934
00935
00936 $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"rolf",$rfoldObj->getRefId());
00937 $rbacadmin->grantPermission($roleObj->getId(),$ops,$rfoldObj->getRefId());
00938
00939
00940
00941 $roleObj = $rfoldObj->createRole("il_grp_member_".$this->getRefId(),"Groupmember of group obj_no.".$this->getId());
00942 $this->m_roleMemberId = $roleObj->getId();
00943
00944
00945 $q = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_member'";
00946 $r = $this->ilias->db->getRow($q, DB_FETCHMODE_OBJECT);
00947 $rbacadmin->copyRolePermission($r->obj_id,ROLE_FOLDER_ID,$rfoldObj->getRefId(),$roleObj->getId());
00948
00949
00950 $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"grp",$rfoldObj->getRefId());
00951 $rbacadmin->grantPermission($roleObj->getId(),$ops,$this->getRefId());
00952
00953
00954 $ops = $rbacreview->getOperationsOfRole($roleObj->getId(),"rolf",$rfoldObj->getRefId());
00955 $rbacadmin->grantPermission($roleObj->getId(),$ops,$rfoldObj->getRefId());
00956
00957 unset($rfoldObj);
00958 unset($roleObj);
00959
00960 $roles[] = $this->m_roleAdminId;
00961 $roles[] = $this->m_roleMemberId;
00962 return $roles ? $roles : array();
00963 }
00964
00975 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00976 {
00977 global $tree;
00978
00979 $parent_id = (int) $tree->getParentId($a_node_id);
00980
00981 if ($parent_id != 0)
00982 {
00983 $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00984 $obj_data->notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$parent_id,$a_params);
00985 }
00986
00987 return true;
00988 }
00989
00998 function _search(&$a_search_obj)
00999 {
01000 global $ilBench;
01001
01002
01003
01004 $where_condition = $a_search_obj->getWhereCondition("like",array("title","description"));
01005 $in = $a_search_obj->getInStatement("ore.ref_id");
01006
01007 $query = "SELECT ore.ref_id AS ref_id FROM object_data AS od, object_reference AS ore ".
01008 $where_condition." ".
01009 $in." ".
01010 "AND od.obj_id = ore.obj_id ".
01011 "AND od.type = 'grp' ";
01012
01013 $ilBench->start("Search", "ilObjGroup_search");
01014 $res = $a_search_obj->ilias->db->query($query);
01015 $ilBench->stop("Search", "ilObjGroup_search");
01016
01017 $counter = 0;
01018
01019 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01020 {
01021 $result_data[$counter++]["id"] = $row->ref_id;
01022 #$result_data[$counter]["link"] = "group.php?cmd=view&ref_id=".$row->ref_id;
01023 #$result_data[$counter++]["target"] = "";
01024 }
01025
01026 return $result_data ? $result_data : array();
01027 }
01028
01037 function _getLinkToObject($a_id)
01038 {
01039 return array("repository.php?ref_id=".$a_id."&set_mode=flat&cmdClass=ilobjgroupgui","");
01040 }
01041
01042 function isUserRegistered($a_user_id = 0)
01043 {
01044 global $rbacsystem;
01045
01046
01047 if (in_array(SYSTEM_ROLE_ID,$_SESSION["RoleId"]))
01048 {
01049 return true;
01050 }
01051
01052 if (!$this->isMember() or !$rbacsystem->checkAccess("join", $this->ref_id))
01053 {
01054 return false;
01055 }
01056
01057 return true;
01058 }
01059 }
01060 ?>