ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilXapiResultsCronjob Class Reference
+ Inheritance diagram for ilXapiResultsCronjob:
+ Collaboration diagram for ilXapiResultsCronjob:

Public Member Functions

 __construct ()
 
 getThisRunTS ()
 
 getLastRunTS ()
 
 getId ()
 Get id. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. 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...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 run ()
 Run job. More...
 
- 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...
 

Data Fields

const LAST_RUN_TS_SETTING_NAME = 'cron_xapi_res_eval_last_run'
 
- 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
 

Protected Member Functions

 initThisRunTS ()
 
 readLastRunTS ()
 
 writeThisAsLastRunTS ()
 
 getXapiStatementsReport (ilObjCmiXapi $object, ilCmiXapiStatementsReportFilter $filter)
 
 buildReportFilter ()
 
 getObjectsToBeReported ()
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Protected Attributes

 $thisRunTS
 
 $lastRunTS
 
 $log
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilXapiResultsCronjob::__construct ( )

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

35 {
36 global $DIC; /* @var \ILIAS\DI\Container $DIC */
37
38 $DIC->language()->loadLanguageModule('cmix');
39
40 $this->log = ilLoggerFactory::getLogger('cmix');
41
42 $this->initThisRunTS();
43 $this->readLastRunTS();
44 }
static getLogger($a_component_id)
Get component logger.
$DIC
Definition: xapitoken.php:46

References $DIC, ilLoggerFactory\getLogger(), initThisRunTS(), and readLastRunTS().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildReportFilter()

ilXapiResultsCronjob::buildReportFilter ( )
protected

Definition at line 173 of file class.ilXapiResultsCronjob.php.

174 {
175 $filter = new ilCmiXapiStatementsReportFilter();
176
177 $start = $end = null;
178
179 if ($this->getLastRunTS()) {
180 $filter->setStartDate(new ilCmiXapiDateTime($this->getLastRunTS(), IL_CAL_UNIX));
181 $start = $filter->getStartDate()->get(IL_CAL_DATETIME);
182 }
183
184 $filter->setEndDate(new ilCmiXapiDateTime($this->getThisRunTS(), IL_CAL_UNIX));
185 $end = $filter->getEndDate()->get(IL_CAL_DATETIME);
186
187 $this->log->debug("use filter from ($start) until ($end)");
188
189 return $filter;
190 }
const IL_CAL_UNIX
const IL_CAL_DATETIME

References getLastRunTS(), getThisRunTS(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by run().

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

◆ getDefaultScheduleType()

ilXapiResultsCronjob::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 100 of file class.ilXapiResultsCronjob.php.

101 {
103 }
const SCHEDULE_TYPE_DAILY

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilXapiResultsCronjob::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 105 of file class.ilXapiResultsCronjob.php.

106 {
107 return;
108 }

◆ getDescription()

ilXapiResultsCronjob::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 84 of file class.ilXapiResultsCronjob.php.

85 {
86 global $DIC; /* @var \ILIAS\DI\Container $DIC */
87 return $DIC->language()->txt("cron_xapi_results_evaluation_desc");
88 }

References $DIC.

◆ getId()

ilXapiResultsCronjob::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

Definition at line 73 of file class.ilXapiResultsCronjob.php.

74 {
75 return 'xapi_results_evaluation';
76 }

◆ getLastRunTS()

ilXapiResultsCronjob::getLastRunTS ( )

Definition at line 68 of file class.ilXapiResultsCronjob.php.

References $lastRunTS.

Referenced by buildReportFilter().

+ Here is the caller graph for this function:

◆ getObjectsToBeReported()

ilXapiResultsCronjob::getObjectsToBeReported ( )
protected
Returns
array

Definition at line 195 of file class.ilXapiResultsCronjob.php.

195 : array
196 {
197 $objects = array_unique(array_merge(
200 ));
201
202 return $objects;
203 }
static getCmixObjectsHavingUsersMissingProxySuccess()
static getObjectsHavingBypassProxyEnabledAndRegisteredUsers()

References ilCmiXapiUser\getCmixObjectsHavingUsersMissingProxySuccess(), and ilObjCmiXapi\getObjectsHavingBypassProxyEnabledAndRegisteredUsers().

Referenced by run().

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

◆ getThisRunTS()

ilXapiResultsCronjob::getThisRunTS ( )

Definition at line 63 of file class.ilXapiResultsCronjob.php.

References $thisRunTS.

Referenced by buildReportFilter(), and run().

+ Here is the caller graph for this function:

◆ getTitle()

ilXapiResultsCronjob::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 78 of file class.ilXapiResultsCronjob.php.

79 {
80 global $DIC; /* @var \ILIAS\DI\Container $DIC */
81 return $DIC->language()->txt("cron_xapi_results_evaluation");
82 }

References $DIC.

◆ getXapiStatementsReport()

ilXapiResultsCronjob::getXapiStatementsReport ( ilObjCmiXapi  $object,
ilCmiXapiStatementsReportFilter  $filter 
)
protected

Definition at line 155 of file class.ilXapiResultsCronjob.php.

156 {
157 $filter->setActivityId($object->getActivityId());
158
159 $linkBuilder = new ilCmiXapiStatementsReportLinkBuilder(
160 $object,
161 $object->getLrsType()->getLrsEndpointStatementsAggregationLink(),
162 $filter
163 );
164
166 $object->getLrsType()->getBasicAuth(),
167 $linkBuilder
168 );
169
170 return $request->queryReport($object);
171 }

References ilObjCmiXapi\getActivityId(), ilObjCmiXapi\getLrsType(), and ilCmiXapiStatementsReportFilter\setActivityId().

Referenced by run().

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

◆ hasAutoActivation()

ilXapiResultsCronjob::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 90 of file class.ilXapiResultsCronjob.php.

91 {
92 return false;
93 }

◆ hasCustomSettings()

ilXapiResultsCronjob::hasCustomSettings ( )

Has cron job any custom setting which can be edited?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 110 of file class.ilXapiResultsCronjob.php.

111 {
112 return false;
113 }

◆ hasFlexibleSchedule()

ilXapiResultsCronjob::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 95 of file class.ilXapiResultsCronjob.php.

96 {
97 return true;
98 }

◆ initThisRunTS()

ilXapiResultsCronjob::initThisRunTS ( )
protected

Definition at line 46 of file class.ilXapiResultsCronjob.php.

47 {
48 $this->thisRunTS = time();
49 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ readLastRunTS()

ilXapiResultsCronjob::readLastRunTS ( )
protected

Definition at line 51 of file class.ilXapiResultsCronjob.php.

52 {
53 $settings = new ilSetting('cmix');
54 $this->lastRunTS = $settings->get(self::LAST_RUN_TS_SETTING_NAME, 0);
55 }
ILIAS Setting Class.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ run()

ilXapiResultsCronjob::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 115 of file class.ilXapiResultsCronjob.php.

116 {
117 $objects = $this->getObjectsToBeReported();
118
119 foreach ($objects as $objId) {
120 $this->log->debug('handle object (' . $objId . ')');
121
122 $filter = $this->buildReportFilter();
123
125
126 $evaluation = new ilXapiStatementEvaluation($this->log, $object);
127
128 if ($object->getLaunchMode() != ilObjCmiXapi::LAUNCH_MODE_NORMAL) {
129 $this->log->debug('skipped object due to launch mode (' . $objId . ')');
130 continue;
131 }
132
133 $report = $this->getXapiStatementsReport($object, $filter);
134
135 $evaluation->evaluateReport($report);
136
137 //$this->log->debug('update lp for object (' . $objId . ')');
138 //ilLPStatusWrapper::_refreshStatus($objId);
139
140 $objectIds[] = $objId;
141 }
142
145 $objectIds
146 );
147
148 $result = new ilCronJobResult();
150
151 $this->writeThisAsLastRunTS();
152 return $result;
153 }
$result
static updateFetchedUntilForObjects(ilCmiXapiDateTime $fetchedUntil, $objectIds)
Cron job result data container.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getXapiStatementsReport(ilObjCmiXapi $object, ilCmiXapiStatementsReportFilter $filter)
$objId
Definition: xapitoken.php:41

References $objId, $result, buildReportFilter(), ilObjectFactory\getInstanceByObjId(), getObjectsToBeReported(), getThisRunTS(), getXapiStatementsReport(), IL_CAL_UNIX, ilObjCmiXapi\LAUNCH_MODE_NORMAL, ilCronJobResult\STATUS_OK, ilCmiXapiUser\updateFetchedUntilForObjects(), and writeThisAsLastRunTS().

+ Here is the call graph for this function:

◆ writeThisAsLastRunTS()

ilXapiResultsCronjob::writeThisAsLastRunTS ( )
protected

Definition at line 57 of file class.ilXapiResultsCronjob.php.

58 {
59 $settings = new ilSetting('cmix');
60 $settings->set(self::LAST_RUN_TS_SETTING_NAME, $this->thisRunTS);
61 }

Referenced by run().

+ Here is the caller graph for this function:

Field Documentation

◆ $lastRunTS

ilXapiResultsCronjob::$lastRunTS
protected

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

Referenced by getLastRunTS().

◆ $log

ilXapiResultsCronjob::$log
protected

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

◆ $thisRunTS

ilXapiResultsCronjob::$thisRunTS
protected

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

Referenced by getThisRunTS().

◆ LAST_RUN_TS_SETTING_NAME

const ilXapiResultsCronjob::LAST_RUN_TS_SETTING_NAME = 'cron_xapi_res_eval_last_run'

Definition at line 17 of file class.ilXapiResultsCronjob.php.


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