ILIAS  release_7 Revision v7.30-3-g800a261c036
ilStudyProgrammeAssignmentDBRepository Class Reference
+ Inheritance diagram for ilStudyProgrammeAssignmentDBRepository:
+ Collaboration diagram for ilStudyProgrammeAssignmentDBRepository:

Public Member Functions

 __construct (ilDBInterface $db)
 
 createFor (int $root_prg_id, int $usr_id, int $assigning_usr_id)
 Create a record corresponding to a SP-Object and return represending settings.Will throw if a record allready exists. More...
 
 get (int $id)
 Load settings belonging to a SP-Object.Will throw if the record does not exist yet.
Returns
ilStudyProgrammeAssignment | null
More...
 
 getByUsrId (int $usr_id)
 Get all assignments of a user. More...
 
 getByPrgId (int $prg_id)
 Get all assignments to a prg. More...
 
 getByUsrIdAndPrgId (int $usr_id, int $prg_id)
 
 getDueToRestart ()
 Get all assignments due to restart and not restrted yet.
Returns
ilStudyProgrammeAssignment[]
More...
 
 getDueToRestartAndMail ()
 
 getDueToManuelRestart (int $days_before_end)
 Get all assignments due to restart and not restrted yet. More...
 
 update (ilStudyProgrammeAssignment $assignment)
 Update settings belonging to a SP-Object.Will throw if the record does not exist yet. More...
 
 delete (ilStudyProgrammeAssignment $assignment)
 Delete record corresponding to settings.Will throw if the record does not exist yet. More...
 
 reminderSendFor (int $assignment_id)
 
 getDashboardInstancesforUser (int $usr_id)
 
 deleteAllAssignmentsForProgrammeId (int $prg_obj_id)
 
 getTableAndFieldOfAssignmentIds ()
 
 getInstanceById (int $id)
 
 getInstanceByModel (\ilStudyProgrammeAssignment $assignment)
 
 getInstancesOfUser (int $user_id)
 
 createFor (int $prg_id, int $usr_id, int $assigning_usr_id)
 Create a record corresponding to a SP-Object and return represending settings. More...
 
 get (int $id)
 Load settings belonging to a SP-Object. More...
 
 getByUsrId (int $usr_id)
 Get all assignments of a user. More...
 
 getByPrgId (int $prg_id)
 Get all assignments to a prg. More...
 
 getDueToRestart ()
 Get all assignments due to restart and not restrted yet. More...
 
 getDueToManuelRestart (int $days_before_end)
 Get all assignments due to restart and not restrted yet. More...
 
 update (ilStudyProgrammeAssignment $assignment)
 Update settings belonging to a SP-Object. More...
 
 delete (ilStudyProgrammeAssignment $assignment)
 Delete record corresponding to settings. More...
 

Data Fields

const TABLE = 'prg_usr_assignments'
 
const FIELD_ID = 'id'
 
const FIELD_USR_ID = 'usr_id'
 
const FIELD_ROOT_PRG_ID = 'root_prg_id'
 
const FIELD_LAST_CHANGE = 'last_change'
 
const FIELD_LAST_CHANGE_BY = 'last_change_by'
 
const FIELD_RESTART_DATE = 'restart_date'
 
const FIELD_RESTARTED_ASSIGNMENT_ID = 'restarted_assignment_id'
 
const FIELD_RESTART_MAIL = 'restart_mail_send'
 

Protected Member Functions

 loadDueToRestart ()
 
 loadDueToRestartAndMail ()
 
 getSQLHeader ()
 
 getDueToRestartBaseSQL ()
 
 loadDueToManuelRestart (int $days_before_end)
 
 assignmentByRow (array $row)
 
 loadByFilterDB (array $filter)
 
 insertRowDB (array $row)
 
 updatedRowDB (array $values)
 
 deleteDB (int $id)
 
 nextId ()
 

Protected Attributes

 $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeAssignmentDBRepository::__construct ( ilDBInterface  $db)

Member Function Documentation

◆ assignmentByRow()

ilStudyProgrammeAssignmentDBRepository::assignmentByRow ( array  $row)
protected
Exceptions
ilException

Definition at line 311 of file class.ilStudyProgrammeAssignmentDBRepository.php.

312 {
313 return (new ilStudyProgrammeAssignment((int) $row[self::FIELD_ID]))
314 ->withRootId((int) $row[self::FIELD_ROOT_PRG_ID])
315 ->withUserId((int) $row[self::FIELD_USR_ID])
316 ->withLastChange(
317 (int) $row[self::FIELD_LAST_CHANGE_BY],
318 DateTimeImmutable::createFromFormat(
320 $row[self::FIELD_LAST_CHANGE]
321 )
322 )
323 ->withRestarted(
324 (int) $row[self::FIELD_RESTARTED_ASSIGNMENT_ID],
325 $row[self::FIELD_RESTART_DATE] ?
326 DateTimeImmutable::createFromFormat(ilStudyProgrammeAssignment::DATE_TIME_FORMAT, $row[self::FIELD_RESTART_DATE]) :
327 null
328 );
329 }
Represents one assignment of the user to a program tree.

References ilStudyProgrammeAssignment\DATE_TIME_FORMAT, and ilStudyProgrammeAssignment\withRootId().

Referenced by createFor(), get(), getByPrgId(), getByUsrId(), getByUsrIdAndPrgId(), getDashboardInstancesforUser(), getDueToManuelRestart(), getDueToRestart(), and getDueToRestartAndMail().

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

◆ createFor()

ilStudyProgrammeAssignmentDBRepository::createFor ( int  $root_prg_id,
int  $usr_id,
int  $assigning_usr_id 
)

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

Exceptions
ilException

Implements ilStudyProgrammeAssignmentRepository.

Definition at line 31 of file class.ilStudyProgrammeAssignmentDBRepository.php.

32 {
33 if (ilObject::_lookupType($usr_id) != "usr") {
34 throw new ilException("ilStudyProgrammeAssignment::createFor: '$usr_id' "
35 . "is no id of a user.");
36 }
37 if (ilObject::_lookupType($root_prg_id) != "prg") {
38 throw new ilException("ilStudyProgrammeAssignment::createFor: '$root_prg_id' "
39 . "is no id of a prg.");
40 }
41
42 $row = [
43 self::FIELD_ID => $this->nextId(),
44 self::FIELD_USR_ID => $usr_id,
45 self::FIELD_ROOT_PRG_ID => $root_prg_id,
46 self::FIELD_LAST_CHANGE_BY => $assigning_usr_id,
47 self::FIELD_LAST_CHANGE => ilUtil::now(),
48 self::FIELD_RESTART_DATE => null,
49 self::FIELD_RESTARTED_ASSIGNMENT_ID => ilStudyProgrammeAssignment::NO_RESTARTED_ASSIGNMENT
50 ];
51 $this->insertRowDB($row);
52 return $this->assignmentByRow($row);
53 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType($a_id, $a_reference=false)
lookup object type
static now()
Return current timestamp in Y-m-d H:i:s format.

References ilObject\_lookupType(), assignmentByRow(), insertRowDB(), nextId(), ilStudyProgrammeAssignment\NO_RESTARTED_ASSIGNMENT, and ilUtil\now().

+ Here is the call graph for this function:

◆ delete()

ilStudyProgrammeAssignmentDBRepository::delete ( ilStudyProgrammeAssignment  $assignment)

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

Implements ilStudyProgrammeAssignmentRepository.

Definition at line 244 of file class.ilStudyProgrammeAssignmentDBRepository.php.

References deleteDB().

+ Here is the call graph for this function:

◆ deleteAllAssignmentsForProgrammeId()

ilStudyProgrammeAssignmentDBRepository::deleteAllAssignmentsForProgrammeId ( int  $prg_obj_id)

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

392 : void
393 {
394 $query = 'DELETE FROM ' . self::TABLE . PHP_EOL
395 . 'WHERE ' . self::FIELD_ROOT_PRG_ID . '=' . $this->db->quote($prg_obj_id, 'integer');
396 $this->db->manipulate($query);
397 }
$query

References $query.

◆ deleteDB()

ilStudyProgrammeAssignmentDBRepository::deleteDB ( int  $id)
protected

Definition at line 381 of file class.ilStudyProgrammeAssignmentDBRepository.php.

382 {
383 $this->db->manipulate('DELETE FROM ' . self::TABLE . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($id, 'integer'));
384 }

Referenced by delete().

+ Here is the caller graph for this function:

◆ get()

ilStudyProgrammeAssignmentDBRepository::get ( int  $id)

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

Returns
ilStudyProgrammeAssignment | null

Exceptions
ilException

Implements ilStudyProgrammeAssignmentRepository.

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

60 {
61 foreach ($this->loadByFilterDB([self::FIELD_ID => $id]) as $row) {
62 return $this->assignmentByRow($row);
63 }
64 return null;
65 }

References assignmentByRow(), and loadByFilterDB().

+ Here is the call graph for this function:

◆ getByPrgId()

ilStudyProgrammeAssignmentDBRepository::getByPrgId ( int  $prg_id)

Get all assignments to a prg.

Exceptions
ilException

Implements ilStudyProgrammeAssignmentRepository.

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

84 : array
85 {
86 $return = [];
87 foreach ($this->loadByFilterDB([self::FIELD_ROOT_PRG_ID => $prg_id]) as $row) {
88 $return[] = $this->assignmentByRow($row);
89 }
90 return $return;
91 }

References assignmentByRow(), and loadByFilterDB().

+ Here is the call graph for this function:

◆ getByUsrId()

ilStudyProgrammeAssignmentDBRepository::getByUsrId ( int  $usr_id)

Get all assignments of a user.

Exceptions
ilException

Implements ilStudyProgrammeAssignmentRepository.

Definition at line 71 of file class.ilStudyProgrammeAssignmentDBRepository.php.

71 : array
72 {
73 $return = [];
74 foreach ($this->loadByFilterDB([self::FIELD_USR_ID => $usr_id]) as $row) {
75 $return[] = $this->assignmentByRow($row);
76 }
77 return $return;
78 }

References assignmentByRow(), and loadByFilterDB().

Referenced by getInstancesOfUser().

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

◆ getByUsrIdAndPrgId()

ilStudyProgrammeAssignmentDBRepository::getByUsrIdAndPrgId ( int  $usr_id,
int  $prg_id 
)

Exceptions
ilException

Definition at line 97 of file class.ilStudyProgrammeAssignmentDBRepository.php.

98 {
99 $return = [];
100 foreach ($this->loadByFilterDB(
101 [self::FIELD_USR_ID => $usr_id
102 , self::FIELD_ROOT_PRG_ID => $prg_id]
103 ) as $row) {
104 $return[] = $this->assignmentByRow($row);
105 }
106 return $return;
107 }

References assignmentByRow(), and loadByFilterDB().

+ Here is the call graph for this function:

◆ getDashboardInstancesforUser()

ilStudyProgrammeAssignmentDBRepository::getDashboardInstancesforUser ( int  $usr_id)
Exceptions
ilException

Definition at line 271 of file class.ilStudyProgrammeAssignmentDBRepository.php.

272 {
273 global $DIC;
274 $db = $DIC['ilDB'];
275 $q = 'SELECT ' . self::FIELD_ID
276 . ', ' . self::FIELD_USR_ID
277 . ', ' . self::FIELD_ROOT_PRG_ID
278 . ', ' . self::FIELD_LAST_CHANGE
279 . ', ' . self::FIELD_LAST_CHANGE_BY
280 . ', ' . self::FIELD_RESTART_DATE
281 . ', ' . self::FIELD_RESTARTED_ASSIGNMENT_ID
282 . ' FROM ' . self::TABLE
283 . ' WHERE ' . self::FIELD_USR_ID . ' = ' . $usr_id
284 . ' ORDER BY ' . self::FIELD_ROOT_PRG_ID . ', ' . self::FIELD_ID
285 ;
286 $ret = [];
287 $assignments = [];
288 $res = $db->query($q);
289 $prg = 0;
290 while ($row = $db->fetchAssoc($res)) {
291 if ($prg == 0) {
292 $prg = $row['root_prg_id'];
293 }
294 if ($prg != $row['root_prg_id']) {
295 $ret[$prg] = $assignments;
296 $prg = $row['root_prg_id'];
297 $assignments = [];
298 }
299 $assignments[(int) $row['id']] = $this->assignmentByRow($row);
300 }
301 if (count($assignments) > 0) {
302 $ret[$prg] = $assignments;
303 }
304
305 return $ret;
306 }
global $DIC
Definition: goto.php:24
$ret
Definition: parser.php:6
foreach($_POST as $key=> $value) $res

References $db, $DIC, $res, $ret, assignmentByRow(), and FIELD_ID.

+ Here is the call graph for this function:

◆ getDueToManuelRestart()

ilStudyProgrammeAssignmentDBRepository::getDueToManuelRestart ( int  $days_before_end)

Get all assignments due to restart and not restrted yet.

Exceptions
Exception

Implements ilStudyProgrammeAssignmentRepository.

Definition at line 188 of file class.ilStudyProgrammeAssignmentDBRepository.php.

188 : array
189 {
190 $return = [];
191 foreach ($this->loadDueToManuelRestart($days_before_end) as $row) {
192 $return[] = $this->assignmentByRow($row);
193 }
194 return $return;
195 }

References assignmentByRow(), and loadDueToManuelRestart().

+ Here is the call graph for this function:

◆ getDueToRestart()

ilStudyProgrammeAssignmentDBRepository::getDueToRestart ( )

Get all assignments due to restart and not restrted yet.

Returns
ilStudyProgrammeAssignment[]

Exceptions
ilException

Implements ilStudyProgrammeAssignmentRepository.

Definition at line 113 of file class.ilStudyProgrammeAssignmentDBRepository.php.

113 : array
114 {
115 $return = [];
116 foreach ($this->loadDueToRestart() as $row) {
117 $return[] = $this->assignmentByRow($row);
118 }
119 return $return;
120 }

References assignmentByRow(), and loadDueToRestart().

+ Here is the call graph for this function:

◆ getDueToRestartAndMail()

ilStudyProgrammeAssignmentDBRepository::getDueToRestartAndMail ( )
Returns
ilStudyProgrammeAssignment[]

Definition at line 125 of file class.ilStudyProgrammeAssignmentDBRepository.php.

125 : array
126 {
127 $return = [];
128 foreach ($this->loadDueToRestartAndMail() as $row) {
129 $return[] = $this->assignmentByRow($row);
130 }
131 return $return;
132 }

References assignmentByRow(), and loadDueToRestartAndMail().

+ Here is the call graph for this function:

◆ getDueToRestartBaseSQL()

ilStudyProgrammeAssignmentDBRepository::getDueToRestartBaseSQL ( )
protected

Definition at line 166 of file class.ilStudyProgrammeAssignmentDBRepository.php.

166 : string
167 {
168 return $this->getSQLHeader()
169 . ' WHERE ' . self::FIELD_RESTARTED_ASSIGNMENT_ID
170 . ' = ' . $this->db->quote(
172 'integer'
173 ) . PHP_EOL
174 . ' AND ' . self::FIELD_RESTART_DATE . ' IS NOT NULL' . PHP_EOL
175 . ' AND DATE(' . self::FIELD_RESTART_DATE . ') <= '
176 . $this->db->quote(
177 (new DateTime())->format(
179 ),
180 'text'
181 );
182 }

References ilStudyProgrammeAssignment\DATE_FORMAT, getSQLHeader(), and ilStudyProgrammeAssignment\NO_RESTARTED_ASSIGNMENT.

Referenced by loadDueToRestart(), and loadDueToRestartAndMail().

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

◆ getInstanceById()

ilStudyProgrammeAssignmentDBRepository::getInstanceById ( int  $id)

Backport ilStudyProgrammeUserAssignmentDB

Definition at line 411 of file class.ilStudyProgrammeAssignmentDBRepository.php.

412 {
413 return $this->get($id);
414 }

◆ getInstanceByModel()

ilStudyProgrammeAssignmentDBRepository::getInstanceByModel ( \ilStudyProgrammeAssignment  $assignment)

Definition at line 416 of file class.ilStudyProgrammeAssignmentDBRepository.php.

417 {
418 return $assignment;
419 }

◆ getInstancesOfUser()

ilStudyProgrammeAssignmentDBRepository::getInstancesOfUser ( int  $user_id)

Definition at line 421 of file class.ilStudyProgrammeAssignmentDBRepository.php.

422 {
423 global $DIC;
424 $tree = $DIC['tree'];
425
426 $assignments = $this->getByUsrId($user_id);
427
428 //if parent object is deleted or in trash
429 //the assignment for the user should not be returned
430 $ret = [];
431 foreach ($assignments as $ass) {
432 foreach (ilObject::_getAllReferences($ass->getRootId()) as $value) {
433 if ($tree->isInTree($value)) {
434 $ret[] = $ass;
435 continue 2;
436 }
437 }
438 }
439 return $ret;
440 }
static _getAllReferences($a_id)
get all reference ids of object

References $DIC, $ret, ilObject\_getAllReferences(), and getByUsrId().

+ Here is the call graph for this function:

◆ getSQLHeader()

ilStudyProgrammeAssignmentDBRepository::getSQLHeader ( )
protected

Definition at line 154 of file class.ilStudyProgrammeAssignmentDBRepository.php.

154 : string
155 {
156 return 'SELECT ' . self::FIELD_ID
157 . ', ' . self::FIELD_USR_ID
158 . ', ' . self::FIELD_ROOT_PRG_ID
159 . ', ' . self::FIELD_LAST_CHANGE
160 . ', ' . self::FIELD_LAST_CHANGE_BY
161 . ', ' . self::FIELD_RESTART_DATE
162 . ', ' . self::FIELD_RESTARTED_ASSIGNMENT_ID . PHP_EOL
163 . ' FROM ' . self::TABLE . PHP_EOL;
164 }

Referenced by getDueToRestartBaseSQL(), and loadDueToManuelRestart().

+ Here is the caller graph for this function:

◆ getTableAndFieldOfAssignmentIds()

ilStudyProgrammeAssignmentDBRepository::getTableAndFieldOfAssignmentIds ( )

◆ insertRowDB()

ilStudyProgrammeAssignmentDBRepository::insertRowDB ( array  $row)
protected

Definition at line 351 of file class.ilStudyProgrammeAssignmentDBRepository.php.

352 {
353 $this->db->insert(
354 self::TABLE,
355 [
356 self::FIELD_ID => ['integer', $row[self::FIELD_ID]]
357 , self::FIELD_USR_ID => ['integer', $row[self::FIELD_USR_ID]]
358 , self::FIELD_ROOT_PRG_ID => ['integer', $row[self::FIELD_ROOT_PRG_ID]]
359 , self::FIELD_LAST_CHANGE => ['text', $row[self::FIELD_LAST_CHANGE]]
360 , self::FIELD_LAST_CHANGE_BY => ['integer', $row[self::FIELD_LAST_CHANGE_BY]]
361 , self::FIELD_RESTART_DATE => ['timestamp', $row[self::FIELD_RESTART_DATE]]
362 , self::FIELD_RESTARTED_ASSIGNMENT_ID => ['integer', $row[self::FIELD_RESTARTED_ASSIGNMENT_ID]]
363 ]
364 );
365 }

Referenced by createFor().

+ Here is the caller graph for this function:

◆ loadByFilterDB()

ilStudyProgrammeAssignmentDBRepository::loadByFilterDB ( array  $filter)
protected

Definition at line 331 of file class.ilStudyProgrammeAssignmentDBRepository.php.

332 {
333 $q = 'SELECT ' . self::FIELD_ID
334 . ' ,' . self::FIELD_USR_ID
335 . ' ,' . self::FIELD_ROOT_PRG_ID
336 . ' ,' . self::FIELD_LAST_CHANGE
337 . ' ,' . self::FIELD_LAST_CHANGE_BY
338 . ' ,' . self::FIELD_RESTART_DATE
339 . ' ,' . self::FIELD_RESTARTED_ASSIGNMENT_ID
340 . ' FROM ' . self::TABLE
341 . ' WHERE TRUE';
342 foreach ($filter as $field => $value) {
343 $q .= ' AND ' . $field . ' = ' . $this->db->quote($value, 'text');
344 }
345 $res = $this->db->query($q);
346 while ($rec = $this->db->fetchAssoc($res)) {
347 yield $rec;
348 }
349 }

References $res.

Referenced by get(), getByPrgId(), getByUsrId(), and getByUsrIdAndPrgId().

+ Here is the caller graph for this function:

◆ loadDueToManuelRestart()

ilStudyProgrammeAssignmentDBRepository::loadDueToManuelRestart ( int  $days_before_end)
protected
Exceptions
Exception

Definition at line 200 of file class.ilStudyProgrammeAssignmentDBRepository.php.

201 {
202 $date = new DateTime();
203 $date->sub(new DateInterval('P' . $days_before_end . 'D'));
204 $q = $this->getSQLHeader()
205 . ' WHERE ' . self::FIELD_RESTARTED_ASSIGNMENT_ID
206 . ' = ' . $this->db->quote(
208 'integer'
209 ) . PHP_EOL
210 . ' AND ' . self::FIELD_RESTART_DATE . ' IS NOT NULL' . PHP_EOL
211 . ' AND DATE(' . self::FIELD_RESTART_DATE . ') <= '
212 . $this->db->quote(
213 $date->format(
215 ),
216 'text'
217 );
218 $res = $this->db->query($q);
219 while ($rec = $this->db->fetchAssoc($res)) {
220 yield $rec;
221 }
222 }

References $res, ilStudyProgrammeAssignment\DATE_FORMAT, getSQLHeader(), and ilStudyProgrammeAssignment\NO_RESTARTED_ASSIGNMENT.

Referenced by getDueToManuelRestart().

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

◆ loadDueToRestart()

ilStudyProgrammeAssignmentDBRepository::loadDueToRestart ( )
protected

Definition at line 134 of file class.ilStudyProgrammeAssignmentDBRepository.php.

135 {
136 $q = $this->getDueToRestartBaseSQL();
137 $res = $this->db->query($q);
138 while ($rec = $this->db->fetchAssoc($res)) {
139 yield $rec;
140 }
141 }

References $res, and getDueToRestartBaseSQL().

Referenced by getDueToRestart().

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

◆ loadDueToRestartAndMail()

ilStudyProgrammeAssignmentDBRepository::loadDueToRestartAndMail ( )
protected

Definition at line 143 of file class.ilStudyProgrammeAssignmentDBRepository.php.

144 {
145 $q = $this->getDueToRestartBaseSQL();
146 $q .= ' AND ' . self::FIELD_RESTART_MAIL . ' IS NULL';
147
148 $res = $this->db->query($q);
149 while ($rec = $this->db->fetchAssoc($res)) {
150 yield $rec;
151 }
152 }

References $res, and getDueToRestartBaseSQL().

Referenced by getDueToRestartAndMail().

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

◆ nextId()

ilStudyProgrammeAssignmentDBRepository::nextId ( )
protected

Definition at line 386 of file class.ilStudyProgrammeAssignmentDBRepository.php.

387 {
388 return $this->db->nextId(self::TABLE);
389 }

Referenced by createFor().

+ Here is the caller graph for this function:

◆ reminderSendFor()

ilStudyProgrammeAssignmentDBRepository::reminderSendFor ( int  $assignment_id)

Definition at line 249 of file class.ilStudyProgrammeAssignmentDBRepository.php.

249 : void
250 {
251 $where = [
252 self::FIELD_ID => [
253 'integer',
254 $assignment_id
255 ]
256 ];
257
258 $values = [
259 self::FIELD_RESTART_MAIL => [
260 'timestamp',
261 date('Y-m-d H:i:s')
262 ]
263 ];
264
265 $this->db->update(self::TABLE, $values, $where);
266 }

◆ update()

ilStudyProgrammeAssignmentDBRepository::update ( ilStudyProgrammeAssignment  $assignment)

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

Implements ilStudyProgrammeAssignmentRepository.

Definition at line 227 of file class.ilStudyProgrammeAssignmentDBRepository.php.

228 {
229 $row = [
230 self::FIELD_ID => $assignment->getId(),
231 self::FIELD_USR_ID => $assignment->getUserId(),
232 self::FIELD_ROOT_PRG_ID => $assignment->getRootId(),
233 self::FIELD_LAST_CHANGE_BY => $assignment->getLastChangeBy(),
234 self::FIELD_LAST_CHANGE => $assignment->getLastChange()->format(ilStudyProgrammeAssignment::DATE_TIME_FORMAT),
235 self::FIELD_RESTART_DATE => $assignment->getRestartDate() ? $assignment->getRestartDate()->format(ilStudyProgrammeAssignment::DATE_TIME_FORMAT) : null,
236 self::FIELD_RESTARTED_ASSIGNMENT_ID => $assignment->getRestartedAssignmentId()
237 ];
238 $this->updatedRowDB($row);
239 }

References ilStudyProgrammeAssignment\DATE_TIME_FORMAT, ilStudyProgrammeAssignment\getId(), ilStudyProgrammeAssignment\getLastChange(), ilStudyProgrammeAssignment\getLastChangeBy(), ilStudyProgrammeAssignment\getRestartDate(), ilStudyProgrammeAssignment\getRestartedAssignmentId(), ilStudyProgrammeAssignment\getRootId(), ilStudyProgrammeAssignment\getUserId(), and updatedRowDB().

+ Here is the call graph for this function:

◆ updatedRowDB()

ilStudyProgrammeAssignmentDBRepository::updatedRowDB ( array  $values)
protected

Definition at line 367 of file class.ilStudyProgrammeAssignmentDBRepository.php.

368 {
369 $q = 'UPDATE ' . self::TABLE
370 . ' SET'
371 . ' ' . self::FIELD_USR_ID . ' = ' . $this->db->quote($values[self::FIELD_USR_ID], 'integer')
372 . ' ,' . self::FIELD_ROOT_PRG_ID . ' = ' . $this->db->quote($values[self::FIELD_ROOT_PRG_ID], 'integer')
373 . ' ,' . self::FIELD_LAST_CHANGE . ' = ' . $this->db->quote($values[self::FIELD_LAST_CHANGE], 'text')
374 . ' ,' . self::FIELD_LAST_CHANGE_BY . ' = ' . $this->db->quote($values[self::FIELD_LAST_CHANGE_BY], 'integer')
375 . ' ,' . self::FIELD_RESTART_DATE . ' = ' . $this->db->quote($values[self::FIELD_RESTART_DATE], 'timestamp')
376 . ' ,' . self::FIELD_RESTARTED_ASSIGNMENT_ID . ' = ' . $this->db->quote($values[self::FIELD_RESTARTED_ASSIGNMENT_ID], 'integer')
377 . ' WHERE ' . self::FIELD_ID . ' = ' . $this->db->quote($values[self::FIELD_ID], 'integer');
378 $this->db->manipulate($q);
379 }

Referenced by update().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilStudyProgrammeAssignmentDBRepository::$db
protected

◆ FIELD_ID

const ilStudyProgrammeAssignmentDBRepository::FIELD_ID = 'id'

◆ FIELD_LAST_CHANGE

const ilStudyProgrammeAssignmentDBRepository::FIELD_LAST_CHANGE = 'last_change'

◆ FIELD_LAST_CHANGE_BY

const ilStudyProgrammeAssignmentDBRepository::FIELD_LAST_CHANGE_BY = 'last_change_by'

◆ FIELD_RESTART_DATE

const ilStudyProgrammeAssignmentDBRepository::FIELD_RESTART_DATE = 'restart_date'

◆ FIELD_RESTART_MAIL

const ilStudyProgrammeAssignmentDBRepository::FIELD_RESTART_MAIL = 'restart_mail_send'

◆ FIELD_RESTARTED_ASSIGNMENT_ID

const ilStudyProgrammeAssignmentDBRepository::FIELD_RESTARTED_ASSIGNMENT_ID = 'restarted_assignment_id'

◆ FIELD_ROOT_PRG_ID

const ilStudyProgrammeAssignmentDBRepository::FIELD_ROOT_PRG_ID = 'root_prg_id'

◆ FIELD_USR_ID

const ilStudyProgrammeAssignmentDBRepository::FIELD_USR_ID = 'usr_id'

◆ TABLE


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