ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 101 of file class.ilStudyProgrammeAssignment.php.

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

Referenced by ilObjStudyProgramme\assignUser().

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

References IL_CAL_DATETIME.

Referenced by setLastChange().

184  {
185  return new ilDateTime($this->last_change, IL_CAL_DATETIME);
186  }
const IL_CAL_DATETIME
Date and time handling
+ 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 158 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 130 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 144 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

◆ 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 207 of file class.ilStudyProgrammeAssignment.php.

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

Referenced by updateLastChange().

207  {
208  if (ilDateTime::_before($a_timestamp, $this->getLastChange())) {
209  throw new ilException("ilStudyProgrammeAssignment::setLastChange: Given "
210  ."timestamp is before current timestamp. That "
211  ."is logically impossible.");
212  }
213 
214  $this->last_change = $a_timestamp->get(IL_CAL_DATETIME);
215  return $this;
216  }
Base class for ILIAS Exception handling.
const IL_CAL_DATETIME
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.
get($a_format, $a_format_str='', $a_tz='')
get formatted date
+ 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 170 of file class.ilStudyProgrammeAssignment.php.

References ilObject\_lookupType().

170  {
171  if (ilObject::_lookupType($a_usr_id) != "usr") {
172  throw new ilException("ilStudyProgrammeAssignment::setLastChangeBy: '$a_usr_id' "
173  ."is no id of a user.");
174  }
175  $this->last_change_by = $a_usr_id;
176  return $this;
177  }
Base class for ILIAS Exception handling.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ setRootId()

ilStudyProgrammeAssignment::setRootId (   $a_id)
protected

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

134  {
135  $this->root_prg_id = $a_id;
136  return $this;
137  }

◆ setUserId()

ilStudyProgrammeAssignment::setUserId (   $a_usr_id)
protected

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

Referenced by createFor().

148  {
149  $this->usr_id = $a_usr_id;
150  return $this;
151  }
+ Here is the caller graph for this function:

◆ updateLastChange()

ilStudyProgrammeAssignment::updateLastChange ( )

Update the last change timestamp to the current time.

Returns
$this

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

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

193  {
195  return $this;
196  }
const IL_CAL_DATETIME
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.
Date and time handling
+ Here is the call graph for this function:

Field Documentation

◆ $id

ilStudyProgrammeAssignment::$id
protected

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

Referenced by getId().

◆ $last_change

ilStudyProgrammeAssignment::$last_change
protected

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

◆ $last_change_by

ilStudyProgrammeAssignment::$last_change_by
protected

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

Referenced by getLastChangeBy().

◆ $root_prg_id

ilStudyProgrammeAssignment::$root_prg_id
protected

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

Referenced by getRootId().

◆ $usr_id

ilStudyProgrammeAssignment::$usr_id
protected

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

Referenced by getUserId().


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