ILIAS  release_8 Revision v8.23
ilObjRepositorySettings Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjRepositorySettings:
+ Collaboration diagram for ilObjRepositorySettings:

Public Member Functions

 __construct (int $a_id, bool $a_call_by_reference=true)
 
 delete ()
 
- Public Member Functions inherited from ilObject
 __construct (int $id=0, bool $reference=true)
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $desc)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static addNewItemGroupSeparator ()
 
static addNewItemGroup (array $a_titles)
 
static updateNewItemGroup (int $a_id, array $a_titles)
 
static deleteNewItemGroup (int $a_id)
 
static getNewItemGroups ()
 
static updateNewItemGroupOrder (array $a_order)
 
static getNewItemGroupSubItems ()
 
static getDefaultNewItemGrouping ()
 
static deleteObjectType (string $a_type)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Data Fields

const NEW_ITEM_GROUP_TYPE_GROUP = 1
 
const NEW_ITEM_GROUP_TYPE_SEPARATOR = 2
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Static Protected Member Functions

static getAllObjTypes ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
int $id
 
bool $referenced
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjRepositorySettings

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 24 of file class.ilObjRepositorySettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjRepositorySettings::__construct ( int  $a_id,
bool  $a_call_by_reference = true 
)

Definition at line 29 of file class.ilObjRepositorySettings.php.

References ILIAS\GlobalScreen\Provider\__construct().

30  {
31  $this->type = "reps";
32  parent::__construct($a_id, $a_call_by_reference);
33  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addNewItemGroup()

static ilObjRepositorySettings::addNewItemGroup ( array  $a_titles)
static

Definition at line 64 of file class.ilObjRepositorySettings.php.

References $DIC, $ilDB, and ILIAS\Repository\int().

Referenced by ilObjRepositorySettingsGUI\saveNewItemGroup().

64  : bool
65  {
66  global $DIC;
67 
68  $ilDB = $DIC->database();
69 
70  // append
71  $pos = $ilDB->query("SELECT max(pos) mpos FROM il_new_item_grp");
72  $pos = $ilDB->fetchAssoc($pos);
73  $pos = (int) $pos["mpos"];
74  $pos += 10;
75 
76  $seq = $ilDB->nextID("il_new_item_grp");
77 
78  $ilDB->manipulate("INSERT INTO il_new_item_grp" .
79  " (id, titles, pos, type) VALUES (" .
80  $ilDB->quote($seq, "integer") .
81  ", " . $ilDB->quote(serialize($a_titles), "text") .
82  ", " . $ilDB->quote($pos, "integer") .
83  ", " . $ilDB->quote(self::NEW_ITEM_GROUP_TYPE_GROUP, "integer") .
84  ")");
85  return true;
86  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addNewItemGroupSeparator()

static ilObjRepositorySettings::addNewItemGroupSeparator ( )
static

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

References $DIC, $ilDB, and ILIAS\Repository\int().

Referenced by ilObjRepositorySettingsGUI\addNewItemGroupSeparator().

41  : bool
42  {
43  global $DIC;
44 
45  $ilDB = $DIC->database();
46 
47  // append
48  $pos = $ilDB->query("SELECT max(pos) mpos FROM il_new_item_grp");
49  $pos = $ilDB->fetchAssoc($pos);
50  $pos = (int) $pos["mpos"];
51  $pos += 10;
52 
53  $seq = $ilDB->nextID("il_new_item_grp");
54 
55  $ilDB->manipulate("INSERT INTO il_new_item_grp" .
56  " (id, pos, type) VALUES (" .
57  $ilDB->quote($seq, "integer") .
58  ", " . $ilDB->quote($pos, "integer") .
59  ", " . $ilDB->quote(self::NEW_ITEM_GROUP_TYPE_SEPARATOR, "integer") .
60  ")");
61  return true;
62  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjRepositorySettings::delete ( )

Definition at line 35 of file class.ilObjRepositorySettings.php.

35  : bool
36  {
37  // DISABLED
38  return false;
39  }

◆ deleteNewItemGroup()

static ilObjRepositorySettings::deleteNewItemGroup ( int  $a_id)
static

Definition at line 100 of file class.ilObjRepositorySettings.php.

References $DIC, $ilDB, and $ilSetting.

Referenced by ilObjRepositorySettingsGUI\deleteNewItemGroup().

100  : bool
101  {
102  global $DIC;
103 
104  $ilDB = $DIC->database();
105  $ilSetting = $DIC->settings();
106 
107  // move subitems to unassigned
108  $sub_items = self::getNewItemGroupSubItems();
109  $sub_items = $sub_items[$a_id] ?? false;
110  if ($sub_items) {
111  foreach ($sub_items as $obj_type) {
112  $old_pos = $ilSetting->get("obj_add_new_pos_" . $obj_type);
113  if (strlen($old_pos) === 8) {
114  $new_pos = "9999" . substr($old_pos, 4);
115  $ilSetting->set("obj_add_new_pos_" . $obj_type, $new_pos);
116  $ilSetting->set("obj_add_new_pos_grp_" . $obj_type, '0');
117  }
118  }
119  }
120 
121  $ilDB->manipulate("DELETE FROM il_new_item_grp" .
122  " WHERE id = " . $ilDB->quote($a_id, "integer"));
123  return true;
124  }
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ deleteObjectType()

static ilObjRepositorySettings::deleteObjectType ( string  $a_type)
static

Definition at line 293 of file class.ilObjRepositorySettings.php.

References $DIC, and $ilSetting.

Referenced by ilRepUtil\deleteObjectType().

293  : void
294  {
295  global $DIC;
296 
297  $ilSetting = $DIC->settings();
298 
299  // see ilObjRepositorySettingsGUI::saveModules()
300  $ilSetting->delete("obj_dis_creation_" . $a_type);
301  $ilSetting->delete("obj_add_new_pos_" . $a_type);
302  $ilSetting->delete("obj_add_new_pos_grp_" . $a_type);
303  }
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ getAllObjTypes()

static ilObjRepositorySettings::getAllObjTypes ( )
staticprotected

Definition at line 179 of file class.ilObjRepositorySettings.php.

References $DIC, XapiProxy\$plugin, $res, and ilComponentInfo\TYPE_MODULES.

179  : array
180  {
181  global $DIC;
182 
183  $component_repository = $DIC["component.repository"];
184  $objDefinition = $DIC["objDefinition"];
185 
186  $res = [];
187 
188  // parse modules
189  foreach ($component_repository->getComponents() as $mod) {
190  if ($mod->getType() !== ilComponentInfo::TYPE_MODULES) {
191  continue;
192  }
193  $has_repo = false;
194  $rep_types = $objDefinition->getRepositoryObjectTypesForComponent(ilComponentInfo::TYPE_MODULES, $mod->getName());
195  if (count($rep_types) > 0) {
196  foreach ($rep_types as $ridx => $rt) {
197  // we only want to display repository modules
198  if ($rt["repository"]) {
199  $has_repo = true;
200  } else {
201  unset($rep_types[$ridx]);
202  }
203  }
204  }
205  if ($has_repo) {
206  foreach ($rep_types as $rt) {
207  $res[] = $rt["id"];
208  }
209  }
210  }
211 
212  // parse plugins
213  $pl_names = $component_repository->getPluginSlotById("robj")->getActivePlugins();
214  foreach ($pl_names as $plugin) {
215  $res[] = $plugin->getId();
216  }
217 
218  return $res;
219  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28

◆ getDefaultNewItemGrouping()

static ilObjRepositorySettings::getDefaultNewItemGrouping ( )
static

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

References $DIC, ilObject\$lng, $res, ilObject\$title, ilLanguage\getUserLanguage(), and ilLanguage\txt().

Referenced by ilObjectAddNewItemGUI\parseRepository().

237  : array
238  {
239  global $DIC;
240 
241  $lng = $DIC->language();
242 
243  $res = [];
244 
245  $groups = [
246  "organisation" => ["fold", "sess", "cat", "catr", "crs", "crsr", "grp", "grpr", "itgr", "book", "prg", "prgr"],
247  "communication" => ["frm", "chtr"],
248  "breaker1" => null,
249  "content" => ["file", "webr", "feed", "copa", "wiki", "blog", "lm", "htlm", "sahs", 'cmix', 'lti', "lso", "glo", "dcl", "bibl", "mcst", "mep"],
250  "breaker2" => null,
251  "assessment" => ["exc", "tst", "qpl", "iass"],
252  "feedback" => ["poll", "svy", "spl"],
253  "templates" => ["prtt"]
254  ];
255 
256  $pos = 0;
257  foreach ($groups as $group => $items) {
258  $pos += 10;
259  $grp_id = $pos / 10;
260 
261  if (is_array($items)) {
262  $title = $lng->txt("rep_add_new_def_grp_" . $group);
263 
264  $res["groups"][$grp_id] = [
265  "id" => $grp_id,
266  "titles" => [$lng->getUserLanguage() => $title],
267  "pos" => $pos,
268  "type" => self::NEW_ITEM_GROUP_TYPE_GROUP,
269  "title" => $title
270  ];
271 
272  foreach ($items as $idx => $item) {
273  $res["items"][$item] = $grp_id;
274  $res["sort"][$item] = str_pad((string) $pos, 4, "0", STR_PAD_LEFT) .
275  str_pad((string) ($idx + 1), 4, "0", STR_PAD_LEFT);
276  }
277  } else {
278  $title = "COL_SEP";
279 
280  $res["groups"][$grp_id] = [
281  "id" => $grp_id,
282  "titles" => [$lng->getUserLanguage() => $title],
283  "pos" => $pos,
284  "type" => self::NEW_ITEM_GROUP_TYPE_SEPARATOR,
285  "title" => $title
286  ];
287  }
288  }
289 
290  return $res;
291  }
string $title
$res
Definition: ltiservices.php:69
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...
getUserLanguage()
Return language of user.
global $DIC
Definition: feed.php:28
ilLanguage $lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewItemGroups()

static ilObjRepositorySettings::getNewItemGroups ( )
static

Definition at line 126 of file class.ilObjRepositorySettings.php.

References $DIC, $ilDB, $ilUser, ilObject\$lng, $res, ilObject\$title, ilLanguage\getDefaultLanguage(), and ilLanguage\txt().

Referenced by ilObjRepositorySettingsGUI\confirmDeleteNewItemGroup(), ilModulesTableGUI\getComponents(), ilNewItemGroupTableGUI\getGroups(), ilObjRepositorySettingsGUI\initNewItemGroupForm(), ilObjectAddNewItemGUI\parseRepository(), ilObjRepositorySettingsGUI\saveModules(), and ilObjRepositorySettingsGUI\saveNewItemGroupOrder().

126  : array
127  {
128  global $DIC;
129 
130  $ilDB = $DIC->database();
131  $lng = $DIC->language();
132  $ilUser = $DIC->user();
133 
134  $def_lng = $lng->getDefaultLanguage();
135  $usr_lng = $ilUser->getLanguage();
136 
137  $res = [];
138 
139  $set = $ilDB->query("SELECT * FROM il_new_item_grp ORDER BY pos");
140  while ($row = $ilDB->fetchAssoc($set)) {
141  if ((int) $row["type"] === self::NEW_ITEM_GROUP_TYPE_GROUP) {
142  $row["titles"] = unserialize($row["titles"], ["allowed_classes" => false]);
143 
144  $title = $row["titles"][$usr_lng] ?? "";
145  if ($title == "") {
146  $title = $row["titles"][$def_lng] ?? "";
147  }
148  if ($title == "") {
149  $title = array_shift($row["titles"]);
150  }
151  $row["title"] = $title;
152  } else {
153  $row["title"] = $lng->txt("rep_new_item_group_separator");
154  }
155 
156  $res[$row["id"]] = $row;
157  }
158 
159  return $res;
160  }
string $title
$res
Definition: ltiservices.php:69
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...
getDefaultLanguage()
Return default language.
global $DIC
Definition: feed.php:28
ilLanguage $lng
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewItemGroupSubItems()

static ilObjRepositorySettings::getNewItemGroupSubItems ( )
static

Definition at line 221 of file class.ilObjRepositorySettings.php.

References $DIC, $ilSetting, $res, and ilObject\$type.

Referenced by ilNewItemGroupTableGUI\getGroups(), ilObjectAddNewItemGUI\parseRepository(), and ilObjRepositorySettingsGUI\saveNewItemGroupOrder().

221  : array
222  {
223  global $DIC;
224 
225  $ilSetting = $DIC->settings();
226 
227  $res = [];
228 
229  foreach (self::getAllObjTypes() as $type) {
230  $pos_grp = $ilSetting->get("obj_add_new_pos_grp_" . $type, '0');
231  $res[$pos_grp][] = $type;
232  }
233 
234  return $res;
235  }
$res
Definition: ltiservices.php:69
string $type
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ updateNewItemGroup()

static ilObjRepositorySettings::updateNewItemGroup ( int  $a_id,
array  $a_titles 
)
static

Definition at line 88 of file class.ilObjRepositorySettings.php.

References $DIC, and $ilDB.

Referenced by ilObjRepositorySettingsGUI\updateNewItemGroup().

88  : bool
89  {
90  global $DIC;
91 
92  $ilDB = $DIC->database();
93 
94  $ilDB->manipulate("UPDATE il_new_item_grp" .
95  " SET titles = " . $ilDB->quote(serialize($a_titles), "text") .
96  " WHERE id = " . $ilDB->quote($a_id, "integer"));
97  return true;
98  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ updateNewItemGroupOrder()

static ilObjRepositorySettings::updateNewItemGroupOrder ( array  $a_order)
static

Definition at line 162 of file class.ilObjRepositorySettings.php.

References $DIC, ilObject\$id, and $ilDB.

Referenced by ilObjRepositorySettingsGUI\saveNewItemGroupOrder().

162  : void
163  {
164  global $DIC;
165 
166  $ilDB = $DIC->database();
167 
168  asort($a_order);
169  $pos = 0;
170  foreach (array_keys($a_order) as $id) {
171  $pos += 10;
172 
173  $ilDB->manipulate("UPDATE il_new_item_grp" .
174  " SET pos = " . $ilDB->quote($pos, "integer") .
175  " WHERE id = " . $ilDB->quote($id, "integer"));
176  }
177  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

Field Documentation

◆ NEW_ITEM_GROUP_TYPE_GROUP

const ilObjRepositorySettings::NEW_ITEM_GROUP_TYPE_GROUP = 1

◆ NEW_ITEM_GROUP_TYPE_SEPARATOR

const ilObjRepositorySettings::NEW_ITEM_GROUP_TYPE_SEPARATOR = 2

Definition at line 27 of file class.ilObjRepositorySettings.php.


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