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();
592 return self::VIEW_BY_TYPE;
597 return $this->order_type ?: self::SORT_TITLE;
602 $this->order_type = $a_value;
610 $id = get_class($class_provider);
625 if ($this->isClassificationFilterActive() && in_array($this->getType(), [
"grp",
"crs"])) {
637 if ($this->filteredSubtree()) {
638 $objects = $tree->getSubTree($tree->getNodeData($this->getRefId()));
640 $objects = $tree->getChilds($this->getRefId(),
"title");
649 bool $a_admin_panel_enabled =
false,
650 bool $a_include_side_block =
false,
651 int $a_get_single = 0,
654 $objDefinition = $this->obj_definition;
658 isset($this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block]) &&
659 is_array($this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block]) &&
662 return $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block];
665 $objects = $this->getInitialSubitems();
666 $objects = $this->applyContainerUserFilter($objects, $container_user_filter);
667 $objects = self::getCompleteDescriptions($objects);
672 $id = get_class($class_provider);
675 $class_provider->setSelection($current);
676 $filtered = $class_provider->getFilteredObjects();
677 $objects = array_filter($objects,
static function (array $i) use ($filtered):
bool {
678 return (is_array($filtered) && in_array($i[
"obj_id"], $filtered));
687 if (!self::$data_preloaded) {
696 $classification_filter_active = $this->isClassificationFilterActive();
697 foreach ($objects as $key => $object) {
699 if (!self::$data_preloaded) {
700 if ($object[
"type"] ===
"sess") {
702 foreach ($ev_items as $ev_item) {
703 $preloader->addItem((
int) $ev_item[
"obj_id"], $ev_item[
"type"], $ev_item[
"ref_id"]);
707 if ($a_get_single > 0 && $object[
"child"] != $a_get_single) {
712 if ($object[
"type"] ===
"adm" || $object[
"type"] ===
"rolf" || $objDefinition->getDevMode($object[
"type"])) {
717 if ($objDefinition->isInactivePlugin($object[
"type"])) {
723 [
'file',
'fold',
'cat'],
726 $this->setHiddenFilesFound(
true);
727 if (!$a_admin_panel_enabled) {
733 if (!self::$data_preloaded) {
734 $preloader->addItem((
int) $object[
"obj_id"], $object[
"type"], $object[
"child"]);
738 if (!$a_include_side_block && $objDefinition->isSideBlock($object[
'type'])) {
742 $all_ref_ids[] = (
int) $object[
"child"];
746 if (!self::$data_preloaded) {
747 $preloader->preload();
750 self::$data_preloaded =
true;
753 foreach ($objects as $key => $object) {
755 if (!in_array($object[
"child"], $all_ref_ids)) {
760 $type = $objDefinition->getGroupOfObj($object[
"type"]);
762 $type = $object[
"type"];
766 $this->addAdditionalSubItemInformation($object);
768 $this->items[$type][$key] = $object;
770 $this->items[
"_all"][$key] = $object;
771 if ($object[
"type"] !==
"sess") {
772 $this->items[
"_non_sess"][$key] = $object;
775 $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block]
776 = $sort->sortItems($this->items);
778 return $this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block];
786 if (isset($this->items[
"_all"]) && is_array($this->items[
"_all"]) && count($this->items[
"_all"]) > 0) {
803 $objDefinition = $this->obj_definition;
805 if (empty($this->type_grps)) {
806 $this->type_grps = $objDefinition::getGroupedRepositoryObjectTypes($this->getType());
808 return $this->type_grps;
816 if (
$ilSetting->get(
"enable_cat_page_edit")) {
828 $ret = parent::create();
831 $this->obj_trans = $this->getObjectProperties()->getPropertyTranslations();
834 $this->addTranslation(
836 $this->getLongDescription(),
837 $lng->getDefaultLanguage(),
841 if (($this->getStyleSheetId()) > 0) {
846 $log->debug(
"Create Container, id: " . $this->
getId());
848 self::_writeContainerSetting($this->
getId(),
"news_timeline", (
string) ((
int) $this->getNewsTimeline()));
849 self::_writeContainerSetting($this->
getId(),
"news_timeline_incl_auto", (
string) ((
int) $this->getNewsTimelineAutoEntries()));
850 self::_writeContainerSetting($this->
getId(),
"news_timeline_landing_page", (
string) ((
int) $this->getNewsTimelineLandingPage()));
859 parent::putInTree($parent_ref_id);
862 if (self::_lookupContainerSetting(
ilObject::_lookupObjId($parent_ref_id),
"hide_header_icon_and_title")) {
863 self::_writeContainerSetting($this->
getId(),
"hide_header_icon_and_title",
'1');
866 self::_writeContainerSetting($this->
getId(),
"hide_top_actions",
'1');
872 $ret = parent::update();
875 $log->debug(
"**5**" . count($this->getObjectProperties()->getPropertyTranslations()->getLanguages()));
877 $this->getObjectProperties()->storePropertyTranslations(
878 $this->getObjectProperties()->getPropertyTranslations()
879 ->withDefaultTitle($this->
getTitle())
880 ->withDefaultDescription($this->getLongDescription())
884 $log->debug(
":::::::::::::::::::::::::::");
890 $log->debug(
"Update Container, id: " . $this->
getId());
892 self::_writeContainerSetting($this->
getId(),
"news_timeline", (
string) ((
int) $this->getNewsTimeline()));
893 self::_writeContainerSetting($this->
getId(),
"news_timeline_incl_auto", (
string) (
int) $this->getNewsTimelineAutoEntries());
894 self::_writeContainerSetting($this->
getId(),
"news_timeline_landing_page", (
string) ((
int) ($this->getNewsTimelineLandingPage())));
909 $this->readContainerSettings();
910 $this->obj_trans = $this->getObjectProperties()->getPropertyTranslations();
915 $this->setNewsTimeline((
bool) self::_lookupContainerSetting($this->
getId(),
"news_timeline"));
916 $this->setNewsTimelineAutoEntries((
bool) self::_lookupContainerSetting($this->
getId(),
"news_timeline_incl_auto"));
917 $this->setNewsTimelineLandingPage((
bool) self::_lookupContainerSetting($this->
getId(),
"news_timeline_landing_page"));
918 $this->setNewsBlockActivated((
bool) self::_lookupContainerSetting(
921 $this->setting->get(
'block_activated_news',
'1')
924 $this->news->isGloballyActivated());
937 $ilObjDataCache =
$DIC[
"ilObjDataCache"];
940 $short_desc =
$ilSetting->get(
"rep_shorten_description");
941 $short_desc_max_length =
$ilSetting->get(
"rep_shorten_description_length");
945 foreach ($objects as $key => $object) {
947 $object[
"description"],
948 (
int) $short_desc_max_length,
956 foreach ($objects as $key => $object) {
957 $obj_ids[] = $object[
"obj_id"];
959 if (count($obj_ids)) {
961 foreach ($objects as $key => $object) {
963 if ($ilObjDataCache->isTranslatedDescription((
int) $object[
"obj_id"])) {
964 $long_desc[$object[
"obj_id"]] = $object[
"description"];
966 if ($short_desc && $short_desc_max_length) {
968 $long_desc[$object[
"obj_id"]] ??
'',
969 (
int) $short_desc_max_length,
973 $objects[$key][
"description"] = $long_desc[$object[
"obj_id"]] ??
'';
981 protected static function fixInternalLinksAfterCopy(
989 $obj_definition =
$DIC[
"objDefinition"];
993 $mapping = $cwo->getMappings();
997 $pg->handleRepositoryLinksOnCopy($mapping, $a_source_ref_id);
998 $pg->update(
true,
true);
1001 foreach ($mapping as $old_ref_id => $new_ref_id) {
1002 if (!is_numeric($old_ref_id) || !is_numeric($new_ref_id)) {
1007 $class =
'il' . $obj_definition->
getClassName($type) .
'PageCollector';
1009 $file = $loc .
'/class.' . $class .
'.php';
1011 if (is_file($file)) {
1013 $coll =
new $class();
1018 $page->handleRepositoryLinksOnCopy($mapping, $a_source_ref_id);
1019 $page->update(
true,
true);
1029 $this->getObjectProperties()->deletePropertyTranslations();
1034 $this->obj_trans = $this->obj_trans->withoutLanguage($a_lang);
1035 $this->getObjectProperties()->storePropertyTranslations($this->obj_trans);
1042 string $a_lang_default
1044 if (empty($a_title)) {
1045 $a_title =
"NO TITLE";
1048 $this->obj_trans = $this->obj_trans->withLanguage(
1053 (
bool) $a_lang_default
1056 $this->getObjectProperties()->storePropertyTranslations($this->obj_trans);
1063 $filter = $this->domain->content()->
filter(
1065 $container_user_filter,
1066 !self::_lookupContainerSetting($this->
getId(),
"filter_show_empty", false)
1068 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="-")
Get page object instance.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
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, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
if(!file_exists('../ilias.ini.php'))