ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilContainer.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 // note: the values are derived from ilObjCourse constants
25 // to enable easy migration from course view setting to container view setting
26 
27 require_once "./Services/Object/classes/class.ilObject.php";
28 
39 class ilContainer extends ilObject
40 {
41  protected $order_type = 0;
42  protected $hiddenfilesfound = false;
43  protected $news_timeline = false;
44  protected $news_timeline_auto_entries = false;
45 
46  // container view constants
47  const VIEW_SESSIONS = 0;
48  const VIEW_OBJECTIVE = 1;
49  const VIEW_TIMING = 2;
50  const VIEW_ARCHIVE = 3;
51  const VIEW_SIMPLE = 4;
52  const VIEW_BY_TYPE = 5;
53  const VIEW_INHERIT = 6;
54 
55  const VIEW_DEFAULT = self::VIEW_BY_TYPE;
56 
57 
58  const SORT_TITLE = 0;
59  const SORT_MANUAL = 1;
60  const SORT_ACTIVATION = 2;
61  const SORT_INHERIT = 3;
62  const SORT_CREATION = 4;
63 
64  const SORT_DIRECTION_ASC = 0;
66 
69 
73 
74 
75  static $data_preloaded = false;
76 
80  protected $setting;
81 
82  function __construct($a_id = 0, $a_reference = true)
83  {
84  global $DIC;
85 
86  $this->setting = $DIC["ilSetting"];
87  parent::__construct($a_id, $a_reference);
88 
89  }
90 
96  {
97  global $DIC;
98 
99  $webspace_dir = ilUtil::getWebspaceDir();
100  $cont_dir = $webspace_dir."/container_data";
101  if (!is_dir($cont_dir))
102  {
103  ilUtil::makeDir($cont_dir);
104  }
105  $obj_dir = $cont_dir."/obj_".$this->getId();
106  if (!is_dir($obj_dir))
107  {
108  ilUtil::makeDir($obj_dir);
109  }
110  }
111 
118  {
119  return $this->_getContainerDirectory($this->getId());
120  }
121 
127  static function _getContainerDirectory($a_id)
128  {
129  return ilUtil::getWebspaceDir()."/container_data/obj_".$a_id;
130  }
131 
138  function getBigIconPath()
139  {
140  return self::_lookupIconPath($this->getId());
141  }
142 
149  function getSmallIconPath()
150  {
151  return self::_lookupIconPath($this->getId());
152  }
153 
160  function getTinyIconPath()
161  {
162  return self::_lookupIconPath($this->getId());
163  }
164 
170  function getCustomIconPath()
171  {
172  return self::_lookupIconPath($this->getId());
173  }
174 
175 
181  function setHiddenFilesFound($a_hiddenfilesfound)
182  {
183  $this->hiddenfilesfound = $a_hiddenfilesfound;
184  }
185 
192  {
194  }
195 
199  function getStyleSheetId()
200  {
201  return $this->style_id;
202  }
203 
207  function setStyleSheetId($a_style_id)
208  {
209  $this->style_id = $a_style_id;
210  }
211 
217  function setNewsTimeline($a_val)
218  {
219  $this->news_timeline = $a_val;
220  }
221 
227  function getNewsTimeline()
228  {
229  return $this->news_timeline;
230  }
231 
237  function setNewsTimelineAutoEntries($a_val)
238  {
239  $this->news_timeline_auto_entries = $a_val;
240  }
241 
248  {
250  }
251 
257  function setNewsTimelineLandingPage($a_val)
258  {
259  $this->news_timeline_landing_page = $a_val;
260  }
261 
268  {
269  return $this->news_timeline_landing_page;
270  }
271 
277  public function isNewsTimelineEffective()
278  {
279  if ($this->getUseNews())
280  {
281  if ($this->getNewsTimeline())
282  {
283  return true;
284  }
285  }
286  return false;
287  }
288 
295  {
296  if ($this->getUseNews())
297  {
298  if ($this->getNewsTimeline())
299  {
300  if ($this->getNewsTimelineLandingPage())
301  {
302  return true;
303  }
304  }
305  }
306  return false;
307  }
308 
309 
315  function setNewsBlockActivated($a_val)
316  {
317  $this->news_block_activated = $a_val;
318  }
319 
326  {
327  return $this->news_block_activated;
328  }
329 
335  function setUseNews($a_val)
336  {
337  $this->use_news = $a_val;
338  }
339 
345  function getUseNews()
346  {
347  return $this->use_news;
348  }
349 
358  static function _lookupContainerSetting($a_id, $a_keyword, $a_default_value = NULL)
359  {
360  global $ilDB;
361 
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);
366  $rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
367 
368  if(isset($rec['value']))
369  {
370  return $rec["value"];
371  }
372  if($a_default_value === NULL)
373  {
374  return '';
375  }
376  return $a_default_value;
377  }
378 
384  public static function _writeContainerSetting($a_id, $a_keyword, $a_value)
385  {
386  global $ilDB;
387 
388  $query = "DELETE FROM container_settings WHERE ".
389  "id = ".$ilDB->quote($a_id,'integer')." ".
390  "AND keyword = ".$ilDB->quote($a_keyword,'text');
391  $res = $ilDB->manipulate($query);
392 
394  $log->debug("Write container setting, id: ".$a_id.", keyword: ".$a_keyword.", value: ".$a_value);
395 
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').
400  ")";
401 
402  $res = $ilDB->manipulate($query);
403  }
404 
405  public static function _getContainerSettings($a_id)
406  {
407  global $ilDB;
408 
409  $res = array();
410 
411  $sql = "SELECT * FROM container_settings WHERE ".
412  " id = ".$ilDB->quote($a_id ,'integer');
413  $set = $ilDB->query($sql);
414  while($row = $ilDB->fetchAssoc($set))
415  {
416  $res[$row["keyword"]] = $row["value"];
417  }
418 
419  return $res;
420  }
421 
422  public static function _deleteContainerSettings($a_id, $a_keyword = null, $a_keyword_like = false)
423  {
424  global $ilDB;
425 
426  if(!$a_id)
427  {
428  return;
429  }
430 
431  $sql = "DELETE FROM container_settings WHERE ".
432  " id = ".$ilDB->quote($a_id ,'integer');
433  if($a_keyword)
434  {
435  if(!$a_keyword_like)
436  {
437  $sql .= " AND keyword = ".$ilDB->quote($a_keyword, "text");
438  }
439  else
440  {
441  $sql .= " AND ".$ilDB->like("keyword", "text", $a_keyword);
442  }
443  }
444  $ilDB->manipulate($sql);
445  }
446 
447  public static function _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
448  {
449  // container settings
450  $settings = self::_getContainerSettings($a_obj_id);
451  if(sizeof($settings))
452  {
453  $a_xml->xmlStartTag("ContainerSettings");
454 
455  foreach($settings as $keyword => $value)
456  {
457  // :TODO: proper custom icon export/import
458  if(stristr($keyword, "icon"))
459  {
460  continue;
461  }
462 
463  $a_xml->xmlStartTag(
464  'ContainerSetting',
465  array(
466  'id' => $keyword,
467  )
468  );
469 
470  $a_xml->xmlData($value);
471  $a_xml->xmlEndTag("ContainerSetting");
472  }
473 
474  $a_xml->xmlEndTag("ContainerSettings");
475  }
476  }
477 
484  static function _lookupIconPath($a_id, $a_size = "big")
485  {
486  if ($a_size == "")
487  {
488  $a_size = "big";
489  }
490  $size = $a_size;
491 
492  if (ilContainer::_lookupContainerSetting($a_id, "icon_custom"))
493  {
494  $cont_dir = ilContainer::_getContainerDirectory($a_id);
495 
496  $file_name = $cont_dir."/icon_custom.svg";
497  if (is_file($file_name))
498  {
499  return $file_name;
500  }
501  }
502 
503  return "";
504  }
505 
509  function saveIcons($a_custom_icon)
510  {
511  global $ilDB;
512 
513  $this->createContainerDirectory();
514  $cont_dir = $this->getContainerDirectory();
515 
516  $file_name = "";
517  if ($a_custom_icon != "")
518  {
519  $file_name = $cont_dir."/icon_custom.svg";
520  ilUtil::moveUploadedFile($a_custom_icon, "icon_custom.svg", $file_name);
521 
522  if ($file_name != "" && is_file($file_name))
523  {
524  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 1);
525  }
526  else
527  {
528  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 0);
529  }
530  }
531  }
532 
536  function removeCustomIcon()
537  {
538  $cont_dir = $this->getContainerDirectory();
539  $small_file_name = $cont_dir."/icon_custom.svg";
540  @unlink($small_file_name);
541  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 0);
542  }
543 
552  public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree = false)
553  {
554  global $ilLog;
555 
556  $new_obj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
557 
558  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
559  #18624 - copy all sorting settings
560  ilContainerSortingSettings::_cloneSettings($this->getId(), $new_obj->getId());
561 
562  // copy content page
563  include_once("./Services/Container/classes/class.ilContainerPage.php");
564  if (ilContainerPage::_exists("cont",
565  $this->getId()))
566  {
567  $orig_page = new ilContainerPage($this->getId());
568  $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId());
569  }
570 
571  // #20614 - copy style
572  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
573  $style_id = $this->getStyleSheetId();
574  if ($style_id > 0)
575  {
576  if (!!ilObjStyleSheet::_lookupStandard($style_id))
577  {
578  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
579  $new_id = $style_obj->ilClone();
580  $new_obj->setStyleSheetId($new_id);
581  $new_obj->update();
582  }
583  else
584  {
585  $new_obj->setStyleSheetId($this->getStyleSheetId());
586  }
587  }
588 
589  // #10271 - copy start objects page
590  include_once("./Services/Container/classes/class.ilContainerStartObjectsPage.php");
592  $this->getId()))
593  {
594  $orig_page = new ilContainerStartObjectsPage($this->getId());
595  $orig_page->copy($new_obj->getId(), "cstr", $new_obj->getId());
596  }
597 
598  // #10271
599  foreach(self::_getContainerSettings($this->getId()) as $keyword => $value)
600  {
601  self::_writeContainerSetting($new_obj->getId(), $keyword, $value);
602 
603  // copy custom icons
604  if($keyword == "icon_custom" &&
605  $value)
606  {
607  // see saveIcons()
608  $new_obj->createContainerDirectory();
609  $tgt_dir = $new_obj->getContainerDirectory();
610  $src_dir = $this->getContainerDirectory();
611  $file = "icon_custom.svg";
612  $src_file = $src_dir."/".$file;
613  if(file_exists($src_file))
614  {
615  copy($src_file, $tgt_dir."/".$file);
616  }
617  }
618  }
619 
620  return $new_obj;
621  }
622 
631  public function cloneDependencies($a_target_id,$a_copy_id)
632  {
633  global $ilLog;
634 
635  parent::cloneDependencies($a_target_id, $a_copy_id);
636 
637  include_once('./Services/Container/classes/class.ilContainerSorting.php');
638  ilContainerSorting::_getInstance($this->getId())->cloneSorting($a_target_id,$a_copy_id);
639 
640  // fix internal links to other objects
641  ilContainer::fixInternalLinksAfterCopy($a_target_id,$a_copy_id, $this->getRefId());
642 
643  // fix item group references in page content
644  include_once("./Modules/ItemGroup/classes/class.ilObjItemGroup.php");
646 
647  include_once('Services/Object/classes/class.ilObjectLP.php');
648  $olp = ilObjectLP::getInstance($this->getId());
649  $collection = $olp->getCollectionInstance();
650  if($collection)
651  {
652  $collection->cloneCollection($a_target_id, $a_copy_id);
653  }
654 
655  return true;
656  }
657 
672  public function cloneAllObject($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call = false, $a_submode = 1)
673  {
674  global $ilLog;
675 
676  include_once('./Services/Link/classes/class.ilLink.php');
677  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
678 
679  global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser;
680 
681  // Save wizard options
683  $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
684  $wizard_options->saveOwner($ilUser->getId());
685  $wizard_options->saveRoot($clone_source);
686 
687  // add entry for source container
688  $wizard_options->initContainer($clone_source, $ref_id);
689 
690  foreach($options as $source_id => $option)
691  {
692  $wizard_options->addEntry($source_id,$option);
693  }
694  $wizard_options->read();
695  $wizard_options->storeTree($clone_source);
696 
697  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
698  if($a_submode == ilObjectCopyGUI::SUBMODE_CONTENT_ONLY)
699  {
700  ilLoggerFactory::getLogger('obj')->info('Copy content only...');
701  ilLoggerFactory::getLogger('obj')->debug('Added mapping, source ID: '.$clone_source.', target ID: '.$ref_id);
702  $wizard_options->read();
703  $wizard_options->dropFirstNode();
704  $wizard_options->appendMapping($clone_source,$ref_id);
705  }
706 
707 
708  #print_r($options);
709  // Duplicate session to avoid logout problems with backgrounded SOAP calls
710  $new_session_id = ilSession::_duplicate($session_id);
711  // Start cloning process using soap call
712  include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
713 
714  $soap_client = new ilSoapClient();
715  $soap_client->setResponseTimeout(5);
716  $soap_client->enableWSDL(true);
717 
718  $ilLog->write(__METHOD__.': Trying to call Soap client...');
719  if($soap_client->init())
720  {
721  ilLoggerFactory::getLogger('obj')->info('Calling soap clone method');
722  $res = $soap_client->call('ilClone',array($new_session_id.'::'.$client_id, $copy_id));
723  }
724  else
725  {
726  ilLoggerFactory::getLogger('obj')->warning('SOAP clone call failed. Calling clone method manually');
727  $wizard_options->disableSOAP();
728  $wizard_options->read();
729  include_once('./webservice/soap/include/inc.soap_functions.php');
730  $res = ilSoapFunctions::ilClone($new_session_id.'::'.$client_id, $copy_id);
731  }
732  return array(
733  'copy_id' => $copy_id,
734  'ref_id' => (int) $res
735  );
736  }
737 
741  function getViewMode()
742  {
744  }
745 
749  function getOrderType()
750  {
751  return $this->order_type ? $this->order_type : ilContainer::SORT_TITLE;
752  }
753 
754  function setOrderType($a_value)
755  {
756  $this->order_type = $a_value;
757  }
758 
767  public function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
768  {
769  global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem,
770  $ilSetting;
771 
772  // Caching
773  if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) &&
774  !$a_get_single)
775  {
776  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
777  }
778 
779  $type_grps = $this->getGroupedObjTypes();
780  $objects = $tree->getChilds($this->getRefId(), "title");
781 
782  $objects = self::getCompleteDescriptions($objects);
783 
784  $found = false;
785  $all_ref_ids = array();
786 
787  if(!self::$data_preloaded)
788  {
789  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
791  }
792 
793  include_once('Services/Container/classes/class.ilContainerSorting.php');
794  $sort = ilContainerSorting::_getInstance($this->getId());
795 
796  // TODO: check this
797  // get items attached to a session
798  include_once './Modules/Session/classes/class.ilEventItems.php';
799  $event_items = ilEventItems::_getItemsOfContainer($this->getRefId());
800 
801  foreach ($objects as $key => $object)
802  {
803  if ($a_get_single > 0 && $object["child"] != $a_get_single)
804  {
805  continue;
806  }
807 
808  // hide object types in devmode
809  if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm"
810  || $object["type"] == "rolf")
811  {
812  continue;
813  }
814 
815  // remove inactive plugins
816  if ($objDefinition->isInactivePlugin($object["type"]))
817  {
818  continue;
819  }
820 
821  // BEGIN WebDAV: Don't display hidden Files, Folders and Categories
822  if (in_array($object['type'], array('file','fold','cat')))
823  {
824  include_once 'Modules/File/classes/class.ilObjFileAccess.php';
825  if (ilObjFileAccess::_isFileHidden($object['title']))
826  {
827  $this->setHiddenFilesFound(true);
828  if (!$a_admin_panel_enabled)
829  {
830  continue;
831  }
832  }
833  }
834  // END WebDAV: Don't display hidden Files, Folders and Categories
835 
836  // including event items!
837  if (!self::$data_preloaded)
838  {
839  $preloader->addItem($object["obj_id"], $object["type"], $object["child"]);
840  }
841 
842  // filter out items that are attached to an event
843  if (in_array($object['ref_id'],$event_items))
844  {
845  continue;
846  }
847 
848  // filter side block items
849  if(!$a_include_side_block && $objDefinition->isSideBlock($object['type']))
850  {
851  continue;
852  }
853 
854  $all_ref_ids[] = $object["child"];
855  }
856 
857  // data preloader
858  if (!self::$data_preloaded)
859  {
860  $preloader->preload();
861  unset($preloader);
862 
863  self::$data_preloaded = true;
864  }
865 
866  foreach($objects as $key => $object)
867  {
868  // see above, objects were filtered
869  if(!in_array($object["child"], $all_ref_ids))
870  {
871  continue;
872  }
873 
874  // group object type groups together (e.g. learning resources)
875  $type = $objDefinition->getGroupOfObj($object["type"]);
876  if ($type == "")
877  {
878  $type = $object["type"];
879  }
880 
881  // this will add activation properties
882  $this->addAdditionalSubItemInformation($object);
883 
884  $this->items[$type][$key] = $object;
885 
886  $this->items["_all"][$key] = $object;
887  if ($object["type"] != "sess")
888  {
889  $this->items["_non_sess"][$key] = $object;
890  }
891  }
892 
893  $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]
894  = $sort->sortItems($this->items);
895 
896  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
897  }
898 
902  function gotItems()
903  {
904  if (is_array($this->items["_all"]) && count($this->items["_all"]) > 0)
905  {
906  return true;
907  }
908  return false;
909  }
910 
916  {
917  }
918 
925  {
926  global $objDefinition;
927 
928  if (empty($this->type_grps))
929  {
930  $this->type_grps = $objDefinition->getGroupedRepositoryObjectTypes($this->getType());
931  }
932  return $this->type_grps;
933  }
934 
938  function enablePageEditing()
939  {
940  global $ilSetting;
941 
942  // @todo: this will need a more general approach
943  if ($ilSetting->get("enable_cat_page_edit"))
944  {
945  return true;
946  }
947  }
948 
952  function create()
953  {
954  $ret = parent::create();
955 
956  if (((int) $this->getStyleSheetId()) > 0)
957  {
958  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
960  }
961 
963  $log->debug("Create Container, id: ".$this->getId());
964 
965  self::_writeContainerSetting($this->getId(), "news_timeline", (int) $this->getNewsTimeline());
966  self::_writeContainerSetting($this->getId(), "news_timeline_incl_auto", (int) $this->getNewsTimelineAutoEntries());
967  self::_writeContainerSetting($this->getId(), "news_timeline_landing_page", (int) $this->getNewsTimelineLandingPage());
968  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
969  self::_writeContainerSetting($this->getId() ,ilObjectServiceSettingsGUI::NEWS_VISIBILITY,(int) $this->getNewsBlockActivated());
970  self::_writeContainerSetting($this->getId() ,ilObjectServiceSettingsGUI::USE_NEWS,(int) $this->getUseNews());
971 
972  return $ret;
973  }
974 
978  function update()
979  {
980  $ret = parent::update();
981 
982  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
984 
986  $log->debug("Update Container, id: ".$this->getId());
987 
988  self::_writeContainerSetting($this->getId(), "news_timeline", (int) $this->getNewsTimeline());
989  self::_writeContainerSetting($this->getId(), "news_timeline_incl_auto", (int) $this->getNewsTimelineAutoEntries());
990  self::_writeContainerSetting($this->getId(), "news_timeline_landing_page", (int) $this->getNewsTimelineLandingPage());
991  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
992  self::_writeContainerSetting($this->getId() ,ilObjectServiceSettingsGUI::NEWS_VISIBILITY,(int) $this->getNewsBlockActivated());
993  self::_writeContainerSetting($this->getId() ,ilObjectServiceSettingsGUI::USE_NEWS,(int) $this->getUseNews());
994 
995  return $ret;
996  }
997 
998 
1006  public function read()
1007  {
1008  parent::read();
1009 
1010  include_once("./Services/Container/classes/class.ilContainerSortingSettings.php");
1012 
1013  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1015 
1016  $this->readContainerSettings();
1017  }
1018 
1026  {
1027  $this->setNewsTimeline(self::_lookupContainerSetting($this->getId(), "news_timeline"));
1028  $this->setNewsTimelineAutoEntries(self::_lookupContainerSetting($this->getId(), "news_timeline_incl_auto"));
1029  $this->setNewsTimelineLandingPage(self::_lookupContainerSetting($this->getId(), "news_timeline_landing_page"));
1030  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
1031  $this->setNewsBlockActivated(self::_lookupContainerSetting($this->getId(), ilObjectServiceSettingsGUI::NEWS_VISIBILITY,
1032  $this->setting->get('block_activated_news',true)));
1033  $this->setUseNews(self::_lookupContainerSetting($this->getId(), ilObjectServiceSettingsGUI::USE_NEWS, true));
1034  }
1035 
1036 
1044  public static function getCompleteDescriptions(array $objects)
1045  {
1046  global $ilSetting, $ilObjDataCache;
1047  // using long descriptions?
1048  $short_desc = $ilSetting->get("rep_shorten_description");
1049  $short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
1050  if(!$short_desc || $short_desc_max_length != ilObject::DESC_LENGTH)
1051  {
1052  // using (part of) shortened description
1053  if($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::DESC_LENGTH)
1054  {
1055  foreach($objects as $key => $object)
1056  {
1057  $objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
1058  }
1059  }
1060  // using (part of) long description
1061  else
1062  {
1063  $obj_ids = array();
1064  foreach($objects as $key => $object)
1065  {
1066  $obj_ids[] = $object["obj_id"];
1067  }
1068  if(sizeof($obj_ids))
1069  {
1071  foreach($objects as $key => $object)
1072  {
1073  // #12166 - keep translation, ignore long description
1074  if($ilObjDataCache->isTranslatedDescription($object["obj_id"]))
1075  {
1076  $long_desc[$object["obj_id"]] = $object["description"];
1077  }
1078  if($short_desc && $short_desc_max_length)
1079  {
1080  $long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
1081  }
1082  $objects[$key]["description"] = $long_desc[$object["obj_id"]];
1083  }
1084  }
1085  }
1086  }
1087  return $objects;
1088  }
1089 
1096  protected static function fixInternalLinksAfterCopy($a_target_id, $a_copy_id, $a_source_ref_id)
1097  {
1098  $obj_id = ilObject::_lookupObjId($a_target_id);
1099  include_once("./Services/Container/classes/class.ilContainerPage.php");
1100  if (ilContainerPage::_exists("cont", $obj_id))
1101  {
1102  include_once("./Services/CopyWizard/classes/class.ilCopyWizardOptions.php");
1103  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
1104  $mapping = $cwo->getMappings();
1105  $pg = new ilContainerPage($obj_id);
1106  $pg->handleRepositoryLinksOnCopy($mapping, $a_source_ref_id);
1107  $pg->update(true, true);
1108  }
1109  }
1110 
1111 } // END class ilContainer
1112 ?>
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
setNewsTimelineAutoEntries($a_val)
Set news timeline auto entries.
static _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
global $ilErr
Definition: raiseError.php:16
getCustomIconPath()
Get path for custom icon.
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies (container sorting)
$size
Definition: RandomTest.php:79
static _getContainerDirectory($a_id)
Get the container directory.
const SORT_NEW_ITEMS_POSITION_TOP
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
xmlData($data, $encode=TRUE, $escape=TRUE)
Writes data.
isNewsTimelineEffective()
Is news timeline effective?
static getLongDescriptions(array $a_obj_ids)
Get long description data.
removeCustomIcon()
remove small icon
Container start objects page object.
static _getItemsOfContainer($a_ref_id)
static ilClone($sid, $copy_identifier)
static _isFileHidden($a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user. ...
Class ilObject Basic functions for all objects.
getNewsTimelineLandingPage()
Get news timline is landing page.
const DESC_LENGTH
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
getBigIconPath()
Get path for big icon.
XML writer class.
getTinyIconPath()
Get path for tiny icon.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
setHiddenFilesFound($a_hiddenfilesfound)
Set Found hidden files (set by getSubItems).
setNewsBlockActivated($a_val)
Set news block activated.
saveIcons($a_custom_icon)
save container icons
getViewMode()
Get container view mode.
setUseNews($a_val)
Set use news.
getNewsTimelineAutoEntries()
Get news timeline auto entries.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static _cloneSettings($a_old_id, $a_new_id)
Clone settings.
xmlEndTag($tag)
Writes an endtag.
getOrderType()
Get order type default implementation.
getSubItems($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
Get subitems of container.
static _lookupStandard($a_id)
Lookup standard flag.
static _lookupIconPath($a_id, $a_size="big")
lookup icon path
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
Preloader for object list GUIs.
const SORT_NEW_ITEMS_POSITION_BOTTOM
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getContainerDirectory()
Get the container directory.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone container settings.
setNewsTimelineLandingPage($a_val)
Set news timline is landing page.
if(!is_array($argv)) $options
getId()
get object id public
Container page object.
isNewsTimelineLandingPageEffective()
Is news timeline landing page effective?
static _deleteContainerSettings($a_id, $a_keyword=null, $a_keyword_like=false)
setNewsTimeline($a_val)
Set news timeline.
const SORT_NEW_ITEMS_ORDER_CREATION
getStyleSheetId()
get ID of assigned style sheet object
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
getNewsTimeline()
Get news timeline.
static _lookupObjId($a_id)
static _getContainerSettings($a_id)
enablePageEditing()
Check whether page editing is allowed for container.
gotItems()
Check whether we got any items.
getHiddenFilesFound()
Get Found hidden files (set by getSubItems).
$ilUser
Definition: imgupload.php:18
static _allocateCopyId()
Allocate a copy for further entries.
Class ilContainer.
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
getType()
get object type public
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
const SORT_NEW_ITEMS_ORDER_ACTIVATION
static fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
Fix container item group references after a container has been cloned.
getSmallIconPath()
Get path for small icon.
static _duplicate($a_session_id)
Duplicate session.
readContainerSettings()
Read container settings.
addAdditionalSubItemInformation(&$object)
Add additional information to sub item, e.g.
setOrderType($a_value)
global $ilSetting
Definition: privfeed.php:17
__construct($a_id=0, $a_reference=true)
const SORT_DIRECTION_DESC
getUseNews()
Get use news.
global $ilBench
Definition: ilias.php:18
global $ilDB
$ret
Definition: parser.php:6
getRefId()
get reference id public
static _writeContainerSetting($a_id, $a_keyword, $a_value)
static $data_preloaded
global $DIC
static getLogger($a_component_id)
Get component logger.
static _lookupSortMode($a_obj_id)
lookup sort mode
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _getInstance($a_obj_id)
get instance by obj_id
$client_id
const SORT_DIRECTION_ASC
createContainerDirectory()
Create directory for the container.
getNewsBlockActivated()
Get news block activated.
getGroupedObjTypes()
Get grouped repository object types.
static getInstance($a_obj_id)
const SORT_NEW_ITEMS_ORDER_TITLE
static getWebspaceDir($mode="filesystem")
get webspace directory
static getCompleteDescriptions(array $objects)
overwrites description fields to long or short description in an assoc array keys needed (obj_id and ...
static fixInternalLinksAfterCopy($a_target_id, $a_copy_id, $a_source_ref_id)
Fix internal links after copy process.