ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilStudyProgrammeAssignment Class Reference

Class ilStudyProgrammeAssignment. More...

+ Inheritance diagram for ilStudyProgrammeAssignment:
+ Collaboration diagram for ilStudyProgrammeAssignment:

Public Member Functions

 getId ()
 Get the id of the assignment. More...
 
 getRootId ()
 Get the object id of the program the user was assigned to. More...
 
 getUserId ()
 Get the id of the user who is assigned. More...
 
 getLastChangeBy ()
 Get the id of the user who did the last change on this assignment. More...
 
 setLastChangeBy ($a_usr_id)
 Set the id of the user who did the last change on this assignment. More...
 
 getLastChange ()
 Get the timestamp of the last change on this program or a sub program. More...
 
 updateLastChange ()
 Update the last change timestamp to the current time. More...
 
 setLastChange (ilDateTime $a_timestamp)
 Set the last change timestamp to the given time. More...
 
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 
 getArFieldList ()
 
 getConnectorContainerName ()
 
 setConnectorContainerName ($connector_container_name)
 
 getPrimaryFieldValue ()
 
 setPrimaryFieldValue ($value)
 
 __construct ($primary_key=0, arConnector $connector=null)
 
 storeObjectToCache ()
 
 __getConvertedDateFieldsAsArray ($format=null)
 
 __asCsv ($separator=';', $header=false)
 
 __asArray ()
 
 __asStdClass ()
 
 __asSerializedObject ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, $value)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 getArrayForDb ()
 
 getArrayForConnector ()
 
 installConnector ()
 
 store ()
 
 save ()
 
 create ()
 
 copy ($new_id=0)
 
 afterObjectLoad ()
 
 read ()
 
 update ()
 
 delete ()
 
 __call ($name, $arguments)
 

Static Public Member Functions

static returnDbTableName ()
 
static createFor (ilStudyProgramme $a_prg, $a_usr_id, $a_assigning_usr_id)
 Create new assignment object for study program and user. More...
 
- Static Public Member Functions inherited from ActiveRecord
static returnDbTableName ()
 
static installDB ()
 
static renameDBField ($old_name, $new_name)
 
static tableExists ()
 
static fieldExists ($field_name)
 
static removeDBField ($field_name)
 
static updateDB ()
 
static resetDB ()
 
static truncateDB ()
 
static flushDB ()
 
static preloadObjects ()
 
static additionalParams (array $additional_params)
 
static findOrFail ($primary_key, array $add_constructor_args=array())
 Tries to find the object and throws an Exception if object is not found, instead of returning null. More...
 
static findOrGetInstance ($primary_key, array $add_constructor_args=array())
 
static where ($where, $operator=null)
 
static innerjoinAR (ActiveRecord $ar, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static innerjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static leftjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static orderBy ($orderBy, $orderDirection='ASC')
 
static dateFormat ($date_format='d.m.Y - H:i:s')
 
static limit ($start, $end)
 
static affectedRows ()
 
static count ()
 
static get ()
 
static debug ()
 
static first ()
 
static getCollection ()
 
static last ()
 
static getFirstFromLastQuery ()
 
static connector (arConnector $connector)
 
static raw ($set_raw=true)
 
static getArray ($key=null, $values=null)
 
static _toCamelCase ($str, $capitalise_first_char=false)
 

Protected Member Functions

 setRootId ($a_id)
 
 setUserId ($a_usr_id)
 
- Protected Member Functions inherited from ActiveRecord
 serializeToCSV ($field)
 This method is called for every field of your instance if you use __asCsv. More...
 
 installDatabase ()
 

Protected Attributes

 $id
 
 $usr_id
 
 $root_prg_id
 
 $last_change
 
 $last_change_by
 
- Protected Attributes inherited from ActiveRecord
 $ar_safe_read = true
 
 $connector_container_name = ''
 

Additional Inherited Members

- Data Fields inherited from ActiveRecord
const ACTIVE_RECORD_VERSION = '2.0.7'
 
- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 
static fromCamelCase ($str)
 

Detailed Description

Class ilStudyProgrammeAssignment.

Represents one assignment of the user to a program tree.

One user can have multiple assignments to the same tree. This makes it possible to represent programs that need to be accomplished periodically as well.

Author
: Richard Klees richa.nosp@m.rd.k.nosp@m.lees@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de
Version
: 0.1.0

Definition at line 19 of file class.ilStudyProgrammeAssignment.php.

Member Function Documentation

◆ createFor()

static ilStudyProgrammeAssignment::createFor ( ilStudyProgramme  $a_prg,
  $a_usr_id,
  $a_assigning_usr_id 
)
static

Create new assignment object for study program and user.

Throws when $a_usr_id does not point to a user.

Exceptions
ilException
Parameters
int$a_usr_id
int$a_assigning_usr_id
Returns
ilStudyProgrammeAssignment

Definition at line 103 of file class.ilStudyProgrammeAssignment.php.

104 {
105 if (ilObject::_lookupType($a_usr_id) != "usr") {
106 throw new ilException("ilStudyProgrammeAssignment::createFor: '$a_usr_id' "
107 . "is no id of a user.");
108 }
109
110 $ass = new ilStudyProgrammeAssignment();
111 $ass->setRootId($a_prg->getObjId())
112 ->setUserId($a_usr_id)
113 ->setLastChangeBy($a_assigning_usr_id)
114 ->updateLastChange()
115 ->create();
116 return $ass;
117 }
Base class for ILIAS Exception handling.
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilStudyProgrammeAssignment.
getObjId()
Get the id of the study program.

References ilObject\_lookupType(), and ilStudyProgramme\getObjId().

Referenced by ilObjStudyProgramme\assignUser().

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

◆ getId()

ilStudyProgrammeAssignment::getId ( )

Get the id of the assignment.

Returns
int

Definition at line 124 of file class.ilStudyProgrammeAssignment.php.

References $id.

Referenced by ilStudyProgrammeProgress\createFor().

+ Here is the caller graph for this function:

◆ getLastChange()

ilStudyProgrammeAssignment::getLastChange ( )

Get the timestamp of the last change on this program or a sub program.

Returns
ilDateTime

Definition at line 194 of file class.ilStudyProgrammeAssignment.php.

195 {
196 return new ilDateTime($this->last_change, IL_CAL_DATETIME);
197 }
const IL_CAL_DATETIME
@classDescription Date and time handling

References IL_CAL_DATETIME.

Referenced by setLastChange().

+ Here is the caller graph for this function:

◆ getLastChangeBy()

ilStudyProgrammeAssignment::getLastChangeBy ( )

Get the id of the user who did the last change on this assignment.

Returns
int

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

References $last_change_by.

◆ getRootId()

ilStudyProgrammeAssignment::getRootId ( )

Get the object id of the program the user was assigned to.

Returns
int

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

References $root_prg_id.

◆ getUserId()

ilStudyProgrammeAssignment::getUserId ( )

Get the id of the user who is assigned.

Returns
int

Definition at line 150 of file class.ilStudyProgrammeAssignment.php.

References $usr_id.

Referenced by ilStudyProgrammeProgress\createFor().

+ Here is the caller graph for this function:

◆ returnDbTableName()

static ilStudyProgrammeAssignment::returnDbTableName ( )
static
Returns
string

Reimplemented from ActiveRecord.

Definition at line 24 of file class.ilStudyProgrammeAssignment.php.

25 {
26 return "prg_usr_assignments";
27 }

Referenced by ilStudyProgrammeMembersTableGUI\getFrom(), ilStudyProgrammeUserAssignmentTest\testDeassignRemovesEntriesInPrgUsrAssignment(), and ilStudyProgrammeUserAssignmentTest\testDeleteOfProgrammeRemovesEntriesInPrgUsrAssignment().

+ Here is the caller graph for this function:

◆ setLastChange()

ilStudyProgrammeAssignment::setLastChange ( ilDateTime  $a_timestamp)

Set the last change timestamp to the given time.

Throws when given time is smaller then current timestamp since that is logically impossible.

Exceptions
ilException
Returns
$this

Definition at line 219 of file class.ilStudyProgrammeAssignment.php.

220 {
221 if (ilDateTime::_before($a_timestamp, $this->getLastChange())) {
222 throw new ilException("ilStudyProgrammeAssignment::setLastChange: Given "
223 . "timestamp is before current timestamp. That "
224 . "is logically impossible.");
225 }
226
227 $this->last_change = $a_timestamp->get(IL_CAL_DATETIME);
228 return $this;
229 }
get($a_format, $a_format_str='', $a_tz='')
get formatted date
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
getLastChange()
Get the timestamp of the last change on this program or a sub program.

References ilDateTime\_before(), ilDateTime\get(), getLastChange(), and IL_CAL_DATETIME.

Referenced by updateLastChange().

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

◆ setLastChangeBy()

ilStudyProgrammeAssignment::setLastChangeBy (   $a_usr_id)

Set the id of the user who did the last change on this assignment.

Throws when $a_usr_id is not the id of a user.

Exceptions
ilException
Returns
$this

Definition at line 179 of file class.ilStudyProgrammeAssignment.php.

180 {
181 if (ilObject::_lookupType($a_usr_id) != "usr") {
182 throw new ilException("ilStudyProgrammeAssignment::setLastChangeBy: '$a_usr_id' "
183 . "is no id of a user.");
184 }
185 $this->last_change_by = $a_usr_id;
186 return $this;
187 }

References ilObject\_lookupType().

+ Here is the call graph for this function:

◆ setRootId()

ilStudyProgrammeAssignment::setRootId (   $a_id)
protected

Definition at line 139 of file class.ilStudyProgrammeAssignment.php.

140 {
141 $this->root_prg_id = $a_id;
142 return $this;
143 }

◆ setUserId()

ilStudyProgrammeAssignment::setUserId (   $a_usr_id)
protected

Definition at line 155 of file class.ilStudyProgrammeAssignment.php.

156 {
157 $this->usr_id = $a_usr_id;
158 return $this;
159 }

◆ updateLastChange()

ilStudyProgrammeAssignment::updateLastChange ( )

Update the last change timestamp to the current time.

Returns
$this

Definition at line 204 of file class.ilStudyProgrammeAssignment.php.

205 {
207 return $this;
208 }
setLastChange(ilDateTime $a_timestamp)
Set the last change timestamp to the given time.
static now()
Return current timestamp in Y-m-d H:i:s format.

References IL_CAL_DATETIME, ilUtil\now(), and setLastChange().

+ Here is the call graph for this function:

Field Documentation

◆ $id

ilStudyProgrammeAssignment::$id
protected

Definition at line 41 of file class.ilStudyProgrammeAssignment.php.

Referenced by getId().

◆ $last_change

ilStudyProgrammeAssignment::$last_change
protected

Definition at line 78 of file class.ilStudyProgrammeAssignment.php.

◆ $last_change_by

ilStudyProgrammeAssignment::$last_change_by
protected

Definition at line 90 of file class.ilStudyProgrammeAssignment.php.

Referenced by getLastChangeBy().

◆ $root_prg_id

ilStudyProgrammeAssignment::$root_prg_id
protected

Definition at line 66 of file class.ilStudyProgrammeAssignment.php.

Referenced by getRootId().

◆ $usr_id

ilStudyProgrammeAssignment::$usr_id
protected

Definition at line 53 of file class.ilStudyProgrammeAssignment.php.

Referenced by getUserId().


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