ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainer Class Reference

Class ilContainer. More...

+ Inheritance diagram for ilContainer:
+ Collaboration diagram for ilContainer:

Public Member Functions

 ilContainer ($a_id=0, $a_call_by_reference=true)
 Constructor public. More...
 
 createContainerDirectory ()
 Create directory for the container. More...
 
 getContainerDirectory ()
 Get the container directory. More...
 
 _getContainerDirectory ($a_id)
 Get the container directory. More...
 
 getBigIconPath ()
 Get path for big icon. More...
 
 getSmallIconPath ()
 Get path for small icon. More...
 
 getTinyIconPath ()
 Get path for tiny icon. More...
 
 getCustomIconPath ()
 Get path for custom icon. More...
 
 setHiddenFilesFound ($a_hiddenfilesfound)
 Set Found hidden files (set by getSubItems). More...
 
 getHiddenFilesFound ()
 Get Found hidden files (set by getSubItems). More...
 
 getStyleSheetId ()
 get ID of assigned style sheet object More...
 
 setStyleSheetId ($a_style_id)
 set ID of assigned style sheet object More...
 
 _lookupContainerSetting ($a_id, $a_keyword, $a_default_value=NULL)
 Lookup a container setting. More...
 
 _writeContainerSetting ($a_id, $a_keyword, $a_value)
 
 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path More...
 
 saveIcons ($a_custom_icon)
 save container icons More...
 
 removeCustomIcon ()
 remove small icon More...
 
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone container settings. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies (container sorting) More...
 
 cloneAllObject ($session_id, $client_id, $new_type, $ref_id, $clone_source, $options, $soap_call=false)
 clone all objects according to this container More...
 
 getViewMode ()
 Get container view mode. More...
 
 getOrderType ()
 Get order type default implementation. More...
 
 setOrderType ($a_value)
 
 getSubItems ($a_admin_panel_enabled=false, $a_include_side_block=false, $a_get_single=0)
 Get subitems of container. More...
 
 gotItems ()
 Check whether we got any items. More...
 
 addAdditionalSubItemInformation (&$object)
 Add additional information to sub item, e.g. More...
 
 getGroupedObjTypes ()
 Get grouped repository object types. More...
 
 enablePageEditing ()
 Check whether page editing is allowed for container. More...
 
 create ()
 Create. More...
 
 update ()
 Update. More...
 
 read ()
 read More...
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 read object data from db into object More...
 
 getId ()
 get object id public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date public More...
 
 getLastUpdateDate ()
 get last update date public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Static Public Member Functions

static _getContainerSettings ($a_id)
 
static _deleteContainerSettings ($a_id, $a_keyword=null, $a_keyword_like=false)
 
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 description) More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

const VIEW_SESSIONS = 0
 
const VIEW_OBJECTIVE = 1
 
const VIEW_TIMING = 2
 
const VIEW_ARCHIVE = 3
 
const VIEW_SIMPLE = 4
 
const VIEW_BY_TYPE = 5
 
const VIEW_INHERIT = 6
 
const VIEW_ILINC = 7
 
const VIEW_DEFAULT = self::VIEW_BY_TYPE
 
const SORT_TITLE = 0
 
const SORT_MANUAL = 1
 
const SORT_ACTIVATION = 2
 
const SORT_INHERIT = 3
 
const SORT_CREATION = 4
 
const SORT_DIRECTION_ASC = 0
 
const SORT_DIRECTION_DESC = 1
 
const SORT_NEW_ITEMS_POSITION_TOP = 0
 
const SORT_NEW_ITEMS_POSITION_BOTTOM = 1
 
const SORT_NEW_ITEMS_ORDER_TITLE = 0
 
const SORT_NEW_ITEMS_ORDER_CREATION = 1
 
const SORT_NEW_ITEMS_ORDER_ACTIVATION = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 
 $obj_data_record
 object_data record More...
 

Static Public Attributes

static $data_preloaded = false
 

Protected Attributes

 $order_type = 0
 
 $hiddenfilesfound = false
 

Detailed Description

Class ilContainer.

Base class for all container objects (categories, courses, groups)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 39 of file class.ilContainer.php.

Member Function Documentation

◆ _deleteContainerSettings()

static ilContainer::_deleteContainerSettings (   $a_id,
  $a_keyword = null,
  $a_keyword_like = false 
)
static

Definition at line 271 of file class.ilContainer.php.

References $ilDB.

Referenced by ilObjCategoryGUI\updateTaxonomySettingsObject().

272  {
273  global $ilDB;
274 
275  if(!$a_id)
276  {
277  return;
278  }
279 
280  $sql = "DELETE FROM container_settings WHERE ".
281  " id = ".$ilDB->quote($a_id ,'integer');
282  if($a_keyword)
283  {
284  if(!$a_keyword_like)
285  {
286  $sql .= " AND keyword = ".$ilDB->quote($a_keyword, "text");
287  }
288  else
289  {
290  $sql .= " AND ".$ilDB->like("keyword", "text", $a_keyword);
291  }
292  }
293  $ilDB->manipulate($sql);
294  }
global $ilDB
+ Here is the caller graph for this function:

◆ _exportContainerSettings()

static ilContainer::_exportContainerSettings ( ilXmlWriter  $a_xml,
  $a_obj_id 
)
static

Definition at line 296 of file class.ilContainer.php.

References ilXmlWriter\xmlData(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by ilCategoryXmlWriter\export(), ilGroupXMLWriter\start(), and ilCourseXMLWriter\start().

297  {
298  // container settings
299  $settings = self::_getContainerSettings($a_obj_id);
300  if(sizeof($settings))
301  {
302  $a_xml->xmlStartTag("ContainerSettings");
303 
304  foreach($settings as $keyword => $value)
305  {
306  // :TODO: proper custom icon export/import
307  if(stristr($keyword, "icon"))
308  {
309  continue;
310  }
311 
312  $a_xml->xmlStartTag(
313  'ContainerSetting',
314  array(
315  'id' => $keyword,
316  )
317  );
318 
319  $a_xml->xmlData($value);
320  $a_xml->xmlEndTag("ContainerSetting");
321  }
322 
323  $a_xml->xmlEndTag("ContainerSettings");
324  }
325  }
xmlData($data, $encode=TRUE, $escape=TRUE)
Writes data.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getContainerDirectory()

ilContainer::_getContainerDirectory (   $a_id)

Get the container directory.

Returns
string container directory

Definition at line 123 of file class.ilContainer.php.

References ilUtil\getWebspaceDir().

Referenced by ilObject\_getIcon(), _lookupIconPath(), and getContainerDirectory().

124  {
125  return ilUtil::getWebspaceDir()."/container_data/obj_".$a_id;
126  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getContainerSettings()

static ilContainer::_getContainerSettings (   $a_id)
static

Definition at line 254 of file class.ilContainer.php.

References $ilDB, $res, and $row.

Referenced by ilObjCategoryGUI\getActiveBlocks(), and ilTaxonomyClassificationProvider\getActiveTaxonomiesForParentRefId().

255  {
256  global $ilDB;
257 
258  $res = array();
259 
260  $sql = "SELECT * FROM container_settings WHERE ".
261  " id = ".$ilDB->quote($a_id ,'integer');
262  $set = $ilDB->query($sql);
263  while($row = $ilDB->fetchAssoc($set))
264  {
265  $res[$row["keyword"]] = $row["value"];
266  }
267 
268  return $res;
269  }
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupContainerSetting()

ilContainer::_lookupContainerSetting (   $a_id,
  $a_keyword,
  $a_default_value = NULL 
)

Lookup a container setting.

Parameters
intcontainer id
stringsetting keyword
Returns
string setting value

Definition at line 216 of file class.ilContainer.php.

References $ilDB, and DB_FETCHMODE_ASSOC.

Referenced by ilObject\_getIcon(), _lookupIconPath(), ilContainerGUI\editPageContentObject(), ilContainerGUI\editPageFrameObject(), ilContainerGUI\forwardToPageObject(), ilTaxonomyClassificationProvider\getActiveTaxonomiesForParentRefId(), ilContainerGUI\getContainerPageHTML(), ilObjCategoryListGUI\getInfoScreenStatus(), ilTaxMDGUI\getSelectableTaxonomies(), ilObjCategoryGUI\getTabs(), ilObject\hasAutoRating(), ilObjCategoryGUI\ilObjCategoryGUI(), ilObjRootFolderGUI\initEditForm(), ilObjectServiceSettingsGUI\initServiceSettingsForm(), ilContainerGUI\initStylePropertiesForm(), ilObjectListGUI\insertCommands(), ilTaggingClassificationProvider\isActive(), ilColumnGUI\isGloballyActivated(), ilCalendarSettings\lookupCalendarActivated(), ilContainerGUI\savePageContentObject(), ilObjRootFolderGUI\setTitleAndDescription(), and ilContainerGUI\setTitleAndDescription().

217  {
218  global $ilDB;
219 
220  $q = "SELECT * FROM container_settings WHERE ".
221  " id = ".$ilDB->quote($a_id ,'integer')." AND ".
222  " keyword = ".$ilDB->quote($a_keyword ,'text');
223  $set = $ilDB->query($q);
224  $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
225 
226  if(isset($rec['value']))
227  {
228  return $rec["value"];
229  }
230  if($a_default_value === NULL)
231  {
232  return '';
233  }
234  return $a_default_value;
235  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupIconPath()

ilContainer::_lookupIconPath (   $a_id,
  $a_size = "big" 
)

lookup icon path

Parameters
int$a_idcontainer object id
string$a_size"big" | "small"

Definition at line 333 of file class.ilContainer.php.

References $size, _getContainerDirectory(), and _lookupContainerSetting().

Referenced by ilPDSelectedItemsBlockGUI\addParentRow(), ilShopPurchaseGUI\addStandardRow(), ilContainerGUI\addStandardRow(), ilPDSelectedItemsBlockGUI\addStandardRow(), and ilContainerGUI\setTitleAndDescription().

334  {
335  if ($a_size == "")
336  {
337  $a_size = "big";
338  }
339  $size = $a_size;
340 
341  if (ilContainer::_lookupContainerSetting($a_id, "icon_custom"))
342  {
343  $cont_dir = ilContainer::_getContainerDirectory($a_id);
344 
345  $file_name = $cont_dir."/icon_custom.svg";
346  if (is_file($file_name))
347  {
348  return $file_name;
349  }
350  }
351 
352  return "";
353  }
$size
Definition: RandomTest.php:79
_getContainerDirectory($a_id)
Get the container directory.
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _writeContainerSetting()

ilContainer::_writeContainerSetting (   $a_id,
  $a_keyword,
  $a_value 
)

Definition at line 237 of file class.ilContainer.php.

References $ilDB, $query, and $res.

Referenced by ilCategoryXmlParser\handlerEndTag(), ilGroupXMLParser\handlerEndTag(), ilCourseXMLParser\handlerEndTag(), removeCustomIcon(), saveIcons(), ilContainerGUI\savePageContentObject(), ilObjRootFolderGUI\updateObject(), ilObjectServiceSettingsGUI\updateServiceSettingsForm(), ilObjCategoryGUI\updateTaxonomySettingsObject(), ilObjectServiceSettingsGUI\updateToolSettings(), and ilContainerGUI\useNewEditorObject().

238  {
239  global $ilDB;
240 
241  $query = "DELETE FROM container_settings WHERE ".
242  "id = ".$ilDB->quote($a_id,'integer')." ".
243  "AND keyword = ".$ilDB->quote($a_keyword,'text');
244  $res = $ilDB->manipulate($query);
245 
246  $query = "INSERT INTO container_settings (id, keyword, value) VALUES (".
247  $ilDB->quote($a_id ,'integer').", ".
248  $ilDB->quote($a_keyword ,'text').", ".
249  $ilDB->quote($a_value ,'text').
250  ")";
251  $res = $ilDB->manipulate($query);
252  }
global $ilDB
+ Here is the caller graph for this function:

◆ addAdditionalSubItemInformation()

ilContainer::addAdditionalSubItemInformation ( $object)

Add additional information to sub item, e.g.

used in courses for timings information etc.

Definition at line 745 of file class.ilContainer.php.

Referenced by getSubItems().

746  {
747  }
+ Here is the caller graph for this function:

◆ cloneAllObject()

ilContainer::cloneAllObject (   $session_id,
  $client_id,
  $new_type,
  $ref_id,
  $clone_source,
  $options,
  $soap_call = false 
)

clone all objects according to this container

Parameters
string$session_id
string$client_id
string$new_type
int$ref_id
int$clone_source
array$options
Returns
new refid if clone has finished or parameter ref id if cloning is still in progress

Definition at line 497 of file class.ilContainer.php.

References $client_id, $ilErr, $ilLog, $ilUser, $options, ilObject\$ref_id, $res, ilCopyWizardOptions\_allocateCopyId(), ilSession\_duplicate(), ilCopyWizardOptions\_getInstance(), ilCopyWizardOptions\_isFinished(), ilObject\_lookupObjId(), ilObject\_lookupType(), and ilSoapFunctions\ilClone().

498  {
499  global $ilLog;
500 
501  include_once('./Services/Link/classes/class.ilLink.php');
502  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
503 
504  global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser;
505 
506  // Save wizard options
508  $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
509  $wizard_options->saveOwner($ilUser->getId());
510  $wizard_options->saveRoot($clone_source);
511 
512  // add entry for source container
513  $wizard_options->initContainer($clone_source, $ref_id);
514 
515  foreach($options as $source_id => $option)
516  {
517  $wizard_options->addEntry($source_id,$option);
518  }
519  $wizard_options->read();
520  $wizard_options->storeTree($clone_source);
521 
522  // Special handling for course in existing courses
523  if($new_type == 'crs' and ilObject::_lookupType(ilObject::_lookupObjId($ref_id)) == 'crs')
524  {
525  $ilLog->write(__METHOD__.': Copy course in course...');
526  $ilLog->write(__METHOD__.': Added mapping, source ID: '.$clone_source.', target ID: '.$ref_id);
527  $wizard_options->read();
528  $wizard_options->dropFirstNode();
529  $wizard_options->appendMapping($clone_source,$ref_id);
530  }
531 
532  #print_r($options);
533  // Duplicate session to avoid logout problems with backgrounded SOAP calls
534  $new_session_id = ilSession::_duplicate($session_id);
535  // Start cloning process using soap call
536  include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
537 
538  $soap_client = new ilSoapClient();
539  $soap_client->setResponseTimeout(30);
540  $soap_client->enableWSDL(true);
541 
542  $ilLog->write(__METHOD__.': Trying to call Soap client...');
543  if($soap_client->init())
544  {
545  $ilLog->write(__METHOD__.': Calling soap clone method...');
546  $res = $soap_client->call('ilClone',array($new_session_id.'::'.$client_id, $copy_id));
547  }
548  else
549  {
550  $ilLog->write(__METHOD__.': SOAP call failed. Calling clone method manually. ');
551  $wizard_options->disableSOAP();
552  $wizard_options->read();
553  include_once('./webservice/soap/include/inc.soap_functions.php');
554  $res = ilSoapFunctions::ilClone($new_session_id.'::'.$client_id, $copy_id);
555  }
556  // Check if copy is in progress or if this has been called by soap (don't wait for finishing)
557  if($soap_call || ilCopyWizardOptions::_isFinished($copy_id))
558  {
559  return $res;
560  }
561  else
562  {
563  return $ref_id;
564  }
565  }
static ilClone($sid, $copy_identifier)
static _isFinished($a_copy_id)
check if copy is finished
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
static _lookupObjId($a_id)
static _allocateCopyId()
Allocate a copy for further entries.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _duplicate($a_session_id)
Duplicate session.
global $ilUser
Definition: imgupload.php:15
$client_id
+ Here is the call graph for this function:

◆ cloneDependencies()

ilContainer::cloneDependencies (   $a_target_id,
  $a_copy_id 
)

Clone object dependencies (container sorting)

public

Parameters
inttarget ref id of new course
intcopy id return bool

Definition at line 462 of file class.ilContainer.php.

References $ilLog, ilContainerSorting\_getInstance(), ilObjItemGroup\fixContainerItemGroupRefsAfterCloning(), ilObject\getId(), and ilObjectLP\getInstance().

463  {
464  global $ilLog;
465 
466  parent::cloneDependencies($a_target_id, $a_copy_id);
467 
468  include_once('./Services/Container/classes/class.ilContainerSorting.php');
469  ilContainerSorting::_getInstance($this->getId())->cloneSorting($a_target_id,$a_copy_id);
470 
471  // fix item group references in page content
472  include_once("./Modules/ItemGroup/classes/class.ilObjItemGroup.php");
474 
475  include_once('Services/Object/classes/class.ilObjectLP.php');
476  $olp = ilObjectLP::getInstance($this->getId());
477  $collection = $olp->getCollectionInstance();
478  if($collection)
479  {
480  $collection->cloneCollection($a_target_id, $a_copy_id);
481  }
482 
483  return true;
484  }
getId()
get object id public
static fixContainerItemGroupRefsAfterCloning($a_source_container, $a_copy_id)
Fix container item group references after a container has been cloned.
static _getInstance($a_obj_id)
get instance by obj_id
static getInstance($a_obj_id)
+ Here is the call graph for this function:

◆ cloneObject()

ilContainer::cloneObject (   $a_target_id,
  $a_copy_id = 0 
)

Clone container settings.

public

Parameters
inttarget ref_id
intcopy id
Returns
object new object

Definition at line 401 of file class.ilContainer.php.

References $file, $ilLog, ilContainerSortingSettings\_cloneSettings(), ilPageObject\_exists(), getContainerDirectory(), and ilObject\getId().

402  {
403  global $ilLog;
404 
405  $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
406 
407  include_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
408  #18624 - copy all sorting settings
409  ilContainerSortingSettings::_cloneSettings($this->getId(), $new_obj->getId());
410 
411  // copy content page
412  include_once("./Services/Container/classes/class.ilContainerPage.php");
413  if (ilContainerPage::_exists("cont",
414  $this->getId()))
415  {
416  $orig_page = new ilContainerPage($this->getId());
417  $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId());
418  }
419 
420  // #10271 - copy start objects page
421  include_once("./Services/Container/classes/class.ilContainerStartObjectsPage.php");
423  $this->getId()))
424  {
425  $orig_page = new ilContainerStartObjectsPage($this->getId());
426  $orig_page->copy($new_obj->getId(), "cstr", $new_obj->getId());
427  }
428 
429  // #10271
430  foreach(self::_getContainerSettings($this->getId()) as $keyword => $value)
431  {
432  self::_writeContainerSetting($new_obj->getId(), $keyword, $value);
433 
434  // copy custom icons
435  if($keyword == "icon_custom" &&
436  $value)
437  {
438  // see saveIcons()
439  $new_obj->createContainerDirectory();
440  $tgt_dir = $new_obj->getContainerDirectory();
441  $src_dir = $this->getContainerDirectory();
442  $file = "icon_custom.svg";
443  $src_file = $src_dir."/".$file;
444  if(file_exists($src_file))
445  {
446  copy($src_file, $tgt_dir."/".$file);
447  }
448  }
449  }
450 
451  return $new_obj;
452  }
print $file
Container start objects page object.
static _cloneSettings($a_old_id, $a_new_id)
Clone settings.
getContainerDirectory()
Get the container directory.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
getId()
get object id public
Container page object.
+ Here is the call graph for this function:

◆ create()

ilContainer::create ( )

Create.

Definition at line 782 of file class.ilContainer.php.

References $ret, ilObject\getId(), getStyleSheetId(), and ilObjStyleSheet\writeStyleUsage().

783  {
784  $ret = parent::create();
785 
786  if (((int) $this->getStyleSheetId()) > 0)
787  {
788  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
790  }
791 
792  return $ret;
793  }
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getId()
get object id public
getStyleSheetId()
get ID of assigned style sheet object
+ Here is the call graph for this function:

◆ createContainerDirectory()

ilContainer::createContainerDirectory ( )

Create directory for the container.

It is <webspace_dir>/container_data.

Definition at line 93 of file class.ilContainer.php.

References ilObject\getId(), ilUtil\getWebspaceDir(), and ilUtil\makeDir().

Referenced by saveIcons().

94  {
95  $webspace_dir = ilUtil::getWebspaceDir();
96  $cont_dir = $webspace_dir."/container_data";
97  if (!is_dir($cont_dir))
98  {
99  ilUtil::makeDir($cont_dir);
100  }
101  $obj_dir = $cont_dir."/obj_".$this->getId();
102  if (!is_dir($obj_dir))
103  {
104  ilUtil::makeDir($obj_dir);
105  }
106  }
getId()
get object id public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enablePageEditing()

ilContainer::enablePageEditing ( )

Check whether page editing is allowed for container.

Definition at line 768 of file class.ilContainer.php.

References $ilSetting.

769  {
770  global $ilSetting;
771 
772  // @todo: this will need a more general approach
773  if ($ilSetting->get("enable_cat_page_edit"))
774  {
775  return true;
776  }
777  }
global $ilSetting
Definition: privfeed.php:40

◆ getBigIconPath()

ilContainer::getBigIconPath ( )

Get path for big icon.

Returns
string icon path
Deprecated:
use _lookupIconPath instead

Definition at line 134 of file class.ilContainer.php.

References ilObject\getId().

Referenced by ilObjCategory\cloneObject(), ilObjGroup\cloneObject(), and ilObjCourse\cloneObject().

135  {
136  return self::_lookupIconPath($this->getId());
137  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCompleteDescriptions()

static ilContainer::getCompleteDescriptions ( array  $objects)
static

overwrites description fields to long or short description in an assoc array keys needed (obj_id and description)

Parameters
array$objects
Returns
array

Definition at line 834 of file class.ilContainer.php.

References $ilSetting, ilObject\$long_desc, ilObject\DESC_LENGTH, ilObject\getLongDescriptions(), and ilUtil\shortenText().

Referenced by ilContainerContentGUI\renderItem(), and ilContainerContentGUI\renderItemGroup().

835  {
836  global $ilSetting, $ilObjDataCache;
837  // using long descriptions?
838  $short_desc = $ilSetting->get("rep_shorten_description");
839  $short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
840  if(!$short_desc || $short_desc_max_length != ilObject::DESC_LENGTH)
841  {
842  // using (part of) shortened description
843  if($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::DESC_LENGTH)
844  {
845  foreach($objects as $key => $object)
846  {
847  $objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
848  }
849  }
850  // using (part of) long description
851  else
852  {
853  $obj_ids = array();
854  foreach($objects as $key => $object)
855  {
856  $obj_ids[] = $object["obj_id"];
857  }
858  if(sizeof($obj_ids))
859  {
861  foreach($objects as $key => $object)
862  {
863  // #12166 - keep translation, ignore long description
864  if($ilObjDataCache->isTranslatedDescription($object["obj_id"]))
865  {
866  $long_desc[$object["obj_id"]] = $object["description"];
867  }
868  if($short_desc && $short_desc_max_length)
869  {
870  $long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
871  }
872  $objects[$key]["description"] = $long_desc[$object["obj_id"]];
873  }
874  }
875  }
876  }
877  return $objects;
878  }
static getLongDescriptions(array $a_obj_ids)
Get long description data.
const DESC_LENGTH
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
global $ilSetting
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContainerDirectory()

ilContainer::getContainerDirectory ( )

Get the container directory.

Returns
string container directory

Definition at line 113 of file class.ilContainer.php.

References _getContainerDirectory(), and ilObject\getId().

Referenced by cloneObject(), removeCustomIcon(), and saveIcons().

114  {
115  return $this->_getContainerDirectory($this->getId());
116  }
_getContainerDirectory($a_id)
Get the container directory.
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCustomIconPath()

ilContainer::getCustomIconPath ( )

Get path for custom icon.

Returns
string icon path

Definition at line 166 of file class.ilContainer.php.

References ilObject\getId().

167  {
168  return self::_lookupIconPath($this->getId());
169  }
getId()
get object id public
+ Here is the call graph for this function:

◆ getGroupedObjTypes()

ilContainer::getGroupedObjTypes ( )

Get grouped repository object types.

Returns
array array of object types

Definition at line 754 of file class.ilContainer.php.

References ilObject\getType().

Referenced by getSubItems().

755  {
756  global $objDefinition;
757 
758  if (empty($this->type_grps))
759  {
760  $this->type_grps = $objDefinition->getGroupedRepositoryObjectTypes($this->getType());
761  }
762  return $this->type_grps;
763  }
getType()
get object type public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHiddenFilesFound()

ilContainer::getHiddenFilesFound ( )

Get Found hidden files (set by getSubItems).

Returns
boolean Found hidden files (set by getSubItems)

Definition at line 187 of file class.ilContainer.php.

References $hiddenfilesfound.

188  {
190  }

◆ getOrderType()

ilContainer::getOrderType ( )

Get order type default implementation.

Definition at line 578 of file class.ilContainer.php.

References SORT_TITLE.

579  {
580  return $this->order_type ? $this->order_type : ilContainer::SORT_TITLE;
581  }

◆ getSmallIconPath()

ilContainer::getSmallIconPath ( )

Get path for small icon.

Returns
string icon path
Deprecated:
use _lookupIconPath instead

Definition at line 145 of file class.ilContainer.php.

References ilObject\getId().

Referenced by ilObjCategory\cloneObject(), ilObjGroup\cloneObject(), and ilObjCourse\cloneObject().

146  {
147  return self::_lookupIconPath($this->getId());
148  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleSheetId()

ilContainer::getStyleSheetId ( )

get ID of assigned style sheet object

Definition at line 195 of file class.ilContainer.php.

Referenced by create(), and update().

196  {
197  return $this->style_id;
198  }
+ Here is the caller graph for this function:

◆ getSubItems()

ilContainer::getSubItems (   $a_admin_panel_enabled = false,
  $a_include_side_block = false,
  $a_get_single = 0 
)

Get subitems of container.

Parameters
booladministration panel enabled
boolside blocks enabled
Returns
array

Definition at line 596 of file class.ilContainer.php.

References $ilBench, $ilSetting, $ilUser, ilObject\$type, ilContainerSorting\_getInstance(), ilEventItems\_getItemsOfContainer(), ilObjFileAccess\_isFileHidden(), addAdditionalSubItemInformation(), ilObjectListGUI\CONTEXT_REPOSITORY, getGroupedObjTypes(), ilObject\getId(), ilObject\getRefId(), and setHiddenFilesFound().

598  {
599  global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem,
600  $ilSetting;
601 
602  // Caching
603  if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) &&
604  !$a_get_single)
605  {
606  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
607  }
608 
609  $type_grps = $this->getGroupedObjTypes();
610  $objects = $tree->getChilds($this->getRefId(), "title");
611 
612  $objects = self::getCompleteDescriptions($objects);
613 
614  $found = false;
615  $all_ref_ids = array();
616 
617  if(!self::$data_preloaded)
618  {
619  include_once("./Services/Object/classes/class.ilObjectListGUIPreloader.php");
621  }
622 
623  include_once('Services/Container/classes/class.ilContainerSorting.php');
624  $sort = ilContainerSorting::_getInstance($this->getId());
625 
626  // TODO: check this
627  // get items attached to a session
628  include_once './Modules/Session/classes/class.ilEventItems.php';
629  $event_items = ilEventItems::_getItemsOfContainer($this->getRefId());
630 
631  foreach ($objects as $key => $object)
632  {
633  if ($a_get_single > 0 && $object["child"] != $a_get_single)
634  {
635  continue;
636  }
637 
638  // hide object types in devmode
639  if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm"
640  || $object["type"] == "rolf")
641  {
642  continue;
643  }
644 
645  // remove inactive plugins
646  if ($objDefinition->isInactivePlugin($object["type"]))
647  {
648  continue;
649  }
650 
651  // BEGIN WebDAV: Don't display hidden Files, Folders and Categories
652  if (in_array($object['type'], array('file','fold','cat')))
653  {
654  include_once 'Modules/File/classes/class.ilObjFileAccess.php';
655  if (ilObjFileAccess::_isFileHidden($object['title']))
656  {
657  $this->setHiddenFilesFound(true);
658  if (!$a_admin_panel_enabled)
659  {
660  continue;
661  }
662  }
663  }
664  // END WebDAV: Don't display hidden Files, Folders and Categories
665 
666  // including event items!
667  if (!self::$data_preloaded)
668  {
669  $preloader->addItem($object["obj_id"], $object["type"], $object["child"]);
670  }
671 
672  // filter out items that are attached to an event
673  if (in_array($object['ref_id'],$event_items))
674  {
675  continue;
676  }
677 
678  // filter side block items
679  if(!$a_include_side_block && $objDefinition->isSideBlock($object['type']))
680  {
681  continue;
682  }
683 
684  $all_ref_ids[] = $object["child"];
685  }
686 
687  // data preloader
688  if (!self::$data_preloaded)
689  {
690  $preloader->preload();
691  unset($preloader);
692 
693  self::$data_preloaded = true;
694  }
695 
696  foreach($objects as $key => $object)
697  {
698  // see above, objects were filtered
699  if(!in_array($object["child"], $all_ref_ids))
700  {
701  continue;
702  }
703 
704  // group object type groups together (e.g. learning resources)
705  $type = $objDefinition->getGroupOfObj($object["type"]);
706  if ($type == "")
707  {
708  $type = $object["type"];
709  }
710 
711  // this will add activation properties
712  $this->addAdditionalSubItemInformation($object);
713 
714  $this->items[$type][$key] = $object;
715 
716  $this->items["_all"][$key] = $object;
717  if ($object["type"] != "sess")
718  {
719  $this->items["_non_sess"][$key] = $object;
720  }
721  }
722 
723  $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]
724  = $sort->sortItems($this->items);
725 
726  return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
727  }
static _isFileHidden($a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user. ...
_getItemsOfContainer($a_ref_id)
setHiddenFilesFound($a_hiddenfilesfound)
Set Found hidden files (set by getSubItems).
Preloader for object list GUIs.
getId()
get object id public
global $ilUser
Definition: imgupload.php:15
addAdditionalSubItemInformation(&$object)
Add additional information to sub item, e.g.
global $ilSetting
Definition: privfeed.php:40
global $ilBench
Definition: ilias.php:18
getRefId()
get reference id public
static _getInstance($a_obj_id)
get instance by obj_id
getGroupedObjTypes()
Get grouped repository object types.
+ Here is the call graph for this function:

◆ getTinyIconPath()

ilContainer::getTinyIconPath ( )

Get path for tiny icon.

Returns
string icon path
Deprecated:
use _lookupIconPath instead

Definition at line 156 of file class.ilContainer.php.

References ilObject\getId().

Referenced by ilObjCategory\cloneObject(), ilObjGroup\cloneObject(), and ilObjCourse\cloneObject().

157  {
158  return self::_lookupIconPath($this->getId());
159  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getViewMode()

ilContainer::getViewMode ( )

Get container view mode.

Definition at line 570 of file class.ilContainer.php.

References VIEW_BY_TYPE.

Referenced by ilObjGroup\cloneObject(), ilObjGroup\create(), and ilObjGroup\update().

571  {
573  }
+ Here is the caller graph for this function:

◆ gotItems()

ilContainer::gotItems ( )

Check whether we got any items.

Definition at line 732 of file class.ilContainer.php.

733  {
734  if (is_array($this->items["_all"]) && count($this->items["_all"]) > 0)
735  {
736  return true;
737  }
738  return false;
739  }

◆ ilContainer()

ilContainer::ilContainer (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 82 of file class.ilContainer.php.

Referenced by ilObjOrgUnit\__construct(), and ilObjCategory\ilObjCategory().

83  {
84  parent::__construct($a_id, $a_call_by_reference);
85  }
+ Here is the caller graph for this function:

◆ read()

ilContainer::read ( )

read

public

Parameters

Definition at line 816 of file class.ilContainer.php.

References ilContainerSortingSettings\_lookupSortMode(), ilObject\getId(), ilObjStyleSheet\lookupObjectStyle(), setOrderType(), and setStyleSheetId().

Referenced by ilObjOrgUnit\__construct().

817  {
818  parent::read();
819 
820  include_once("./Services/Container/classes/class.ilContainerSortingSettings.php");
822 
823  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
825  }
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
static lookupObjectStyle($a_obj_id)
Lookup object style.
getId()
get object id public
setOrderType($a_value)
static _lookupSortMode($a_obj_id)
lookup sort mode
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeCustomIcon()

ilContainer::removeCustomIcon ( )

remove small icon

Definition at line 385 of file class.ilContainer.php.

References _writeContainerSetting(), getContainerDirectory(), and ilObject\getId().

386  {
387  $cont_dir = $this->getContainerDirectory();
388  $small_file_name = $cont_dir."/icon_custom.svg";
389  @unlink($small_file_name);
390  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 0);
391  }
_writeContainerSetting($a_id, $a_keyword, $a_value)
getContainerDirectory()
Get the container directory.
getId()
get object id public
+ Here is the call graph for this function:

◆ saveIcons()

ilContainer::saveIcons (   $a_custom_icon)

save container icons

Definition at line 358 of file class.ilContainer.php.

References $ilDB, _writeContainerSetting(), createContainerDirectory(), getContainerDirectory(), ilObject\getId(), and ilUtil\moveUploadedFile().

359  {
360  global $ilDB;
361 
362  $this->createContainerDirectory();
363  $cont_dir = $this->getContainerDirectory();
364 
365  $file_name = "";
366  if ($a_custom_icon != "")
367  {
368  $file_name = $cont_dir."/icon_custom.svg";
369  ilUtil::moveUploadedFile($a_custom_icon, "icon_custom.svg", $file_name);
370 
371  if ($file_name != "" && is_file($file_name))
372  {
373  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 1);
374  }
375  else
376  {
377  ilContainer::_writeContainerSetting($this->getId(), "icon_custom", 0);
378  }
379  }
380  }
_writeContainerSetting($a_id, $a_keyword, $a_value)
getContainerDirectory()
Get the container directory.
getId()
get object id public
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
global $ilDB
createContainerDirectory()
Create directory for the container.
+ Here is the call graph for this function:

◆ setHiddenFilesFound()

ilContainer::setHiddenFilesFound (   $a_hiddenfilesfound)

Set Found hidden files (set by getSubItems).

Parameters
boolean$a_hiddenfilesfoundFound hidden files (set by getSubItems)

Definition at line 177 of file class.ilContainer.php.

Referenced by getSubItems().

178  {
179  $this->hiddenfilesfound = $a_hiddenfilesfound;
180  }
+ Here is the caller graph for this function:

◆ setOrderType()

ilContainer::setOrderType (   $a_value)

Definition at line 583 of file class.ilContainer.php.

Referenced by ilObjFolder\read(), ilObjGroup\read(), ilObjCourse\read(), and read().

584  {
585  $this->order_type = $a_value;
586  }
+ Here is the caller graph for this function:

◆ setStyleSheetId()

ilContainer::setStyleSheetId (   $a_style_id)

set ID of assigned style sheet object

Definition at line 203 of file class.ilContainer.php.

Referenced by read().

204  {
205  $this->style_id = $a_style_id;
206  }
+ Here is the caller graph for this function:

◆ update()

ilContainer::update ( )

Update.

Definition at line 798 of file class.ilContainer.php.

References $ret, ilObject\getId(), getStyleSheetId(), and ilObjStyleSheet\writeStyleUsage().

799  {
800  $ret = parent::update();
801 
802  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
804 
805  return $ret;
806  }
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getId()
get object id public
getStyleSheetId()
get ID of assigned style sheet object
+ Here is the call graph for this function:

Field Documentation

◆ $data_preloaded

ilContainer::$data_preloaded = false
static

Definition at line 74 of file class.ilContainer.php.

◆ $hiddenfilesfound

ilContainer::$hiddenfilesfound = false
protected

Definition at line 42 of file class.ilContainer.php.

Referenced by getHiddenFilesFound().

◆ $order_type

ilContainer::$order_type = 0
protected

Definition at line 41 of file class.ilContainer.php.

◆ SORT_ACTIVATION

◆ SORT_CREATION

◆ SORT_DIRECTION_ASC

◆ SORT_DIRECTION_DESC

const ilContainer::SORT_DIRECTION_DESC = 1

◆ SORT_INHERIT

◆ SORT_MANUAL

◆ SORT_NEW_ITEMS_ORDER_ACTIVATION

◆ SORT_NEW_ITEMS_ORDER_CREATION

◆ SORT_NEW_ITEMS_ORDER_TITLE

◆ SORT_NEW_ITEMS_POSITION_BOTTOM

◆ SORT_NEW_ITEMS_POSITION_TOP

◆ SORT_TITLE

◆ VIEW_ARCHIVE

const ilContainer::VIEW_ARCHIVE = 3

Definition at line 48 of file class.ilContainer.php.

◆ VIEW_BY_TYPE

◆ VIEW_DEFAULT

const ilContainer::VIEW_DEFAULT = self::VIEW_BY_TYPE

Definition at line 54 of file class.ilContainer.php.

Referenced by ilObjGroup\getViewMode(), and ilObjGroup\translateViewMode().

◆ VIEW_ILINC

const ilContainer::VIEW_ILINC = 7

◆ VIEW_INHERIT

const ilContainer::VIEW_INHERIT = 6

◆ VIEW_OBJECTIVE

◆ VIEW_SESSIONS

◆ VIEW_SIMPLE

◆ VIEW_TIMING

const ilContainer::VIEW_TIMING = 2

The documentation for this class was generated from the following file: