ILIAS  release_8 Revision v8.24
ilMembershipCronMinMembers Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 run ()
 
- Public Member Functions inherited from ilCronJob
 setDateTimeProvider (?Closure $date_time_provider)
 
 isDue (?DateTimeImmutable $last_run, ?int $schedule_type, ?int $schedule_value, bool $is_manually_executed=false)
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule (?int $a_type, ?int $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...
 
 isManuallyExecutable ()
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
 activationWasToggled (ilDBInterface $db, ilSetting $setting, bool $a_currently_active)
 Important: This method is (also) called from the setup process, where the constructor of an ilCronJob ist NOT executed. More...
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 

Protected Member Functions

 getCourses (array &$a_recipients_map)
 
 getGroups (array &$a_recipients_map)
 
 sendMessage (int $a_reci_id, array $a_items)
 

Protected Attributes

ilLanguage $lng
 
- Protected Attributes inherited from ilCronJob
int $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_HOURS = 3
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_DAYS = 4
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_WEEKLY = 5
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_MONTHLY = 6
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_QUARTERLY = 7
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_YEARLY = 8
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 28 of file class.ilMembershipCronMinMembers.php.

Constructor & Destructor Documentation

◆ __construct()

ilMembershipCronMinMembers::__construct ( )

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

33 {
34 global $DIC;
35
36 $this->lng = $DIC->language();
37 }
global $DIC
Definition: feed.php:28

References $DIC, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getCourses()

ilMembershipCronMinMembers::getCourses ( array &  $a_recipients_map)
protected

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

99 : void
100 {
101 foreach (ilObjCourse::findCoursesWithNotEnoughMembers() as $obj_id => $item) {
102 $too_few = (bool) $item[0];
103
104
105 if ($too_few) {
106 // not enough members: notifiy course admins
107 foreach ($item[1] as $reci_id) {
108 $a_recipients_map[$reci_id][] = array("crs", $obj_id, $item[0]);
109 }
110 }
111 }
112 }
static findCoursesWithNotEnoughMembers()

References ilObjCourse\findCoursesWithNotEnoughMembers().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultScheduleType()

ilMembershipCronMinMembers::getDefaultScheduleType ( )

Reimplemented from ilCronJob.

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

54 : int
55 {
57 }
const SCHEDULE_TYPE_DAILY
@depracated This will be replaced with an ENUM in ILIAS 9

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilMembershipCronMinMembers::getDefaultScheduleValue ( )

Reimplemented from ilCronJob.

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

59 : ?int
60 {
61 return null;
62 }

◆ getDescription()

ilMembershipCronMinMembers::getDescription ( )

Reimplemented from ilCronJob.

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

49 : string
50 {
51 return $this->lng->txt("mem_cron_min_members_info");
52 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getGroups()

ilMembershipCronMinMembers::getGroups ( array &  $a_recipients_map)
protected

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

114 : void
115 {
116 foreach (ilObjGroup::findGroupsWithNotEnoughMembers() as $obj_id => $item) {
117 $too_few = (bool) $item[0];
118
119
120 if ($too_few) {
121 // not enough members: notifiy group admins
122 foreach ($item[1] as $reci_id) {
123 $a_recipients_map[$reci_id][] = array("grp", $obj_id, $item[0]);
124 }
125 }
126 }
127 }
static findGroupsWithNotEnoughMembers()

References ilObjGroup\findGroupsWithNotEnoughMembers().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilMembershipCronMinMembers::getId ( )

Reimplemented from ilCronJob.

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

39 : string
40 {
41 return "mem_min_members";
42 }

◆ getTitle()

ilMembershipCronMinMembers::getTitle ( )

Reimplemented from ilCronJob.

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

44 : string
45 {
46 return $this->lng->txt("mem_cron_min_members");
47 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilMembershipCronMinMembers::hasAutoActivation ( )

Is to be activated on "installation", does only work for ILIAS core cron jobs.

Reimplemented from ilCronJob.

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

64 : bool
65 {
66 return true;
67 }

◆ hasFlexibleSchedule()

ilMembershipCronMinMembers::hasFlexibleSchedule ( )

Reimplemented from ilCronJob.

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

69 : bool
70 {
71 return false;
72 }

◆ run()

ilMembershipCronMinMembers::run ( )

Reimplemented from ilCronJob.

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

75 {
77 $message = '';
78
79 $recipients_map = array();
80
81 $this->getCourses($recipients_map);
82 $this->getGroups($recipients_map);
83
84 if (count($recipients_map)) {
85 foreach ($recipients_map as $reci_id => $items) {
86 $this->sendMessage($reci_id, $items);
87 }
89 $message = count($recipients_map) . " notifications sent";
90 }
91
92 $result = new ilCronJobResult();
93 $result->setStatus($status);
94 $result->setMessage($message);
95
96 return $result;
97 }
sendMessage(int $a_reci_id, array $a_items)
$message
Definition: xapiexit.php:32

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

+ Here is the call graph for this function:

◆ sendMessage()

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

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

129 : void
130 {
131 $ntf = new ilSystemNotification();
132 $ntf->setLangModules(array("crs"));
133
134 // #17097
135 $ntf->setReasonLangId("mem_cron_min_members_reason");
136
137 // user specific language
138 $lng = $ntf->getUserLanguage($a_reci_id);
139
140 $list = array();
141 foreach ($a_items as $item) {
142 $obj_type = (string) $item[0];
143 $obj_id = (int) $item[1];
144 $ref_ids = ilObject::_getAllReferences($obj_id);
145 $ref_id = array_pop($ref_ids);
146 $title = ilObject::_lookupTitle($obj_id);
147 $url = ilLink::_getLink($ref_id, $obj_type);
148
149 $list[] = $title . "\n" . $url . "\n";
150 }
151 $list = implode($ntf->getBlockBorder(), $list);
152
153 $ntf->addAdditionalInfo("mem_cron_min_members_intro", $list, true);
154 $ntf->addAdditionalInfo("mem_cron_min_members_task", "");
155
156 $mail = new ilMail(ANONYMOUS_USER_ID);
157 $mail->enqueue(
158 ilObjUser::_lookupLogin($a_reci_id),
159 '',
160 '',
161 $lng->txt("mem_cron_min_members_subject"),
162 $ntf->composeAndGetMessage($a_reci_id, null, "read", true),
163 []
164 );
165 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getUserLanguage()
Return language of user.
static _lookupLogin(int $a_user_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
$ref_id
Definition: ltiauth.php:67
$url

References $lng, $ref_id, $url, ilObject\_getAllReferences(), ilLink\_getLink(), ilObjUser\_lookupLogin(), ilObject\_lookupTitle(), ANONYMOUS_USER_ID, ilLanguage\getUserLanguage(), ILIAS\Repository\int(), and ilLanguage\txt().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilLanguage ilMembershipCronMinMembers::$lng
protected

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

Referenced by sendMessage().


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