ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 read ()
 
 create ()
 
 update ()
 
 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...
 
 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...
 
 updateCustomIcon ()
 updates the selected custom icon in container folder by type More...
 
 saveIcons ($a_custom_icon)
 save container icons More...
 
- Public Member Functions inherited from ilContainer
 ilContainer ($a_id=0, $a_call_by_reference=true)
 Constructor public. More...
 
 createContainerDirectory ()
 Create directory for the container. More...
 
 getContainerDirectory ()
 Get the container directory. More...
 
 _getContainerDirectory ($a_id)
 Get the container directory. More...
 
 getBigIconPath ()
 Get path for big icon. More...
 
 getSmallIconPath ()
 Get path for small icon. More...
 
 getTinyIconPath ()
 Get path for tiny icon. More...
 
 getCustomIconPath ()
 Get path for custom icon. 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...
 
 _lookupContainerSetting ($a_id, $a_keyword, $a_default_value=NULL)
 Lookup a container setting. More...
 
 _writeContainerSetting ($a_id, $a_keyword, $a_value)
 
 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path More...
 
 saveIcons ($a_custom_icon)
 save container icons More...
 
 removeCustomIcon ()
 remove small icon More...
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone container settings. 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...
 
 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...
 
 update ()
 Update. More...
 
 read ()
 read More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title 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...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) 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...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type 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...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! 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) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. 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 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 _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 _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data 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 _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. 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 hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $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
 
 $ilias
 
 $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
 
 $obj_data_record
 object_data record More...
 

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
 
- Protected Attributes inherited from ilContainer
 $order_type = 0
 
 $hiddenfilesfound = false
 

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

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

References $ilUser, $tree, clearChildrenCache(), clearLPChildrenCache(), clearParentCache(), ilContainer\ilContainer(), and ilObjectFactoryWrapper\singleton().

40  {
41  $this->type = "prg";
42  $this->settings = null;
43  $this->ilContainer($a_id, $a_call_by_reference);
44 
45  $this->clearParentCache();
46  $this->clearChildrenCache();
47  $this->clearLPChildrenCache();
48 
49  global $tree, $ilUser;
50  $this->tree = $tree;
51  $this->ilUser = $ilUser;
52 
53  $this->object_factory = ilObjectFactoryWrapper::singleton();
54  self::initStudyProgrammeCache();
55  }
clearLPChildrenCache()
Clear the cached lp children.
clearChildrenCache()
Clear the cached children.
ilContainer($a_id=0, $a_call_by_reference=true)
Constructor public.
clearParentCache()
Clear the cached parent to query it again at the tree.
+ Here is the call graph for this function:

Member Function Documentation

◆ 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 759 of file class.ilObjStudyProgramme.php.

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

759  {
760  $this->throwIfNotInTree();
761 
762  if ($this->hasChildren()) {
763  throw new ilStudyProgrammeTreeException("Program already contains other programm nodes.");
764  }
765 
766  if ($a_leaf->getRefId() === null) {
767  $a_leaf->createReference();
768  }
769  $a_leaf->putInTree($this->getRefId());
770  $this->clearLPChildrenCache();
771 
772  $this->settings->setLPMode(ilStudyProgramme::MODE_LP_COMPLETED);
773  $this->update();
774 
775  return $this;
776  }
clearLPChildrenCache()
Clear the cached lp children.
hasChildren()
Does this StudyProgramme have other ilObjStudyProgrammes as children?
getRefId()
get reference id public
throwIfNotInTree()
Helper function to check, weather object is in tree.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ 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 1034 of file class.ilObjStudyProgramme.php.

References getAssignments().

Referenced by nodeInserted().

1034  {
1035  foreach ($this->getAssignments() as $ass) {
1036  $ass->addMissingProgresses();
1037  }
1038  }
getAssignments()
Get all assignments to this program or any node above.
+ 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 653 of file class.ilObjStudyProgramme.php.

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

653  {
654  $this->throwIfNotInTree();
655 
657  throw new ilStudyProgrammeTreeException("Program already contains leafs.");
658  }
659 
660  if ($this->tree->isInTree($a_prg->getRefId())) {
661  throw new ilStudyProgrammeTreeException("Other program already is in tree.");
662  }
663 
664  if ($a_prg->getRefId() === null) {
665  $a_prg->createReference();
666  }
667  $a_prg->putInTree($this->getRefId());
668  return $this;
669  }
createReference()
creates reference for object
putInTree($a_parent_ref)
Overwritten from ilObject.
getRefId()
get reference id public
throwIfNotInTree()
Helper function to check, weather object is in tree.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ 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 279 of file class.ilObjStudyProgramme.php.

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

279  {
280  if ($this->getAmountOfLPChildren() > 0) {
281  $this->settings->setLPMode(ilStudyProgramme::MODE_LP_COMPLETED)
282  ->update();
283  }
284  else {
285  if ($this->getAmountOfChildren() > 0) {
286  $this->settings->setLPMode(ilStudyProgramme::MODE_POINTS)
287  ->update();
288  }
289  else {
290  $this->settings->setLPMode(ilStudyProgramme::MODE_UNDEFINED)
291  ->update();
292  }
293  }
294  }
getAmountOfChildren()
Get the amount of other StudyProgrammes this StudyProgramme has as children.
getAmountOfLPChildren()
Get the amount of leafs, the study programme contains.
+ 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 600 of file class.ilObjStudyProgramme.php.

References getChildren(), and throwIfNotInTree().

Referenced by assignUser().

600  {
601  $this->throwIfNotInTree();
602 
603  if ($fun($this) !== false) {
604  foreach($this->getChildren() as $child) {
605  $child->applyToSubTreeNodes($fun);
606  }
607  }
608  }
getChildren()
Get all ilObjStudyProgrammes that are direct children of this object.
throwIfNotInTree()
Helper function to check, weather object is in tree.
+ 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 853 of file class.ilObjStudyProgramme.php.

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

853  {
854  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
855  require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAssignment.php");
856  require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeProgress.php");
857  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeEvents.php");
858 
859  if ($this->settings === null) {
860  throw new ilException("ilObjStudyProgramme::assignUser: Program was not properly created.'");
861  }
862 
863  if ($this->getStatus() != ilStudyProgramme::STATUS_ACTIVE) {
864  throw new ilException("ilObjStudyProgramme::assignUser: Can't assign user to program '"
865  .$this->getId()."', since it's not in active status.");
866  }
867 
868  if ($a_assigning_usr_id === null) {
869  $a_assigning_usr_id = $this->ilUser->getId();
870  }
871 
872  $ass_mod = ilStudyProgrammeAssignment::createFor($this->settings, $a_usr_id, $a_assigning_usr_id);
873  $ass = new ilStudyProgrammeUserAssignment($ass_mod);
874 
875  $this->applyToSubTreeNodes(function(ilObjStudyProgramme $node) use ($ass_mod, $a_assigning_usr_id) {
876  $progress = $node->createProgressForAssignment($ass_mod);
877  if ($node->getStatus() != ilStudyProgramme::STATUS_ACTIVE) {
879  ->update();
880  }
881  });
882 
884 
885  return $ass;
886  }
Base class for ILIAS Exception handling.
applyToSubTreeNodes(Closure $fun)
Apply the given Closure to every node in the subtree starting at this object.
static userAssigned(ilStudyProgrammeUserAssignment $a_assignment)
getId()
get object id public
Class ilObjStudyProgramme.
static createFor(ilStudyProgramme $a_prg, $a_usr_id, $a_assigning_usr_id)
Create new assignment object for study program and user.
Represents one assignment of a user to a study programme.
createProgressForAssignment(ilStudyProgrammeAssignment $ass)
Create a progress on this programme for the given assignment.
+ 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 738 of file class.ilObjStudyProgramme.php.

References getProgresses(), and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

Referenced by removeNode().

738  {
739  foreach($this->getProgresses() as $progress) {
740  if ($progress->getStatus() != ilStudyProgrammeProgress::STATUS_NOT_RELEVANT) {
741  return false;
742  }
743  if ($progress->getLastChangeBy() !== null) {
744  return false;
745  }
746  }
747  return true;
748  }
getProgresses()
Get all progresses on this node.
+ 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 74 of file class.ilObjStudyProgramme.php.

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

74  {
75  $this->children = null;
76  }
+ Here is the caller graph for this function:

◆ clearLPChildrenCache()

ilObjStudyProgramme::clearLPChildrenCache ( )
protected

Clear the cached lp children.

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

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

81  {
82  $this->lp_children = null;
83  }
+ 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 66 of file class.ilObjStudyProgramme.php.

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

66  {
67  // This is not initialized, but we need null if there is no parent.
68  $this->parent = false;
69  }
+ Here is the caller graph for this function:

◆ create()

ilObjStudyProgramme::create ( )

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

References ilObject\$id, and createSettings().

184  {
185  $id = parent::create();
186  $this->createSettings();
187 
188  return $id;
189  }
createSettings()
Create new settings object.
+ 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 998 of file class.ilObjStudyProgramme.php.

References ilStudyProgrammeProgress\createFor().

Referenced by assignUser().

998  {
999  return ilStudyProgrammeProgress::createFor($this->settings, $ass);
1000  }
static createFor(ilStudyProgramme $a_prg, ilStudyProgrammeAssignment $a_ass)
Create a new progress object for a given program node and assignment.
+ 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 135 of file class.ilObjStudyProgramme.php.

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

Referenced by create().

135  {
136  if ($this->settings !== null) {
137  throw new ilException("ilObjStudyProgramme::createSettings: already loaded.");
138  }
139 
140  $id = $this->getId();
141  if (!$id) {
142  throw new ilException("ilObjStudyProgramme::loadSettings: no id.");
143  }
144  $this->settings = ilStudyProgramme::createForObject($this);
145  }
Base class for ILIAS Exception handling.
getId()
get object id public
static createForObject(ilObject $a_object)
Create new study program settings for an object.
+ 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

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

References deleteAssignments(), and deleteSettings().

211  {
212  // always call parent delete function first!!
213  if (!parent::delete()) {
214  return false;
215  }
216 
217  $this->deleteSettings();
218  try {
219  $this->deleteAssignments();
220  } catch(ilStudyProgrammeTreeException $e) {
221  // This would be the case when SP is in trash (#17797)
222  }
223 
224  return true;
225  }
deleteSettings()
Delete settings from DB.
deleteAssignments()
Delete all assignments from the DB.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ Here is the call graph for this function:

◆ deleteAssignments()

ilObjStudyProgramme::deleteAssignments ( )
protected

Delete all assignments from the DB.

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

References getAssignments().

Referenced by delete().

172  {
173  foreach ($this->getAssignments() as $ass) {
174  $ass->delete();
175  }
176  }
getAssignments()
Get all assignments to this program or any node above.
+ 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 162 of file class.ilObjStudyProgramme.php.

Referenced by delete().

162  {
163  if ($this->settings === null) {
164  throw new Exception("ilObjStudyProgramme::deleteSettings: no settings loaded.");
165  }
166  $this->settings->delete();
167  }
+ 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 375 of file class.ilObjStudyProgramme.php.

References $ret.

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

375  {
376  $ret = array();
377  $root = self::getInstanceByRefId($a_ref_id);
378  $root_id = $root->getId();
379  $root->applyToSubTreeNodes(function($prg) use (&$ret, $root_id) {
380  // exclude root node of subtree.
381  if ($prg->getId() == $root_id) {
382  return;
383  }
384  $ret[] = $prg;
385  });
386  return $ret;
387  }
+ 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 929 of file class.ilObjStudyProgramme.php.

References getAssignmentsOf().

Referenced by hasAssignmentOf().

929  {
930  return count($this->getAssignmentsOf($a_user_id));
931  }
getAssignmentsOf($a_user_id)
Get the assignments of user at this program or any node above.
+ 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 474 of file class.ilObjStudyProgramme.php.

References getChildren().

Referenced by adjustLPMode(), and hasChildren().

474  {
475  return count($this->getChildren());
476  }
getChildren()
Get all ilObjStudyProgrammes that are direct children of this object.
+ 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 561 of file class.ilObjStudyProgramme.php.

References getLPChildren().

Referenced by adjustLPMode(), and hasLPChildren().

561  {
562  return count($this->getLPChildren());
563  }
getLPChildren()
Get the leafs the study programme contains.
+ 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 960 of file class.ilObjStudyProgramme.php.

References getAssignmentsRaw().

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

960  {
961  return array_map(function($ass) {
962  return new ilStudyProgrammeUserAssignment($ass);
963  }, array_values($this->getAssignmentsRaw())); // use array values since we want keys 0...
964  }
getAssignmentsRaw()
Get model objects for the assignments on this programm.
Represents one assignment of a user to a study programme.
+ 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 941 of file class.ilObjStudyProgramme.php.

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

Referenced by getAmountOfAssignmentsOf().

941  {
942  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
943 
944  $prg_ids = $this->getIdsFromNodesOnPathFromRootToHere();
945  $assignments = ilStudyProgrammeAssignment::where(array( "usr_id" => $a_user_id
946  , "root_prg_id" => $prg_ids
947  ))
948  ->orderBy("last_change", "DESC")
949  ->get();
950  return array_map(function($ass) {
951  return new ilStudyProgrammeUserAssignment($ass);
952  }, array_values($assignments)); // use array values since we want keys 0...
953  }
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...
Represents one assignment of a user to a study programme.
+ 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 1149 of file class.ilObjStudyProgramme.php.

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

Referenced by getAssignments().

1149  {
1150  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
1151  $prg_ids = $this->getIdsFromNodesOnPathFromRootToHere();
1152  return ilStudyProgrammeAssignment::where(array( "root_prg_id" => $prg_ids))
1153  ->orderBy("last_change", "DESC")
1154  ->get();
1155  }
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...
+ 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 397 of file class.ilObjStudyProgramme.php.

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

Referenced by applyToSubTreeNodes(), and getAmountOfChildren().

397  {
398  $this->throwIfNotInTree();
399 
400  if ($this->children === null) {
401  $ref_ids = $this->tree->getChildsByType($this->getRefId(), "prg");
402 
403  // apply container sorting to tree
404  $sorting = ilContainerSorting::_getInstance($this->getId());
405  $ref_ids = $sorting->sortItems(array('prg'=>$ref_ids));
406  $ref_ids = $ref_ids['prg'];
407 
408  $this->children = array_map(function($node_data) {
409  return ilObjStudyProgramme::getInstanceByRefId($node_data["child"]);
410  }, $ref_ids);
411  }
412 
413  return $this->children;
414  }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
getId()
get object id public
getRefId()
get reference id public
static _getInstance($a_obj_id)
get instance by obj_id
throwIfNotInTree()
Helper function to check, weather object is in tree.
+ 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 616 of file class.ilObjStudyProgramme.php.

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

616  {
617  require_once("Services/ContainerReference/classes/class.ilContainerReference.php");
618  require_once("Services/Tracking/classes/class.ilLPStatus.php");
619 
620  $node_data = $this->tree->getNodeData($this->getRefId());
621  $crsrs = $this->tree->getSubTree($node_data, true, "crsr");
622 
623  $completed_crss = array();
624  foreach ($crsrs as $ref) {
625  $crs_id = ilContainerReference::_lookupTargetId($ref["obj_id"]);
626  if (ilLPStatus::_hasUserCompleted($crs_id, $a_user_id)) {
627  $completed_crss[] = array( "crs_id" => $crs_id
628  , "prg_ref_id" => $ref["parent"]
629  , "crsr_ref_id" => $ref["child"]
630  , "crsr_id" => $ref["obj_id"]
631  , "title" => ilContainerReference::_lookupTargetTitle($ref["obj_id"])
632  );
633  }
634  }
635 
636  return $completed_crss;
637  }
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
static _lookupTargetTitle($a_obj_id)
Lookup target title.
getRefId()
get reference id public
static _lookupTargetId($a_obj_id)
lookup target id
+ 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 1256 of file class.ilObjStudyProgramme.php.

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

1256  {
1257  if ($a_ref_id === null) {
1258  return $a_subobjects;
1259  }
1260 
1261  if (ilObject::_lookupType($a_ref_id, true) != "prg") {
1262  throw new ilException("Ref-Id '$a_ref_id' does not belong to a study programme object.");
1263  }
1264 
1266 
1267  $mode = $parent->getLPMode();
1268 
1269  switch ($mode) {
1271  return $a_subobjects;
1273  return array("prg" => $a_subobjects["prg"]);
1275  unset($a_subobjects["prg"]);
1276  return $a_subobjects;
1277  }
1278 
1279  throw new ilException("Undefined mode for study programme: '$mode'");
1280  }
Base class for ILIAS Exception handling.
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ 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 486 of file class.ilObjStudyProgramme.php.

486  {
487  $cur = $this;
488  $count = 0;
489  while ($cur = $cur->getParent()) {
490  $count++;
491  }
492  return $count;
493  }

◆ 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 1138 of file class.ilObjStudyProgramme.php.

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

Referenced by getAssignmentsOf(), and getAssignmentsRaw().

1138  {
1139  $prg_ids =array_map(function($par) {
1140  return $par->getId();
1141  }, $this->getParents());
1142  $prg_ids[] = $this->getId();
1143  return $prg_ids;
1144  }
getId()
get object id public
getParents()
Get all parents of the node, where the root of the program comes first.
+ 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 1093 of file class.ilObjStudyProgramme.php.

References getProgresses().

1093  {
1094  $returns = array();
1095  foreach ($this->getProgresses() as $progress) {
1096  if ($progress->isSuccessful()) {
1097  $returns[] = $progress->getUserId();
1098  }
1099  }
1100  return array_unique($returns);
1101  }
getProgresses()
Get all progresses on this node.
+ 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 1109 of file class.ilObjStudyProgramme.php.

References getProgresses().

1109  {
1110  $returns = array();
1111  foreach ($this->getProgresses() as $progress) {
1112  if ($progress->isRelevant() && !$progress->isSuccessful()) {
1113  $returns[] = $progress->getUserId();
1114  }
1115  }
1116  return array_unique($returns);
1117  }
getProgresses()
Get all progresses on this node.
+ 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 1078 of file class.ilObjStudyProgramme.php.

References getProgresses().

1078  {
1079  $returns = array();
1080  foreach ($this->getProgresses() as $progress) {
1081  if ($progress->isRelevant()) {
1082  $returns[] = $progress->getUserId();
1083  }
1084  }
1085  return array_unique($returns);
1086  }
getProgresses()
Get all progresses on this node.
+ Here is the call graph for this function:

◆ getInstanceByRefId()

static ilObjStudyProgramme::getInstanceByRefId (   $a_ref_id)
static

Get an instance of ilObjStudyProgramme, use cache.

Parameters
int$a_ref_id
Returns
ilObjStudyProgramme

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

Referenced by ilObjStudyProgrammeAccess\_checkAccess(), getChildren(), getCreatableSubObjects(), ilObjStudyProgrammeSettingsGUI\getObject(), getParent(), ilObjStudyProgrammeTreeExplorerGUI\getRootNode(), ilStudyProgrammeUserAssignment\getStudyProgramme(), ilStudyProgrammeAppEventListener\getStudyProgramme(), ilStudyProgrammeUserProgress\getStudyProgramme(), ilObjStudyProgrammeMembersGUI\getStudyProgramme(), putInTree(), setProgressesCompletedIfParentIsProgrammeInLPCompletedMode(), ilObjStudyProgrammeTest\testDelete(), ilObjStudyProgrammeTest\testGetInstanceByRefId(), ilObjStudyProgrammeTest\testLoadByObjId(), and ilObjStudyProgrammeTest\testSettings().

92  {
93  require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgrammeCache.php");
94  if (self::$study_programme_cache === null) {
95  self::initStudyProgrammeCache();
96  }
97  return self::$study_programme_cache->getInstanceByRefId($a_ref_id);
98  }
+ Here is the caller graph for this function:

◆ getLastChange()

ilObjStudyProgramme::getLastChange ( )

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

Returns
ilDateTime

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

236  {
237  return $this->settings->getLastChange();
238  }

◆ getLPChildren()

ilObjStudyProgramme::getLPChildren ( )

Get the leafs the study programme contains.

Throws when this object is not in tree.

Returns
ilStudyProgrammeLeaf[]

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

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

Referenced by getAmountOfLPChildren(), and getLPChildrenIds().

515  {
516  $this->throwIfNotInTree();
517 
518  if ($this->lp_children === null) {
519  $this->lp_children = array();
520 
521  // TODO: find a better way to get all elements except StudyProgramme-children
522  $ref_ids = $this->tree->getChildsByType($this->getRefId(), "crsr");
523 
524  // apply container sorting to tree
525  $sorting = ilContainerSorting::_getInstance($this->getId());
526  $ref_ids = $sorting->sortItems(array('crs_ref'=>$ref_ids));
527  $ref_ids = $ref_ids['crs_ref'];
528 
529  // TODO: $this could be removed as soon as support for PHP 5.3 is dropped:
530  $self = $this;
531  $lp_children = array_map(function($node_data) use ($self) {
532  $lp_obj = $self->object_factory->getInstanceByRefId($node_data["child"]);
533 
534  // filter out all StudyProgramme instances
535  return ($lp_obj instanceof $self)? null : $lp_obj;
536  }, $ref_ids);
537 
538  $this->lp_children = array_filter($lp_children);
539  }
540  return $this->lp_children;
541  }
getId()
get object id public
getRefId()
get reference id public
static _getInstance($a_obj_id)
get instance by obj_id
throwIfNotInTree()
Helper function to check, weather object is in tree.
+ 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 550 of file class.ilObjStudyProgramme.php.

References getLPChildren().

550  {
551  return array_map(function($child) {
552  return $child->getId();
553  }, $this->getLPChildren());
554  }
getLPChildren()
Get the leafs the study programme contains.
+ Here is the call graph for this function:

◆ getLPMode()

ilObjStudyProgramme::getLPMode ( )

Get the lp mode.

Returns
integer - one of ilStudyProgramme::$MODES

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

Referenced by addNode(), and nodeInserted().

267  {
268  return $this->settings->getLPMode();
269  }
+ 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 424 of file class.ilObjStudyProgramme.php.

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

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

424  {
425  if ($this->parent === false) {
426  $this->throwIfNotInTree();
427  $parent_data = $this->tree->getParentNodeData($this->getRefId());
428  if ($parent_data["type"] != "prg") {
429  $this->parent = null;
430  }
431  else {
432  $this->parent = ilObjStudyProgramme::getInstanceByRefId($parent_data["ref_id"]);
433  }
434  }
435  return $this->parent;
436  }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
getRefId()
get reference id public
throwIfNotInTree()
Helper function to check, weather object is in tree.
+ 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 1202 of file class.ilObjStudyProgramme.php.

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

1202  {
1203  global $tree;
1204  if (!$tree->isInTree($a_object->getRefId())) {
1205  return null;
1206  }
1207 
1208  $nd = $tree->getParentNodeData($a_object->getRefId());
1209  return $nd["obj_id"];
1210  }
$nd
Definition: error.php:11
getRefId()
get reference id public
+ 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 443 of file class.ilObjStudyProgramme.php.

Referenced by getIdsFromNodesOnPathFromRootToHere(), and getRoot().

443  {
444  $current = $this;
445  $parents = array();
446  while(true) {
447  $current = $current->getParent();
448  if ($current === null) {
449  return array_reverse($parents);
450  }
451  $parents[] = $current;
452  }
453  }
+ Here is the caller graph for this function:

◆ getPoints()

ilObjStudyProgramme::getPoints ( )

Get the amount of points.

Returns
integer - larger than zero

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

245  {
246  return $this->settings->getPoints();
247  }

◆ getProgresses()

ilObjStudyProgramme::getProgresses ( )

Get all progresses on this node.

Returns
ilStudyProgrammeUserProgress[]

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

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

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

1045  {
1046  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
1048  }
getId()
get object id public
static getInstancesForProgram($a_program_id)
Get the instances for a program node.
+ 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 1008 of file class.ilObjStudyProgramme.php.

References ilObject\getId(), and ilStudyProgrammeUserProgress\getInstancesForUser().

1008  {
1009  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
1010  return ilStudyProgrammeUserProgress::getInstancesForUser($this->getId(), $a_user_id);
1011  }
static getInstancesForUser($a_program_id, $a_user_id)
Get the instances that user has on program.
getId()
get object id public
+ 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 1022 of file class.ilObjStudyProgramme.php.

References ilObject\getId(), and ilStudyProgrammeUserProgress\getInstanceForAssignment().

1022  {
1023  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
1024  return ilStudyProgrammeUserProgress::getInstanceForAssignment($this->getId(), $a_assignment_id);
1025  }
static getInstanceForAssignment($a_program_id, $a_assignment_id)
Get the instance for the assignment on the program.
getId()
get object id public
+ 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 1219 of file class.ilObjStudyProgramme.php.

References $settings.

1219  {
1220  return $this->settings;
1221  }

◆ 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 503 of file class.ilObjStudyProgramme.php.

References getParents().

503  {
504  $parents = $this->getParents();
505  return $parents[0];
506  }
getParents()
Get all parents of the node, where the root of the program comes first.
+ Here is the call graph for this function:

◆ getStatus()

ilObjStudyProgramme::getStatus ( )

Get the status.

Returns
integer - one of ilStudyProgramme::$STATUS

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

Referenced by assignUser(), and isActive().

301  {
302  return $this->settings->getStatus();
303  }
+ Here is the caller graph for this function:

◆ getSubType()

ilObjStudyProgramme::getSubType ( )

Gets the SubType Object.

Returns
ilStudyProgrammeType

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

References getSubtypeId().

Referenced by update(), and updateCustomIcon().

353  {
354  if(!in_array($this->getSubtypeId(), array("-", "0"))) {
355  $subtype_id = $this->getSubtypeId();
356  return new ilStudyProgrammeType($subtype_id);
357  }
358 
359  return null;
360  }
Class ilStudyProgrammeType.
getSubtypeId()
Gets the meta-data subtype id (allows to add additional meta-data based on a type) ...
+ 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 331 of file class.ilObjStudyProgramme.php.

Referenced by getSubType().

331  {
332  return $this->settings->getSubtypeId();
333  }
+ 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 918 of file class.ilObjStudyProgramme.php.

References getAmountOfAssignmentsOf().

918  {
919  return $this->getAmountOfAssignmentsOf($a_user_id) > 0;
920  }
getAmountOfAssignmentsOf($a_user_id)
Get the amount of assignments a user has on this program node or any node above.
+ 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 971 of file class.ilObjStudyProgramme.php.

References getAssignments().

971  {
972  return count($this->getAssignments()) > 0;
973  }
getAssignments()
Get all assignments to this program or any node above.
+ 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 462 of file class.ilObjStudyProgramme.php.

References getAmountOfChildren().

Referenced by addLeaf().

462  {
463  return $this->getAmountOfChildren() > 0;
464  }
getAmountOfChildren()
Get the amount of other StudyProgrammes this StudyProgramme has as children.
+ 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 572 of file class.ilObjStudyProgramme.php.

References getAmountOfLPChildren().

572  {
573  return ($this->getAmountOfLPChildren() > 0);
574  }
getAmountOfLPChildren()
Get the amount of leafs, the study programme contains.
+ 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 1055 of file class.ilObjStudyProgramme.php.

References getProgresses().

1055  {
1056  return count($this->getProgresses()) > 0;
1057  }
getProgresses()
Get all progresses on this node.
+ 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 1064 of file class.ilObjStudyProgramme.php.

References getProgresses().

1064  {
1065  foreach ($this->getProgresses() as $progress) {
1066  if ($progress->isRelevant()) {
1067  return true;
1068  }
1069  }
1070  return false;
1071  }
getProgresses()
Get all progresses on this node.
+ Here is the call graph for this function:

◆ initStudyProgrammeCache()

static ilObjStudyProgramme::initStudyProgrammeCache ( )
static

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

References ilObjStudyProgrammeCache\singleton().

57  {
58  if (self::$study_programme_cache === null) {
59  self::$study_programme_cache = ilObjStudyProgrammeCache::singleton();
60  }
61  }
+ Here is the call graph for this function:

◆ isActive()

ilObjStudyProgramme::isActive ( )

Check whether this programme is active.

Returns
bool

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

References getStatus(), and ilStudyProgramme\STATUS_ACTIVE.

322  {
323  return $this->getStatus() == ilStudyProgramme::STATUS_ACTIVE;
324  }
+ 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 810 of file class.ilObjStudyProgramme.php.

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

810  {
811  global $rbacadmin;
812 
813  if ($parent = $this->getParent()) {
814 
815  // TODO: check if there some leafs in the new parent
816 
817  $this->tree->moveTree($this->getRefId(), $a_new_parent->getRefId());
818  // necessary to clean up permissions
819  $rbacadmin->adjustMovedObjectPermissions($this->getRefId(), $parent->getRefId());
820 
821  // TODO: lp-progress needs to be updated
822 
823  // clear caches on different nodes
824  $this->clearParentCache();
825 
826  $parent->clearChildrenCache();
827  $parent->clearLPChildrenCache();
828 
829  $a_new_parent->clearChildrenCache();
830  $a_new_parent->clearLPChildrenCache();
831  }
832 
833  return $this;
834  }
clearLPChildrenCache()
Clear the cached lp children.
getParent()
Get the parent ilObjStudyProgramme of this object.
clearChildrenCache()
Clear the cached children.
getRefId()
get reference id public
clearParentCache()
Clear the cached parent to query it again at the tree.
+ 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 674 of file class.ilObjStudyProgramme.php.

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

674  {
676  throw new ilStudyProgrammeTreeException("Program already contains leafs.");
677  }
678 
679  if ($this->settings->getLPMode() !== ilStudyProgramme::MODE_POINTS) {
680  $this->settings->setLPMode(ilStudyProgramme::MODE_POINTS)
681  ->update();
682  }
683 
684  $this->clearChildrenCache();
685  $this->addMissingProgresses();
686  }
clearChildrenCache()
Clear the cached children.
addMissingProgresses()
Add missing progress records for all assignments of this programm.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ 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.

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

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

Referenced by addNode().

693  {
694  $res = parent::putInTree($a_parent_ref);
695 
696  if (ilObject::_lookupType($a_parent_ref, true) == "prg") {
697  $par = ilObjStudyProgramme::getInstanceByRefId($a_parent_ref);
698  $par->nodeInserted($this);
699  }
700 
701  return $res;
702  }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilObjStudyProgramme::read ( )

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

References readSettings().

178  {
179  parent::read();
180  $this->readSettings();
181  }
readSettings()
Load Settings from DB.
+ 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 120 of file class.ilObjStudyProgramme.php.

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

Referenced by read().

120  {
121  if ($this->settings !== null) {
122  throw new ilException("ilObjStudyProgramme::loadSettings: already loaded.");
123  }
124  $id = $this->getId();
125  if (!$id) {
126  throw new ilException("ilObjStudyProgramme::loadSettings: no id.");
127  }
128  $this->settings = new ilStudyProgramme($this->getId());
129  }
Base class for ILIAS Exception handling.
Class ilStudyProgramme.
getId()
get object id public
+ 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 896 of file class.ilObjStudyProgramme.php.

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

896  {
897  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeEvents.php");
898 
899  if ($a_assignment->getStudyProgramme()->getId() != $this->getId()) {
900  throw new ilException("ilObjStudyProgramme::removeAssignment: Assignment '"
901  .$a_assignment->getId()."' does not belong to study "
902  ."program '".$this->getId()."'.");
903  }
904 
906 
907  $a_assignment->delete();
908 
909  return $this;
910  }
Base class for ILIAS Exception handling.
getStudyProgramme()
Get the program node where this assignment was made.
getId()
get object id public
delete()
Delete the assignment from database.
static userDeassigned(ilStudyProgrammeUserAssignment $a_assignment)
+ 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 788 of file class.ilObjStudyProgramme.php.

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

788  {
789  if (self::getParentId($a_leaf) !== $this->getId()) {
790  throw new ilStudyProgrammeTreeException("This is no parent of the given leaf node.");
791  }
792 
793  $node_data = $this->tree->getNodeData($a_leaf->getRefId());
794  $this->tree->deleteTree($node_data);
795  $this->clearLPChildrenCache();
796 
797  return $this;
798  }
clearLPChildrenCache()
Clear the cached lp children.
getId()
get object id public
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ 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 714 of file class.ilObjStudyProgramme.php.

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

714  {
715  if ($a_prg->getParent()->getId() !== $this->getId()) {
716  throw new ilStudyProgrammeTreeException("This is no parent of the given programm.");
717  }
718 
719  if (!$a_prg->canBeRemoved()) {
720  throw new ilStudyProgrammeTreeException("The node has relevant assignments.");
721  }
722 
723  // *sigh*...
724  $node_data = $this->tree->getNodeData($a_prg->getRefId());
725  $this->tree->deleteTree($node_data);
726  $a_prg->clearParentCache();
727  $this->clearChildrenCache();
728 
729  return $this;
730  }
getParent()
Get the parent ilObjStudyProgramme of this object.
clearChildrenCache()
Clear the cached children.
getId()
get object id public
canBeRemoved()
Check weather a node can be removed.
getRefId()
get reference id public
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
clearParentCache()
Clear the cached parent to query it again at the tree.
+ Here is the call graph for this function:

◆ saveIcons()

ilObjStudyProgramme::saveIcons (   $a_custom_icon)

save container icons

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

References $ilDB, ilContainer\_writeContainerSetting(), ilContainer\createContainerDirectory(), ilContainer\getContainerDirectory(), ilObject\getId(), and ilUtil\moveUploadedFile().

Referenced by updateCustomIcon().

1290  {
1291  global $ilDB;
1292 
1293  $this->createContainerDirectory();
1294  $cont_dir = $this->getContainerDirectory();
1295  $file_name = "";
1296  if ($a_custom_icon != "")
1297  {
1298  $file_name = $cont_dir."/icon_custom.svg";
1299 
1300  ilUtil::moveUploadedFile($a_custom_icon, "icon_custom.svg", $file_name, true, "copy");
1301 
1302  if ($file_name != "" && is_file($file_name))
1303  {
1304  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 1);
1305  }
1306  else
1307  {
1308  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 0);
1309  }
1310  }
1311  }
_writeContainerSetting($a_id, $a_keyword, $a_value)
getContainerDirectory()
Get the container directory.
getId()
get object id public
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
global $ilDB
createContainerDirectory()
Create directory for the container.
+ Here is the call graph for this function:
+ Here is the caller 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 256 of file class.ilObjStudyProgramme.php.

References updateLastChange().

256  {
257  $this->settings->setPoints($a_points);
258  $this->updateLastChange();
259  return $this;
260  }
updateLastChange()
Update last change timestamp on this node and its parents.
+ Here is the call 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 1161 of file class.ilObjStudyProgramme.php.

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

Referenced by ilStudyProgrammeAppEventListener\onServiceTrackingUpdateStatus().

1161  {
1162  // We only use courses via crs_refs
1163  $type = ilObject::_lookupType($a_obj_id);
1164  if ($type == "crs") {
1165  require_once("Services/ContainerReference/classes/class.ilContainerReference.php");
1166  $crs_reference_obj_ids = ilContainerReference::_lookupSourceIds($a_obj_id);
1167  foreach ($crs_reference_obj_ids as $obj_id) {
1168  foreach(ilObject::_getAllReferences($obj_id) as $ref_id) {
1169  self::setProgressesCompletedIfParentIsProgrammeInLPCompletedMode($ref_id, $obj_id, $a_user_id);
1170  }
1171  }
1172  }
1173  else {
1174  foreach (ilObject::_getAllReferences($a_obj_id) as $ref_id) {
1175  self::setProgressesCompletedIfParentIsProgrammeInLPCompletedMode($ref_id, $a_obj_id, $a_user_id);
1176  }
1177  }
1178  }
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupSourceIds($a_target_id)
Get ids of all container references that target the object with the given id.
+ 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 1180 of file class.ilObjStudyProgramme.php.

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

1180  {
1181  global $tree; // TODO: replace this by a settable static for testing purpose?
1182  $node_data = $tree->getParentNodeData($a_ref_id);
1183  if ($node_data["type"] !== "prg") {
1184  return;
1185  }
1186  self::initStudyProgrammeCache();
1187  $prg = ilObjStudyProgramme::getInstanceByRefId($node_data["child"]);
1188  if ($prg->getLPMode() != ilStudyProgramme::MODE_LP_COMPLETED) {
1189  return;
1190  }
1191  foreach ($prg->getProgressesOf($a_user_id) as $progress) {
1192  $progress->setLPCompleted($a_obj_id, $a_user_id);
1193  }
1194  }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
+ Here is the call 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 311 of file class.ilObjStudyProgramme.php.

References updateLastChange().

311  {
312  $this->settings->setStatus($a_status);
313  $this->updateLastChange();
314  return $this;
315  }
updateLastChange()
Update last change timestamp on this node and its parents.
+ Here is the call 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 343 of file class.ilObjStudyProgramme.php.

343  {
344  $this->settings->setSubtypeId($a_subtype_id);
345  return $this;
346  }

◆ throwIfNotInTree()

ilObjStudyProgramme::throwIfNotInTree ( )
protected

Helper function to check, weather object is in tree.

Throws ilStudyProgrammeTreeException if object is not in tree.

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

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

580  {
581  if (!$this->tree->isInTree($this->getRefId())) {
582  throw new ilStudyProgrammeTreeException("This program is not in tree.");
583  }
584  }
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ Here is the caller graph for this function:

◆ update()

ilObjStudyProgramme::update ( )

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

References ilObject\getId(), getSubType(), ilAdvancedMDRecord\saveObjRecSelection(), and updateSettings().

Referenced by addLeaf(), and updateLastChange().

192  {
193  parent::update();
194 
195  // Update selection for advanced meta data of the type
196  if ($this->getSubType()) {
197  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', $this->getSubType()->getAssignedAdvancedMDRecordIds());
198  } else {
199  // If no type is assigned, delete relations by passing an empty array
200  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', array());
201  }
202 
203  $this->updateSettings();
204  }
getSubType()
Gets the SubType Object.
updateSettings()
Update settings in DB.
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
getId()
get object id public
+ 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 980 of file class.ilObjStudyProgramme.php.

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

980  {
982  foreach ($assignments as $ass) {
983  $ass->updateFromProgram();
984  }
985  return $this;
986  }
getId()
get object id public
static getInstancesForProgram($a_program_id)
Get all assignments that were made to the given program.
+ Here is the call graph for this function:

◆ updateCustomIcon()

ilObjStudyProgramme::updateCustomIcon ( )

updates the selected custom icon in container folder by type

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

References getSubType(), ilContainer\removeCustomIcon(), and saveIcons().

1227  {
1228  $subtype = $this->getSubType();
1229 
1230  if($subtype) {
1231  if(is_file($subtype->getIconPath(true))) {
1232  $icon = $subtype->getIconPath(true);
1233  $this->saveIcons($icon);
1234  } else {
1235  $this->removeCustomIcon();
1236  }
1237  } else {
1238  $this->removeCustomIcon();
1239  }
1240  }
getSubType()
Gets the SubType Object.
removeCustomIcon()
remove small icon
saveIcons($a_custom_icon)
save container icons
+ 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 1126 of file class.ilObjStudyProgramme.php.

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

Referenced by setPoints(), and setStatus().

1126  {
1127  $this->settings->updateLastChange();
1128  if ($parent = $this->getParent()) {
1129  $parent->updateLastChange();
1130  }
1131  $this->update();
1132  }
getParent()
Get the parent ilObjStudyProgramme of this object.
+ 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 151 of file class.ilObjStudyProgramme.php.

Referenced by update().

151  {
152  if ($this->settings === null) {
153  throw new ilException("ilObjStudyProgramme::updateSettings: no settings loaded.");
154  }
155  $this->settings->update();
156  }
Base class for ILIAS Exception handling.
+ Here is the caller graph for this function:

Field Documentation

◆ $children

ilObjStudyProgramme::$children
protected

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

Referenced by getChildren().

◆ $ilUser

ilObjStudyProgramme::$ilUser

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

Referenced by __construct().

◆ $lp_children

ilObjStudyProgramme::$lp_children
protected

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

Referenced by getLPChildren().

◆ $object_factory

ilObjStudyProgramme::$object_factory

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

◆ $parent

ilObjStudyProgramme::$parent
protected

◆ $settings

ilObjStudyProgramme::$settings
protected

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

Referenced by getRawSettings().

◆ $study_programme_cache

ilObjStudyProgramme::$study_programme_cache = null
static

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

◆ $tree

ilObjStudyProgramme::$tree

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