ILIAS  release_4-4 Revision
ilParticipants Class Reference
+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

 __construct ($a_obj_id)
 Singleton Constructor. More...
 
 getType ()
 Get object type. More...
 
 getNotificationRecipients ()
 Get admin, tutor which have notification enabled. More...
 
 getCountMembers ()
 Get number of members (not participants) More...
 
 getCountParticipants ()
 Get number of participants. More...
 
 getParticipants ()
 Get all participants ids. More...
 
 getMembers ()
 Get all members ids (admins and tutors are not members) Use get participants to fetch all. More...
 
 getAdmins ()
 Get all admins ids. More...
 
 getCountAdmins ()
 Get number of admins. More...
 
 getTutors ()
 Get all tutors ids. More...
 
 isAdmin ($a_usr_id)
 is user admin More...
 
 isTutor ($a_usr_id)
 is user tutor More...
 
 isMember ($a_usr_id)
 is user member More...
 
 isAssigned ($a_usr_id)
 check if user is assigned More...
 
 isLastAdmin ($a_usr_id)
 Check if user is last admin. More...
 
 getRoles ()
 Get course roles. More...
 
 getAssignedRoles ($a_usr_id)
 Get assigned roles. More...
 
 updateRoleAssignments ($a_usr_id, $a_roles)
 Update role assignments. More...
 
 checkLastAdmin ($a_usr_ids)
 Check if user for deletion are last admins. More...
 
 isBlocked ($a_usr_id)
 Check if user is blocked. More...
 
 hasPassed ($a_usr_id)
 Check if user has passed course. More...
 
 delete ($a_usr_id)
 Drop user from all roles. More...
 
 updateBlocked ($a_usr_id, $a_blocked)
 Update blocked status. More...
 
 updateNotification ($a_usr_id, $a_notification)
 Update notification status. More...
 
 add ($a_usr_id, $a_role)
 Add user to course. More...
 
 deleteParticipants ($a_user_ids)
 Delete users. More...
 
 addDesktopItem ($a_usr_id)
 Add desktop item. More...
 
 dropDesktopItem ($a_usr_id)
 Drop desktop item. More...
 
 isNotificationEnabled ($a_usr_id)
 check if notification is enabled More...
 
 isGroupingMember ($a_usr_id, $a_field='')
 Check grouping membership. More...
 
 getSubscribers ()
 get all subscribers More...
 
 getCountSubscribers ()
 get number of subscribers More...
 
 getSubscriberData ($a_usr_id)
 get subscriber data More...
 
 assignSubscribers ($a_usr_ids)
 Assign subscribers. More...
 
 assignSubscriber ($a_usr_id)
 Assign subscriber. More...
 
 autoFillSubscribers ()
 Assign subscriber. More...
 
 addSubscriber ($a_usr_id)
 Add subscriber. More...
 
 updateSubscriptionTime ($a_usr_id, $a_subtime)
 Update subscription time. More...
 
 updateSubject ($a_usr_id, $a_subject)
 update subject More...
 
 deleteSubscriber ($a_usr_id)
 Delete subsciber. More...
 
 deleteSubscribers ($a_usr_ids)
 Delete subscibers. More...
 
 isSubscriber ($a_usr_id)
 check if is subscriber More...
 

Static Public Member Functions

static getInstanceByObjId ($a_obj_id)
 Get instance by obj type. More...
 
static hasParticipantListAccess ($a_obj_id, $a_usr_id=null)
 Check if (current) user has access to the participant list. More...
 
static _getMembershipByType ($a_usr_id, $a_type, $a_only_member_role=false)
 get membership by type Get course or group membership More...
 
static _isParticipant ($a_ref_id, $a_usr_id)
 Static function to check if a user is a participant of the container object. More...
 
static lookupNumberOfParticipants ($a_ref_id)
 Lookup the number of participants (crs admins, tutors, members, grp admins, members) More...
 
static lookupNumberOfMembers ($a_ref_id)
 Lookup number of members ilRbacReview $rbacreview <type> $ilObjDataCache. More...
 
static _isBlocked ($a_obj_id, $a_usr_id)
 Check if user is blocked. More...
 
static _hasPassed ($a_obj_id, $a_usr_id)
 Check if user has passed course. More...
 
static _deleteAllEntries ($a_obj_id)
 Delete all entries Normally called for course deletion. More...
 
static _deleteUser ($a_usr_id)
 Delete user data. More...
 
static getDefaultMemberRole ($a_ref_id)
 
static lookupSubscribers ($a_obj_id)
 
static _isSubscriber ($a_obj_id, $a_usr_id)
 check if user is subscriber More...
 
static lookupSubscribersData ($a_obj_id)
 

Protected Member Functions

 readSubscribers ()
 read subscribers More...
 
 readSubscriberData ($a_usr_id)
 read subscribers More...
 

Protected Attributes

 $obj_id = 0
 
 $type = ''
 
 $ref_id = 0
 
 $roles = array()
 
 $role_data = array()
 
 $participants = array()
 
 $participants_status = array()
 
 $members = array()
 
 $tutors = array()
 
 $admins = array()
 
 $subscribers = array()
 
 $ilDB
 
 $lng
 

Private Member Functions

 readParticipants ()
 Read participants. More...
 
 readParticipantsStatus ()
 Read stati of participants (blocked, notification, passed) More...
 

Detailed Description

Definition at line 20 of file class.ilParticipants.php.

Constructor & Destructor Documentation

◆ __construct()

ilParticipants::__construct (   $a_obj_id)

Singleton Constructor.

public

Parameters
intobj_id of container

Definition at line 48 of file class.ilParticipants.php.

References $ilDB, $lng, ilObject\_getAllReferences(), ilObject\_lookupType(), readParticipants(), and readParticipantsStatus().

49  {
50  global $ilDB,$lng;
51 
52  $this->ilDB = $ilDB;
53  $this->lng = $lng;
54 
55  $this->obj_id = $a_obj_id;
56  $this->type = ilObject::_lookupType($a_obj_id);
57  $ref_ids = ilObject::_getAllReferences($this->obj_id);
58  $this->ref_id = current($ref_ids);
59 
60  $this->readParticipants();
61  $this->readParticipantsStatus();
62  }
readParticipantsStatus()
Read stati of participants (blocked, notification, passed)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Database Wrapper.
Definition: class.ilDB.php:28
readParticipants()
Read participants.
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllEntries()

static ilParticipants::_deleteAllEntries (   $a_obj_id)
static

Delete all entries Normally called for course deletion.

public

Parameters
intobj_id

Definition at line 303 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

Referenced by ilObjGroup\delete(), ilObjCourse\delete(), and ilSoapCourseAdministration\updateCourse().

304  {
305  global $ilDB;
306 
307  $query = "DELETE FROM obj_members ".
308  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
309  $res = $ilDB->manipulate($query);
310 
311  $query = "DELETE FROM il_subscribers ".
312  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
313  $res = $ilDB->manipulate($query);
314 
315  $query = 'DELETE FROM crs_waiting_list '.
316  'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
317  $ilDB->manipulate($query);
318 
319  return true;
320  }
+ Here is the caller graph for this function:

◆ _deleteUser()

static ilParticipants::_deleteUser (   $a_usr_id)
static

Delete user data.

public

Parameters
intuser id

Definition at line 330 of file class.ilParticipants.php.

References $ilDB, $query, $res, and ilWaitingList\_deleteUser().

Referenced by ilObjCourse\_deleteUser().

331  {
332  global $ilDB;
333 
334  $query = "DELETE FROM obj_members WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
335  $res = $ilDB->manipulate($query);
336 
337  $query = "DELETE FROM il_subscribers WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
338  $res = $ilDB->manipulate($query);
339 
340  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
342  }
static _deleteUser($a_usr_id)
Delete user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMembershipByType()

static ilParticipants::_getMembershipByType (   $a_usr_id,
  $a_type,
  $a_only_member_role = false 
)
static

get membership by type Get course or group membership

public

Parameters
int$a_usr_idusr_id
string$a_typecrs or grp
bool$a_only_member_role
Returns

Definition at line 137 of file class.ilParticipants.php.

References $ilDB, $query, $res, and $row.

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilMailSearchCoursesGUI\cancel(), ilBasicSkill\getCompletionDateForTriggerRefId(), ilCourseVerificationTableGUI\getItems(), ilLPProgressTableGUI\getItems(), ilPDSelectedItemsBlockGUI\getObjectsByMembership(), ilTestEvaluationData\getParticipants(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), ilWorkspaceAccessGUI\share(), and ilMailSearchGroupsGUI\showMyGroups().

138  {
139  global $ilDB;
140 
141  // this will also dismiss local roles!
142  if ($a_only_member_role)
143  {
144  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
145  $a2 = "AND obd2.title LIKE 'il_".$a_type."_mem%' ";
146  }
147 
148  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua ".
149  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
150  "JOIN tree t1 ON t1.child = fa.parent ".
151  "JOIN object_reference obr ON t1.parent = obr.ref_id ".
152  "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
153  $j2.
154  "WHERE obd.type = ".$ilDB->quote($a_type,'text')." ".
155  "AND fa.assign = 'y' ".
156  "AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
157  $a2;
158 
159  $res = $ilDB->query($query);
160 
161  while($row = $ilDB->fetchObject($res))
162  {
163  $ref_ids[] = $row->obj_id;
164  }
165 
166  return $ref_ids ? $ref_ids : array();
167  }
+ Here is the caller graph for this function:

◆ _hasPassed()

static ilParticipants::_hasPassed (   $a_obj_id,
  $a_usr_id 
)
static

Check if user has passed course.

public

Parameters
intobj_id
intuser id

Definition at line 282 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

Referenced by ilObjCourse\_checkCondition().

283  {
284  global $ilDB;
285 
286  $query = "SELECT * FROM obj_members ".
287  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
288  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
289  "AND passed = '1'";
290  $res = $ilDB->query($query);
291  return $res->numRows() ? true : false;
292  }
+ Here is the caller graph for this function:

◆ _isBlocked()

static ilParticipants::_isBlocked (   $a_obj_id,
  $a_usr_id 
)
static

Check if user is blocked.

public

Parameters
intcourse id
intusr_id

Definition at line 261 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

262  {
263  global $ilDB;
264 
265  $query = "SELECT * FROM obj_members ".
266  "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
267  "AND usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
268  "AND blocked = ".$ilDB->quote(1,'integer');
269  $res = $ilDB->query($query);
270  return $res->numRows() ? true : false;
271  }

◆ _isParticipant()

static ilParticipants::_isParticipant (   $a_ref_id,
  $a_usr_id 
)
static

Static function to check if a user is a participant of the container object.

public

Parameters
intref_id
intuser id

Definition at line 179 of file class.ilParticipants.php.

References $ilDB, and $ilLog.

Referenced by ilForumModeratorsGUI\detachModeratorRole(), ilObjCourseGUI\executeCommand(), ilObjCourseGUI\getTabs(), and ilObjCourseGUI\initHeaderAction().

180  {
181  global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
182 
183  $rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
184  if(!isset($rolf['ref_id']) or !$rolf['ref_id'])
185  {
186  $title = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($a_ref_id));
187  $ilLog->write(__METHOD__.': Found object without role folder. Ref_id: '.$a_ref_id.', title: '.$title);
188  $ilLog->logStack();
189 
190  return false;
191  }
192  $local_roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
193 
194  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
195  }
+ Here is the caller graph for this function:

◆ _isSubscriber()

static ilParticipants::_isSubscriber (   $a_obj_id,
  $a_usr_id 
)
static

check if user is subscriber

public

Definition at line 1328 of file class.ilParticipants.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilObjCourseListGUI\getProperties(), and ilMembershipTest\testSubscription().

1329  {
1330  global $ilDB;
1331 
1332  $query = "SELECT * FROM il_subscribers ".
1333  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1334  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
1335 
1336  $res = $ilDB->query($query);
1337  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1338  {
1339  return true;
1340  }
1341  return false;
1342  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ add()

ilParticipants::add (   $a_usr_id,
  $a_role 
)

Add user to course.

public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

Definition at line 794 of file class.ilParticipants.php.

References $ilLog, addDesktopItem(), deleteSubscriber(), ilWaitingList\deleteUserEntry(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, and isAssigned().

Referenced by ilGroupXMLParser\__assignMembers(), and assignSubscriber().

795  {
796  global $rbacadmin,$ilLog,$ilAppEventHandler;
797 
798  if($this->isAssigned($a_usr_id))
799  {
800  return false;
801  }
802 
803  switch($a_role)
804  {
805  case IL_CRS_ADMIN:
806  $this->admins[] = $a_usr_id;
807  break;
808 
809  case IL_CRS_TUTOR:
810  $this->tutors[] = $a_usr_id;
811  break;
812 
813  case IL_CRS_MEMBER:
814  $this->members[] = $a_usr_id;
815  break;
816 
817  case IL_GRP_ADMIN:
818  $this->admins[] = $a_usr_id;
819  break;
820 
821  case IL_GRP_MEMBER:
822  $this->members[] = $a_usr_id;
823  break;
824  }
825 
826  $this->participants[] = $a_usr_id;
827  $rbacadmin->assignUser($this->role_data[$a_role],$a_usr_id);
828  $this->addDesktopItem($a_usr_id);
829 
830  // Delete subscription request
831  $this->deleteSubscriber($a_usr_id);
832 
833  include_once './Services/Membership/classes/class.ilWaitingList.php';
834  ilWaitingList::deleteUserEntry($a_usr_id,$this->obj_id);
835 
836  if($this->type == 'crs') {
837  // Add event: used for ecs accounts
838  $ilLog->write(__METHOD__.': Raise new event: Modules/Course addParticipant');
839  $ilAppEventHandler->raise(
840  "Modules/Course",
841  "addParticipant",
842  array(
843  'obj_id' => $this->obj_id,
844  'usr_id' => $a_usr_id,
845  'role_id' => $a_role)
846  );
847  }
848  return true;
849  }
addDesktopItem($a_usr_id)
Add desktop item.
isAssigned($a_usr_id)
check if user is assigned
const IL_GRP_ADMIN
const IL_CRS_TUTOR
deleteSubscriber($a_usr_id)
Delete subsciber.
const IL_GRP_MEMBER
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addDesktopItem()

ilParticipants::addDesktopItem (   $a_usr_id)

Add desktop item.

public

Parameters
intusr_id

Definition at line 875 of file class.ilParticipants.php.

References ilObjUser\_addDesktopItem(), and ilObjUser\_isDesktopItem().

Referenced by add().

876  {
877  if(!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
878  {
879  ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id,$this->type);
880  }
881  return true;
882  }
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user&#39;s personal desktop
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubscriber()

ilParticipants::addSubscriber (   $a_usr_id)

Add subscriber.

public

Definition at line 1204 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

1205  {
1206  global $ilDB;
1207 
1208  $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) ".
1209  " VALUES (".
1210  $ilDB->quote($a_usr_id ,'integer').",".
1211  $ilDB->quote($this->obj_id ,'integer').", ".
1212  $ilDB->quote('','text').", ".
1213  $ilDB->quote(time() ,'integer').
1214  ")";
1215  $res = $ilDB->manipulate($query);
1216 
1217  return true;
1218  }

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

public

Definition at line 1139 of file class.ilParticipants.php.

References $ilErr, add(), deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), IL_CRS_MEMBER, isAssigned(), and isSubscriber().

Referenced by assignSubscribers(), and autoFillSubscribers().

1140  {
1141  global $ilErr;
1142 
1143  $ilErr->setMessage("");
1144  if(!$this->isSubscriber($a_usr_id))
1145  {
1146  $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1147 
1148  return false;
1149  }
1150  if($this->isAssigned($a_usr_id))
1151  {
1152  $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1153  $ilErr->appendMessage($tmp_obj->getLogin().": ".$this->lng->txt("crs_user_already_assigned"));
1154 
1155  return false;
1156  }
1157 
1158  if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id))
1159  {
1160  $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1161 
1162  return false;
1163  }
1164 
1165  // TODO: must be group or course member role
1166  $this->add($tmp_obj->getId(),IL_CRS_MEMBER);
1167  $this->deleteSubscriber($a_usr_id);
1168 
1169  return true;
1170  }
isAssigned($a_usr_id)
check if user is assigned
deleteSubscriber($a_usr_id)
Delete subsciber.
add($a_usr_id, $a_role)
Add user to course.
const IL_CRS_MEMBER
isSubscriber($a_usr_id)
check if is subscriber
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignSubscribers()

ilParticipants::assignSubscribers (   $a_usr_ids)

Assign subscribers.

public

Definition at line 1118 of file class.ilParticipants.php.

References assignSubscriber().

1119  {
1120  if(!is_array($a_usr_ids) or !count($a_usr_ids))
1121  {
1122  return false;
1123  }
1124  foreach($a_usr_ids as $id)
1125  {
1126  if(!$this->assignSubscriber($id))
1127  {
1128  return false;
1129  }
1130  }
1131  return true;
1132  }
assignSubscriber($a_usr_id)
Assign subscriber.
+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

public

Definition at line 1177 of file class.ilParticipants.php.

References assignSubscriber(), and readSubscribers().

1178  {
1179  $this->readSubscribers();
1180 
1181  $counter = 0;
1182  foreach($this->subscribers as $subscriber)
1183  {
1184  if(!$this->assignSubscriber($subscriber))
1185  {
1186  continue;
1187  }
1188  else
1189  {
1190  // TODO: notification
1191  #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1192  }
1193  ++$counter;
1194  }
1195 
1196  return $counter;
1197  }
assignSubscriber($a_usr_id)
Assign subscriber.
readSubscribers()
read subscribers
+ Here is the call graph for this function:

◆ checkLastAdmin()

ilParticipants::checkLastAdmin (   $a_usr_ids)

Check if user for deletion are last admins.

public

Parameters
arrayarray of user ids for deletion

Definition at line 622 of file class.ilParticipants.php.

References getAdmins().

623  {
624  foreach($this->getAdmins() as $admin_id)
625  {
626  if(!in_array($admin_id,$a_usr_ids))
627  {
628  return true;
629  }
630  }
631  return false;
632  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ delete()

ilParticipants::delete (   $a_usr_id)

Drop user from all roles.

public

Parameters
intusr_id

Definition at line 673 of file class.ilParticipants.php.

References $GLOBALS, $ilDB, $query, $res, dropDesktopItem(), readParticipants(), and readParticipantsStatus().

674  {
675  global $rbacadmin,$ilDB;
676 
677  $this->dropDesktopItem($a_usr_id);
678  foreach($this->roles as $role_id)
679  {
680  $rbacadmin->deassignUser($role_id,$a_usr_id);
681  }
682 
683  $query = "DELETE FROM obj_members ".
684  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
685  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer');
686  $res = $ilDB->manipulate($query);
687 
688  $this->readParticipants();
689  $this->readParticipantsStatus();
690 
691  if($this->type == 'crs')
692  {
693  // Add event: used for ecs accounts
694  $GLOBALS['ilAppEventHandler']->raise("Modules/Course", "deleteParticipant", array('obj_id' => $this->obj_id, 'usr_id' => $a_usr_id));
695  }
696 
697 
698  return true;
699  }
readParticipantsStatus()
Read stati of participants (blocked, notification, passed)
dropDesktopItem($a_usr_id)
Drop desktop item.
$GLOBALS['ct_recipient']
readParticipants()
Read participants.
+ Here is the call graph for this function:

◆ deleteParticipants()

ilParticipants::deleteParticipants (   $a_user_ids)

Delete users.

public

Parameters
arrayuser ids

Definition at line 859 of file class.ilParticipants.php.

860  {
861  foreach($a_user_ids as $user_id)
862  {
863  $this->delete($user_id);
864  }
865  return true;
866  }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

public

Definition at line 1264 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

Referenced by add(), assignSubscriber(), and readSubscribers().

1265  {
1266  global $ilDB;
1267 
1268  $query = "DELETE FROM il_subscribers ".
1269  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1270  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1271  $res = $ilDB->manipulate($query);
1272 
1273  return true;
1274  }
+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

public

Definition at line 1282 of file class.ilParticipants.php.

References $ilDB, $ilErr, $query, and $res.

1283  {
1284  global $ilErr,$ilDB;
1285 
1286  if(!is_array($a_usr_ids) or !count($a_usr_ids))
1287  {
1288  $ilErr->setMessage('');
1289  $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1290 
1291  return false;
1292  }
1293  $query = "DELETE FROM il_subscribers ".
1294  "WHERE ".$ilDB->in('usr_id',(array) $a_usr_ids,false,'integer')." ".
1295  "AND obj_id = ".$ilDB->quote($this->obj_id,'integer');
1296  $res = $ilDB->query($query);
1297  return true;
1298  }

◆ dropDesktopItem()

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

public

Parameters
intusr_id

Definition at line 891 of file class.ilParticipants.php.

References ilObjUser\_dropDesktopItem(), and ilObjUser\_isDesktopItem().

Referenced by delete().

892  {
893  if(ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
894  {
895  ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id,$this->type);
896  }
897 
898  return true;
899  }
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user&#39;s personal desktop
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

public

Returns
array array of user ids

Definition at line 459 of file class.ilParticipants.php.

Referenced by checkLastAdmin(), getCountAdmins(), and isLastAdmin().

460  {
461  return $this->admins ? $this->admins : array();
462  }
+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

public

Parameters
intuser_id

Definition at line 566 of file class.ilParticipants.php.

567  {
568  global $rbacreview;
569 
570  foreach($this->roles as $role)
571  {
572  if($rbacreview->isAssigned($a_usr_id,$role))
573  {
574  $assigned[] = $role;
575  }
576  }
577  return $assigned ? $assigned : array();
578  }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

Definition at line 468 of file class.ilParticipants.php.

References getAdmins().

469  {
470  return count($this->getAdmins());
471  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

public

Definition at line 412 of file class.ilParticipants.php.

413  {
414  return count($this->members);
415  }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

public

Definition at line 423 of file class.ilParticipants.php.

424  {
425  return count($this->participants);
426  }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

public

Definition at line 1096 of file class.ilParticipants.php.

References getSubscribers().

1097  {
1098  return count($this->getSubscribers());
1099  }
getSubscribers()
get all subscribers
+ Here is the call graph for this function:

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

Definition at line 344 of file class.ilParticipants.php.

References $ilCtrl, $obj_id, $roles, $type, ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by ilStartUpGUI\_checkGoto(), and ilRbacSystem\initMemberView().

345  {
346  global $ilCtrl;
347 
348  $obj_id = ilObject::_lookupObjId($a_ref_id);
350 
351  if(!in_array($type,array('crs','grp')))
352  {
353  return 0;
354  }
355 
356  global $rbacreview;
357 
358 
359  $rolf = $rbacreview->getRoleFolderIdOfObject($a_ref_id);
360  $roles = $rbacreview->getRolesOfRoleFolder($rolf,false);
361 
362  foreach($roles as $role)
363  {
364  $title = ilObject::_lookupTitle($role);
365  if(substr($title, 0, 13) == ('il_'.$type.'_member'))
366  {
367  return $role;
368  }
369  }
370  return 0;
371  }
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByObjId()

static ilParticipants::getInstanceByObjId (   $a_obj_id)
static

Get instance by obj type.

Parameters
int$a_obj_id
Returns
ilParticipants

Definition at line 70 of file class.ilParticipants.php.

References $type, ilGroupParticipants\_getInstanceByObjId(), ilCourseParticipants\_getInstanceByObjId(), and ilObject\_lookupType().

Referenced by ilRepositorySearchGUI\listUsers(), and ilRepositoryObjectResultTableGUI\parseObjectIds().

71  {
72  $type = ilObject::_lookupType($a_obj_id);
73  switch($type)
74  {
75  case 'crs':
76  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
78 
79  case 'grp':
80  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
82  }
83  // @todo proper error handling
84  return null;
85  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMembers()

ilParticipants::getMembers ( )

Get all members ids (admins and tutors are not members) Use get participants to fetch all.

public

Returns
array array of user ids

Definition at line 449 of file class.ilParticipants.php.

450  {
451  return $this->members ? $this->members : array();
452  }

◆ getNotificationRecipients()

ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

public

Returns
array array of user ids

Definition at line 388 of file class.ilParticipants.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, isAdmin(), and isTutor().

Referenced by ilGroupParticipants\sendNotification(), ilCourseParticipants\sendNotificationToAdmins(), ilCourseParticipants\sendSubscriptionRequestToAdmins(), and ilCourseParticipants\sendUnsubscribeNotificationToAdmins().

389  {
390  global $ilDB;
391 
392  $query = "SELECT * FROM obj_members ".
393  "WHERE notification = 1 ".
394  "AND obj_id = ".$ilDB->quote($this->obj_id)." ";
395  $res = $ilDB->query($query);
396  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
397  {
398  if($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id))
399  {
400  $recp[] = $row->usr_id;
401  }
402  }
403  return $recp ? $recp : array();
404  }
isAdmin($a_usr_id)
is user admin
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
isTutor($a_usr_id)
is user tutor
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParticipants()

ilParticipants::getParticipants ( )

Get all participants ids.

public

Returns
array array of user ids

Definition at line 437 of file class.ilParticipants.php.

Referenced by isGroupingMember().

438  {
439  return $this->participants ? $this->participants : array();
440  }
+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

public

Parameters

Definition at line 554 of file class.ilParticipants.php.

Referenced by updateRoleAssignments().

555  {
556  return $this->roles ? $this->roles : array();
557  }
+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

public

Definition at line 1106 of file class.ilParticipants.php.

References readSubscriberData().

1107  {
1108  return $this->readSubscriberData($a_usr_id);
1109  }
readSubscriberData($a_usr_id)
read subscribers
+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers

public

Definition at line 1083 of file class.ilParticipants.php.

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

1084  {
1085  $this->readSubscribers();
1086 
1087  return $this->subscribers;
1088  }
readSubscribers()
read subscribers
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTutors()

ilParticipants::getTutors ( )

Get all tutors ids.

public

Returns
array array of user ids

Definition at line 480 of file class.ilParticipants.php.

481  {
482  return $this->tutors ? $this->tutors : array();
483  }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

Definition at line 377 of file class.ilParticipants.php.

References $type.

378  {
379  return $this->type;
380  }

◆ hasParticipantListAccess()

static ilParticipants::hasParticipantListAccess (   $a_obj_id,
  $a_usr_id = null 
)
static

Check if (current) user has access to the participant list.

Parameters
type$a_obj
type$a_usr_id

Definition at line 93 of file class.ilParticipants.php.

References $GLOBALS, $ref_id, ilObject\_getAllReferences(), and ilObjCourse\lookupShowMembersEnabled().

Referenced by ilRepositorySearchGUI\listUsers(), ilRepositoryObjectResultTableGUI\parseObjectIds(), and ilMailSearchGUI\showResults().

94  {
95  if(!$a_usr_id)
96  {
97  $a_usr_id = $GLOBALS['ilUser']->getId();
98  }
99 
100  // if write access granted => return true
101  $refs = ilObject::_getAllReferences($a_obj_id);
102  $ref_id = end($refs);
103 
104  if($GLOBALS['ilAccess']->checkAccess('write','',$ref_id))
105  {
106  return true;
107  }
108  $part = self::getInstanceByObjId($a_obj_id);
109  if($part->isAssigned($a_usr_id))
110  {
111  if($part->getType() == 'crs')
112  {
113  // Check for show_members
114  include_once './Modules/Course/classes/class.ilObjCourse.php';
116  {
117  return false;
118  }
119  }
120  return true;
121  }
122  // User is not assigned to course/group => no read access
123  return false;
124  }
static _getAllReferences($a_id)
get all reference ids of object
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
$GLOBALS['ct_recipient']
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPassed()

ilParticipants::hasPassed (   $a_usr_id)

Check if user has passed course.

public

Parameters
intuser_id

Definition at line 657 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

658  {
659  if(isset($this->participants_status[$a_usr_id]))
660  {
661  return $this->participants_status[$a_usr_id]['passed'] ? true : false;
662  }
663  return false;
664  }
+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipants::isAdmin (   $a_usr_id)

is user admin

public

Parameters
intusr_id

Definition at line 492 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody(), and getNotificationRecipients().

493  {
494  return in_array($a_usr_id,$this->admins) ? true : false;
495  }
+ Here is the caller graph for this function:

◆ isAssigned()

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

public

Parameters

Definition at line 531 of file class.ilParticipants.php.

Referenced by add(), and assignSubscriber().

532  {
533  return in_array($a_usr_id,$this->participants);
534  }
+ Here is the caller graph for this function:

◆ isBlocked()

ilParticipants::isBlocked (   $a_usr_id)

Check if user is blocked.

public

Parameters
intuser_id

Definition at line 641 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

642  {
643  if(isset($this->participants_status[$a_usr_id]))
644  {
645  return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
646  }
647  return false;
648  }
+ Here is the caller graph for this function:

◆ isGroupingMember()

ilParticipants::isGroupingMember (   $a_usr_id,
  $a_field = '' 
)

Check grouping membership.

public

Parameters

Definition at line 1020 of file class.ilParticipants.php.

References $ilDB, $query, $res, ilObjectFactory\getInstanceByObjId(), and getParticipants().

1021  {
1022  global $rbacreview,$ilObjDataCache,$ilDB;
1023 
1024  // Used for membership limitations -> check membership by given field
1025  if($a_field)
1026  {
1027  include_once './Services/User/classes/class.ilObjUser.php';
1028 
1029  $tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id);
1030  switch($a_field)
1031  {
1032  case 'login':
1033  $and = "AND login = ".$ilDB->quote($tmp_user->getLogin(),'text')." ";
1034  break;
1035  case 'email':
1036  $and = "AND email = ".$ilDB->quote($tmp_user->getEmail(),'text')." ";
1037  break;
1038  case 'matriculation':
1039  $and = "AND matriculation = ".$ilDB->quote($tmp_user->getMatriculation(),'text')." ";
1040  break;
1041 
1042  default:
1043  $and = "AND usr_id = ".$ilDB->quote($a_usr_id,'integer'). " ";
1044  break;
1045  }
1046 
1047  if(!$this->getParticipants())
1048  {
1049  return false;
1050  }
1051 
1052  $query = "SELECT * FROM usr_data ud ".
1053  "WHERE ".$ilDB->in('usr_id',$this->getParticipants(),false,'integer')." ".
1054  $and;
1055 
1056  $res = $ilDB->query($query);
1057  return $res->numRows() ? true : false;
1058  }
1059  }
getParticipants()
Get all participants ids.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

◆ isLastAdmin()

ilParticipants::isLastAdmin (   $a_usr_id)

Check if user is last admin.

Parameters
int$a_usr_id
Returns
bool

Definition at line 541 of file class.ilParticipants.php.

References getAdmins().

542  {
543  return in_array($a_usr_id,$this->getAdmins()) and count($this->getAdmins()) == 1;
544  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ isMember()

ilParticipants::isMember (   $a_usr_id)

is user member

public

Parameters
intusr_id

Definition at line 516 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

517  {
518  return in_array($a_usr_id,$this->members) ? true : false;
519  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

public

Parameters

Definition at line 910 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

911  {
912  if(isset($this->participants_status[$a_usr_id]))
913  {
914  return $this->participants_status[$a_usr_id]['notification'] ? true : false;
915  }
916  return false;
917  }
+ Here is the caller graph for this function:

◆ isSubscriber()

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

public

Definition at line 1306 of file class.ilParticipants.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by assignSubscriber().

1307  {
1308  global $ilDB;
1309 
1310  $query = "SELECT * FROM il_subscribers ".
1311  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1312  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')."";
1313 
1314  $res = $ilDB->query($query);
1315  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1316  {
1317  return true;
1318  }
1319  return false;
1320  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor (   $a_usr_id)

is user tutor

public

Parameters
intusr_id

Definition at line 504 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody(), and getNotificationRecipients().

505  {
506  return in_array($a_usr_id,$this->tutors) ? true : false;
507  }
+ Here is the caller graph for this function:

◆ lookupNumberOfMembers()

static ilParticipants::lookupNumberOfMembers (   $a_ref_id)
static

Lookup number of members ilRbacReview $rbacreview <type> $ilObjDataCache.

Parameters
<type>$a_ref_id
Returns
int

Definition at line 220 of file class.ilParticipants.php.

Referenced by ilObjCourseGUI\infoScreen().

221  {
222  global $rbacreview, $ilObjDataCache;
223 
224  $rolf = $rbacreview->getRoleFolderIdOfObject($a_ref_id);
225 
226  if(!$rolf)
227  {
228  return 0;
229  }
230  $lroles = $rbacreview->getRolesOfRoleFolder($rolf,false);
231 
232  $memberRoles = array();
233  foreach($lroles as $role_id)
234  {
235  $title = $ilObjDataCache->lookupTitle($role_id);
236  switch(substr($title,0,8))
237  {
238  case 'il_crs_a':
239  case 'il_crs_t':
240  case 'il_grp_a':
241  break;
242 
243  default:
244  $memberRoles[] = $role_id;
245  break;
246  }
247  }
248  return $rbacreview->getNumberOfAssignedUsers($memberRoles);
249  }
+ Here is the caller graph for this function:

◆ lookupNumberOfParticipants()

static ilParticipants::lookupNumberOfParticipants (   $a_ref_id)
static

Lookup the number of participants (crs admins, tutors, members, grp admins, members)

ilRbacReview $rbacreview

Parameters
int$a_ref_id

Definition at line 204 of file class.ilParticipants.php.

205  {
206  global $rbacreview;
207 
208  $rolf = $rbacreview->getRoleFolderOfObject($a_ref_id);
209  $lroles = $rbacreview->getRolesOfRoleFolder($rolf['ref_id'],false);
210  return $rbacreview->getNumberOfAssignedUsers($lroles);
211  }

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

Definition at line 1061 of file class.ilParticipants.php.

References $ilDB, $query, $res, $row, $subscribers, and DB_FETCHMODE_OBJECT.

Referenced by ilObjCourseGUI\membersObject().

1062  {
1063  global $ilDB;
1064 
1065  $subscribers = array();
1066  $query = "SELECT usr_id FROM il_subscribers ".
1067  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
1068  "ORDER BY sub_time ";
1069 
1070  $res = $ilDB->query($query);
1071  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1072  {
1073  $subscribers[] = $row->usr_id;
1074  }
1075  return $subscribers;
1076  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

Definition at line 1395 of file class.ilParticipants.php.

References $data, $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilSubscriberTableGUI\readSubscriberData().

1396  {
1397  global $ilDB;
1398 
1399  $query = 'SELECT * FROM il_subscribers '.
1400  'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
1401  $res = $ilDB->query($query);
1402 
1403  $data = array();
1404  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1405  {
1406  $data[$row->usr_id]['time'] = $row->sub_time;
1407  $data[$row->usr_id]['usr_id'] = $row->usr_id;
1408  $data[$row->usr_id]['subject'] = $row->subject;
1409  }
1410  return $data;
1411  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
private

Read participants.

private

Parameters

Definition at line 927 of file class.ilParticipants.php.

References $ilLog, $participants, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, and IL_GRP_MEMBER.

Referenced by __construct(), delete(), and updateRoleAssignments().

928  {
929  global $rbacreview,$ilObjDataCache,$ilLog;
930 
931  $rolf = $rbacreview->getRoleFolderOfObject($this->ref_id);
932 
933  if(!isset($rolf['ref_id']) or !$rolf['ref_id'])
934  {
935  $title = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->ref_id));
936  $ilLog->write(__METHOD__.': Found object without role folder. Ref_id: '.$this->ref_id.', title: '.$title);
937  $ilLog->logStack();
938  return false;
939  }
940 
941  $this->roles = $rbacreview->getRolesOfRoleFolder($rolf['ref_id'],false);
942 
943  $users = array();
944  $this->participants = array();
945  $this->members = $this->admins = $this->tutors = array();
946 
947  foreach($this->roles as $role_id)
948  {
949  $title = $ilObjDataCache->lookupTitle($role_id);
950  switch(substr($title,0,8))
951  {
952  case 'il_crs_m':
953  $this->role_data[IL_CRS_MEMBER] = $role_id;
954  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
955  $this->members = array_unique(array_merge($assigned,$this->members));
956  break;
957 
958  case 'il_crs_a':
959  $this->role_data[IL_CRS_ADMIN] = $role_id;
960  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
961  $this->admins = $rbacreview->assignedUsers($role_id);
962  break;
963 
964  case 'il_crs_t':
965  $this->role_data[IL_CRS_TUTOR] = $role_id;
966  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
967  $this->tutors = $rbacreview->assignedUsers($role_id);
968  break;
969 
970  case 'il_grp_a':
971  $this->role_data[IL_GRP_ADMIN] = $role_id;
972  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
973  $this->admins = $rbacreview->assignedUsers($role_id);
974  break;
975 
976  case 'il_grp_m':
977  $this->role_data[IL_GRP_MEMBER] = $role_id;
978  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
979  $this->members = $rbacreview->assignedUsers($role_id);
980  break;
981 
982  default:
983  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
984  $this->members = array_unique(array_merge($assigned,$this->members));
985  break;
986  }
987  }
988  }
const IL_GRP_ADMIN
const IL_CRS_TUTOR
const IL_GRP_MEMBER
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
+ Here is the caller graph for this function:

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
private

Read stati of participants (blocked, notification, passed)

private

Parameters

Definition at line 997 of file class.ilParticipants.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct(), delete(), and updateRoleAssignments().

998  {
999  global $ilDB;
1000 
1001  $query = "SELECT * FROM obj_members ".
1002  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1003  $res = $ilDB->query($query);
1004  $this->participants_status = array();
1005  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1006  {
1007  $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1008  $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1009  $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1010  }
1011  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

protected

Definition at line 1377 of file class.ilParticipants.php.

References $data, $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and ilDB\query().

Referenced by getSubscriberData().

1378  {
1379  global $ilDB;
1380 
1381  $query = "SELECT * FROM il_subscribers ".
1382  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1383  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
1384 
1385  $res = $this->ilDB->query($query);
1386  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1387  {
1388  $data["time"] = $row->sub_time;
1389  $data["usr_id"] = $row->usr_id;
1390  $data['subject'] = $row->subject;
1391  }
1392  return $data ? $data : array();
1393  }
query($sql, $a_handle_error=true)
Query.
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected

read subscribers

protected

Definition at line 1349 of file class.ilParticipants.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), and ilDB\query().

Referenced by autoFillSubscribers(), and getSubscribers().

1350  {
1351  global $ilDB;
1352 
1353  $this->subscribers = array();
1354 
1355  $query = "SELECT usr_id FROM il_subscribers ".
1356  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1357  "ORDER BY sub_time ";
1358 
1359  $res = $this->ilDB->query($query);
1360  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1361  {
1362  // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1363  if(!ilObjectFactory::getInstanceByObjId($row->usr_id,false))
1364  {
1365  $this->deleteSubscriber($row->usr_id);
1366  }
1367  $this->subscribers[] = $row->usr_id;
1368  }
1369  return true;
1370  }
query($sql, $a_handle_error=true)
Query.
deleteSubscriber($a_usr_id)
Delete subsciber.
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Database Wrapper.
Definition: class.ilDB.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

public

Parameters
intusr_id
boolblocked

Definition at line 709 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

710  {
711  global $ilDB;
712 
713  $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
714 
715  $query = "SELECT * FROM obj_members ".
716  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
717  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
718  $res = $ilDB->query($query);
719  if($res->numRows())
720  {
721  $query = "UPDATE obj_members SET ".
722  "blocked = ".$ilDB->quote((int) $a_blocked ,'integer')." ".
723  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
724  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
725  }
726  else
727  {
728  $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) ".
729  "VALUES ( ".
730  $ilDB->quote((int) $a_blocked ,'integer').", ".
731  $ilDB->quote($this->obj_id ,'integer').", ".
732  $ilDB->quote($a_usr_id ,'integer').", ".
733  $ilDB->quote(0,'integer').", ".
734  $ilDB->quote(0,'integer').
735  ")";
736 
737  }
738  $res = $ilDB->manipulate($query);
739  return true;
740  }

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

Definition at line 750 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

751  {
752  global $ilDB;
753 
754  $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
755 
756  $query = "SELECT * FROM obj_members ".
757  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
758  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
759  $res = $ilDB->query($query);
760  if($res->numRows())
761  {
762  $query = "UPDATE obj_members SET ".
763  "notification = ".$ilDB->quote((int) $a_notification ,'integer')." ".
764  "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
765  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
766  }
767  else
768  {
769  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) ".
770  "VALUES ( ".
771  $ilDB->quote((int) $a_notification ,'integer').", ".
772  $ilDB->quote($this->obj_id ,'integer').", ".
773  $ilDB->quote($a_usr_id ,'integer').", ".
774  $ilDB->quote(0,'integer').", ".
775  $ilDB->quote(0,'integer').
776  ")";
777 
778  }
779  $res = $ilDB->manipulate($query);
780  return true;
781  }

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

public

Parameters
intusr_id
arrayarray of new roles

Definition at line 588 of file class.ilParticipants.php.

References $roles, getRoles(), readParticipants(), and readParticipantsStatus().

589  {
590  global $rbacreview,$rbacadmin;
591 
592  $roles = $a_roles ? $a_roles : array();
593 
594  foreach($this->getRoles() as $role_id)
595  {
596  if($rbacreview->isAssigned($a_usr_id,$role_id))
597  {
598  if(!in_array($role_id,$roles))
599  {
600  $rbacadmin->deassignUser($role_id,$a_usr_id);
601  }
602  }
603  else
604  {
605  if(in_array($role_id,$roles))
606  {
607  $rbacadmin->assignUser($role_id,$a_usr_id);
608  }
609  }
610  }
611  $this->readParticipants();
612  $this->readParticipantsStatus();
613  }
readParticipantsStatus()
Read stati of participants (blocked, notification, passed)
getRoles()
Get course roles.
readParticipants()
Read participants.
+ Here is the call graph for this function:

◆ updateSubject()

ilParticipants::updateSubject (   $a_usr_id,
  $a_subject 
)

update subject

public

Parameters

Definition at line 1246 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

1247  {
1248  global $ilDB;
1249 
1250  $query = "UPDATE il_subscribers ".
1251  "SET subject = ".$ilDB->quote($a_subject ,'text')." ".
1252  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1253  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1254  $res = $ilDB->manipulate($query);
1255  return true;
1256  }

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

public

Definition at line 1226 of file class.ilParticipants.php.

References $ilDB, $query, and $res.

1227  {
1228  global $ilDB;
1229 
1230  $query = "UPDATE il_subscribers ".
1231  "SET sub_time = ".$ilDB->quote($a_subtime ,'integer')." ".
1232  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1233  "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1234  $res = $ilDB->manipulate($query);
1235 
1236  return true;
1237  }

Field Documentation

◆ $admins

ilParticipants::$admins = array()
protected

Definition at line 33 of file class.ilParticipants.php.

◆ $ilDB

◆ $lng

ilParticipants::$lng
protected

Definition at line 38 of file class.ilParticipants.php.

Referenced by __construct().

◆ $members

ilParticipants::$members = array()
protected

Definition at line 31 of file class.ilParticipants.php.

◆ $obj_id

ilParticipants::$obj_id = 0
protected

Definition at line 22 of file class.ilParticipants.php.

Referenced by getDefaultMemberRole().

◆ $participants

ilParticipants::$participants = array()
protected

Definition at line 29 of file class.ilParticipants.php.

Referenced by readParticipants().

◆ $participants_status

ilParticipants::$participants_status = array()
protected

Definition at line 30 of file class.ilParticipants.php.

◆ $ref_id

ilParticipants::$ref_id = 0
protected

Definition at line 24 of file class.ilParticipants.php.

Referenced by hasParticipantListAccess().

◆ $role_data

ilParticipants::$role_data = array()
protected

Definition at line 27 of file class.ilParticipants.php.

◆ $roles

ilParticipants::$roles = array()
protected

◆ $subscribers

ilParticipants::$subscribers = array()
protected

Definition at line 35 of file class.ilParticipants.php.

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

ilParticipants::$tutors = array()
protected

Definition at line 32 of file class.ilParticipants.php.

◆ $type

ilParticipants::$type = ''
protected

Definition at line 23 of file class.ilParticipants.php.

Referenced by getDefaultMemberRole(), getInstanceByObjId(), and getType().


The documentation for this class was generated from the following file: