68 protected \ILIAS\Container\InternalDomainService
$domain;
89 public function __construct(
int $a_id = 0,
bool $a_reference =
true)
94 $this->db =
$DIC->database();
95 $this->log =
$DIC[
"ilLog"];
96 $this->
access = $DIC->access();
97 $this->
error = $DIC[
"ilErr"];
98 $this->rbacsystem =
$DIC->rbac()->system();
99 $this->tree =
$DIC->repositoryTree();
100 $this->
user = $DIC->user();
101 $this->obj_definition =
$DIC[
"objDefinition"];
102 $this->news =
$DIC->news();
105 $this->setting =
$DIC[
"ilSetting"];
109 $this->content_style_domain =
$DIC->contentStyle()->domain();
110 $this->domain =
$DIC->container()->internal()->domain();
120 self::TILE_SMALL =>
$lng->
txt(
"cont_tile_size_1"),
121 self::TILE_NORMAL =>
$lng->
txt(
"cont_tile_size_0"),
122 self::TILE_LARGE =>
$lng->
txt(
"cont_tile_size_2"),
123 self::TILE_EXTRA_LARGE =>
$lng->
txt(
"cont_tile_size_3"),
124 self::TILE_FULL =>
$lng->
txt(
"cont_tile_size_4")
142 $cont_dir = $webspace_dir .
"/container_data";
143 if (!is_dir($cont_dir)) {
146 $obj_dir = $cont_dir .
"/obj_" . $this->
getId();
147 if (!is_dir($obj_dir)) {
165 $this->hiddenfilesfound = $a_hiddenfilesfound;
180 $this->style_id = $a_style_id;
185 $this->news_timeline = $a_val;
195 $this->news_timeline_auto_entries = $a_val;
205 $this->news_timeline_landing_page = $a_val;
215 if (!$this->news->isGloballyActivated()) {
235 $this->news_block_activated = $a_val;
245 $this->use_news = $a_val;
256 ?
string $a_default_value =
null
262 $q =
"SELECT value FROM container_settings WHERE " .
263 " id = " .
$ilDB->quote($a_id,
'integer') .
" AND " .
264 " keyword = " .
$ilDB->quote($a_keyword,
'text');
268 if (isset($rec[
'value'])) {
269 return $rec[
"value"];
272 return $a_default_value ??
'';
283 $q =
"SELECT value FROM container_settings WHERE " .
284 " id = " .
$ilDB->quote($a_id,
'integer') .
" AND " .
285 " keyword = " .
$ilDB->quote($a_keyword,
'text');
301 $query =
"DELETE FROM container_settings WHERE " .
302 "id = " .
$ilDB->quote($a_id,
'integer') .
" " .
303 "AND keyword = " .
$ilDB->quote($a_keyword,
'text');
304 $ilDB->manipulate($query);
307 $log->debug(
"Write container setting, id: " . $a_id .
", keyword: " . $a_keyword .
", value: " . $a_value);
309 $query =
"INSERT INTO container_settings (id, keyword, value) VALUES (" .
310 $ilDB->quote($a_id,
'integer') .
", " .
311 $ilDB->quote($a_keyword,
'text') .
", " .
312 $ilDB->quote($a_value,
'text') .
315 $ilDB->manipulate($query);
330 $sql =
"SELECT keyword, value FROM container_settings WHERE " .
331 " id = " .
$ilDB->quote($a_id,
'integer');
332 $set =
$ilDB->query($sql);
333 while ($row =
$ilDB->fetchAssoc($set)) {
334 $res[$row[
"keyword"]] = $row[
"value"];
342 string $a_keyword =
"",
343 bool $a_keyword_like =
false
353 $sql =
"DELETE FROM container_settings WHERE " .
354 " id = " .
$ilDB->quote($a_id,
'integer');
355 if ($a_keyword !==
"") {
356 if (!$a_keyword_like) {
357 $sql .=
" AND keyword = " .
$ilDB->quote($a_keyword,
"text");
359 $sql .=
" AND " .
$ilDB->like(
"keyword",
"text", $a_keyword);
362 $ilDB->manipulate($sql);
370 $settings = self::_getContainerSettings($a_obj_id);
371 if (count($settings)) {
374 foreach ($settings as $keyword => $value) {
377 stripos($keyword,
"icon") !==
false
378 && $keyword !==
'hide_header_icon_and_title'
390 $a_xml->
xmlData((
string) $value);
406 public function cloneObject(
int $target_id,
int $copy_id = 0,
bool $omit_tree =
false): ?
ilObject
409 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
414 $ot = $this->getObjectProperties()->clonePropertyTranslations($new_obj->getId())
415 ->withDefaultTitle($new_obj->getTitle());
416 $new_obj->getObjectProperties()->storePropertyTranslations($ot);
417 $new_obj->setObjectTranslation($ot);
418 if ($ot->getDefaultDescription() !==
"") {
419 $new_obj->setDescription($ot->getDefaultDescription());
421 $log->debug(
"**1**" . count($new_obj->getObjectTranslation()->getLanguages()));
422 $log->debug(
"ilContainer: cloning translations from " . $this->
getId() .
" to " .
425 #18624 - copy all sorting settings
434 $orig_page->copy($new_obj->getId(),
"cont", $new_obj->getId());
438 $this->content_style_domain->styleForRefId($this->getRefId())->cloneTo($new_obj->getId());
446 $orig_page->copy($new_obj->getId(),
"cstr", $new_obj->getId());
450 foreach (self::_getContainerSettings($this->
getId()) as $keyword => $value) {
451 self::_writeContainerSetting($new_obj->getId(), (
string) $keyword, (
string) $value);
454 $new_obj->setNewsTimeline($this->getNewsTimeline());
455 $new_obj->setNewsBlockActivated($this->getNewsBlockActivated());
456 $new_obj->setUseNews($this->getUseNews());
457 $new_obj->setNewsTimelineAutoEntries($this->getNewsTimelineAutoEntries());
458 $new_obj->setNewsTimelineLandingPage($this->getNewsTimelineLandingPage());
461 $mom_noti->cloneSettings($new_obj->getRefId());
465 $container_filter_service->cloneFilterFields($this->getRefId(), $new_obj->getRefId());
482 parent::cloneDependencies($target_id, $copy_id);
487 self::fixInternalLinksAfterCopy($target_id, $copy_id, $this->getRefId());
493 $collection = $olp->getCollectionInstance();
495 $collection->cloneCollection($target_id, $copy_id);
519 bool $soap_call =
false,
523 $ilUser = $this->user;
528 $wizard_options->saveOwner($ilUser->getId());
529 $wizard_options->saveRoot($clone_source);
532 $wizard_options->initContainer($clone_source,
$ref_id);
534 foreach (
$options as $source_id => $option) {
535 $wizard_options->addEntry($source_id, $option);
537 $wizard_options->read();
538 $wizard_options->storeTree($clone_source);
543 $wizard_options->read();
544 $wizard_options->dropFirstNode();
545 $wizard_options->appendMapping($clone_source,
$ref_id);
554 $soap_client->setResponseTimeout($soap_client->getResponseTimeout());
555 $soap_client->enableWSDL(
true);
557 $ilLog->write(__METHOD__ .
': Trying to call Soap client...');
558 if ($soap_client->init()) {
560 $res = $soap_client->call(
'ilClone', [$new_session_id .
'::' .
$client_id, $copy_id]);
563 $wizard_options->disableSOAP();
564 $wizard_options->read();
568 'copy_id' => $copy_id,
578 public function delete():
bool
581 if (!parent::delete()) {
585 $this->getObjectProperties()->deletePropertyTranslations();
588 $this->domain->page($this)->deletePage();
595 return self::VIEW_BY_TYPE;
600 return $this->order_type ?: self::SORT_TITLE;
605 $this->order_type = $a_value;
613 $id = get_class($class_provider);
628 if ($this->isClassificationFilterActive() && in_array($this->getType(), [
"grp",
"crs"])) {
640 if ($this->filteredSubtree()) {
641 $objects = $tree->getSubTree($tree->getNodeData($this->getRefId()));
643 $objects = $tree->getChilds($this->getRefId(),
"title");
652 bool $a_admin_panel_enabled =
false,
653 bool $a_include_side_block =
false,
654 int $a_get_single = 0,
657 $objDefinition = $this->obj_definition;
661 isset($this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block]) &&
662 is_array($this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block]) &&
665 return $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block];
668 $objects = $this->getInitialSubitems();
669 $objects = $this->applyContainerUserFilter($objects, $container_user_filter);
670 $objects = self::getCompleteDescriptions($objects);
675 $id = get_class($class_provider);
678 $class_provider->setSelection($current);
679 $filtered = $class_provider->getFilteredObjects();
680 $objects = array_filter($objects,
static function (array $i) use ($filtered):
bool {
681 return (is_array($filtered) && in_array($i[
"obj_id"], $filtered));
690 if (!self::$data_preloaded) {
699 $classification_filter_active = $this->isClassificationFilterActive();
700 foreach ($objects as $key => $object) {
702 if (!self::$data_preloaded) {
703 if ($object[
"type"] ===
"sess") {
705 foreach ($ev_items as $ev_item) {
706 $preloader->addItem((
int) $ev_item[
"obj_id"], $ev_item[
"type"], $ev_item[
"ref_id"]);
710 if ($a_get_single > 0 && $object[
"child"] != $a_get_single) {
715 if ($object[
"type"] ===
"adm" || $object[
"type"] ===
"rolf" || $objDefinition->getDevMode($object[
"type"])) {
720 if ($objDefinition->isInactivePlugin($object[
"type"])) {
726 [
'file',
'fold',
'cat'],
729 $this->setHiddenFilesFound(
true);
730 if (!$a_admin_panel_enabled) {
736 if (!self::$data_preloaded) {
737 $preloader->addItem((
int) $object[
"obj_id"], $object[
"type"], $object[
"child"]);
741 if (!$a_include_side_block && $objDefinition->isSideBlock($object[
'type'])) {
745 $all_ref_ids[] = (
int) $object[
"child"];
749 if (!self::$data_preloaded) {
750 $preloader->preload();
753 self::$data_preloaded =
true;
756 foreach ($objects as $key => $object) {
758 if (!in_array($object[
"child"], $all_ref_ids)) {
763 $type = $objDefinition->getGroupOfObj($object[
"type"]);
765 $type = $object[
"type"];
769 $this->addAdditionalSubItemInformation($object);
771 $this->items[$type][$key] = $object;
773 $this->items[
"_all"][$key] = $object;
774 if ($object[
"type"] !==
"sess") {
775 $this->items[
"_non_sess"][$key] = $object;
778 $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block]
779 = $sort->sortItems($this->items);
781 return $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block];
789 if (isset($this->items[
"_all"]) && is_array($this->items[
"_all"]) && count($this->items[
"_all"]) > 0) {
806 $objDefinition = $this->obj_definition;
808 if (empty($this->type_grps)) {
809 $this->type_grps = $objDefinition::getGroupedRepositoryObjectTypes($this->getType());
811 return $this->type_grps;
819 if (
$ilSetting->get(
"enable_cat_page_edit")) {
831 $ret = parent::create();
834 $this->obj_trans = $this->getObjectProperties()->getPropertyTranslations();
837 $this->addTranslation(
839 $this->getLongDescription(),
840 $lng->getDefaultLanguage(),
844 if (($this->getStyleSheetId()) > 0) {
849 $log->debug(
"Create Container, id: " . $this->
getId());
851 self::_writeContainerSetting($this->
getId(),
"news_timeline", (
string) ((
int) $this->getNewsTimeline()));
852 self::_writeContainerSetting($this->
getId(),
"news_timeline_incl_auto", (
string) ((
int) $this->getNewsTimelineAutoEntries()));
853 self::_writeContainerSetting($this->
getId(),
"news_timeline_landing_page", (
string) ((
int) $this->getNewsTimelineLandingPage()));
862 parent::putInTree($parent_ref_id);
865 if (self::_lookupContainerSetting(
ilObject::_lookupObjId($parent_ref_id),
"hide_header_icon_and_title")) {
866 self::_writeContainerSetting($this->
getId(),
"hide_header_icon_and_title",
'1');
869 self::_writeContainerSetting($this->
getId(),
"hide_top_actions",
'1');
875 $ret = parent::update();
878 $log->debug(
"**5**" . count($this->getObjectProperties()->getPropertyTranslations()->getLanguages()));
880 $this->getObjectProperties()->storePropertyTranslations(
881 $this->getObjectProperties()->getPropertyTranslations()
882 ->withDefaultTitle($this->
getTitle())
883 ->withDefaultDescription($this->getLongDescription())
887 $log->debug(
":::::::::::::::::::::::::::");
893 $log->debug(
"Update Container, id: " . $this->
getId());
895 self::_writeContainerSetting($this->
getId(),
"news_timeline", (
string) ((
int) $this->getNewsTimeline()));
896 self::_writeContainerSetting($this->
getId(),
"news_timeline_incl_auto", (
string) (
int) $this->getNewsTimelineAutoEntries());
897 self::_writeContainerSetting($this->
getId(),
"news_timeline_landing_page", (
string) ((
int) ($this->getNewsTimelineLandingPage())));
912 $this->readContainerSettings();
913 $this->obj_trans = $this->getObjectProperties()->getPropertyTranslations();
918 $this->setNewsTimeline((
bool) self::_lookupContainerSetting($this->
getId(),
"news_timeline"));
919 $this->setNewsTimelineAutoEntries((
bool) self::_lookupContainerSetting($this->
getId(),
"news_timeline_incl_auto"));
920 $this->setNewsTimelineLandingPage((
bool) self::_lookupContainerSetting($this->
getId(),
"news_timeline_landing_page"));
921 $this->setNewsBlockActivated((
bool) self::_lookupContainerSetting(
924 $this->setting->get(
'block_activated_news',
'1')
927 $this->news->isGloballyActivated());
940 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
943 $short_desc =
$ilSetting->get(
"rep_shorten_description");
944 $short_desc_max_length =
$ilSetting->get(
"rep_shorten_description_length");
948 foreach ($objects as $key => $object) {
950 $object[
"description"],
951 (
int) $short_desc_max_length,
959 foreach ($objects as $key => $object) {
960 $obj_ids[] = $object[
"obj_id"];
962 if (count($obj_ids)) {
964 foreach ($objects as $key => $object) {
966 if ($ilObjDataCache->isTranslatedDescription((
int) $object[
"obj_id"])) {
967 $long_desc[$object[
"obj_id"]] = $object[
"description"];
969 if ($short_desc && $short_desc_max_length) {
971 $long_desc[$object[
"obj_id"]] ??
'',
972 (
int) $short_desc_max_length,
976 $objects[$key][
"description"] = $long_desc[$object[
"obj_id"]] ??
'';
984 protected static function fixInternalLinksAfterCopy(
992 $obj_definition =
$DIC[
"objDefinition"];
996 $mapping = $cwo->getMappings();
1000 $pg->handleRepositoryLinksOnCopy($mapping, $a_source_ref_id);
1001 $pg->update(
true,
true);
1005 $pg->handleRepositoryLinksOnCopy($mapping, $a_source_ref_id);
1006 $pg->update(
true,
true);
1011 foreach ($mapping as $old_ref_id => $new_ref_id) {
1012 if (!is_numeric($old_ref_id) || !is_numeric($new_ref_id)) {
1017 $class =
'il' . $obj_definition->
getClassName($type) .
'PageCollector';
1019 $file = $loc .
'/class.' . $class .
'.php';
1021 if (is_file($file)) {
1023 $coll =
new $class();
1028 $page->handleRepositoryLinksOnCopy($mapping, $a_source_ref_id);
1029 $page->update(
true,
true);
1039 $this->getObjectProperties()->deletePropertyTranslations();
1044 $this->obj_trans = $this->obj_trans->withoutLanguage($a_lang);
1045 $this->getObjectProperties()->storePropertyTranslations($this->obj_trans);
1052 string $a_lang_default
1054 if (empty($a_title)) {
1055 $a_title =
"NO TITLE";
1058 $this->obj_trans = $this->obj_trans->withLanguage(
1063 (
bool) $a_lang_default
1066 $this->getObjectProperties()->storePropertyTranslations($this->obj_trans);
1073 $filter = $this->domain->content()->
filter(
1075 $container_user_filter,
1076 !self::_lookupContainerSetting($this->
getId(),
"filter_show_empty", false)
1078 return $filter->apply();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class handles translation mode for an object.
static cloneSettingsOfBlock(string $block_type, int $block_id, int $new_block_id)
static getValidProviders(int $a_parent_ref_id, int $a_parent_obj_id, string $a_parent_obj_type)
Get all valid providers (for parent container)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupSortMode(int $a_obj_id)
static _cloneSettings(int $a_old_id, int $a_new_id)
static _getInstance(int $a_obj_id)
Container start objects page object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Style Content DomainService $content_style_domain
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)
isClassificationFilterActive()
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
const SORT_DIRECTION_DESC
ilObjectDefinition $obj_definition
ilRecommendedContentManager $recommended_content_manager
static getCompleteDescriptions(array $objects)
overwrites description fields to long or short description in an assoc array keys needed (obj_id and ...
deleteTranslation(string $a_lang)
getNewsTimelineLandingPage()
cloneDependencies(int $target_id, int $copy_id)
Clone object dependencies (container sorting)
create()
note: title, description and type should be set when this function is called
setNewsTimelineAutoEntries(bool $a_val)
const SORT_NEW_ITEMS_ORDER_ACTIVATION
createContainerDirectory()
bool $news_timeline_auto_entries
setOrderType(int $a_value)
setStyleSheetId(int $a_style_id)
setObjectTranslation(?Translations $obj_trans)
addTranslation(string $a_title, string $a_desc, string $a_lang, string $a_lang_default)
setNewsBlockActivated(bool $a_val)
static _getContainerSettings(int $a_id)
filteredSubtree()
Note grp/crs currently allow to filter in their whole subtrees Catetories only their direct childs.
const SORT_NEW_ITEMS_ORDER_TITLE
const SORT_NEW_ITEMS_ORDER_CREATION
setNewsTimelineLandingPage(bool $a_val)
addAdditionalSubItemInformation(array &$object)
Add additional information to sub item, e.g.
getSubItems(bool $a_admin_panel_enabled=false, bool $a_include_side_block=false, int $a_get_single=0, ?ilContainerUserFilter $container_user_filter=null)
putInTree(int $parent_ref_id)
maybe this method should be in tree object!?
setHiddenFilesFound(bool $a_hiddenfilesfound)
static _hasContainerSetting(int $a_id, string $a_keyword)
bool $news_timeline_landing_page
const SORT_NEW_ITEMS_POSITION_BOTTOM
ILIAS Container InternalDomainService $domain
static _getContainerDirectory(int $a_id)
setNewsTimeline(bool $a_val)
const SORT_NEW_ITEMS_POSITION_TOP
getNewsTimelineAutoEntries()
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static _deleteContainerSettings(int $a_id, string $a_keyword="", bool $a_keyword_like=false)
static bool $data_preloaded
isNewsTimelineEffective()
isNewsTimelineLandingPageEffective()
static _exportContainerSettings(ilXmlWriter $a_xml, int $a_obj_id)
applyContainerUserFilter(array $objects, ?ilContainerUserFilter $container_user_filter=null)
bool $news_block_activated
static _allocateCopyId()
Allocate a copy for further entries.
static _getInstance(int $a_copy_id)
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
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...
static getLogger(string $a_component_id)
Get component logger.
Membership notification settings.
static _isFileHidden(string $a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user.
static fixContainerItemGroupRefsAfterCloning(ilContainer $a_source_container, int $a_copy_id)
static getItemsByEvent(int $event_id)
Get session material / event items.
const SUBMODE_CONTENT_ONLY
parses the objects.xml it handles the xml-description of all ilias objects
getLocation(string $obj_name)
getClassName(string $obj_name)
static getInstance(int $obj_id)
Preloader for object list GUIs.
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
static getLongDescriptions(array $obj_ids)
static _lookupObjId(int $ref_id)
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _duplicate(string $a_session_id)
Duplicate session.
static ilClone(string $sid, int $copy_identifier)
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlEndTag(string $tag)
Writes an endtag.
xmlData(string $data, bool $encode=true, bool $escape=true)
Writes data.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
filter(string $filter_id, array $class_path, string $cmd, bool $activated=true, bool $expanded=true)
if(!file_exists('../ilias.ini.php'))