3 require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
32 $this->parent_ref_id = (int)$a_parent_ref_id;
35 $lng->loadLanguageModule(
"rep");
36 $lng->loadLanguageModule(
"cntr");
41 $this->mode = (int)$a_mode;
51 $this->disabled_object_types = $a_types;
61 $this->url_creation_callback = $a_ref_id;
71 $this->url_creation = $a_url;
85 $this->sub_objects =
array();
87 $settings_map =
array(
"blog" =>
"blogs",
89 "tstv" =>
"certificates",
90 "excv" =>
"certificates",
91 "crsv" =>
"certificates",
92 "scov" =>
"certificates",
96 if (count($subtypes) > 0)
98 foreach (array_keys($subtypes) as $type)
100 if (isset($settings_map[$type]) &&
101 $ilSetting->get(
"disable_wsp_".$settings_map[$type]))
106 $this->sub_objects[] =
array(
"type" =>
"object",
108 "title" => $lng->txt(
"wsp_type_".$type));
124 global $objDefinition,
$lng, $ilAccess;
126 $this->sub_objects =
array();
128 if(!is_array($this->disabled_object_types))
130 $this->disabled_object_types =
array();
132 $this->disabled_object_types[] =
"rolf";
135 $subtypes = $objDefinition->getCreatableSubObjects($parent_type, $this->mode, $this->parent_ref_id);
136 if (count($subtypes) > 0)
140 $grp_map = $pos_group_map =
array();
142 include_once(
"Services/Repository/classes/class.ilObjRepositorySettings.php");
149 $groups = $default[
"groups"];
150 $grp_map = $default[
"items"];
154 foreach($subtypes as $item_type => $item)
157 if(substr($item_type, 0, 1) ==
"x")
159 $subtypes[$item_type][
"pos"] =
"99992000";
163 $subtypes[$item_type][
"pos"] =
"9999".str_pad(++$pos, 4,
"0", STR_PAD_LEFT);
168 foreach($default[
"sort"] as $item_type => $pos)
170 if(array_key_exists($item_type, $subtypes))
172 $subtypes[$item_type][
"pos"] = $pos;
184 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)
198 $pos_group_map[$item[
"id"]] = $item[
"title"];
200 else if(
sizeof($old_grp_ids))
202 $group_separators[$item[
"id"]] = $old_grp_ids;
204 $old_grp_ids[] = $item[
"id"];
208 foreach ($subtypes as $type => $subitem)
210 if (!in_array($type, $this->disabled_object_types))
213 if ($ilAccess->checkAccess(
"create_".$type,
"", $this->parent_ref_id, $parent_type))
216 if(
sizeof($pos_group_map) > 1)
218 $obj_grp_id = (int)$grp_map[$type];
219 if($obj_grp_id !== $current_grp)
223 foreach($group_separators as $idx => $spath)
226 if($current_grp && !in_array($obj_grp_id, $spath))
231 $this->sub_objects[] =
array(
"type" =>
"column_separator");
234 unset($group_separators[$idx]);
238 $title = $pos_group_map[$obj_grp_id];
240 $this->sub_objects[] =
array(
"type" =>
"group",
243 $current_grp = $obj_grp_id;
247 if ($subitem[
"plugin"])
249 include_once(
"./Services/Component/classes/class.ilPlugin.php");
255 $title = $lng->txt(
"obj_".$type);
258 $this->sub_objects[] =
array(
"type" =>
"object",
280 $base_url =
"ilias.php?baseClass=ilRepositoryGUI&ref_id=".$this->parent_ref_id.
"&cmd=create";
286 $base_url = $ilCtrl->appendRequestTokenParameterString($base_url);
288 if($this->url_creation_callback)
290 $base_url .=
"&crtcb=".$this->url_creation_callback;
293 include_once(
"./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
295 $gl->setAsDropDown(
true,
true);
297 foreach ($this->sub_objects as $item)
299 switch($item[
"type"])
301 case "column_separator":
312 $gl->addGroupHeader($item[
"title"]);
316 $type = $item[
"value"];
319 $icon = (
$path !=
"")
323 $url = $base_url .
"&new_type=".$type;
327 $gl->addEntry($icon.$item[
"title"],
$url,
"_top",
"",
"",
328 $type, $ttip,
"bottom center",
"top center",
false);
335 return $gl->getHTML();
357 $ov_id =
"il_add_new_item_ov";
358 $ov_trigger_id = $ov_id.
"_tr";
361 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
363 $adv->setListTitle($lng->txt(
"cntr_add_new_item"));
365 $adv->setGroupedList($this->gl);
367 $tpl->setVariable(
"SELECT_OBJTYPE_REPOS", $adv->getHTML());
373 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
375 $button->setId($ov_trigger_id);
376 $button->setCaption(
"cntr_add_new_item");
377 $button->setPrimary(
true);
378 $ilToolbar->addButtonInstance($button);
381 $tpl->setVariable(
"SELECT_OBJTYPE_REPOS",
382 '<div id="'.$ov_id.
'" style="display:none;" class="ilOverlay">'.
383 $this->getHTML().
'</div>');
setCreationUrl($a_url)
Set (custom) url for object creation.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static lookupTxtById($plugin_id, $lang_var)
static getNewItemGroups()
static getNewItemGroupSubItems()
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
parseRepository()
Parse creatable sub objects for repository incl.
getHTML()
Get rendered html of sub object list.
static getDefaultNewItemGrouping()
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static getObjCreationTooltipText($a_type)
Get object_creation tooltip tab text.
setDisabledObjectTypes(array $a_types)
Set object types which may not be created.
User interface class for advanced drop-down selection lists.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
parsePersonalWorkspace()
Parse creatable sub objects for personal workspace.
Render add new item selector.
__construct($a_parent_ref_id)
Constructor.
render()
Add new item selection to current page incl.
setAfterCreationCallback($a_ref_id)
Set after creation callback.
const NEW_ITEM_GROUP_TYPE_GROUP