ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
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 ()
 
 cloneObject (int $target_ref_id, int $copy_id=0, bool $omit_tree=false)
 
 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...
 
 isCertificateActive ()
 
 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 (ilPRGAssignment $assignment)
 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...
 
 getCertificateRelevantAssignmentIds (int ... $usr_ids)
 
 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, bool $search_recursive)
 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, bool $search_recursive)
 Disable a membership source. More...
 
 enableAutomaticMembershipSource (string $type, int $src_id, bool $search_recursive, $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...
 
 hasContentPage ()
 
 createContentPage ()
 
- Public Member Functions inherited from ilContainer
 getTileSizes ()
 
 getObjectTranslation ()
 
 setObjectTranslation (?Translations $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
 getObjectProperties ()
 
 flushObjectProperties ()
 
 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 $description)
 
 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, int $new_obj_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 setProgressesCompletedFor (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 setProgressesCompletedIfParentIsProgrammeInLPCompletedMode (int $ref_id, int $obj_id, int $user_id)
 
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 getIconForType (string $type)
 
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)
 

Data Fields

const CP_TYPE = 'cont'
 
- 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
 

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 ()
 
 getMembersOfMembershipSource (ilStudyProgrammeAutoMembershipSource $ams, ?int $exclude_id)
 Get member-ids of a certain source. More...
 
 updateLastChange ()
 Update last change timestamp on this node and its parents. More...
 
 getLoggedInUserId ()
 
 getNow ()
 
 refreshLPStatus (int $usr_id, ?int $node_obj_id=null)
 
- Protected Member Functions inherited from ilContainer
 getInitialSubitems ()
 
 applyContainerUserFilter (array $objects, ?ilContainerUserFilter $container_user_filter=null)
 
- 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...
 

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
 
CustomIconFactory $custom_icon_factory
 
ilLogger $logger
 
- Protected Attributes inherited from ilContainer
News $news
 
ILIAS Style Content DomainService $content_style_domain
 
ILIAS Container InternalDomainService $domain
 
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
 
Translations $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
 
array $type_grps = null
 
- 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
 
LOMServices $lom_services
 
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 = ""
 
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

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

Detailed Description

Definition at line 24 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.

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

76 {
78 $this->type = "prg";
79
80 $this->type_repository = $dic['model.Type.ilStudyProgrammeTypeRepository'];
81 $this->auto_categories_repository = $dic['model.AutoCategories.ilStudyProgrammeAutoCategoriesRepository'];
82 $this->auto_memberships_repository = $dic['model.AutoMemberships.ilStudyProgrammeAutoMembershipsRepository'];
83 $this->membersourcereader_factory = $dic['model.AutoMemberships.ilStudyProgrammeMembershipSourceReaderFactory'];
84
85 $this->settings_repository = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
86 $this->assignment_repository = $dic['repo.assignment'];
87 $this->events = $dic['ilStudyProgrammeEvents'];
88
90
91 $this->clearParentCache();
92 $this->clearChildrenCache();
93 $this->clearLPChildrenCache();
94
95 global $DIC;
96 $tree = $DIC['tree'];
97 $ilUser = $DIC['ilUser'];
98 $this->webdir = $DIC->filesystem()->web();
99 $this->tree = $tree;
100 $this->ilUser = $ilUser;
101 $this->db = $DIC['ilDB'];
102 $this->lng = $DIC['lng'];
103 $this->logger = ilLoggerFactory::getLogger($this->type);
104
105 $this->object_factory = ilObjectFactoryWrapper::singleton();
106
107 $this->custom_icon_factory = $DIC['object.customicons.factory'];
108
110 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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
$dic
Definition: ltiresult.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References ilObject\$call_by_reference, $DIC, $dic, $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 1848 of file class.ilObjStudyProgramme.php.

1852 : void {
1853 $acting_usr_id = $this->getLoggedInUserId();
1854 $assignment = $this->assignment_repository->get($assignment_id);
1855 foreach ($nodes as $nodeinfo) {
1856 [$node_obj_id, $course_obj_id] = $nodeinfo;
1857
1858 $assignment = $assignment->succeed(
1859 $this->settings_repository,
1860 $node_obj_id,
1861 $course_obj_id
1862 );
1863
1864 $msg = sprintf(
1865 '%s, progress-id (%s/%s)',
1866 $assignment->getUserInformation()->getFullname(),
1867 $assignment->getId(),
1868 (string) $node_obj_id
1869 );
1870 $err_collection->add(true, 'acknowledged_course', $msg);
1871 }
1872 $this->assignment_repository->store($assignment);
1873 $this->refreshLPStatus($assignment->getUserId());
1874 }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)

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

1257 : void
1258 {
1259 foreach (self::getProgrammesMonitoringCategory($cat_ref_id) as $prg) {
1260 $course_ref = new ilObjCourseReference();
1261 $course_ref->setTitleType(ilContainerReference::TITLE_TYPE_REUSE);
1262 $course_ref->setTargetRefId($crs_ref_id);
1263 $course_ref->create();
1264 $course_ref->createReference();
1265 $course_ref->putInTree($prg->getRefId());
1266 $course_ref->setPermissions($crs_ref_id);
1267 $course_ref->setTargetId(ilObject::_lookupObjectId($crs_ref_id));
1268 $course_ref->update();
1269 $lp = new ilLPObjSettings($course_ref->getId());
1270 $lp->insert();
1271 $lp->setMode($lp::LP_MODE_COURSE_REFERENCE);
1272 $lp->update(false);
1273 }
1274 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 1470 of file class.ilObjStudyProgramme.php.

1470 : void
1471 {
1472 foreach (self::getProgrammesMonitoringMemberSource($src_type, $src_id) as $prg) {
1473 if ($prg->isActive() &&
1474 !$prg->hasAssignmentsOfSingleProgramForUser($usr_id)) {
1476 $prg->assignUser($usr_id, $assigned_by);
1477 }
1478 }
1479 }

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

1171 : void
1172 {
1173 $assignments = $this->getAssignments();
1174 foreach ($assignments as $ass) {
1175 $this->assignment_repository->store($ass);
1176 }
1177 }

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

803 {
804 $this->throwIfNotInTree();
805
807 throw new ilStudyProgrammeTreeException("Program already contains leafs.");
808 }
809
810 if ($this->tree->isInTree($a_prg->getRefId())) {
811 throw new ilStudyProgrammeTreeException("Other program already is in tree.");
812 }
813
814 if ($a_prg->getRefId() === null) {
815 $a_prg->createReference();
816 }
817 $a_prg->putInTree($this->getRefId());
818 return $this;
819 }
putInTree(int $parent_ref_id)
Overwritten from ilObject.
createReference()
creates reference for object
Exception is thrown when invariants on the program tree would be violated by manipulation of tree.

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

365 : void
366 {
367 // Clear caches here, there have been some changes, because this method
368 // would not have been called otherwise, and the changer just does not
369 // know if we have filled the caches already...
370 $this->clearLPChildrenCache();
371 $this->clearChildrenCache();
372
373 if ($this->tree->isInTree($this->getRefId())) {
374 if ($this->getAmountOfLPChildren() > 0) {
375 $this->settings_repository->update(
377 );
378 } elseif ($this->getAmountOfChildren(true) > 0) {
379 $this->settings_repository->update(
381 );
382 } else {
383 $this->settings_repository->update(
385 );
386 }
387 }
388 }
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 737 of file class.ilObjStudyProgramme.php.

737 : void
738 {
739 $this->throwIfNotInTree();
740
741 if ($fun($this) !== false) {
742 foreach ($this->getChildren($include_references) as $child) {
743 $child->applyToSubTreeNodes($fun, $include_references);
744 }
745 }
746 }
getChildren(bool $include_references=false)
Get all ilObjStudyProgrammes that are direct children of this object.

References getChildren(), and throwIfNotInTree().

Referenced by getAllPrgChildren(), and getCompletedCourses().

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

955 {
956 $this->members_cache = null;
957
959 throw new ilException(
960 "ilObjStudyProgramme::assignUser: Can't assign user to program '"
961 . $this->getId() . "', since it's not in active status."
962 );
963 }
964
965 if (is_null($acting_usr_id)) {
966 $acting_usr_id = $this->getLoggedInUserId();
967 }
968
969 $ass = $this->assignment_repository->createFor($this->getId(), $usr_id, $acting_usr_id);
970 $ass = $ass
971 ->initAssignmentDates();
972
973 $ass = $ass->resetProgresses(
974 $this->getSettingsRepository(),
975 $acting_usr_id
976 );
977
978 $this->assignment_repository->store($ass);
979
980 if ($raise_event) {
981 $this->events->userAssigned($ass);
982 }
983 return $ass;
984 }
Base class for ILIAS Exception handling.
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 1876 of file class.ilObjStudyProgramme.php.

1876 : bool
1877 {
1879 return false;
1880 }
1882 return true;
1883 }
1884 $possible_points = $progress->getPossiblePointsOfRelevantChildren();
1885 return $possible_points >= $progress->getAmountOfPoints();
1886 }

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

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

899 : bool
900 {
901 return ! $this->hasRelevantProgresses();
902 }
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 1812 of file class.ilObjStudyProgramme.php.

1817 : void {
1818 $progress_node_id = $this->getId();
1819 $assignment = $this->assignment_repository->get($assignment_id)
1820 ->changeAmountOfPoints(
1821 $this->getSettingsRepository(),
1822 $progress_node_id,
1823 $acting_usr_id,
1824 $err_collection,
1825 $points
1826 );
1827
1828 $this->assignment_repository->store($assignment);
1829 $this->refreshLPStatus($assignment->getUserId());
1830 }

◆ changeProgressDeadline()

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

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

1777 : void {
1778 $progress_node_id = $this->getId();
1779 $assignment = $this->assignment_repository->get($assignment_id)
1780 ->changeProgressDeadline(
1781 $this->getSettingsRepository(),
1782 $progress_node_id,
1783 $acting_usr_id,
1784 $err_collection,
1785 $deadline
1786 );
1787
1788 $this->assignment_repository->store($assignment);
1789 $this->refreshLPStatus($assignment->getUserId());
1790 }

◆ changeProgressValidityDate()

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

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

1797 : void {
1798 $progress_node_id = $this->getId();
1799 $assignment = $this->assignment_repository->get($assignment_id)
1800 ->changeProgressValidityDate(
1801 $this->getSettingsRepository(),
1802 $progress_node_id,
1803 $acting_usr_id,
1804 $err_collection,
1805 $validity
1806 );
1807
1808 $this->assignment_repository->store($assignment);
1809 $this->refreshLPStatus($assignment->getUserId());
1810 }

◆ clearChildrenCache()

ilObjStudyProgramme::clearChildrenCache ( )
protected

Clear the cached children.

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

131 : void
132 {
133 $this->children = null;
134 }

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

139 : void
140 {
141 $this->lp_children = null;
142 }

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

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

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

+ Here is the caller graph for this function:

◆ cloneObject()

ilObjStudyProgramme::cloneObject ( int  $target_ref_id,
int  $copy_id = 0,
bool  $omit_tree = false 
)

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

306 : ?ilObject
307 {
308 $new_obj = parent::cloneObject($target_ref_id, $copy_id, $omit_tree);
309 $settings = $this->getSettings()->withObjId($new_obj->getId());
310 $settings = $settings->withAssessmentSettings(
311 $settings->getAssessmentSettings()->withStatus(ilStudyProgrammeSettings::STATUS_DRAFT)
312 );
313 $new_obj->updateSettings($settings);
314 return $new_obj;
315 }
Class ilObject Basic functions for all objects.

References getSettings(), and ilStudyProgrammeSettings\STATUS_DRAFT.

+ Here is the call graph for this function:

◆ create()

ilObjStudyProgramme::create ( )
Exceptions
ilException

Reimplemented from ilContainer.

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

239 : int
240 {
241 $id = (int) parent::create();
242 $this->getSettingsRepository()->createFor($id);
243 return $id;
244 }

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

+ Here is the call graph for this function:

◆ createContentPage()

ilObjStudyProgramme::createContentPage ( )

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

1917 : void
1918 {
1919 if ($this->hasContentPage()) {
1920 throw new \LogicException('will not create content page - it already exists.');
1921 }
1922 $new_page_object = new \ilContainerPage();
1923 $new_page_object->setId($this->getId());
1924 $new_page_object->setParentId($this->getId());
1925 $new_page_object->createFromXML();
1926 }

References ILIAS\Survey\Mode\getId().

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

194 {
195 $obj = new ilObjStudyProgramme();
196 $obj->create();
197 $obj->createReference();
198 self::$study_programme_cache->addInstance($obj);
199 return $obj;
200 }

◆ delete()

ilObjStudyProgramme::delete ( )

Delete Study Programme and all related data.

Exceptions
ilException

Reimplemented from ilContainer.

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

273 : bool
274 {
275 // always call parent delete function first!!
276 if (!parent::delete()) {
277 return false;
278 }
279
280 $this->deleteSettings();
282 try {
283 $this->auto_categories_repository->deleteFor($this->getId());
285 // This would be the case when SP is in trash (#17797)
286 }
287
290
291 $this->events->raise('delete', ['object' => $this, 'obj_id' => $this->getId()]);
292 return true;
293 }
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 1249 of file class.ilObjStudyProgramme.php.

1249 : void
1250 {
1251 $this->auto_categories_repository->deleteFor($this->getId());
1252 }

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

1387 : void
1388 {
1389 $this->auto_memberships_repository->deleteFor($this->getId());
1390 }

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

231 : void
232 {
233 $this->assignment_repository->deleteAllAssignmentsForProgrammeId($this->getId());
234 }

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

1241 : void
1242 {
1243 $this->auto_categories_repository->delete($this->getId(), $category_ids);
1244 }

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

1379 : void
1380 {
1381 $this->auto_memberships_repository->delete($this->getId(), $type, $src_id);
1382 }
string $type

References ilObject\getId().

+ Here is the call graph for this function:

◆ deleteSettings()

ilObjStudyProgramme::deleteSettings ( )
protected

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

221 : void
222 {
223 $this->getSettingsRepository()->delete($this->getSettings());
224 }

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,
bool  $search_recursive 
)

Disable a membership source.

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

1395 : void
1396 {
1397 $ams = $this->auto_memberships_repository->create(
1398 $this->getId(),
1399 $type,
1400 $src_id,
1401 false,
1402 null,
1403 null,
1404 $search_recursive
1405 );
1406 $this->auto_memberships_repository->update($ams);
1407 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ enableAutomaticMembershipSource()

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

Enable a membership source.

Exceptions
ilException

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

1413 : void
1414 {
1415 if ($assign_now) {
1417 $member_ids = $this->getMembersOfMembershipSource($type, $src_id);
1418 foreach ($member_ids as $usr_id) {
1419 if (!$this->getAssignmentsOfSingleProgramForUser($usr_id)) {
1420 $this->assignUser($usr_id, $assigned_by);
1421 }
1422 }
1423 }
1424 $ams = $this->auto_memberships_repository->create(
1425 $this->getId(),
1426 $type,
1427 $src_id,
1428 true,
1429 null,
1430 null,
1431 $search_recursive
1432 );
1433 $this->auto_memberships_repository->update($ams);
1434 }
getMembersOfMembershipSource(ilStudyProgrammeAutoMembershipSource $ams, ?int $exclude_id)
Get member-ids of a certain source.
assignUser(int $usr_id, ?int $acting_usr_id=null, $raise_event=true)
Assign a user to this node at the study program.
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 454 of file class.ilObjStudyProgramme.php.

454 : array
455 {
456 $ret = array();
457 $root = self::getInstanceByRefId($a_ref_id);
458 $root_id = $root->getId();
459 $root->applyToSubTreeNodes(function (ilObjStudyProgramme $prg) use (&$ret, $root_id) {
460 // exclude root node of subtree.
461 if ($prg->getId() === $root_id) {
462 return;
463 }
464 $ret[] = $prg;
465 }, $include_references);
466 return $ret;
467 }

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

+ Here is the call graph for this function:

◆ getAllPrgChildren()

ilObjStudyProgramme::getAllPrgChildren ( )

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

469 : array
470 {
471 $ret = [];
472 $this->applyToSubTreeNodes(
473 function (ilObjStudyProgramme $prg) use (&$ret) {
474 if ($prg->getId() === $this->getId()) {
475 return;
476 }
477 $ret[] = $prg;
478 }
479 );
480 return $ret;
481 }
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 1052 of file class.ilObjStudyProgramme.php.

1052 : int
1053 {
1054 return count($this->getAssignmentsOf($user_id));
1055 }
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 623 of file class.ilObjStudyProgramme.php.

623 : int
624 {
625 return count($this->getChildren($include_references));
626 }

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

706 : int
707 {
708 return count($this->getLPChildren());
709 }
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 1511 of file class.ilObjStudyProgramme.php.

1515 foreach ($this->getAutomaticMembershipSources() as $ams) {
1516 if ($ams->isEnabled()) {
1517 $source_members = $this->getMembersOfMembershipSource($ams, $exclude_id);
1518 if (in_array($usr_id, $source_members)) {
1519 return $ams;
1520 }
1521 }
1522 }
1523 return null;
1524 }
getAutomaticMembershipSources()
Get sources for auto-memberships.

References getMembersOfMembershipSource().

+ Here is the call graph for this function:

◆ getAssignmentRepository()

ilObjStudyProgramme::getAssignmentRepository ( )
protected

◆ getAssignments()

ilObjStudyProgramme::getAssignments ( )
Returns
ilPRGAssignment[]

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

1086 : array
1087 {
1088 return $this->assignment_repository->getAllForNodeIsContained($this->getId());
1089 }

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

1064 : array
1065 {
1066 $assignments = $this->assignment_repository->getAllForNodeIsContained(
1067 $this->getId(),
1068 [$user_id]
1069 );
1070
1071 usort($assignments, static function (ilPRGAssignment $a_one, ilPRGAssignment $a_other): int {
1072 $left = $a_one->getLastChange();
1073 $right = $a_other->getLastChange();
1074 if ($left === null || $right === null) {
1075 return (int) ($left !== null) <=> (int) ($right !== null);
1076 }
1077
1078 return $left->getTimestamp() <=> $right->getTimestamp();
1079 });
1080 return $assignments;
1081 }

References ilObject\getId(), and ilPRGAssignment\getLastChange().

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

1140 : array
1141 {
1142 return $this->assignment_repository->getAllForSpecificNode($this->getId(), [$usr_id]);
1143 }

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

1213 : array
1214 {
1215 return $this->auto_categories_repository->getFor($this->getId());
1216 }

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

1354 : array
1355 {
1356 return $this->auto_memberships_repository->getFor($this->getId());
1357 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ getCertificateRelevantAssignmentIds()

ilObjStudyProgramme::getCertificateRelevantAssignmentIds ( int ...  $usr_ids)

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

1153 : array
1154 {
1155 return $this->assignment_repository->getCertificateRelevantAssignmentIds(
1156 $this->getId(),
1157 ...$usr_ids
1158 );
1159 }

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

490 : array
491 {
492 $this->throwIfNotInTree();
493
494 if ($this->children === null) {
495 $ref_ids = $this->tree->getChildsByType($this->getRefId(), "prg");
496
497 // apply container sorting to tree
498 $sorting = ilContainerSorting::_getInstance($this->getId());
499 $ref_ids = $sorting->sortItems(array('prg' => $ref_ids));
500 $ref_ids = $ref_ids['prg'];
501
502 $this->children = array_map(static function ($node_data) {
503 return ilObjStudyProgramme::getInstanceByRefId($node_data["child"]);
504 }, $ref_ids);
505 }
506
507 if ($include_references && $this->reference_children === null) {
508 $this->reference_children = [];
509 $ref_child_ref_ids = $this->tree->getChildsByType($this->getRefId(), "prgr");
510 foreach (
511 array_unique(
512 array_map(
513 static function ($data) {
514 return (int) $data['child'];
515 },
516 array_filter($ref_child_ref_ids, static function ($data) {
517 return $data["deleted"] === null;
518 })
519 )
520 ) as $prg_ref_id
521 ) {
522 $this->reference_children[] =
523 (new ilObjStudyProgrammeReference($prg_ref_id))->getReferencedObject();
524 }
525 }
526 return $include_references ?
527 array_merge($this->children, $this->reference_children) :
528 $this->children;
529 }
static _getInstance(int $a_obj_id)

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 ( ilPRGAssignment  $assignment)

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

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

751 : array
752 {
753 $completed_crss = [];
754 $f = function ($prg) use (&$completed_crss, $assignment) {
755 if ($prg->isActive() &&
756 $assignment->getProgressForNode($prg->getId())->isRelevant()
757 ) {
758 foreach ($prg->getLPChildren() as $child) {
759 $crs_id = (int) ilContainerReference::_lookupTargetId((int) $child->getId());
760 $crs_ref_id = (int) ilContainerReference::_lookupTargetRefId((int) $child->getId());
761 $crsr_ref_id = (int) $child->getRefId();
762
763 if (ilObject::_exists($crsr_ref_id, true) &&
764 is_null(ilObject::_lookupDeletedDate($crsr_ref_id)) &&
765 ilObject::_exists($crs_id, false) &&
766 is_null(ilObject::_lookupDeletedDate($crs_ref_id)) &&
767 ilLPStatus::_hasUserCompleted($crs_id, $assignment->getUserId())
768 ) {
769 $completed_crss[] = [
770 'crs_id' => $crs_id,
771 'prg_ref_id' => $prg->getRefId(),
772 'prg_obj_id' => $prg->getId(),
773 'crsr_ref_id' => $crsr_ref_id,
774 'crsr_id' => $child->getId(),
775 'crs_ref_id' => $crs_ref_id,
776 'title' => ilContainerReference::_lookupTitle((int) $child->getId()),
777 ];
778 }
779 }
780 return true;
781 }
782 return false;
783 };
784 $this->applyToSubTreeNodes($f, true);
785 return $completed_crss;
786 }
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
getProgressForNode(int $node_id)

References Vendor\Package\$f, ilObject\_exists(), ilLPStatus\_hasUserCompleted(), ilObject\_lookupDeletedDate(), ilContainerReference\_lookupTargetId(), ilContainerReference\_lookupTargetRefId(), ilContainerReference\_lookupTitle(), applyToSubTreeNodes(), ilPRGAssignment\getProgressForNode(), ilPRGAssignment\getUserId(), 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 1638 of file class.ilObjStudyProgramme.php.

1638 : array
1639 {
1640 if ($ref_id === null) {
1641 return $subobjects;
1642 }
1643
1644 if (ilObject::_lookupType($ref_id, true) !== "prg") {
1645 throw new ilException("Ref-Id '$ref_id' does not belong to a study programme object.");
1646 }
1647
1649
1650 $mode = $parent->getLPMode();
1651
1652 switch ($mode) {
1654 $possible_subobjects = $subobjects;
1655 break;
1657 $possible_subobjects = [
1658 "prg" => $subobjects["prg"],
1659 "prgr" => $subobjects["prgr"]
1660 ];
1661 break;
1663 $possible_subobjects = ['crsr' => $subobjects['crsr']];
1664 break;
1665 default:
1666 throw new ilException("Undefined mode for study programme: '$mode'");
1667 }
1668
1669 if ($parent->hasAutomaticContentCategories()) {
1670 $possible_subobjects = array_filter(
1671 $possible_subobjects,
1672 static function ($subtype) {
1673 return $subtype === 'crsr';
1674 },
1675 ARRAY_FILTER_USE_KEY
1676 );
1677 }
1678 return $possible_subobjects;
1679 }
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 634 of file class.ilObjStudyProgramme.php.

634 : int
635 {
636 $cur = $this;
637 $count = 0;
638 while ($cur = $cur->getParent()) {
639 $count++;
640 }
641 return $count;
642 }

◆ getIdsOfUsersWithRelevantProgress()

ilObjStudyProgramme::getIdsOfUsersWithRelevantProgress ( )

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

1196 : array
1197 {
1198 return array_map(
1199 fn($ass) => $ass->getUserId(),
1200 $this->getAssignments()
1201 );
1202 }

◆ getInstanceByObjId()

◆ getInstanceByRefId()

static ilObjStudyProgramme::getInstanceByRefId (   $ref_id)
static

◆ getLastChange()

ilObjStudyProgramme::getLastChange ( )

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

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

324 : DateTime
325 {
326 return $this->getSettings()->getLastChange();
327 }

References getSettings().

+ Here is the call graph for this function:

◆ getLocalMembers()

ilObjStudyProgramme::getLocalMembers ( )

get usr_ids with assignment on this node

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

1107 : array
1108 {
1109 if (!$this->members_cache) {
1110 $this->members_cache = array_map(
1111 static function ($assignment) {
1112 return $assignment->getUserId();
1113 },
1114 $this->assignment_repository->getByPrgId($this->getId())
1115 );
1116 }
1117 return $this->members_cache;
1118 }

References $members_cache, and ilObject\getId().

+ Here is the call graph for this function:

◆ getLoggedInUserId()

ilObjStudyProgramme::getLoggedInUserId ( )
protected

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

1682 : int
1683 {
1684 return $this->ilUser->getId();
1685 }

Referenced by assignUser().

+ Here is the caller graph for this function:

◆ getLogger()

ilObjStudyProgramme::getLogger ( )
protected

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

183 : ilLogger
184 {
185 return $this->logger;
186 }
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 663 of file class.ilObjStudyProgramme.php.

663 : array
664 {
665 $this->throwIfNotInTree();
666
667 if ($this->lp_children === null) {
668 $this->lp_children = array();
669
670 $ref_ids = $this->tree->getChildsByType($this->getRefId(), "crsr");
671
672 // apply container sorting to tree
673 $sorting = ilContainerSorting::_getInstance($this->getId());
674 $ref_ids = $sorting->sortItems(array('crs_ref' => $ref_ids));
675 $ref_ids = $ref_ids['crs_ref'];
676
677 $lp_children = array_map(function ($node_data) {
678 $lp_obj = $this->object_factory->getInstanceByRefId((int) $node_data["child"]);
679
680 // filter out all StudyProgramme instances
681 return ($lp_obj instanceof $this) ? null : $lp_obj;
682 }, $ref_ids);
683
684 $this->lp_children = array_filter($lp_children);
685 }
686 return $this->lp_children;
687 }

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

695 : array
696 {
697 return array_map(static function ($child) {
698 return $child->getId();
699 }, $this->getLPChildren());
700 }

References getLPChildren().

+ Here is the call graph for this function:

◆ getLPMode()

ilObjStudyProgramme::getLPMode ( )

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

352 : int
353 {
354 return $this->getSettings()->getLPMode();
355 }

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

1095 : array
1096 {
1097 $usr_ids = [];
1098 foreach ($this->getAssignments() as $assignment) {
1099 $usr_ids[] = $assignment->getUserId();
1100 }
1101 return array_unique($usr_ids);
1102 }

References getAssignments().

+ Here is the call graph for this function:

◆ getMembersOfMembershipSource()

ilObjStudyProgramme::getMembersOfMembershipSource ( ilStudyProgrammeAutoMembershipSource  $ams,
?int  $exclude_id 
)
protected

Get member-ids of a certain source.

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

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

1441 : array
1442 {
1443 $source_reader = $this->membersourcereader_factory->getReaderFor($ams, $exclude_id);
1444 return $source_reader->getMemberIds();
1445 }

Referenced by enableAutomaticMembershipSource(), and getApplicableMembershipSourceForUser().

+ Here is the caller graph for this function:

◆ getNow()

ilObjStudyProgramme::getNow ( )
protected

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

1687 : DateTimeImmutable
1688 {
1689 return new DateTimeImmutable();
1690 }

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

538 {
539 if ($this->parent === false) {
540 $this->throwIfNotInTree();
541 $parent_data = $this->tree->getParentNodeData($this->getRefId());
542 if ($parent_data["type"] !== "prg") {
543 $this->parent = null;
544 } else {
545 $this->parent = self::getInstanceByRefId($parent_data["ref_id"]);
546 }
547 }
548 return $this->parent;
549 }

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

Referenced by moveTo(), and removeNode().

+ Here is the call graph for this function:
+ Here is the caller 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 580 of file class.ilObjStudyProgramme.php.

580 : array
581 {
582 $current = $this;
583 $parents = [];
584 $queque = [$current];
585 while ($element = array_shift($queque)) {
586 $parent = $element->getParent();
587 if ($parent === null || $include_references) {
588 foreach ($this->getReferencesTo($element) as $reference) {
589 if ($this->tree->isDeleted($reference->getRefId())) {
590 continue;
591 }
592 $r_parent = $reference->getParent();
593 if (is_null($r_parent)) {
594 continue;
595 }
596 $queque[] = $r_parent;
597 $parents[] = $r_parent;
598 }
599 continue;
600 }
601 $queque[] = $parent;
602 $parents[] = $parent;
603 }
604 return array_reverse($parents);
605 }
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 332 of file class.ilObjStudyProgramme.php.

332 : int
333 {
334 return $this->getSettings()->getAssessmentSettings()->getPoints();
335 }

References getSettings().

+ Here is the call graph for this function:

◆ getPrgInstanceByObjId()

ilObjStudyProgramme::getPrgInstanceByObjId ( int  $obj_id)
protected

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

154 {
156 }

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

1296 : array
1297 {
1298 $db = ilStudyProgrammeDIC::dic()['model.AutoCategories.ilStudyProgrammeAutoCategoriesRepository'];
1299 $programmes =
1300 array_filter(
1301 array_map(
1302 static function (array $rec) {
1303 $values = array_values($rec);
1304 $prg_obj_id = (int) array_shift($values);
1305
1306 $references = ilObject::_getAllReferences($prg_obj_id);
1307 $prg_ref_id = (int) array_shift($references);
1308
1309 $prg = self::getInstanceByRefId($prg_ref_id);
1310 if ($prg->isAutoContentApplicable()) {
1311 return $prg;
1312 }
1313 },
1314 $db::getProgrammesFor($cat_ref_id)
1315 )
1316 );
1317 return $programmes;
1318 }
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 1451 of file class.ilObjStudyProgramme.php.

1451 : array
1452 {
1453 $db = ilStudyProgrammeDIC::dic()['model.AutoMemberships.ilStudyProgrammeAutoMembershipsRepository'];
1454 $programmes = array_map(
1455 static function ($rec) {
1456 $values = array_values($rec);
1457 $prg_obj_id = (int) array_shift($values);
1458
1459 $references = ilObject::_getAllReferences($prg_obj_id);
1460 $prg_ref_id = (int) array_shift($references);
1461
1462 $prg = self::getInstanceByRefId($prg_ref_id);
1463 return $prg;
1464 },
1465 $db::getProgrammesFor($src_type, $src_id)
1466 );
1467 return $programmes;
1468 }

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

+ Here is the call graph for this function:

◆ getReferencesTo()

ilObjStudyProgramme::getReferencesTo ( ilObjStudyProgramme  $prg)
protected

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

551 : array
552 {
554 return array_filter(
555 array_map(
556 static function ($id) {
557 $refs = ilObject::_getAllReferences((int) $id);
559 array_shift($refs)
560 );
561 },
563 ),
564 static function ($prg_ref) use ($tree) {
565 return !$tree->isDeleted($prg_ref->getRefId());
566 }
567 );
568 }
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 $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 570 of file class.ilObjStudyProgramme.php.

570 : array
571 {
572 return $this->getReferencesTo($this);
573 }

References getReferencesTo().

+ Here is the call graph for this function:

◆ getRefIdFor()

static ilObjStudyProgramme::getRefIdFor ( int  $obj_id)
static

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

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

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

649 {
650 $parents = $this->getParents();
651 if (count($parents) < 1) {
652 return $this;
653 }
654 return $parents[0];
655 }
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 175 of file class.ilObjStudyProgramme.php.

176 {
178 }
ilStudyProgrammeSettingsDBRepository $settings_repository
Covers the persistence of settings belonging to a study programme (SP).

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

1016 {
1017 return $this->assignment_repository->get($assignment_id);
1018 }

◆ getStatus()

ilObjStudyProgramme::getStatus ( )

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

390 : int
391 {
392 return $this->getSettings()->getAssessmentSettings()->getStatus();
393 }

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

419 {
420 $type_settings = $this->getSettings()->getTypeSettings();
421 if (!in_array($type_settings->getTypeId(), array("-", "0"))) {
422 $subtype_id = $type_settings->getTypeId();
423 return $this->type_repository->getType($subtype_id);
424 }
425
426 return null;
427 }
Class ilStudyProgrammeType.

References getSettings().

+ Here is the call graph for this function:

◆ getTree()

ilObjStudyProgramme::getTree ( )
protected

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

179 : ilTree
180 {
181 return $this->tree;
182 }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

References ilObject\$tree.

◆ hasAdvancedMetadata()

ilObjStudyProgramme::hasAdvancedMetadata ( )

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

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

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

1043 : bool
1044 {
1045 return $this->getAmountOfAssignmentsOf($user_id) > 0;
1046 }
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 1123 of file class.ilObjStudyProgramme.php.

1123 : bool
1124 {
1125 $filter = new ilPRGAssignmentFilter($this->lng);
1126 $count = $this->assignment_repository->countAllForNodeIsContained(
1127 $this->getId(),
1128 null,
1129 $filter
1130 );
1131 return $count > 0;
1132
1133 }

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

1148 : bool
1149 {
1150 return count($this->getAssignmentsOfSingleProgramForUser($usr_id)) > 0;
1151 }

References getAssignmentsOfSingleProgramForUser().

+ Here is the call graph for this function:

◆ hasAutomaticContentCategories()

ilObjStudyProgramme::hasAutomaticContentCategories ( )

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

1218 : bool
1219 {
1220 return count($this->getAutomaticContentCategories()) > 0;
1221 }
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 612 of file class.ilObjStudyProgramme.php.

612 : bool
613 {
614 return $this->getAmountOfChildren($include_references) > 0;
615 }

References getAmountOfChildren().

+ Here is the call graph for this function:

◆ hasContentPage()

ilObjStudyProgramme::hasContentPage ( )

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

1913 : bool
1914 {
1915 return \ilContainerPage::_exists(self::CP_TYPE, $this->getId());
1916 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ hasLPChildren()

ilObjStudyProgramme::hasLPChildren ( )

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

711 : bool
712 {
713 return ($this->getAmountOfLPChildren() > 0);
714 }

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

1182 : bool
1183 {
1184 $filter = new ilPRGAssignmentFilter($this->lng);
1185 $filter = $filter->withValues([
1186 'prg_status_hide_irrelevant' => true
1187 ]);
1188 $count = $this->assignment_repository->countAllForNodeIsContained(
1189 $this->getId(),
1190 null,
1191 $filter
1192 );
1193 return $count > 0;
1194 }

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

112 : void
113 {
114 if (self::$study_programme_cache === null) {
115 self::$study_programme_cache = ilObjStudyProgrammeCache::singleton();
116 }
117 }

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

410 : bool
411 {
413 }

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

1326 : bool
1327 {
1328 $valid_status = in_array(
1329 $this->getSettings()->getAssessmentSettings()->getStatus(),
1330 [
1333 ],
1334 true
1335 );
1336
1337 $crslnk_allowed = (
1338 $this->hasLPChildren()
1339 || $this->getAmountOfChildren(true) === 0
1340 );
1341
1342 return $valid_status && $crslnk_allowed;
1343 }

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

+ Here is the call graph for this function:

◆ isCertificateActive()

ilObjStudyProgramme::isCertificateActive ( )

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

429 : bool
430 {
431 $global_settings = new ilSetting('certificate');
432 $global_active = (bool) $global_settings->get('active', '0');
433 if (!$global_active) {
434 return false;
435 }
438 return $certificate_template->isCurrentlyActive();
439 }
ILIAS Setting Class.
ilCertificateTemplateRepository $certificate_template_repository
fetchCurrentlyUsedCertificate(int $objId)

References $certificate_template_repository, ilCertificateTemplateRepository\fetchCurrentlyUsedCertificate(), and ilObject\getId().

+ Here is the call graph for this function:

◆ markAccredited()

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

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

1704 : void {
1705 $progress_node_id = $this->getId();
1706 $assignment = $this->assignment_repository->get($assignment_id)
1707 ->markAccredited(
1708 $this->getSettingsRepository(),
1709 $this->events,
1710 $progress_node_id,
1711 $acting_usr_id,
1712 $err_collection
1713 );
1714
1715 $this->assignment_repository->store($assignment);
1716 }

◆ markNotRelevant()

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

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

1740 : void {
1741 $progress_node_id = $this->getId();
1742 $assignment = $this->assignment_repository->get($assignment_id)
1743 ->markNotRelevant(
1744 $this->getSettingsRepository(),
1745 $progress_node_id,
1746 $acting_usr_id,
1747 $err_collection
1748 );
1749
1750 $this->assignment_repository->store($assignment);
1751 $this->refreshLPStatus($assignment->getUserId());
1752 }

◆ markRelevant()

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

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

1758 : void {
1759 $progress_node_id = $this->getId();
1760 $assignment = $this->assignment_repository->get($assignment_id)
1761 ->markRelevant(
1762 $this->getSettingsRepository(),
1763 $progress_node_id,
1764 $acting_usr_id,
1765 $err_collection
1766 );
1767
1768 $this->assignment_repository->store($assignment);
1769 $this->refreshLPStatus($assignment->getUserId());
1770 }

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

914 {
915 global $DIC;
916 $rbacadmin = $DIC['rbacadmin'];
917
918 if ($parent = $this->getParent()) {
919 // TODO: check if there some leafs in the new parent
920
921 $this->tree->moveTree($this->getRefId(), $new_parent->getRefId());
922 // necessary to clean up permissions
923 $rbacadmin->adjustMovedObjectPermissions($this->getRefId(), $parent->getRefId());
924
925 // TODO: lp-progress needs to be updated
926
927 // clear caches on different nodes
928 $this->clearParentCache();
929
930 $parent->clearChildrenCache();
931 $parent->clearLPChildrenCache();
932
933 $new_parent->clearChildrenCache();
934 $new_parent->clearLPChildrenCache();
935 }
936
937 return $this;
938 }
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 829 of file class.ilObjStudyProgramme.php.

829 : void
830 {
831 if (! $prg instanceof ilObjStudyProgrammeReference &&
832 ! $prg instanceof ilObjStudyProgramme
833 ) {
834 throw new ilStudyProgrammeTreeException("Wrong type of node: " . get_class($prg));
835 }
837 throw new ilStudyProgrammeTreeException("Program already contains leafs.");
838 }
839
841 $this->settings_repository->update(
843 );
844 }
845
846 $this->clearChildrenCache();
847 $this->addMissingProgresses();
848 }
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 857 of file class.ilObjStudyProgramme.php.

857 : void
858 {
859 parent::putInTree($parent_ref_id);
860
861 if (ilObject::_lookupType($parent_ref_id, true) === "prg") {
862 $par = self::getInstanceByRefId($parent_ref_id);
863 $par->nodeInserted($this);
864 }
865 }

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

1692 : void
1693 {
1694 if (is_null($node_obj_id)) {
1695 $node_obj_id = $this->getId();
1696 }
1697 ilLPStatusWrapper::_updateStatus($node_obj_id, $usr_id);
1698 }
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 993 of file class.ilObjStudyProgramme.php.

994 {
995 $this->members_cache = null;
996 if ($assignment->getRootId() !== $this->getId()) {
997 throw new ilException(
998 "ilObjStudyProgramme::removeAssignment: Assignment '"
999 . $assignment->getId() . "' does not belong to study "
1000 . "program '" . $this->getId() . "'."
1001 );
1002 }
1003
1004 $this->assignment_repository->delete($assignment);
1005
1006 $affected_node_ids = array_map(fn($pgs) => $pgs->getNodeId(), $assignment->getProgresses());
1007 foreach ($affected_node_ids as $node_obj_id) {
1008 $this->refreshLPStatus($assignment->getUserId(), $node_obj_id);
1009 }
1010
1011 $this->events->userDeassigned($assignment);
1012 return $this;
1013 }
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 1281 of file class.ilObjStudyProgramme.php.

1281 : void
1282 {
1283 foreach (self::getProgrammesMonitoringCategory($cat_ref_id) as $prg) {
1284 foreach ($prg->getLPChildren() as $child) {
1285 if ((int) $child->getTargetRefId() === $crs_ref_id) {
1286 $child->delete();
1287 }
1288 }
1289 }
1290 }

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

1481 : void
1482 {
1483 $now = new DateTimeImmutable();
1484 $assignment_repository = ilStudyProgrammeDIC::dic()['repo.assignment'];
1485 foreach (self::getProgrammesMonitoringMemberSource($src_type, $src_id) as $prg) {
1486 $assignments = $prg->getAssignmentsOfSingleProgramForUser($usr_id);
1487 $next_membership_source = $prg->getApplicableMembershipSourceForUser($usr_id, $src_id);
1488
1489 foreach ($assignments as $assignment) {
1490 if (!$assignment->getProgressTree()->isInProgress()) {
1491 continue;
1492 }
1493
1494 if (
1495 $next_membership_source !== null
1496 && $next_membership_source?->isEnabled()
1497 && $next_membership_source->getSourceId() !== $src_id
1498 ) {
1499 $new_src_type = $next_membership_source->getSourceType();
1500 $assigned_by = ilStudyProgrammeAutoMembershipSource::SOURCE_MAPPING[$new_src_type];
1501 $assignment = $assignment->withLastChange($assigned_by, $now);
1502 $assignment_repository->store($assignment);
1503 break;
1504 } else {
1505 $assignment_repository->delete($assignment);
1506 }
1507 }
1508 }
1509 }

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

877 {
878 if ($a_prg->getParent()->getId() !== $this->getId()) {
879 throw new ilStudyProgrammeTreeException("This is no parent of the given programm.");
880 }
881
882 if (!$a_prg->canBeRemoved()) {
883 throw new ilStudyProgrammeTreeException("The node has relevant assignments.");
884 }
885
886 // *sigh*...
887 $node_data = $this->tree->getNodeData($a_prg->getRefId());
888 $this->tree->deleteTree($node_data);
889 $a_prg->clearParentCache();
890 $this->clearChildrenCache();
891
892 return $this;
893 }
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 1025 of file class.ilObjStudyProgramme.php.

1025 : void
1026 {
1027 $this->assignment_repository->resetExpiryInfoSentFor($ass);
1028 }

Referenced by ilPRGMail\resetExpiryInfoSentFor().

+ Here is the caller graph for this function:

◆ resetRiskyToFailSentFor()

ilObjStudyProgramme::resetRiskyToFailSentFor ( ilPRGAssignment  $ass)

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

1035 : void
1036 {
1037 $this->assignment_repository->resetRiskyToFailSentFor($ass);
1038 }

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

343 {
344 $settings = $this->getSettings();
345 $this->updateSettings(
346 $settings->withAssessmentSettings($settings->getAssessmentSettings()->withPoints($points))
347 );
348 $this->updateLastChange();
349 return $this;
350 }
updateSettings(ilStudyProgrammeSettings $settings)
updateLastChange()
Update last change timestamp on this node and its parents.

References getSettings(), updateLastChange(), and updateSettings().

+ Here is the call graph for this function:

◆ setProgressesCompletedFor()

static ilObjStudyProgramme::setProgressesCompletedFor ( 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

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

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

1553 : void
1554 {
1555 // We only use courses via crs_refs
1556 $type = ilObject::_lookupType($obj_id);
1557 if ($type === "crsr") {
1558 foreach (ilObject::_getAllReferences($obj_id) as $ref_id) {
1560 }
1561 }
1562 }
static setProgressesCompletedIfParentIsProgrammeInLPCompletedMode(int $ref_id, int $obj_id, int $user_id)

References $ref_id, $user_id, ilObject\_getAllReferences(), and ilObject\_lookupType().

+ Here is the call graph for this function:

◆ setProgressesCompletedIfParentIsProgrammeInLPCompletedMode()

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

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

1571 : void {
1572 global $DIC; // TODO: replace this by a settable static for testing purpose?
1573 $tree = $DIC['tree'];
1574 $node_data = $tree->getParentNodeData($ref_id);
1575 if (count($node_data) === 0 || !array_key_exists('type', $node_data) || $node_data["type"] !== "prg") {
1576 return;
1577 }
1579 $prg = self::getInstanceByRefId($node_data["child"]);
1580 if ($prg->getLPMode() !== ilStudyProgrammeSettings::MODE_LP_COMPLETED) {
1581 return;
1582 }
1583 $prg->succeed($user_id, $obj_id);
1584 }
getParentNodeData(int $a_node_id)
get data of parent node from tree and object_data

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

401 {
402 $settings = $this->getSettings();
403 $this->updateSettings(
404 $settings->withAssessmentSettings($settings->getAssessmentSettings()->withStatus($a_status))
405 );
406 $this->updateLastChange();
407 return $this;
408 }

References 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 1891 of file class.ilObjStudyProgramme.php.

1891 : string
1892 {
1893 $lng = $this->lng;
1894 $lng->loadLanguageModule("prg");
1895 if ($status === ilPRGProgress::STATUS_IN_PROGRESS) {
1896 return $lng->txt("prg_status_in_progress");
1897 }
1898 if ($status === ilPRGProgress::STATUS_COMPLETED) {
1899 return $lng->txt("prg_status_completed");
1900 }
1901 if ($status === ilPRGProgress::STATUS_ACCREDITED) {
1902 return $lng->txt("prg_status_accredited");
1903 }
1904 if ($status === ilPRGProgress::STATUS_NOT_RELEVANT) {
1905 return $lng->txt("prg_status_not_relevant");
1906 }
1907 if ($status === ilPRGProgress::STATUS_FAILED) {
1908 return $lng->txt("prg_status_failed");
1909 }
1910 throw new ilException("Unknown status: '$status'");
1911 }
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 1228 of file class.ilObjStudyProgramme.php.

1228 : void
1229 {
1230 $ac = $this->auto_categories_repository->create(
1231 $this->getId(),
1232 $category_ref_id
1233 );
1234 $this->auto_categories_repository->update($ac);
1235 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ storeAutomaticMembershipSource()

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

Store a source to be monitored for automatic memberships.

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

1362 : void
1363 {
1364 $ams = $this->auto_memberships_repository->create(
1365 $this->getId(),
1366 $type,
1367 $src_id,
1368 false,
1369 null,
1370 null,
1371 $search_recursive
1372 );
1373 $this->auto_memberships_repository->update($ams);
1374 }

References ilObject\getId().

+ Here is the call graph for this function:

◆ storeExpiryInfoSentFor()

ilObjStudyProgramme::storeExpiryInfoSentFor ( ilPRGAssignment  $ass)

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

1020 : void
1021 {
1022 $this->assignment_repository->storeExpiryInfoSentFor($ass);
1023 }

Referenced by ilPRGMail\sendInformToReAssignMail().

+ Here is the caller graph for this function:

◆ storeRiskyToFailSentFor()

ilObjStudyProgramme::storeRiskyToFailSentFor ( ilPRGAssignment  $ass)

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

1030 : void
1031 {
1032 $this->assignment_repository->storeRiskyToFailSentFor($ass);
1033 }

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

1586 : void
1587 {
1588 $progress_node_id = $this->getId();
1589 if (is_null($ass)) {
1590 $user_assignments = $this->assignment_repository
1591 ->getAllForNodeIsContained($progress_node_id, [$usr_id]);
1592 } else {
1593 $user_assignments = [$ass];
1594 }
1595
1596 foreach ($user_assignments as $ass) {
1597 $ass = $ass->succeed(
1598 $this->getSettingsRepository(),
1599 $progress_node_id,
1600 $triggering_obj_id
1601 );
1602 $this->assignment_repository->store($ass);
1603 }
1604 }

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

719 : void
720 {
721 if (!$this->tree->isInTree($this->getRefId())) {
722 throw new ilStudyProgrammeTreeException("This program is not in tree.");
723 }
724 }

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

1722 : void {
1723 $progress_node_id = $this->getId();
1724 $assignment = $this->assignment_repository->get($assignment_id)
1725 ->unmarkAccredited(
1726 $this->getSettingsRepository(),
1727 $progress_node_id,
1728 $acting_usr_id,
1729 $err_collection
1730 );
1731
1732 $this->assignment_repository->store($assignment);
1733 $this->refreshLPStatus($assignment->getUserId());
1734 }

◆ update()

ilObjStudyProgramme::update ( )
Exceptions
ilException

Reimplemented from ilContainer.

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

249 : bool
250 {
251 parent::update();
252
253 $type_settings = $this->getSettings()->getTypeSettings();
254 // Update selection for advanced metadata of the type
255 if ($type_settings->getTypeId()) {
257 $this->getId(),
258 'prg_type',
259 $this->type_repository->getAssignedAMDRecordIdsByType($type_settings->getTypeId())
260 );
261 } else {
262 // If no type is assigned, delete relations by passing an empty array
263 ilAdvancedMDRecord::saveObjRecSelection($this->getId(), 'prg_type', array());
264 }
265 return true;
266 }
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 1606 of file class.ilObjStudyProgramme.php.

1606 : void
1607 {
1608 $customIcon = $this->custom_icon_factory->getByObjId($this->getId(), $this->getType());
1609 $subtype = $this->getSubType();
1610
1611 if ($subtype && $subtype->getIconIdentifier()) {
1612 $src = $this->type_repository->getIconPathFS($subtype);
1613
1614 //This is a horrible hack to allow Flysystem/LocalFilesystem to read the file.
1615 $tmp = 'ico_' . $this->getId();
1616 copy($src, \ilFileUtils::getDataDir() . '/temp/' . $tmp);
1617
1618 $customIcon->saveFromTempFileName($tmp);
1619 } else {
1620 $customIcon->remove();
1621 }
1622 }
static getDataDir()
get data directory (outside webspace)
getSubType()
Gets the SubType Object.

References ilFileUtils\getDataDir(), and 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 1533 of file class.ilObjStudyProgramme.php.

1533 : void
1534 {
1535 $this->getSettings()->updateLastChange();
1536 if ($parent = $this->getParent()) {
1537 $parent->updateLastChange();
1538 }
1539 $this->update();
1540 }

Referenced by setPoints(), and setStatus().

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

1836 : void {
1837 $assignment = $this->assignment_repository->get($assignment_id)
1838 ->updatePlanFromRepository(
1839 $this->getSettingsRepository(),
1840 $acting_usr_id,
1841 $err_collection
1842 );
1843
1844 $this->assignment_repository->store($assignment);
1845 $this->refreshLPStatus($assignment->getUserId());
1846 }

◆ updateSettings()

ilObjStudyProgramme::updateSettings ( ilStudyProgrammeSettings  $settings)

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

211 : bool
212 {
213 if ($settings->getObjId() !== $this->getId()) {
214 throw new Exception("The given settings-object does not belong to this programme", 1);
215 }
216 $this->getSettingsRepository()->update($settings);
217
218 return true;
219 }
getObjId()
Get the id of the study program.

References ilStudyProgrammeSettings\getObjId(), 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 47 of file class.ilObjStudyProgramme.php.

◆ $auto_memberships_repository

ilStudyProgrammeAutoMembershipsDBRepository ilObjStudyProgramme::$auto_memberships_repository
protected

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

◆ $children

array ilObjStudyProgramme::$children = null
protected

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

Referenced by getChildren().

◆ $custom_icon_factory

CustomIconFactory ilObjStudyProgramme::$custom_icon_factory
protected

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

◆ $events

ilStudyProgrammeEvents ilObjStudyProgramme::$events
protected

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

◆ $ilUser

ilObjUser ilObjStudyProgramme::$ilUser
protected

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

Referenced by __construct().

◆ $logger

ilLogger ilObjStudyProgramme::$logger
protected

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

Referenced by getLogger().

◆ $lp_children

array ilObjStudyProgramme::$lp_children = null
protected

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

Referenced by getLPChildren().

◆ $members_cache

array ilObjStudyProgramme::$members_cache = null
protected

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

Referenced by getLocalMembers().

◆ $membersourcereader_factory

ilStudyProgrammeMembershipSourceReaderFactory ilObjStudyProgramme::$membersourcereader_factory
protected

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

◆ $object_factory

ilObjectFactoryWrapper ilObjStudyProgramme::$object_factory = null
protected

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

◆ $parent

ilObjStudyProgramme::$parent
protected

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

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

◆ $reference_children

array ilObjStudyProgramme::$reference_children = null
protected

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

◆ $settings_repository

ilStudyProgrammeSettingsDBRepository ilObjStudyProgramme::$settings_repository
protected

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

Referenced by getSettingsRepository().

◆ $study_programme_cache

ilObjStudyProgrammeCache ilObjStudyProgramme::$study_programme_cache = null
staticprotected

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

◆ $type_repository

ilStudyProgrammeTypeDBRepository ilObjStudyProgramme::$type_repository
protected

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

◆ $webdir

Filesystem ilObjStudyProgramme::$webdir
protected

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

◆ CP_TYPE

const ilObjStudyProgramme::CP_TYPE = 'cont'

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


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