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

Class ilObjStudyProgramme. More...

+ Inheritance diagram for ilObjStudyProgramme:
+ Collaboration diagram for ilObjStudyProgramme:

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=true)
 ATTENTION: After using the constructor the object won't be in the cache. More...
 
 getStudyProgrammeUserProgressDB ()
 Get a (cached) instance of ilStudyProgrammeUserProgressDB. More...
 
 read ()
 read More...
 
 create ()
 Create. More...
 
 update ()
 Update. More...
 
 delete ()
 Delete Study Programme and all related data. More...
 
 getLastChange ()
 Get the timestamp of the last change on this program or sub program. More...
 
 getPoints ()
 Get the amount of points. More...
 
 setPoints ($a_points)
 Set the amount of points. More...
 
 getLPMode ()
 Get the lp mode. More...
 
 adjustLPMode ()
 Adjust the lp mode to match current state of tree: More...
 
 getStatus ()
 Get the status. More...
 
 setStatus ($a_status)
 Set the status of the node. More...
 
 isActive ()
 Check whether this programme is active. More...
 
 getSubtypeId ()
 Gets the meta-data subtype id (allows to add additional meta-data based on a type) More...
 
 setSubtypeId ($a_subtype_id)
 Sets the meta-data subtype id. More...
 
 getSubType ()
 Gets the SubType Object. More...
 
 getChildren ()
 Get all ilObjStudyProgrammes that are direct children of this object. More...
 
 getParent ()
 Get the parent ilObjStudyProgramme of this object. More...
 
 getParents ()
 Get all parents of the node, where the root of the program comes first. More...
 
 hasChildren ()
 Does this StudyProgramme have other ilObjStudyProgrammes as children? More...
 
 getAmountOfChildren ()
 Get the amount of other StudyProgrammes this StudyProgramme has as children. More...
 
 getDepth ()
 Get the depth of this StudyProgramme in the tree starting at the topmost StudyProgramme (not root node of the repo tree!). More...
 
 getRoot ()
 Get the ilObjStudyProgramme that is the root node of the tree this programme is in. More...
 
 getLPChildren ()
 Get the leafs the study programme contains. More...
 
 getLPChildrenIds ()
 Get the ids of the leafs the program contains. More...
 
 getAmountOfLPChildren ()
 Get the amount of leafs, the study programme contains. More...
 
 hasLPChildren ()
 Does this StudyProgramme has leafs? More...
 
 applyToSubTreeNodes (Closure $fun)
 Apply the given Closure to every node in the subtree starting at this object. More...
 
 getCompletedCourses ($a_user_id)
 Get courses in this program that the given user already completed. More...
 
 addNode (ilObjStudyProgramme $a_prg)
 Inserts another ilObjStudyProgramme in this object. More...
 
 putInTree ($a_parent_ref)
 Overwritten from ilObject. More...
 
 removeNode (ilObjStudyProgramme $a_prg)
 Remove a node from this object. More...
 
 canBeRemoved ()
 Check weather a node can be removed. More...
 
 addLeaf ( $a_leaf)
 Insert a leaf in this object. More...
 
 removeLeaf ( $a_leaf)
 Remove a leaf from this object. More...
 
 moveTo (ilObjStudyProgramme $a_new_parent)
 Move this tree node to a new parent. More...
 
 assignUser ($a_usr_id, $a_assigning_usr_id=null)
 Assign a user to this node at the study program. More...
 
 removeAssignment (ilStudyProgrammeUserAssignment $a_assignment)
 Remove an assignment from this program. More...
 
 hasAssignmentOf ($a_user_id)
 Check whether user is assigned to this program or any node above. More...
 
 getAmountOfAssignmentsOf ($a_user_id)
 Get the amount of assignments a user has on this program node or any node above. More...
 
 getAssignmentsOf ($a_user_id)
 Get the assignments of user at this program or any node above. More...
 
 getAssignments ()
 Get all assignments to this program or any node above. More...
 
 hasAssignments ()
 Are there any assignments on this node or any node above? More...
 
 updateAllAssignments ()
 Update all assignments to this program node. More...
 
 createProgressForAssignment (ilStudyProgrammeAssignment $ass)
 Create a progress on this programme for the given assignment. More...
 
 getProgressesOf ($a_user_id)
 Get the progresses the user has on this node. More...
 
 getProgressForAssignment ($a_assignment_id)
 Get the progress for an assignment on this node. More...
 
 addMissingProgresses ()
 Add missing progress records for all assignments of this programm. More...
 
 getProgresses ()
 Get all progresses on this node. More...
 
 hasProgresses ()
 Are there any users that have a progress on this programme? More...
 
 hasRelevantProgresses ()
 Are there any users that have a relevant progress on this programme? More...
 
 getIdsOfUsersWithRelevantProgress ()
 Get the ids of all users that have a relevant progress at this programme. More...
 
 getIdsOfUsersWithCompletedProgress ()
 Get the ids of all users that have completed this programme. More...
 
 getIdsOfUsersWithFailedProgress ()
 Get the ids of all users that have failed this programme. More...
 
 getIdsOfUsersWithNotCompletedAndRelevantProgress ()
 Get the ids of all users that have not completed this programme but have a relevant progress on it. More...
 
 getRawSettings ()
 Get the underlying model of this program. More...
 
- Public Member Functions inherited from ilContainer
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 getObjectTranslation ()
 Get object translation. More...
 
 setObjectTranslation (ilObjectTranslation $obj_trans)
 Get object translation. More...
 
 createContainerDirectory ()
 Create directory for the container. More...
 
 getContainerDirectory ()
 Get the container directory. More...
 
 setHiddenFilesFound ($a_hiddenfilesfound)
 Set Found hidden files (set by getSubItems). More...
 
 getHiddenFilesFound ()
 Get Found hidden files (set by getSubItems). More...
 
 getStyleSheetId ()
 get ID of assigned style sheet object More...
 
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object More...
 
 setNewsTimeline ($a_val)
 Set news timeline. More...
 
 getNewsTimeline ()
 Get news timeline. More...
 
 setNewsTimelineAutoEntries ($a_val)
 Set news timeline auto entries. More...
 
 getNewsTimelineAutoEntries ()
 Get news timeline auto entries. More...
 
 setNewsTimelineLandingPage ($a_val)
 Set news timline is landing page. More...
 
 getNewsTimelineLandingPage ()
 Get news timline is landing page. More...
 
 isNewsTimelineEffective ()
 Is news timeline effective? More...
 
 isNewsTimelineLandingPageEffective ()
 Is news timeline landing page effective? More...
 
 setNewsBlockActivated ($a_val)
 Set news block activated. More...
 
 getNewsBlockActivated ()
 Get news block activated. More...
 
 setUseNews ($a_val)
 Set use news. More...
 
 getUseNews ()
 Get use news. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies (container sorting) More...
 
 cloneAllObject ($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call=false, $a_submode=1)
 clone all objects according to this container More...
 
 delete ()
 delete category and all related data More...
 
 getViewMode ()
 Get container view mode. More...
 
 getOrderType ()
 Get order type default implementation. More...
 
 setOrderType ($a_value)
 
 getSubItems ($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
 Get subitems of container. More...
 
 gotItems ()
 Check whether we got any items. More...
 
 addAdditionalSubItemInformation (&$object)
 Add additional information to sub item, e.g. More...
 
 getGroupedObjTypes ()
 Get grouped repository object types. More...
 
 enablePageEditing ()
 Check whether page editing is allowed for container. More...
 
 create ()
 Create. More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
Todo:
role/rbac stuff
Parameters
int$a_parent_refRef-ID of the parent object
More...
 
 update ()
 Update. More...
 
 read ()
 read More...
 
 readContainerSettings ()
 Read container settings. More...
 
 removeTranslations ()
 Remove all translations of container. More...
 
 deleteTranslation ($a_lang)
 Delete translation. More...
 
 addTranslation ($a_title, $a_desc, $a_lang, $a_lang_default)
 Add translation. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static initStudyProgrammeCache ()
 
static _getStudyProgrammeUserProgressDB ()
 Get an instance of ilStudyProgrammeUserProgressDB. More...
 
static getInstanceByRefId ($a_ref_id)
 Get an instance of ilObjStudyProgramme, use cache. More...
 
static createInstance ()
 Create an instance of ilObjStudyProgramme, put in cache. More...
 
static getAllChildren ($a_ref_id)
 Get a list of all ilObjStudyProgrammes in the subtree starting at $a_ref_id. More...
 
static setProgressesCompletedFor ($a_obj_id, $a_user_id)
 Set all progresses to completed where the object with given id is a leaf and that belong to the user. More...
 
static getCreatableSubObjects ($a_subobjects, $a_ref_id)
 Filter the list of possible subobjects for the objects that actually could be created on a concrete node. More...
 
- Static Public Member Functions inherited from ilContainer
static _getContainerDirectory ($a_id)
 Get the container directory. More...
 
static _lookupContainerSetting ($a_id, $a_keyword, $a_default_value=null)
 Lookup a container setting. More...
 
static _writeContainerSetting ($a_id, $a_keyword, $a_value)
 
static _getContainerSettings ($a_id)
 
static _deleteContainerSettings ($a_id, $a_keyword=null, $a_keyword_like=false)
 
static _exportContainerSettings (ilXmlWriter $a_xml, $a_obj_id)
 
static getCompleteDescriptions (array $objects)
 overwrites description fields to long or short description in an assoc array keys needed (obj_id and description) More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $webdir
 
 $tree
 
 $ilUser
 
 $object_factory
 
- Data Fields inherited from ilContainer
const VIEW_SESSIONS = 0
 
const VIEW_OBJECTIVE = 1
 
const VIEW_TIMING = 2
 
const VIEW_ARCHIVE = 3
 
const VIEW_SIMPLE = 4
 
const VIEW_BY_TYPE = 5
 
const VIEW_INHERIT = 6
 
const VIEW_DEFAULT = self::VIEW_BY_TYPE
 
const SORT_TITLE = 0
 
const SORT_MANUAL = 1
 
const SORT_ACTIVATION = 2
 
const SORT_INHERIT = 3
 
const SORT_CREATION = 4
 
const SORT_DIRECTION_ASC = 0
 
const SORT_DIRECTION_DESC = 1
 
const SORT_NEW_ITEMS_POSITION_TOP = 0
 
const SORT_NEW_ITEMS_POSITION_BOTTOM = 1
 
const SORT_NEW_ITEMS_ORDER_TITLE = 0
 
const SORT_NEW_ITEMS_ORDER_CREATION = 1
 
const SORT_NEW_ITEMS_ORDER_ACTIVATION = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Static Public Attributes

static $study_programme_cache = null
 
- Static Public Attributes inherited from ilContainer
static $data_preloaded = false
 

Protected Member Functions

 clearParentCache ()
 Clear the cached parent to query it again at the tree. More...
 
 clearChildrenCache ()
 Clear the cached children. More...
 
 clearLPChildrenCache ()
 Clear the cached lp children. More...
 
 readSettings ()
 Load Settings from DB. More...
 
 createSettings ()
 Create new settings object. More...
 
 updateSettings ()
 Update settings in DB. More...
 
 deleteSettings ()
 Delete settings from DB. More...
 
 deleteAssignments ()
 Delete all assignments from the DB. More...
 
 throwIfNotInTree ()
 Helper function to check, weather object is in tree. More...
 
 nodeInserted (ilObjStudyProgramme $a_prg)
 Clears child chache and adds progress for new node. More...
 
 updateLastChange ()
 Update last change timestamp on this node and its parents. More...
 
 getIdsFromNodesOnPathFromRootToHere ()
 Get the ids from the nodes in the path leading from the root node of this program to this node, including the id of this node. More...
 
 getAssignmentsRaw ()
 Get model objects for the assignments on this programm. More...
 

Static Protected Member Functions

static setProgressesCompletedIfParentIsProgrammeInLPCompletedMode ($a_ref_id, $a_obj_id, $a_user_id)
 
static getParentId (ilObject $a_object)
 Get the obj id of the parent object for the given object. More...
 

Protected Attributes

 $settings
 
 $parent
 
 $children
 
 $lp_children
 
 $sp_user_progress_db
 
- Protected Attributes inherited from ilContainer
 $db
 
 $log
 
 $access
 
 $error
 
 $rbacsystem
 
 $tree
 
 $user
 
 $obj_definition
 
 $order_type = 0
 
 $hiddenfilesfound = false
 
 $news_timeline = false
 
 $news_timeline_auto_entries = false
 
 $setting
 
 $obj_trans = null
 
- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgramme::__construct (   $a_id = 0,
  $a_call_by_reference = true 
)

ATTENTION: After using the constructor the object won't be in the cache.

This could lead to unexpected behaviour when using the tree navigation.

Parameters
int$a_id
bool$a_call_by_reference

Reimplemented from ilContainer.

Definition at line 47 of file class.ilObjStudyProgramme.php.

48 {
49 $this->type = "prg";
50 $this->settings = null;
51 parent::__construct($a_id, $a_call_by_reference);
52
53 $this->clearParentCache();
54 $this->clearChildrenCache();
55 $this->clearLPChildrenCache();
56
57 global $DIC;
58 $tree = $DIC['tree'];
59 $ilUser = $DIC['ilUser'];
60 $this->webdir = $DIC->filesystem()->web();
61 $this->tree = $tree;
62 $this->ilUser = $ilUser;
63
64 $this->object_factory = ilObjectFactoryWrapper::singleton();
66 }
clearLPChildrenCache()
Clear the cached lp children.
clearParentCache()
Clear the cached parent to query it again at the tree.
clearChildrenCache()
Clear the cached children.
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, $ilUser, $tree, clearChildrenCache(), clearLPChildrenCache(), clearParentCache(), initStudyProgrammeCache(), settings(), and ilObjectFactoryWrapper\singleton().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getStudyProgrammeUserProgressDB()

static ilObjStudyProgramme::_getStudyProgrammeUserProgressDB ( )
static

Get an instance of ilStudyProgrammeUserProgressDB.

Returns
ilStudyProgrammeUserProgressDB

Definition at line 93 of file class.ilObjStudyProgramme.php.

94 {
95 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgressDB.php");
96 static $sp_user_progress_db = null;
97 if ($sp_user_progress_db === null) {
99 }
101 }
Storage implementation for ilStudyProgrammeUserProgress.

References $sp_user_progress_db.

Referenced by ilObjStudyProgrammeAccess\checkCondition(), ilObjStudyProgrammeGUI\executeCommand(), ilStudyProgrammeUserAssignment\getInstance(), ilStudyProgrammeUserAssignment\getInstancesForProgram(), and ilStudyProgrammeUserAssignment\getInstancesOfUser().

+ Here is the caller graph for this function:

◆ addLeaf()

ilObjStudyProgramme::addLeaf (   $a_leaf)

Insert a leaf in this object.

Throws when object already contain ilObjStudyProgrammes as children. Throws when this object is not in tree.

Exceptions
ilStudyProgrammeTreeException
Returns
$this

Definition at line 840 of file class.ilObjStudyProgramme.php.

841 {
842 $this->throwIfNotInTree();
843
844 if ($this->hasChildren()) {
845 throw new ilStudyProgrammeTreeException("Program already contains other programm nodes.");
846 }
847
848 if ($a_leaf->getRefId() === null) {
849 $a_leaf->createReference();
850 }
851 $a_leaf->putInTree($this->getRefId());
852 $this->clearLPChildrenCache();
853
855 $this->update();
856
857 return $this;
858 }
throwIfNotInTree()
Helper function to check, weather object is in tree.
hasChildren()
Does this StudyProgramme have other ilObjStudyProgrammes as children?
getRefId()
get reference id @access public
Exception is thrown when invariants on the program tree would be violated by manipulation of tree.

References clearLPChildrenCache(), ilObject\getRefId(), hasChildren(), ilStudyProgramme\MODE_LP_COMPLETED, settings(), throwIfNotInTree(), and update().

+ Here is the call graph for this function:

◆ addMissingProgresses()

ilObjStudyProgramme::addMissingProgresses ( )

Add missing progress records for all assignments of this programm.

Use this after the structure of the programme was modified.

Returns
null

Definition at line 1128 of file class.ilObjStudyProgramme.php.

1129 {
1130 foreach ($this->getAssignments() as $ass) {
1131 $ass->addMissingProgresses();
1132 }
1133 }
getAssignments()
Get all assignments to this program or any node above.

References getAssignments().

Referenced by nodeInserted().

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

◆ addNode()

ilObjStudyProgramme::addNode ( ilObjStudyProgramme  $a_prg)

Inserts another ilObjStudyProgramme in this object.

Throws when object already contains non ilObjStudyProgrammes as children. Throws when $a_prg already is in the tree. Throws when this object is not in tree.

Exceptions
ilStudyProgrammeTreeException
Returns
$this

Definition at line 729 of file class.ilObjStudyProgramme.php.

730 {
731 $this->throwIfNotInTree();
732
734 throw new ilStudyProgrammeTreeException("Program already contains leafs.");
735 }
736
737 if ($this->tree->isInTree($a_prg->getRefId())) {
738 throw new ilStudyProgrammeTreeException("Other program already is in tree.");
739 }
740
741 if ($a_prg->getRefId() === null) {
742 $a_prg->createReference();
743 }
744 $a_prg->putInTree($this->getRefId());
745 return $this;
746 }
putInTree($a_parent_ref)
Overwritten from ilObject.
createReference()
creates reference for object

References ilObject\createReference(), getLPMode(), ilObject\getRefId(), ilStudyProgramme\MODE_LP_COMPLETED, putInTree(), and throwIfNotInTree().

+ Here is the call graph for this function:

◆ adjustLPMode()

ilObjStudyProgramme::adjustLPMode ( )

Adjust the lp mode to match current state of tree:

If there are any non programme children, the mode is MODE_LP_COMPLETED, otherwise its MODE_POINTS.

Exceptions
ilExceptionwhen programme is not in draft mode.

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

339 {
340 if ($this->getAmountOfLPChildren() > 0) {
342 ->update();
343 } else {
344 if ($this->getAmountOfChildren() > 0) {
345 $this->settings->setLPMode(ilStudyProgramme::MODE_POINTS)
346 ->update();
347 } else {
349 ->update();
350 }
351 }
352 }
getAmountOfChildren()
Get the amount of other StudyProgrammes this StudyProgramme has as children.
getAmountOfLPChildren()
Get the amount of leafs, the study programme contains.

References getAmountOfChildren(), getAmountOfLPChildren(), ilStudyProgramme\MODE_LP_COMPLETED, ilStudyProgramme\MODE_POINTS, ilStudyProgramme\MODE_UNDEFINED, and settings().

+ Here is the call graph for this function:

◆ applyToSubTreeNodes()

ilObjStudyProgramme::applyToSubTreeNodes ( Closure  $fun)

Apply the given Closure to every node in the subtree starting at this object.

When the closure returns false, the underlying nodes won't be visited.

Throws when this object is not in tree.

Parameters
Closure$fun- An anonymus function taking an ilObjStudyProgramme as parameter.

Definition at line 674 of file class.ilObjStudyProgramme.php.

675 {
676 $this->throwIfNotInTree();
677
678 if ($fun($this) !== false) {
679 foreach ($this->getChildren() as $child) {
680 $child->applyToSubTreeNodes($fun);
681 }
682 }
683 }
getChildren()
Get all ilObjStudyProgrammes that are direct children of this object.

References getChildren(), and throwIfNotInTree().

Referenced by assignUser().

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

◆ assignUser()

ilObjStudyProgramme::assignUser (   $a_usr_id,
  $a_assigning_usr_id = null 
)

Assign a user to this node at the study program.

Throws when node is in DRAFT or OUTDATED status. Throws when there are no settings for the program.

TODO: Should it be allowed to assign inactive users?

Exceptions
ilException
Parameters
int$a_usr_id
int  |  null$a_assigning_usr_id- defaults to global ilUser
Returns
ilStudyProgrammeUserAssignment

Definition at line 938 of file class.ilObjStudyProgramme.php.

939 {
940 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
941 require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAssignment.php");
942 require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeProgress.php");
943 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeEvents.php");
944
945 if ($this->settings === null) {
946 throw new ilException("ilObjStudyProgramme::assignUser: Program was not properly created.'");
947 }
948
950 throw new ilException("ilObjStudyProgramme::assignUser: Can't assign user to program '"
951 . $this->getId() . "', since it's not in active status.");
952 }
953
954 if ($a_assigning_usr_id === null) {
955 $a_assigning_usr_id = $this->ilUser->getId();
956 }
957
958 $ass_mod = ilStudyProgrammeAssignment::createFor($this->settings, $a_usr_id, $a_assigning_usr_id);
960
961 $this->applyToSubTreeNodes(function (ilObjStudyProgramme $node) use ($ass_mod, $a_assigning_usr_id) {
962 $progress = $node->createProgressForAssignment($ass_mod);
964 $progress->setStatus(ilStudyProgrammeProgress::STATUS_NOT_RELEVANT)
965 ->update();
966 }
967 });
968
970
971 return $ass;
972 }
Base class for ILIAS Exception handling.
Class ilObjStudyProgramme.
createProgressForAssignment(ilStudyProgrammeAssignment $ass)
Create a progress on this programme for the given assignment.
getStudyProgrammeUserProgressDB()
Get a (cached) instance of ilStudyProgrammeUserProgressDB.
applyToSubTreeNodes(Closure $fun)
Apply the given Closure to every node in the subtree starting at this object.
getId()
get object id @access public
static createFor(ilStudyProgramme $a_prg, $a_usr_id, $a_assigning_usr_id)
Create new assignment object for study program and user.
static userAssigned(ilStudyProgrammeUserAssignment $a_assignment)
Represents one assignment of a user to a study programme.

References applyToSubTreeNodes(), ilStudyProgrammeAssignment\createFor(), createProgressForAssignment(), ilObject\getId(), getStatus(), getStudyProgrammeUserProgressDB(), settings(), ilStudyProgramme\STATUS_ACTIVE, and ilStudyProgrammeEvents\userAssigned().

+ Here is the call graph for this function:

◆ canBeRemoved()

ilObjStudyProgramme::canBeRemoved ( )

Check weather a node can be removed.

This is allowed when all progresses on the node are marked as not relevant programmatically.

Returns
bool

Definition at line 818 of file class.ilObjStudyProgramme.php.

819 {
820 foreach ($this->getProgresses() as $progress) {
821 if ($progress->getStatus() != ilStudyProgrammeProgress::STATUS_NOT_RELEVANT) {
822 return false;
823 }
824 if ($progress->getLastChangeBy() !== null) {
825 return false;
826 }
827 }
828 return true;
829 }
getProgresses()
Get all progresses on this node.

References getProgresses(), and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

Referenced by removeNode().

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

◆ clearChildrenCache()

ilObjStudyProgramme::clearChildrenCache ( )
protected

Clear the cached children.

Definition at line 116 of file class.ilObjStudyProgramme.php.

117 {
118 $this->children = null;
119 }

Referenced by __construct(), moveTo(), nodeInserted(), and removeNode().

+ Here is the caller graph for this function:

◆ clearLPChildrenCache()

ilObjStudyProgramme::clearLPChildrenCache ( )
protected

Clear the cached lp children.

Definition at line 124 of file class.ilObjStudyProgramme.php.

125 {
126 $this->lp_children = null;
127 }

Referenced by __construct(), addLeaf(), moveTo(), and removeLeaf().

+ Here is the caller graph for this function:

◆ clearParentCache()

ilObjStudyProgramme::clearParentCache ( )
protected

Clear the cached parent to query it again at the tree.

Definition at line 107 of file class.ilObjStudyProgramme.php.

108 {
109 // This is not initialized, but we need null if there is no parent.
110 $this->parent = false;
111 }

Referenced by __construct(), moveTo(), and removeNode().

+ Here is the caller graph for this function:

◆ create()

ilObjStudyProgramme::create ( )

Create.

Reimplemented from ilContainer.

Definition at line 236 of file class.ilObjStudyProgramme.php.

237 {
238 $id = parent::create();
239 $this->createSettings();
240
241 return $id;
242 }
createSettings()
Create new settings object.

References ilObject\$id, and createSettings().

+ Here is the call graph for this function:

◆ createInstance()

◆ createProgressForAssignment()

ilObjStudyProgramme::createProgressForAssignment ( ilStudyProgrammeAssignment  $ass)

Create a progress on this programme for the given assignment.

Parameters
ilStudyProgrammeAssignment
Returns
ilStudyProgrammeProgress

Definition at line 1091 of file class.ilObjStudyProgramme.php.

1092 {
1093 return ilStudyProgrammeProgress::createFor($this->settings, $ass);
1094 }
static createFor(ilStudyProgramme $a_prg, ilStudyProgrammeAssignment $a_ass)
Create a new progress object for a given program node and assignment.

References ilStudyProgrammeProgress\createFor(), and settings().

Referenced by assignUser().

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

◆ createSettings()

ilObjStudyProgramme::createSettings ( )
protected

Create new settings object.

Throws when settings are already loaded or id is null.

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

183 {
184 if ($this->settings !== null) {
185 throw new ilException("ilObjStudyProgramme::createSettings: already loaded.");
186 }
187
188 $id = $this->getId();
189 if (!$id) {
190 throw new ilException("ilObjStudyProgramme::loadSettings: no id.");
191 }
193 }
static createForObject(ilObject $a_object)
Create new study program settings for an object.

References ilObject\$id, ilStudyProgramme\createForObject(), ilObject\getId(), and settings().

Referenced by create().

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

◆ delete()

ilObjStudyProgramme::delete ( )

Delete Study Programme and all related data.

Returns
boolean true if all object data were removed; false if only a references were removed

Reimplemented from ilContainer.

Definition at line 265 of file class.ilObjStudyProgramme.php.

266 {
267 // always call parent delete function first!!
268 if (!parent::delete()) {
269 return false;
270 }
271
272 $this->deleteSettings();
273 try {
274 $this->deleteAssignments();
275 } catch (ilStudyProgrammeTreeException $e) {
276 // This would be the case when SP is in trash (#17797)
277 }
278
279 return true;
280 }
deleteAssignments()
Delete all assignments from the DB.
deleteSettings()
Delete settings from DB.

References deleteAssignments(), and deleteSettings().

+ Here is the call graph for this function:

◆ deleteAssignments()

ilObjStudyProgramme::deleteAssignments ( )
protected

Delete all assignments from the DB.

Definition at line 222 of file class.ilObjStudyProgramme.php.

223 {
224 foreach ($this->getAssignments() as $ass) {
225 $ass->delete();
226 }
227 }

References getAssignments().

Referenced by delete().

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

◆ deleteSettings()

ilObjStudyProgramme::deleteSettings ( )
protected

Delete settings from DB.

Throws when settings are not loaded.

Definition at line 211 of file class.ilObjStudyProgramme.php.

212 {
213 if ($this->settings === null) {
214 throw new Exception("ilObjStudyProgramme::deleteSettings: no settings loaded.");
215 }
216 $this->settings->delete();
217 }

References settings().

Referenced by delete().

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

◆ getAllChildren()

static ilObjStudyProgramme::getAllChildren (   $a_ref_id)
static

Get a list of all ilObjStudyProgrammes in the subtree starting at $a_ref_id.

Throws when object is not in tree.

Parameters
int$a_ref_id
Returns
[ilObjStudyProgramme]

Definition at line 439 of file class.ilObjStudyProgramme.php.

440 {
441 $ret = array();
442 $root = self::getInstanceByRefId($a_ref_id);
443 $root_id = $root->getId();
444 $root->applyToSubTreeNodes(function ($prg) use (&$ret, $root_id) {
445 // exclude root node of subtree.
446 if ($prg->getId() == $root_id) {
447 return;
448 }
449 $ret[] = $prg;
450 });
451 return $ret;
452 }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
$ret
Definition: parser.php:6
$root
Definition: sabredav.php:45

References $ret, $root, and getInstanceByRefId().

Referenced by ilObjStudyProgrammeTreeGUI\confirmedDelete(), ilObjStudyProgrammeTest\testMoveTo(), and ilObjStudyProgrammeTest\testTreeGetChildren().

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

◆ getAmountOfAssignmentsOf()

ilObjStudyProgramme::getAmountOfAssignmentsOf (   $a_user_id)

Get the amount of assignments a user has on this program node or any node above.

Parameters
int$a_user_id
Returns
int

Definition at line 1017 of file class.ilObjStudyProgramme.php.

1018 {
1019 return count($this->getAssignmentsOf($a_user_id));
1020 }
getAssignmentsOf($a_user_id)
Get the assignments of user at this program or any node above.

References getAssignmentsOf().

Referenced by hasAssignmentOf().

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

◆ getAmountOfChildren()

ilObjStudyProgramme::getAmountOfChildren ( )

Get the amount of other StudyProgrammes this StudyProgramme has as children.

Throws when this object is not in tree.

Returns
int

Definition at line 542 of file class.ilObjStudyProgramme.php.

543 {
544 return count($this->getChildren());
545 }

References getChildren().

Referenced by adjustLPMode(), and hasChildren().

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

◆ getAmountOfLPChildren()

ilObjStudyProgramme::getAmountOfLPChildren ( )

Get the amount of leafs, the study programme contains.

Throws when this object is not in tree.

Definition at line 632 of file class.ilObjStudyProgramme.php.

633 {
634 return count($this->getLPChildren());
635 }
getLPChildren()
Get the leafs the study programme contains.

References getLPChildren().

Referenced by adjustLPMode(), and hasLPChildren().

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

◆ getAssignments()

ilObjStudyProgramme::getAssignments ( )

Get all assignments to this program or any node above.

Returns
[ilStudyProgrammeUserAssignment]

Definition at line 1050 of file class.ilObjStudyProgramme.php.

1051 {
1052 return array_map(function ($ass) {
1054 }, array_values($this->getAssignmentsRaw())); // use array values since we want keys 0...
1055 }
getAssignmentsRaw()
Get model objects for the assignments on this programm.

References getAssignmentsRaw(), and getStudyProgrammeUserProgressDB().

Referenced by addMissingProgresses(), deleteAssignments(), and hasAssignments().

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

◆ getAssignmentsOf()

ilObjStudyProgramme::getAssignmentsOf (   $a_user_id)

Get the assignments of user at this program or any node above.

The assignments are ordered by last_change, where the most recently changed assignments is the first one.

Parameters
int$a_user_id
Returns
[ilStudyProgrammeUserAssignment]

Definition at line 1030 of file class.ilObjStudyProgramme.php.

1031 {
1032 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
1033
1034 $prg_ids = $this->getIdsFromNodesOnPathFromRootToHere();
1035 $assignments = ilStudyProgrammeAssignment::where(array( "usr_id" => $a_user_id
1036 , "root_prg_id" => $prg_ids
1037 ))
1038 ->orderBy("last_change", "DESC")
1039 ->get();
1040 return array_map(function ($ass) {
1042 }, array_values($assignments)); // use array values since we want keys 0...
1043 }
static where($where, $operator=null)
getIdsFromNodesOnPathFromRootToHere()
Get the ids from the nodes in the path leading from the root node of this program to this node,...

References getIdsFromNodesOnPathFromRootToHere(), getStudyProgrammeUserProgressDB(), and ActiveRecord\where().

Referenced by getAmountOfAssignmentsOf().

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

◆ getAssignmentsRaw()

ilObjStudyProgramme::getAssignmentsRaw ( )
protected

Get model objects for the assignments on this programm.

Definition at line 1268 of file class.ilObjStudyProgramme.php.

1269 {
1270 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
1271 $prg_ids = $this->getIdsFromNodesOnPathFromRootToHere();
1272 return ilStudyProgrammeAssignment::where(array( "root_prg_id" => $prg_ids))
1273 ->orderBy("last_change", "DESC")
1274 ->get();
1275 }

References getIdsFromNodesOnPathFromRootToHere(), and ActiveRecord\where().

Referenced by getAssignments().

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

◆ getChildren()

ilObjStudyProgramme::getChildren ( )

Get all ilObjStudyProgrammes that are direct children of this object.

Throws when this object is not in tree.

Returns
[ilObjStudyProgramme]

Definition at line 462 of file class.ilObjStudyProgramme.php.

463 {
464 $this->throwIfNotInTree();
465
466 if ($this->children === null) {
467 $ref_ids = $this->tree->getChildsByType($this->getRefId(), "prg");
468
469 // apply container sorting to tree
470 $sorting = ilContainerSorting::_getInstance($this->getId());
471 $ref_ids = $sorting->sortItems(array('prg' => $ref_ids));
472 $ref_ids = $ref_ids['prg'];
473
474 $this->children = array_map(function ($node_data) {
475 return ilObjStudyProgramme::getInstanceByRefId($node_data["child"]);
476 }, $ref_ids);
477 }
478
479 return $this->children;
480 }
static _getInstance($a_obj_id)
get instance by obj_id

References $children, ilContainerSorting\_getInstance(), ilObject\getId(), getInstanceByRefId(), ilObject\getRefId(), and throwIfNotInTree().

Referenced by applyToSubTreeNodes(), and getAmountOfChildren().

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

◆ getCompletedCourses()

ilObjStudyProgramme::getCompletedCourses (   $a_user_id)

Get courses in this program that the given user already completed.

Parameters
int$a_user_id
Returns
array $obj_id => $ref_id

Definition at line 691 of file class.ilObjStudyProgramme.php.

692 {
693 require_once("Services/ContainerReference/classes/class.ilContainerReference.php");
694 require_once("Services/Tracking/classes/class.ilLPStatus.php");
695
696 $node_data = $this->tree->getNodeData($this->getRefId());
697 $crsrs = $this->tree->getSubTree($node_data, true, "crsr");
698
699 $completed_crss = array();
700 foreach ($crsrs as $ref) {
701 $crs_id = ilContainerReference::_lookupTargetId($ref["obj_id"]);
702 if (ilLPStatus::_hasUserCompleted($crs_id, $a_user_id)) {
703 $completed_crss[] = array( "crs_id" => $crs_id
704 , "prg_ref_id" => $ref["parent"]
705 , "crsr_ref_id" => $ref["child"]
706 , "crsr_id" => $ref["obj_id"]
707 , "title" => ilContainerReference::_lookupTargetTitle($ref["obj_id"])
708 );
709 }
710 }
711
712 return $completed_crss;
713 }
static _lookupTargetId($a_obj_id)
lookup target id
static _lookupTargetTitle($a_obj_id)
Lookup target title.
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.

References ilLPStatus\_hasUserCompleted(), ilContainerReference\_lookupTargetId(), ilContainerReference\_lookupTargetTitle(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ getCreatableSubObjects()

static ilObjStudyProgramme::getCreatableSubObjects (   $a_subobjects,
  $a_ref_id 
)
static

Filter the list of possible subobjects for the objects that actually could be created on a concrete node.

Will be called by ilObjDefinition::getCreatableSubObjects.

Parameters
array$a_subobjects
int$a_ref_id
Returns
array

Definition at line 1388 of file class.ilObjStudyProgramme.php.

1389 {
1390 if ($a_ref_id === null) {
1391 return $a_subobjects;
1392 }
1393
1394 if (ilObject::_lookupType($a_ref_id, true) != "prg") {
1395 throw new ilException("Ref-Id '$a_ref_id' does not belong to a study programme object.");
1396 }
1397
1399
1400 $mode = $parent->getLPMode();
1401
1402 switch ($mode) {
1404 return $a_subobjects;
1406 return array("prg" => $a_subobjects["prg"]);
1408 unset($a_subobjects["prg"]);
1409 return $a_subobjects;
1410 }
1411
1412 throw new ilException("Undefined mode for study programme: '$mode'");
1413 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References $parent, ilObject\_lookupType(), getInstanceByRefId(), ilStudyProgramme\MODE_LP_COMPLETED, ilStudyProgramme\MODE_POINTS, and ilStudyProgramme\MODE_UNDEFINED.

Referenced by ilObjectDefinition\getCreatableSubObjects(), ilObjStudyProgrammeTest\testCreatableSubObjectsRaisesOnNonProgramRef(), ilObjStudyProgrammeTest\testCreatableSubObjectsWithoutRef(), and ilObjStudyProgrammeTest\testCreateableSubObjects().

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

◆ getDepth()

ilObjStudyProgramme::getDepth ( )

Get the depth of this StudyProgramme in the tree starting at the topmost StudyProgramme (not root node of the repo tree!).

Root node has depth = 0.

Throws when this object is not in tree.

Returns
int

Definition at line 555 of file class.ilObjStudyProgramme.php.

556 {
557 $cur = $this;
558 $count = 0;
559 while ($cur = $cur->getParent()) {
560 $count++;
561 }
562 return $count;
563 }

◆ getIdsFromNodesOnPathFromRootToHere()

ilObjStudyProgramme::getIdsFromNodesOnPathFromRootToHere ( )
protected

Get the ids from the nodes in the path leading from the root node of this program to this node, including the id of this node.

Definition at line 1256 of file class.ilObjStudyProgramme.php.

1257 {
1258 $prg_ids = array_map(function ($par) {
1259 return $par->getId();
1260 }, $this->getParents());
1261 $prg_ids[] = $this->getId();
1262 return $prg_ids;
1263 }
getParents()
Get all parents of the node, where the root of the program comes first.

References ilObject\getId(), and getParents().

Referenced by getAssignmentsOf(), and getAssignmentsRaw().

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

◆ getIdsOfUsersWithCompletedProgress()

ilObjStudyProgramme::getIdsOfUsersWithCompletedProgress ( )

Get the ids of all users that have completed this programme.

Returns
int[]

Definition at line 1191 of file class.ilObjStudyProgramme.php.

1192 {
1193 $returns = array();
1194 foreach ($this->getProgresses() as $progress) {
1195 if ($progress->isSuccessful()) {
1196 $returns[] = $progress->getUserId();
1197 }
1198 }
1199 return array_unique($returns);
1200 }

References getProgresses().

+ Here is the call graph for this function:

◆ getIdsOfUsersWithFailedProgress()

ilObjStudyProgramme::getIdsOfUsersWithFailedProgress ( )

Get the ids of all users that have failed this programme.

Returns
int[]

Definition at line 1207 of file class.ilObjStudyProgramme.php.

1208 {
1209 $returns = array();
1210 foreach ($this->getProgresses() as $progress) {
1211 $progress->recalculateFailedToDeadline();
1212 if ($progress->isFailed()) {
1213 $returns[] = $progress->getUserId();
1214 }
1215 }
1216 return array_unique($returns);
1217 }

References getProgresses().

+ Here is the call graph for this function:

◆ getIdsOfUsersWithNotCompletedAndRelevantProgress()

ilObjStudyProgramme::getIdsOfUsersWithNotCompletedAndRelevantProgress ( )

Get the ids of all users that have not completed this programme but have a relevant progress on it.

Returns
int[]

Definition at line 1225 of file class.ilObjStudyProgramme.php.

1226 {
1227 $returns = array();
1228 foreach ($this->getProgresses() as $progress) {
1229 if ($progress->isRelevant() && !$progress->isSuccessful()) {
1230 $returns[] = $progress->getUserId();
1231 }
1232 }
1233 return array_unique($returns);
1234 }

References getProgresses().

+ Here is the call graph for this function:

◆ getIdsOfUsersWithRelevantProgress()

ilObjStudyProgramme::getIdsOfUsersWithRelevantProgress ( )

Get the ids of all users that have a relevant progress at this programme.

Returns
int[]

Definition at line 1175 of file class.ilObjStudyProgramme.php.

1176 {
1177 $returns = array();
1178 foreach ($this->getProgresses() as $progress) {
1179 if ($progress->isRelevant()) {
1180 $returns[] = $progress->getUserId();
1181 }
1182 }
1183 return array_unique($returns);
1184 }

References getProgresses().

+ Here is the call graph for this function:

◆ getInstanceByRefId()

static ilObjStudyProgramme::getInstanceByRefId (   $a_ref_id)
static

◆ getLastChange()

ilObjStudyProgramme::getLastChange ( )

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

Returns
ilDateTime

Definition at line 291 of file class.ilObjStudyProgramme.php.

292 {
293 return $this->settings->getLastChange();
294 }

References settings().

+ Here is the call graph for this function:

◆ getLPChildren()

ilObjStudyProgramme::getLPChildren ( )

Get the leafs the study programme contains.

Throws when this object is not in tree.

Returns
ilStudyProgrammeLeaf[]

Definition at line 586 of file class.ilObjStudyProgramme.php.

587 {
588 $this->throwIfNotInTree();
589
590 if ($this->lp_children === null) {
591 $this->lp_children = array();
592
593 // TODO: find a better way to get all elements except StudyProgramme-children
594 $ref_ids = $this->tree->getChildsByType($this->getRefId(), "crsr");
595
596 // apply container sorting to tree
597 $sorting = ilContainerSorting::_getInstance($this->getId());
598 $ref_ids = $sorting->sortItems(array('crs_ref' => $ref_ids));
599 $ref_ids = $ref_ids['crs_ref'];
600
601 $lp_children = array_map(function ($node_data) {
602 $lp_obj = $this->object_factory->getInstanceByRefId($node_data["child"]);
603
604 // filter out all StudyProgramme instances
605 return ($lp_obj instanceof $this)? null : $lp_obj;
606 }, $ref_ids);
607
608 $this->lp_children = array_filter($lp_children);
609 }
610 return $this->lp_children;
611 }

References $lp_children, ilContainerSorting\_getInstance(), ilObject\getId(), ilObject\getRefId(), and throwIfNotInTree().

Referenced by getAmountOfLPChildren(), and getLPChildrenIds().

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

◆ getLPChildrenIds()

ilObjStudyProgramme::getLPChildrenIds ( )

Get the ids of the leafs the program contains.

Throws when object is not in tree.

Returns
ilStudyProgrammeLeaf[]

Definition at line 620 of file class.ilObjStudyProgramme.php.

621 {
622 return array_map(function ($child) {
623 return $child->getId();
624 }, $this->getLPChildren());
625 }

References getLPChildren().

+ Here is the call graph for this function:

◆ getLPMode()

ilObjStudyProgramme::getLPMode ( )

Get the lp mode.

Returns
integer - one of ilStudyProgramme::$MODES

Definition at line 325 of file class.ilObjStudyProgramme.php.

326 {
327 return $this->settings->getLPMode();
328 }

References settings().

Referenced by addNode(), and nodeInserted().

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

◆ getParent()

ilObjStudyProgramme::getParent ( )

Get the parent ilObjStudyProgramme of this object.

Returns null if parent is no StudyProgramme.

Throws when this object is not in tree.

Returns
ilObjStudyProgramme | null

Definition at line 490 of file class.ilObjStudyProgramme.php.

491 {
492 if ($this->parent === false) {
493 $this->throwIfNotInTree();
494 $parent_data = $this->tree->getParentNodeData($this->getRefId());
495 if ($parent_data["type"] != "prg") {
496 $this->parent = null;
497 } else {
498 $this->parent = ilObjStudyProgramme::getInstanceByRefId($parent_data["ref_id"]);
499 }
500 }
501 return $this->parent;
502 }

References $parent, getInstanceByRefId(), ilObject\getRefId(), and throwIfNotInTree().

Referenced by moveTo(), removeNode(), and updateLastChange().

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

◆ getParentId()

static ilObjStudyProgramme::getParentId ( ilObject  $a_object)
staticprotected

Get the obj id of the parent object for the given object.

Returns null if object is not in the tree currently.

Returns
int | null

Definition at line 1324 of file class.ilObjStudyProgramme.php.

1325 {
1326 global $DIC;
1327 $tree = $DIC['tree'];
1328 if (!$tree->isInTree($a_object->getRefId())) {
1329 return null;
1330 }
1331
1332 $nd = $tree->getParentNodeData($a_object->getRefId());
1333 return $nd["obj_id"];
1334 }
$nd
Definition: error.php:10

References $DIC, $nd, $tree, and ilObject\getRefId().

+ Here is the call graph for this function:

◆ getParents()

ilObjStudyProgramme::getParents ( )

Get all parents of the node, where the root of the program comes first.

Returns
[ilObjStudyProgramme]

Definition at line 509 of file class.ilObjStudyProgramme.php.

510 {
511 $current = $this;
512 $parents = array();
513 while (true) {
514 $current = $current->getParent();
515 if ($current === null) {
516 return array_reverse($parents);
517 }
518 $parents[] = $current;
519 }
520 }

References $current.

Referenced by getIdsFromNodesOnPathFromRootToHere(), and getRoot().

+ Here is the caller graph for this function:

◆ getPoints()

ilObjStudyProgramme::getPoints ( )

Get the amount of points.

Returns
integer - larger than zero

Definition at line 301 of file class.ilObjStudyProgramme.php.

302 {
303 return $this->settings->getPoints();
304 }

References settings().

Referenced by ilObjStudyProgrammeSettingsGUI\buildForm().

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

◆ getProgresses()

ilObjStudyProgramme::getProgresses ( )

Get all progresses on this node.

Returns
ilStudyProgrammeUserProgress[]

Definition at line 1140 of file class.ilObjStudyProgramme.php.

1141 {
1142 return $this->getStudyProgrammeUserProgressDB()->getInstancesForProgram($this->getId());
1143 }

References ilObject\getId(), and getStudyProgrammeUserProgressDB().

Referenced by canBeRemoved(), getIdsOfUsersWithCompletedProgress(), getIdsOfUsersWithFailedProgress(), getIdsOfUsersWithNotCompletedAndRelevantProgress(), getIdsOfUsersWithRelevantProgress(), hasProgresses(), and hasRelevantProgresses().

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

◆ getProgressesOf()

ilObjStudyProgramme::getProgressesOf (   $a_user_id)

Get the progresses the user has on this node.

Parameters
int$a_user_id
Returns
ilStudyProgrammUserProgress[]

Definition at line 1102 of file class.ilObjStudyProgramme.php.

1103 {
1104 return $this->getStudyProgrammeUserProgressDB()->getInstancesForUser($this->getId(), $a_user_id);
1105 }

References ilObject\getId(), and getStudyProgrammeUserProgressDB().

+ Here is the call graph for this function:

◆ getProgressForAssignment()

ilObjStudyProgramme::getProgressForAssignment (   $a_assignment_id)

Get the progress for an assignment on this node.

Throws when assignment does not belong to this program.

Exceptions
ilException
Parameters
int$a_assignment_id
Returns
ilStudyProgrammUserProgress

Definition at line 1116 of file class.ilObjStudyProgramme.php.

1117 {
1118 return $this->getStudyProgrammeUserProgressDB()->getInstanceForAssignment($this->getId(), $a_assignment_id);
1119 }

References ilObject\getId(), and getStudyProgrammeUserProgressDB().

+ Here is the call graph for this function:

◆ getRawSettings()

ilObjStudyProgramme::getRawSettings ( )

Get the underlying model of this program.

ATTENTION: Only use the model object if you know what you are doing.

Returns
ilStudyProgramme

Definition at line 1343 of file class.ilObjStudyProgramme.php.

1344 {
1345 return $this->settings;
1346 }

References $settings.

◆ getRoot()

ilObjStudyProgramme::getRoot ( )

Get the ilObjStudyProgramme that is the root node of the tree this programme is in.

Throws when this object is not in tree.

Returns
ilObjStudyProgramme

Definition at line 573 of file class.ilObjStudyProgramme.php.

574 {
575 $parents = $this->getParents();
576 return $parents[0];
577 }

References getParents().

+ Here is the call graph for this function:

◆ getStatus()

ilObjStudyProgramme::getStatus ( )

Get the status.

Returns
integer - one of ilStudyProgramme::$STATUS

Definition at line 359 of file class.ilObjStudyProgramme.php.

360 {
361 return $this->settings->getStatus();
362 }

References settings().

Referenced by assignUser(), ilObjStudyProgrammeSettingsGUI\buildForm(), and isActive().

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

◆ getStudyProgrammeUserProgressDB()

ilObjStudyProgramme::getStudyProgrammeUserProgressDB ( )

Get a (cached) instance of ilStudyProgrammeUserProgressDB.

Returns
ilStudyProgrammeUserProgressDB

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

81 {
82 if (!$this->sp_user_progress_db) {
83 $this->sp_user_progress_db = static::_getStudyProgrammeUserProgressDB();
84 }
86 }

References $sp_user_progress_db.

Referenced by assignUser(), getAssignments(), getAssignmentsOf(), getProgresses(), getProgressesOf(), and getProgressForAssignment().

+ Here is the caller graph for this function:

◆ getSubType()

ilObjStudyProgramme::getSubType ( )

Gets the SubType Object.

Returns
ilStudyProgrammeType

Definition at line 416 of file class.ilObjStudyProgramme.php.

417 {
418 if (!in_array($this->getSubtypeId(), array("-", "0"))) {
419 $subtype_id = $this->getSubtypeId();
420 return new ilStudyProgrammeType($subtype_id);
421 }
422
423 return null;
424 }
getSubtypeId()
Gets the meta-data subtype id (allows to add additional meta-data based on a type)
Class ilStudyProgrammeType.

References getSubtypeId().

Referenced by update().

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

◆ getSubtypeId()

ilObjStudyProgramme::getSubtypeId ( )

Gets the meta-data subtype id (allows to add additional meta-data based on a type)

Returns
integer

Definition at line 392 of file class.ilObjStudyProgramme.php.

393 {
394 return $this->settings->getSubtypeId();
395 }

References settings().

Referenced by ilObjStudyProgrammeSettingsGUI\buildForm(), getSubType(), and ilObjStudyProgrammeSettingsGUI\updateWith().

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

◆ hasAssignmentOf()

ilObjStudyProgramme::hasAssignmentOf (   $a_user_id)

Check whether user is assigned to this program or any node above.

Parameters
int$a_user_id
Returns
bool

Definition at line 1005 of file class.ilObjStudyProgramme.php.

1006 {
1007 return $this->getAmountOfAssignmentsOf($a_user_id) > 0;
1008 }
getAmountOfAssignmentsOf($a_user_id)
Get the amount of assignments a user has on this program node or any node above.

References getAmountOfAssignmentsOf().

+ Here is the call graph for this function:

◆ hasAssignments()

ilObjStudyProgramme::hasAssignments ( )

Are there any assignments on this node or any node above?

Returns
bool

Definition at line 1062 of file class.ilObjStudyProgramme.php.

1063 {
1064 return count($this->getAssignments()) > 0;
1065 }

References getAssignments().

+ Here is the call graph for this function:

◆ hasChildren()

ilObjStudyProgramme::hasChildren ( )

Does this StudyProgramme have other ilObjStudyProgrammes as children?

Throws when this object is not in tree.

Returns
bool

Definition at line 529 of file class.ilObjStudyProgramme.php.

530 {
531 return $this->getAmountOfChildren() > 0;
532 }

References getAmountOfChildren().

Referenced by addLeaf().

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

◆ hasLPChildren()

ilObjStudyProgramme::hasLPChildren ( )

Does this StudyProgramme has leafs?

Throws when this object is not in tree.

Returns
bool

Definition at line 644 of file class.ilObjStudyProgramme.php.

645 {
646 return ($this->getAmountOfLPChildren() > 0);
647 }

References getAmountOfLPChildren().

+ Here is the call graph for this function:

◆ hasProgresses()

ilObjStudyProgramme::hasProgresses ( )

Are there any users that have a progress on this programme?

Returns
bool

Definition at line 1150 of file class.ilObjStudyProgramme.php.

1151 {
1152 return count($this->getProgresses()) > 0;
1153 }

References getProgresses().

+ Here is the call graph for this function:

◆ hasRelevantProgresses()

ilObjStudyProgramme::hasRelevantProgresses ( )

Are there any users that have a relevant progress on this programme?

Returns
bool

Definition at line 1160 of file class.ilObjStudyProgramme.php.

1161 {
1162 foreach ($this->getProgresses() as $progress) {
1163 if ($progress->isRelevant()) {
1164 return true;
1165 }
1166 }
1167 return false;
1168 }

References getProgresses().

+ Here is the call graph for this function:

◆ initStudyProgrammeCache()

static ilObjStudyProgramme::initStudyProgrammeCache ( )
static

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

69 {
70 if (self::$study_programme_cache === null) {
71 self::$study_programme_cache = ilObjStudyProgrammeCache::singleton();
72 }
73 }

References ilObjStudyProgrammeCache\singleton().

Referenced by __construct(), getInstanceByRefId(), and setProgressesCompletedIfParentIsProgrammeInLPCompletedMode().

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

◆ isActive()

ilObjStudyProgramme::isActive ( )

Check whether this programme is active.

Returns
bool

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

383 {
385 }

References getStatus(), and ilStudyProgramme\STATUS_ACTIVE.

+ Here is the call graph for this function:

◆ moveTo()

ilObjStudyProgramme::moveTo ( ilObjStudyProgramme  $a_new_parent)

Move this tree node to a new parent.

Throws, when manipulation of tree is not allowed due to invariants that need to hold on the tree.

Exceptions
ilStudyProgrammeTreeException
Parameters
int$a_new_parent_ref_id
Returns
$this

Definition at line 893 of file class.ilObjStudyProgramme.php.

894 {
895 global $DIC;
896 $rbacadmin = $DIC['rbacadmin'];
897
898 if ($parent = $this->getParent()) {
899
900 // TODO: check if there some leafs in the new parent
901
902 $this->tree->moveTree($this->getRefId(), $a_new_parent->getRefId());
903 // necessary to clean up permissions
904 $rbacadmin->adjustMovedObjectPermissions($this->getRefId(), $parent->getRefId());
905
906 // TODO: lp-progress needs to be updated
907
908 // clear caches on different nodes
909 $this->clearParentCache();
910
911 $parent->clearChildrenCache();
912 $parent->clearLPChildrenCache();
913
914 $a_new_parent->clearChildrenCache();
915 $a_new_parent->clearLPChildrenCache();
916 }
917
918 return $this;
919 }
getParent()
Get the parent ilObjStudyProgramme of this object.

References $DIC, $parent, ilObject\$rbacadmin, clearChildrenCache(), clearLPChildrenCache(), clearParentCache(), getParent(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ nodeInserted()

ilObjStudyProgramme::nodeInserted ( ilObjStudyProgramme  $a_prg)
protected

Clears child chache and adds progress for new node.

Definition at line 751 of file class.ilObjStudyProgramme.php.

752 {
754 throw new ilStudyProgrammeTreeException("Program already contains leafs.");
755 }
756
757 if ($this->settings->getLPMode() !== ilStudyProgramme::MODE_POINTS) {
758 $this->settings->setLPMode(ilStudyProgramme::MODE_POINTS)
759 ->update();
760 }
761
762 $this->clearChildrenCache();
763 $this->addMissingProgresses();
764 }
addMissingProgresses()
Add missing progress records for all assignments of this programm.

References addMissingProgresses(), clearChildrenCache(), getLPMode(), ilStudyProgramme\MODE_LP_COMPLETED, ilStudyProgramme\MODE_POINTS, and settings().

+ Here is the call graph for this function:

◆ putInTree()

ilObjStudyProgramme::putInTree (   $a_parent_ref)

Overwritten from ilObject.

Calls nodeInserted on parent object if parent object is another program.

Reimplemented from ilContainer.

Definition at line 771 of file class.ilObjStudyProgramme.php.

772 {
773 $res = parent::putInTree($a_parent_ref);
774
775 if (ilObject::_lookupType($a_parent_ref, true) == "prg") {
776 $par = ilObjStudyProgramme::getInstanceByRefId($a_parent_ref);
777 $par->nodeInserted($this);
778 }
779
780 return $res;
781 }
foreach($_POST as $key=> $value) $res

References $res, ilObject\_lookupType(), and getInstanceByRefId().

Referenced by addNode().

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

◆ read()

ilObjStudyProgramme::read ( )

read

@access public

Parameters

return

Reimplemented from ilContainer.

Definition at line 229 of file class.ilObjStudyProgramme.php.

230 {
231 parent::read();
232 $this->readSettings();
233 }
readSettings()
Load Settings from DB.

References readSettings().

+ Here is the call graph for this function:

◆ readSettings()

ilObjStudyProgramme::readSettings ( )
protected

Load Settings from DB.

Throws when settings are already loaded or id is null.

Definition at line 166 of file class.ilObjStudyProgramme.php.

167 {
168 if ($this->settings !== null) {
169 throw new ilException("ilObjStudyProgramme::loadSettings: already loaded.");
170 }
171 $id = $this->getId();
172 if (!$id) {
173 throw new ilException("ilObjStudyProgramme::loadSettings: no id.");
174 }
175 $this->settings = new ilStudyProgramme($this->getId());
176 }
Class ilStudyProgramme.

References ilObject\$id, ilObject\getId(), and settings().

Referenced by read().

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

◆ removeAssignment()

ilObjStudyProgramme::removeAssignment ( ilStudyProgrammeUserAssignment  $a_assignment)

Remove an assignment from this program.

Throws when assignment doesn't have this program as root node.

Exceptions
ilException
Returns
$this

Definition at line 982 of file class.ilObjStudyProgramme.php.

983 {
984 require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeEvents.php");
985
986 if ($a_assignment->getStudyProgramme()->getId() != $this->getId()) {
987 throw new ilException("ilObjStudyProgramme::removeAssignment: Assignment '"
988 . $a_assignment->getId() . "' does not belong to study "
989 . "program '" . $this->getId() . "'.");
990 }
991
993
994 $a_assignment->delete();
995
996 return $this;
997 }
static userDeassigned(ilStudyProgrammeUserAssignment $a_assignment)
getStudyProgramme()
Get the program node where this assignment was made.
delete()
Delete the assignment from database.

References ilStudyProgrammeUserAssignment\delete(), ilStudyProgrammeUserAssignment\getId(), ilStudyProgrammeUserAssignment\getStudyProgramme(), and ilStudyProgrammeEvents\userDeassigned().

+ Here is the call graph for this function:

◆ removeLeaf()

ilObjStudyProgramme::removeLeaf (   $a_leaf)

Remove a leaf from this object.

Throws when leaf is not a child of this object. Throws, when manipulation of tree is not allowed due to invariants that need to hold on the tree.

Exceptions
ilException
ilStudyProgrammeTreeException
Returns
$this

Definition at line 870 of file class.ilObjStudyProgramme.php.

871 {
872 if (self::getParentId($a_leaf) !== $this->getId()) {
873 throw new ilStudyProgrammeTreeException("This is no parent of the given leaf node.");
874 }
875
876 $node_data = $this->tree->getNodeData($a_leaf->getRefId());
877 $this->tree->deleteTree($node_data);
878 $this->clearLPChildrenCache();
879
880 return $this;
881 }

References clearLPChildrenCache(), and ilObject\getId().

+ Here is the call graph for this function:

◆ removeNode()

ilObjStudyProgramme::removeNode ( ilObjStudyProgramme  $a_prg)

Remove a node from this object.

Throws when node is no child of the object. Throws, when manipulation of tree is not allowed due to invariants that need to hold on the tree.

Exceptions
ilException
ilStudyProgrammTreeException
Returns
$this

Definition at line 793 of file class.ilObjStudyProgramme.php.

794 {
795 if ($a_prg->getParent()->getId() !== $this->getId()) {
796 throw new ilStudyProgrammeTreeException("This is no parent of the given programm.");
797 }
798
799 if (!$a_prg->canBeRemoved()) {
800 throw new ilStudyProgrammeTreeException("The node has relevant assignments.");
801 }
802
803 // *sigh*...
804 $node_data = $this->tree->getNodeData($a_prg->getRefId());
805 $this->tree->deleteTree($node_data);
806 $a_prg->clearParentCache();
807 $this->clearChildrenCache();
808
809 return $this;
810 }
canBeRemoved()
Check weather a node can be removed.

References canBeRemoved(), clearChildrenCache(), clearParentCache(), getParent(), and ilObject\getRefId().

+ Here is the call graph for this function:

◆ setPoints()

ilObjStudyProgramme::setPoints (   $a_points)

Set the amount of points.

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

Definition at line 313 of file class.ilObjStudyProgramme.php.

314 {
315 $this->settings->setPoints($a_points);
316 $this->updateLastChange();
317 return $this;
318 }
updateLastChange()
Update last change timestamp on this node and its parents.

References settings(), and updateLastChange().

Referenced by ilObjStudyProgrammeSettingsGUI\updateWith().

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

◆ setProgressesCompletedFor()

static ilObjStudyProgramme::setProgressesCompletedFor (   $a_obj_id,
  $a_user_id 
)
static

Set all progresses to completed where the object with given id is a leaf and that belong to the user.

Definition at line 1281 of file class.ilObjStudyProgramme.php.

1282 {
1283 // We only use courses via crs_refs
1284 $type = ilObject::_lookupType($a_obj_id);
1285 if ($type == "crs") {
1286 require_once("Services/ContainerReference/classes/class.ilContainerReference.php");
1287 $crs_reference_obj_ids = ilContainerReference::_lookupSourceIds($a_obj_id);
1288 foreach ($crs_reference_obj_ids as $obj_id) {
1289 foreach (ilObject::_getAllReferences($obj_id) as $ref_id) {
1291 }
1292 }
1293 } else {
1294 foreach (ilObject::_getAllReferences($a_obj_id) as $ref_id) {
1296 }
1297 }
1298 }
static _lookupSourceIds($a_target_id)
Get ids of all container references that target the object with the given id.
static setProgressesCompletedIfParentIsProgrammeInLPCompletedMode($a_ref_id, $a_obj_id, $a_user_id)
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\$ref_id, ilObject\$type, ilObject\_getAllReferences(), ilContainerReference\_lookupSourceIds(), ilObject\_lookupType(), and setProgressesCompletedIfParentIsProgrammeInLPCompletedMode().

Referenced by ilStudyProgrammeAppEventListener\onServiceTrackingUpdateStatus().

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

◆ setProgressesCompletedIfParentIsProgrammeInLPCompletedMode()

static ilObjStudyProgramme::setProgressesCompletedIfParentIsProgrammeInLPCompletedMode (   $a_ref_id,
  $a_obj_id,
  $a_user_id 
)
staticprotected

Definition at line 1300 of file class.ilObjStudyProgramme.php.

1301 {
1302 global $DIC; // TODO: replace this by a settable static for testing purpose?
1303 $tree = $DIC['tree'];
1304 $node_data = $tree->getParentNodeData($a_ref_id);
1305 if ($node_data["type"] !== "prg") {
1306 return;
1307 }
1309 $prg = ilObjStudyProgramme::getInstanceByRefId($node_data["child"]);
1310 if ($prg->getLPMode() != ilStudyProgramme::MODE_LP_COMPLETED) {
1311 return;
1312 }
1313 foreach ($prg->getProgressesOf($a_user_id) as $progress) {
1314 $progress->setLPCompleted($a_obj_id, $a_user_id);
1315 }
1316 }

References $DIC, $tree, getInstanceByRefId(), initStudyProgrammeCache(), and ilStudyProgramme\MODE_LP_COMPLETED.

Referenced by setProgressesCompletedFor().

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

◆ setStatus()

ilObjStudyProgramme::setStatus (   $a_status)

Set the status of the node.

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

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

371 {
372 $this->settings->setStatus($a_status);
373 $this->updateLastChange();
374 return $this;
375 }

References settings(), and updateLastChange().

Referenced by ilObjStudyProgrammeSettingsGUI\updateWith().

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

◆ setSubtypeId()

ilObjStudyProgramme::setSubtypeId (   $a_subtype_id)

Sets the meta-data subtype id.

Parameters
$a_subtype_id
Returns
$this

Definition at line 405 of file class.ilObjStudyProgramme.php.

406 {
407 $this->settings->setSubtypeId($a_subtype_id);
408 return $this;
409 }

References settings().

Referenced by ilObjStudyProgrammeSettingsGUI\updateWith().

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

◆ throwIfNotInTree()

ilObjStudyProgramme::throwIfNotInTree ( )
protected

Helper function to check, weather object is in tree.

Throws ilStudyProgrammeTreeException if object is not in tree.

Definition at line 653 of file class.ilObjStudyProgramme.php.

654 {
655 if (!$this->tree->isInTree($this->getRefId())) {
656 throw new ilStudyProgrammeTreeException("This program is not in tree.");
657 }
658 }

Referenced by addLeaf(), addNode(), applyToSubTreeNodes(), getChildren(), getLPChildren(), and getParent().

+ Here is the caller graph for this function:

◆ update()

ilObjStudyProgramme::update ( )

Update.

Reimplemented from ilContainer.

Definition at line 245 of file class.ilObjStudyProgramme.php.

246 {
248
249 // Update selection for advanced meta data of the type
250 if ($this->getSubType()) {
251 ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', $this->getSubType()->getAssignedAdvancedMDRecordIds());
252 } else {
253 // If no type is assigned, delete relations by passing an empty array
254 ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', array());
255 }
256
257 $this->updateSettings();
258 }
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
getSubType()
Gets the SubType Object.
updateSettings()
Update settings in DB.
update($pash, $contents, Config $config)

References ilObject\getId(), getSubType(), ilAdvancedMDRecord\saveObjRecSelection(), League\Flysystem\Adapter\Polyfill\update(), and updateSettings().

Referenced by addLeaf(), updateLastChange(), and ilObjStudyProgrammeSettingsGUI\updateWith().

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

◆ updateAllAssignments()

ilObjStudyProgramme::updateAllAssignments ( )

Update all assignments to this program node.

Returns
$this

Definition at line 1072 of file class.ilObjStudyProgramme.php.

1073 {
1075 foreach ($assignments as $ass) {
1076 $ass->updateFromProgram();
1077 }
1078 return $this;
1079 }
static getInstancesForProgram($a_program_id)
Get all assignments that were made to the given program.

References ilObject\getId(), and ilStudyProgrammeUserAssignment\getInstancesForProgram().

+ Here is the call graph for this function:

◆ updateLastChange()

ilObjStudyProgramme::updateLastChange ( )
protected

Update last change timestamp on this node and its parents.

Definition at line 1243 of file class.ilObjStudyProgramme.php.

1244 {
1245 $this->settings->updateLastChange();
1246 if ($parent = $this->getParent()) {
1247 $parent->updateLastChange();
1248 }
1249 $this->update();
1250 }

References $parent, getParent(), settings(), and update().

Referenced by setPoints(), and setStatus().

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

◆ updateSettings()

ilObjStudyProgramme::updateSettings ( )
protected

Update settings in DB.

Throws when settings are not loaded.

Definition at line 199 of file class.ilObjStudyProgramme.php.

200 {
201 if ($this->settings === null) {
202 throw new ilException("ilObjStudyProgramme::updateSettings: no settings loaded.");
203 }
204 $this->settings->update();
205 }

References settings().

Referenced by update().

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

Field Documentation

◆ $children

ilObjStudyProgramme::$children
protected

Definition at line 22 of file class.ilObjStudyProgramme.php.

Referenced by getChildren().

◆ $ilUser

ilObjStudyProgramme::$ilUser

Definition at line 28 of file class.ilObjStudyProgramme.php.

Referenced by __construct().

◆ $lp_children

ilObjStudyProgramme::$lp_children
protected

Definition at line 23 of file class.ilObjStudyProgramme.php.

Referenced by getLPChildren().

◆ $object_factory

ilObjStudyProgramme::$object_factory

Definition at line 31 of file class.ilObjStudyProgramme.php.

◆ $parent

ilObjStudyProgramme::$parent
protected

◆ $settings

ilObjStudyProgramme::$settings
protected

Definition at line 20 of file class.ilObjStudyProgramme.php.

Referenced by getRawSettings().

◆ $sp_user_progress_db

ilObjStudyProgramme::$sp_user_progress_db
protected

◆ $study_programme_cache

ilObjStudyProgramme::$study_programme_cache = null
static

Definition at line 33 of file class.ilObjStudyProgramme.php.

◆ $tree

ilObjStudyProgramme::$tree

◆ $webdir

ilObjStudyProgramme::$webdir

Definition at line 26 of file class.ilObjStudyProgramme.php.


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