3 require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
67 $this->lng = $DIC->language();
68 $this->obj_definition = $DIC[
"objDefinition"];
70 $this->access = $DIC->access();
71 $this->ctrl = $DIC->ctrl();
72 $this->toolbar = $DIC->toolbar();
73 $this->tpl = $DIC[
"tpl"];
74 $lng = $DIC->language();
76 $this->parent_ref_id = (int) $a_parent_ref_id;
79 $lng->loadLanguageModule(
"rep");
80 $lng->loadLanguageModule(
"cntr");
85 $this->mode = (int) $a_mode;
95 $this->disabled_object_types = $a_types;
105 $this->url_creation_callback = $a_ref_id;
115 $this->url_creation = $a_url;
131 $this->sub_objects = array();
140 if (count($subtypes) > 0) {
141 foreach (array_keys($subtypes) as
$type) {
142 if (isset($settings_map[$type]) &&
143 $ilSetting->get(
"disable_wsp_" . $settings_map[$type])) {
147 $this->sub_objects[] = array(
"type" =>
"object",
149 "title" =>
$lng->txt(
"wsp_type_" . $type));
169 $this->sub_objects = array();
171 if (!is_array($this->disabled_object_types)) {
172 $this->disabled_object_types = array();
174 $this->disabled_object_types[] =
"rolf";
177 $subtypes = $objDefinition->getCreatableSubObjects($parent_type, $this->mode, $this->parent_ref_id);
178 if (count($subtypes) > 0) {
181 $grp_map = $pos_group_map = array();
183 include_once(
"Services/Repository/classes/class.ilObjRepositorySettings.php");
189 $groups = $default[
"groups"];
190 $grp_map = $default[
"items"];
194 foreach ($subtypes as $item_type => $item) {
196 if (substr($item_type, 0, 1) ==
"x") {
197 $subtypes[$item_type][
"pos"] =
"99992000";
199 $subtypes[$item_type][
"pos"] =
"9999" . str_pad(++$pos, 4,
"0", STR_PAD_LEFT);
204 foreach ($default[
"sort"] as $item_type => $pos) {
205 if (array_key_exists($item_type, $subtypes)) {
206 $subtypes[$item_type][
"pos"] = $pos;
216 foreach ($subitems as $subitem) {
217 $grp_map[$subitem] = $grp_id;
222 $group_separators = array();
223 $pos_group_map[0] =
$lng->txt(
"rep_new_item_group_other");
224 $old_grp_ids = array();
225 foreach ($groups as $item) {
227 $pos_group_map[$item[
"id"]] = $item[
"title"];
228 } elseif (
sizeof($old_grp_ids)) {
229 $group_separators[$item[
"id"]] = $old_grp_ids;
231 $old_grp_ids[] = $item[
"id"];
235 foreach ($subtypes as
$type => $subitem) {
236 if (!in_array(
$type, $this->disabled_object_types)) {
238 if ($ilAccess->checkAccess(
"create_" .
$type,
"", $this->parent_ref_id, $parent_type)) {
240 if (
sizeof($pos_group_map) > 1) {
241 $obj_grp_id = (int) $grp_map[
$type];
242 if ($obj_grp_id !== $current_grp) {
245 foreach ($group_separators as $idx => $spath) {
247 if ($current_grp && !in_array($obj_grp_id, $spath)) {
250 $this->sub_objects[] = array(
"type" =>
"column_separator");
253 unset($group_separators[$idx]);
257 $title = $pos_group_map[$obj_grp_id];
259 $this->sub_objects[] = array(
"type" =>
"group",
262 $current_grp = $obj_grp_id;
266 if ($subitem[
"plugin"]) {
267 include_once(
"./Services/Component/classes/class.ilPlugin.php");
274 $this->sub_objects[] = array(
"type" =>
"object",
295 $base_url =
"ilias.php?baseClass=ilRepositoryGUI&ref_id=" . $this->parent_ref_id .
"&cmd=create";
299 $base_url = $ilCtrl->appendRequestTokenParameterString($base_url);
301 if ($this->url_creation_callback) {
305 include_once(
"./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
307 $gl->setAsDropDown(
true,
false);
309 foreach ($this->sub_objects as $item) {
310 switch ($item[
"type"]) {
311 case "column_separator":
322 $gl->addGroupHeader($item[
"title"]);
326 $type = $item[
"value"];
329 $icon = ($path !=
"")
338 $icon . $item[
"title"],
355 return $gl->getHTML();
375 $ov_id =
"il_add_new_item_ov";
376 $ov_trigger_id = $ov_id .
"_tr";
379 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
381 $adv->setPullRight(
false);
382 $adv->setListTitle(
$lng->txt(
"cntr_add_new_item"));
384 $adv->setGroupedList($this->gl);
387 $ilToolbar->addStickyItem($adv);
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 sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static lookupTxtById($plugin_id, $lang_var)
static getNewItemGroups()
static getNewItemGroupSubItems()
parseRepository()
Parse creatable sub objects for repository incl.
getHTML()
Get rendered html of sub object list.
static getDefaultNewItemGrouping()
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
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.
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