ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 (int $usr_id)
 Get courses in this program that the given user already completed. More...
 
 addNode (ilObjStudyProgramme $a_prg)
 Inserts another ilObjStudyProgramme in this object. More...
 
 nodeInserted ($prg)
 Clears child cache and adds progress for new node. More...
 
 putInTree (int $parent_ref_id)
 Overwritten from ilObject. More...
 
 removeNode (ilObjStudyProgramme $a_prg)
 Remove a node from this object. More...
 
 canBeRemoved ()
 Check weather a node can be removed. More...
 
 moveTo (ilObjStudyProgramme $new_parent)
 Move this tree node to a new parent. More...
 
 assignUser (int $usr_id, ?int $acting_usr_id=null, $raise_event=true)
 Assign a user to this node at the study program. More...
 
 removeAssignment (ilPRGAssignment $assignment)
 Remove an assignment from this program. More...
 
 getSpecificAssignment (int $assignment_id)
 
 storeExpiryInfoSentFor (ilPRGAssignment $ass)
 
 resetExpiryInfoSentFor (ilPRGAssignment $ass)
 
 storeRiskyToFailSentFor (ilPRGAssignment $ass)
 
 resetRiskyToFailSentFor (ilPRGAssignment $ass)
 
 hasAssignmentOf (int $user_id)
 Check whether user is assigned to this program or any node above. More...
 
 getAmountOfAssignmentsOf (int $user_id)
 Get the amount of assignments a user has on this program node or any node above. More...
 
 getAssignmentsOf (int $user_id)
 Get the assignments of user at this program or any node above. More...
 
 getAssignments ()
 
 getMembers ()
 get usr_ids with any progress on this node More...
 
 getLocalMembers ()
 get usr_ids with assignment on this node More...
 
 hasAssignments ()
 Are there any assignments on this node or any node above? More...
 
 getAssignmentsOfSingleProgramForUser (int $usr_id)
 Get assignments of user to this program-node only. More...
 
 hasAssignmentsOfSingleProgramForUser (int $usr_id)
 Get assignments of user to this program-node only. More...
 
 addMissingProgresses ()
 Add missing progress records for all assignments of this programm. More...
 
 hasRelevantProgresses ()
 Are there any users that have a relevant progress on this programme? More...
 
 getIdsOfUsersWithRelevantProgress ()
 
 getAutomaticContentCategories ()
 Get configuration of categories with auto-content for this StudyProgramme;. More...
 
 hasAutomaticContentCategories ()
 
 storeAutomaticContentCategory (int $category_ref_id)
 Store a Category with auto-content for this StudyProgramme; a category can only be referenced once (per programme). More...
 
 deleteAutomaticContentCategories (array $category_ids=[])
 Delete configuration of categories with auto-content for this StudyProgramme;. More...
 
 deleteAllAutomaticContentCategories ()
 Delete all configuration of categories with auto-content for this StudyProgramme;. More...
 
 isAutoContentApplicable ()
 AutoContent should only be available in active- or draft-mode, and only, if there is no sub-programme. More...
 
 getAutomaticMembershipSources ()
 Get sources for auto-memberships. More...
 
 storeAutomaticMembershipSource (string $type, int $src_id, 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 (?ilObjectTranslation $obj_trans)
 
 createContainerDirectory ()
 
 getContainerDirectory ()
 
 setHiddenFilesFound (bool $a_hiddenfilesfound)
 
 getHiddenFilesFound ()
 
 getStyleSheetId ()
 
 setStyleSheetId (int $a_style_id)
 
 setNewsTimeline (bool $a_val)
 
 getNewsTimeline ()
 
 setNewsTimelineAutoEntries (bool $a_val)
 
 getNewsTimelineAutoEntries ()
 
 setNewsTimelineLandingPage (bool $a_val)
 
 getNewsTimelineLandingPage ()
 
 isNewsTimelineEffective ()
 
 isNewsTimelineLandingPageEffective ()
 
 setNewsBlockActivated (bool $a_val)
 
 getNewsBlockActivated ()
 
 setUseNews (bool $a_val)
 
 getUseNews ()
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies (container sorting) More...
 
 cloneAllObject (string $session_id, string $client_id, string $new_type, int $ref_id, int $clone_source, array $options, bool $soap_call=false, int $a_submode=1)
 
 delete ()
 delete category and all related data More...
 
 getViewMode ()
 
 getOrderType ()
 
 setOrderType (int $a_value)
 
 isClassificationFilterActive ()
 
 filteredSubtree ()
 Note grp/crs currently allow to filter in their whole subtrees Catetories only their direct childs. More...
 
 getSubItems (bool $a_admin_panel_enabled=false, bool $a_include_side_block=false, int $a_get_single=0, ?ilContainerUserFilter $container_user_filter=null)
 
 gotItems ()
 
 addAdditionalSubItemInformation (array &$object)
 Add additional information to sub item, e.g. More...
 
 getGroupedObjTypes ()
 
 enablePageEditing ()
 
 create ()
 
 putInTree (int $parent_ref_id)
 
 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)
 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
 
ilObjectCustomIconFactory $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
 
ilObjectTranslation $obj_trans = null
 
int $style_id = 0
 
bool $news_timeline_landing_page = false
 
bool $news_block_activated = false
 
bool $use_news = false
 
ilRecommendedContentManager $recommended_content_manager
 
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 23 of file class.ilObjStudyProgramme.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgramme::__construct ( int  $id = 0,
bool  $call_by_reference = true 
)

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

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

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

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

75  {
77  $this->type = "prg";
78 
79  $this->type_repository = $dic['model.Type.ilStudyProgrammeTypeRepository'];
80  $this->auto_categories_repository = $dic['model.AutoCategories.ilStudyProgrammeAutoCategoriesRepository'];
81  $this->auto_memberships_repository = $dic['model.AutoMemberships.ilStudyProgrammeAutoMembershipsRepository'];
82  $this->membersourcereader_factory = $dic['model.AutoMemberships.ilStudyProgrammeMembershipSourceReaderFactory'];
83 
84  $this->settings_repository = $dic['model.Settings.ilStudyProgrammeSettingsRepository'];
85  $this->assignment_repository = $dic['repo.assignment'];
86  $this->events = $dic['ilStudyProgrammeEvents'];
87 
89 
90  $this->clearParentCache();
91  $this->clearChildrenCache();
92  $this->clearLPChildrenCache();
93 
94  global $DIC;
95  $tree = $DIC['tree'];
96  $ilUser = $DIC['ilUser'];
97  $this->webdir = $DIC->filesystem()->web();
98  $this->tree = $tree;
99  $this->ilUser = $ilUser;
100  $this->db = $DIC['ilDB'];
101  $this->lng = $DIC['lng'];
102  $this->logger = ilLoggerFactory::getLogger($this->type);
103 
104  $this->object_factory = ilObjectFactoryWrapper::singleton();
105 
106  $this->custom_icon_factory = $DIC['object.customicons.factory'];
107 
108  self::initStudyProgrammeCache();
109  }
clearLPChildrenCache()
Clear the cached lp children.
static getLogger(string $a_component_id)
Get component logger.
ilTree $tree
clearChildrenCache()
Clear the cached children.
bool $call_by_reference
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(Container $dic, ilPlugin $plugin)
$dic
Definition: result.php:31
clearParentCache()
Clear the cached parent to query it again at the tree.
+ 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 1841 of file class.ilObjStudyProgramme.php.

References getLoggedInUserId(), and refreshLPStatus().

1845  : void {
1846  $acting_usr_id = $this->getLoggedInUserId();
1847  $assignment = $this->assignment_repository->get($assignment_id);
1848  foreach ($nodes as $nodeinfo) {
1849  [$node_obj_id, $course_obj_id] = $nodeinfo;
1850 
1851  $assignment = $assignment->succeed(
1852  $this->settings_repository,
1853  $node_obj_id,
1854  $course_obj_id
1855  );
1856 
1857  $msg = sprintf(
1858  '%s, progress-id (%s/%s)',
1859  $assignment->getUserInformation()->getFullname(),
1860  $assignment->getId(),
1861  (string) $node_obj_id
1862  );
1863  $err_collection->add(true, 'acknowledged_course', $msg);
1864  }
1865  $this->assignment_repository->store($assignment);
1866  $this->refreshLPStatus($assignment->getUserId());
1867  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ 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 1250 of file class.ilObjStudyProgramme.php.

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

Referenced by ilStudyProgrammeAppEventListener\addCrsToProgrammes().

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

References ilStudyProgrammeAutoMembershipSource\SOURCE_MAPPING.

Referenced by ilStudyProgrammeAppEventListener\addMemberToProgrammes().

1463  : void
1464  {
1465  foreach (self::getProgrammesMonitoringMemberSource($src_type, $src_id) as $prg) {
1466  if ($prg->isActive() &&
1467  !$prg->hasAssignmentsOfSingleProgramForUser($usr_id)) {
1468  $assigned_by = ilStudyProgrammeAutoMembershipSource::SOURCE_MAPPING[$src_type];
1469  $prg->assignUser($usr_id, $assigned_by);
1470  }
1471  }
1472  }
+ 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 1164 of file class.ilObjStudyProgramme.php.

References getAssignments().

Referenced by nodeInserted().

1164  : void
1165  {
1166  $assignments = $this->getAssignments();
1167  foreach ($assignments as $ass) {
1168  $this->assignment_repository->store($ass);
1169  }
1170  }
+ 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 806 of file class.ilObjStudyProgramme.php.

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

807  {
808  $this->throwIfNotInTree();
809 
811  throw new ilStudyProgrammeTreeException("Program already contains leafs.");
812  }
813 
814  if ($this->tree->isInTree($a_prg->getRefId())) {
815  throw new ilStudyProgrammeTreeException("Other program already is in tree.");
816  }
817 
818  if ($a_prg->getRefId() === null) {
819  $a_prg->createReference();
820  }
821  $a_prg->putInTree($this->getRefId());
822  return $this;
823  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
createReference()
creates reference for object
putInTree(int $parent_ref_id)
Overwritten from ilObject.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ Here is the call graph for this function:

◆ adjustLPMode()

ilObjStudyProgramme::adjustLPMode ( )

Adjust the lp mode to match current state of tree:

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

Exceptions
ilExceptionwhen programme is not in draft mode.

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

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

364  : void
365  {
366  // Clear caches here, there have been some changes, because this method
367  // would not have been called otherwise, and the changer just does not
368  // know if we have filled the caches already...
369  $this->clearLPChildrenCache();
370  $this->clearChildrenCache();
371 
372  if ($this->tree->isInTree($this->getRefId())) {
373  if ($this->getAmountOfLPChildren() > 0) {
374  $this->settings_repository->update(
376  );
377  } elseif ($this->getAmountOfChildren(true) > 0) {
378  $this->settings_repository->update(
380  );
381  } else {
382  $this->settings_repository->update(
384  );
385  }
386  }
387  }
clearLPChildrenCache()
Clear the cached lp children.
getAmountOfLPChildren()
Get the amount of leafs the study programme contains.
clearChildrenCache()
Clear the cached children.
getAmountOfChildren($include_references=false)
Get the amount of other StudyProgrammes this StudyProgramme has as children.
+ 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 743 of file class.ilObjStudyProgramme.php.

References getChildren(), and throwIfNotInTree().

Referenced by getAllPrgChildren().

743  : void
744  {
745  $this->throwIfNotInTree();
746 
747  if ($fun($this) !== false) {
748  foreach ($this->getChildren($include_references) as $child) {
749  $child->applyToSubTreeNodes($fun, $include_references);
750  }
751  }
752  }
getChildren(bool $include_references=false)
Get all ilObjStudyProgrammes that are direct children of this object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

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

Referenced by enableAutomaticMembershipSource().

959  {
960  $this->members_cache = null;
961 
963  throw new ilException(
964  "ilObjStudyProgramme::assignUser: Can't assign user to program '"
965  . $this->getId() . "', since it's not in active status."
966  );
967  }
968 
969  if (is_null($acting_usr_id)) {
970  $acting_usr_id = $this->getLoggedInUserId();
971  }
972 
973  $ass = $this->assignment_repository->createFor($this->getId(), $usr_id, $acting_usr_id);
974  $ass = $ass
975  ->initAssignmentDates();
976 
977  $ass = $ass->resetProgresses(
978  $this->getSettingsRepository(),
979  $acting_usr_id
980  );
981 
982  $this->assignment_repository->store($ass);
983 
984  if ($raise_event) {
985  $this->events->userAssigned($ass);
986  }
987  return $ass;
988  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canBeCompleted()

ilObjStudyProgramme::canBeCompleted ( ilPRGProgress  $progress)

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

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

1869  : bool
1870  {
1872  return false;
1873  }
1875  return true;
1876  }
1877  $possible_points = $progress->getPossiblePointsOfRelevantChildren();
1878  return $possible_points >= $progress->getAmountOfPoints();
1879  }
+ 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 903 of file class.ilObjStudyProgramme.php.

References hasRelevantProgresses().

Referenced by removeNode().

903  : bool
904  {
905  return ! $this->hasRelevantProgresses();
906  }
hasRelevantProgresses()
Are there any users that have a relevant progress on this programme?
+ 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 1805 of file class.ilObjStudyProgramme.php.

References ilObject\getId(), getSettingsRepository(), and refreshLPStatus().

1810  : void {
1811  $progress_node_id = $this->getId();
1812  $assignment = $this->assignment_repository->get($assignment_id)
1813  ->changeAmountOfPoints(
1814  $this->getSettingsRepository(),
1815  $progress_node_id,
1816  $acting_usr_id,
1817  $err_collection,
1818  $points
1819  );
1820 
1821  $this->assignment_repository->store($assignment);
1822  $this->refreshLPStatus($assignment->getUserId());
1823  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ Here is the call graph for this function:

◆ changeProgressDeadline()

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

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

References ilObject\getId(), getSettingsRepository(), and refreshLPStatus().

1770  : void {
1771  $progress_node_id = $this->getId();
1772  $assignment = $this->assignment_repository->get($assignment_id)
1773  ->changeProgressDeadline(
1774  $this->getSettingsRepository(),
1775  $progress_node_id,
1776  $acting_usr_id,
1777  $err_collection,
1778  $deadline
1779  );
1780 
1781  $this->assignment_repository->store($assignment);
1782  $this->refreshLPStatus($assignment->getUserId());
1783  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ Here is the call graph for this function:

◆ changeProgressValidityDate()

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

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

References ilObject\getId(), getSettingsRepository(), and refreshLPStatus().

1790  : void {
1791  $progress_node_id = $this->getId();
1792  $assignment = $this->assignment_repository->get($assignment_id)
1793  ->changeProgressValidityDate(
1794  $this->getSettingsRepository(),
1795  $progress_node_id,
1796  $acting_usr_id,
1797  $err_collection,
1798  $validity
1799  );
1800 
1801  $this->assignment_repository->store($assignment);
1802  $this->refreshLPStatus($assignment->getUserId());
1803  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ Here is the call graph for this function:

◆ clearChildrenCache()

ilObjStudyProgramme::clearChildrenCache ( )
protected

Clear the cached children.

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

References null.

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

130  : void
131  {
132  $this->children = null;
133  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ clearLPChildrenCache()

ilObjStudyProgramme::clearLPChildrenCache ( )
protected

Clear the cached lp children.

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

References null.

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

138  : void
139  {
140  $this->lp_children = null;
141  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 121 of file class.ilObjStudyProgramme.php.

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

121  : void
122  {
123  // This is not initialized, but we need null if there is no parent.
124  $this->parent = false;
125  }
+ 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 305 of file class.ilObjStudyProgramme.php.

References getSettings(), and ilStudyProgrammeSettings\STATUS_DRAFT.

305  : ?ilObject
306  {
307  $new_obj = parent::cloneObject($target_ref_id, $copy_id, $omit_tree);
308  $settings = $this->getSettings()->withObjId($new_obj->getId());
309  $settings = $settings->withAssessmentSettings(
310  $settings->getAssessmentSettings()->withStatus(ilStudyProgrammeSettings::STATUS_DRAFT)
311  );
312  $new_obj->updateSettings($settings);
313  return $new_obj;
314  }
+ Here is the call graph for this function:

◆ create()

ilObjStudyProgramme::create ( )
Exceptions
ilException

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

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

238  : int
239  {
240  $id = (int) parent::create();
241  $this->getSettingsRepository()->createFor($id);
242  return $id;
243  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ createContentPage()

ilObjStudyProgramme::createContentPage ( )

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

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

1910  : void
1911  {
1912  if ($this->hasContentPage()) {
1913  throw new \LogicException('will not create content page - it already exists.');
1914  }
1915  $new_page_object = new \ilContainerPage();
1916  $new_page_object->setId($this->getId());
1917  $new_page_object->setParentId($this->getId());
1918  $new_page_object->createFromXML();
1919  }
+ 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 192 of file class.ilObjStudyProgramme.php.

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

◆ delete()

ilObjStudyProgramme::delete ( )

Delete Study Programme and all related data.

Exceptions
ilException

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

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

272  : bool
273  {
274  // always call parent delete function first!!
275  if (!parent::delete()) {
276  return false;
277  }
278 
279  $this->deleteSettings();
281  try {
282  $this->auto_categories_repository->deleteFor($this->getId());
284  // This would be the case when SP is in trash (#17797)
285  }
286 
289 
290  $this->events->raise('delete', ['object' => $this, 'obj_id' => $this->getId()]);
291  return true;
292  }
deleteAssignmentsAndProgresses()
Delete all assignments from the DB.
deleteAllAutomaticContentCategories()
Delete all configuration of categories with auto-content for this StudyProgramme;.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
deleteAllAutomaticMembershipSources()
Delete all membership sources of this StudyProgramme;.
+ 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 1242 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

Referenced by delete().

1242  : void
1243  {
1244  $this->auto_categories_repository->deleteFor($this->getId());
1245  }
+ 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 1380 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

Referenced by delete().

1380  : void
1381  {
1382  $this->auto_memberships_repository->deleteFor($this->getId());
1383  }
+ 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 230 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

Referenced by delete().

230  : void
231  {
232  $this->assignment_repository->deleteAllAssignmentsForProgrammeId($this->getId());
233  }
+ 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 1234 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

1234  : void
1235  {
1236  $this->auto_categories_repository->delete($this->getId(), $category_ids);
1237  }
+ Here is the call graph for this function:

◆ deleteAutomaticMembershipSource()

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

Delete a membership source.

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

References ilObject\getId().

1372  : void
1373  {
1374  $this->auto_memberships_repository->delete($this->getId(), $type, $src_id);
1375  }
string $type
+ Here is the call graph for this function:

◆ deleteSettings()

ilObjStudyProgramme::deleteSettings ( )
protected

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

References getSettings(), and getSettingsRepository().

Referenced by delete().

220  : void
221  {
222  $this->getSettingsRepository()->delete($this->getSettings());
223  }
+ 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 1388 of file class.ilObjStudyProgramme.php.

References ilObject\getId(), and null.

1388  : void
1389  {
1390  $ams = $this->auto_memberships_repository->create(
1391  $this->getId(),
1392  $type,
1393  $src_id,
1394  false,
1395  null,
1396  null,
1397  $search_recursive
1398  );
1399  $this->auto_memberships_repository->update($ams);
1400  }
string $type
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 1406 of file class.ilObjStudyProgramme.php.

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

1406  : void
1407  {
1408  if ($assign_now) {
1410  $member_ids = $this->getMembersOfMembershipSource($type, $src_id);
1411  foreach ($member_ids as $usr_id) {
1412  if (!$this->getAssignmentsOfSingleProgramForUser($usr_id)) {
1413  $this->assignUser($usr_id, $assigned_by);
1414  }
1415  }
1416  }
1417  $ams = $this->auto_memberships_repository->create(
1418  $this->getId(),
1419  $type,
1420  $src_id,
1421  true,
1422  null,
1423  null,
1424  $search_recursive
1425  );
1426  $this->auto_memberships_repository->update($ams);
1427  }
string $type
assignUser(int $usr_id, ?int $acting_usr_id=null, $raise_event=true)
Assign a user to this node at the study program.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getMembersOfMembershipSource(ilStudyProgrammeAutoMembershipSource $ams, ?int $exclude_id)
Get member-ids of a certain source.
getAssignmentsOfSingleProgramForUser(int $usr_id)
Get assignments of user to this program-node only.
+ 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 453 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

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

◆ getAllPrgChildren()

ilObjStudyProgramme::getAllPrgChildren ( )

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

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

468  : array
469  {
470  $ret = [];
471  $this->applyToSubTreeNodes(
472  function (ilObjStudyProgramme $prg) use (&$ret) {
473  if ($prg->getId() === $this->getId()) {
474  return;
475  }
476  $ret[] = $prg;
477  }
478  );
479  return $ret;
480  }
applyToSubTreeNodes(Closure $fun, bool $include_references=false)
Apply the given Closure to every node in the subtree starting at this object.
+ 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 1056 of file class.ilObjStudyProgramme.php.

References getAssignmentsOf().

Referenced by hasAssignmentOf().

1056  : int
1057  {
1058  return count($this->getAssignmentsOf($user_id));
1059  }
getAssignmentsOf(int $user_id)
Get the assignments of user at this program or any node above.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAmountOfChildren()

ilObjStudyProgramme::getAmountOfChildren (   $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 629 of file class.ilObjStudyProgramme.php.

References getChildren().

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

629  : int
630  {
631  return count($this->getChildren($include_references));
632  }
getChildren(bool $include_references=false)
Get all ilObjStudyProgrammes that are direct children of this object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAmountOfLPChildren()

ilObjStudyProgramme::getAmountOfLPChildren ( )

Get the amount of leafs the study programme contains.

Exceptions
whenthis object is not in tree.

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

References getLPChildren().

Referenced by adjustLPMode(), and hasLPChildren().

712  : int
713  {
714  return count($this->getLPChildren());
715  }
getLPChildren()
Get the leafs the study programme contains.
+ 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 1504 of file class.ilObjStudyProgramme.php.

References getAutomaticMembershipSources(), getMembersOfMembershipSource(), and null.

1508  foreach ($this->getAutomaticMembershipSources() as $ams) {
1509  if ($ams->isEnabled()) {
1510  $source_members = $this->getMembersOfMembershipSource($ams, $exclude_id);
1511  if (in_array($usr_id, $source_members)) {
1512  return $ams;
1513  }
1514  }
1515  }
1516  return null;
1517  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getMembersOfMembershipSource(ilStudyProgrammeAutoMembershipSource $ams, ?int $exclude_id)
Get member-ids of a certain source.
getAutomaticMembershipSources()
Get sources for auto-memberships.
+ Here is the call graph for this function:

◆ getAssignmentRepository()

ilObjStudyProgramme::getAssignmentRepository ( )
protected

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

References $assignment_repository.

◆ getAssignments()

ilObjStudyProgramme::getAssignments ( )
Returns
ilPRGAssignment[]

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

References ilObject\getId().

Referenced by addMissingProgresses(), getIdsOfUsersWithRelevantProgress(), and getMembers().

1087  : array
1088  {
1089  return $this->assignment_repository->getAllForNodeIsContained($this->getId());
1090  }
+ 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 1068 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

Referenced by getAmountOfAssignmentsOf().

1068  : array
1069  {
1070  $assignments = $this->assignment_repository->getAllForNodeIsContained(
1071  $this->getId(),
1072  [$user_id]
1073  );
1074 
1075  usort($assignments, function ($a_one, $a_other) {
1076  return strcmp(
1077  $a_one->getLastChange()->format('Y-m-d'),
1078  $a_other->getLastChange()->format('Y-m-d')
1079  );
1080  });
1081  return $assignments;
1082  }
+ 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 1141 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

Referenced by enableAutomaticMembershipSource(), and hasAssignmentsOfSingleProgramForUser().

1141  : array
1142  {
1143  return $this->assignment_repository->getAllForSpecificNode($this->getId(), [$usr_id]);
1144  }
+ 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 1206 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

Referenced by hasAutomaticContentCategories().

1206  : array
1207  {
1208  return $this->auto_categories_repository->getFor($this->getId());
1209  }
+ 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 1347 of file class.ilObjStudyProgramme.php.

References ilObject\getId().

Referenced by getApplicableMembershipSourceForUser().

1347  : array
1348  {
1349  return $this->auto_memberships_repository->getFor($this->getId());
1350  }
+ Here is the call graph for this function:
+ Here is the caller 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 489 of file class.ilObjStudyProgramme.php.

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

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

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

◆ getCompletedCourses()

ilObjStudyProgramme::getCompletedCourses ( int  $usr_id)

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

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

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

757  : array
758  {
759  $node_data = $this->tree->getNodeData($this->getRefId());
760  $crsrs = $this->tree->getSubTree($node_data, true, ["crsr"]);
761 
762  $completed_crss = array();
763  foreach ($crsrs as $ref) {
764  $crs_id = (int) ilContainerReference::_lookupTargetId((int) $ref["obj_id"]);
765  $crs_ref_id = (int) ilContainerReference::_lookupTargetRefId((int) $ref["obj_id"]);
766 
767  if (ilObject::_exists((int) $ref['ref_id'], true) &&
768  is_null(ilObject::_lookupDeletedDate((int) $ref['ref_id'])) &&
769  ilObject::_exists($crs_id, false) &&
770  is_null(ilObject::_lookupDeletedDate($crs_ref_id)) &&
771  ilLPStatus::_hasUserCompleted($crs_id, $usr_id)
772  ) {
773  $containing_prg = self::getInstanceByRefId((int) $ref["parent"]);
774  if ($containing_prg->isActive()) {
775  $completed_crss[] = [
776  "crs_id" => $crs_id
777  , "prg_ref_id" => (int) $ref["parent"]
778  , "prg_obj_id" => $containing_prg->getId()
779  , "crsr_ref_id" => (int) $ref["child"]
780  , "crsr_id" => (int) $ref["obj_id"]
781  , "crs_ref_id" => (int) $crs_ref_id
782  , "crs_id" => (int) $crs_id
783 
784  , "title" => ilContainerReference::_lookupTitle((int) $ref["obj_id"])
785  ];
786  }
787  }
788  }
789  return $completed_crss;
790  }
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
static _lookupTitle(int $obj_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupTargetRefId(int $a_obj_id)
static _lookupTargetId(int $a_obj_id)
static _lookupDeletedDate(int $ref_id)
+ 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.

ilException

Parameters
string[]$subobjects

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

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

Referenced by ilObjectDefinition\getCreatableSubObjects().

1631  : array
1632  {
1633  if ($ref_id === null) {
1634  return $subobjects;
1635  }
1636 
1637  if (ilObject::_lookupType($ref_id, true) !== "prg") {
1638  throw new ilException("Ref-Id '$ref_id' does not belong to a study programme object.");
1639  }
1640 
1641  $parent = self::getInstanceByRefId($ref_id);
1642 
1643  $mode = $parent->getLPMode();
1644 
1645  switch ($mode) {
1647  $possible_subobjects = $subobjects;
1648  break;
1650  $possible_subobjects = [
1651  "prg" => $subobjects["prg"],
1652  "prgr" => $subobjects["prgr"]
1653  ];
1654  break;
1656  $possible_subobjects = ['crsr' => $subobjects['crsr']];
1657  break;
1658  default:
1659  throw new ilException("Undefined mode for study programme: '$mode'");
1660  }
1661 
1662  if ($parent->hasAutomaticContentCategories()) {
1663  $possible_subobjects = array_filter(
1664  $possible_subobjects,
1665  static function ($subtype) {
1666  return $subtype === 'crsr';
1667  },
1668  ARRAY_FILTER_USE_KEY
1669  );
1670  }
1671  return $possible_subobjects;
1672  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDepth()

ilObjStudyProgramme::getDepth ( )

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

Root node has depth = 0.

Exceptions
ilExceptionwhen this object is not in tree.

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

640  : int
641  {
642  $cur = $this;
643  $count = 0;
644  while ($cur = $cur->getParent()) {
645  $count++;
646  }
647  return $count;
648  }

◆ getIdsOfUsersWithRelevantProgress()

ilObjStudyProgramme::getIdsOfUsersWithRelevantProgress ( )

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

References getAssignments().

1189  : array
1190  {
1191  return array_map(
1192  fn($ass) => $ass->getUserId(),
1193  $this->getAssignments()
1194  );
1195  }
+ Here is the call graph for this function:

◆ getInstanceByObjId()

◆ getInstanceByRefId()

static ilObjStudyProgramme::getInstanceByRefId (   $ref_id)
static

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

References ilObject\$ref_id, and null.

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

163  {
164  if (self::$study_programme_cache === null) {
165  self::initStudyProgrammeCache();
166  }
167  return self::$study_programme_cache->getInstanceByRefId((int) $ref_id);
168  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getLastChange()

ilObjStudyProgramme::getLastChange ( )

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

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

References getSettings().

323  : DateTime
324  {
325  return $this->getSettings()->getLastChange();
326  }
+ Here is the call graph for this function:

◆ getLocalMembers()

ilObjStudyProgramme::getLocalMembers ( )

get usr_ids with assignment on this node

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

References $members_cache, and ilObject\getId().

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

◆ getLoggedInUserId()

ilObjStudyProgramme::getLoggedInUserId ( )
protected

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

Referenced by acknowledgeCourses(), and assignUser().

1675  : int
1676  {
1677  return $this->ilUser->getId();
1678  }
+ Here is the caller graph for this function:

◆ getLogger()

ilObjStudyProgramme::getLogger ( )
protected

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

References $logger.

182  : ilLogger
183  {
184  return $this->logger;
185  }

◆ getLPChildren()

ilObjStudyProgramme::getLPChildren ( )

Get the leafs the study programme contains.

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

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

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

Referenced by getAmountOfLPChildren(), and getLPChildrenIds().

669  : array
670  {
671  $this->throwIfNotInTree();
672 
673  if ($this->lp_children === null) {
674  $this->lp_children = array();
675 
676  $ref_ids = $this->tree->getChildsByType($this->getRefId(), "crsr");
677 
678  // apply container sorting to tree
679  $sorting = ilContainerSorting::_getInstance($this->getId());
680  $ref_ids = $sorting->sortItems(array('crs_ref' => $ref_ids));
681  $ref_ids = $ref_ids['crs_ref'];
682 
683  $lp_children = array_map(function ($node_data) {
684  $lp_obj = $this->object_factory->getInstanceByRefId((int) $node_data["child"]);
685 
686  // filter out all StudyProgramme instances
687  return ($lp_obj instanceof $this) ? null : $lp_obj;
688  }, $ref_ids);
689 
690  $this->lp_children = array_filter($lp_children);
691  }
692  return $this->lp_children;
693  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getInstance(int $a_obj_id)
+ 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 701 of file class.ilObjStudyProgramme.php.

References getLPChildren().

701  : array
702  {
703  return array_map(static function ($child) {
704  return $child->getId();
705  }, $this->getLPChildren());
706  }
getLPChildren()
Get the leafs the study programme contains.
+ Here is the call graph for this function:

◆ getLPMode()

ilObjStudyProgramme::getLPMode ( )

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

References getSettings().

Referenced by addNode(), canBeCompleted(), and nodeInserted().

351  : int
352  {
353  return $this->getSettings()->getLPMode();
354  }
+ 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 1096 of file class.ilObjStudyProgramme.php.

References getAssignments().

1096  : array
1097  {
1098  $usr_ids = [];
1099  foreach ($this->getAssignments() as $assignment) {
1100  $usr_ids[] = $assignment->getUserId();
1101  }
1102  return array_unique($usr_ids);
1103  }
+ 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 1434 of file class.ilObjStudyProgramme.php.

Referenced by enableAutomaticMembershipSource(), and getApplicableMembershipSourceForUser().

1434  : array
1435  {
1436  $source_reader = $this->membersourcereader_factory->getReaderFor($ams, $exclude_id);
1437  return $source_reader->getMemberIds();
1438  }
+ Here is the caller graph for this function:

◆ getNow()

ilObjStudyProgramme::getNow ( )
protected

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

1681  {
1682  return new DateTimeImmutable();
1683  }

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

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

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

544  {
545  if ($this->parent === false) {
546  $this->throwIfNotInTree();
547  $parent_data = $this->tree->getParentNodeData($this->getRefId());
548  if ($parent_data["type"] !== "prg") {
549  $this->parent = null;
550  } else {
551  $this->parent = self::getInstanceByRefId($parent_data["ref_id"]);
552  }
553  }
554  return $this->parent;
555  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 586 of file class.ilObjStudyProgramme.php.

References $parent, getReferencesTo(), and null.

Referenced by getRoot().

586  : array
587  {
588  $current = $this;
589  $parents = [];
590  $queque = [$current];
591  while ($element = array_shift($queque)) {
592  $parent = $element->getParent();
593  if ($parent === null || $include_references) {
594  foreach ($this->getReferencesTo($element) as $reference) {
595  if ($this->tree->isDeleted($reference->getRefId())) {
596  continue;
597  }
598  $r_parent = $reference->getParent();
599  if (is_null($r_parent)) {
600  continue;
601  }
602  $queque[] = $r_parent;
603  $parents[] = $r_parent;
604  }
605  continue;
606  }
607  $queque[] = $parent;
608  $parents[] = $parent;
609  }
610  return array_reverse($parents);
611  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getReferencesTo(ilObjStudyProgramme $prg)
+ 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 331 of file class.ilObjStudyProgramme.php.

References getSettings().

331  : int
332  {
333  return $this->getSettings()->getAssessmentSettings()->getPoints();
334  }
+ Here is the call graph for this function:

◆ getPrgInstanceByObjId()

ilObjStudyProgramme::getPrgInstanceByObjId ( int  $obj_id)
protected

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

References getRefIdFor().

153  {
154  return self::getInstanceByRefId(self::getRefIdFor($obj_id));
155  }
getRefIdFor(int $obj_id)
+ 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 1289 of file class.ilObjStudyProgramme.php.

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

1289  : array
1290  {
1291  $db = ilStudyProgrammeDIC::dic()['model.AutoCategories.ilStudyProgrammeAutoCategoriesRepository'];
1292  $programmes =
1293  array_filter(
1294  array_map(
1295  static function (array $rec) {
1296  $values = array_values($rec);
1297  $prg_obj_id = (int) array_shift($values);
1298 
1299  $references = ilObject::_getAllReferences($prg_obj_id);
1300  $prg_ref_id = (int) array_shift($references);
1301 
1302  $prg = self::getInstanceByRefId($prg_ref_id);
1303  if ($prg->isAutoContentApplicable()) {
1304  return $prg;
1305  }
1306  },
1307  $db::getProgrammesFor($cat_ref_id)
1308  )
1309  );
1310  return $programmes;
1311  }
static _getAllReferences(int $id)
get all reference ids for object ID
ilDBInterface $db
+ 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 1444 of file class.ilObjStudyProgramme.php.

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

1444  : array
1445  {
1446  $db = ilStudyProgrammeDIC::dic()['model.AutoMemberships.ilStudyProgrammeAutoMembershipsRepository'];
1447  $programmes = array_map(
1448  static function ($rec) {
1449  $values = array_values($rec);
1450  $prg_obj_id = (int) array_shift($values);
1451 
1452  $references = ilObject::_getAllReferences($prg_obj_id);
1453  $prg_ref_id = (int) array_shift($references);
1454 
1455  $prg = self::getInstanceByRefId($prg_ref_id);
1456  return $prg;
1457  },
1458  $db::getProgrammesFor($src_type, $src_id)
1459  );
1460  return $programmes;
1461  }
static _getAllReferences(int $id)
get all reference ids for object ID
ilDBInterface $db
+ Here is the call graph for this function:

◆ getReferencesTo()

ilObjStudyProgramme::getReferencesTo ( ilObjStudyProgramme  $prg)
protected

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

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

Referenced by getParents(), and getReferencesToSelf().

557  : array
558  {
559  $tree = $this->tree;
560  return array_filter(
561  array_map(
562  static function ($id) {
563  $refs = ilObject::_getAllReferences((int) $id);
564  return new ilObjStudyProgrammeReference(
565  array_shift($refs)
566  );
567  },
569  ),
570  static function ($prg_ref) use ($tree) {
571  return !$tree->isDeleted($prg_ref->getRefId());
572  }
573  );
574  }
static _getAllReferences(int $id)
get all reference ids for object ID
ilTree $tree
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.
static _lookupSourceIds(int $a_target_id)
Get ids of all container references that target the object with the given id.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReferencesToSelf()

ilObjStudyProgramme::getReferencesToSelf ( )

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

References getReferencesTo().

576  : array
577  {
578  return $this->getReferencesTo($this);
579  }
getReferencesTo(ilObjStudyProgramme $prg)
+ Here is the call graph for this function:

◆ getRefIdFor()

static ilObjStudyProgramme::getRefIdFor ( int  $obj_id)
static

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

References ilObject\_getAllReferences().

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

143  : int
144  {
145  $refs = ilObject::_getAllReferences($obj_id);
146  if (count($refs) < 1) {
147  throw new ilException("Could not find ref_id for programme with obj_id $obj_id");
148  }
149  return (int) array_shift($refs);
150  }
static _getAllReferences(int $id)
get all reference ids for object ID
+ 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 654 of file class.ilObjStudyProgramme.php.

References getParents().

655  {
656  $parents = $this->getParents();
657  if (count($parents) < 1) {
658  return $this;
659  }
660  return $parents[0];
661  }
getParents(bool $include_references=false)
Get all parents of the node, where the root of the program comes first.
+ Here is the call graph for this function:

◆ getSettings()

◆ getSettingsRepository()

ilObjStudyProgramme::getSettingsRepository ( )
protected

◆ getSpecificAssignment()

ilObjStudyProgramme::getSpecificAssignment ( int  $assignment_id)

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

1019  : ilPRGAssignment
1020  {
1021  return $this->assignment_repository->get($assignment_id);
1022  }
Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PR...

◆ getStatus()

ilObjStudyProgramme::getStatus ( )

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

References getSettings().

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

389  : int
390  {
391  return $this->getSettings()->getAssessmentSettings()->getStatus();
392  }
+ 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 417 of file class.ilObjStudyProgramme.php.

References getSettings(), and null.

Referenced by updateCustomIcon().

418  {
419  $type_settings = $this->getSettings()->getTypeSettings();
420  if (!in_array($type_settings->getTypeId(), array("-", "0"))) {
421  $subtype_id = $type_settings->getTypeId();
422  return $this->type_repository->getType($subtype_id);
423  }
424 
425  return null;
426  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilStudyProgrammeType.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTree()

ilObjStudyProgramme::getTree ( )
protected

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

References ilObject\$tree.

178  : ilTree
179  {
180  return $this->tree;
181  }
ilTree $tree

◆ hasAdvancedMetadata()

ilObjStudyProgramme::hasAdvancedMetadata ( )

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

References ilObject\$type, getSettings(), and null.

294  : bool
295  {
296  $sub_type_id = $this->getSettings()->getTypeSettings()->getTypeId();
297  $type = null;
298  if ($sub_type_id) {
299  $type = $this->type_repository->getType($sub_type_id);
300  }
301 
302  return !is_null($type) && count($this->type_repository->getAssignedAMDRecordIdsByType($type->getId(), true)) > 0;
303  }
string $type
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 1047 of file class.ilObjStudyProgramme.php.

References getAmountOfAssignmentsOf().

1047  : bool
1048  {
1049  return $this->getAmountOfAssignmentsOf($user_id) > 0;
1050  }
getAmountOfAssignmentsOf(int $user_id)
Get the amount of assignments a user has on this program node or any node above.
+ Here is the call graph for this function:

◆ hasAssignments()

ilObjStudyProgramme::hasAssignments ( )

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

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

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

1124  : bool
1125  {
1126  $filter = new ilPRGAssignmentFilter($this->lng);
1127  $count = $this->assignment_repository->countAllForNodeIsContained(
1128  $this->getId(),
1129  null,
1130  $filter
1131  );
1132  return $count > 0;
1133 
1134  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 1149 of file class.ilObjStudyProgramme.php.

References getAssignmentsOfSingleProgramForUser().

1149  : bool
1150  {
1151  return count($this->getAssignmentsOfSingleProgramForUser($usr_id)) > 0;
1152  }
getAssignmentsOfSingleProgramForUser(int $usr_id)
Get assignments of user to this program-node only.
+ Here is the call graph for this function:

◆ hasAutomaticContentCategories()

ilObjStudyProgramme::hasAutomaticContentCategories ( )

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

References getAutomaticContentCategories().

1211  : bool
1212  {
1213  return count($this->getAutomaticContentCategories()) > 0;
1214  }
getAutomaticContentCategories()
Get configuration of categories with auto-content for this StudyProgramme;.
+ 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 618 of file class.ilObjStudyProgramme.php.

References getAmountOfChildren().

618  : bool
619  {
620  return $this->getAmountOfChildren($include_references) > 0;
621  }
getAmountOfChildren($include_references=false)
Get the amount of other StudyProgrammes this StudyProgramme has as children.
+ Here is the call graph for this function:

◆ hasContentPage()

ilObjStudyProgramme::hasContentPage ( )

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

References ilObject\getId().

Referenced by createContentPage().

1906  : bool
1907  {
1908  return \ilContainerPage::_exists(self::CP_TYPE, $this->getId());
1909  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasLPChildren()

ilObjStudyProgramme::hasLPChildren ( )

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

References getAmountOfLPChildren().

Referenced by isAutoContentApplicable().

717  : bool
718  {
719  return ($this->getAmountOfLPChildren() > 0);
720  }
getAmountOfLPChildren()
Get the amount of leafs the study programme contains.
+ 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 1175 of file class.ilObjStudyProgramme.php.

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

Referenced by canBeRemoved().

1175  : bool
1176  {
1177  $filter = new ilPRGAssignmentFilter($this->lng);
1178  $filter = $filter->withValues([
1179  'prg_status_hide_irrelevant' => true
1180  ]);
1181  $count = $this->assignment_repository->countAllForNodeIsContained(
1182  $this->getId(),
1183  null,
1184  $filter
1185  );
1186  return $count > 0;
1187  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStudyProgrammeCache()

static ilObjStudyProgramme::initStudyProgrammeCache ( )
static

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

References null, and ilObjStudyProgrammeCache\singleton().

111  : void
112  {
113  if (self::$study_programme_cache === null) {
114  self::$study_programme_cache = ilObjStudyProgrammeCache::singleton();
115  }
116  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ isActive()

ilObjStudyProgramme::isActive ( )

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

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

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

1319  : bool
1320  {
1321  $valid_status = in_array(
1322  $this->getSettings()->getAssessmentSettings()->getStatus(),
1323  [
1326  ],
1327  true
1328  );
1329 
1330  $crslnk_allowed = (
1331  $this->hasLPChildren()
1332  || $this->getAmountOfChildren(true) === 0
1333  );
1334 
1335  return $valid_status && $crslnk_allowed;
1336  }
getAmountOfChildren($include_references=false)
Get the amount of other StudyProgrammes this StudyProgramme has as children.
+ Here is the call graph for this function:

◆ isCertificateActive()

ilObjStudyProgramme::isCertificateActive ( )

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

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

428  : bool
429  {
430  $global_settings = new ilSetting('certificate');
431  $global_active = (bool) $global_settings->get('active', '0');
432  if (!$global_active) {
433  return false;
434  }
436  $certificate_template = $certificate_template_repository->fetchCurrentlyUsedCertificate($this->getId());
437  return $certificate_template->isCurrentlyActive();
438  }
fetchCurrentlyUsedCertificate(int $objId)
ilCertificateTemplateRepository $certificate_template_repository
+ Here is the call graph for this function:

◆ markAccredited()

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

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

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

1697  : void {
1698  $progress_node_id = $this->getId();
1699  $assignment = $this->assignment_repository->get($assignment_id)
1700  ->markAccredited(
1701  $this->getSettingsRepository(),
1702  $this->events,
1703  $progress_node_id,
1704  $acting_usr_id,
1705  $err_collection
1706  );
1707 
1708  $this->assignment_repository->store($assignment);
1709  }
+ Here is the call graph for this function:

◆ markNotRelevant()

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

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

References ilObject\getId(), getSettingsRepository(), and refreshLPStatus().

1733  : void {
1734  $progress_node_id = $this->getId();
1735  $assignment = $this->assignment_repository->get($assignment_id)
1736  ->markNotRelevant(
1737  $this->getSettingsRepository(),
1738  $progress_node_id,
1739  $acting_usr_id,
1740  $err_collection
1741  );
1742 
1743  $this->assignment_repository->store($assignment);
1744  $this->refreshLPStatus($assignment->getUserId());
1745  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ Here is the call graph for this function:

◆ markRelevant()

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

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

References ilObject\getId(), getSettingsRepository(), and refreshLPStatus().

1751  : void {
1752  $progress_node_id = $this->getId();
1753  $assignment = $this->assignment_repository->get($assignment_id)
1754  ->markRelevant(
1755  $this->getSettingsRepository(),
1756  $progress_node_id,
1757  $acting_usr_id,
1758  $err_collection
1759  );
1760 
1761  $this->assignment_repository->store($assignment);
1762  $this->refreshLPStatus($assignment->getUserId());
1763  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ Here is the call graph for this function:

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

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

918  {
919  global $DIC;
920  $rbacadmin = $DIC['rbacadmin'];
921 
922  if ($parent = $this->getParent()) {
923  // TODO: check if there some leafs in the new parent
924 
925  $this->tree->moveTree($this->getRefId(), $new_parent->getRefId());
926  // necessary to clean up permissions
927  $rbacadmin->adjustMovedObjectPermissions($this->getRefId(), $parent->getRefId());
928 
929  // TODO: lp-progress needs to be updated
930 
931  // clear caches on different nodes
932  $this->clearParentCache();
933 
934  $parent->clearChildrenCache();
935  $parent->clearLPChildrenCache();
936 
937  $new_parent->clearChildrenCache();
938  $new_parent->clearLPChildrenCache();
939  }
940 
941  return $this;
942  }
clearLPChildrenCache()
Clear the cached lp children.
getParent()
Get the parent ilObjStudyProgramme of this object.
clearChildrenCache()
Clear the cached children.
global $DIC
Definition: shib_login.php:22
clearParentCache()
Clear the cached parent to query it again at the tree.
+ 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 833 of file class.ilObjStudyProgramme.php.

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

833  : void
834  {
835  if (! $prg instanceof ilObjStudyProgrammeReference &&
836  ! $prg instanceof ilObjStudyProgramme
837  ) {
838  throw new ilStudyProgrammeTreeException("Wrong type of node: " . get_class($prg));
839  }
841  throw new ilStudyProgrammeTreeException("Program already contains leafs.");
842  }
843 
845  $this->settings_repository->update(
847  );
848  }
849 
850  $this->clearChildrenCache();
851  $this->addMissingProgresses();
852  }
clearChildrenCache()
Clear the cached children.
addMissingProgresses()
Add missing progress records for all assignments of this programm.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ Here is the call graph for this function:

◆ putInTree()

ilObjStudyProgramme::putInTree ( 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

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

References ilObject\_lookupType().

Referenced by addNode().

861  : void
862  {
863  parent::putInTree($parent_ref_id);
864 
865  if (ilObject::_lookupType($parent_ref_id, true) === "prg") {
866  $par = self::getInstanceByRefId($parent_ref_id);
867  $par->nodeInserted($this);
868  }
869  }
static _lookupType(int $id, bool $reference=false)
+ 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 1685 of file class.ilObjStudyProgramme.php.

References ilLPStatusWrapper\_updateStatus(), and ilObject\getId().

Referenced by acknowledgeCourses(), changeAmountOfPoints(), changeProgressDeadline(), changeProgressValidityDate(), markNotRelevant(), markRelevant(), removeAssignment(), unmarkAccredited(), and updatePlanFromRepository().

1685  : void
1686  {
1687  if (is_null($node_obj_id)) {
1688  $node_obj_id = $this->getId();
1689  }
1690  ilLPStatusWrapper::_updateStatus($node_obj_id, $usr_id);
1691  }
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ 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 997 of file class.ilObjStudyProgramme.php.

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

998  {
999  $this->members_cache = null;
1000  if ($assignment->getRootId() !== $this->getId()) {
1001  throw new ilException(
1002  "ilObjStudyProgramme::removeAssignment: Assignment '"
1003  . $assignment->getId() . "' does not belong to study "
1004  . "program '" . $this->getId() . "'."
1005  );
1006  }
1007 
1008  $this->assignment_repository->delete($assignment);
1009 
1010  $affected_node_ids = array_map(fn($pgs) => $pgs->getNodeId(), $assignment->getProgresses());
1011  foreach ($affected_node_ids as $node_obj_id) {
1012  $this->refreshLPStatus($assignment->getUserId(), $node_obj_id);
1013  }
1014 
1015  $this->events->userDeassigned($assignment);
1016  return $this;
1017  }
getProgresses(array &$ret=[], ?ilPRGProgress $pgs=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ 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 1274 of file class.ilObjStudyProgramme.php.

Referenced by ilStudyProgrammeAppEventListener\removeCrsFromProgrammes().

1274  : void
1275  {
1276  foreach (self::getProgrammesMonitoringCategory($cat_ref_id) as $prg) {
1277  foreach ($prg->getLPChildren() as $child) {
1278  if ((int) $child->getTargetRefId() === $crs_ref_id) {
1279  $child->delete();
1280  }
1281  }
1282  }
1283  }
+ 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 1474 of file class.ilObjStudyProgramme.php.

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

Referenced by ilStudyProgrammeAppEventListener\removeMemberFromProgrammes().

1474  : void
1475  {
1476  $now = new DateTimeImmutable();
1477  $assignment_repository = ilStudyProgrammeDIC::dic()['repo.assignment'];
1478  foreach (self::getProgrammesMonitoringMemberSource($src_type, $src_id) as $prg) {
1479  $assignments = $prg->getAssignmentsOfSingleProgramForUser($usr_id);
1480  $next_membership_source = $prg->getApplicableMembershipSourceForUser($usr_id, $src_id);
1481 
1482  foreach ($assignments as $assignment) {
1483  if (!$assignment->getProgressTree()->isInProgress()) {
1484  continue;
1485  }
1486 
1487  if (
1488  $next_membership_source !== null
1489  && $next_membership_source?->isEnabled()
1490  && $next_membership_source->getSourceId() !== $src_id
1491  ) {
1492  $new_src_type = $next_membership_source->getSourceType();
1493  $assigned_by = ilStudyProgrammeAutoMembershipSource::SOURCE_MAPPING[$new_src_type];
1494  $assignment = $assignment->withLastChange($assigned_by, $now);
1495  $assignment_repository->store($assignment);
1496  break;
1497  } else {
1498  $assignment_repository->delete($assignment);
1499  }
1500  }
1501  }
1502  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilPRGAssignmentDBRepository $assignment_repository
+ 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 880 of file class.ilObjStudyProgramme.php.

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

881  {
882  if ($a_prg->getParent()->getId() !== $this->getId()) {
883  throw new ilStudyProgrammeTreeException("This is no parent of the given programm.");
884  }
885 
886  if (!$a_prg->canBeRemoved()) {
887  throw new ilStudyProgrammeTreeException("The node has relevant assignments.");
888  }
889 
890  // *sigh*...
891  $node_data = $this->tree->getNodeData($a_prg->getRefId());
892  $this->tree->deleteTree($node_data);
893  $a_prg->clearParentCache();
894  $this->clearChildrenCache();
895 
896  return $this;
897  }
getParent()
Get the parent ilObjStudyProgramme of this object.
clearChildrenCache()
Clear the cached children.
canBeRemoved()
Check weather a node can be removed.
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
clearParentCache()
Clear the cached parent to query it again at the tree.
+ Here is the call graph for this function:

◆ resetExpiryInfoSentFor()

ilObjStudyProgramme::resetExpiryInfoSentFor ( ilPRGAssignment  $ass)

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

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

◆ resetRiskyToFailSentFor()

ilObjStudyProgramme::resetRiskyToFailSentFor ( ilPRGAssignment  $ass)

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

1039  : void
1040  {
1041  $this->assignment_repository->resetRiskyToFailSentFor($ass);
1042  }

◆ setPoints()

ilObjStudyProgramme::setPoints ( int  $points)

Set the amount of points.

Exceptions
ilException

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

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

342  {
343  $settings = $this->getSettings();
344  $this->updateSettings(
345  $settings->withAssessmentSettings($settings->getAssessmentSettings()->withPoints($points))
346  );
347  $this->updateLastChange();
348  return $this;
349  }
updateLastChange()
Update last change timestamp on this node and its parents.
updateSettings(ilStudyProgrammeSettings $settings)
+ 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 1546 of file class.ilObjStudyProgramme.php.

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

1546  : void
1547  {
1548  // We only use courses via crs_refs
1549  $type = ilObject::_lookupType($obj_id);
1550  if ($type === "crsr") {
1551  foreach (ilObject::_getAllReferences($obj_id) as $ref_id) {
1552  self::setProgressesCompletedIfParentIsProgrammeInLPCompletedMode($ref_id, $obj_id, $user_id);
1553  }
1554  }
1555  }
string $type
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupType(int $id, bool $reference=false)
+ 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 1560 of file class.ilObjStudyProgramme.php.

References $DIC, ilObject\$tree, ilTree\getParentNodeData(), and ilStudyProgrammeSettings\MODE_LP_COMPLETED.

Referenced by ilStudyProgrammeAppEventListener\onServiceTrackingUpdateStatus().

1564  : void {
1565  global $DIC; // TODO: replace this by a settable static for testing purpose?
1566  $tree = $DIC['tree'];
1567  $node_data = $tree->getParentNodeData($ref_id);
1568  if (count($node_data) === 0 || !array_key_exists('type', $node_data) || $node_data["type"] !== "prg") {
1569  return;
1570  }
1571  self::initStudyProgrammeCache();
1572  $prg = self::getInstanceByRefId($node_data["child"]);
1573  if ($prg->getLPMode() !== ilStudyProgrammeSettings::MODE_LP_COMPLETED) {
1574  return;
1575  }
1576  $prg->succeed($user_id, $obj_id);
1577  }
ilTree $tree
getParentNodeData(int $a_node_id)
get data of parent node from tree and object_data
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ 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 399 of file class.ilObjStudyProgramme.php.

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

400  {
401  $settings = $this->getSettings();
402  $this->updateSettings(
403  $settings->withAssessmentSettings($settings->getAssessmentSettings()->withStatus($a_status))
404  );
405  $this->updateLastChange();
406  return $this;
407  }
updateLastChange()
Update last change timestamp on this node and its parents.
updateSettings(ilStudyProgrammeSettings $settings)
+ Here is the call graph for this function:

◆ statusToRepr()

ilObjStudyProgramme::statusToRepr ( int  $status)

Get a user readable representation of a status.

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

References ilObject\$lng, ilLanguage\loadLanguageModule(), ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, ilPRGProgress\STATUS_NOT_RELEVANT, and ilLanguage\txt().

1884  : string
1885  {
1886  $lng = $this->lng;
1887  $lng->loadLanguageModule("prg");
1888  if ($status === ilPRGProgress::STATUS_IN_PROGRESS) {
1889  return $lng->txt("prg_status_in_progress");
1890  }
1891  if ($status === ilPRGProgress::STATUS_COMPLETED) {
1892  return $lng->txt("prg_status_completed");
1893  }
1894  if ($status === ilPRGProgress::STATUS_ACCREDITED) {
1895  return $lng->txt("prg_status_accredited");
1896  }
1897  if ($status === ilPRGProgress::STATUS_NOT_RELEVANT) {
1898  return $lng->txt("prg_status_not_relevant");
1899  }
1900  if ($status === ilPRGProgress::STATUS_FAILED) {
1901  return $lng->txt("prg_status_failed");
1902  }
1903  throw new ilException("Unknown status: '$status'");
1904  }
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...
loadLanguageModule(string $a_module)
Load language module.
ilLanguage $lng
+ Here is the call graph for this function:

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

References ilObject\getId().

1221  : void
1222  {
1223  $ac = $this->auto_categories_repository->create(
1224  $this->getId(),
1225  $category_ref_id
1226  );
1227  $this->auto_categories_repository->update($ac);
1228  }
+ 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 1355 of file class.ilObjStudyProgramme.php.

References ilObject\getId(), and null.

1355  : void
1356  {
1357  $ams = $this->auto_memberships_repository->create(
1358  $this->getId(),
1359  $type,
1360  $src_id,
1361  false,
1362  null,
1363  null,
1364  $search_recursive
1365  );
1366  $this->auto_memberships_repository->update($ams);
1367  }
string $type
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ storeExpiryInfoSentFor()

ilObjStudyProgramme::storeExpiryInfoSentFor ( ilPRGAssignment  $ass)

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

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

◆ storeRiskyToFailSentFor()

ilObjStudyProgramme::storeRiskyToFailSentFor ( ilPRGAssignment  $ass)

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

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

◆ succeed()

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

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

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

1579  : void
1580  {
1581  $progress_node_id = $this->getId();
1582  if (is_null($ass)) {
1583  $user_assignments = $this->assignment_repository
1584  ->getAllForNodeIsContained($progress_node_id, [$usr_id]);
1585  } else {
1586  $user_assignments = [$ass];
1587  }
1588 
1589  foreach ($user_assignments as $ass) {
1590  $ass = $ass->succeed(
1591  $this->getSettingsRepository(),
1592  $progress_node_id,
1593  $triggering_obj_id
1594  );
1595  $this->assignment_repository->store($ass);
1596  }
1597  }
+ Here is the call graph for this function:

◆ throwIfNotInTree()

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

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

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

725  : void
726  {
727  if (!$this->tree->isInTree($this->getRefId())) {
728  throw new ilStudyProgrammeTreeException("This program is not in tree.");
729  }
730  }
Exception is thrown when invariants on the program tree would be violated by manipulation of tree...
+ Here is the caller graph for this function:

◆ unmarkAccredited()

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

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

References ilObject\getId(), getSettingsRepository(), and refreshLPStatus().

1715  : void {
1716  $progress_node_id = $this->getId();
1717  $assignment = $this->assignment_repository->get($assignment_id)
1718  ->unmarkAccredited(
1719  $this->getSettingsRepository(),
1720  $progress_node_id,
1721  $acting_usr_id,
1722  $err_collection
1723  );
1724 
1725  $this->assignment_repository->store($assignment);
1726  $this->refreshLPStatus($assignment->getUserId());
1727  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ Here is the call graph for this function:

◆ update()

ilObjStudyProgramme::update ( )
Exceptions
ilException

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

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

Referenced by updateLastChange().

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

◆ updateCustomIcon()

ilObjStudyProgramme::updateCustomIcon ( )

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

References ilFileUtils\getDataDir(), ilObject\getId(), getSubType(), and ilObject\getType().

Referenced by ilObjStudyProgrammeSettingsGUI\buildForm().

1599  : void
1600  {
1601  $customIcon = $this->custom_icon_factory->getByObjId($this->getId(), $this->getType());
1602  $subtype = $this->getSubType();
1603 
1604  if ($subtype && $subtype->getIconIdentifier()) {
1605  $src = $this->type_repository->getIconPathFS($subtype);
1606 
1607  //This is a horrible hack to allow Flysystem/LocalFilesystem to read the file.
1608  $tmp = 'ico_' . $this->getId();
1609  copy($src, \ilFileUtils::getDataDir() . '/temp/' . $tmp);
1610 
1611  $customIcon->saveFromTempFileName($tmp);
1612  } else {
1613  $customIcon->remove();
1614  }
1615  }
getSubType()
Gets the SubType Object.
static getDataDir()
get data directory (outside webspace)
+ 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 1526 of file class.ilObjStudyProgramme.php.

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

Referenced by setPoints(), and setStatus().

1526  : void
1527  {
1528  $this->getSettings()->updateLastChange();
1529  if ($parent = $this->getParent()) {
1530  $parent->updateLastChange();
1531  }
1532  $this->update();
1533  }
getParent()
Get the parent ilObjStudyProgramme of this object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updatePlanFromRepository()

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

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

References getSettingsRepository(), and refreshLPStatus().

1829  : void {
1830  $assignment = $this->assignment_repository->get($assignment_id)
1831  ->updatePlanFromRepository(
1832  $this->getSettingsRepository(),
1833  $acting_usr_id,
1834  $err_collection
1835  );
1836 
1837  $this->assignment_repository->store($assignment);
1838  $this->refreshLPStatus($assignment->getUserId());
1839  }
refreshLPStatus(int $usr_id, ?int $node_obj_id=null)
+ Here is the call graph for this function:

◆ updateSettings()

ilObjStudyProgramme::updateSettings ( ilStudyProgrammeSettings  $settings)

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

References ilObject\getId(), ilStudyProgrammeSettings\getObjId(), and getSettingsRepository().

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

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

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

Referenced by getAssignmentRepository().

◆ $auto_categories_repository

ilStudyProgrammeAutoCategoryDBRepository ilObjStudyProgramme::$auto_categories_repository
protected

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

◆ $auto_memberships_repository

ilStudyProgrammeAutoMembershipsDBRepository ilObjStudyProgramme::$auto_memberships_repository
protected

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

◆ $children

array ilObjStudyProgramme::$children = null
protected

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

Referenced by getChildren().

◆ $custom_icon_factory

ilObjectCustomIconFactory ilObjStudyProgramme::$custom_icon_factory
protected

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

◆ $events

ilStudyProgrammeEvents ilObjStudyProgramme::$events
protected

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

◆ $ilUser

ilObjUser ilObjStudyProgramme::$ilUser
protected

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

Referenced by __construct().

◆ $logger

ilLogger ilObjStudyProgramme::$logger
protected

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

Referenced by getLogger().

◆ $lp_children

array ilObjStudyProgramme::$lp_children = null
protected

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

Referenced by getLPChildren().

◆ $members_cache

array ilObjStudyProgramme::$members_cache = null
protected

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

Referenced by getLocalMembers().

◆ $membersourcereader_factory

ilStudyProgrammeMembershipSourceReaderFactory ilObjStudyProgramme::$membersourcereader_factory
protected

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

◆ $object_factory

ilObjectFactoryWrapper ilObjStudyProgramme::$object_factory = null
protected

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

◆ $parent

ilObjStudyProgramme::$parent
protected

◆ $reference_children

array ilObjStudyProgramme::$reference_children = null
protected

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

◆ $settings_repository

ilStudyProgrammeSettingsDBRepository ilObjStudyProgramme::$settings_repository
protected

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

Referenced by getSettingsRepository().

◆ $study_programme_cache

ilObjStudyProgrammeCache ilObjStudyProgramme::$study_programme_cache = null
staticprotected

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

◆ $type_repository

ilStudyProgrammeTypeDBRepository ilObjStudyProgramme::$type_repository
protected

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

◆ $webdir

Filesystem ilObjStudyProgramme::$webdir
protected

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

◆ CP_TYPE

const ilObjStudyProgramme::CP_TYPE = 'cont'

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


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