ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilStudyProgrammeAssignment.php
Go to the documentation of this file.
1<?php declare(strict_types = 1);
2
3/* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5
19{
21
22 const DATE_TIME_FORMAT = 'Y-m-d H:i:s';
23 const DATE_FORMAT = 'Y-m-d';
24
29
36 protected $id;
37
43 protected $usr_id;
44
51 protected $root_prg_id;
52
53
59 protected $last_change;
60
66 protected $last_change_by;
67
73 protected $restart_date;
74
82
83
84 public function __construct(int $id)
85 {
86 $this->id = $id;
87 }
88
94 public function getId() : int
95 {
96 return $this->id;
97 }
98
104 public function getRootId() : int
105 {
106 return $this->root_prg_id;
107 }
108
110 {
111 $this->root_prg_id = $id;
112 return $this;
113 }
114
120 public function getUserId() : int
121 {
122 return $this->usr_id;
123 }
124
126 {
127 $this->usr_id = $usr_id;
128 return $this;
129 }
130
136 public function getLastChangeBy() : int
137 {
139 }
140
149 public function setLastChangeBy(int $assigned_by_id) : ilStudyProgrammeAssignment
150 {
151 $auto_assignment = [
156 ];
157 $is_auto_assignment = in_array($assigned_by_id, $auto_assignment);
158 $exists = ilObject::_exists($assigned_by_id);
159 $is_usr = ilObject::_lookupType($assigned_by_id) == "usr";
160 if (!$is_auto_assignment && ($exists && !$is_usr)) {
161 throw new ilException("ilStudyProgrammeAssignment::setLastChangeBy: '$assigned_by_id' "
162 . "is neither a user's id nor a valid membership source.");
163 }
164
165 $this->last_change_by = $assigned_by_id;
166 return $this;
167 }
168
174 public function getLastChange() : DateTime
175 {
176 return DateTime::createFromFormat(self::DATE_TIME_FORMAT, $this->last_change);
177 }
178
185 {
186 $this->setLastChange(new DateTime());
187 return $this;
188 }
189
196 {
197 $this->last_change = $timestamp->format(self::DATE_TIME_FORMAT);
198 return $this;
199 }
200
204 public function setRestartDate(DateTime $date = null) : ilStudyProgrammeAssignment
205 {
206 $this->restart_date = $date;
207 return $this;
208 }
209
215 public function getRestartDate()
216 {
217 return $this->restart_date;
218 }
219
224 {
225 $this->restarted_asssignment_id = $id;
226 return $this;
227 }
228
234 public function getRestartedAssignmentId() : int
235 {
237 }
238}
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
An exception for terminatinating execution or to throw for unit testing.
Base class for ILIAS Exception handling.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilStudyProgrammeAssignment.
getUserId()
Get the id of the user who is assigned.
updateLastChange()
Update the last change timestamp to the current time.
getId()
Get the id of the assignment.
setLastChangeBy(int $assigned_by_id)
Set the id of the user who did the last change on this assignment.
getRestartDate()
Get the date, at which the user is to be reassigned to the programme.
getLastChange()
Get the timestamp of the last change on this program or a sub program.
getRootId()
Get the object id of the program the user was assigned to.
setRestartedAssignmentId(int $id)
Set the id of the assignment which was intiated due to expiring progress of this assignment.
setLastChange(DateTime $timestamp)
Set the last change timestamp to the given time.
setRestartDate(DateTime $date=null)
Set the date, at which the user is to be reassigned to the programme.
getLastChangeBy()
Get the id of the user who did the last change on this assignment.
getRestartedAssignmentId()
Get the id of the assignment which was intiated due to expiring progress of this assignment.