ILIAS  release_8 Revision v8.24
ilObjStudyProgramme Class Reference
+ Inheritance diagram for ilObjStudyProgramme:
+ Collaboration diagram for ilObjStudyProgramme:

Public Member Functions

 __construct (int $id=0, bool $call_by_reference=true)
 ATTENTION: After using the constructor the object won't be in the cache. More...
 
 getSettings ()
 
 updateSettings (ilStudyProgrammeSettings $settings)
 
 create ()
 
 update ()
 
 delete ()
 Delete Study Programme and all related data. More...
 
 hasAdvancedMetadata ()
 
 getLastChange ()
 Get the timestamp of the last change on this program or sub program. More...
 
 getPoints ()
 Get the amount of points. More...
 
 setPoints (int $points)
 Set the amount of points. More...
 
 getLPMode ()
 
 adjustLPMode ()
 Adjust the lp mode to match current state of tree: More...
 
 getStatus ()
 
 setStatus (int $a_status)
 Set the status of the node. More...
 
 isActive ()
 
 getSubType ()
 Gets the SubType Object. More...
 
 getAllPrgChildren ()
 
 getChildren (bool $include_references=false)
 Get all ilObjStudyProgrammes that are direct children of this object. More...
 
 getParent ()
 Get the parent ilObjStudyProgramme of this object. More...
 
 getReferencesToSelf ()
 
 getParents (bool $include_references=false)
 Get all parents of the node, where the root of the program comes first. More...
 
 hasChildren (bool $include_references=false)
 Does this StudyProgramme have other ilObjStudyProgrammes as children? More...
 
 getAmountOfChildren ($include_references=false)
 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 obj-ids of the leafs the program contains. More...
 
 getAmountOfLPChildren ()
 Get the amount of leafs the study programme contains. More...
 
 hasLPChildren ()
 
 applyToSubTreeNodes (Closure $fun, bool $include_references=false)
 Apply the given Closure to every node in the subtree starting at this object. More...
 
 getCompletedCourses (int $usr_id)
 Get courses in this program that the given user already completed. More...
 
 addNode (ilObjStudyProgramme $a_prg)
 Inserts another ilObjStudyProgramme in this object. More...
 
 nodeInserted ($prg)
 Clears child cache and adds progress for new node. More...
 
 putInTree (int $parent_ref_id)
 Overwritten from ilObject. More...
 
 removeNode (ilObjStudyProgramme $a_prg)
 Remove a node from this object. More...
 
 canBeRemoved ()
 Check weather a node can be removed. More...
 
 moveTo (ilObjStudyProgramme $new_parent)
 Move this tree node to a new parent. More...
 
 assignUser (int $usr_id, int $acting_usr_id=null, $raise_event=true)
 Assign a user to this node at the study program. More...
 
 removeAssignment (ilPRGAssignment $assignment)
 Remove an assignment from this program. More...
 
 getSpecificAssignment (int $assignment_id)
 
 storeExpiryInfoSentFor (ilPRGAssignment $ass)
 
 resetExpiryInfoSentFor (ilPRGAssignment $ass)
 
 storeRiskyToFailSentFor (ilPRGAssignment $ass)
 
 resetRiskyToFailSentFor (ilPRGAssignment $ass)
 
 hasAssignmentOf (int $user_id)
 Check whether user is assigned to this program or any node above. More...
 
 getAmountOfAssignmentsOf (int $user_id)
 Get the amount of assignments a user has on this program node or any node above. More...
 
 getAssignmentsOf (int $user_id)
 Get the assignments of user at this program or any node above. More...
 
 getAssignments ()
 
 getMembers ()
 get usr_ids with any progress on this node More...
 
 getLocalMembers ()
 get usr_ids with assignment on this node More...
 
 hasAssignments ()
 Are there any assignments on this node or any node above? More...
 
 getAssignmentsOfSingleProgramForUser (int $usr_id)
 Get assignments of user to this program-node only. More...
 
 hasAssignmentsOfSingleProgramForUser (int $usr_id)
 Get assignments of user to this program-node only. More...
 
 addMissingProgresses ()
 Add missing progress records for all assignments of this programm. More...
 
 hasRelevantProgresses ()
 Are there any users that have a relevant progress on this programme? More...
 
 getIdsOfUsersWithRelevantProgress ()
 
 getAutomaticContentCategories ()
 Get configuration of categories with auto-content for this StudyProgramme;. More...
 
 hasAutomaticContentCategories ()
 
 storeAutomaticContentCategory (int $category_ref_id)
 Store a Category with auto-content for this StudyProgramme; a category can only be referenced once (per programme). More...
 
 deleteAutomaticContentCategories (array $category_ids=[])
 Delete configuration of categories with auto-content for this StudyProgramme;. More...
 
 deleteAllAutomaticContentCategories ()
 Delete all configuration of categories with auto-content for this StudyProgramme;. More...
 
 isAutoContentApplicable ()
 AutoContent should only be available in active- or draft-mode, and only, if there is no sub-programme. More...
 
 getAutomaticMembershipSources ()
 Get sources for auto-memberships. More...
 
 storeAutomaticMembershipSource (string $type, int $src_id)
 Store a source to be monitored for automatic memberships. More...
 
 deleteAutomaticMembershipSource (string $type, int $src_id)
 Delete a membership source. More...
 
 deleteAllAutomaticMembershipSources ()
 Delete all membership sources of this StudyProgramme;. More...
 
 disableAutomaticMembershipSource (string $type, int $src_id)
 Disable a membership source. More...
 
 enableAutomaticMembershipSource (string $type, int $src_id, bool $assign_now=false)
 Enable a membership source. More...
 
 getApplicableMembershipSourceForUser (int $usr_id, ?int $exclude_id)
 
 succeed (int $usr_id, int $triggering_obj_id, ilPRGAssignment $ass=null)
 
 updateCustomIcon ()
 
 markAccredited (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
 unmarkAccredited (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
 markNotRelevant (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
 markRelevant (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection)
 
 changeProgressDeadline (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, ?DateTimeImmutable $deadline)
 
 changeProgressValidityDate (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, ?DateTimeImmutable $validity)
 
 changeAmountOfPoints (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection, int $points)
 
 updatePlanFromRepository (int $assignment_id, int $acting_usr_id, ilPRGMessageCollection $err_collection=null)
 
 acknowledgeCourses (int $assignment_id, array $nodes, ilPRGMessageCollection $err_collection=null)
 
 canBeCompleted (ilPRGProgress $progress)
 
 statusToRepr (int $status)
 Get a user readable representation of a status. More...
 
- Public Member Functions inherited from ilContainer
 getTileSizes ()
 
 getObjectTranslation ()
 
 setObjectTranslation (?ilObjectTranslation $obj_trans)
 
 createContainerDirectory ()
 
 getContainerDirectory ()
 
 setHiddenFilesFound (bool $a_hiddenfilesfound)
 
 getHiddenFilesFound ()
 
 getStyleSheetId ()
 
 setStyleSheetId (int $a_style_id)
 
 setNewsTimeline (bool $a_val)
 
 getNewsTimeline ()
 
 setNewsTimelineAutoEntries (bool $a_val)
 
 getNewsTimelineAutoEntries ()
 
 setNewsTimelineLandingPage (bool $a_val)
 
 getNewsTimelineLandingPage ()
 
 isNewsTimelineEffective ()
 
 isNewsTimelineLandingPageEffective ()
 
 setNewsBlockActivated (bool $a_val)
 
 getNewsBlockActivated ()
 
 setUseNews (bool $a_val)
 
 getUseNews ()
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies (container sorting) More...
 
 cloneAllObject (string $session_id, string $client_id, string $new_type, int $ref_id, int $clone_source, array $options, bool $soap_call=false, int $a_submode=1)
 
 delete ()
 delete category and all related data More...
 
 getViewMode ()
 
 getOrderType ()
 
 setOrderType (int $a_value)
 
 isClassificationFilterActive ()
 
 filteredSubtree ()
 Note grp/crs currently allow to filter in their whole subtrees Catetories only their direct childs. More...
 
 getSubItems (bool $a_admin_panel_enabled=false, bool $a_include_side_block=false, int $a_get_single=0, ilContainerUserFilter $container_user_filter=null)
 
 gotItems ()
 
 addAdditionalSubItemInformation (array &$object)
 Add additional information to sub item, e.g. More...
 
 getGroupedObjTypes ()
 
 enablePageEditing ()
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 update ()
 
 read ()
 
 readContainerSettings ()
 
 removeTranslations ()
 
 deleteTranslation (string $a_lang)
 
 addTranslation (string $a_title, string $a_desc, string $a_lang, string $a_lang_default)
 
- Public Member Functions inherited from ilObject
 __construct (int $id=0, bool $reference=true)
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $desc)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static initStudyProgrammeCache ()
 
static getRefIdFor (int $obj_id)
 
static getInstanceByObjId (int $obj_id)
 
static getInstanceByRefId ($ref_id)
 
static createInstance ()
 Create an instance of ilObjStudyProgramme, put in cache. More...
 
static getAllChildren (int $a_ref_id, bool $include_references=false)
 Get a list of all ilObjStudyProgrammes in the subtree starting at $a_ref_id. More...
 
static addCrsToProgrammes (int $crs_ref_id, int $cat_ref_id)
 Check, if a category is under surveilllance and automatically add the course. More...
 
static removeCrsFromProgrammes (int $crs_ref_id, int $cat_ref_id)
 Check, if a category is under surveillance and automatically remove the deleted course. More...
 
static addMemberToProgrammes (string $src_type, int $src_id, int $usr_id)
 
static removeMemberFromProgrammes (string $src_type, int $src_id, int $usr_id)
 
static setProgressesCompletedIfParentIsProgrammeInLPCompletedMode (int $ref_id, int $obj_id, int $user_id)
 Succeed all StudyProgramme(Nodes) where the object with the given id (a CRSR) is in a Programme with MODE_LP_COMPLETED. More...
 
static getCreatableSubObjects (array $subobjects, $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 (int $a_id)
 
static _lookupContainerSetting (int $a_id, string $a_keyword, string $a_default_value=null)
 
static _hasContainerSetting (int $a_id, string $a_keyword)
 
static _writeContainerSetting (int $a_id, string $a_keyword, string $a_value)
 
static _getContainerSettings (int $a_id)
 
static _deleteContainerSettings (int $a_id, string $a_keyword="", bool $a_keyword_like=false)
 
static _exportContainerSettings (ilXmlWriter $a_xml, int $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 (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

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...
 
 getPrgInstanceByObjId (int $obj_id)
 
 getAssignmentRepository ()
 
 getSettingsRepository ()
 
 getTree ()
 
 getLogger ()
 
 deleteSettings ()
 
 deleteAssignmentsAndProgresses ()
 Delete all assignments from the DB. More...
 
 getReferencesTo (ilObjStudyProgramme $prg)
 
 throwIfNotInTree ()
 
 getMessageCollection (string $topic)
 
 getMembersOfMembershipSource (string $src_type, int $src_id)
 Get member-ids of a certain source. More...
 
 updateLastChange ()
 Update last change timestamp on this node and its parents. More...
 
 getLoggedInUserId ()
 
 getNow ()
 
 getObjIdsOfChildren (int $node_obj_id)
 
 refreshLPStatus (int $usr_id, int $node_obj_id=null)
 
 getProgressIdString (ilPRGAssignment $assignment, ilPRGProgress $progress)
 
- Protected Member Functions inherited from ilContainer
 getInitialSubitems ()
 
 applyContainerUserFilter (array $objects, ilContainerUserFilter $container_user_filter=null)
 Apply container user filter on objects. More...
 
 filterObjIdsByCopyright (array $obj_ids, string $copyright_id)
 
 filterObjIdsByDefaultCopyright (array $obj_ids, string $default_identifier)
 
 legacyOnlineFilter (array $obj_ids, array $objects, int $val)
 Legacy online filter. More...
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Static Protected Member Functions

static getProgrammesMonitoringCategory (int $cat_ref_id)
 Get all (not OUTDATED) StudyProgrammes monitoring this category. More...
 
static getProgrammesMonitoringMemberSource (string $src_type, int $src_id)
 Get all StudyProgrammes monitoring this membership-source. More...
 
static getParentId (ilObjCourseReference $leaf)
 Get the obj id of the parent object for the given object. More...
 

Protected Attributes

 $parent
 
array $children = null
 
array $lp_children = null
 
ilStudyProgrammeTypeDBRepository $type_repository
 
ilPRGAssignmentDBRepository $assignment_repository
 
ilStudyProgrammeAutoCategoryDBRepository $auto_categories_repository
 
ilStudyProgrammeAutoMembershipsDBRepository $auto_memberships_repository
 
ilStudyProgrammeMembershipSourceReaderFactory $membersourcereader_factory
 
ilStudyProgrammeEvents $events
 
ilStudyProgrammeSettingsDBRepository $settings_repository
 
array $members_cache = null
 
array $reference_children = null
 
Filesystem $webdir
 
ilObjUser $ilUser
 
ilObjectFactoryWrapper $object_factory = null
 
ilObjectCustomIconFactory $custom_icon_factory
 
ilLogger $logger
 
- Protected Attributes inherited from ilContainer
ILIAS Style Content DomainService $content_style_domain
 
ilNewsService $news
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilObjectDefinition $obj_definition
 
int $order_type = 0
 
bool $hiddenfilesfound = false
 
bool $news_timeline = false
 
bool $news_timeline_auto_entries = false
 
ilSetting $setting
 
ilObjectTranslation $obj_trans = null
 
int $style_id = 0
 
bool $news_timeline_landing_page = false
 
bool $news_block_activated = false
 
bool $use_news = false
 
ilRecommendedContentManager $recommended_content_manager
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
int $id
 
bool $referenced
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Static Protected Attributes

static ilObjStudyProgrammeCache $study_programme_cache = null
 

Additional Inherited Members

- 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
 
const TILE_NORMAL = 0
 
const TILE_SMALL = 1
 
const TILE_LARGE = 2
 
const TILE_EXTRA_LARGE = 3
 
const TILE_FULL = 4
 
array $items = []
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 
- Static Public Attributes inherited from ilContainer
static bool $data_preloaded = false
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgramme::__construct ( int  $id = 0,
bool  $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.

Reimplemented from ilObject.

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

73 {
75 $this->type = "prg";
76
77 $this->type_repository = $dic['model.Type.ilStudyProgrammeTypeRepository'];
78 $this->auto_categories_repository = $dic['model.AutoCategories.ilStudyProgrammeAutoCategoriesRepository'];
79 $this->auto_memberships_repository = $dic['model.AutoMemberships.ilStudyProgrammeAutoMembershipsRepository'];
80 $this->membersourcereader_factory = $dic['model.AutoMemberships.ilStudyProgrammeMembershipSourceReaderFactory'];
81
82 $this->settings_repository = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
83 $this->assignment_repository = $dic['repo.assignment'];
84 $this->events = $dic['ilStudyProgrammeEvents'];
85
87
88 $this->clearParentCache();
89 $this->clearChildrenCache();
90 $this->clearLPChildrenCache();
91
92 global $DIC;
93 $tree = $DIC['tree'];
94 $ilUser = $DIC['ilUser'];
95 $this->webdir = $DIC->filesystem()->web();
96 $this->tree = $tree;
97 $this->ilUser = $ilUser;
98 $this->db = $DIC['ilDB'];
99 $this->lng = $DIC['lng'];
100 $this->logger = ilLoggerFactory::getLogger($this->type);
101
102 $this->object_factory = ilObjectFactoryWrapper::singleton();
103
104 $this->custom_icon_factory = $DIC['object.customicons.factory'];
105
107 }
static getLogger(string $a_component_id)
Get component logger.
clearLPChildrenCache()
Clear the cached lp children.
clearParentCache()
Clear the cached parent to query it again at the tree.
clearChildrenCache()
Clear the cached children.
ilTree $tree
bool $call_by_reference
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$dic
Definition: result.php:32

References ilObject\$call_by_reference, $DIC, $dic, ilObject\$id, $ilUser, ilObject\$tree, ILIAS\GlobalScreen\Provider\__construct(), clearChildrenCache(), clearLPChildrenCache(), clearParentCache(), ilStudyProgrammeDIC\dic(), ilLoggerFactory\getLogger(), initStudyProgrammeCache(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), and ilObjectFactoryWrapper\singleton().

+ Here is the call graph for this function:

Member Function Documentation

◆ acknowledgeCourses()

ilObjStudyProgramme::acknowledgeCourses ( int  $assignment_id,
array  $nodes,
ilPRGMessageCollection  $err_collection = null 
)

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

1828 : void {
1829 $acting_usr_id = $this->getLoggedInUserId();
1830 $assignment = $this->assignment_repository->get($assignment_id);
1831 foreach($nodes as $nodeinfo) {
1832 [$node_obj_id, $course_obj_id] = $nodeinfo;
1833
1834 $assignment = $assignment->succeed(
1835 $this->settings_repository,
1836 $node_obj_id,
1837 $course_obj_id
1838 );
1839
1840 $msg = sprintf(
1841 '%s, progress-id (%s/%s)',
1842 $assignment->getUserInformation()->getFullname(),
1843 $assignment->getId(),
1844 (string) $node_obj_id
1845 );
1846 $err_collection->add(true, 'acknowledged_course', $msg);
1847 }
1848 $this->assignment_repository->store($assignment);
1849 $this->refreshLPStatus($assignment->getUserId());
1850 }
refreshLPStatus(int $usr_id, int $node_obj_id=null)
add(bool $success, string $message, string $record_identitifer)

References ilPRGMessageCollection\add().

+ Here is the call graph for this function:

◆ addCrsToProgrammes()

static ilObjStudyProgramme::addCrsToProgrammes ( int  $crs_ref_id,
int  $cat_ref_id 
)
static

Check, if a category is under surveilllance and automatically add the course.

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

1233 : void
1234 {
1235 foreach (self::getProgrammesMonitoringCategory($cat_ref_id) as $prg) {
1236 $course_ref = new ilObjCourseReference();
1237 $course_ref->setTitleType(ilContainerReference::TITLE_TYPE_REUSE);
1238 $course_ref->setTargetRefId($crs_ref_id);
1239 $course_ref->create();
1240 $course_ref->createReference();
1241 $course_ref->putInTree($prg->getRefId());
1242 $course_ref->setPermissions($crs_ref_id);
1243 $course_ref->setTargetId(ilObject::_lookupObjectId($crs_ref_id));
1244 $course_ref->update();
1245 $lp = new ilLPObjSettings($course_ref->getId());
1246 $lp->insert();
1247 $lp->setMode($lp::LP_MODE_COURSE_REFERENCE);
1248 $lp->update(false);
1249 }
1250 }
static _lookupObjectId(int $ref_id)

References ilObject\_lookupObjectId(), and ilContainerReference\TITLE_TYPE_REUSE.

Referenced by ilStudyProgrammeAppEventListener\addCrsToProgrammes().

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

◆ addMemberToProgrammes()

static ilObjStudyProgramme::addMemberToProgrammes ( string  $src_type,
int  $src_id,
int  $usr_id 
)
static

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

1423 : void
1424 {
1425 foreach (self::getProgrammesMonitoringMemberSource($src_type, $src_id) as $prg) {
1426 if ($prg->isActive() &&
1427 !$prg->hasAssignmentsOfSingleProgramForUser($usr_id)) {
1429 $prg->assignUser($usr_id, $assigned_by);
1430 }
1431 }
1432 }

References ilStudyProgrammeAutoMembershipSource\SOURCE_MAPPING.

Referenced by ilStudyProgrammeAppEventListener\addMemberToProgrammes().

+ Here is the caller 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, i.e.: there was a node added below this one.

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

1147 : void
1148 {
1149 $assignments = $this->getAssignments();
1150 foreach ($assignments as $ass) {
1151 $this->assignment_repository->store($ass);
1152 }
1153 }

References getAssignments().

Referenced by nodeInserted().

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

◆ addNode()

ilObjStudyProgramme::addNode ( ilObjStudyProgramme  $a_prg)

Inserts another ilObjStudyProgramme in this object.

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

Parameters
ilObjStudyProgramme$a_prg
Returns
ilObjStudyProgramme
Exceptions
ilException
ilStudyProgrammeTreeException

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

784 {
785 $this->throwIfNotInTree();
786
788 throw new ilStudyProgrammeTreeException("Program already contains leafs.");
789 }
790
791 if ($this->tree->isInTree($a_prg->getRefId())) {
792 throw new ilStudyProgrammeTreeException("Other program already is in tree.");
793 }
794
795 if ($a_prg->getRefId() === null) {
796 $a_prg->createReference();
797 }
798 $a_prg->putInTree($this->getRefId());
799 return $this;
800 }
putInTree(int $parent_ref_id)
Overwritten from ilObject.
createReference()
creates reference for object
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ adjustLPMode()

ilObjStudyProgramme::adjustLPMode ( )

Adjust the lp mode to match current state of tree:

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

Exceptions
ilExceptionwhen programme is not in draft mode.

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

351 : void
352 {
353 // Clear caches here, there have been some changes, because this method
354 // would not have been called otherwise, and the changer just does not
355 // know if we have filled the caches already...
356 $this->clearLPChildrenCache();
357 $this->clearChildrenCache();
358
359 if ($this->tree->isInTree($this->getRefId())) {
360 if ($this->getAmountOfLPChildren() > 0) {
361 $this->settings_repository->update(
363 );
364 } elseif ($this->getAmountOfChildren(true) > 0) {
365 $this->settings_repository->update(
367 );
368 } else {
369 $this->settings_repository->update(
371 );
372 }
373 }
374 }
getAmountOfChildren($include_references=false)
Get the amount of other StudyProgrammes this StudyProgramme has as children.
getAmountOfLPChildren()
Get the amount of leafs the study programme contains.

References clearChildrenCache(), clearLPChildrenCache(), getAmountOfChildren(), getAmountOfLPChildren(), getSettings(), ilStudyProgrammeSettings\MODE_LP_COMPLETED, ilStudyProgrammeSettings\MODE_POINTS, and ilStudyProgrammeSettings\MODE_UNDEFINED.

+ Here is the call graph for this function:

◆ applyToSubTreeNodes()

ilObjStudyProgramme::applyToSubTreeNodes ( Closure  $fun,
bool  $include_references = false 
)

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.

Exceptions
ilStudyProgrammeTreeExceptionThrows when this object is not in tree.

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

718 : void
719 {
720 $this->throwIfNotInTree();
721
722 if ($fun($this) !== false) {
723 foreach ($this->getChildren($include_references) as $child) {
724 $child->applyToSubTreeNodes($fun, $include_references);
725 }
726 }
727 }
getChildren(bool $include_references=false)
Get all ilObjStudyProgrammes that are direct children of this object.

References getChildren(), and throwIfNotInTree().

Referenced by getAllPrgChildren().

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

◆ assignUser()

ilObjStudyProgramme::assignUser ( int  $usr_id,
int  $acting_usr_id = null,
  $raise_event = true 
)

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

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

942 {
943 $this->members_cache = null;
944
946 throw new ilException(
947 "ilObjStudyProgramme::assignUser: Can't assign user to program '"
948 . $this->getId() . "', since it's not in active status."
949 );
950 }
951
952 if (is_null($acting_usr_id)) {
953 $acting_usr_id = $this->getLoggedInUserId();
954 }
955
956 $ass = $this->assignment_repository->createFor($this->getId(), $usr_id, $acting_usr_id);
957 $ass = $ass
958 ->initAssignmentDates();
959
960 $ass = $ass->resetProgresses(
961 $this->getSettingsRepository(),
962 $acting_usr_id
963 );
964
965 $this->assignment_repository->store($ass);
966
967 if ($raise_event) {
968 $this->events->userAssigned($ass);
969 }
970 return $ass;
971 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...

References ilObject\getId(), getLoggedInUserId(), getSettingsRepository(), getStatus(), and ilStudyProgrammeSettings\STATUS_ACTIVE.

Referenced by enableAutomaticMembershipSource().

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

◆ canBeCompleted()

ilObjStudyProgramme::canBeCompleted ( ilPRGProgress  $progress)

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

1852 : bool
1853 {
1855 return true;
1856 }
1857 $possible_points = $progress->getPossiblePointsOfRelevantChildren();
1858 return $possible_points >= $progress->getAmountOfPoints();
1859 }

References ilPRGProgress\getAmountOfPoints(), ilPRGProgress\getPossiblePointsOfRelevantChildren(), and ilStudyProgrammeSettings\MODE_LP_COMPLETED.

+ 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.

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

880 : bool
881 {
882 return ! $this->hasRelevantProgresses();
883 }
hasRelevantProgresses()
Are there any users that have a relevant progress on this programme?

References hasRelevantProgresses().

Referenced by removeNode().

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

◆ changeAmountOfPoints()

ilObjStudyProgramme::changeAmountOfPoints ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection,
int  $points 
)

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

1793 : void {
1794 $progress_node_id = $this->getId();
1795 $assignment = $this->assignment_repository->get($assignment_id)
1796 ->changeAmountOfPoints(
1797 $this->getSettingsRepository(),
1798 $progress_node_id,
1799 $acting_usr_id,
1800 $err_collection,
1801 $points
1802 );
1803
1804 $this->assignment_repository->store($assignment);
1805 $this->refreshLPStatus($assignment->getUserId());
1806 }

◆ changeProgressDeadline()

ilObjStudyProgramme::changeProgressDeadline ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection,
?DateTimeImmutable  $deadline 
)

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

1753 : void {
1754 $progress_node_id = $this->getId();
1755 $assignment = $this->assignment_repository->get($assignment_id)
1756 ->changeProgressDeadline(
1757 $this->getSettingsRepository(),
1758 $progress_node_id,
1759 $acting_usr_id,
1760 $err_collection,
1761 $deadline
1762 );
1763
1764 $this->assignment_repository->store($assignment);
1765 $this->refreshLPStatus($assignment->getUserId());
1766 }

◆ changeProgressValidityDate()

ilObjStudyProgramme::changeProgressValidityDate ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection,
?DateTimeImmutable  $validity 
)

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

1773 : void {
1774 $progress_node_id = $this->getId();
1775 $assignment = $this->assignment_repository->get($assignment_id)
1776 ->changeProgressValidityDate(
1777 $this->getSettingsRepository(),
1778 $progress_node_id,
1779 $acting_usr_id,
1780 $err_collection,
1781 $validity
1782 );
1783
1784 $this->assignment_repository->store($assignment);
1785 $this->refreshLPStatus($assignment->getUserId());
1786 }

◆ clearChildrenCache()

ilObjStudyProgramme::clearChildrenCache ( )
protected

Clear the cached children.

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

128 : void
129 {
130 $this->children = null;
131 }

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

+ Here is the caller graph for this function:

◆ clearLPChildrenCache()

ilObjStudyProgramme::clearLPChildrenCache ( )
protected

Clear the cached lp children.

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

136 : void
137 {
138 $this->lp_children = null;
139 }

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

+ 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 119 of file class.ilObjStudyProgramme.php.

119 : void
120 {
121 // This is not initialized, but we need null if there is no parent.
122 $this->parent = false;
123 }

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

+ Here is the caller graph for this function:

◆ create()

ilObjStudyProgramme::create ( )
Exceptions
ilException

Reimplemented from ilContainer.

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

236 : int
237 {
238 $id = (int) parent::create();
239 $this->getSettingsRepository()->createFor($id);
240 return $id;
241 }

References ilObject\$id, getSettingsRepository(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ createInstance()

static ilObjStudyProgramme::createInstance ( )
static

Create an instance of ilObjStudyProgramme, put in cache.

Exceptions
ilException

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

191 {
192 $obj = new ilObjStudyProgramme();
193 $obj->create();
194 $obj->createReference();
195 self::$study_programme_cache->addInstance($obj);
196 return $obj;
197 }

◆ delete()

ilObjStudyProgramme::delete ( )

Delete Study Programme and all related data.

Exceptions
ilException

Reimplemented from ilContainer.

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

270 : bool
271 {
272 // always call parent delete function first!!
273 if (!parent::delete()) {
274 return false;
275 }
276
277 $this->deleteSettings();
279 try {
280 $this->auto_categories_repository->deleteFor($this->getId());
282 // This would be the case when SP is in trash (#17797)
283 }
284
287
288 $this->events->raise('delete', ['object' => $this, 'obj_id' => $this->getId()]);
289 return true;
290 }
deleteAllAutomaticContentCategories()
Delete all configuration of categories with auto-content for this StudyProgramme;.
deleteAllAutomaticMembershipSources()
Delete all membership sources of this StudyProgramme;.
deleteAssignmentsAndProgresses()
Delete all assignments from the DB.

References Vendor\Package\$e, deleteAllAutomaticContentCategories(), deleteAllAutomaticMembershipSources(), deleteAssignmentsAndProgresses(), deleteSettings(), and ilObject\getId().

+ Here is the call graph for this function:

◆ deleteAllAutomaticContentCategories()

ilObjStudyProgramme::deleteAllAutomaticContentCategories ( )

Delete all configuration of categories with auto-content for this StudyProgramme;.

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

1225 : void
1226 {
1227 $this->auto_categories_repository->deleteFor($this->getId());
1228 }

References ilObject\getId().

Referenced by delete().

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

◆ deleteAllAutomaticMembershipSources()

ilObjStudyProgramme::deleteAllAutomaticMembershipSources ( )

Delete all membership sources of this StudyProgramme;.

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

1355 : void
1356 {
1357 $this->auto_memberships_repository->deleteFor($this->getId());
1358 }

References ilObject\getId().

Referenced by delete().

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

◆ deleteAssignmentsAndProgresses()

ilObjStudyProgramme::deleteAssignmentsAndProgresses ( )
protected

Delete all assignments from the DB.

Exceptions
ilException

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

228 : void
229 {
230 $this->assignment_repository->deleteAllAssignmentsForProgrammeId($this->getId());
231 }

References ilObject\getId().

Referenced by delete().

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

◆ deleteAutomaticContentCategories()

ilObjStudyProgramme::deleteAutomaticContentCategories ( array  $category_ids = [])

Delete configuration of categories with auto-content for this StudyProgramme;.

Parameters
int[]$category_ids

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

1217 : void
1218 {
1219 $this->auto_categories_repository->delete($this->getId(), $category_ids);
1220 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ deleteAutomaticMembershipSource()

ilObjStudyProgramme::deleteAutomaticMembershipSource ( string  $type,
int  $src_id 
)

Delete a membership source.

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

1347 : void
1348 {
1349 $this->auto_memberships_repository->delete($this->getId(), $type, $src_id);
1350 }
string $type

References ilObject\getId().

+ Here is the call graph for this function:

◆ deleteSettings()

ilObjStudyProgramme::deleteSettings ( )
protected

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

218 : void
219 {
220 $this->getSettingsRepository()->delete($this->getSettings());
221 }

References getSettings(), and getSettingsRepository().

Referenced by delete().

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

◆ disableAutomaticMembershipSource()

ilObjStudyProgramme::disableAutomaticMembershipSource ( string  $type,
int  $src_id 
)

Disable a membership source.

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

1363 : void
1364 {
1365 $ams = $this->auto_memberships_repository->create($this->getId(), $type, $src_id, false);
1366 $this->auto_memberships_repository->update($ams);
1367 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ enableAutomaticMembershipSource()

ilObjStudyProgramme::enableAutomaticMembershipSource ( string  $type,
int  $src_id,
bool  $assign_now = false 
)

Enable a membership source.

Exceptions
ilException

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

1373 : void
1374 {
1375 if ($assign_now) {
1377 $member_ids = $this->getMembersOfMembershipSource($type, $src_id);
1378 foreach ($member_ids as $usr_id) {
1379 if (!$this->getAssignmentsOfSingleProgramForUser($usr_id)) {
1380 $this->assignUser($usr_id, $assigned_by);
1381 }
1382 }
1383 }
1384 $ams = $this->auto_memberships_repository->create($this->getId(), $type, $src_id, true);
1385 $this->auto_memberships_repository->update($ams);
1386 }
assignUser(int $usr_id, int $acting_usr_id=null, $raise_event=true)
Assign a user to this node at the study program.
getMembersOfMembershipSource(string $src_type, int $src_id)
Get member-ids of a certain source.
getAssignmentsOfSingleProgramForUser(int $usr_id)
Get assignments of user to this program-node only.

References ilObject\$type, assignUser(), getAssignmentsOfSingleProgramForUser(), ilObject\getId(), getMembersOfMembershipSource(), and ilStudyProgrammeAutoMembershipSource\SOURCE_MAPPING.

+ Here is the call graph for this function:

◆ getAllChildren()

static ilObjStudyProgramme::getAllChildren ( int  $a_ref_id,
bool  $include_references = false 
)
static

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

Throws when object is not in tree.

Returns
ilObjStudyProgramme[]

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

428 : array
429 {
430 $ret = array();
431 $root = self::getInstanceByRefId($a_ref_id);
432 $root_id = $root->getId();
433 $root->applyToSubTreeNodes(function (ilObjStudyProgramme $prg) use (&$ret, $root_id) {
434 // exclude root node of subtree.
435 if ($prg->getId() === $root_id) {
436 return;
437 }
438 $ret[] = $prg;
439 }, $include_references);
440 return $ret;
441 }

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

Referenced by ilObjStudyProgrammeTreeGUI\confirmedDelete().

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

◆ getAllPrgChildren()

ilObjStudyProgramme::getAllPrgChildren ( )

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

443 : array
444 {
445 $ret = [];
446 $this->applyToSubTreeNodes(
447 function (ilObjStudyProgramme $prg) use (&$ret) {
448 if ($prg->getId() === $this->getId()) {
449 return;
450 }
451 $ret[] = $prg;
452 }
453 );
454 return $ret;
455 }
applyToSubTreeNodes(Closure $fun, bool $include_references=false)
Apply the given Closure to every node in the subtree starting at this object.

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

+ Here is the call graph for this function:

◆ getAmountOfAssignmentsOf()

ilObjStudyProgramme::getAmountOfAssignmentsOf ( int  $user_id)

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

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

1039 : int
1040 {
1041 return count($this->getAssignmentsOf($user_id));
1042 }
getAssignmentsOf(int $user_id)
Get the assignments of user at this program or any node above.

References getAssignmentsOf().

Referenced by hasAssignmentOf().

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

◆ getAmountOfChildren()

ilObjStudyProgramme::getAmountOfChildren (   $include_references = false)

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

Exceptions
ilStudyProgrammeTreeExceptionwhen this object is not in tree.

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

604 : int
605 {
606 return count($this->getChildren($include_references));
607 }

References getChildren().

Referenced by adjustLPMode(), hasChildren(), and isAutoContentApplicable().

+ 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.

Exceptions
whenthis object is not in tree.

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

687 : int
688 {
689 return count($this->getLPChildren());
690 }
getLPChildren()
Get the leafs the study programme contains.

References getLPChildren().

Referenced by adjustLPMode(), and hasLPChildren().

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

◆ getApplicableMembershipSourceForUser()

ilObjStudyProgramme::getApplicableMembershipSourceForUser ( int  $usr_id,
?int  $exclude_id 
)

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

1464 foreach ($this->getAutomaticMembershipSources() as $ams) {
1465 $src_id = $ams->getSourceId();
1466 if ($src_id !== $exclude_id
1467 && $ams->isEnabled()
1468 ) {
1469 $source_members = $this->getMembersOfMembershipSource($ams->getSourceType(), $src_id);
1470 if (in_array($usr_id, $source_members)) {
1471 return $ams;
1472 }
1473 }
1474 }
1475 return null;
1476 }
getAutomaticMembershipSources()
Get sources for auto-memberships.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References getMembersOfMembershipSource(), and ilStudyProgrammeAutoMembershipSource\getSourceId().

+ Here is the call graph for this function:

◆ getAssignmentRepository()

ilObjStudyProgramme::getAssignmentRepository ( )
protected

◆ getAssignments()

ilObjStudyProgramme::getAssignments ( )
Returns
ilPRGAssignment[]

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

1070 : array
1071 {
1072 return $this->assignment_repository->getAllForNodeIsContained($this->getId());
1073 }

References ilObject\getId().

Referenced by addMissingProgresses(), and getMembers().

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

◆ getAssignmentsOf()

ilObjStudyProgramme::getAssignmentsOf ( int  $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 assignment is the first one.

Returns
ilPRGAssignment[]

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

1051 : array
1052 {
1053 $assignments = $this->assignment_repository->getAllForNodeIsContained(
1054 $this->getId(),
1055 [$user_id]
1056 );
1057
1058 usort($assignments, function ($a_one, $a_other) {
1059 return strcmp(
1060 $a_one->getLastChange()->format('Y-m-d'),
1061 $a_other->getLastChange()->format('Y-m-d')
1062 );
1063 });
1064 return $assignments;
1065 }

References ilObject\getId().

Referenced by getAmountOfAssignmentsOf().

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

◆ getAssignmentsOfSingleProgramForUser()

ilObjStudyProgramme::getAssignmentsOfSingleProgramForUser ( int  $usr_id)

Get assignments of user to this program-node only.

Returns
ilPRGAssignment[]

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

1124 : array
1125 {
1126 return $this->assignment_repository->getAllForSpecificNode($this->getId(), [$usr_id]);
1127 }

References ilObject\getId().

Referenced by enableAutomaticMembershipSource(), and hasAssignmentsOfSingleProgramForUser().

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

◆ getAutomaticContentCategories()

ilObjStudyProgramme::getAutomaticContentCategories ( )

Get configuration of categories with auto-content for this StudyProgramme;.

Returns
ilStudyProgrammeAutoCategory[]

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

1189 : array
1190 {
1191 return $this->auto_categories_repository->getFor($this->getId());
1192 }

References ilObject\getId().

Referenced by hasAutomaticContentCategories().

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

◆ getAutomaticMembershipSources()

ilObjStudyProgramme::getAutomaticMembershipSources ( )

Get sources for auto-memberships.

Returns
ilStudyProgrammeAutoMembershipSource[]

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

1330 : array
1331 {
1332 return $this->auto_memberships_repository->getFor($this->getId());
1333 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ getChildren()

ilObjStudyProgramme::getChildren ( bool  $include_references = false)

Get all ilObjStudyProgrammes that are direct children of this object.

Returns
ilObjStudyProgramme[]
Exceptions
ilStudyProgrammeTreeExceptionwhen this object is not in tree.

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

464 : array
465 {
466 $this->throwIfNotInTree();
467
468 if ($this->children === null) {
469 $ref_ids = $this->tree->getChildsByType($this->getRefId(), "prg");
470
471 // apply container sorting to tree
472 $sorting = ilContainerSorting::_getInstance($this->getId());
473 $ref_ids = $sorting->sortItems(array('prg' => $ref_ids));
474 $ref_ids = $ref_ids['prg'];
475
476 $this->children = array_map(static function ($node_data) {
477 return ilObjStudyProgramme::getInstanceByRefId($node_data["child"]);
478 }, $ref_ids);
479 }
480
481 if ($include_references && $this->reference_children === null) {
482 $this->reference_children = [];
483 $ref_child_ref_ids = $this->tree->getChildsByType($this->getRefId(), "prgr");
484 foreach ($this->children as $prg) {
485 $ref_child_ref_ids =
486 array_merge(
487 $this->tree->getChildsByType($prg->getRefId(), "prgr"),
488 $ref_child_ref_ids
489 );
490 }
491 foreach (
492 array_unique(
493 array_map(
494 static function ($data) {
495 return (int) $data['child'];
496 },
497 array_filter($ref_child_ref_ids, static function ($data) {
498 return $data["deleted"] === null;
499 })
500 )
501 ) as $prg_ref_id
502 ) {
503 $this->reference_children[] =
504 (new ilObjStudyProgrammeReference($prg_ref_id))->getReferencedObject();
505 }
506 }
507 return $include_references ?
508 array_merge($this->children, $this->reference_children) :
509 $this->children;
510 }
static _getInstance(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

Referenced by applyToSubTreeNodes(), getAmountOfChildren(), and ilStudyProgrammeProgressListGUI\showMoreObjectsInfo().

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

◆ getCompletedCourses()

ilObjStudyProgramme::getCompletedCourses ( int  $usr_id)

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

Returns
int[]

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

734 : array
735 {
736 $node_data = $this->tree->getNodeData($this->getRefId());
737 $crsrs = $this->tree->getSubTree($node_data, true, ["crsr"]);
738
739 $completed_crss = array();
740 foreach ($crsrs as $ref) {
741 $crs_id = (int) ilContainerReference::_lookupTargetId((int) $ref["obj_id"]);
742 $crs_ref_id = (int) ilContainerReference::_lookupTargetRefId((int) $ref["obj_id"]);
743
744 if (ilObject::_exists((int) $ref['ref_id'], true) &&
745 is_null(ilObject::_lookupDeletedDate((int) $ref['ref_id'])) &&
746 ilObject::_exists($crs_id, false) &&
747 is_null(ilObject::_lookupDeletedDate($crs_ref_id)) &&
748 ilLPStatus::_hasUserCompleted($crs_id, $usr_id)
749 ) {
750 $containing_prg = self::getInstanceByRefId((int) $ref["parent"]);
751 if ($containing_prg->isActive()) {
752 $completed_crss[] = [
753 "crs_id" => $crs_id
754 , "prg_ref_id" => (int) $ref["parent"]
755 , "prg_obj_id" => $containing_prg->getId()
756 , "crsr_ref_id" => (int) $ref["child"]
757 , "crsr_id" => (int) $ref["obj_id"]
758 , "crs_ref_id" => (int) $crs_ref_id
759 , "crs_id" => (int) $crs_id
760
761 , "title" => ilContainerReference::_lookupTitle((int) $ref["obj_id"])
762 ];
763 }
764 }
765 }
766 return $completed_crss;
767 }
static _lookupTitle(int $obj_id)
static _lookupTargetId(int $a_obj_id)
static _lookupTargetRefId(int $a_obj_id)
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
static _lookupDeletedDate(int $ref_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data

References ilObject\_exists(), ilLPStatus\_hasUserCompleted(), ilObject\_lookupDeletedDate(), ilContainerReference\_lookupTargetId(), ilContainerReference\_lookupTargetRefId(), ilContainerReference\_lookupTitle(), getInstanceByRefId(), ilObject\getRefId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getCreatableSubObjects()

static ilObjStudyProgramme::getCreatableSubObjects ( array  $subobjects,
  $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.

@thorws ilException

Parameters
string[]$subobjects

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

1591 : array
1592 {
1593 if ($ref_id === null) {
1594 return $subobjects;
1595 }
1596
1597 if (ilObject::_lookupType($ref_id, true) !== "prg") {
1598 throw new ilException("Ref-Id '$ref_id' does not belong to a study programme object.");
1599 }
1600
1602
1603 $mode = $parent->getLPMode();
1604
1605 switch ($mode) {
1607 $possible_subobjects = $subobjects;
1608 break;
1610 $possible_subobjects = [
1611 "prg" => $subobjects["prg"],
1612 "prgr" => $subobjects["prgr"]
1613 ];
1614 break;
1616 $possible_subobjects = ['crsr' => $subobjects['crsr']];
1617 break;
1618 default:
1619 throw new ilException("Undefined mode for study programme: '$mode'");
1620 }
1621
1622 if ($parent->hasAutomaticContentCategories()) {
1623 $possible_subobjects = array_filter(
1624 $possible_subobjects,
1625 static function ($subtype) {
1626 return $subtype === 'crsr';
1627 },
1628 ARRAY_FILTER_USE_KEY
1629 );
1630 }
1631 return $possible_subobjects;
1632 }
static _lookupType(int $id, bool $reference=false)

References $ref_id, ilObject\_lookupType(), ilStudyProgrammeSettings\MODE_LP_COMPLETED, ilStudyProgrammeSettings\MODE_POINTS, and ilStudyProgrammeSettings\MODE_UNDEFINED.

+ Here is the call 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.

Exceptions
ilExceptionwhen this object is not in tree.

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

615 : int
616 {
617 $cur = $this;
618 $count = 0;
619 while ($cur = $cur->getParent()) {
620 $count++;
621 }
622 return $count;
623 }

◆ getIdsOfUsersWithRelevantProgress()

ilObjStudyProgramme::getIdsOfUsersWithRelevantProgress ( )

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

1172 : array
1173 {
1174 return array_map(
1175 fn ($ass) => $ass->getUserId(),
1176 $this->getAssignments()
1177 );
1178 }

◆ getInstanceByObjId()

◆ getInstanceByRefId()

static ilObjStudyProgramme::getInstanceByRefId (   $ref_id)
static

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

161 {
162 if (self::$study_programme_cache === null) {
164 }
165 return self::$study_programme_cache->getInstanceByRefId((int) $ref_id);
166 }

References ilObject\$ref_id, and initStudyProgrammeCache().

Referenced by ilStudyProgrammeMembersTableGUI\__construct(), ilObjStudyProgrammeReferenceAccess\_checkAccess(), ilObjStudyProgrammeAccess\_checkAccess(), ilPRGPermissionsHelper\getAllAssignedUserIds(), getAllChildren(), getChildren(), getCompletedCourses(), getInstanceByObjId(), ilObjStudyProgrammeAutoCategoriesGUI\getObject(), ilObjStudyProgrammeAutoMembershipsGUI\getObject(), ilObjStudyProgrammeSettingsGUI\getObject(), ilStudyProgrammeChangeDeadlineGUI\getObject(), ilStudyProgrammeChangeExpireDateGUI\getObject(), getParent(), ilObjStudyProgrammeReference\getParent(), getPrgInstanceByObjId(), getProgrammesMonitoringCategory(), getProgrammesMonitoringMemberSource(), ilObjStudyProgrammeReference\getReferencedObject(), ilObjStudyProgrammeTreeExplorerGUI\getRootNode(), ilStudyProgrammeAppEventListener\getStudyProgramme(), ilObjStudyProgrammeMembersGUI\getStudyProgramme(), ilObjStudyProgrammeReference\putInTree(), putInTree(), ilObjStudyProgrammeMembersGUI\removeAssignment(), ilObjStudyProgrammeIndividualPlanGUI\setRefId(), ilObjStudyProgrammeMembersGUI\setRefId(), and ilStudyProgrammeType\updateAssignedStudyProgrammesIcons().

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

◆ getLastChange()

ilObjStudyProgramme::getLastChange ( )

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

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

310 : DateTime
311 {
312 return $this->getSettings()->getLastChange();
313 }

References getSettings().

+ Here is the call graph for this function:

◆ getLocalMembers()

ilObjStudyProgramme::getLocalMembers ( )

get usr_ids with assignment on this node

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

1091 : array
1092 {
1093 if (!$this->members_cache) {
1094 $this->members_cache = array_map(
1095 static function ($assignment) {
1096 return $assignment->getUserId();
1097 },
1098 $this->assignment_repository->getByPrgId($this->getId())
1099 );
1100 }
1101 return $this->members_cache;
1102 }

References $members_cache, and ilObject\getId().

+ Here is the call graph for this function:

◆ getLoggedInUserId()

ilObjStudyProgramme::getLoggedInUserId ( )
protected

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

1635 : int
1636 {
1637 return $this->ilUser->getId();
1638 }

Referenced by assignUser().

+ Here is the caller graph for this function:

◆ getLogger()

ilObjStudyProgramme::getLogger ( )
protected

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

180 : ilLogger
181 {
182 return $this->logger;
183 }
Component logger with individual log levels by component id.

References $logger.

◆ getLPChildren()

ilObjStudyProgramme::getLPChildren ( )

Get the leafs the study programme contains.

Returns
ilStudyProgrammeLeaf[]
Exceptions
ilStudyProgrammeTreeExceptionwhen this object is not in tree.

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

644 : array
645 {
646 $this->throwIfNotInTree();
647
648 if ($this->lp_children === null) {
649 $this->lp_children = array();
650
651 $ref_ids = $this->tree->getChildsByType($this->getRefId(), "crsr");
652
653 // apply container sorting to tree
654 $sorting = ilContainerSorting::_getInstance($this->getId());
655 $ref_ids = $sorting->sortItems(array('crs_ref' => $ref_ids));
656 $ref_ids = $ref_ids['crs_ref'];
657
658 $lp_children = array_map(function ($node_data) {
659 $lp_obj = $this->object_factory->getInstanceByRefId((int) $node_data["child"]);
660
661 // filter out all StudyProgramme instances
662 return ($lp_obj instanceof $this) ? null : $lp_obj;
663 }, $ref_ids);
664
665 $this->lp_children = array_filter($lp_children);
666 }
667 return $this->lp_children;
668 }

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

Referenced by getAmountOfLPChildren(), and getLPChildrenIds().

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

◆ getLPChildrenIds()

ilObjStudyProgramme::getLPChildrenIds ( )

Get the obj-ids of the leafs the program contains.

Returns
int[]
Exceptions
ilStudyProgrammeTreeException

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

676 : array
677 {
678 return array_map(static function ($child) {
679 return $child->getId();
680 }, $this->getLPChildren());
681 }

References getLPChildren().

+ Here is the call graph for this function:

◆ getLPMode()

ilObjStudyProgramme::getLPMode ( )

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

338 : int
339 {
340 return $this->getSettings()->getLPMode();
341 }

References getSettings().

Referenced by addNode(), and nodeInserted().

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

◆ getMembers()

ilObjStudyProgramme::getMembers ( )

get usr_ids with any progress on this node

Returns
int[]

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

1079 : array
1080 {
1081 $usr_ids = [];
1082 foreach ($this->getAssignments() as $assignment) {
1083 $usr_ids[] = $assignment->getUserId();
1084 }
1085 return array_unique($usr_ids);
1086 }

References getAssignments().

+ Here is the call graph for this function:

◆ getMembersOfMembershipSource()

ilObjStudyProgramme::getMembersOfMembershipSource ( string  $src_type,
int  $src_id 
)
protected

Get member-ids of a certain source.

Returns
int[]
Exceptions
InvalidArgumentExceptionif $src_type is not in AutoMembershipSource-types

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

1393 : array
1394 {
1395 $source_reader = $this->membersourcereader_factory->getReaderFor($src_type, $src_id);
1396 return $source_reader->getMemberIds();
1397 }

Referenced by enableAutomaticMembershipSource(), and getApplicableMembershipSourceForUser().

+ Here is the caller graph for this function:

◆ getMessageCollection()

ilObjStudyProgramme::getMessageCollection ( string  $topic)
protected

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

926 {
927 $msgs = new ilPRGMessageCollection();
928 return $msgs->withNewTopic($topic);
929 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getNow()

ilObjStudyProgramme::getNow ( )
protected

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

1640 : DateTimeImmutable
1641 {
1642 return new DateTimeImmutable();
1643 }

◆ getObjIdsOfChildren()

ilObjStudyProgramme::getObjIdsOfChildren ( int  $node_obj_id)
protected

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

1645 : array
1646 {
1647 $node_ref_id = self::getRefIdFor($node_obj_id);
1648
1649 $prgs = $this->tree->getChildsByType($node_ref_id, "prg");
1650 $prg_ids = array_map(
1651 static function ($nd) {
1652 return (int) $nd['obj_id'];
1653 },
1654 $prgs
1655 );
1656
1657 $prg_ref_ids = [];
1658 $prg_refs = $this->tree->getChildsByType($node_ref_id, "prgr");
1659 foreach ($prg_refs as $ref) {
1660 $ref_obj = new ilObjStudyProgrammeReference((int) $ref['ref_id']);
1661 $prg_ref_ids[] = $ref_obj->getReferencedObject()->getId();
1662 }
1663
1664 return array_merge($prg_ids, $prg_ref_ids);
1665 }
static getRefIdFor(int $obj_id)
$nd
Definition: error.php:12

References $nd, and getRefIdFor().

+ Here is the call graph for this function:

◆ getParent()

ilObjStudyProgramme::getParent ( )

Get the parent ilObjStudyProgramme of this object.

Returns null if parent is no StudyProgramme.

Exceptions
ilExceptionwhen this object is not in tree.

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

519 {
520 if ($this->parent === false) {
521 $this->throwIfNotInTree();
522 $parent_data = $this->tree->getParentNodeData($this->getRefId());
523 if ($parent_data["type"] !== "prg") {
524 $this->parent = null;
525 } else {
526 $this->parent = self::getInstanceByRefId($parent_data["ref_id"]);
527 }
528 }
529 return $this->parent;
530 }

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

Referenced by ilObjStudyProgrammeTreeExplorerGUI\listItemStart(), moveTo(), and removeNode().

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

◆ getParentId()

static ilObjStudyProgramme::getParentId ( ilObjCourseReference  $leaf)
staticprotected

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

Returns null if object is not in the tree currently.

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

1548 : ?int
1549 {
1550 global $DIC;
1551 $tree = $DIC['tree'];
1552 if (!$tree->isInTree($leaf->getRefId())) {
1553 return null;
1554 }
1555
1556 $nd = $tree->getParentNodeData($leaf->getRefId());
1557 return $nd["obj_id"];
1558 }
isInTree(?int $a_node_id)
get all information of a node.
getParentNodeData(int $a_node_id)
get data of parent node from tree and object_data

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

+ Here is the call graph for this function:

◆ getParents()

ilObjStudyProgramme::getParents ( bool  $include_references = false)

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

Returns
ilObjStudyProgramme[]

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

561 : array
562 {
563 $current = $this;
564 $parents = [];
565 $queque = [$current];
566 while ($element = array_shift($queque)) {
567 $parent = $element->getParent();
568 if ($parent === null || $include_references) {
569 foreach ($this->getReferencesTo($element) as $reference) {
570 if ($this->tree->isDeleted($reference->getRefId())) {
571 continue;
572 }
573 $r_parent = $reference->getParent();
574 if (is_null($r_parent)) {
575 continue;
576 }
577 $queque[] = $r_parent;
578 $parents[] = $r_parent;
579 }
580 continue;
581 }
582 $queque[] = $parent;
583 $parents[] = $parent;
584 }
585 return array_reverse($parents);
586 }
getReferencesTo(ilObjStudyProgramme $prg)

References $parent, and getReferencesTo().

Referenced by getRoot().

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

◆ getPoints()

ilObjStudyProgramme::getPoints ( )

Get the amount of points.

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

318 : int
319 {
320 return $this->getSettings()->getAssessmentSettings()->getPoints();
321 }

References getSettings().

+ Here is the call graph for this function:

◆ getPrgInstanceByObjId()

ilObjStudyProgramme::getPrgInstanceByObjId ( int  $obj_id)
protected

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

151 {
153 }

References getInstanceByRefId(), and getRefIdFor().

+ Here is the call graph for this function:

◆ getProgrammesMonitoringCategory()

static ilObjStudyProgramme::getProgrammesMonitoringCategory ( int  $cat_ref_id)
staticprotected

Get all (not OUTDATED) StudyProgrammes monitoring this category.

Returns
ilObjStudyProgramme[]

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

1272 : array
1273 {
1274 $db = ilStudyProgrammeDIC::dic()['model.AutoCategories.ilStudyProgrammeAutoCategoriesRepository'];
1275 $programmes =
1276 array_filter(
1277 array_map(
1278 static function (array $rec) {
1279 $values = array_values($rec);
1280 $prg_obj_id = (int) array_shift($values);
1281
1282 $references = ilObject::_getAllReferences($prg_obj_id);
1283 $prg_ref_id = (int) array_shift($references);
1284
1285 $prg = self::getInstanceByRefId($prg_ref_id);
1286 if ($prg->isAutoContentApplicable()) {
1287 return $prg;
1288 }
1289 },
1290 $db::getProgrammesFor($cat_ref_id)
1291 )
1292 );
1293 return $programmes;
1294 }
static _getAllReferences(int $id)
get all reference ids for object ID
ilDBInterface $db

References ilObject\$db, ilObject\_getAllReferences(), ilStudyProgrammeDIC\dic(), getInstanceByRefId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getProgrammesMonitoringMemberSource()

static ilObjStudyProgramme::getProgrammesMonitoringMemberSource ( string  $src_type,
int  $src_id 
)
staticprotected

Get all StudyProgrammes monitoring this membership-source.

Returns
ilObjStudyProgramme[]

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

1404 : array
1405 {
1406 $db = ilStudyProgrammeDIC::dic()['model.AutoMemberships.ilStudyProgrammeAutoMembershipsRepository'];
1407 $programmes = array_map(
1408 static function ($rec) {
1409 $values = array_values($rec);
1410 $prg_obj_id = (int) array_shift($values);
1411
1412 $references = ilObject::_getAllReferences($prg_obj_id);
1413 $prg_ref_id = (int) array_shift($references);
1414
1415 $prg = self::getInstanceByRefId($prg_ref_id);
1416 return $prg;
1417 },
1418 $db::getProgrammesFor($src_type, $src_id)
1419 );
1420 return $programmes;
1421 }

References ilObject\$db, ilObject\_getAllReferences(), ilStudyProgrammeDIC\dic(), getInstanceByRefId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getProgressIdString()

ilObjStudyProgramme::getProgressIdString ( ilPRGAssignment  $assignment,
ilPRGProgress  $progress 
)
protected

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

1886 : string
1887 {
1888 $username = ilObjUser::_lookupFullname($assignment->getUserId());
1889 return sprintf(
1890 '%s, progress-id (%s/%s)',
1891 $username,
1892 $assignment->getId(),
1893 $progress->getNodeId()
1894 );
1895 }
static _lookupFullname(int $a_user_id)

References ilObjUser\_lookupFullname(), ilPRGAssignment\getId(), ilPRGProgress\getNodeId(), and ilPRGAssignment\getUserId().

+ Here is the call graph for this function:

◆ getReferencesTo()

ilObjStudyProgramme::getReferencesTo ( ilObjStudyProgramme  $prg)
protected

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

532 : array
533 {
535 return array_filter(
536 array_map(
537 static function ($id) {
538 $refs = ilObject::_getAllReferences((int) $id);
540 array_shift($refs)
541 );
542 },
544 ),
545 static function ($prg_ref) use ($tree) {
546 return !$tree->isDeleted($prg_ref->getRefId());
547 }
548 );
549 }
static _lookupSourceIds(int $a_target_id)
Get ids of all container references that target the object with the given id.
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.

References ilObject\$id, ilObject\$tree, ilObject\_getAllReferences(), ilContainerReference\_lookupSourceIds(), ilObject\getId(), and ilTree\isDeleted().

Referenced by getParents(), and getReferencesToSelf().

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

◆ getReferencesToSelf()

ilObjStudyProgramme::getReferencesToSelf ( )

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

551 : array
552 {
553 return $this->getReferencesTo($this);
554 }

References getReferencesTo().

+ Here is the call graph for this function:

◆ getRefIdFor()

static ilObjStudyProgramme::getRefIdFor ( int  $obj_id)
static

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

141 : int
142 {
143 $refs = ilObject::_getAllReferences($obj_id);
144 if (count($refs) < 1) {
145 throw new ilException("Could not find ref_id for programme with obj_id $obj_id");
146 }
147 return (int) array_shift($refs);
148 }

References ilObject\_getAllReferences().

Referenced by ilStudyProgrammeMailMemberSearchGUI\getRootPrgRefId(), ilStudyProgrammeUserTable\lookupTitle(), and ilObjStudyProgrammeMembersGUI\removeAssignment().

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

◆ getRoot()

ilObjStudyProgramme::getRoot ( )

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

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

630 {
631 $parents = $this->getParents();
632 if (count($parents) < 1) {
633 return $this;
634 }
635 return $parents[0];
636 }
getParents(bool $include_references=false)
Get all parents of the node, where the root of the program comes first.

References getParents().

+ Here is the call graph for this function:

◆ getSettings()

◆ getSettingsRepository()

ilObjStudyProgramme::getSettingsRepository ( )
protected

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

173 {
175 }
ilStudyProgrammeSettingsDBRepository $settings_repository
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $settings_repository.

Referenced by assignUser(), create(), deleteSettings(), getSettings(), and updateSettings().

+ Here is the caller graph for this function:

◆ getSpecificAssignment()

ilObjStudyProgramme::getSpecificAssignment ( int  $assignment_id)

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

1003 {
1004 return $this->assignment_repository->get($assignment_id);
1005 }

◆ getStatus()

ilObjStudyProgramme::getStatus ( )

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

376 : int
377 {
378 return $this->getSettings()->getAssessmentSettings()->getStatus();
379 }

References getSettings().

Referenced by assignUser(), ilStudyProgrammeIndividualPlanProgressListGUI\getTitleForItem(), isActive(), and isAutoContentApplicable().

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

◆ getSubType()

ilObjStudyProgramme::getSubType ( )

Gets the SubType Object.

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

405 {
406 $type_settings = $this->getSettings()->getTypeSettings();
407 if (!in_array($type_settings->getTypeId(), array("-", "0"))) {
408 $subtype_id = $type_settings->getTypeId();
409 return $this->type_repository->getType($subtype_id);
410 }
411
412 return null;
413 }
Class ilStudyProgrammeType.

References getSettings().

+ Here is the call graph for this function:

◆ getTree()

ilObjStudyProgramme::getTree ( )
protected

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

176 : ilTree
177 {
178 return $this->tree;
179 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilObject\$tree.

◆ hasAdvancedMetadata()

ilObjStudyProgramme::hasAdvancedMetadata ( )

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

292 : bool
293 {
294 $sub_type_id = $this->getSettings()->getTypeSettings()->getTypeId();
295 $type = null;
296 if ($sub_type_id) {
297 $type = $this->type_repository->getType($sub_type_id);
298 }
299
300 return !is_null($type) && count($this->type_repository->getAssignedAMDRecordIdsByType($type->getId(), true)) > 0;
301 }

References ilObject\$type, and getSettings().

+ Here is the call graph for this function:

◆ hasAssignmentOf()

ilObjStudyProgramme::hasAssignmentOf ( int  $user_id)

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

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

1030 : bool
1031 {
1032 return $this->getAmountOfAssignmentsOf($user_id) > 0;
1033 }
getAmountOfAssignmentsOf(int $user_id)
Get the amount of assignments a user has on this program node or any node above.

References getAmountOfAssignmentsOf().

+ Here is the call graph for this function:

◆ hasAssignments()

ilObjStudyProgramme::hasAssignments ( )

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

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

1107 : bool
1108 {
1109 $filter = new ilPRGAssignmentFilter($this->lng);
1110 $count = $this->assignment_repository->countAllForNodeIsContained(
1111 $this->getId(),
1112 null,
1113 $filter
1114 );
1115 return $count > 0;
1116
1117 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilObject\getId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasAssignmentsOfSingleProgramForUser()

ilObjStudyProgramme::hasAssignmentsOfSingleProgramForUser ( int  $usr_id)

Get assignments of user to this program-node only.

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

1132 : bool
1133 {
1134 return count($this->getAssignmentsOfSingleProgramForUser($usr_id)) > 0;
1135 }

References getAssignmentsOfSingleProgramForUser().

+ Here is the call graph for this function:

◆ hasAutomaticContentCategories()

ilObjStudyProgramme::hasAutomaticContentCategories ( )

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

1194 : bool
1195 {
1196 return count($this->getAutomaticContentCategories()) > 0;
1197 }
getAutomaticContentCategories()
Get configuration of categories with auto-content for this StudyProgramme;.

References getAutomaticContentCategories().

+ Here is the call graph for this function:

◆ hasChildren()

ilObjStudyProgramme::hasChildren ( bool  $include_references = false)

Does this StudyProgramme have other ilObjStudyProgrammes as children?

Exceptions
ilStudyProgrammeTreeException

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

593 : bool
594 {
595 return $this->getAmountOfChildren($include_references) > 0;
596 }

References getAmountOfChildren().

+ Here is the call graph for this function:

◆ hasLPChildren()

ilObjStudyProgramme::hasLPChildren ( )

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

692 : bool
693 {
694 return ($this->getAmountOfLPChildren() > 0);
695 }

References getAmountOfLPChildren().

Referenced by isAutoContentApplicable().

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

◆ hasRelevantProgresses()

ilObjStudyProgramme::hasRelevantProgresses ( )

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

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

1158 : bool
1159 {
1160 $filter = new ilPRGAssignmentFilter($this->lng);
1161 $filter = $filter->withValues([
1162 'prg_status_hide_irrelevant' => true
1163 ]);
1164 $count = $this->assignment_repository->countAllForNodeIsContained(
1165 $this->getId(),
1166 null,
1167 $filter
1168 );
1169 return $count > 0;
1170 }

References ilObject\getId(), and ILIAS\Repository\lng().

Referenced by canBeRemoved().

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

◆ initStudyProgrammeCache()

static ilObjStudyProgramme::initStudyProgrammeCache ( )
static

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

109 : void
110 {
111 if (self::$study_programme_cache === null) {
112 self::$study_programme_cache = ilObjStudyProgrammeCache::singleton();
113 }
114 }

References ilObjStudyProgrammeCache\singleton().

Referenced by __construct(), and getInstanceByRefId().

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

◆ isActive()

ilObjStudyProgramme::isActive ( )

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

396 : bool
397 {
399 }

References getStatus(), and ilStudyProgrammeSettings\STATUS_ACTIVE.

+ Here is the call graph for this function:

◆ isAutoContentApplicable()

ilObjStudyProgramme::isAutoContentApplicable ( )

AutoContent should only be available in active- or draft-mode, and only, if there is no sub-programme.

Exceptions
ilStudyProgrammeTreeException

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

1302 : bool
1303 {
1304 $valid_status = in_array(
1305 $this->getSettings()->getAssessmentSettings()->getStatus(),
1306 [
1309 ],
1310 true
1311 );
1312
1313 $crslnk_allowed = (
1314 $this->hasLPChildren()
1315 || $this->getAmountOfChildren(true) === 0
1316 );
1317
1318 return $valid_status && $crslnk_allowed;
1319 }

References getAmountOfChildren(), getSettings(), getStatus(), hasLPChildren(), ilStudyProgrammeSettings\STATUS_ACTIVE, and ilStudyProgrammeSettings\STATUS_DRAFT.

+ Here is the call graph for this function:

◆ markAccredited()

ilObjStudyProgramme::markAccredited ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection 
)

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

1679 : void {
1680 $progress_node_id = $this->getId();
1681 $assignment = $this->assignment_repository->get($assignment_id)
1682 ->markAccredited(
1683 $this->getSettingsRepository(),
1684 $this->events,
1685 $progress_node_id,
1686 $acting_usr_id,
1687 $err_collection
1688 );
1689
1690 $this->assignment_repository->store($assignment);
1691 }

◆ markNotRelevant()

ilObjStudyProgramme::markNotRelevant ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection 
)

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

1715 : void {
1716 $progress_node_id = $this->getId();
1717 $assignment = $this->assignment_repository->get($assignment_id)
1718 ->markNotRelevant(
1719 $this->getSettingsRepository(),
1720 $progress_node_id,
1721 $acting_usr_id,
1722 $err_collection
1723 );
1724
1725 $this->assignment_repository->store($assignment);
1726 $this->refreshLPStatus($assignment->getUserId());
1727 }

◆ markRelevant()

ilObjStudyProgramme::markRelevant ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection 
)

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

1733 : void {
1734 $progress_node_id = $this->getId();
1735 $assignment = $this->assignment_repository->get($assignment_id)
1736 ->markRelevant(
1737 $this->getSettingsRepository(),
1738 $progress_node_id,
1739 $acting_usr_id,
1740 $err_collection
1741 );
1742
1743 $this->assignment_repository->store($assignment);
1744 $this->refreshLPStatus($assignment->getUserId());
1745 }

◆ moveTo()

ilObjStudyProgramme::moveTo ( ilObjStudyProgramme  $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
ilException

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

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

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

+ Here is the call graph for this function:

◆ nodeInserted()

ilObjStudyProgramme::nodeInserted (   $prg)

Clears child cache and adds progress for new node.

called by ilObjStudyProgrammeReference::putInTree, e.g.

Parameters
ilObjStudyProgrammeReference | ilObjStudyProgramme$prg
Exceptions
ilStudyProgrammeTreeException
ilException

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

810 : void
811 {
812 if (! $prg instanceof ilObjStudyProgrammeReference &&
813 ! $prg instanceof ilObjStudyProgramme
814 ) {
815 throw new ilStudyProgrammeTreeException("Wrong type of node: " . get_class($prg));
816 }
818 throw new ilStudyProgrammeTreeException("Program already contains leafs.");
819 }
820
822 $this->settings_repository->update(
824 );
825 }
826
827 $this->clearChildrenCache();
828 $this->addMissingProgresses();
829 }
addMissingProgresses()
Add missing progress records for all assignments of this programm.

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

+ Here is the call graph for this function:

◆ putInTree()

ilObjStudyProgramme::putInTree ( int  $parent_ref_id)

Overwritten from ilObject.

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

Parameters
int$parent_ref_id
Exceptions
ilStudyProgrammeTreeException
ilException

Reimplemented from ilContainer.

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

838 : void
839 {
840 parent::putInTree($parent_ref_id);
841
842 if (ilObject::_lookupType($parent_ref_id, true) === "prg") {
843 $par = self::getInstanceByRefId($parent_ref_id);
844 $par->nodeInserted($this);
845 }
846 }

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

Referenced by addNode().

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

◆ refreshLPStatus()

ilObjStudyProgramme::refreshLPStatus ( int  $usr_id,
int  $node_obj_id = null 
)
protected

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

1667 : void
1668 {
1669 if (is_null($node_obj_id)) {
1670 $node_obj_id = $this->getId();
1671 }
1672 ilLPStatusWrapper::_updateStatus($node_obj_id, $usr_id);
1673 }
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)

References ilLPStatusWrapper\_updateStatus(), and ILIAS\Survey\Mode\getId().

Referenced by removeAssignment().

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

◆ removeAssignment()

ilObjStudyProgramme::removeAssignment ( ilPRGAssignment  $assignment)

Remove an assignment from this program.

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

Exceptions
ilException

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

981 {
982 $this->members_cache = null;
983 if ($assignment->getRootId() !== $this->getId()) {
984 throw new ilException(
985 "ilObjStudyProgramme::removeAssignment: Assignment '"
986 . $assignment->getId() . "' does not belong to study "
987 . "program '" . $this->getId() . "'."
988 );
989 }
990
991 $this->assignment_repository->delete($assignment);
992
993 $affected_node_ids = array_map(fn ($pgs) => $pgs->getNodeId(), $assignment->getProgresses());
994 foreach ($affected_node_ids as $node_obj_id) {
995 $this->refreshLPStatus($assignment->getUserId(), $node_obj_id);
996 }
997
998 $this->events->userDeassigned($assignment);
999 return $this;
1000 }
getProgresses(array &$ret=[], ilPRGProgress $pgs=null)

References ilPRGAssignment\getId(), ilPRGAssignment\getProgresses(), ilPRGAssignment\getRootId(), ilPRGAssignment\getUserId(), and refreshLPStatus().

+ Here is the call graph for this function:

◆ removeCrsFromProgrammes()

static ilObjStudyProgramme::removeCrsFromProgrammes ( int  $crs_ref_id,
int  $cat_ref_id 
)
static

Check, if a category is under surveillance and automatically remove the deleted course.

Exceptions
ilStudyProgrammeTreeException

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

1257 : void
1258 {
1259 foreach (self::getProgrammesMonitoringCategory($cat_ref_id) as $prg) {
1260 foreach ($prg->getLPChildren() as $child) {
1261 if ((int) $child->getTargetRefId() === $crs_ref_id) {
1262 $child->delete();
1263 }
1264 }
1265 }
1266 }

Referenced by ilStudyProgrammeAppEventListener\removeCrsFromProgrammes().

+ Here is the caller graph for this function:

◆ removeMemberFromProgrammes()

static ilObjStudyProgramme::removeMemberFromProgrammes ( string  $src_type,
int  $src_id,
int  $usr_id 
)
static

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

1434 : void
1435 {
1436 $now = new DateTimeImmutable();
1437 $assignment_repository = ilStudyProgrammeDIC::dic()['repo.assignment'];
1438 foreach (self::getProgrammesMonitoringMemberSource($src_type, $src_id) as $prg) {
1439 $assignments = $prg->getAssignmentsOfSingleProgramForUser($usr_id);
1440 $next_membership_source = $prg->getApplicableMembershipSourceForUser($usr_id, $src_id);
1441
1442 foreach ($assignments as $assignment) {
1443 if (!$assignment->getProgressTree()->isInProgress()) {
1444 continue;
1445 }
1446
1447 if (!is_null($next_membership_source) && $next_membership_source->isEnabled()) {
1448 $new_src_type = $next_membership_source->getSourceType();
1449 $assigned_by = ilStudyProgrammeAutoMembershipSource::SOURCE_MAPPING[$new_src_type];
1450 $assignment = $assignment->withLastChange($assigned_by, $now);
1451 $assignment_repository->store($assignment);
1452 break;
1453 } else {
1454 $assignment_repository->delete($assignment);
1455 }
1456 }
1457 }
1458 }

References $assignment_repository, ilPRGAssignmentDBRepository\delete(), ilStudyProgrammeDIC\dic(), ilStudyProgrammeAutoMembershipSource\SOURCE_MAPPING, and ilPRGAssignmentDBRepository\store().

Referenced by ilStudyProgrammeAppEventListener\removeMemberFromProgrammes().

+ Here is the call graph for this function:
+ Here is the caller 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
ilStudyProgrammeTreeException

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

858 {
859 if ($a_prg->getParent()->getId() !== $this->getId()) {
860 throw new ilStudyProgrammeTreeException("This is no parent of the given programm.");
861 }
862
863 if (!$a_prg->canBeRemoved()) {
864 throw new ilStudyProgrammeTreeException("The node has relevant assignments.");
865 }
866
867 // *sigh*...
868 $node_data = $this->tree->getNodeData($a_prg->getRefId());
869 $this->tree->deleteTree($node_data);
870 $a_prg->clearParentCache();
871 $this->clearChildrenCache();
872
873 return $this;
874 }
canBeRemoved()
Check weather a node can be removed.

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

+ Here is the call graph for this function:

◆ resetExpiryInfoSentFor()

ilObjStudyProgramme::resetExpiryInfoSentFor ( ilPRGAssignment  $ass)

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

1012 : void
1013 {
1014 $this->assignment_repository->resetExpiryInfoSentFor($ass);
1015 }

Referenced by ilPRGMail\resetExpiryInfoSentFor().

+ Here is the caller graph for this function:

◆ resetRiskyToFailSentFor()

ilObjStudyProgramme::resetRiskyToFailSentFor ( ilPRGAssignment  $ass)

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

1022 : void
1023 {
1024 $this->assignment_repository->resetRiskyToFailSentFor($ass);
1025 }

Referenced by ilPRGMail\resetRiskyToFailSentFor().

+ Here is the caller graph for this function:

◆ setPoints()

ilObjStudyProgramme::setPoints ( int  $points)

Set the amount of points.

Exceptions
ilException

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

329 {
330 $settings = $this->getSettings();
331 $this->updateSettings(
332 $settings->withAssessmentSettings($settings->getAssessmentSettings()->withPoints($points))
333 );
334 $this->updateLastChange();
335 return $this;
336 }
updateSettings(ilStudyProgrammeSettings $settings)
updateLastChange()
Update last change timestamp on this node and its parents.
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References ILIAS\LTI\ToolProvider\$settings, getSettings(), updateLastChange(), and updateSettings().

+ Here is the call graph for this function:

◆ setProgressesCompletedIfParentIsProgrammeInLPCompletedMode()

static ilObjStudyProgramme::setProgressesCompletedIfParentIsProgrammeInLPCompletedMode ( int  $ref_id,
int  $obj_id,
int  $user_id 
)
static

Succeed all StudyProgramme(Nodes) where the object with the given id (a CRSR) is in a Programme with MODE_LP_COMPLETED.

This is exclusively called via event "Services/Tracking, updateStatus" (onServiceTrackingUpdateStatus)

Parameters
int$ref_idthe RefId of the CRSR; used to find the PRG it's in
int$obj_idthe ObjId of the CRS; used as "triggering object"
int$user_idthe user's id to succeed for; all assignments are affected
Exceptions
ilException

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

1509 : void {
1510 global $DIC; // TODO: replace this by a settable static for testing purpose?
1511 $tree = $DIC['tree'];
1512 $node_data = $tree->getParentNodeData($ref_id);
1513 if (count($node_data) === 0 || !array_key_exists('type', $node_data) || $node_data["type"] !== "prg") {
1514 return;
1515 }
1517 $prg = self::getInstanceByRefId($node_data["child"]);
1518 if ($prg->getLPMode() !== ilStudyProgrammeSettings::MODE_LP_COMPLETED) {
1519 return;
1520 }
1521 $prg->succeed($user_id, $obj_id);
1522 }

Referenced by ilStudyProgrammeAppEventListener\onServiceTrackingUpdateStatus().

+ Here is the caller graph for this function:

◆ setStatus()

ilObjStudyProgramme::setStatus ( int  $a_status)

Set the status of the node.

Exceptions
ilException

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

387 {
388 $settings = $this->getSettings();
389 $this->updateSettings(
390 $settings->withAssessmentSettings($settings->getAssessmentSettings()->withStatus($a_status))
391 );
392 $this->updateLastChange();
393 return $this;
394 }

References ILIAS\LTI\ToolProvider\$settings, getSettings(), updateLastChange(), and updateSettings().

+ Here is the call graph for this function:

◆ statusToRepr()

ilObjStudyProgramme::statusToRepr ( int  $status)

Get a user readable representation of a status.

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

1864 : string
1865 {
1866 $lng = $this->lng;
1867 $lng->loadLanguageModule("prg");
1868 if ($status === ilPRGProgress::STATUS_IN_PROGRESS) {
1869 return $lng->txt("prg_status_in_progress");
1870 }
1871 if ($status === ilPRGProgress::STATUS_COMPLETED) {
1872 return $lng->txt("prg_status_completed");
1873 }
1874 if ($status === ilPRGProgress::STATUS_ACCREDITED) {
1875 return $lng->txt("prg_status_accredited");
1876 }
1877 if ($status === ilPRGProgress::STATUS_NOT_RELEVANT) {
1878 return $lng->txt("prg_status_not_relevant");
1879 }
1880 if ($status === ilPRGProgress::STATUS_FAILED) {
1881 return $lng->txt("prg_status_failed");
1882 }
1883 throw new ilException("Unknown status: '$status'");
1884 }
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilLanguage $lng

References $lng, ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, and ilPRGProgress\STATUS_NOT_RELEVANT.

◆ storeAutomaticContentCategory()

ilObjStudyProgramme::storeAutomaticContentCategory ( int  $category_ref_id)

Store a Category with auto-content for this StudyProgramme; a category can only be referenced once (per programme).

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

1204 : void
1205 {
1206 $ac = $this->auto_categories_repository->create(
1207 $this->getId(),
1208 $category_ref_id
1209 );
1210 $this->auto_categories_repository->update($ac);
1211 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ storeAutomaticMembershipSource()

ilObjStudyProgramme::storeAutomaticMembershipSource ( string  $type,
int  $src_id 
)

Store a source to be monitored for automatic memberships.

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

1338 : void
1339 {
1340 $ams = $this->auto_memberships_repository->create($this->getId(), $type, $src_id, false);
1341 $this->auto_memberships_repository->update($ams);
1342 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ storeExpiryInfoSentFor()

ilObjStudyProgramme::storeExpiryInfoSentFor ( ilPRGAssignment  $ass)

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

1007 : void
1008 {
1009 $this->assignment_repository->storeExpiryInfoSentFor($ass);
1010 }

Referenced by ilPRGMail\sendInformToReAssignMail().

+ Here is the caller graph for this function:

◆ storeRiskyToFailSentFor()

ilObjStudyProgramme::storeRiskyToFailSentFor ( ilPRGAssignment  $ass)

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

1017 : void
1018 {
1019 $this->assignment_repository->storeRiskyToFailSentFor($ass);
1020 }

Referenced by ilPRGMail\sendRiskyToFailMail().

+ Here is the caller graph for this function:

◆ succeed()

ilObjStudyProgramme::succeed ( int  $usr_id,
int  $triggering_obj_id,
ilPRGAssignment  $ass = null 
)

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

1524 : void
1525 {
1526 $progress_node_id = $this->getId();
1527 if (is_null($ass)) {
1528 $user_assignments = $this->assignment_repository
1529 ->getAllForNodeIsContained($progress_node_id, [$usr_id]);
1530 } else {
1531 $user_assignments = [$ass];
1532 }
1533
1534 foreach ($user_assignments as $ass) {
1535 $ass = $ass->succeed(
1536 $this->getSettingsRepository(),
1537 $progress_node_id,
1538 $triggering_obj_id
1539 );
1540 $this->assignment_repository->store($ass);
1541 }
1542 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ throwIfNotInTree()

ilObjStudyProgramme::throwIfNotInTree ( )
protected
Exceptions
ilStudyProgrammeTreeExceptionif object is not in tree.

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

700 : void
701 {
702 if (!$this->tree->isInTree($this->getRefId())) {
703 throw new ilStudyProgrammeTreeException("This program is not in tree.");
704 }
705 }

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

+ Here is the caller graph for this function:

◆ unmarkAccredited()

ilObjStudyProgramme::unmarkAccredited ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection 
)

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

1697 : void {
1698 $progress_node_id = $this->getId();
1699 $assignment = $this->assignment_repository->get($assignment_id)
1700 ->unmarkAccredited(
1701 $this->getSettingsRepository(),
1702 $progress_node_id,
1703 $acting_usr_id,
1704 $err_collection
1705 );
1706
1707 $this->assignment_repository->store($assignment);
1708 $this->refreshLPStatus($assignment->getUserId());
1709 }

◆ update()

ilObjStudyProgramme::update ( )
Exceptions
ilException

Reimplemented from ilContainer.

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

246 : bool
247 {
248 parent::update();
249
250 $type_settings = $this->getSettings()->getTypeSettings();
251 // Update selection for advanced metadata of the type
252 if ($type_settings->getTypeId()) {
254 $this->getId(),
255 'prg_type',
256 $this->type_repository->getAssignedAMDRecordIdsByType($type_settings->getTypeId())
257 );
258 } else {
259 // If no type is assigned, delete relations by passing an empty array
260 ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', array());
261 }
262 return true;
263 }
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.

References ilObject\getId(), getSettings(), and ilAdvancedMDRecord\saveObjRecSelection().

+ Here is the call graph for this function:

◆ updateCustomIcon()

ilObjStudyProgramme::updateCustomIcon ( )

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

1561 : void
1562 {
1563 $customIcon = $this->custom_icon_factory->getByObjId($this->getId(), $this->getType());
1564 $subtype = $this->getSubType();
1565
1566 if ($subtype
1567 && $this->webdir->has($subtype->getIconPath(true))
1568 && $subtype->getIconPath(true) !== $subtype->getIconPath(false)
1569 ) {
1570 $icon = $subtype->getIconPath(true);
1571 $customIcon->saveFromSourceFile($icon);
1572 } else {
1573 $customIcon->remove();
1574 }
1575 }
getSubType()
Gets the SubType Object.

References ILIAS\Survey\Mode\getId().

Referenced by ilObjStudyProgrammeSettingsGUI\buildForm().

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

◆ updateLastChange()

ilObjStudyProgramme::updateLastChange ( )
protected

Update last change timestamp on this node and its parents.

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

1485 : void
1486 {
1487 $this->getSettings()->updateLastChange();
1488 if ($parent = $this->getParent()) {
1489 $parent->updateLastChange();
1490 }
1491 $this->update();
1492 }

References ILIAS\LTI\ToolProvider\getSettings().

Referenced by setPoints(), and setStatus().

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

◆ updatePlanFromRepository()

ilObjStudyProgramme::updatePlanFromRepository ( int  $assignment_id,
int  $acting_usr_id,
ilPRGMessageCollection  $err_collection = null 
)

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

1812 : void {
1813 $assignment = $this->assignment_repository->get($assignment_id)
1814 ->updatePlanFromRepository(
1815 $this->getSettingsRepository(),
1816 $acting_usr_id,
1817 $err_collection
1818 );
1819
1820 $this->assignment_repository->store($assignment);
1821 $this->refreshLPStatus($assignment->getUserId());
1822 }

◆ updateSettings()

ilObjStudyProgramme::updateSettings ( ilStudyProgrammeSettings  $settings)

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

208 : bool
209 {
210 if ($settings->getObjId() !== $this->getId()) {
211 throw new Exception("The given settings-object does not belong to this programme", 1);
212 }
213 $this->getSettingsRepository()->update($settings);
214
215 return true;
216 }

References ILIAS\LTI\ToolProvider\$settings, and getSettingsRepository().

Referenced by ilObjStudyProgrammeSettingsGUI\buildForm(), setPoints(), and setStatus().

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

Field Documentation

◆ $assignment_repository

ilPRGAssignmentDBRepository ilObjStudyProgramme::$assignment_repository
protected

◆ $auto_categories_repository

ilStudyProgrammeAutoCategoryDBRepository ilObjStudyProgramme::$auto_categories_repository
protected

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

◆ $auto_memberships_repository

ilStudyProgrammeAutoMembershipsDBRepository ilObjStudyProgramme::$auto_memberships_repository
protected

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

◆ $children

array ilObjStudyProgramme::$children = null
protected

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

Referenced by getChildren().

◆ $custom_icon_factory

ilObjectCustomIconFactory ilObjStudyProgramme::$custom_icon_factory
protected

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

◆ $events

ilStudyProgrammeEvents ilObjStudyProgramme::$events
protected

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

◆ $ilUser

ilObjUser ilObjStudyProgramme::$ilUser
protected

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

Referenced by __construct().

◆ $logger

ilLogger ilObjStudyProgramme::$logger
protected

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

Referenced by getLogger().

◆ $lp_children

array ilObjStudyProgramme::$lp_children = null
protected

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

Referenced by getLPChildren().

◆ $members_cache

array ilObjStudyProgramme::$members_cache = null
protected

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

Referenced by getLocalMembers().

◆ $membersourcereader_factory

ilStudyProgrammeMembershipSourceReaderFactory ilObjStudyProgramme::$membersourcereader_factory
protected

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

◆ $object_factory

ilObjectFactoryWrapper ilObjStudyProgramme::$object_factory = null
protected

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

◆ $parent

ilObjStudyProgramme::$parent
protected

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

Referenced by getParent(), getParents(), and moveTo().

◆ $reference_children

array ilObjStudyProgramme::$reference_children = null
protected

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

◆ $settings_repository

ilStudyProgrammeSettingsDBRepository ilObjStudyProgramme::$settings_repository
protected

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

Referenced by getSettingsRepository().

◆ $study_programme_cache

ilObjStudyProgrammeCache ilObjStudyProgramme::$study_programme_cache = null
staticprotected

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

◆ $type_repository

ilStudyProgrammeTypeDBRepository ilObjStudyProgramme::$type_repository
protected

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

◆ $webdir

Filesystem ilObjStudyProgramme::$webdir
protected

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


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