ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 getDeadline ()
 Get the deadline of this progress. More...
 
 setDeadline (ilDateTime $deadline=null)
 Set the deadline of this progress. 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
 
const STATUS_FAILED = 5
 
- 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
 
 $deadline
 
- 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 206 of file class.ilStudyProgrammeProgress.php.

207 {
208 $prg = new ilStudyProgrammeProgress();
209 $prg->setAssignmentId($a_ass->getId())
210 ->setNodeId($a_prg->getObjId())
211 ->setUserId($a_ass->getUserId())
213 ->setAmountOfPoints($a_prg->getPoints())
214 ->setCurrentAmountOfPoints(0)
215 ->setCompletionBy(null)
216 ->setLastChangeBy(null)
217 ->updateLastChange()
218 ->create();
219 return $prg;
220 }
getUserId()
Get the id of the user who is assigned.
getId()
Get the id of the assignment.
Class ilStudyProgrammeProgress.
getPoints()
Get the amount of points.
getObjId()
Get the id of the study program.

References ilStudyProgrammeAssignment\getId(), ilStudyProgramme\getObjId(), ilStudyProgramme\getPoints(), ilStudyProgrammeAssignment\getUserId(), and STATUS_IN_PROGRESS.

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

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

References $points.

◆ getAssignmentId()

ilStudyProgrammeProgress::getAssignmentId ( )

Get the assignment, this progress belongs to.

Returns
ilStudyProgrammeAssignment.

Definition at line 227 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 390 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 310 of file class.ilStudyProgrammeProgress.php.

References $points_cur.

◆ getDeadline()

ilStudyProgrammeProgress::getDeadline ( )

Get the deadline of this progress.

Returns
ilDateTime

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

475 {
476 if ($this->deadline !== null) {
477 return new ilDateTime($this->deadline, IL_CAL_DATE);
478 }
479 return $this->deadline;
480 }
const IL_CAL_DATE
@classDescription Date and time handling

References $deadline, and IL_CAL_DATE.

◆ getLastChange()

ilStudyProgrammeProgress::getLastChange ( )

Get the timestamp of the last change on this progress.

Returns
ilDateTime

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

428 {
429 return new ilDateTime($this->last_change, IL_CAL_DATETIME);
430 }
const IL_CAL_DATETIME

References IL_CAL_DATETIME.

Referenced by setLastChange().

+ 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 399 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 243 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 340 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 259 of file class.ilStudyProgrammeProgress.php.

References $usr_id.

◆ returnDbTableName()

static ilStudyProgrammeProgress::returnDbTableName ( )
static
Returns
string

Reimplemented from ActiveRecord.

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

51 {
52 return "prg_usr_progress";
53 }

Referenced by ilStudyProgrammeMembersTableGUI\getFrom().

+ Here is the caller graph for this function:

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

293 {
294 if (!is_numeric($a_points) || $a_points < 0) {
295 throw new ilException("ilStudyProgrammeProgress::setAmountOfPoints: "
296 . "Expected a number >= 0 as argument, got '$a_points'");
297 }
298
299 $this->points = (int) $a_points;
300
301 $this->updateLastChange();
302 return $this;
303 }
Base class for ILIAS Exception handling.
updateLastChange()
Update the last change timestamp to the current time.

References updateLastChange().

+ Here is the call graph for this function:

◆ setAssignmentId()

ilStudyProgrammeProgress::setAssignmentId (   $a_id)
protected

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

233 {
234 $this->assignment_id = $a_id;
235 return $this;
236 }

◆ setCompletionBy()

ilStudyProgrammeProgress::setCompletionBy (   $a_id)

Set the completion_by field.

Parameters
$a_idint | null
Returns
$this

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

375 {
376 if ($a_id !== null) {
377 $a_id = (int) $a_id;
378 }
379 $this->completion_by = $a_id;
380 $this->updateLastChange();
381 return $this;
382 }

References updateLastChange().

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

324 {
325 if (!is_numeric($a_points) || $a_points < 0) {
326 throw new ilException("ilStudyProgrammeProgress::setCurrentAmountOfPoints: "
327 . "Expected a number >= 0 as argument, got '$a_points'.");
328 }
329
330 $this->points_cur = (int) $a_points;
331 $this->updateLastChange();
332 return $this;
333 }

References updateLastChange().

+ Here is the call graph for this function:

◆ setDeadline()

ilStudyProgrammeProgress::setDeadline ( ilDateTime  $deadline = null)

Set the deadline of this progress.

Parameters
ilDateTime  |  null$deadline
Returns
$this

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

490 {
491 if ($deadline === null) {
492 $this->deadline = $deadline;
493 } else {
494 $this->deadline = $deadline->get(IL_CAL_DATE);
495 }
496
497 return $this;
498 }

References $deadline, and IL_CAL_DATE.

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

458 {
459 if (ilDateTime::_before($a_timestamp, $this->getLastChange())) {
460 throw new ilException("ilStudyProgrammeProgress::setLastChange: Given "
461 . "timestamp is before current timestamp. That "
462 . "is logically impossible.");
463 }
464
465 $this->last_change = $a_timestamp->get(IL_CAL_DATETIME);
466 return $this;
467 }
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 progress.

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()

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

413 {
414 if ($a_usr_id !== null && ilObject::_lookupType($a_usr_id) != "usr") {
415 throw new ilException("ilStudyProgrammeProgress::setLastChangeBy: '$a_usr_id' "
416 . "is no id of a user.");
417 }
418 $this->last_change_by = $a_usr_id;
419 return $this;
420 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References ilObject\_lookupType().

+ Here is the call graph for this function:

◆ setNodeId()

ilStudyProgrammeProgress::setNodeId (   $a_id)
protected

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

249 {
250 $this->prg_id = $a_id;
251 return $this;
252 }

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

356 {
357 $a_status = (int) $a_status;
358 if (!in_array($a_status, self::$STATUS)) {
359 throw new ilException("ilStudyProgrammeProgress::setStatus: No status: "
360 . "'$a_status'");
361 }
362
363 $this->status = $a_status;
364 $this->updateLastChange();
365 return $this;
366 }

References updateLastChange().

+ Here is the call graph for this function:

◆ setUserId()

ilStudyProgrammeProgress::setUserId (   $a_id)
protected

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

265 {
266 $this->usr_id = $a_id;
267 return $this;
268 }

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

443 {
445 return $this;
446 }
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().

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

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

Referenced by getAssignmentId().

◆ $completion_by

ilStudyProgrammeProgress::$completion_by
protected

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

Referenced by getCompletionBy().

◆ $deadline

ilStudyProgrammeProgress::$deadline
protected

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

Referenced by getDeadline(), and setDeadline().

◆ $id

ilStudyProgrammeProgress::$id
protected

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

◆ $last_change

ilStudyProgrammeProgress::$last_change
protected

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

◆ $last_change_by

ilStudyProgrammeProgress::$last_change_by
protected

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

Referenced by getLastChangeBy().

◆ $points

ilStudyProgrammeProgress::$points
protected

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

Referenced by getAmountOfPoints().

◆ $points_cur

ilStudyProgrammeProgress::$points_cur
protected

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

Referenced by getCurrentAmountOfPoints().

◆ $prg_id

ilStudyProgrammeProgress::$prg_id
protected

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

Referenced by getNodeId().

◆ $STATUS

◆ $status

ilStudyProgrammeProgress::$status
protected

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

Referenced by getStatus().

◆ $usr_id

ilStudyProgrammeProgress::$usr_id
protected

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

Referenced by getUserId().

◆ STATUS_ACCREDITED

◆ STATUS_COMPLETED

◆ STATUS_FAILED

◆ STATUS_IN_PROGRESS

◆ STATUS_NOT_RELEVANT


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