ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilStudyProgrammeSettingsDBRepository Class Reference
+ Inheritance diagram for ilStudyProgrammeSettingsDBRepository:
+ Collaboration diagram for ilStudyProgrammeSettingsDBRepository:

Public Member Functions

 __construct (ilDBInterface $db)
 
 createFor (int $obj_id)
 Create a record corresponding to a SP-Object and return representing settings.Will throw if a record allready exists. More...
 
 get (int $obj_id)
 Load settings belonging to a SP-Object.Will throw if the record does not exist yet. More...
 
 update (ilStudyProgrammeSettings $settings)
 Update settings belonging to a SP-Object.Will throw if the record does not exist yet. More...
 
 delete (ilStudyProgrammeSettings $settings)
 Delete record corresponding to settings.Will throw if the record does not exist yet. More...
 
 loadByType (int $type_id)
 Load SP settings by assigned type.
Returns
ilStudyProgrammeSettings[]
More...
 
 loadIdsByType (int $type_id)
 Load SP setting-ids by assigned type. More...
 
 getProgrammeIdsWithRiskyToFailSettings ()
 Programme must be active and have a setting to send mails if the user is at risk to fail completing the progress due to a deadline. More...
 
 getProgrammeIdsWithMailsForExpiringValidity ()
 Programme must be active and have a setting to send mails for qualifications about to expire. More...
 
 getProgrammeIdsWithReassignmentForExpiringValidity ()
 Programme must be active and have a setting to reassign users when validity expires. More...
 
 createFor (int $obj_id)
 Create a record corresponding to a SP-Object and return representing settings. More...
 
 get (int $obj_id)
 Load settings belonging to a SP-Object. More...
 
 update (ilStudyProgrammeSettings $settings)
 Update settings belonging to a SP-Object. More...
 
 delete (ilStudyProgrammeSettings $settings)
 Delete record corresponding to settings. More...
 
 loadByType (int $type_id)
 Load SP settings by assigned type. More...
 
 loadIdsByType (int $type_id)
 Load SP setting-ids by assigned type. More...
 

Static Public Member Functions

static clearCache ()
 

Protected Member Functions

 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)
 
 loadDB (int $obj_id)
 
 createByRow (array $row)
 
 deleteDB (int $obj_id)
 
 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)
 @pthrows LogicException More...
 
 checkExists (int $obj_id)
 

Protected Attributes

ilDBInterface $db
 

Static Protected Attributes

static array $cache = []
 

Private Attributes

const TABLE = 'prg_settings'
 
const FIELD_OBJ_ID = 'obj_id'
 
const FIELD_SUBTYPE_ID = 'subtype_id'
 
const FIELD_STATUS = 'status'
 
const FIELD_LP_MODE = 'lp_mode'
 
const FIELD_POINTS = 'points'
 
const FIELD_LAST_CHANGED = 'last_change'
 
const FIELD_DEADLINE_PERIOD = 'deadline_period'
 
const FIELD_DEADLINE_DATE = 'deadline_date'
 
const FIELD_VALIDITY_QUALIFICATION_DATE = 'vq_date'
 
const FIELD_VALIDITY_QUALIFICATION_PERIOD = 'vq_period'
 
const FIELD_VQ_RESTART_PERIOD = 'vq_restart_period'
 
const FIELD_VQ_RESTART_RECHECK = 'vq_restart_recheck'
 
const FIELD_RM_NOT_RESTARTED_BY_USER_DAY = 'rm_nr_by_usr_days'
 
const FIELD_PROC_ENDS_NOT_SUCCESSFUL = 'proc_end_no_success'
 
const FIELD_SEND_RE_ASSIGNED_MAIL = "send_re_assigned_mail"
 
const FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL = "send_info_to_re_assign_mail"
 
const FIELD_SEND_RISKY_TO_FAIL_MAIL = "send_risky_to_fail_mail"
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeSettingsDBRepository::__construct ( ilDBInterface  $db)

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

References $db.

Member Function Documentation

◆ checkExists()

ilStudyProgrammeSettingsDBRepository::checkExists ( int  $obj_id)
protected

Definition at line 518 of file class.ilStudyProgrammeSettingsDBRepository.php.

518 : bool
519 {
520 $rec = $this->db->fetchAssoc(
521 $this->db->query(
522 'SELECT ' . self::FIELD_OBJ_ID
523 . ' FROM ' . self::TABLE
524 . ' WHERE ' . self::FIELD_OBJ_ID . ' = ' . $this->db->quote($obj_id, 'integer')
525 )
526 );
527 if ($rec) {
528 return true;
529 }
530 return false;
531 }

Referenced by deleteDB(), and updateDB().

+ Here is the caller graph for this function:

◆ clearCache()

static ilStudyProgrammeSettingsDBRepository::clearCache ( )
static

Definition at line 533 of file class.ilStudyProgrammeSettingsDBRepository.php.

533 : void
534 {
535 self::$cache = [];
536 }

Referenced by ilStudyProgrammeSettingsRepositoryTest\testPRGRepoEditAndUpdate().

+ Here is the caller graph for this function:

◆ createByRow()

ilStudyProgrammeSettingsDBRepository::createByRow ( array  $row)
protected
Exceptions
ilException

Definition at line 298 of file class.ilStudyProgrammeSettingsDBRepository.php.

299 {
300 $type_settings = new ilStudyProgrammeTypeSettings(
302 );
303 $assessment_settings = new ilStudyProgrammeAssessmentSettings(
306 );
307 $deadline_settings = new ilStudyProgrammeDeadlineSettings(null, null);
308 $validity_of_achieved_qualification_settings =
309 new \ilStudyProgrammeValidityOfAchievedQualificationSettings(
310 null,
311 null,
312 null,
313 (bool) $row[self::FIELD_VQ_RESTART_RECHECK]
314 );
315 $automail = new \ilStudyProgrammeAutoMailSettings(false, null, null);
316
317 $prg = new ilStudyProgrammeSettings(
318 (int) $row[self::FIELD_OBJ_ID],
319 $type_settings,
320 $assessment_settings,
321 $deadline_settings,
322 $validity_of_achieved_qualification_settings,
323 $automail
324 );
325
326 $return = $prg
327 ->setLPMode((int) $row[self::FIELD_LP_MODE])
328 ->setLastChange(DateTime::createFromFormat(
330 $row[self::FIELD_LAST_CHANGED]
331 ))
332 ;
333
334 $type = $return->getTypeSettings();
335 $type = $type->withTypeId((int) $row['subtype_id']);
336 $return = $return->withTypeSettings($type);
337
338 $points = $return->getAssessmentSettings();
339 $points = $points->withPoints((int) $row['points'])->withStatus((int) $row['status']);
340 $return = $return->withAssessmentSettings($points);
341
342 $deadline = $return->getDeadlineSettings();
343 if ($row[self::FIELD_DEADLINE_DATE] !== null) {
344 $deadline = $deadline->withDeadlineDate(DateTimeImmutable::createFromFormat(
346 $row[self::FIELD_DEADLINE_DATE]
347 ))
348 ;
349 } else {
350 $deadline_period = (int) $row[self::FIELD_DEADLINE_PERIOD];
351 if ($deadline_period === ilStudyProgrammeSettings::NO_DEADLINE) {
352 $deadline_period = null;
353 }
354 $deadline = $deadline->withDeadlinePeriod($deadline_period);
355 }
356 $return = $return->withDeadlineSettings($deadline);
357
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]
364 )
365 );
366 } else {
367 $qualification_period = (int) $row[self::FIELD_VALIDITY_QUALIFICATION_PERIOD];
369 $qualification_period = null;
370 }
371 $vqs = $vqs->withQualificationPeriod($qualification_period);
372 }
373 $restart_period = (int) $row[self::FIELD_VQ_RESTART_PERIOD];
374 if ($restart_period === ilStudyProgrammeSettings::NO_RESTART) {
375 $restart_period = null;
376 }
377
378 $vqs = $vqs
379 ->withRestartPeriod($restart_period)
380 ->withRestartRecheck((bool) $row[self::FIELD_VQ_RESTART_RECHECK]);
381
382 $return = $return->withValidityOfQualificationSettings($vqs);
383
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;
387 }
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;
391 }
392
393 return $return->withAutoMailSettings(
396 $rm_nr_by_usr_days,
397 $proc_end_no_success
398 )
399 );
400 }

References ilStudyProgrammeSettings\DATE_TIME_FORMAT, ilStudyProgrammeSettings\DEFAULT_POINTS, ilStudyProgrammeSettings\DEFAULT_SUBTYPE, FIELD_PROC_ENDS_NOT_SUCCESSFUL, FIELD_RM_NOT_RESTARTED_BY_USER_DAY, FIELD_SEND_RE_ASSIGNED_MAIL, FIELD_VQ_RESTART_RECHECK, ILIAS\Repository\int(), ilStudyProgrammeSettings\NO_DEADLINE, ilStudyProgrammeSettings\NO_RESTART, ilStudyProgrammeSettings\NO_VALIDITY_OF_QUALIFICATION_PERIOD, and ilStudyProgrammeSettings\STATUS_DRAFT.

Referenced by loadByType(), and loadDB().

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

◆ createFor()

ilStudyProgrammeSettingsDBRepository::createFor ( int  $obj_id)

Create a record corresponding to a SP-Object and return representing settings.Will throw if a record allready exists.

Exceptions
ilException

Implements ilStudyProgrammeSettingsRepository.

Definition at line 55 of file class.ilStudyProgrammeSettingsDBRepository.php.

56 {
57 $type_settings = new ilStudyProgrammeTypeSettings(
59 );
60 $assessment_settings = new ilStudyProgrammeAssessmentSettings(
63 );
64 $deadline_settings = new ilStudyProgrammeDeadlineSettings(null, null);
65 $validity_of_achieved_qualification_settings =
66 new \ilStudyProgrammeValidityOfAchievedQualificationSettings(null, null, null, false)
67 ;
68 $automail = new ilStudyProgrammeAutoMailSettings(false, null, null);
69
70 $prg = new ilStudyProgrammeSettings(
71 $obj_id,
72 $type_settings,
73 $assessment_settings,
74 $deadline_settings,
75 $validity_of_achieved_qualification_settings,
76 $automail
77 );
78
79 $this->insertDB(
80 $obj_id,
85 (new DateTime())->format(ilStudyProgrammeSettings::DATE_TIME_FORMAT),
86 0,
89 null,
90 null,
91 null,
92 null
93 );
94
95 $prg = $prg->setLPMode(ilStudyProgrammeSettings::MODE_UNDEFINED);
96 self::$cache[$obj_id] = $prg;
97 return $prg;
98 }
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)

References ilStudyProgrammeSettings\DATE_TIME_FORMAT, ilStudyProgrammeSettings\DEFAULT_POINTS, ilStudyProgrammeSettings\DEFAULT_SUBTYPE, insertDB(), ilStudyProgrammeSettings\MODE_UNDEFINED, ilStudyProgrammeSettings\NO_RESTART, ilStudyProgrammeSettings\NO_VALIDITY_OF_QUALIFICATION_PERIOD, and ilStudyProgrammeSettings\STATUS_DRAFT.

Referenced by ilStudyProgrammeSettingsRepositoryTest\testPRGRepoEditAndUpdate().

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

◆ delete()

ilStudyProgrammeSettingsDBRepository::delete ( ilStudyProgrammeSettings  $settings)

Delete record corresponding to settings.Will throw if the record does not exist yet.

Implements ilStudyProgrammeSettingsRepository.

Definition at line 172 of file class.ilStudyProgrammeSettingsDBRepository.php.

172 : void
173 {
174 unset(self::$cache[$settings->getObjId()]);
175 $this->deleteDB($settings->getObjId());
176 }
getObjId()
Get the id of the study program.

References deleteDB().

+ Here is the call graph for this function:

◆ deleteDB()

ilStudyProgrammeSettingsDBRepository::deleteDB ( int  $obj_id)
protected
Exceptions
LogicException

Definition at line 405 of file class.ilStudyProgrammeSettingsDBRepository.php.

405 : void
406 {
407 if (!$this->checkExists($obj_id)) {
408 throw new LogicException('invaid obj_id to delete: ' . $obj_id);
409 }
410 $this->db->manipulate(
411 'DELETE FROM ' . self::TABLE
412 . ' WHERE ' . self::FIELD_OBJ_ID . ' = ' . $this->db->quote($obj_id, 'integer')
413 );
414 }

References checkExists().

Referenced by delete().

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

◆ get()

ilStudyProgrammeSettingsDBRepository::get ( int  $obj_id)

Load settings belonging to a SP-Object.Will throw if the record does not exist yet.

Exceptions
ilException

Implements ilStudyProgrammeSettingsRepository.

Definition at line 104 of file class.ilStudyProgrammeSettingsDBRepository.php.

105 {
106 if (!array_key_exists($obj_id, self::$cache)) {
107 $type = ilObject::_lookupType($obj_id);
108 if ($type === 'prgr') {
109 $prg_reference = new ilObjStudyProgrammeReference($obj_id, false);
110 $obj_id = $prg_reference->getReferencedObject()->getId();
111 }
112 self::$cache[$obj_id] = $this->loadDB($obj_id);
113 }
114 return self::$cache[$obj_id];
115 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType(), and loadDB().

Referenced by ilStudyProgrammeSettingsRepositoryTest\testPRGRepoEditAndUpdate().

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

◆ getProgrammeIdsWithMailsForExpiringValidity()

ilStudyProgrammeSettingsDBRepository::getProgrammeIdsWithMailsForExpiringValidity ( )

Programme must be active and have a setting to send mails for qualifications about to expire.

Returns
array <int id, int days_offset>

Definition at line 566 of file class.ilStudyProgrammeSettingsDBRepository.php.

566 : array
567 {
568 $query = 'SELECT '
569 . self::FIELD_OBJ_ID . ', '
570 . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY
571 . ' FROM ' . self::TABLE . PHP_EOL
572 . ' WHERE ' . self::FIELD_STATUS . ' = ' . ilStudyProgrammeSettings::STATUS_ACTIVE
573 . ' AND ' . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY . ' IS NOT NULL';
574
575 $return = [];
576 $res = $this->db->query($query);
577 while ($rec = $this->db->fetchAssoc($res)) {
579 }
580 return $return;
581 }
$res
Definition: ltiservices.php:69

References $res, FIELD_OBJ_ID, FIELD_RM_NOT_RESTARTED_BY_USER_DAY, and ilStudyProgrammeSettings\STATUS_ACTIVE.

◆ getProgrammeIdsWithReassignmentForExpiringValidity()

ilStudyProgrammeSettingsDBRepository::getProgrammeIdsWithReassignmentForExpiringValidity ( )

Programme must be active and have a setting to reassign users when validity expires.

Returns
array <int id, int days_offset>

Definition at line 588 of file class.ilStudyProgrammeSettingsDBRepository.php.

588 : array
589 {
590 $query = 'SELECT '
591 . self::FIELD_OBJ_ID . ', '
592 . self::FIELD_VQ_RESTART_PERIOD
593 . ' FROM ' . self::TABLE . PHP_EOL
594 . ' WHERE ' . self::FIELD_STATUS . ' = ' . ilStudyProgrammeSettings::STATUS_ACTIVE
595 . ' AND ' . self::FIELD_VQ_RESTART_PERIOD . ' >= 0';
596
597 $return = [];
598 $res = $this->db->query($query);
599 while ($rec = $this->db->fetchAssoc($res)) {
601 }
602 return $return;
603 }

References $res, FIELD_OBJ_ID, FIELD_VQ_RESTART_PERIOD, and ilStudyProgrammeSettings\STATUS_ACTIVE.

◆ getProgrammeIdsWithRiskyToFailSettings()

ilStudyProgrammeSettingsDBRepository::getProgrammeIdsWithRiskyToFailSettings ( )

Programme must be active and have a setting to send mails if the user is at risk to fail completing the progress due to a deadline.

Returns
array <int id, int days_offset>

Definition at line 544 of file class.ilStudyProgrammeSettingsDBRepository.php.

544 : array
545 {
546 $query = 'SELECT '
547 . self::FIELD_OBJ_ID . ', '
548 . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL
549 . ' FROM ' . self::TABLE . PHP_EOL
550 . ' WHERE ' . self::FIELD_STATUS . ' = ' . ilStudyProgrammeSettings::STATUS_ACTIVE
551 . ' AND ' . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL . ' IS NOT NULL';
552
553 $return = [];
554 $res = $this->db->query($query);
555 while ($rec = $this->db->fetchAssoc($res)) {
557 }
558 return $return;
559 }

References $res, FIELD_OBJ_ID, FIELD_PROC_ENDS_NOT_SUCCESSFUL, and ilStudyProgrammeSettings\STATUS_ACTIVE.

◆ insertDB()

ilStudyProgrammeSettingsDBRepository::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 
)
protected

Definition at line 217 of file class.ilStudyProgrammeSettingsDBRepository.php.

235 {
236 $this->db->insert(
237 self::TABLE,
238 [
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]
256 ]
257 );
258 }

Referenced by createFor().

+ Here is the caller graph for this function:

◆ loadByType()

ilStudyProgrammeSettingsDBRepository::loadByType ( int  $type_id)

Load SP settings by assigned type.

Returns
ilStudyProgrammeSettings[]

Exceptions
ilException

Implements ilStudyProgrammeSettingsRepository.

Definition at line 182 of file class.ilStudyProgrammeSettingsDBRepository.php.

182 : array
183 {
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);
204 $return = [];
205 while ($rec = $this->db->fetchAssoc($res)) {
206 $return[] = $this->createByRow($rec);
207 }
208 return $return;
209 }
$q
Definition: shib_logout.php:23

References $q, $res, and createByRow().

+ Here is the call graph for this function:

◆ loadDB()

ilStudyProgrammeSettingsDBRepository::loadDB ( int  $obj_id)
protected
Exceptions
ilException@thorws LogicException

Definition at line 264 of file class.ilStudyProgrammeSettingsDBRepository.php.

265 {
266 $rec = $this->db->fetchAssoc(
267 $this->db->query(
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')
287 )
288 );
289 if (!$rec) {
290 throw new LogicException('invalid obj_id to load: ' . $obj_id);
291 }
292 return $this->createByRow($rec);
293 }

References createByRow().

Referenced by get().

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

◆ loadIdsByType()

ilStudyProgrammeSettingsDBRepository::loadIdsByType ( int  $type_id)

Load SP setting-ids by assigned type.

Implements ilStudyProgrammeSettingsRepository.

Definition at line 212 of file class.ilStudyProgrammeSettingsDBRepository.php.

212 : array
213 {
214 return [];
215 }

◆ update()

ilStudyProgrammeSettingsDBRepository::update ( ilStudyProgrammeSettings  $settings)

Update settings belonging to a SP-Object.Will throw if the record does not exist yet.

Implements ilStudyProgrammeSettingsRepository.

Definition at line 120 of file class.ilStudyProgrammeSettingsDBRepository.php.

120 : void
121 {
122 $deadline_period = $settings->getDeadlineSettings()->getDeadlinePeriod();
123 if (is_null($deadline_period)) {
124 $deadline_period = 0;
125 }
126
127 $deadline_date = $settings->getDeadlineSettings()->getDeadlineDate();
128 if (!is_null($deadline_date)) {
129 $deadline_date = $deadline_date->format(ilStudyProgrammeSettings::DATE_TIME_FORMAT);
130 }
131
132 $vq_date = $settings->getValidityOfQualificationSettings()->getQualificationDate();
133 if (!is_null($vq_date)) {
134 $vq_date = $vq_date->format(ilStudyProgrammeSettings::DATE_TIME_FORMAT);
135 }
136
137 $qp = $settings->getValidityOfQualificationSettings()->getQualificationPeriod();
138 if (is_null($qp)) {
139 $qp = 0;
140 }
141
142 $rp = $settings->getValidityOfQualificationSettings()->getRestartPeriod();
143 if (is_null($rp)) {
144 $rp = 0;
145 }
146
147 $this->updateDB(
148 $settings->getObjId(),
149 $settings->getTypeSettings()->getTypeId(),
150 $settings->getAssessmentSettings()->getStatus(),
151 $settings->getLPMode(),
152 $settings->getAssessmentSettings()->getPoints(),
154 $deadline_period,
155 $qp,
156 $rp,
157 $deadline_date,
158 $vq_date,
159 $settings->getAutoMailSettings()->getReminderNotRestartedByUserDays(),
160 $settings->getAutoMailSettings()->getProcessingEndsNotSuccessfulDays(),
161 $settings->getAutoMailSettings()->getSendReAssignedMail(),
162 false,
163 false,
164 $settings->getValidityOfQualificationSettings()->getRestartRecheck()
165 );
166 self::$cache[$settings->getObjId()] = $settings;
167 }
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)
@pthrows LogicException
getLastChange()
Get the timestamp of the last change on this program or a sub program.

References ilStudyProgrammeSettings\DATE_TIME_FORMAT, ilStudyProgrammeSettings\getAssessmentSettings(), ilStudyProgrammeSettings\getAutoMailSettings(), ilStudyProgrammeSettings\getDeadlineSettings(), ilStudyProgrammeSettings\getLastChange(), ilStudyProgrammeSettings\getLPMode(), ilStudyProgrammeSettings\getObjId(), ilStudyProgrammeSettings\getTypeSettings(), ilStudyProgrammeSettings\getValidityOfQualificationSettings(), and updateDB().

Referenced by ilStudyProgrammeSettingsRepositoryTest\testPRGRepoEditAndUpdate().

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

◆ updateDB()

ilStudyProgrammeSettingsDBRepository::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 
)
protected

@pthrows LogicException

Definition at line 419 of file class.ilStudyProgrammeSettingsDBRepository.php.

437 {
438 if (!$this->checkExists($obj_id)) {
439 throw new LogicException('invalid obj_id to update: ' . $obj_id);
440 }
441 $where = [
442 self::FIELD_OBJ_ID => [
443 'integer',
444 $obj_id
445 ]
446 ];
447
448 $values = [
449 self::FIELD_SUBTYPE_ID => [
450 'integer',
451 $subtype_id
452 ],
453 self::FIELD_STATUS => [
454 'integer',
455 $status
456 ],
457 self::FIELD_LP_MODE => [
458 'integer',
459 $lp_mode
460 ],
461 self::FIELD_POINTS => [
462 'integer',
463 $points
464 ],
465 self::FIELD_LAST_CHANGED => [
466 'timestamp',
467 $last_change
468 ],
469 self::FIELD_DEADLINE_PERIOD => [
470 'integer',
471 $deadline_period
472 ],
473 self::FIELD_DEADLINE_DATE => [
474 'timestamp',
475 $deadline_date
476 ],
477 self::FIELD_VALIDITY_QUALIFICATION_PERIOD => [
478 'integer',
479 $vq_period
480 ],
481 self::FIELD_VALIDITY_QUALIFICATION_DATE => [
482 'timestamp',
483 $vq_date
484 ],
485 self::FIELD_VQ_RESTART_PERIOD => [
486 'integer',
487 $vq_restart_period
488 ],
489 self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY => [
490 'integer',
491 $rm_nr_by_usr_days
492 ],
493 self::FIELD_PROC_ENDS_NOT_SUCCESSFUL => [
494 'integer',
495 $proc_end_no_success
496 ],
497 self::FIELD_SEND_RE_ASSIGNED_MAIL => [
498 'integer',
499 $send_re_assigned_mail
500 ],
501 self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL => [
502 'integer',
503 $send_info_to_re_assign_mail
504 ],
505 self::FIELD_SEND_RISKY_TO_FAIL_MAIL => [
506 'integer',
507 $send_risky_to_fail_mail
508 ],
509 self::FIELD_VQ_RESTART_RECHECK => [
510 'integer',
511 $vq_restart_recheck
512 ]
513 ];
514
515 $this->db->update(self::TABLE, $values, $where);
516 }

References checkExists().

Referenced by update().

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

Field Documentation

◆ $cache

array ilStudyProgrammeSettingsDBRepository::$cache = []
staticprotected

◆ $db

ilDBInterface ilStudyProgrammeSettingsDBRepository::$db
protected

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

Referenced by __construct().

◆ FIELD_DEADLINE_DATE

const ilStudyProgrammeSettingsDBRepository::FIELD_DEADLINE_DATE = 'deadline_date'
private

◆ FIELD_DEADLINE_PERIOD

const ilStudyProgrammeSettingsDBRepository::FIELD_DEADLINE_PERIOD = 'deadline_period'
private

◆ FIELD_LAST_CHANGED

const ilStudyProgrammeSettingsDBRepository::FIELD_LAST_CHANGED = 'last_change'
private

◆ FIELD_LP_MODE

const ilStudyProgrammeSettingsDBRepository::FIELD_LP_MODE = 'lp_mode'
private

◆ FIELD_OBJ_ID

const ilStudyProgrammeSettingsDBRepository::FIELD_OBJ_ID = 'obj_id'
private

◆ FIELD_POINTS

const ilStudyProgrammeSettingsDBRepository::FIELD_POINTS = 'points'
private

◆ FIELD_PROC_ENDS_NOT_SUCCESSFUL

const ilStudyProgrammeSettingsDBRepository::FIELD_PROC_ENDS_NOT_SUCCESSFUL = 'proc_end_no_success'
private

◆ FIELD_RM_NOT_RESTARTED_BY_USER_DAY

const ilStudyProgrammeSettingsDBRepository::FIELD_RM_NOT_RESTARTED_BY_USER_DAY = 'rm_nr_by_usr_days'
private

◆ FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL

const ilStudyProgrammeSettingsDBRepository::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL = "send_info_to_re_assign_mail"
private

◆ FIELD_SEND_RE_ASSIGNED_MAIL

const ilStudyProgrammeSettingsDBRepository::FIELD_SEND_RE_ASSIGNED_MAIL = "send_re_assigned_mail"
private

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

Referenced by createByRow().

◆ FIELD_SEND_RISKY_TO_FAIL_MAIL

const ilStudyProgrammeSettingsDBRepository::FIELD_SEND_RISKY_TO_FAIL_MAIL = "send_risky_to_fail_mail"
private

◆ FIELD_STATUS

const ilStudyProgrammeSettingsDBRepository::FIELD_STATUS = 'status'
private

◆ FIELD_SUBTYPE_ID

const ilStudyProgrammeSettingsDBRepository::FIELD_SUBTYPE_ID = 'subtype_id'
private

◆ FIELD_VALIDITY_QUALIFICATION_DATE

const ilStudyProgrammeSettingsDBRepository::FIELD_VALIDITY_QUALIFICATION_DATE = 'vq_date'
private

◆ FIELD_VALIDITY_QUALIFICATION_PERIOD

const ilStudyProgrammeSettingsDBRepository::FIELD_VALIDITY_QUALIFICATION_PERIOD = 'vq_period'
private

◆ FIELD_VQ_RESTART_PERIOD

const ilStudyProgrammeSettingsDBRepository::FIELD_VQ_RESTART_PERIOD = 'vq_restart_period'
private

◆ FIELD_VQ_RESTART_RECHECK

const ilStudyProgrammeSettingsDBRepository::FIELD_VQ_RESTART_RECHECK = 'vq_restart_recheck'
private

Definition at line 36 of file class.ilStudyProgrammeSettingsDBRepository.php.

Referenced by createByRow().

◆ TABLE

const ilStudyProgrammeSettingsDBRepository::TABLE = 'prg_settings'
private

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