ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMembershipCronMinMembers Class Reference

Cron for course/group minimum members. More...

+ Inheritance diagram for ilMembershipCronMinMembers:
+ Collaboration diagram for ilMembershipCronMinMembers:

Public Member Functions

 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 run ()
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $a_value)
 Update current schedule (if flexible) More...
 
 getValidScheduleTypes ()
 Get all available schedule types. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Protected Member Functions

 getCourses (array &$a_recipients_map)
 
 getGroups (array &$a_recipients_map)
 
 sendMessage ($a_reci_id, array $a_items)
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 

Detailed Description

Cron for course/group minimum members.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 13 of file class.ilMembershipCronMinMembers.php.

Member Function Documentation

◆ getCourses()

ilMembershipCronMinMembers::getCourses ( array $a_recipients_map)
protected

Definition at line 82 of file class.ilMembershipCronMinMembers.php.

References array, and ilObjCourse\findCoursesWithNotEnoughMembers().

Referenced by run().

83  {
84  include_once "Modules/Course/classes/class.ilObjCourse.php";
85  foreach(ilObjCourse::findCoursesWithNotEnoughMembers() as $obj_id => $item)
86  {
87  $too_few = (bool)$item[0];
88 
89  /*
90  $ilDB->manipulate("UPDATE crs_settings".
91  " SET cancel_end_noti = ".$ilDB->quote($now, "integer").
92  " WHERE obj_id = ".$ilDB->quote($obj_id, "integer"));
93  */
94 
95  if($too_few)
96  {
97  // not enough members: notifiy course admins
98  foreach($item[1] as $reci_id)
99  {
100  $a_recipients_map[$reci_id][] = array("crs", $obj_id, $item[0]);
101  }
102  }
103  else
104  {
105  // enough members: notify members?
106 
107  // :TODO: ?
108  }
109  }
110  }
Create styles array
The data for the language used.
static findCoursesWithNotEnoughMembers()
Minimum members check type $ilDB.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultScheduleType()

ilMembershipCronMinMembers::getDefaultScheduleType ( )

Definition at line 34 of file class.ilMembershipCronMinMembers.php.

35  {
36  return self::SCHEDULE_TYPE_DAILY;
37  }

◆ getDefaultScheduleValue()

ilMembershipCronMinMembers::getDefaultScheduleValue ( )

Definition at line 39 of file class.ilMembershipCronMinMembers.php.

40  {
41  return;
42  }

◆ getDescription()

ilMembershipCronMinMembers::getDescription ( )

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

References $lng.

28  {
29  global $lng;
30 
31  return $lng->txt("mem_cron_min_members_info");
32  }
global $lng
Definition: privfeed.php:17

◆ getGroups()

ilMembershipCronMinMembers::getGroups ( array $a_recipients_map)
protected

Definition at line 112 of file class.ilMembershipCronMinMembers.php.

References array, and ilObjGroup\findGroupsWithNotEnoughMembers().

Referenced by run().

113  {
114  include_once "Modules/Group/classes/class.ilObjGroup.php";
115  foreach(ilObjGroup::findGroupsWithNotEnoughMembers() as $obj_id => $item)
116  {
117  $too_few = (bool)$item[0];
118 
119  /*
120  $ilDB->manipulate("UPDATE grp_settings".
121  " SET cancel_end_noti = ".$ilDB->quote($now, "integer").
122  " WHERE obj_id = ".$ilDB->quote($obj_id, "integer"));
123  */
124 
125  if($too_few)
126  {
127  // not enough members: notifiy group admins
128  foreach($item[1] as $reci_id)
129  {
130  $a_recipients_map[$reci_id][] = array("grp", $obj_id, $item[0]);
131  }
132  }
133  else
134  {
135  // enough members: notify members?
136 
137  // :TODO: ?
138  }
139  }
140  }
static findGroupsWithNotEnoughMembers()
Minimum members check $ilDB $ilDB.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilMembershipCronMinMembers::getId ( )

Definition at line 15 of file class.ilMembershipCronMinMembers.php.

16  {
17  return "mem_min_members";
18  }

◆ getTitle()

ilMembershipCronMinMembers::getTitle ( )

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

References $lng.

21  {
22  global $lng;
23 
24  return $lng->txt("mem_cron_min_members");
25  }
global $lng
Definition: privfeed.php:17

◆ hasAutoActivation()

ilMembershipCronMinMembers::hasAutoActivation ( )

Definition at line 44 of file class.ilMembershipCronMinMembers.php.

45  {
46  return true;
47  }

◆ hasFlexibleSchedule()

ilMembershipCronMinMembers::hasFlexibleSchedule ( )

Definition at line 49 of file class.ilMembershipCronMinMembers.php.

50  {
51  return false;
52  }

◆ run()

ilMembershipCronMinMembers::run ( )

Definition at line 54 of file class.ilMembershipCronMinMembers.php.

References $result, array, getCourses(), getGroups(), sendMessage(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

55  {
57  $message = null;
58 
59  $recipients_map = array();
60 
61  $this->getCourses($recipients_map);
62  $this->getGroups($recipients_map);
63 
64  if(sizeof($recipients_map))
65  {
66  foreach($recipients_map as $reci_id => $items)
67  {
68  $this->sendMessage($reci_id, $items);
69  }
70 
72  $message = sizeof($recipients_map)." notifications sent";
73  }
74 
75  $result = new ilCronJobResult();
76  $result->setStatus($status);
77  $result->setMessage($message);
78 
79  return $result;
80  }
$result
Create styles array
The data for the language used.
Cron job result data container.
+ Here is the call graph for this function:

◆ sendMessage()

ilMembershipCronMinMembers::sendMessage (   $a_reci_id,
array  $a_items 
)
protected

Definition at line 142 of file class.ilMembershipCronMinMembers.php.

References $ilUser, $lng, $ref_id, $title, $url, ilObject\_getAllReferences(), ilLink\_getLink(), ilObjUser\_lookupLogin(), ilObject\_lookupTitle(), and array.

Referenced by run().

143  {
144  global $ilUser;
145 
146  include_once "Services/Link/classes/class.ilLink.php";
147  include_once "./Services/Notification/classes/class.ilSystemNotification.php";
148  $ntf = new ilSystemNotification();
149  $ntf->setLangModules(array("crs"));
150 
151  // #17097
152  $ntf->setReasonLangId("mem_cron_min_members_reason");
153  $ntf->setTaskLangId("mem_cron_min_members_task");
154 
155  // user specific language
156  $lng = $ntf->getUserLanguage($a_reci_id);
157 
158  $list = array();
159  foreach($a_items as $item)
160  {
161  $obj_type = $item[0];
162  $obj_id = $item[1];
163  $ref_id = array_pop(ilObject::_getAllReferences($obj_id));
164 
165  $title = ilObject::_lookupTitle($obj_id);
166  $url = ilLink::_getLink($ref_id, $obj_type);
167 
168  $list[] = $title."\n".$url."\n";
169  }
170  $list = implode($ntf->getBlockBorder(), $list);
171 
172  $ntf->addAdditionalInfo("mem_cron_min_members_intro", $list, true);
173 
174  $mail = new ilMail(ANONYMOUS_USER_ID);
175  $mail->enableSOAP(false); // #10410
176  $mail->sendMail(ilObjUser::_lookupLogin($a_reci_id),
177  null,
178  null,
179  $lng->txt("mem_cron_min_members_subject"),
180  $ntf->composeAndGetMessage($a_reci_id, null, "read", true),
181  null,
182  array("system"));
183  }
static _lookupLogin($a_user_id)
lookup login
static _lookupTitle($a_id)
lookup object title
$url
Definition: shib_logout.php:72
static _getAllReferences($a_id)
get all reference ids of object
This class handles base functions for mail handling.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
$ref_id
Definition: sahs_server.php:39
global $lng
Definition: privfeed.php:17
Wrapper classes for system notifications.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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