ILIAS  release_7 Revision v7.30-3-g800a261c036
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. 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 ()
 

Data Fields

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_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"
 

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)
 
 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)
 @pthrows LogicException More...
 
 checkExists (int $obj_id)
 

Protected Attributes

 $db
 

Static Protected Attributes

static $cache = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeSettingsDBRepository::__construct ( ilDBInterface  $db)

Member Function Documentation

◆ checkExists()

ilStudyProgrammeSettingsDBRepository::checkExists ( int  $obj_id)
protected

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

487 {
488 $rec = $this->db->fetchAssoc(
489 $this->db->query(
490 'SELECT ' . self::FIELD_OBJ_ID
491 . ' FROM ' . self::TABLE
492 . ' WHERE ' . self::FIELD_OBJ_ID . ' = ' . $this->db->quote($obj_id, 'integer')
493 )
494 );
495 if ($rec) {
496 return true;
497 }
498 return false;
499 }

Referenced by deleteDB(), and updateDB().

+ Here is the caller graph for this function:

◆ clearCache()

static ilStudyProgrammeSettingsDBRepository::clearCache ( )
static

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

502 {
503 self::$cache = [];
504 }

Referenced by ilStudyProgrammeSettingsRepositoryTest\test_edit_and_update().

+ Here is the caller graph for this function:

◆ createByRow()

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

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

280 {
281 $type_settings = new \ilStudyProgrammeTypeSettings(
283 );
284 $assessment_settings = new \ilStudyProgrammeAssessmentSettings(
287 );
288 $deadline_settings = new \ilStudyProgrammeDeadlineSettings(null, null);
289 $validity_of_achieved_qualification_settings =
290 new \ilStudyProgrammeValidityOfAchievedQualificationSettings(null, null, null)
291 ;
292 $automail = new \ilStudyProgrammeAutoMailSettings(false, null, null);
293
294 $prg = new ilStudyProgrammeSettings(
295 (int) $row[self::FIELD_OBJ_ID],
296 $type_settings,
297 $assessment_settings,
298 $deadline_settings,
299 $validity_of_achieved_qualification_settings,
300 $automail
301 );
302
303 $return = $prg
304 ->setLPMode((int) $row[self::FIELD_LP_MODE])
305 ->setLastChange(DateTime::createFromFormat(
307 $row[self::FIELD_LAST_CHANGED]
308 ))
309 ;
310
311 $type = $return->getTypeSettings();
312 $type = $type->withTypeId((int) $row['subtype_id']);
313 $return = $return->withTypeSettings($type);
314
315 $points = $return->getAssessmentSettings();
316 $points = $points->withPoints((int) $row['points'])->withStatus((int) $row['status']);
317 $return = $return->withAssessmentSettings($points);
318
319 $deadline = $return->getDeadlineSettings();
320 if ($row[self::FIELD_DEADLINE_DATE] !== null) {
321 $deadline = $deadline->withDeadlineDate(DateTime::createFromFormat(
323 $row[self::FIELD_DEADLINE_DATE]
324 ))
325 ;
326 } else {
327 $deadline_period = (int) $row[self::FIELD_DEADLINE_PERIOD];
328 if ($deadline_period == -1) {
329 $deadline_period = null;
330 }
331 $deadline = $deadline->withDeadlinePeriod($deadline_period);
332 }
333 $return = $return->withDeadlineSettings($deadline);
334
335 $vqs = $return->getValidityOfQualificationSettings();
336 if ($row[self::FIELD_VALIDITY_QUALIFICATION_DATE] !== null) {
337 $vqs = $vqs->withQualificationDate(
338 DateTime::createFromFormat(
340 $row[self::FIELD_VALIDITY_QUALIFICATION_DATE]
341 )
342 );
343 } else {
344 $qualification_period = (int) $row[self::FIELD_VALIDITY_QUALIFICATION_PERIOD];
345 if ($qualification_period == -1) {
346 $qualification_period = null;
347 }
348 $vqs = $vqs->withQualificationPeriod($qualification_period);
349 }
350 $restart_period = (int) $row[self::FIELD_VQ_RESTART_PERIOD];
351 if ($restart_period == -1) {
352 $restart_period = null;
353 }
354 $vqs = $vqs->withRestartPeriod($restart_period);
355 $return = $return->withValidityOfQualificationSettings($vqs);
356
357 $rm_nr_by_usr_days = $row[self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY];
358 if (!is_null($rm_nr_by_usr_days)) {
359 $rm_nr_by_usr_days = (int) $rm_nr_by_usr_days;
360 }
361 $proc_end_no_success = $row[self::FIELD_PROC_ENDS_NOT_SUCCESSFUL];
362 if (!is_null($proc_end_no_success)) {
363 $proc_end_no_success = (int) $proc_end_no_success;
364 }
365
366 return $return->withAutoMailSettings(
369 $rm_nr_by_usr_days,
370 $proc_end_no_success
371 )
372 );
373 }
$type

References $type, 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, and ilStudyProgrammeSettings\STATUS_DRAFT.

Referenced by loadByType(), and loadDB().

+ 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 48 of file class.ilStudyProgrammeSettingsDBRepository.php.

49 {
50 $type_settings = new \ilStudyProgrammeTypeSettings(
52 );
53 $assessment_settings = new \ilStudyProgrammeAssessmentSettings(
56 );
57 $deadline_settings = new \ilStudyProgrammeDeadlineSettings(null, null);
58 $validity_of_achieved_qualification_settings =
59 new \ilStudyProgrammeValidityOfAchievedQualificationSettings(null, null, null)
60 ;
61 $automail = new \ilStudyProgrammeAutoMailSettings(false, null, null);
62
63 $prg = new ilStudyProgrammeSettings(
64 $obj_id,
65 $type_settings,
66 $assessment_settings,
67 $deadline_settings,
68 $validity_of_achieved_qualification_settings,
69 $automail
70 );
71
72 $this->insertDB(
73 $obj_id,
78 (new DateTime())->format(ilStudyProgrammeSettings::DATE_TIME_FORMAT),
79 0,
82 null,
83 null,
84 null,
85 null
86 );
87
88 $prg = $prg->setLPMode(ilStudyProgrammeSettings::MODE_UNDEFINED);
89 self::$cache[$obj_id] = $prg;
90 return $prg;
91 }
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)

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.

+ Here is the call 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 159 of file class.ilStudyProgrammeSettingsDBRepository.php.

159 : void
160 {
161 unset(self::$cache[$settings->getObjId()]);
162 $this->deleteDB($settings->getObjId());
163 }
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 378 of file class.ilStudyProgrammeSettingsDBRepository.php.

379 {
380 if (!$this->checkExists($obj_id)) {
381 throw new LogicException('invaid obj_id to delete: ' . $obj_id);
382 }
383 $this->db->manipulate(
384 'DELETE FROM ' . self::TABLE
385 . ' WHERE ' . self::FIELD_OBJ_ID . ' = ' . $this->db->quote($obj_id, 'integer')
386 );
387 }

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 97 of file class.ilStudyProgrammeSettingsDBRepository.php.

98 {
99 if (!array_key_exists($obj_id, self::$cache)) {
100 self::$cache[$obj_id] = $this->loadDB($obj_id);
101 }
102 return self::$cache[$obj_id];
103 }

References loadDB().

+ Here is the call 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 534 of file class.ilStudyProgrammeSettingsDBRepository.php.

534 : array
535 {
536 $query = 'SELECT '
537 . self::FIELD_OBJ_ID . ', '
538 . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY
539 . ' FROM ' . self::TABLE . PHP_EOL
540 . ' WHERE ' . self::FIELD_STATUS . ' = ' . ilStudyProgrammeSettings::STATUS_ACTIVE
541 . ' AND ' . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY . ' IS NOT NULL';
542
543 $return = [];
544 $res = $this->db->query($query);
545 while ($rec = $this->db->fetchAssoc($res)) {
547 }
548 return $return;
549 }
$query
foreach($_POST as $key=> $value) $res

References $query, $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 556 of file class.ilStudyProgrammeSettingsDBRepository.php.

556 : array
557 {
558 $query = 'SELECT '
559 . self::FIELD_OBJ_ID . ', '
560 . self::FIELD_VQ_RESTART_PERIOD
561 . ' FROM ' . self::TABLE . PHP_EOL
562 . ' WHERE ' . self::FIELD_STATUS . ' = ' . ilStudyProgrammeSettings::STATUS_ACTIVE
563 . ' AND ' . self::FIELD_VQ_RESTART_PERIOD . ' > 0';
564
565 $return = [];
566 $res = $this->db->query($query);
567 while ($rec = $this->db->fetchAssoc($res)) {
569 }
570 return $return;
571 }

References $query, $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 512 of file class.ilStudyProgrammeSettingsDBRepository.php.

512 : array
513 {
514 $query = 'SELECT '
515 . self::FIELD_OBJ_ID . ', '
516 . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL
517 . ' FROM ' . self::TABLE . PHP_EOL
518 . ' WHERE ' . self::FIELD_STATUS . ' = ' . ilStudyProgrammeSettings::STATUS_ACTIVE
519 . ' AND ' . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL . ' IS NOT NULL';
520
521 $return = [];
522 $res = $this->db->query($query);
523 while ($rec = $this->db->fetchAssoc($res)) {
525 }
526 return $return;
527 }

References $query, $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 
)
protected

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

218 {
219 $this->db->insert(
220 self::TABLE,
221 [
222 self::FIELD_OBJ_ID => ['integer', $obj_id],
223 self::FIELD_SUBTYPE_ID => ['integer', $subtype_id],
224 self::FIELD_STATUS => ['integer', $status],
225 self::FIELD_POINTS => ['integer', $points],
226 self::FIELD_LP_MODE => ['integer', $lp_mode],
227 self::FIELD_LAST_CHANGED => ['timestamp', $last_change],
228 self::FIELD_DEADLINE_PERIOD => ['integer', $deadline_period],
229 self::FIELD_DEADLINE_DATE => ['timestamp', $deadline_date],
230 self::FIELD_VALIDITY_QUALIFICATION_DATE => ['timestamp', $vq_date],
231 self::FIELD_VALIDITY_QUALIFICATION_PERIOD => ['integer', $vq_period],
232 self::FIELD_VQ_RESTART_PERIOD => ['integer', $vq_restart_period],
233 self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY => ['integer', $rm_nr_by_usr_days],
234 self::FIELD_PROC_ENDS_NOT_SUCCESSFUL => ['integer', $proc_end_no_success],
235 self::FIELD_SEND_RE_ASSIGNED_MAIL => ['integer', $send_re_assigned_mail],
236 self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL => ['integer', $send_info_to_re_assign_mail],
237 self::FIELD_SEND_RISKY_TO_FAIL_MAIL => ['integer', $send_risky_to_fail_mail]
238 ]
239 );
240 }

Referenced by createFor().

+ Here is the caller graph for this function:

◆ loadByType()

ilStudyProgrammeSettingsDBRepository::loadByType ( int  $type_id)

Load SP settings by assigned type.

Exceptions
ilException

Implements ilStudyProgrammeSettingsRepository.

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

169 : array
170 {
171 $q = 'SELECT ' . self::FIELD_SUBTYPE_ID
172 . ' ,' . self::FIELD_STATUS
173 . ' ,' . self::FIELD_POINTS
174 . ' ,' . self::FIELD_LP_MODE
175 . ' ,' . self::FIELD_LAST_CHANGED
176 . ' ,' . self::FIELD_OBJ_ID
177 . ' ,' . self::FIELD_DEADLINE_PERIOD
178 . ' ,' . self::FIELD_DEADLINE_DATE
179 . ' ,' . self::FIELD_VALIDITY_QUALIFICATION_PERIOD
180 . ' ,' . self::FIELD_VALIDITY_QUALIFICATION_DATE
181 . ' ,' . self::FIELD_VQ_RESTART_PERIOD
182 . ', ' . self::FIELD_SEND_RE_ASSIGNED_MAIL
183 . ', ' . self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL
184 . ', ' . self::FIELD_SEND_RISKY_TO_FAIL_MAIL
185 . ' FROM ' . self::TABLE
186 . ' WHERE ' . self::FIELD_SUBTYPE_ID . ' = ' . $this->db->quote($type_id, 'integer');
187 $res = $this->db->query($q);
188 $return = [];
189 while ($rec = $this->db->fetchAssoc($res)) {
190 $return[] = $this->createByRow($rec);
191 }
192 return $return;
193 }

References $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 246 of file class.ilStudyProgrammeSettingsDBRepository.php.

247 {
248 $rec = $this->db->fetchAssoc(
249 $this->db->query(
250 'SELECT ' . self::FIELD_SUBTYPE_ID
251 . ', ' . self::FIELD_STATUS
252 . ', ' . self::FIELD_POINTS
253 . ', ' . self::FIELD_LP_MODE
254 . ', ' . self::FIELD_LAST_CHANGED
255 . ', ' . self::FIELD_OBJ_ID
256 . ', ' . self::FIELD_DEADLINE_PERIOD
257 . ', ' . self::FIELD_DEADLINE_DATE
258 . ', ' . self::FIELD_VALIDITY_QUALIFICATION_PERIOD
259 . ', ' . self::FIELD_VALIDITY_QUALIFICATION_DATE
260 . ', ' . self::FIELD_VQ_RESTART_PERIOD
261 . ', ' . self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY
262 . ', ' . self::FIELD_PROC_ENDS_NOT_SUCCESSFUL
263 . ', ' . self::FIELD_SEND_RE_ASSIGNED_MAIL
264 . ', ' . self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL
265 . ', ' . self::FIELD_SEND_RISKY_TO_FAIL_MAIL
266 . ' FROM ' . self::TABLE
267 . ' WHERE ' . self::FIELD_OBJ_ID . ' = ' . $this->db->quote($obj_id, 'integer')
268 )
269 );
270 if (!$rec) {
271 throw new LogicException('invaid obj_id to load: ' . $obj_id);
272 }
273 return $this->createByRow($rec);
274 }

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 196 of file class.ilStudyProgrammeSettingsDBRepository.php.

196 : array
197 {
198 return [];
199 }

◆ 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 108 of file class.ilStudyProgrammeSettingsDBRepository.php.

108 : void
109 {
110 $deadline_period = $settings->getDeadlineSettings()->getDeadlinePeriod();
111 if (is_null($deadline_period)) {
112 $deadline_period = 0;
113 }
114
115 $deadline_date = $settings->getDeadlineSettings()->getDeadlineDate();
116 if (!is_null($deadline_date)) {
117 $deadline_date = $deadline_date->format(ilStudyProgrammeSettings::DATE_TIME_FORMAT);
118 }
119
120 $vq_date = $settings->getValidityOfQualificationSettings()->getQualificationDate();
121 if (!is_null($vq_date)) {
122 $vq_date = $vq_date->format(ilStudyProgrammeSettings::DATE_TIME_FORMAT);
123 }
124
125 $qp = $settings->getValidityOfQualificationSettings()->getQualificationPeriod();
126 if (is_null($qp)) {
127 $qp = 0;
128 }
129
130 $rp = $settings->getValidityOfQualificationSettings()->getRestartPeriod();
131 if (is_null($rp)) {
132 $rp = 0;
133 }
134
135 $this->updateDB(
136 $settings->getObjId(),
137 $settings->getTypeSettings()->getTypeId(),
138 $settings->getAssessmentSettings()->getStatus(),
139 $settings->getLPMode(),
140 $settings->getAssessmentSettings()->getPoints(),
142 $deadline_period,
143 $qp,
144 $rp,
145 $deadline_date,
146 $vq_date,
147 $settings->getAutoMailSettings()->getReminderNotRestartedByUserDays(),
148 $settings->getAutoMailSettings()->getProcessingEndsNotSuccessfulDays(),
149 $settings->getAutoMailSettings()->getSendReAssignedMail(),
150 false,
151 false
152 );
153 self::$cache[$settings->getObjId()] = $settings;
154 }
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)
@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().

+ Here is the call 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 
)
protected

@pthrows LogicException

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

409 {
410 if (!$this->checkExists($obj_id)) {
411 throw new LogicException('invalid obj_id to update: ' . $obj_id);
412 }
413 $where = [
414 self::FIELD_OBJ_ID => [
415 'integer',
416 $obj_id
417 ]
418 ];
419
420 $values = [
421 self::FIELD_SUBTYPE_ID => [
422 'integer',
423 $subtype_id
424 ],
425 self::FIELD_STATUS => [
426 'integer',
427 $status
428 ],
429 self::FIELD_LP_MODE => [
430 'integer',
431 $lp_mode
432 ],
433 self::FIELD_POINTS => [
434 'integer',
435 $points
436 ],
437 self::FIELD_LAST_CHANGED => [
438 'timestamp',
439 $last_change
440 ],
441 self::FIELD_DEADLINE_PERIOD => [
442 'integer',
443 $deadline_period
444 ],
445 self::FIELD_DEADLINE_DATE => [
446 'timestamp',
447 $deadline_date
448 ],
449 self::FIELD_VALIDITY_QUALIFICATION_PERIOD => [
450 'integer',
451 $vq_period
452 ],
453 self::FIELD_VALIDITY_QUALIFICATION_DATE => [
454 'timestamp',
455 $vq_date
456 ],
457 self::FIELD_VQ_RESTART_PERIOD => [
458 'integer',
459 $vq_restart_period
460 ],
461 self::FIELD_RM_NOT_RESTARTED_BY_USER_DAY => [
462 'integer',
463 $rm_nr_by_usr_days
464 ],
465 self::FIELD_PROC_ENDS_NOT_SUCCESSFUL => [
466 'integer',
467 $proc_end_no_success
468 ],
469 self::FIELD_SEND_RE_ASSIGNED_MAIL => [
470 'integer',
471 $send_re_assigned_mail
472 ],
473 self::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL => [
474 'integer',
475 $send_info_to_re_assign_mail
476 ],
477 self::FIELD_SEND_RISKY_TO_FAIL_MAIL => [
478 'integer',
479 $send_risky_to_fail_mail
480 ]
481 ];
482
483 $this->db->update(self::TABLE, $values, $where);
484 }

References checkExists().

Referenced by update().

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

Field Documentation

◆ $cache

ilStudyProgrammeSettingsDBRepository::$cache = []
staticprotected

◆ $db

ilStudyProgrammeSettingsDBRepository::$db
protected

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

Referenced by __construct().

◆ FIELD_DEADLINE_DATE

const ilStudyProgrammeSettingsDBRepository::FIELD_DEADLINE_DATE = 'deadline_date'

◆ FIELD_DEADLINE_PERIOD

const ilStudyProgrammeSettingsDBRepository::FIELD_DEADLINE_PERIOD = 'deadline_period'

◆ FIELD_LAST_CHANGED

const ilStudyProgrammeSettingsDBRepository::FIELD_LAST_CHANGED = 'last_change'

◆ FIELD_LP_MODE

const ilStudyProgrammeSettingsDBRepository::FIELD_LP_MODE = 'lp_mode'

◆ FIELD_OBJ_ID

◆ FIELD_POINTS

const ilStudyProgrammeSettingsDBRepository::FIELD_POINTS = 'points'

◆ FIELD_PROC_ENDS_NOT_SUCCESSFUL

const ilStudyProgrammeSettingsDBRepository::FIELD_PROC_ENDS_NOT_SUCCESSFUL = 'proc_end_no_success'

◆ FIELD_RM_NOT_RESTARTED_BY_USER_DAY

const ilStudyProgrammeSettingsDBRepository::FIELD_RM_NOT_RESTARTED_BY_USER_DAY = 'rm_nr_by_usr_days'

◆ FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL

const ilStudyProgrammeSettingsDBRepository::FIELD_SEND_INFO_TO_RE_ASSIGN_MAIL = "send_info_to_re_assign_mail"

◆ FIELD_SEND_RE_ASSIGNED_MAIL

const ilStudyProgrammeSettingsDBRepository::FIELD_SEND_RE_ASSIGNED_MAIL = "send_re_assigned_mail"

Definition at line 35 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"

◆ FIELD_STATUS

const ilStudyProgrammeSettingsDBRepository::FIELD_STATUS = 'status'

◆ FIELD_SUBTYPE_ID

const ilStudyProgrammeSettingsDBRepository::FIELD_SUBTYPE_ID = 'subtype_id'

◆ FIELD_VALIDITY_QUALIFICATION_DATE

const ilStudyProgrammeSettingsDBRepository::FIELD_VALIDITY_QUALIFICATION_DATE = 'vq_date'

◆ FIELD_VALIDITY_QUALIFICATION_PERIOD

const ilStudyProgrammeSettingsDBRepository::FIELD_VALIDITY_QUALIFICATION_PERIOD = 'vq_period'

◆ FIELD_VQ_RESTART_PERIOD

const ilStudyProgrammeSettingsDBRepository::FIELD_VQ_RESTART_PERIOD = 'vq_restart_period'

◆ TABLE

const ilStudyProgrammeSettingsDBRepository::TABLE = 'prg_settings'

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