Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(

$white = array();
foreach ($objDefinition->getSubObjectsRecursively("root") as $rtype) {
if ($rtype["name"] !== "itgr" && !$objDefinition->isSideBlock($rtype["name"])) {
if ($rtype["name"] !== "obgr" && !$objDefinition->isSideBlock($rtype["name"])) {
$white[] = $rtype["name"];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function insertCommand(array $body): Server\Response
$res->setResourceListType("_other");
} elseif ($res_type === "_lobj") {
$res->setResourceListType("_lobj");
} elseif ($res_type !== "itgr") {
} elseif ($res_type !== "obgr") {
if (isset($body["type"])) {
$res->setResourceListType(
$body["type"]
Expand All @@ -93,7 +93,7 @@ protected function insertCommand(array $body): Server\Response
}
} else {
$res->setItemGroupRefId(
(int) $body["itgr"]
(int) $body["obgr"]
);
}

Expand Down Expand Up @@ -121,7 +121,7 @@ protected function updateCommand(array $body): Server\Response
$res->setResourceListType("_other");
} elseif ($res_type === "_lobj") {
$res->setResourceListType("_lobj");
} elseif ($res_type !== "itgr") {
} elseif ($res_type !== "obgr") {
if (isset($body["type"])) {
$res->setResourceListType(
$body["type"]
Expand All @@ -131,7 +131,7 @@ protected function updateCommand(array $body): Server\Response
}
} else {
$res->setItemGroupRefId(
(int) $body["itgr"]
(int) $body["obgr"]
);
}

Expand Down
48 changes: 24 additions & 24 deletions components/ILIAS/COPage/PC/Resources/class.ilPCResourcesGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function initForm(bool $a_insert = false): ilPropertyFormGUI
$objDefinition = $this->obj_definition;

$op_type = null;
$op_itemgroup = null;
$op_objectgroup = null;

// edit form
$form = new ilPropertyFormGUI();
Expand All @@ -96,29 +96,29 @@ public function initForm(bool $a_insert = false): ilPropertyFormGUI
$form->setTitle($this->lng->txt("cont_update_resources"));
}

// count number of existing objects per type and collect item groups
// count number of existing objects per type and collect object groups
$ref_id = $this->requested_ref_id;
$childs = $this->rep_tree->getChilds($ref_id);

$type_counts = array();
$item_groups = array();
$object_groups = array();
foreach ($childs as $c) {
// see bug #12471
//echo "<br>-".$c["type"]."-".$objDefinition->getGroupOfObj($c["type"])."-";
$key = ($objDefinition->getGroupOfObj($c["type"]) != "")
? $objDefinition->getGroupOfObj($c["type"])
: $c["type"];
$type_counts[$key] = ($type_counts[$key] ?? 0) + 1;
if ($c["type"] == "itgr") {
$item_groups[$c["ref_id"]] = $c["title"];
if ($c["type"] == "obgr") {
$object_groups[$c["ref_id"]] = $c["title"];
}
}

// radio group for type selection
$radg = new ilRadioGroupInputGUI($lng->txt("cont_resources"), "res_type");
$form->addItem($radg);
if (!$a_insert && $this->content_obj->getMainType() == "ItemGroup") {
$radg->setValue("itgr");
$radg->setValue("obgr");
} else {
$radg->setValue("by_type");
}
Expand All @@ -129,9 +129,9 @@ public function initForm(bool $a_insert = false): ilPropertyFormGUI
//if ($this->supportsTypeBlocks()) {
//}

if ($this->supportsItemGroups() && count($item_groups) > 0) {
$op_itemgroup = new ilRadioOption($lng->txt("cont_manual_item_group"), "itgr", "");
$radg->addOption($op_itemgroup);
if ($this->supportsObjectGroups() && count($object_groups) > 0) {
$op_objectgroup = new ilRadioOption($lng->txt("cont_manual_object_group"), "obgr", "");
$radg->addOption($op_objectgroup);
}

$radg->addOption($op_type);
Expand All @@ -151,7 +151,7 @@ public function initForm(bool $a_insert = false): ilPropertyFormGUI
continue;
}
if (!$objDefinition->isPlugin($k)) {
if ($k != "itgr") {
if ($k != "obgr") {
$types[$k] = $this->lng->txt("objs_" . $k) . " (" . $cnt . ")";
}
} else {
Expand All @@ -166,18 +166,18 @@ public function initForm(bool $a_insert = false): ilPropertyFormGUI
$type_prop->setValue($selected);
$op_type->addSubItem($type_prop);

if ($this->supportsItemGroups() && count($item_groups) > 0) {
// item groups
$options = $item_groups;
if ($this->supportsObjectGroups() && count($object_groups) > 0) {
// object groups
$options = $object_groups;
asort($options);
$si = new ilSelectInputGUI($this->lng->txt("obj_itgr"), "itgr");
$si = new ilSelectInputGUI($this->lng->txt("obj_obgr"), "obgr");
$si->setOptions($options);
$selected = ($a_insert)
? ""
: $this->content_obj->getItemGroupRefId();
$op_itemgroup->addSubItem($si);
$op_objectgroup->addSubItem($si);
if ($a_insert) {
$radg->setValue("itgr");
$radg->setValue("obgr");
}
}

Expand Down Expand Up @@ -235,10 +235,10 @@ protected function getContainerViewManager(): \ILIAS\Container\Content\ViewManag
return $view_manager;
}

protected function supportsItemGroups(): bool
protected function supportsObjectGroups(): bool
{
foreach ($this->getContainerViewManager()->getBlockSequence()->getParts() as $part) {
if ($part instanceof \ILIAS\Container\Content\ItemGroupBlocks) {
if ($part instanceof \ILIAS\Container\Content\ObjectGroupBlocks) {
return true;
}
}
Expand Down Expand Up @@ -284,13 +284,13 @@ public function create(): void
$this->content_obj->setResourceListType("_other");
} elseif ($this->request->getString("res_type") === "_lobj") {
$this->content_obj->setResourceListType("_lobj");
} elseif ($this->request->getString("res_type") !== "itgr") {
} elseif ($this->request->getString("res_type") !== "obgr") {
$this->content_obj->setResourceListType(
$this->request->getString("type")
);
} else {
$this->content_obj->setItemGroupRefId(
$this->request->getString("itgr")
$this->request->getString("obgr")
);
}
$this->updated = $this->pg_obj->update();
Expand All @@ -307,13 +307,13 @@ public function update(): void
$this->content_obj->setResourceListType("_other");
} elseif ($this->request->getString("res_type") === "_lobj") {
$this->content_obj->setResourceListType("_lobj");
} elseif ($this->request->getString("res_type") !== "itgr") {
} elseif ($this->request->getString("res_type") !== "obgr") {
$this->content_obj->setResourceListType(
$this->request->getString("type")
);
} else {
$this->content_obj->setItemGroupRefId(
$this->request->getString("itgr")
$this->request->getString("obgr")
);
}
$this->updated = $this->pg_obj->update();
Expand Down Expand Up @@ -391,7 +391,7 @@ public static function insertResourcesIntoPageContent(
foreach ($block->getItemRefIds() as $ref_id) {
$data = $item_presentation_manager->getRawDataByRefId($ref_id);
if ($block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
if ($data["type"] === "itgr" || in_array($ref_id, $item_ref_ids)) {
if ($data["type"] === "obgr" || in_array($ref_id, $item_ref_ids)) {
continue;
}
}
Expand Down Expand Up @@ -485,7 +485,7 @@ public static function insertResourcesIntoPageContent(
$type = $block->getId();
$tpl->setVariable("HEADER", $lng->txt("objs_sess"));
$a_content = str_replace("[list-" . $type . "]", $tpl->get(), $a_content);
} elseif ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
} elseif ($block->getBlock() instanceof \ILIAS\Container\Content\ObjectGroupBlock) {
$id = $block->getId();
$tpl->setVariable("HEADER", \ilObject::_lookupTitle(
\ilObject::_lookupObjId((int) $id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
namespace ILIAS\Container\Content;

/**
* A block that holds a single item group
* A block that holds a single object group
* @author Alexander Killing <killing@leifos.de>
*/
class ItemGroupBlock implements Block
class ObjectGroupBlock implements Block
{
protected int $ref_id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
namespace ILIAS\Container\Content;

/**
* Represents all item groups of a container
* Represents all object groups of a container
* @author Alexander Killing <killing@leifos.de>
*/
class ItemGroupBlocks implements BlockSequencePart
class ObjectGroupBlocks implements BlockSequencePart
{
public function __construct()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(
public function getBlockSequence(): BlockSequence
{
$blocks = [];
$blocks[] = $this->data->itemGroupBlocks();
$blocks[] = $this->data->objectGroupBlocks();
$blocks[] = $this->data->typeBlocks();
return $this->data->blockSequence($blocks);
}
Expand Down
Loading
Loading