ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. 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 84 of file class.ilMembershipCronMinMembers.php.

References ilObjCourse\findCoursesWithNotEnoughMembers().

Referenced by run().

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

39  {
40  return self::SCHEDULE_TYPE_DAILY;
41  }

◆ getDefaultScheduleValue()

ilMembershipCronMinMembers::getDefaultScheduleValue ( )

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

44  {
45  return;
46  }

◆ getDescription()

ilMembershipCronMinMembers::getDescription ( )

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

References $DIC, and $lng.

30  {
31  global $DIC;
32 
33  $lng = $DIC['lng'];
34 
35  return $lng->txt("mem_cron_min_members_info");
36  }
global $DIC
Definition: saml.php:7
$lng

◆ getGroups()

ilMembershipCronMinMembers::getGroups ( array &  $a_recipients_map)
protected

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

References ilObjGroup\findGroupsWithNotEnoughMembers().

Referenced by run().

110  {
111  include_once "Modules/Group/classes/class.ilObjGroup.php";
112  foreach (ilObjGroup::findGroupsWithNotEnoughMembers() as $obj_id => $item) {
113  $too_few = (bool) $item[0];
114 
115  /*
116  $ilDB->manipulate("UPDATE grp_settings".
117  " SET cancel_end_noti = ".$ilDB->quote($now, "integer").
118  " WHERE obj_id = ".$ilDB->quote($obj_id, "integer"));
119  */
120 
121  if ($too_few) {
122  // not enough members: notifiy group admins
123  foreach ($item[1] as $reci_id) {
124  $a_recipients_map[$reci_id][] = array("grp", $obj_id, $item[0]);
125  }
126  } else {
127  // enough members: notify members?
128 
129  // :TODO: ?
130  }
131  }
132  }
static findGroupsWithNotEnoughMembers()
Minimum members check $ilDB $ilDB.
+ 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 $DIC, and $lng.

21  {
22  global $DIC;
23 
24  $lng = $DIC['lng'];
25 
26  return $lng->txt("mem_cron_min_members");
27  }
global $DIC
Definition: saml.php:7
$lng

◆ hasAutoActivation()

ilMembershipCronMinMembers::hasAutoActivation ( )

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

49  {
50  return true;
51  }

◆ hasFlexibleSchedule()

ilMembershipCronMinMembers::hasFlexibleSchedule ( )

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

54  {
55  return false;
56  }

◆ run()

ilMembershipCronMinMembers::run ( )

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

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

59  {
61  $message = null;
62 
63  $recipients_map = array();
64 
65  $this->getCourses($recipients_map);
66  $this->getGroups($recipients_map);
67 
68  if (sizeof($recipients_map)) {
69  foreach ($recipients_map as $reci_id => $items) {
70  $this->sendMessage($reci_id, $items);
71  }
72 
74  $message = sizeof($recipients_map) . " notifications sent";
75  }
76 
77  $result = new ilCronJobResult();
78  $result->setStatus($status);
79  $result->setMessage($message);
80 
81  return $result;
82  }
$result
catch(Exception $e) $message
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 134 of file class.ilMembershipCronMinMembers.php.

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

Referenced by run().

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