ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilStudyProgramme Class Reference

Class ilStudyProgramme. More...

+ Inheritance diagram for ilStudyProgramme:
+ Collaboration diagram for ilStudyProgramme:

Public Member Functions

 getObjId ()
 Get the id of the study program. More...
 
 getSubtypeId ()
 Return the meta-data subtype id. More...
 
 setSubtypeId ($subtype_id)
 Sets the meta-data type id. 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...
 
 setPoints ($a_points)
 Set the amount of points. More...
 
 getPoints ()
 Get the amount of points. More...
 
 setLPMode ($a_mode)
 Set the lp mode. More...
 
 getLPMode ()
 Get the lp mode. More...
 
 setStatus ($a_status)
 Set the status of the node. More...
 
 getStatus ()
 Get the status. 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 createForObject (ilObject $a_object)
 Create new study program settings for an object. 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 MODE_UNDEFINED = 0
 
const MODE_POINTS = 1
 
const MODE_LP_COMPLETED = 2
 
const STATUS_DRAFT = 10
 
const STATUS_ACTIVE = 20
 
const STATUS_OUTDATED = 30
 
const DEFAULT_POINTS = 100
 
const DEFAULT_SUBTYPE = 0
 
- Data Fields inherited from ActiveRecord
const ACTIVE_RECORD_VERSION = '2.0.7'
 

Static Public Attributes

static $MODES
 
static $STATUS
 

Protected Member Functions

 setObjId ($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

 $obj_id
 
 $last_change
 
 $subtype_id
 
 $points
 
 $lp_mode
 
 $status
 
- 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

Member Function Documentation

◆ createForObject()

static ilStudyProgramme::createForObject ( ilObject  $a_object)
static

Create new study program settings for an object.

Throws when object is no program object.

Exceptions
ilException
Returns
ilStudyProgramme

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

151 {
152 if ($a_object->getType() != "prg") {
153 throw new ilException("ilStudyProgramme::createSettingsForObject: "
154 . "Object is no prg object.");
155 }
156 if (!$a_object->getId()) {
157 throw new ilException("ilStudyProgramme::createSettingsForObject: "
158 . "Object has no id.");
159 }
160
161 $prg = new ilStudyProgramme();
162 $prg->subtype_id = self::DEFAULT_SUBTYPE;
163 $prg->setObjId($a_object->getId())
164 ->setStatus(self::STATUS_DRAFT)
165 ->setLPMode(self::MODE_UNDEFINED)
166 ->setPoints(self::DEFAULT_POINTS)
167 ->create();
168 return $prg;
169 }
Base class for ILIAS Exception handling.
getType()
get object type @access public
getId()
get object id @access public
Class ilStudyProgramme.

References DEFAULT_SUBTYPE, ilObject\getId(), and ilObject\getType().

Referenced by ilObjStudyProgramme\createSettings().

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

◆ getLastChange()

ilStudyProgramme::getLastChange ( )

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

Returns
ilDateTime

Definition at line 214 of file class.ilStudyProgramme.php.

215 {
216 return new ilDateTime($this->last_change, IL_CAL_DATETIME);
217 }
const IL_CAL_DATETIME
@classDescription Date and time handling

References IL_CAL_DATETIME.

Referenced by setLastChange().

+ Here is the caller graph for this function:

◆ getLPMode()

ilStudyProgramme::getLPMode ( )

Get the lp mode.

Returns
integer - one of self::$MODES

Definition at line 307 of file class.ilStudyProgramme.php.

308 {
309 return (int) $this->lp_mode;
310 }

References $lp_mode.

◆ getObjId()

ilStudyProgramme::getObjId ( )

Get the id of the study program.

Returns
integer

Definition at line 183 of file class.ilStudyProgramme.php.

184 {
185 return (int) $this->obj_id;
186 }

References $obj_id.

Referenced by ilStudyProgrammeAssignment\createFor(), and ilStudyProgrammeProgress\createFor().

+ Here is the caller graph for this function:

◆ getPoints()

ilStudyProgramme::getPoints ( )

Get the amount of points.

Returns
integer - larger than zero

Definition at line 277 of file class.ilStudyProgramme.php.

278 {
279 return (int) $this->points;
280 }

References $points.

Referenced by ilStudyProgrammeProgress\createFor().

+ Here is the caller graph for this function:

◆ getStatus()

ilStudyProgramme::getStatus ( )

Get the status.

Returns
integer - one of self::$STATUS

Definition at line 338 of file class.ilStudyProgramme.php.

339 {
340 return (int) $this->status;
341 }

References $status.

◆ getSubtypeId()

ilStudyProgramme::getSubtypeId ( )

Return the meta-data subtype id.

Returns
int

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

194 {
195 return $this->subtype_id;
196 }

References $subtype_id.

◆ returnDbTableName()

static ilStudyProgramme::returnDbTableName ( )
static
Returns
string

Reimplemented from ActiveRecord.

Definition at line 59 of file class.ilStudyProgramme.php.

60 {
61 return "prg_settings";
62 }

Referenced by ilObjStudyProgrammeTest\testDeleteRemovesEntriesInPrgSettings().

+ Here is the caller graph for this function:

◆ setLastChange()

ilStudyProgramme::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.

Returns
$this

Definition at line 238 of file class.ilStudyProgramme.php.

239 {
240 if (ilDateTime::_before($a_timestamp, $this->getLastChange())) {
241 throw new ilException("ilStudyProgramme::setLastChange: Given "
242 . "timestamp is before current timestamp. That "
243 . "is logically impossible.");
244 }
245
246 $this->last_change = $a_timestamp->get(IL_CAL_DATETIME);
247 return $this;
248 }
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:

◆ setLPMode()

ilStudyProgramme::setLPMode (   $a_mode)

Set the lp mode.

Throws when program is not in draft status.

Parameters
integer$a_mode- one of self::$MODES
Returns
$this

Definition at line 290 of file class.ilStudyProgramme.php.

291 {
292 $a_mode = (int) $a_mode;
293 if (!in_array($a_mode, self::$MODES)) {
294 throw new ilException("ilStudyProgramme::setLPMode: No lp mode: "
295 . "'$a_mode'");
296 }
297 $this->lp_mode = $a_mode;
298 $this->updateLastChange();
299 return $this;
300 }
updateLastChange()
Update the last change timestamp to the current time.

References updateLastChange().

+ Here is the call graph for this function:

◆ setObjId()

ilStudyProgramme::setObjId (   $a_id)
protected

Definition at line 172 of file class.ilStudyProgramme.php.

173 {
174 $this->obj_id = $a_id;
175 return $this;
176 }

◆ setPoints()

ilStudyProgramme::setPoints (   $a_points)

Set the amount of points.

Parameters
integer$a_points- larger than zero
Exceptions
ilException
Returns
$this

Definition at line 259 of file class.ilStudyProgramme.php.

260 {
261 $a_points = (int) $a_points;
262 if ($a_points < 0) {
263 throw new ilException("ilStudyProgramme::setPoints: Points cannot "
264 . "be smaller than zero.");
265 }
266
267 $this->points = $a_points;
268 $this->updateLastChange();
269 return $this;
270 }

References updateLastChange().

+ Here is the call graph for this function:

◆ setStatus()

ilStudyProgramme::setStatus (   $a_status)

Set the status of the node.

TODO: Should this throw, when one wants to go back in lifecycle? Maybe getting back to draft needs to be forbidden only?

Parameters
integer$a_status- one of self::$STATUS
Returns
$this

Definition at line 321 of file class.ilStudyProgramme.php.

322 {
323 $a_status = (int) $a_status;
324 if (!in_array($a_status, self::$STATUS)) {
325 throw new ilException("ilStudyProgramme::setStatus: No lp mode: "
326 . "'$a_status'");
327 }
328 $this->status = $a_status;
329 $this->updateLastChange();
330 return $this;
331 }

References updateLastChange().

+ Here is the call graph for this function:

◆ setSubtypeId()

ilStudyProgramme::setSubtypeId (   $subtype_id)

Sets the meta-data type id.

Parameters
int$subtype_id

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

205 {
206 $this->subtype_id = $subtype_id;
207 }

References $subtype_id.

◆ updateLastChange()

ilStudyProgramme::updateLastChange ( )

Update the last change timestamp to the current time.

Returns
$this

Definition at line 224 of file class.ilStudyProgramme.php.

225 {
227 return $this;
228 }
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 setLPMode(), setPoints(), and setStatus().

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

Field Documentation

◆ $last_change

ilStudyProgramme::$last_change
protected

Definition at line 87 of file class.ilStudyProgramme.php.

◆ $lp_mode

ilStudyProgramme::$lp_mode
protected

Definition at line 127 of file class.ilStudyProgramme.php.

Referenced by getLPMode().

◆ $MODES

◆ $obj_id

ilStudyProgramme::$obj_id
protected

Definition at line 75 of file class.ilStudyProgramme.php.

Referenced by getObjId().

◆ $points

ilStudyProgramme::$points
protected

Definition at line 115 of file class.ilStudyProgramme.php.

Referenced by getPoints().

◆ $STATUS

◆ $status

ilStudyProgramme::$status
protected

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

Referenced by getStatus().

◆ $subtype_id

ilStudyProgramme::$subtype_id
protected

Definition at line 101 of file class.ilStudyProgramme.php.

Referenced by getSubtypeId(), and setSubtypeId().

◆ DEFAULT_POINTS

◆ DEFAULT_SUBTYPE

const ilStudyProgramme::DEFAULT_SUBTYPE = 0

Definition at line 54 of file class.ilStudyProgramme.php.

Referenced by createForObject().

◆ MODE_LP_COMPLETED

◆ MODE_POINTS

◆ MODE_UNDEFINED

const ilStudyProgramme::MODE_UNDEFINED = 0

◆ STATUS_ACTIVE

const ilStudyProgramme::STATUS_ACTIVE = 20

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

Referenced by ilObjStudyProgramme\assignUser(), ilObjStudyProgrammeSettingsGUI\getStatusOptions(), ilObjStudyProgramme\isActive(), ilStudyProgrammeLPTest\setAllNodesActive(), ilStudyProgrammeUserProgressTest\setAllNodesActive(), ilStudyProgrammeEventsTest\setUp(), ilStudyProgrammeProgressCalculationTest\setUp(), ilStudyProgrammeProgressCalculationTest\setUpNodes(), ilStudyProgrammeUserProgressTest\testCanBeCompleted3(), ilObjStudyProgrammeTest\testCanRemoveNodeWithNotRelevantProgress(), ilObjStudyProgrammeTest\testCantRemoveNodeWithRelevantProgress(), ilStudyProgrammeUserProgressTest\testCompletionOnDeeplyNestedProgresses(), ilStudyProgrammeUserAssignmentTest\testDeassignRemovesEntriesInPrgUsrAssignment(), ilStudyProgrammeUserAssignmentTest\testDeleteOfProgrammeRemovesEntriesInPrgUsrAssignment(), ilStudyProgrammeUserAssignmentTest\testGetAmountOfAssignments(), ilStudyProgrammeUserAssignmentTest\testGetAssignments(), ilStudyProgrammeUserAssignmentTest\testGetAssignmentsOf(), ilStudyProgrammeUserAssignmentTest\testHasAssignmentOf(), ilStudyProgrammeLPTest\testInitialLPDraft(), ilStudyProgrammeUserProgressTest\testInitialProgressDraft(), ilStudyProgrammeLPTest\testInitialProgressOutdated(), ilStudyProgrammeUserProgressTest\testInitialProgressOutdated(), ilStudyProgrammeUserAssignmentTest\testRemoveAssignment1(), ilStudyProgrammeUserAssignmentTest\testRemoveAssignment2(), ilStudyProgrammeUserAssignmentTest\testRemoveOnRootNodeOnly1(), ilStudyProgrammeUserAssignmentTest\testRemoveOnRootNodeOnly2(), ilObjStudyProgrammeTest\testSettings(), ilStudyProgrammeUserAssignmentTest\testUserId(), and ilStudyProgrammeUserProgress\updateFromProgramNode().

◆ STATUS_DRAFT

◆ STATUS_OUTDATED


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