ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 80 of file class.ilMembershipCronMinMembers.php.

References array, and ilObjCourse\findCoursesWithNotEnoughMembers().

Referenced by run().

81  {
82  include_once "Modules/Course/classes/class.ilObjCourse.php";
83  foreach (ilObjCourse::findCoursesWithNotEnoughMembers() as $obj_id => $item) {
84  $too_few = (bool) $item[0];
85 
86  /*
87  $ilDB->manipulate("UPDATE crs_settings".
88  " SET cancel_end_noti = ".$ilDB->quote($now, "integer").
89  " WHERE obj_id = ".$ilDB->quote($obj_id, "integer"));
90  */
91 
92  if ($too_few) {
93  // not enough members: notifiy course admins
94  foreach ($item[1] as $reci_id) {
95  $a_recipients_map[$reci_id][] = array("crs", $obj_id, $item[0]);
96  }
97  } else {
98  // enough members: notify members?
99 
100  // :TODO: ?
101  }
102  }
103  }
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 105 of file class.ilMembershipCronMinMembers.php.

References array, and ilObjGroup\findGroupsWithNotEnoughMembers().

Referenced by run().

106  {
107  include_once "Modules/Group/classes/class.ilObjGroup.php";
108  foreach (ilObjGroup::findGroupsWithNotEnoughMembers() as $obj_id => $item) {
109  $too_few = (bool) $item[0];
110 
111  /*
112  $ilDB->manipulate("UPDATE grp_settings".
113  " SET cancel_end_noti = ".$ilDB->quote($now, "integer").
114  " WHERE obj_id = ".$ilDB->quote($obj_id, "integer"));
115  */
116 
117  if ($too_few) {
118  // not enough members: notifiy group admins
119  foreach ($item[1] as $reci_id) {
120  $a_recipients_map[$reci_id][] = array("grp", $obj_id, $item[0]);
121  }
122  } else {
123  // enough members: notify members?
124 
125  // :TODO: ?
126  }
127  }
128  }
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 $message, $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  foreach ($recipients_map as $reci_id => $items) {
66  $this->sendMessage($reci_id, $items);
67  }
68 
70  $message = sizeof($recipients_map) . " notifications sent";
71  }
72 
73  $result = new ilCronJobResult();
74  $result->setStatus($status);
75  $result->setMessage($message);
76 
77  return $result;
78  }
$result
catch(Exception $e) $message
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 130 of file class.ilMembershipCronMinMembers.php.

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

Referenced by run().

131  {
132  global $ilUser;
133 
134  include_once "Services/Link/classes/class.ilLink.php";
135  include_once "./Services/Notification/classes/class.ilSystemNotification.php";
136  $ntf = new ilSystemNotification();
137  $ntf->setLangModules(array("crs"));
138 
139  // #17097
140  $ntf->setReasonLangId("mem_cron_min_members_reason");
141  $ntf->setTaskLangId("mem_cron_min_members_task");
142 
143  // user specific language
144  $lng = $ntf->getUserLanguage($a_reci_id);
145 
146  $list = array();
147  foreach ($a_items as $item) {
148  $obj_type = $item[0];
149  $obj_id = $item[1];
150  $ref_id = array_pop(ilObject::_getAllReferences($obj_id));
151 
152  $title = ilObject::_lookupTitle($obj_id);
153  $url = ilLink::_getLink($ref_id, $obj_type);
154 
155  $list[] = $title . "\n" . $url . "\n";
156  }
157  $list = implode($ntf->getBlockBorder(), $list);
158 
159  $ntf->addAdditionalInfo("mem_cron_min_members_intro", $list, true);
160 
161  $mail = new ilMail(ANONYMOUS_USER_ID);
162  $mail->enableSOAP(false); // #10410
163  $mail->sendMail(
164  ilObjUser::_lookupLogin($a_reci_id),
165  null,
166  null,
167  $lng->txt("mem_cron_min_members_subject"),
168  $ntf->composeAndGetMessage($a_reci_id, null, "read", true),
169  null,
170  array("system")
171  );
172  }
static _lookupLogin($a_user_id)
lookup login
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
static _lookupTitle($a_id)
lookup object title
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.
global $lng
Definition: privfeed.php:17
$url
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: