ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 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 148 of file class.ilStudyProgramme.php.

148 {
149 if ($a_object->getType() != "prg") {
150 throw new ilException("ilStudyProgramme::createSettingsForObject: "
151 ."Object is no prg object.");
152 }
153 if(!$a_object->getId()) {
154 throw new ilException("ilStudyProgramme::createSettingsForObject: "
155 ."Object has no id.");
156 }
157
158 $prg = new ilStudyProgramme();
159 $prg->subtype_id = self::DEFAULT_SUBTYPE;
160 $prg->setObjId($a_object->getId())
161 ->setStatus(self::STATUS_DRAFT)
162 ->setLPMode(self::MODE_UNDEFINED)
163 ->setPoints(self::DEFAULT_POINTS)
164 ->create();
165 return $prg;
166 }
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 207 of file class.ilStudyProgramme.php.

207 {
208 return new ilDateTime($this->last_change, IL_CAL_DATETIME);
209 }
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 294 of file class.ilStudyProgramme.php.

294 {
295 return (int)$this->lp_mode;
296 }

References $lp_mode.

◆ getObjId()

ilStudyProgramme::getObjId ( )

Get the id of the study program.

Returns
integer

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

179 {
180 return (int)$this->obj_id;
181 }

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 266 of file class.ilStudyProgramme.php.

266 {
267 return (int)$this->points;
268 }

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

323 {
324 return (int)$this->status;
325 }

References $status.

◆ getSubtypeId()

ilStudyProgramme::getSubtypeId ( )

Return the meta-data subtype id.

Returns
int

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

188 {
189 return $this->subtype_id;
190 }

References $subtype_id.

◆ returnDbTableName()

static ilStudyProgramme::returnDbTableName ( )
static
Returns
string

Reimplemented from ActiveRecord.

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

58 {
59 return "prg_settings";
60 }

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 229 of file class.ilStudyProgramme.php.

229 {
230 if (ilDateTime::_before($a_timestamp, $this->getLastChange())) {
231 throw new ilException("ilStudyProgramme::setLastChange: Given "
232 ."timestamp is before current timestamp. That "
233 ."is logically impossible.");
234 }
235
236 $this->last_change = $a_timestamp->get(IL_CAL_DATETIME);
237 return $this;
238 }
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 278 of file class.ilStudyProgramme.php.

278 {
279 $a_mode = (int)$a_mode;
280 if (!in_array($a_mode, self::$MODES)) {
281 throw new ilException("ilStudyProgramme::setLPMode: No lp mode: "
282 ."'$a_mode'");
283 }
284 $this->lp_mode = $a_mode;
285 $this->updateLastChange();
286 return $this;
287 }
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 169 of file class.ilStudyProgramme.php.

169 {
170 $this->obj_id = $a_id;
171 return $this;
172 }

◆ setPoints()

ilStudyProgramme::setPoints (   $a_points)

Set the amount of points.

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

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

249 {
250 $a_points = (int)$a_points;
251 if ($a_points < 0) {
252 throw new ilException("ilStudyProgramme::setPoints: Points cannot "
253 ."be smaller than zero.");
254 }
255
256 $this->points = $a_points;
257 $this->updateLastChange();
258 return $this;
259 }

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 307 of file class.ilStudyProgramme.php.

307 {
308 $a_status = (int)$a_status;
309 if (!in_array($a_status, self::$STATUS)) {
310 throw new ilException("ilStudyProgramme::setStatus: No lp mode: "
311 ."'$a_status'");
312 }
313 $this->status = $a_status;
314 $this->updateLastChange();
315 return $this;
316 }

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 198 of file class.ilStudyProgramme.php.

198 {
199 $this->subtype_id = $subtype_id;
200 }

References $subtype_id.

◆ updateLastChange()

ilStudyProgramme::updateLastChange ( )

Update the last change timestamp to the current time.

Returns
$this

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

216 {
218 return $this;
219 }
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 85 of file class.ilStudyProgramme.php.

◆ $lp_mode

ilStudyProgramme::$lp_mode
protected

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

Referenced by getLPMode().

◆ $MODES

◆ $obj_id

ilStudyProgramme::$obj_id
protected

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

Referenced by getObjId().

◆ $points

ilStudyProgramme::$points
protected

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

Referenced by getPoints().

◆ $STATUS

◆ $status

ilStudyProgramme::$status
protected

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

Referenced by getStatus().

◆ $subtype_id

ilStudyProgramme::$subtype_id
protected

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

Referenced by getSubtypeId(), and setSubtypeId().

◆ DEFAULT_POINTS

◆ DEFAULT_SUBTYPE

const ilStudyProgramme::DEFAULT_SUBTYPE = 0

Definition at line 53 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 40 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: