19declare(strict_types=1);
44 protected ?ArrayAccess
$di =
null;
47 protected ArrayAccess
$dic;
60 $this->
lng = $DIC[
'lng'];
61 $this->
ctrl = $DIC[
'ilCtrl'];
62 $this->
user = $DIC[
'ilUser'];
63 $this->tree =
$DIC[
'tree'];
64 $this->log =
$DIC[
"ilLoggerFactory"]->getRootLogger();
65 $this->app_event_handler =
$DIC[
'ilAppEventHandler'];
66 $this->il_news =
$DIC->news();
68 $this->repo_ref_props = LocalDIC::dic()[
'properties.object_reference.repositoy'];
71 $this->
lng->loadLanguageModule(
'rbac');
79 public function read(): void
84 $this->ref_props = $this->repo_ref_props->getFor($this->
getRefId());
85 }
catch (\Exception
$e) {
86 $this->ref_props = $this->repo_ref_props->getFor(
null);
87 $this->repo_ref_props->storePropertyAvailabilityPeriod(
88 $this->ref_props->getPropertyAvailabilityPeriod()
89 ->withObjectReferenceId($this->getRefId())
96 $id = parent::create();
100 $this->ref_props = $this->repo_ref_props->getFor(
null);
103 return $this->
getId();
108 if (!parent::update()) {
116 public function delete():
bool
118 if (!parent::delete()) {
133 $this->app_event_handler->raise(
134 'components/ILIAS/LearningSequence',
137 'obj_id' => $this->
getId(),
138 'appointments' =>
null
150 $this->repo_ref_props->storePropertyAvailabilityPeriod($period);
153 public function cloneObject(
int $target_id,
int $copy_id = 0,
bool $omit_tree =
false): ?
ilObject
156 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
166 if ($cwo->isRootNode($this->getRefId())) {
167 $online = $online->withOffline();
169 $new_obj->getObjectProperties()->storePropertyIsOnline($online);
171 $new_obj->repo_ref_props->storePropertyAvailabilityPeriod(
172 $this->ref_props->getPropertyAvailabilityPeriod()
173 ->withObjectReferenceId($new_obj->getRefId())
176 $roles = $new_obj->getLSRoles();
178 $this->
user->getId(),
179 $roles->getDefaultAdminRole()
189 foreach ($cp_types as
$type) {
195 if ($type === LSOPageType::INTRO) {
200 $source_page->copy($target_page_id,
$type->value, $target_page_id);
210 if (!$admin || !$new_admin || !$this->
getRefId() || !$new_obj->
getRefId()) {
211 $this->log->write(__METHOD__ .
' : Error cloning auto generated role: il_lso_admin');
214 $this->rbac_admin->copyRolePermissions($admin, $this->
getRefId(), $new_obj->
getRefId(), $new_admin,
true);
215 $this->log->write(__METHOD__ .
' : Finished copying of role lso_admin.');
220 if (!$member || !$new_member) {
221 $this->log->write(__METHOD__ .
' : Error cloning auto generated role: il_lso_member');
224 $this->rbac_admin->copyRolePermissions($member, $this->
getRefId(), $new_obj->
getRefId(), $new_member,
true);
225 $this->log->write(__METHOD__ .
' : Finished copying of role lso_member.');
235 foreach ($source->getUploads() as $key => $upload_info) {
236 $target = $target->withUpload($upload_info, $key);
239 foreach ($source->getDeletions() as $deletion) {
240 $target = $target->withDeletion($deletion);
244 ->withAbstract($source->getAbstract())
245 ->withExtro($source->getExtro())
246 ->withAbstractImage($source->getAbstractImage())
247 ->withExtroImage($source->getExtroImage())
256 $lp_settings->cloneSettings($obj_id);
264 public function getDI(): ArrayAccess
266 if (is_null($this->di)) {
276 if (is_null($this->local_di)) {
281 new \
ILIAS\Data\Factory(),
284 $this->local_di =
$di;
291 if (!$this->settings_db) {
292 $this->settings_db = $this->
getDI()[
'db.settings'];
299 if (!$this->ls_settings) {
309 $this->ls_settings = $settings;
314 if (!$this->items_db) {
315 $this->items_db = $this->
getLocalDI()[
'db.lsitems'];
322 if (!$this->conditions_db) {
323 $this->conditions_db = $this->
getDI()[
"db.postconditions"];
330 if (!$this->ls_participants) {
331 $this->ls_participants = $this->
getLocalDI()[
'participants'];
343 if (is_null($this->ls_access)) {
366 $db->storeItems($ls_items);
376 $rep_utils->deleteObjects($this->
getRefId(), $ref_ids);
378 $db->delete($ref_ids);
386 $condition_types = $this->il_condition_handler->getOperatorsByTriggerType(
$type);
390 foreach ($condition_types as $cond_type) {
391 $conditions[$cond_type] = $this->
lng->txt(
'condition_' . $cond_type);
398 if (!$this->learner_progress_db) {
399 $this->learner_progress_db = $this->
getLocalDI()[
'db.progress'];
406 if (!$this->state_db) {
407 $this->state_db = $this->
getDI()[
'db.states'];
418 return $db->getLearnerItems($usr_id, $this->
getRefId());
423 if (!$this->ls_roles) {
424 $this->ls_roles = $this->
getLocalDI()[
'roles'];
440 public static function _goto(
string $target,
string $add =
""): void
443 $main_tpl =
$DIC->ui()->mainTemplate();
445 $ilAccess =
$DIC[
'ilAccess'];
448 $ilUser =
$DIC[
'ilUser'];
452 if (substr($add, 0, 5) ==
'rcode') {
457 "login.php?target=" . $request_target .
"&cmd=force_login&lang=" .
458 $ilUser->getCurrentLanguage()
470 if ($add ==
"mem" && $ilAccess->checkAccess(
"manage_members",
"", $target)) {
474 if ($ilAccess->checkAccess(
"read",
"", $target)) {
478 if ($ilAccess->checkAccess(
"visible",
"", $target)) {
482 $main_tpl->setOnScreenMessage(
'failure', sprintf(
483 $lng->
txt(
"msg_no_perm_read_item"),
502 $context = $ns->contextForRefId($this->
getRefId());
503 $item = $ns->item($context);
504 $item->setContentIsLangVar(
true);
505 $item->setContentTextIsLangVar(
true);
506 $item->setTitle(
"lso_news_online_title");
507 $item->setContent(
"lso_news_online_txt");
508 $ns->data()->save($item);
517 $act_db = $this->getActivationDB();
518 $act_db->setEffectiveOnlineStatus($this->
getRefId(), $status);
524 $curriculum =
$dic[
"player.curriculumbuilder"]->getLearnerCurriculum(
false);
525 return $dic[
'ui.renderer']->render($curriculum);
531 $buttons =
$dic[
"player.launchlinksbuilder"]->getLaunchbuttonsComponent();
532 return $dic[
'ui.renderer']->render($buttons);
544 return $this->
getLSRoles()->getLocalLearningSequenceRoles($translate);
549 return $this->
getLSRoles()->getDefaultMemberRole();
554 return $this->
getLSRoles()->getDefaultAdminRole();
562 return $this->
getLSRoles()->getDefaultLearningSequenceRoles($a_grp_id);
577 return $this->getLsRoles()->readMemberData($user_ids, $columns);
582 foreach ($this->tree->getPathFull(
$ref_id) as $hop) {
583 if (in_array($hop[
'type'], $search_types)) {
602 return $this->
getId();
613 throw new \LogicException(
'will not create content page - it already exists.');
617 $new_page_object->setParentId($this->
getId());
618 $new_page_object->createFromXML();
627 $gui = $page_type === LSOPageType::INTRO ?
631 $gui->setPresentationTitle(
"");
632 $gui->setTemplateOutput(
false);
634 $ret = $gui->showPage();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
INTERNAL CLASS: Please do not use in consumer code.
static _getInstance(int $a_copy_id)
Class ilCtrl provides processing control methods.
const LP_STATUS_COMPLETED_NUM
Storage for ilLSPostConditions.
Persistence for View-States.
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...
Get LearningProgress and availability of items in sequence.
Persistence for Settings (like abstract, extro)
Settings for an LSO (like abstract, extro)
static handleCode(int $a_ref_id, string $a_type, string $a_code)
Class ilObjLearningSequenceEditExtroGUI @ilCtrl_Calls ilObjLearningSequenceEditExtroGUI: ilPageEditor...
Class ilObjLearningSequenceEditIntroGUI @ilCtrl_Calls ilObjLearningSequenceEditIntroGUI: ilPageEditor...
cloneLPSettings(int $obj_id)
create()
note: title, description and type should be set when this function is called
getMailToMembersType()
Get mail to members type.
getContentPageHTML(LSOPageType $page_type)
updateSettings(ilLearningSequenceSettings $settings)
ilLearningSequenceParticipants $ls_participants
ilLearningSequenceRoles $ls_roles
__construct(int $id=0, bool $call_by_reference=true)
getCurrentUserCurriculum()
createContentPage(LSOPageType $page_type)
ilLSPostConditionDB $conditions_db
deletePostConditionsForSubObjects(array $ref_ids)
Delete post conditions for ref ids.
setEffectiveOnlineStatus(bool $status)
ilLearningSequenceActivation $ls_activation
ilLearningSequenceSettings $ls_settings
ilConditionHandler $il_condition_handler
ilLearningSequenceSettingsDB $settings_db
static _goto(string $target, string $add="")
Goto target learning sequence.
raiseEvent(string $event_type)
getCurrentUserLaunchButtons()
ReferencePropertiesRepository $repo_ref_props
getObjectReferenceProperties()
cloneSettings(ilObjLearningSequence $new_obj)
cloneAutoGeneratedRoles(ilObjLearningSequence $new_obj)
ilLearnerProgressDB $learner_progress_db
getDefaultLearningSequenceRoles(string $a_grp_id="")
readMemberData(array $user_ids, ?array $columns=null)
getLSLearnerItems(int $usr_id)
ILIAS News Service $il_news
getParentObjectInfo(int $ref_id, array $search_types)
storeAvailabilityPeriod(AvailabilityPeriod $period)
ilObjLearningSequenceAccess $ls_access
ilLearningSequenceActivationDB $activation_db
cloneIntroAndExtroContentPages(ilObjLearningSequence $new_obj, array $cp_types)
static getInstanceByRefId(int $ref_id)
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
getPossiblePostConditionsForType(string $type)
hasContentPage(LSOPageType $page_type)
storeLSItems(array $ls_items)
Update LSItems.
ObjectReferenceProperties $ref_props
getLocalLearningSequenceRoles(bool $translate=false)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
cloneMetaData(ilObject $target_obj)
Copy meta data.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static _deleteAllEntries(int $a_obj_id)
Delete all entries Normally called in case of object deletion.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static redirect(string $a_script)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.