31 $this->parent_ref_id = (int)$a_parent_ref_id;
34 $lng->loadLanguageModule(
"rep");
35 $lng->loadLanguageModule(
"cntr");
40 $this->mode = (int)$a_mode;
50 $this->disabled_object_types = $a_types;
60 $this->url_creation_callback = $a_ref_id;
70 $this->url_creation = $a_url;
84 $this->sub_objects = array();
86 $settings_map = array(
"blog" =>
"blogs",
88 "tstv" =>
"certificates",
89 "excv" =>
"certificates",
90 "crsv" =>
"certificates",
91 "scov" =>
"certificates",
95 if (count($subtypes) > 0)
97 foreach (array_keys($subtypes) as $type)
99 if (isset($settings_map[$type]) &&
100 $ilSetting->get(
"disable_wsp_".$settings_map[$type]))
105 $this->sub_objects[] = array(
"type" =>
"object",
107 "title" => $lng->txt(
"wsp_type_".$type));
123 global $objDefinition,
$lng, $ilAccess;
125 $this->sub_objects = array();
127 if(!is_array($this->disabled_object_types))
129 $this->disabled_object_types = array();
131 $this->disabled_object_types[] =
"rolf";
134 $subtypes = $objDefinition->getCreatableSubObjects($parent_type, $this->mode);
135 if (count($subtypes) > 0)
139 $grp_map = $pos_group_map = array();
141 include_once(
"Services/Repository/classes/class.ilObjRepositorySettings.php");
148 $groups = $default[
"groups"];
149 $grp_map = $default[
"items"];
153 foreach($subtypes as $item_type => $item)
156 if(substr($item_type, 0, 1) ==
"x")
158 $subtypes[$item_type][
"pos"] =
"99992000";
162 $subtypes[$item_type][
"pos"] =
"9999".str_pad(++$pos, 4,
"0", STR_PAD_LEFT);
167 foreach($default[
"sort"] as $item_type => $pos)
169 if(array_key_exists($item_type, $subtypes))
171 $subtypes[$item_type][
"pos"] = $pos;
183 foreach($subitems as $subitem)
185 $grp_map[$subitem] = $grp_id;
190 $group_separators = array();
191 $pos_group_map[0] = $lng->txt(
"rep_new_item_group_other");
192 $old_grp_ids = array();
193 foreach($groups as $item)
197 $pos_group_map[$item[
"id"]] = $item[
"title"];
199 else if(
sizeof($old_grp_ids))
201 $group_separators[$item[
"id"]] = $old_grp_ids;
203 $old_grp_ids[] = $item[
"id"];
207 foreach ($subtypes as $type => $subitem)
209 if (!in_array($type, $this->disabled_object_types))
212 if ($ilAccess->checkAccess(
"create_".$type,
"", $this->parent_ref_id, $parent_type))
215 if(
sizeof($pos_group_map) > 1)
217 $obj_grp_id = (int)$grp_map[$type];
218 if($obj_grp_id !== $current_grp)
222 foreach($group_separators as $idx => $spath)
225 if($current_grp && !in_array($obj_grp_id, $spath))
230 $this->sub_objects[] = array(
"type" =>
"column_separator");
233 unset($group_separators[$idx]);
237 $title = $pos_group_map[$obj_grp_id];
239 $this->sub_objects[] = array(
"type" =>
"group",
242 $current_grp = $obj_grp_id;
246 if ($subitem[
"plugin"])
248 include_once(
"./Services/Component/classes/class.ilPlugin.php");
254 $title = $lng->txt(
"obj_".$type);
257 $this->sub_objects[] = array(
"type" =>
"object",
279 $base_url =
"ilias.php?baseClass=ilRepositoryGUI&ref_id=".$this->parent_ref_id.
"&cmd=create";
285 $base_url = $ilCtrl->appendRequestTokenParameterString($base_url);
287 if($this->url_creation_callback)
289 $base_url .=
"&crtcb=".$this->url_creation_callback;
292 include_once(
"./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
295 foreach ($this->sub_objects as $item)
297 switch($item[
"type"])
299 case "column_separator":
310 $gl->addGroupHeader($item[
"title"]);
314 $type = $item[
"value"];
317 $icon = (
$path !=
"")
321 $url = $base_url .
"&new_type=".$type;
325 $gl->addEntry($icon.$item[
"title"], $url,
"_top",
"",
"",
326 $type, $ttip,
"bottom center",
"top center",
false);
332 return $gl->getHTML();
354 $ov_id =
"il_add_new_item_ov";
355 $ov_trigger_id = $ov_id.
"_tr";
357 include_once
"Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
364 $ov->addTrigger($ov_trigger_id,
"click", $ov_trigger_id,
false,
"tl",
"tr");
367 $ilToolbar->addButton($lng->txt(
"cntr_add_new_item"),
"#",
"",
"",
368 "", $ov_trigger_id,
'submit emphsubmit');
371 $tpl->setVariable(
"SELECT_OBJTYPE_REPOS",
372 '<div id="'.$ov_id.
'" style="display:none;" class="ilOverlay">'.
373 $this->getHTML().
'</div>');