3 declare(strict_types=1);
48 $this->
lng = $DIC->language();
49 $this->obj_definition = $DIC[
"objDefinition"];
51 $this->
access = $DIC->access();
52 $this->
ctrl = $DIC->ctrl();
53 $this->
toolbar = $DIC->toolbar();
54 $this->tpl = $DIC[
"tpl"];
59 $this->
lng->loadLanguageModule(
"rep");
60 $this->
lng->loadLanguageModule(
"cntr");
73 $this->disabled_object_types = $types;
81 $this->url_creation_callback =
$ref_id;
89 $this->url_creation =
$url;
103 $this->sub_objects = array();
112 if (count($subtypes) > 0) {
113 foreach (array_keys($subtypes) as
$type) {
114 if (isset($settings_map[$type]) &&
115 $ilSetting->get(
"disable_wsp_" . $settings_map[$type])) {
119 $this->sub_objects[] = array(
"type" =>
"object",
121 "title" => $lng->
txt(
"wsp_type_" . $type));
139 $this->sub_objects = array();
141 if (!is_array($this->disabled_object_types)) {
142 $this->disabled_object_types = array();
144 $this->disabled_object_types[] =
"rolf";
147 $subtypes = $objDefinition->getCreatableSubObjects($parent_type, $this->mode, $this->parent_ref_id);
148 if (count($subtypes) > 0) {
151 $grp_map = $pos_group_map = array();
158 $groups = $default[
"groups"];
159 $grp_map = $default[
"items"];
163 foreach ($subtypes as $item_type => $item) {
165 if (substr($item_type, 0, 1) ==
"x") {
166 $subtypes[$item_type][
"pos"] =
"99992000";
168 $subtypes[$item_type][
"pos"] =
"9999" . str_pad((
string) ++$pos, 4,
"0", STR_PAD_LEFT);
173 foreach ($default[
"sort"] as $item_type => $pos) {
174 if (array_key_exists($item_type, $subtypes)) {
175 $subtypes[$item_type][
"pos"] = $pos;
185 foreach ($subitems as $subitem) {
186 $grp_map[$subitem] = $grp_id;
191 $group_separators = array();
192 $pos_group_map[0] = $lng->
txt(
"rep_new_item_group_other");
193 $old_grp_ids = array();
194 foreach ($groups as $item) {
196 $pos_group_map[$item[
"id"]] = $item[
"title"];
197 } elseif (
sizeof($old_grp_ids)) {
198 $group_separators[$item[
"id"]] = $old_grp_ids;
200 $old_grp_ids[] = $item[
"id"];
204 foreach ($subtypes as
$type => $subitem) {
205 if (!in_array(
$type, $this->disabled_object_types)) {
207 if ($ilAccess->checkAccess(
"create_" .
$type,
"", $this->parent_ref_id, $parent_type)) {
209 if (
sizeof($pos_group_map) > 1) {
211 if (array_key_exists(
$type, $grp_map)) {
212 $obj_grp_id = (
int) $grp_map[
$type];
214 if ($obj_grp_id !== $current_grp) {
217 foreach ($group_separators as $idx => $spath) {
219 if ($current_grp && !in_array($obj_grp_id, $spath)) {
222 $this->sub_objects[] = array(
"type" =>
"column_separator");
225 unset($group_separators[$idx]);
229 $title = $pos_group_map[$obj_grp_id];
231 $this->sub_objects[] = array(
"type" =>
"group",
234 $current_grp = $obj_grp_id;
238 if (isset($subitem[
"plugin"]) && $subitem[
"plugin"]) {
245 $this->sub_objects[] = array(
"type" =>
"object",
262 $base_url =
"ilias.php?baseClass=ilRepositoryGUI&ref_id=" . $this->parent_ref_id .
"&cmd=create";
270 if ($this->url_creation_callback) {
277 foreach ($this->sub_objects as $item) {
278 switch ($item[
"type"]) {
279 case "column_separator":
286 $type = $item[
"value"];
292 $icon . $item[
"title"],
326 $adv->setPullRight(
false);
327 $adv->setListTitle($this->
lng->txt(
"cntr_add_new_item"));
329 $adv->setGroupedList($this->gl);
331 $this->
toolbar->addStickyItem($adv);
static getObjCreationTooltipText(string $a_type)
Get object_creation tooltip tab text.
ilGlobalTemplateInterface $tpl
setAfterCreationCallback(int $ref_id)
Set after creation callback.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
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...
setCreationUrl(string $url)
Set (custom) url for object creation.
static getNewItemGroups()
setDisabledObjectTypes(array $types)
Set object types which may not be created.
static getNewItemGroupSubItems()
addEntry(string $a_content, string $a_href="", string $a_target="", string $a_onclick="", string $a_add_class="", string $a_id="", string $a_ttip="", string $a_tt_my="right center", string $a_tt_at="left center", bool $a_tt_use_htmlspecialchars=true)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
parses the objects.xml it handles the xml-description of all ilias objects
parseRepository()
Parse creatable sub objects for repository incl.
__construct(int $parent_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getHTML()
Get rendered html of sub object list.
static getDefaultNewItemGrouping()
int $url_creation_callback
static lookupTxtById(string $plugin_id, string $lang_var)
array $disabled_object_types
parsePersonalWorkspace()
Parse creatable sub objects for personal workspace.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
render()
Add new item selection to current page incl.
setAsDropDown(bool $a_val, bool $a_pullright=false)
addGroupHeader(string $a_content, string $a_add_class="")
static _lookupType(int $id, bool $reference=false)
const NEW_ITEM_GROUP_TYPE_GROUP
ilObjectDefinition $obj_definition
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)