ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
 __construct ($a_id=0, $a_reference=true)
 
 createContainerDirectory ()
 Create directory for the container. More...
 
 getContainerDirectory ()
 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...
 
 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...
 
 saveIcons ($a_custom_icon)
 save container icons More...
 
 removeCustomIcon ()
 remove small icon More...
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 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...
 
 readContainerSettings ()
 Read container settings. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor 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 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 ()
 
 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...
 
 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...
 
 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...
 
 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...
 
 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 _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 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path More...
 
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 _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 type $ilDB. 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 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 _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

 $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
 

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...
 
- Static Protected Member Functions inherited from ilContainer
static fixInternalLinksAfterCopy ($a_target_id, $a_copy_id, $a_source_ref_id)
 Fix internal links after copy process. More...
 

Protected Attributes

 $settings
 
 $parent
 
 $children
 
 $lp_children
 
- Protected Attributes inherited from ilContainer
 $order_type = 0
 
 $hiddenfilesfound = false
 
 $news_timeline = false
 
 $news_timeline_auto_entries = false
 
 $setting
 

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 $DIC, $ilUser, $tree, clearChildrenCache(), clearLPChildrenCache(), clearParentCache(), settings(), and ilObjectFactoryWrapper\singleton().

40  {
41  $this->type = "prg";
42  $this->settings = null;
43  parent::__construct($a_id, $a_call_by_reference);
44 
45  $this->clearParentCache();
46  $this->clearChildrenCache();
47  $this->clearLPChildrenCache();
48 
49  global $DIC;
50  $tree = $DIC['tree'];
51  $ilUser = $DIC['ilUser'];
52  $this->tree = $tree;
53  $this->ilUser = $ilUser;
54 
55  $this->object_factory = ilObjectFactoryWrapper::singleton();
56  self::initStudyProgrammeCache();
57  }
clearLPChildrenCache()
Clear the cached lp children.
clearChildrenCache()
Clear the cached children.
settings()
Definition: settings.php:2
global $DIC
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, settings(), 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 
773  $this->update();
774 
775  return $this;
776  }
clearLPChildrenCache()
Clear the cached lp children.
hasChildren()
Does this StudyProgramme have other ilObjStudyProgrammes as children?
settings()
Definition: settings.php:2
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 1035 of file class.ilObjStudyProgramme.php.

References getAssignments().

Referenced by nodeInserted().

1035  {
1036  foreach ($this->getAssignments() as $ass) {
1037  $ass->addMissingProgresses();
1038  }
1039  }
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 281 of file class.ilObjStudyProgramme.php.

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

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

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

854  {
855  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
856  require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAssignment.php");
857  require_once("./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeProgress.php");
858  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeEvents.php");
859 
860  if ($this->settings === null) {
861  throw new ilException("ilObjStudyProgramme::assignUser: Program was not properly created.'");
862  }
863 
864  if ($this->getStatus() != ilStudyProgramme::STATUS_ACTIVE) {
865  throw new ilException("ilObjStudyProgramme::assignUser: Can't assign user to program '"
866  .$this->getId()."', since it's not in active status.");
867  }
868 
869  if ($a_assigning_usr_id === null) {
870  $a_assigning_usr_id = $this->ilUser->getId();
871  }
872 
873  $ass_mod = ilStudyProgrammeAssignment::createFor($this->settings, $a_usr_id, $a_assigning_usr_id);
874  $ass = new ilStudyProgrammeUserAssignment($ass_mod);
875 
876  $this->applyToSubTreeNodes(function(ilObjStudyProgramme $node) use ($ass_mod, $a_assigning_usr_id) {
877  $progress = $node->createProgressForAssignment($ass_mod);
878  if ($node->getStatus() != ilStudyProgramme::STATUS_ACTIVE) {
880  ->update();
881  }
882  });
883 
885 
886  return $ass;
887  }
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.
settings()
Definition: settings.php:2
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 76 of file class.ilObjStudyProgramme.php.

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

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

◆ clearLPChildrenCache()

ilObjStudyProgramme::clearLPChildrenCache ( )
protected

Clear the cached lp children.

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

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

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

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

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

◆ create()

ilObjStudyProgramme::create ( )

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

References ilObject\$id, and createSettings().

186  {
187  $id = parent::create();
188  $this->createSettings();
189 
190  return $id;
191  }
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 999 of file class.ilObjStudyProgramme.php.

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

Referenced by assignUser().

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

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

Referenced by create().

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

References deleteAssignments(), and deleteSettings().

213  {
214  // always call parent delete function first!!
215  if (!parent::delete()) {
216  return false;
217  }
218 
219  $this->deleteSettings();
220  try {
221  $this->deleteAssignments();
222  } catch(ilStudyProgrammeTreeException $e) {
223  // This would be the case when SP is in trash (#17797)
224  }
225 
226  return true;
227  }
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 174 of file class.ilObjStudyProgramme.php.

References getAssignments().

Referenced by delete().

174  {
175  foreach ($this->getAssignments() as $ass) {
176  $ass->delete();
177  }
178  }
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 164 of file class.ilObjStudyProgramme.php.

References settings().

Referenced by delete().

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

References $ret, and array.

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

377  {
378  $ret = array();
379  $root = self::getInstanceByRefId($a_ref_id);
380  $root_id = $root->getId();
381  $root->applyToSubTreeNodes(function($prg) use (&$ret, $root_id) {
382  // exclude root node of subtree.
383  if ($prg->getId() == $root_id) {
384  return;
385  }
386  $ret[] = $prg;
387  });
388  return $ret;
389  }
Create styles array
The data for the language used.
$ret
Definition: parser.php:6
+ 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 930 of file class.ilObjStudyProgramme.php.

References getAssignmentsOf().

Referenced by hasAssignmentOf().

930  {
931  return count($this->getAssignmentsOf($a_user_id));
932  }
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 476 of file class.ilObjStudyProgramme.php.

References getChildren().

Referenced by adjustLPMode(), and hasChildren().

476  {
477  return count($this->getChildren());
478  }
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 961 of file class.ilObjStudyProgramme.php.

References getAssignmentsRaw().

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

961  {
962  return array_map(function($ass) {
963  return new ilStudyProgrammeUserAssignment($ass);
964  }, array_values($this->getAssignmentsRaw())); // use array values since we want keys 0...
965  }
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 942 of file class.ilObjStudyProgramme.php.

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

Referenced by getAmountOfAssignmentsOf().

942  {
943  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
944 
945  $prg_ids = $this->getIdsFromNodesOnPathFromRootToHere();
946  $assignments = ilStudyProgrammeAssignment::where(array( "usr_id" => $a_user_id
947  , "root_prg_id" => $prg_ids
948  ))
949  ->orderBy("last_change", "DESC")
950  ->get();
951  return array_map(function($ass) {
952  return new ilStudyProgrammeUserAssignment($ass);
953  }, array_values($assignments)); // use array values since we want keys 0...
954  }
static where($where, $operator=null)
Create styles array
The data for the language used.
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 1150 of file class.ilObjStudyProgramme.php.

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

Referenced by getAssignments().

1150  {
1151  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserAssignment.php");
1152  $prg_ids = $this->getIdsFromNodesOnPathFromRootToHere();
1153  return ilStudyProgrammeAssignment::where(array( "root_prg_id" => $prg_ids))
1154  ->orderBy("last_change", "DESC")
1155  ->get();
1156  }
static where($where, $operator=null)
Create styles array
The data for the language used.
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 399 of file class.ilObjStudyProgramme.php.

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

Referenced by applyToSubTreeNodes(), and getAmountOfChildren().

399  {
400  $this->throwIfNotInTree();
401 
402  if ($this->children === null) {
403  $ref_ids = $this->tree->getChildsByType($this->getRefId(), "prg");
404 
405  // apply container sorting to tree
406  $sorting = ilContainerSorting::_getInstance($this->getId());
407  $ref_ids = $sorting->sortItems(array('prg'=>$ref_ids));
408  $ref_ids = $ref_ids['prg'];
409 
410  $this->children = array_map(function($node_data) {
411  return ilObjStudyProgramme::getInstanceByRefId($node_data["child"]);
412  }, $ref_ids);
413  }
414 
415  return $this->children;
416  }
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
getId()
get object id public
Create styles array
The data for the language used.
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(), array, 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.
Create styles array
The data for the language used.
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 1259 of file class.ilObjStudyProgramme.php.

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

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

1259  {
1260  if ($a_ref_id === null) {
1261  return $a_subobjects;
1262  }
1263 
1264  if (ilObject::_lookupType($a_ref_id, true) != "prg") {
1265  throw new ilException("Ref-Id '$a_ref_id' does not belong to a study programme object.");
1266  }
1267 
1269 
1270  $mode = $parent->getLPMode();
1271 
1272  switch ($mode) {
1274  return $a_subobjects;
1276  return array("prg" => $a_subobjects["prg"]);
1278  unset($a_subobjects["prg"]);
1279  return $a_subobjects;
1280  }
1281 
1282  throw new ilException("Undefined mode for study programme: '$mode'");
1283  }
Base class for ILIAS Exception handling.
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
Create styles array
The data for the language used.
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 488 of file class.ilObjStudyProgramme.php.

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

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

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

Referenced by getAssignmentsOf(), and getAssignmentsRaw().

1139  {
1140  $prg_ids =array_map(function($par) {
1141  return $par->getId();
1142  }, $this->getParents());
1143  $prg_ids[] = $this->getId();
1144  return $prg_ids;
1145  }
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 1094 of file class.ilObjStudyProgramme.php.

References array, and getProgresses().

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

References array, and getProgresses().

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

References array, and getProgresses().

1079  {
1080  $returns = array();
1081  foreach ($this->getProgresses() as $progress) {
1082  if ($progress->isRelevant()) {
1083  $returns[] = $progress->getUserId();
1084  }
1085  }
1086  return array_unique($returns);
1087  }
getProgresses()
Get all progresses on this node.
Create styles array
The data for the language used.
+ 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 94 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().

94  {
95  require_once("Modules/StudyProgramme/classes/class.ilObjStudyProgrammeCache.php");
96  if (self::$study_programme_cache === null) {
97  self::initStudyProgrammeCache();
98  }
99  return self::$study_programme_cache->getInstanceByRefId($a_ref_id);
100  }
+ 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 238 of file class.ilObjStudyProgramme.php.

References settings().

238  {
239  return $this->settings->getLastChange();
240  }
settings()
Definition: settings.php:2
+ 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 517 of file class.ilObjStudyProgramme.php.

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

Referenced by getAmountOfLPChildren(), and getLPChildrenIds().

517  {
518  $this->throwIfNotInTree();
519 
520  if ($this->lp_children === null) {
521  $this->lp_children = array();
522 
523  // TODO: find a better way to get all elements except StudyProgramme-children
524  $ref_ids = $this->tree->getChildsByType($this->getRefId(), "crsr");
525 
526  // apply container sorting to tree
527  $sorting = ilContainerSorting::_getInstance($this->getId());
528  $ref_ids = $sorting->sortItems(array('crs_ref'=>$ref_ids));
529  $ref_ids = $ref_ids['crs_ref'];
530 
531  $lp_children = array_map(function($node_data) {
532  $lp_obj = $this->object_factory->getInstanceByRefId($node_data["child"]);
533 
534  // filter out all StudyProgramme instances
535  return ($lp_obj instanceof $this)? 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
Create styles array
The data for the language used.
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 269 of file class.ilObjStudyProgramme.php.

References settings().

Referenced by addNode(), and nodeInserted().

269  {
270  return $this->settings->getLPMode();
271  }
settings()
Definition: settings.php:2
+ 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 426 of file class.ilObjStudyProgramme.php.

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

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

426  {
427  if ($this->parent === false) {
428  $this->throwIfNotInTree();
429  $parent_data = $this->tree->getParentNodeData($this->getRefId());
430  if ($parent_data["type"] != "prg") {
431  $this->parent = null;
432  }
433  else {
434  $this->parent = ilObjStudyProgramme::getInstanceByRefId($parent_data["ref_id"]);
435  }
436  }
437  return $this->parent;
438  }
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 1204 of file class.ilObjStudyProgramme.php.

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

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

References array.

Referenced by getIdsFromNodesOnPathFromRootToHere(), and getRoot().

445  {
446  $current = $this;
447  $parents = array();
448  while(true) {
449  $current = $current->getParent();
450  if ($current === null) {
451  return array_reverse($parents);
452  }
453  $parents[] = $current;
454  }
455  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getPoints()

ilObjStudyProgramme::getPoints ( )

Get the amount of points.

Returns
integer - larger than zero

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

References settings().

247  {
248  return $this->settings->getPoints();
249  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ getProgresses()

ilObjStudyProgramme::getProgresses ( )

Get all progresses on this node.

Returns
ilStudyProgrammeUserProgress[]

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

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

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

1046  {
1047  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
1049  }
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 1009 of file class.ilObjStudyProgramme.php.

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

1009  {
1010  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
1011  return ilStudyProgrammeUserProgress::getInstancesForUser($this->getId(), $a_user_id);
1012  }
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 1023 of file class.ilObjStudyProgramme.php.

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

1023  {
1024  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
1025  return ilStudyProgrammeUserProgress::getInstanceForAssignment($this->getId(), $a_assignment_id);
1026  }
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 1222 of file class.ilObjStudyProgramme.php.

References $settings.

1222  {
1223  return $this->settings;
1224  }

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

References getParents().

505  {
506  $parents = $this->getParents();
507  return $parents[0];
508  }
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 303 of file class.ilObjStudyProgramme.php.

References settings().

Referenced by assignUser(), and isActive().

303  {
304  return $this->settings->getStatus();
305  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubType()

ilObjStudyProgramme::getSubType ( )

Gets the SubType Object.

Returns
ilStudyProgrammeType

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

References array, and getSubtypeId().

Referenced by update(), and updateCustomIcon().

355  {
356  if(!in_array($this->getSubtypeId(), array("-", "0"))) {
357  $subtype_id = $this->getSubtypeId();
358  return new ilStudyProgrammeType($subtype_id);
359  }
360 
361  return null;
362  }
Create styles array
The data for the language used.
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 333 of file class.ilObjStudyProgramme.php.

References settings().

Referenced by getSubType().

333  {
334  return $this->settings->getSubtypeId();
335  }
settings()
Definition: settings.php:2
+ 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 919 of file class.ilObjStudyProgramme.php.

References getAmountOfAssignmentsOf().

919  {
920  return $this->getAmountOfAssignmentsOf($a_user_id) > 0;
921  }
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 972 of file class.ilObjStudyProgramme.php.

References getAssignments().

972  {
973  return count($this->getAssignments()) > 0;
974  }
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 464 of file class.ilObjStudyProgramme.php.

References getAmountOfChildren().

Referenced by addLeaf().

464  {
465  return $this->getAmountOfChildren() > 0;
466  }
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 1056 of file class.ilObjStudyProgramme.php.

References getProgresses().

1056  {
1057  return count($this->getProgresses()) > 0;
1058  }
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 1065 of file class.ilObjStudyProgramme.php.

References getProgresses().

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

◆ initStudyProgrammeCache()

static ilObjStudyProgramme::initStudyProgrammeCache ( )
static

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

References ilObjStudyProgrammeCache\singleton().

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

◆ isActive()

ilObjStudyProgramme::isActive ( )

Check whether this programme is active.

Returns
bool

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

References getStatus(), and ilStudyProgramme\STATUS_ACTIVE.

324  {
325  return $this->getStatus() == ilStudyProgramme::STATUS_ACTIVE;
326  }
+ 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 $DIC, $parent, clearChildrenCache(), clearLPChildrenCache(), clearParentCache(), getParent(), and ilObject\getRefId().

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

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.
settings()
Definition: settings.php:2
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 180 of file class.ilObjStudyProgramme.php.

References readSettings().

180  {
181  parent::read();
182  $this->readSettings();
183  }
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 122 of file class.ilObjStudyProgramme.php.

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

Referenced by read().

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

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

897  {
898  require_once("./Modules/StudyProgramme/classes/class.ilStudyProgrammeEvents.php");
899 
900  if ($a_assignment->getStudyProgramme()->getId() != $this->getId()) {
901  throw new ilException("ilObjStudyProgramme::removeAssignment: Assignment '"
902  .$a_assignment->getId()."' does not belong to study "
903  ."program '".$this->getId()."'.");
904  }
905 
907 
908  $a_assignment->delete();
909 
910  return $this;
911  }
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 1292 of file class.ilObjStudyProgramme.php.

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

Referenced by updateCustomIcon().

1293  {
1294  global $DIC;
1295  $ilDB = $DIC['ilDB'];
1296 
1297  $this->createContainerDirectory();
1298  $cont_dir = $this->getContainerDirectory();
1299  $file_name = "";
1300  if ($a_custom_icon != "")
1301  {
1302  $file_name = $cont_dir."/icon_custom.svg";
1303 
1304  ilUtil::moveUploadedFile($a_custom_icon, "icon_custom.svg", $file_name, true, "copy");
1305 
1306  if ($file_name != "" && is_file($file_name))
1307  {
1308  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 1);
1309  }
1310  else
1311  {
1312  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 0);
1313  }
1314  }
1315  }
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
static _writeContainerSetting($a_id, $a_keyword, $a_value)
global $DIC
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 258 of file class.ilObjStudyProgramme.php.

References settings(), and updateLastChange().

258  {
259  $this->settings->setPoints($a_points);
260  $this->updateLastChange();
261  return $this;
262  }
settings()
Definition: settings.php:2
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 1162 of file class.ilObjStudyProgramme.php.

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

Referenced by ilStudyProgrammeAppEventListener\onServiceTrackingUpdateStatus().

1162  {
1163  // We only use courses via crs_refs
1164  $type = ilObject::_lookupType($a_obj_id);
1165  if ($type == "crs") {
1166  require_once("Services/ContainerReference/classes/class.ilContainerReference.php");
1167  $crs_reference_obj_ids = ilContainerReference::_lookupSourceIds($a_obj_id);
1168  foreach ($crs_reference_obj_ids as $obj_id) {
1169  foreach(ilObject::_getAllReferences($obj_id) as $ref_id) {
1170  self::setProgressesCompletedIfParentIsProgrammeInLPCompletedMode($ref_id, $obj_id, $a_user_id);
1171  }
1172  }
1173  }
1174  else {
1175  foreach (ilObject::_getAllReferences($a_obj_id) as $ref_id) {
1176  self::setProgressesCompletedIfParentIsProgrammeInLPCompletedMode($ref_id, $a_obj_id, $a_user_id);
1177  }
1178  }
1179  }
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 1181 of file class.ilObjStudyProgramme.php.

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

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

References settings(), and updateLastChange().

313  {
314  $this->settings->setStatus($a_status);
315  $this->updateLastChange();
316  return $this;
317  }
settings()
Definition: settings.php:2
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 345 of file class.ilObjStudyProgramme.php.

References settings().

345  {
346  $this->settings->setSubtypeId($a_subtype_id);
347  return $this;
348  }
settings()
Definition: settings.php:2
+ Here is the call 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 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 194 of file class.ilObjStudyProgramme.php.

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

Referenced by addLeaf(), and updateLastChange().

194  {
195  parent::update();
196 
197  // Update selection for advanced meta data of the type
198  if ($this->getSubType()) {
199  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', $this->getSubType()->getAssignedAdvancedMDRecordIds());
200  } else {
201  // If no type is assigned, delete relations by passing an empty array
202  ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', array());
203  }
204 
205  $this->updateSettings();
206  }
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
Create styles array
The data for the language used.
+ 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 981 of file class.ilObjStudyProgramme.php.

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

981  {
983  foreach ($assignments as $ass) {
984  $ass->updateFromProgram();
985  }
986  return $this;
987  }
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 1230 of file class.ilObjStudyProgramme.php.

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

1230  {
1231  $subtype = $this->getSubType();
1232 
1233  if($subtype) {
1234  if(is_file($subtype->getIconPath(true))) {
1235  $icon = $subtype->getIconPath(true);
1236  $this->saveIcons($icon);
1237  } else {
1238  $this->removeCustomIcon();
1239  }
1240  } else {
1241  $this->removeCustomIcon();
1242  }
1243  }
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 1127 of file class.ilObjStudyProgramme.php.

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

Referenced by setPoints(), and setStatus().

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

References settings().

Referenced by update().

153  {
154  if ($this->settings === null) {
155  throw new ilException("ilObjStudyProgramme::updateSettings: no settings loaded.");
156  }
157  $this->settings->update();
158  }
Base class for ILIAS Exception handling.
settings()
Definition: settings.php:2
+ 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 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: