ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilStudyProgrammeProgress Class Reference

Class ilStudyProgrammeProgress. More...

+ Inheritance diagram for ilStudyProgrammeProgress:
+ Collaboration diagram for ilStudyProgrammeProgress:

Public Member Functions

 getAssignmentId ()
 Get the assignment, this progress belongs to. More...
 
 getNodeId ()
 Get the id of the program node this progress belongs to. More...
 
 getUserId ()
 Get the id of the user this progress is for. More...
 
 getAmountOfPoints ()
 Get the amount of points the user needs to achieve on the subnodes of this node. More...
 
 setAmountOfPoints ($a_points)
 Get the amount of points the user needs to achieve on the subnodes of this node. More...
 
 getCurrentAmountOfPoints ()
 Get the amount of points the user currently has achieved on the node. More...
 
 setCurrentAmountOfPoints ($a_points)
 Set the amount of points the user currently has achieved on this node. More...
 
 getStatus ()
 Get the status the user has on this node. More...
 
 setStatus ($a_status)
 Set the status of this node. More...
 
 setCompletionBy ($a_id)
 Set the completion_by field. More...
 
 getCompletionBy ()
 Get the id of object or user that lead to the successful completion of this node. 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 progress. More...
 
 getLastChange ()
 Get the timestamp of the last change on this progress. 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, ilStudyProgrammeAssignment $a_ass)
 Create a new progress object for a given program node and assignment. 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)
 

Data Fields

const STATUS_IN_PROGRESS = 1
 
const STATUS_COMPLETED = 2
 
const STATUS_ACCREDITED = 3
 
const STATUS_NOT_RELEVANT = 4
 
- Data Fields inherited from ActiveRecord
const ACTIVE_RECORD_VERSION = '2.0.7'
 

Static Public Attributes

static $STATUS
 

Protected Member Functions

 setAssignmentId ($a_id)
 
 setNodeId ($a_id)
 
 setUserId ($a_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
 
 $assignment_id
 
 $prg_id
 
 $usr_id
 
 $points
 
 $points_cur
 
 $status
 
 $completion_by
 
 $last_change
 
 $last_change_by
 
- Protected Attributes inherited from ActiveRecord
 $ar_safe_read = true
 
 $connector_container_name = ''
 

Additional Inherited Members

- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 
static fromCamelCase ($str)
 

Detailed Description

Class ilStudyProgrammeProgress.

Represents the progress of a user for one program assignment on one node of the program.

The user has one progress per assignment and program node in the subtree of the assigned program.

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 20 of file class.ilStudyProgrammeProgress.php.

Member Function Documentation

◆ createFor()

static ilStudyProgrammeProgress::createFor ( ilStudyProgramme  $a_prg,
ilStudyProgrammeAssignment  $a_ass 
)
static

Create a new progress object for a given program node and assignment.

Parameters
$a_assigning_userint
Returns
ilStudyProgrammeProgress

Definition at line 191 of file class.ilStudyProgrammeProgress.php.

References ilStudyProgrammeAssignment\getId(), ilStudyProgramme\getObjId(), ilStudyProgramme\getPoints(), ilStudyProgrammeAssignment\getUserId(), setCurrentAmountOfPoints(), setNodeId(), setStatus(), setUserId(), and STATUS_IN_PROGRESS.

Referenced by ilStudyProgrammeUserAssignment\addMissingProgresses(), and ilObjStudyProgramme\createProgressForAssignment().

192  {
193  $prg = new ilStudyProgrammeProgress();
194  $prg->setAssignmentId($a_ass->getId())
195  ->setNodeId($a_prg->getObjId())
196  ->setUserId($a_ass->getUserId())
198  ->setAmountOfPoints($a_prg->getPoints())
200  ->setCompletionBy(null)
201  ->setLastChangeBy(null)
202  ->updateLastChange()
203  ->create();
204  return $prg;
205  }
getUserId()
Get the id of the user who is assigned.
setStatus($a_status)
Set the status of this node.
setCurrentAmountOfPoints($a_points)
Set the amount of points the user currently has achieved on this node.
getObjId()
Get the id of the study program.
getPoints()
Get the amount of points.
Class ilStudyProgrammeProgress.
getId()
Get the id of the assignment.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAmountOfPoints()

ilStudyProgrammeProgress::getAmountOfPoints ( )

Get the amount of points the user needs to achieve on the subnodes of this node.

Also the amount of points, this node yields for the progress on the nodes above.

Returns
int

Definition at line 256 of file class.ilStudyProgrammeProgress.php.

References $points.

◆ getAssignmentId()

ilStudyProgrammeProgress::getAssignmentId ( )

Get the assignment, this progress belongs to.

Returns
ilStudyProgrammeAssignment.

Definition at line 212 of file class.ilStudyProgrammeProgress.php.

References $assignment_id.

◆ getCompletionBy()

ilStudyProgrammeProgress::getCompletionBy ( )

Get the id of object or user that lead to the successful completion of this node.

Returns
int

Definition at line 362 of file class.ilStudyProgrammeProgress.php.

References $completion_by.

◆ getCurrentAmountOfPoints()

ilStudyProgrammeProgress::getCurrentAmountOfPoints ( )

Get the amount of points the user currently has achieved on the node.

Returns
int

Definition at line 287 of file class.ilStudyProgrammeProgress.php.

References $points_cur.

◆ getLastChange()

ilStudyProgrammeProgress::getLastChange ( )

Get the timestamp of the last change on this progress.

Returns
ilDateTime

Definition at line 396 of file class.ilStudyProgrammeProgress.php.

References IL_CAL_DATETIME.

Referenced by setLastChange().

396  {
397  return new ilDateTime($this->last_change, IL_CAL_DATETIME);
398  }
const IL_CAL_DATETIME
Date and time handling
+ Here is the caller graph for this function:

◆ getLastChangeBy()

ilStudyProgrammeProgress::getLastChangeBy ( )

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

Returns
int

Definition at line 370 of file class.ilStudyProgrammeProgress.php.

References $last_change_by.

◆ getNodeId()

ilStudyProgrammeProgress::getNodeId ( )

Get the id of the program node this progress belongs to.

Returns
int

Definition at line 226 of file class.ilStudyProgrammeProgress.php.

References $prg_id.

◆ getStatus()

ilStudyProgrammeProgress::getStatus ( )

Get the status the user has on this node.

Returns
int - one of ilStudyProgramme::STATUS_*

Definition at line 315 of file class.ilStudyProgrammeProgress.php.

References $status.

◆ getUserId()

ilStudyProgrammeProgress::getUserId ( )

Get the id of the user this progress is for.

Returns
int

Definition at line 240 of file class.ilStudyProgrammeProgress.php.

References $usr_id.

◆ returnDbTableName()

static ilStudyProgrammeProgress::returnDbTableName ( )
static
Returns
string

Definition at line 46 of file class.ilStudyProgrammeProgress.php.

46  {
47  return "prg_usr_progress";
48  }

◆ setAmountOfPoints()

ilStudyProgrammeProgress::setAmountOfPoints (   $a_points)

Get the amount of points the user needs to achieve on the subnodes of this node.

Also the amount of points, this node yields for the progress on the nodes above.

Throws when amount of points is smaller then zero.

Exceptions
ilException
Returns
$this

Definition at line 270 of file class.ilStudyProgrammeProgress.php.

References updateLastChange().

270  {
271  if (!is_numeric($a_points) || $a_points < 0) {
272  throw new ilException("ilStudyProgrammeProgress::setAmountOfPoints: "
273  ."Expected a number >= 0 as argument, got '$a_points'");
274  }
275 
276  $this->points = (int)$a_points;
277 
278  $this->updateLastChange();
279  return $this;
280  }
Base class for ILIAS Exception handling.
updateLastChange()
Update the last change timestamp to the current time.
+ Here is the call graph for this function:

◆ setAssignmentId()

ilStudyProgrammeProgress::setAssignmentId (   $a_id)
protected

Definition at line 216 of file class.ilStudyProgrammeProgress.php.

216  {
217  $this->assignment_id = $a_id;
218  return $this;
219  }

◆ setCompletionBy()

ilStudyProgrammeProgress::setCompletionBy (   $a_id)

Set the completion_by field.

Parameters
$a_idint | null
Returns
$this

Definition at line 347 of file class.ilStudyProgrammeProgress.php.

References updateLastChange().

347  {
348  if ($a_id !== null) {
349  $a_id = (int)$a_id;
350  }
351  $this->completion_by = $a_id;
352  $this->updateLastChange();
353  return $this;
354  }
updateLastChange()
Update the last change timestamp to the current time.
+ Here is the call graph for this function:

◆ setCurrentAmountOfPoints()

ilStudyProgrammeProgress::setCurrentAmountOfPoints (   $a_points)

Set the amount of points the user currently has achieved on this node.

Throw when amount of points is smaller then zero.

Exceptions
ilException
Returns
$this

Definition at line 299 of file class.ilStudyProgrammeProgress.php.

References updateLastChange().

Referenced by createFor().

299  {
300  if (!is_numeric($a_points) || $a_points < 0) {
301  throw new ilException("ilStudyProgrammeProgress::setCurrentAmountOfPoints: "
302  ."Expected a number >= 0 as argument, got '$a_points'.");
303  }
304 
305  $this->points_cur = (int)$a_points;
306  $this->updateLastChange();
307  return $this;
308  }
Base class for ILIAS Exception handling.
updateLastChange()
Update the last change timestamp to the current time.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLastChange()

ilStudyProgrammeProgress::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 424 of file class.ilStudyProgrammeProgress.php.

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

Referenced by updateLastChange().

424  {
425  if (ilDateTime::_before($a_timestamp, $this->getLastChange())) {
426  throw new ilException("ilStudyProgrammeProgress::setLastChange: Given "
427  ."timestamp is before current timestamp. That "
428  ."is logically impossible.");
429  }
430 
431  $this->last_change = $a_timestamp->get(IL_CAL_DATETIME);
432  return $this;
433  }
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.
get($a_format, $a_format_str='', $a_tz='')
get formatted date
getLastChange()
Get the timestamp of the last change on this progress.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLastChangeBy()

ilStudyProgrammeProgress::setLastChangeBy (   $a_usr_id)

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

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

Exceptions
ilException
Returns
$this

Definition at line 382 of file class.ilStudyProgrammeProgress.php.

References ilObject\_lookupType().

382  {
383  if ($a_usr_id !== null && ilObject::_lookupType($a_usr_id) != "usr") {
384  throw new ilException("ilStudyProgrammeProgress::setLastChangeBy: '$a_usr_id' "
385  ."is no id of a user.");
386  }
387  $this->last_change_by = $a_usr_id;
388  return $this;
389  }
Base class for ILIAS Exception handling.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ setNodeId()

ilStudyProgrammeProgress::setNodeId (   $a_id)
protected

Definition at line 230 of file class.ilStudyProgrammeProgress.php.

Referenced by createFor().

230  {
231  $this->prg_id = $a_id;
232  return $this;
233  }
+ Here is the caller graph for this function:

◆ setStatus()

ilStudyProgrammeProgress::setStatus (   $a_status)

Set the status of this node.

Throws when status is none of ilStudyProgramme::STATUS_*. Throws when current status is STATUS_COMPLETED.

Exceptions
ilException
Parameters
$a_statusint - one of ilStudyProgramme::STATUS_*
Returns
$this

Definition at line 329 of file class.ilStudyProgrammeProgress.php.

References updateLastChange().

Referenced by createFor().

329  {
330  $a_status = (int)$a_status;
331  if (!in_array($a_status, self::$STATUS)) {
332  throw new ilException("ilStudyProgrammeProgress::setStatus: No status: "
333  ."'$a_status'");
334  }
335 
336  $this->status = $a_status;
337  $this->updateLastChange();
338  return $this;
339  }
Base class for ILIAS Exception handling.
updateLastChange()
Update the last change timestamp to the current time.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUserId()

ilStudyProgrammeProgress::setUserId (   $a_id)
protected

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

Referenced by createFor().

244  {
245  $this->usr_id = $a_id;
246  return $this;
247  }
+ Here is the caller graph for this function:

◆ updateLastChange()

ilStudyProgrammeProgress::updateLastChange ( )

Update the last change timestamp to the current time.

TODO: I'm not quite sure how the semantics of the last change field should be. Should this record every change or only changes done by a user manually. The answer to this question will also tell whether this method should be called in other setters or not.

Returns
$this

Definition at line 410 of file class.ilStudyProgrammeProgress.php.

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

Referenced by setAmountOfPoints(), setCompletionBy(), setCurrentAmountOfPoints(), and setStatus().

410  {
412  return $this;
413  }
const IL_CAL_DATETIME
static now()
Return current timestamp in Y-m-d H:i:s format.
Date and time handling
setLastChange(ilDateTime $a_timestamp)
Set the last change timestamp to the given time.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $assignment_id

ilStudyProgrammeProgress::$assignment_id
protected

Definition at line 80 of file class.ilStudyProgrammeProgress.php.

Referenced by getAssignmentId().

◆ $completion_by

ilStudyProgrammeProgress::$completion_by
protected

Definition at line 157 of file class.ilStudyProgrammeProgress.php.

Referenced by getCompletionBy().

◆ $id

ilStudyProgrammeProgress::$id
protected

Definition at line 68 of file class.ilStudyProgrammeProgress.php.

◆ $last_change

ilStudyProgrammeProgress::$last_change
protected

Definition at line 170 of file class.ilStudyProgrammeProgress.php.

◆ $last_change_by

ilStudyProgrammeProgress::$last_change_by
protected

Definition at line 182 of file class.ilStudyProgrammeProgress.php.

Referenced by getLastChangeBy().

◆ $points

ilStudyProgrammeProgress::$points
protected

Definition at line 118 of file class.ilStudyProgrammeProgress.php.

Referenced by getAmountOfPoints().

◆ $points_cur

ilStudyProgrammeProgress::$points_cur
protected

Definition at line 130 of file class.ilStudyProgrammeProgress.php.

Referenced by getCurrentAmountOfPoints().

◆ $prg_id

ilStudyProgrammeProgress::$prg_id
protected

Definition at line 92 of file class.ilStudyProgrammeProgress.php.

Referenced by getNodeId().

◆ $STATUS

◆ $status

ilStudyProgrammeProgress::$status
protected

Definition at line 142 of file class.ilStudyProgrammeProgress.php.

Referenced by getStatus().

◆ $usr_id

ilStudyProgrammeProgress::$usr_id
protected

Definition at line 105 of file class.ilStudyProgrammeProgress.php.

Referenced by getUserId().

◆ STATUS_ACCREDITED

◆ STATUS_COMPLETED

◆ STATUS_IN_PROGRESS

◆ STATUS_NOT_RELEVANT


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