3 declare(strict_types=1);
23 private const TABLE =
'prg_settings';
65 $validity_of_achieved_qualification_settings =
66 new \ilStudyProgrammeValidityOfAchievedQualificationSettings(null, null, null,
false)
75 $validity_of_achieved_qualification_settings,
96 self::$cache[$obj_id] = $prg;
106 if (!array_key_exists($obj_id, self::$cache)) {
108 if (
$type ===
'prgr') {
110 $obj_id = $prg_reference->getReferencedObject()->getId();
112 self::$cache[$obj_id] = $this->
loadDB($obj_id);
114 return self::$cache[$obj_id];
123 if (is_null($deadline_period)) {
124 $deadline_period = 0;
128 if (!is_null($deadline_date)) {
133 if (!is_null($vq_date)) {
174 unset(self::$cache[
$settings->getObjId()]);
184 $q =
'SELECT ' . self::FIELD_SUBTYPE_ID
185 .
' ,' . self::FIELD_STATUS
186 .
' ,' . self::FIELD_POINTS
187 .
' ,' . self::FIELD_LP_MODE
188 .
' ,' . self::FIELD_LAST_CHANGED
189 .
' ,' . self::FIELD_OBJ_ID
190 .
' ,' . self::FIELD_DEADLINE_PERIOD
191 .
' ,' . self::FIELD_DEADLINE_DATE
192 .
' ,' . self::FIELD_VALIDITY_QUALIFICATION_PERIOD
193 .
' ,' . self::FIELD_VALIDITY_QUALIFICATION_DATE
194 .
' ,' . self::FIELD_VQ_RESTART_PERIOD
195 .
', ' . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY
196 .
', ' . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL
197 .
', ' . self::FIELD_SEND_RE_ASSIGNED_MAIL
198 .
', ' . self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL
199 .
', ' . self::FIELD_SEND_RISKY_TO_FAIL_MAIL
200 .
', ' . self::FIELD_VQ_RESTART_RECHECK
201 .
' FROM ' . self::TABLE
202 .
' WHERE ' . self::FIELD_SUBTYPE_ID .
' = ' . $this->db->quote($type_id,
'integer');
203 $res = $this->db->query($q);
205 while ($rec = $this->db->fetchAssoc(
$res)) {
224 int $deadline_period,
226 int $vq_restart_period,
227 string $deadline_date = null,
228 string $vq_date = null,
229 int $rm_nr_by_usr_days = null,
230 int $proc_end_no_success = null,
231 bool $send_re_assigned_mail =
false,
232 bool $send_info_to_re_assign_mail =
false,
233 bool $send_risky_to_fail_mail =
false,
234 bool $vq_restart_recheck =
false 239 self::FIELD_OBJ_ID => [
'integer', $obj_id],
240 self::FIELD_SUBTYPE_ID => [
'integer', $subtype_id],
241 self::FIELD_STATUS => [
'integer', $status],
242 self::FIELD_POINTS => [
'integer', $points],
243 self::FIELD_LP_MODE => [
'integer', $lp_mode],
244 self::FIELD_LAST_CHANGED => [
'timestamp', $last_change],
245 self::FIELD_DEADLINE_PERIOD => [
'integer', $deadline_period],
246 self::FIELD_DEADLINE_DATE => [
'timestamp', $deadline_date],
247 self::FIELD_VALIDITY_QUALIFICATION_DATE => [
'timestamp', $vq_date],
248 self::FIELD_VALIDITY_QUALIFICATION_PERIOD => [
'integer', $vq_period],
249 self::FIELD_VQ_RESTART_PERIOD => [
'integer', $vq_restart_period],
250 self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY => [
'integer', $rm_nr_by_usr_days],
251 self::FIELD_PROC_ENDS_NOT_SUCCESSFUL => [
'integer', $proc_end_no_success],
252 self::FIELD_SEND_RE_ASSIGNED_MAIL => [
'integer', $send_re_assigned_mail],
253 self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL => [
'integer', $send_info_to_re_assign_mail],
254 self::FIELD_SEND_RISKY_TO_FAIL_MAIL => [
'integer', $send_risky_to_fail_mail],
255 self::FIELD_VQ_RESTART_RECHECK => [
'integer', $vq_restart_recheck]
266 $rec = $this->db->fetchAssoc(
268 'SELECT ' . self::FIELD_SUBTYPE_ID
269 .
', ' . self::FIELD_STATUS
270 .
', ' . self::FIELD_POINTS
271 .
', ' . self::FIELD_LP_MODE
272 .
', ' . self::FIELD_LAST_CHANGED
273 .
', ' . self::FIELD_OBJ_ID
274 .
', ' . self::FIELD_DEADLINE_PERIOD
275 .
', ' . self::FIELD_DEADLINE_DATE
276 .
', ' . self::FIELD_VALIDITY_QUALIFICATION_PERIOD
277 .
', ' . self::FIELD_VALIDITY_QUALIFICATION_DATE
278 .
', ' . self::FIELD_VQ_RESTART_PERIOD
279 .
', ' . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY
280 .
', ' . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL
281 .
', ' . self::FIELD_SEND_RE_ASSIGNED_MAIL
282 .
', ' . self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL
283 .
', ' . self::FIELD_SEND_RISKY_TO_FAIL_MAIL
284 .
', ' . self::FIELD_VQ_RESTART_RECHECK
285 .
' FROM ' . self::TABLE
286 .
' WHERE ' . self::FIELD_OBJ_ID .
' = ' . $this->db->quote($obj_id,
'integer')
308 $validity_of_achieved_qualification_settings =
309 new \ilStudyProgrammeValidityOfAchievedQualificationSettings(
313 (
bool) $row[self::FIELD_VQ_RESTART_RECHECK]
315 $automail = new \ilStudyProgrammeAutoMailSettings(
false, null, null);
318 (
int) $row[self::FIELD_OBJ_ID],
320 $assessment_settings,
322 $validity_of_achieved_qualification_settings,
327 ->setLPMode((
int) $row[self::FIELD_LP_MODE])
328 ->setLastChange(DateTime::createFromFormat(
330 $row[self::FIELD_LAST_CHANGED]
334 $type = $return->getTypeSettings();
335 $type =
$type->withTypeId((
int) $row[
'subtype_id']);
336 $return = $return->withTypeSettings(
$type);
338 $points = $return->getAssessmentSettings();
339 $points = $points->withPoints((
int) $row[
'points'])->withStatus((
int) $row[
'status']);
340 $return = $return->withAssessmentSettings($points);
342 $deadline = $return->getDeadlineSettings();
343 if ($row[self::FIELD_DEADLINE_DATE] !== null) {
344 $deadline = $deadline->withDeadlineDate(DateTimeImmutable::createFromFormat(
346 $row[self::FIELD_DEADLINE_DATE]
350 $deadline_period = (
int) $row[self::FIELD_DEADLINE_PERIOD];
352 $deadline_period = null;
354 $deadline = $deadline->withDeadlinePeriod($deadline_period);
356 $return = $return->withDeadlineSettings($deadline);
358 $vqs = $return->getValidityOfQualificationSettings();
359 if ($row[self::FIELD_VALIDITY_QUALIFICATION_DATE] !== null) {
360 $vqs = $vqs->withQualificationDate(
361 DateTimeImmutable::createFromFormat(
363 $row[self::FIELD_VALIDITY_QUALIFICATION_DATE]
367 $qualification_period = (
int) $row[self::FIELD_VALIDITY_QUALIFICATION_PERIOD];
369 $qualification_period = null;
371 $vqs = $vqs->withQualificationPeriod($qualification_period);
373 $restart_period = (
int) $row[self::FIELD_VQ_RESTART_PERIOD];
375 $restart_period = null;
379 ->withRestartPeriod($restart_period)
380 ->withRestartRecheck((
bool) $row[self::FIELD_VQ_RESTART_RECHECK]);
382 $return = $return->withValidityOfQualificationSettings($vqs);
384 $rm_nr_by_usr_days = $row[self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY];
385 if (!is_null($rm_nr_by_usr_days)) {
386 $rm_nr_by_usr_days = (
int) $rm_nr_by_usr_days;
388 $proc_end_no_success = $row[self::FIELD_PROC_ENDS_NOT_SUCCESSFUL];
389 if (!is_null($proc_end_no_success)) {
390 $proc_end_no_success = (
int) $proc_end_no_success;
393 return $return->withAutoMailSettings(
395 (
bool) $row[self::FIELD_SEND_RE_ASSIGNED_MAIL],
410 $this->db->manipulate(
411 'DELETE FROM ' . self::TABLE
412 .
' WHERE ' . self::FIELD_OBJ_ID .
' = ' . $this->db->quote($obj_id,
'integer')
426 int $deadline_period,
428 int $vq_restart_period,
429 string $deadline_date = null,
430 string $vq_date = null,
431 int $rm_nr_by_usr_days = null,
432 int $proc_end_no_success = null,
433 bool $send_re_assigned_mail =
false,
434 bool $send_info_to_re_assign_mail =
false,
435 bool $send_risky_to_fail_mail =
false,
436 bool $vq_restart_recheck =
false 442 self::FIELD_OBJ_ID => [
449 self::FIELD_SUBTYPE_ID => [
453 self::FIELD_STATUS => [
457 self::FIELD_LP_MODE => [
461 self::FIELD_POINTS => [
465 self::FIELD_LAST_CHANGED => [
469 self::FIELD_DEADLINE_PERIOD => [
473 self::FIELD_DEADLINE_DATE => [
477 self::FIELD_VALIDITY_QUALIFICATION_PERIOD => [
481 self::FIELD_VALIDITY_QUALIFICATION_DATE => [
485 self::FIELD_VQ_RESTART_PERIOD => [
489 self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY => [
493 self::FIELD_PROC_ENDS_NOT_SUCCESSFUL => [
497 self::FIELD_SEND_RE_ASSIGNED_MAIL => [
499 $send_re_assigned_mail
501 self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL => [
503 $send_info_to_re_assign_mail
505 self::FIELD_SEND_RISKY_TO_FAIL_MAIL => [
507 $send_risky_to_fail_mail
509 self::FIELD_VQ_RESTART_RECHECK => [
515 $this->db->update(self::TABLE, $values, $where);
520 $rec = $this->db->fetchAssoc(
522 'SELECT ' . self::FIELD_OBJ_ID
523 .
' FROM ' . self::TABLE
524 .
' WHERE ' . self::FIELD_OBJ_ID .
' = ' . $this->db->quote($obj_id,
'integer')
547 . self::FIELD_OBJ_ID .
', ' 548 . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL
549 .
' FROM ' . self::TABLE . PHP_EOL
551 .
' AND ' . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL .
' IS NOT NULL';
555 while ($rec = $this->db->fetchAssoc(
$res)) {
556 $return[$rec[self::FIELD_OBJ_ID]] = $rec[self::FIELD_PROC_ENDS_NOT_SUCCESSFUL];
569 . self::FIELD_OBJ_ID .
', ' 570 . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY
571 .
' FROM ' . self::TABLE . PHP_EOL
573 .
' AND ' . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY .
' IS NOT NULL';
577 while ($rec = $this->db->fetchAssoc(
$res)) {
578 $return[$rec[self::FIELD_OBJ_ID]] = $rec[self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY];
591 . self::FIELD_OBJ_ID .
', ' 592 . self::FIELD_VQ_RESTART_PERIOD
593 .
' FROM ' . self::TABLE . PHP_EOL
595 .
' AND ' . self::FIELD_VQ_RESTART_PERIOD .
' >= 0';
599 while ($rec = $this->db->fetchAssoc(
$res)) {
600 $return[$rec[self::FIELD_OBJ_ID]] = $rec[self::FIELD_VQ_RESTART_PERIOD];
const FIELD_DEADLINE_DATE
createFor(int $obj_id)
Create a record corresponding to a SP-Object and return representing settings.Will throw if a record ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const FIELD_VALIDITY_QUALIFICATION_DATE
getLastChange()
Get the timestamp of the last change on this program or a sub program.
__construct(ilDBInterface $db)
const NO_VALIDITY_OF_QUALIFICATION_PERIOD
const FIELD_RM_NOT_RESTARTED_BY_USER_DAY
loadByType(int $type_id)
Load SP settings by assigned type.ilStudyProgrammeSettings[]
loadIdsByType(int $type_id)
Load SP setting-ids by assigned type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL
const FIELD_VALIDITY_QUALIFICATION_PERIOD
getValidityOfQualificationSettings()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const FIELD_SEND_RE_ASSIGNED_MAIL
getObjId()
Get the id of the study program.
updateDB(int $obj_id, int $subtype_id, int $status, int $lp_mode, int $points, string $last_change, int $deadline_period, int $vq_period, int $vq_restart_period, string $deadline_date=null, string $vq_date=null, int $rm_nr_by_usr_days=null, int $proc_end_no_success=null, bool $send_re_assigned_mail=false, bool $send_info_to_re_assign_mail=false, bool $send_risky_to_fail_mail=false, bool $vq_restart_recheck=false)
LogicException
update(ilStudyProgrammeSettings $settings)
Update settings belonging to a SP-Object.Will throw if the record does not exist yet.
getProgrammeIdsWithRiskyToFailSettings()
Programme must be active and have a setting to send mails if the user is at risk to fail completing t...
const FIELD_SEND_RISKY_TO_FAIL_MAIL
getLPMode()
Get the lp mode.
getProgrammeIdsWithReassignmentForExpiringValidity()
Programme must be active and have a setting to reassign users when validity expires.
insertDB(int $obj_id, int $subtype_id, int $status, int $lp_mode, int $points, string $last_change, int $deadline_period, int $vq_period, int $vq_restart_period, string $deadline_date=null, string $vq_date=null, int $rm_nr_by_usr_days=null, int $proc_end_no_success=null, bool $send_re_assigned_mail=false, bool $send_info_to_re_assign_mail=false, bool $send_risky_to_fail_mail=false, bool $vq_restart_recheck=false)
static _lookupType(int $id, bool $reference=false)
getProgrammeIdsWithMailsForExpiringValidity()
Programme must be active and have a setting to send mails for qualifications about to expire...
const FIELD_PROC_ENDS_NOT_SUCCESSFUL
const FIELD_VQ_RESTART_RECHECK
const FIELD_VQ_RESTART_PERIOD
const FIELD_DEADLINE_PERIOD