29 public function __construct(
int $a_id,
bool $a_call_by_reference =
true)
35 public function delete():
bool 45 $ilDB = $DIC->database();
48 $pos =
$ilDB->query(
"SELECT max(pos) mpos FROM il_new_item_grp");
49 $pos =
$ilDB->fetchAssoc($pos);
50 $pos = (
int) $pos[
"mpos"];
53 $seq =
$ilDB->nextID(
"il_new_item_grp");
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") .
68 $ilDB = $DIC->database();
71 $pos =
$ilDB->query(
"SELECT max(pos) mpos FROM il_new_item_grp");
72 $pos =
$ilDB->fetchAssoc($pos);
73 $pos = (
int) $pos[
"mpos"];
76 $seq =
$ilDB->nextID(
"il_new_item_grp");
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") .
92 $ilDB = $DIC->database();
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"));
104 $ilDB = $DIC->database();
108 $sub_items = self::getNewItemGroupSubItems();
109 $sub_items = $sub_items[$a_id] ??
false;
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');
121 $ilDB->manipulate(
"DELETE FROM il_new_item_grp" .
122 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
130 $ilDB = $DIC->database();
131 $lng = $DIC->language();
135 $usr_lng =
$ilUser->getLanguage();
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]);
144 $title = $row[
"titles"][$usr_lng] ??
"";
146 $title = $row[
"titles"][$def_lng] ??
"";
149 $title = array_shift($row[
"titles"]);
153 $row[
"title"] =
$lng->
txt(
"rep_new_item_group_separator");
156 $res[$row[
"id"]] = $row;
166 $ilDB = $DIC->database();
170 foreach (array_keys($a_order) as
$id) {
173 $ilDB->manipulate(
"UPDATE il_new_item_grp" .
174 " SET pos = " .
$ilDB->quote($pos,
"integer") .
175 " WHERE id = " .
$ilDB->quote($id,
"integer"));
183 $component_repository = $DIC[
"component.repository"];
184 $objDefinition = $DIC[
"objDefinition"];
189 foreach ($component_repository->getComponents() as $mod) {
195 if (count($rep_types) > 0) {
196 foreach ($rep_types as $ridx => $rt) {
198 if ($rt[
"repository"]) {
201 unset($rep_types[$ridx]);
206 foreach ($rep_types as $rt) {
213 $pl_names = $component_repository->getPluginSlotById(
"robj")->getActivePlugins();
214 foreach ($pl_names as
$plugin) {
215 $res[] = $plugin->getId();
229 foreach (self::getAllObjTypes() as
$type) {
230 $pos_grp =
$ilSetting->get(
"obj_add_new_pos_grp_" . $type,
'0');
241 $lng = $DIC->language();
246 "organisation" => [
"fold",
"sess",
"cat",
"catr",
"crs",
"crsr",
"grp",
"grpr",
"itgr",
"book",
"prg",
"prgr"],
247 "communication" => [
"frm",
"chtr"],
249 "content" => [
"file",
"webr",
"feed",
"copa",
"wiki",
"blog",
"lm",
"htlm",
"sahs",
'cmix',
'lti',
"lso",
"glo",
"dcl",
"bibl",
"mcst",
"mep"],
251 "assessment" => [
"exc",
"tst",
"qpl",
"iass"],
252 "feedback" => [
"poll",
"svy",
"spl"],
253 "templates" => [
"prtt"]
257 foreach ($groups as $group => $items) {
261 if (is_array($items)) {
264 $res[
"groups"][$grp_id] = [
268 "type" => self::NEW_ITEM_GROUP_TYPE_GROUP,
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);
280 $res[
"groups"][$grp_id] = [
284 "type" => self::NEW_ITEM_GROUP_TYPE_SEPARATOR,
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);
static addNewItemGroupSeparator()
__construct(int $a_id, bool $a_call_by_reference=true)
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.
getDefaultLanguage()
Return default language.
static getNewItemGroups()
static getNewItemGroupSubItems()
static deleteObjectType(string $a_type)
const NEW_ITEM_GROUP_TYPE_SEPARATOR
static deleteNewItemGroup(int $a_id)
static updateNewItemGroup(int $a_id, array $a_titles)
static getDefaultNewItemGrouping()
static updateNewItemGroupOrder(array $a_order)
static addNewItemGroup(array $a_titles)
__construct(Container $dic, ilPlugin $plugin)
const NEW_ITEM_GROUP_TYPE_GROUP
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...