27require_once
"./Services/Object/classes/class.ilObject.php";
86 $this->setting =
$DIC[
"ilSetting"];
87 parent::__construct($a_id, $a_reference);
100 $cont_dir = $webspace_dir.
"/container_data";
101 if (!is_dir($cont_dir))
105 $obj_dir = $cont_dir.
"/obj_".$this->
getId();
106 if (!is_dir($obj_dir))
183 $this->hiddenfilesfound = $a_hiddenfilesfound;
201 return $this->style_id;
209 $this->style_id = $a_style_id;
219 $this->news_timeline = $a_val;
239 $this->news_timeline_auto_entries = $a_val;
259 $this->news_timeline_landing_page = $a_val;
269 return $this->news_timeline_landing_page;
317 $this->news_block_activated = $a_val;
327 return $this->news_block_activated;
337 $this->use_news = $a_val;
347 return $this->use_news;
362 $q =
"SELECT * FROM container_settings WHERE ".
363 " id = ".$ilDB->quote($a_id ,
'integer').
" AND ".
364 " keyword = ".$ilDB->quote($a_keyword ,
'text');
365 $set =
$ilDB->query($q);
368 if(isset($rec[
'value']))
370 return $rec[
"value"];
372 if($a_default_value === NULL)
376 return $a_default_value;
388 $query =
"DELETE FROM container_settings WHERE ".
389 "id = ".$ilDB->quote($a_id,
'integer').
" ".
390 "AND keyword = ".$ilDB->quote($a_keyword,
'text');
394 $log->debug(
"Write container setting, id: ".$a_id.
", keyword: ".$a_keyword.
", value: ".$a_value);
396 $query =
"INSERT INTO container_settings (id, keyword, value) VALUES (".
397 $ilDB->quote($a_id ,
'integer').
", ".
398 $ilDB->quote($a_keyword ,
'text').
", ".
399 $ilDB->quote($a_value ,
'text').
411 $sql =
"SELECT * FROM container_settings WHERE ".
412 " id = ".$ilDB->quote($a_id ,
'integer');
413 $set =
$ilDB->query($sql);
431 $sql =
"DELETE FROM container_settings WHERE ".
432 " id = ".$ilDB->quote($a_id ,
'integer');
437 $sql .=
" AND keyword = ".$ilDB->quote($a_keyword,
"text");
441 $sql .=
" AND ".$ilDB->like(
"keyword",
"text", $a_keyword);
444 $ilDB->manipulate($sql);
451 if(
sizeof($settings))
455 foreach($settings as $keyword => $value)
458 if(stristr($keyword,
"icon"))
496 $file_name = $cont_dir.
"/icon_custom.svg";
497 if (is_file($file_name))
517 if ($a_custom_icon !=
"")
519 $file_name = $cont_dir.
"/icon_custom.svg";
522 if ($file_name !=
"" && is_file($file_name))
539 $small_file_name = $cont_dir.
"/icon_custom.svg";
540 @unlink($small_file_name);
552 public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree =
false)
556 $new_obj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
558 include_once(
'./Services/Container/classes/class.ilContainerSortingSettings.php');
559 #18624 - copy all sorting settings
563 include_once(
"./Services/Container/classes/class.ilContainerPage.php");
568 $orig_page->copy($new_obj->getId(),
"cont", $new_obj->getId());
572 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
579 $new_id = $style_obj->ilClone();
580 $new_obj->setStyleSheetId($new_id);
590 include_once(
"./Services/Container/classes/class.ilContainerStartObjectsPage.php");
595 $orig_page->copy($new_obj->getId(),
"cstr", $new_obj->getId());
599 foreach(self::_getContainerSettings($this->
getId()) as $keyword => $value)
604 if($keyword ==
"icon_custom" &&
608 $new_obj->createContainerDirectory();
609 $tgt_dir = $new_obj->getContainerDirectory();
611 $file =
"icon_custom.svg";
612 $src_file = $src_dir.
"/".
$file;
613 if(file_exists($src_file))
615 copy($src_file, $tgt_dir.
"/".
$file);
635 parent::cloneDependencies($a_target_id, $a_copy_id);
637 include_once(
'./Services/Container/classes/class.ilContainerSorting.php');
644 include_once(
"./Modules/ItemGroup/classes/class.ilObjItemGroup.php");
647 include_once(
'Services/Object/classes/class.ilObjectLP.php');
649 $collection = $olp->getCollectionInstance();
652 $collection->cloneCollection($a_target_id, $a_copy_id);
676 include_once(
'./Services/Link/classes/class.ilLink.php');
677 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
684 $wizard_options->saveOwner(
$ilUser->getId());
685 $wizard_options->saveRoot($clone_source);
688 $wizard_options->initContainer($clone_source,
$ref_id);
690 foreach(
$options as $source_id => $option)
692 $wizard_options->addEntry($source_id,$option);
694 $wizard_options->read();
695 $wizard_options->storeTree($clone_source);
697 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
702 $wizard_options->read();
703 $wizard_options->dropFirstNode();
704 $wizard_options->appendMapping($clone_source,
$ref_id);
712 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
715 $soap_client->setResponseTimeout(5);
716 $soap_client->enableWSDL(
true);
718 $ilLog->write(__METHOD__.
': Trying to call Soap client...');
719 if($soap_client->init())
722 $res = $soap_client->call(
'ilClone',array($new_session_id.
'::'.
$client_id, $copy_id));
727 $wizard_options->disableSOAP();
728 $wizard_options->read();
729 include_once(
'./webservice/soap/include/inc.soap_functions.php');
733 'copy_id' => $copy_id,
734 'ref_id' => (
int)
$res
756 $this->order_type = $a_value;
767 public function getSubItems($a_admin_panel_enabled =
false, $a_include_side_block =
false, $a_get_single = 0)
769 global $objDefinition,
$ilBench, $tree, $ilObjDataCache,
$ilUser, $rbacsystem,
773 if (is_array($this->items[(
int) $a_admin_panel_enabled][(
int) $a_include_side_block]) &&
776 return $this->items[(int) $a_admin_panel_enabled][(
int) $a_include_side_block];
780 $objects = $tree->getChilds($this->
getRefId(),
"title");
785 $all_ref_ids = array();
787 if(!self::$data_preloaded)
789 include_once(
"./Services/Object/classes/class.ilObjectListGUIPreloader.php");
793 include_once(
'Services/Container/classes/class.ilContainerSorting.php');
798 include_once
'./Modules/Session/classes/class.ilEventItems.php';
801 foreach ($objects as $key => $object)
803 if ($a_get_single > 0 && $object[
"child"] != $a_get_single)
809 if ($objDefinition->getDevMode($object[
"type"]) || $object[
"type"] ==
"adm"
810 || $object[
"type"] ==
"rolf")
816 if ($objDefinition->isInactivePlugin($object[
"type"]))
822 if (in_array($object[
'type'], array(
'file',
'fold',
'cat')))
824 include_once
'Modules/File/classes/class.ilObjFileAccess.php';
828 if (!$a_admin_panel_enabled)
837 if (!self::$data_preloaded)
839 $preloader->addItem($object[
"obj_id"], $object[
"type"], $object[
"child"]);
843 if (in_array($object[
'ref_id'],$event_items))
849 if(!$a_include_side_block && $objDefinition->isSideBlock($object[
'type']))
854 $all_ref_ids[] = $object[
"child"];
858 if (!self::$data_preloaded)
860 $preloader->preload();
863 self::$data_preloaded =
true;
866 foreach($objects as $key => $object)
869 if(!in_array($object[
"child"], $all_ref_ids))
875 $type = $objDefinition->getGroupOfObj($object[
"type"]);
878 $type = $object[
"type"];
884 $this->items[
$type][$key] = $object;
886 $this->items[
"_all"][$key] = $object;
887 if ($object[
"type"] !=
"sess")
889 $this->items[
"_non_sess"][$key] = $object;
893 $this->items[(int) $a_admin_panel_enabled][(
int) $a_include_side_block]
894 = $sort->sortItems($this->items);
896 return $this->items[(int) $a_admin_panel_enabled][(
int) $a_include_side_block];
904 if (is_array($this->items[
"_all"]) && count($this->items[
"_all"]) > 0)
926 global $objDefinition;
928 if (empty($this->type_grps))
930 $this->type_grps = $objDefinition->getGroupedRepositoryObjectTypes($this->
getType());
932 return $this->type_grps;
954 $ret = parent::create();
958 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
963 $log->debug(
"Create Container, id: ".$this->
getId());
968 include_once(
"./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
980 $ret = parent::update();
982 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
986 $log->debug(
"Update Container, id: ".$this->
getId());
991 include_once(
"./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
1010 include_once(
"./Services/Container/classes/class.ilContainerSortingSettings.php");
1013 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1030 include_once(
"./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
1032 $this->setting->get(
'block_activated_news',
true)));
1048 $short_desc =
$ilSetting->get(
"rep_shorten_description");
1049 $short_desc_max_length =
$ilSetting->get(
"rep_shorten_description_length");
1055 foreach($objects as $key => $object)
1057 $objects[$key][
"description"] =
ilUtil::shortenText($object[
"description"], $short_desc_max_length,
true);
1064 foreach($objects as $key => $object)
1066 $obj_ids[] = $object[
"obj_id"];
1068 if(
sizeof($obj_ids))
1071 foreach($objects as $key => $object)
1074 if($ilObjDataCache->isTranslatedDescription($object[
"obj_id"]))
1076 $long_desc[$object[
"obj_id"]] = $object[
"description"];
1078 if($short_desc && $short_desc_max_length)
1082 $objects[$key][
"description"] =
$long_desc[$object[
"obj_id"]];
1099 include_once(
"./Services/Container/classes/class.ilContainerPage.php");
1102 include_once(
"./Services/CopyWizard/classes/class.ilCopyWizardOptions.php");
1104 $mapping = $cwo->getMappings();
1106 $pg->handleRepositoryLinksOnCopy($mapping, $a_source_ref_id);
1107 $pg->update(
true,
true);
An exception for terminatinating execution or to throw for unit testing.
static _cloneSettings($a_old_id, $a_new_id)
Clone settings.
static _lookupSortMode($a_obj_id)
lookup sort mode
static _getInstance($a_obj_id)
get instance by obj_id
Container start objects page object.
setNewsTimeline($a_val)
Set news timeline.
const SORT_DIRECTION_DESC
saveIcons($a_custom_icon)
save container icons
setNewsTimelineLandingPage($a_val)
Set news timline is landing page.
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies (container sorting)
getGroupedObjTypes()
Get grouped repository object types.
cloneAllObject($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call=false, $a_submode=1)
clone all objects according to this container
getSubItems($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
Get subitems of container.
getNewsTimeline()
Get news timeline.
getStyleSheetId()
get ID of assigned style sheet object
static _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
static getCompleteDescriptions(array $objects)
overwrites description fields to long or short description in an assoc array keys needed (obj_id and ...
getNewsTimelineLandingPage()
Get news timline is landing page.
static _deleteContainerSettings($a_id, $a_keyword=null, $a_keyword_like=false)
const SORT_NEW_ITEMS_ORDER_ACTIVATION
getBigIconPath()
Get path for big icon.
$news_timeline_auto_entries
getContainerDirectory()
Get the container directory.
getCustomIconPath()
Get path for custom icon.
createContainerDirectory()
Create directory for the container.
setHiddenFilesFound($a_hiddenfilesfound)
Set Found hidden files (set by getSubItems).
addAdditionalSubItemInformation(&$object)
Add additional information to sub item, e.g.
static _getContainerSettings($a_id)
const SORT_NEW_ITEMS_ORDER_TITLE
getHiddenFilesFound()
Get Found hidden files (set by getSubItems).
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
const SORT_NEW_ITEMS_ORDER_CREATION
static _getContainerDirectory($a_id)
Get the container directory.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
static _lookupIconPath($a_id, $a_size="big")
lookup icon path
getSmallIconPath()
Get path for small icon.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
const SORT_NEW_ITEMS_POSITION_BOTTOM
static fixInternalLinksAfterCopy($a_target_id, $a_copy_id, $a_source_ref_id)
Fix internal links after copy process.
__construct($a_id=0, $a_reference=true)
Constructor @access public.
setNewsBlockActivated($a_val)
Set news block activated.
removeCustomIcon()
remove small icon
setUseNews($a_val)
Set use news.
getOrderType()
Get order type default implementation.
setNewsTimelineAutoEntries($a_val)
Set news timeline auto entries.
const SORT_NEW_ITEMS_POSITION_TOP
getNewsBlockActivated()
Get news block activated.
gotItems()
Check whether we got any items.
getNewsTimelineAutoEntries()
Get news timeline auto entries.
getViewMode()
Get container view mode.
enablePageEditing()
Check whether page editing is allowed for container.
getUseNews()
Get use news.
isNewsTimelineEffective()
Is news timeline effective?
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone container settings.
isNewsTimelineLandingPageEffective()
Is news timeline landing page effective?
readContainerSettings()
Read container settings.
getTinyIconPath()
Get path for tiny icon.
static _allocateCopyId()
Allocate a copy for further entries.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _getItemsOfContainer($a_ref_id)
static getLogger($a_component_id)
Get component logger.
static _isFileHidden($a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user.
static fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
Fix container item group references after a container has been cloned.
static _lookupStandard($a_id)
Lookup standard flag.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
const SUBMODE_CONTENT_ONLY
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstance($a_obj_id)
Preloader for object list GUIs.
Class ilObject Basic functions for all objects.
getType()
get object type @access public
static _lookupObjId($a_id)
getRefId()
get reference id @access public
getId()
get object id @access public
static getLongDescriptions(array $a_obj_ids)
Get long description data.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static _duplicate($a_session_id)
Duplicate session.
static ilClone($sid, $copy_identifier)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getWebspaceDir($mode="filesystem")
get webspace directory
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
xmlEndTag($tag)
Writes an endtag.
xmlData($data, $encode=TRUE, $escape=TRUE)
Writes data.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
if(!is_array($argv)) $options