38 $this->
ctrl = $DIC->ctrl();
39 $this->tpl =
$DIC[
"tpl"];
40 $this->
lng = $DIC->language();
41 $this->obj_definition =
$DIC[
"objDefinition"];
42 $tree =
$DIC->repositoryTree();
44 $this->rep_tree = $tree;
46 $this->container_domain =
$DIC->container()->internal()->domain();
54 $next_class = $this->
ctrl->getNextClass($this);
57 $cmd = $this->
ctrl->getCmd();
59 switch ($next_class) {
71 public function edit(
bool $a_insert =
false): void
76 $html = $form->getHTML();
92 $form->setFormAction($ilCtrl->getFormAction($this));
94 $form->setTitle($this->
lng->txt(
"cont_insert_resources"));
96 $form->setTitle($this->
lng->txt(
"cont_update_resources"));
101 $childs = $this->rep_tree->getChilds(
$ref_id);
103 $type_counts = array();
104 $item_groups = array();
105 foreach ($childs as
$c) {
108 $key = ($objDefinition->getGroupOfObj(
$c[
"type"]) !=
"")
109 ? $objDefinition->getGroupOfObj(
$c[
"type"])
111 $type_counts[$key] = ($type_counts[$key] ?? 0) + 1;
112 if (
$c[
"type"] ==
"itgr") {
113 $item_groups[
$c[
"ref_id"]] =
$c[
"title"];
119 $form->addItem($radg);
120 if (!$a_insert && $this->content_obj->getMainType() ==
"ItemGroup") {
121 $radg->setValue(
"itgr");
123 $radg->setValue(
"by_type");
134 $radg->addOption($op_itemgroup);
137 $radg->addOption($op_type);
141 $this->
lng->txt(
"cont_type"),
146 $sub_objs = $objDefinition->getGroupedRepositoryObjectTypes($obj_type);
148 foreach ($sub_objs as $k => $so) {
149 $cnt = (
int) ($type_counts[$k] ?? 0);
153 if (!$objDefinition->isPlugin($k)) {
155 $types[$k] = $this->
lng->txt(
"objs_" . $k) .
" (" . $cnt .
")";
159 $types[$k] = $pl->txt(
"objs_" . $k) .
" (" . $cnt .
")";
162 $type_prop->setOptions($types);
163 $selected = ($a_insert)
165 : $this->content_obj->getResourceListType();
166 $type_prop->setValue($selected);
167 $op_type->addSubItem($type_prop);
175 $selected = ($a_insert)
177 : $this->content_obj->getItemGroupRefId();
178 $op_itemgroup->addSubItem($si);
180 $radg->setValue(
"itgr");
188 $radg->addOption($op_lobj);
189 if (!$a_insert && $this->content_obj->getResourceListType() ===
"_lobj") {
190 $radg->setValue(
"_lobj");
197 $radg->addOption($op_other);
198 if (!$a_insert && $this->content_obj->getResourceListType() ===
"_other") {
199 $radg->setValue(
"_other");
205 $form->addCommandButton(
"create",
$lng->
txt(
"save"));
206 $form->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
208 $form->addCommandButton(
"update_resources",
$lng->
txt(
"save"));
209 $form->addCommandButton(
"cancelUpdate",
$lng->
txt(
"cancel"));
234 $view_manager = $this->container_domain->content()->view(
$container);
235 return $view_manager;
241 if ($part instanceof \
ILIAS\Container\Content\ItemGroupBlocks) {
251 if ($part instanceof \
ILIAS\Container\Content\OtherBlock) {
261 if ($part instanceof \
ILIAS\Container\Content\ObjectivesBlock) {
271 if ($part instanceof \
ILIAS\Container\Content\TypeBlocks) {
281 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
283 if ($this->request->getString(
"res_type") ===
"_other") {
284 $this->content_obj->setResourceListType(
"_other");
285 } elseif ($this->request->getString(
"res_type") ===
"_lobj") {
286 $this->content_obj->setResourceListType(
"_lobj");
287 } elseif ($this->request->getString(
"res_type") !==
"itgr") {
288 $this->content_obj->setResourceListType(
289 $this->request->getString(
"type")
292 $this->content_obj->setItemGroupRefId(
293 $this->request->getString(
"itgr")
296 $this->updated = $this->pg_obj->update();
297 if ($this->updated ===
true) {
298 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
306 if ($this->request->getString(
"res_type") ===
"_other") {
307 $this->content_obj->setResourceListType(
"_other");
308 } elseif ($this->request->getString(
"res_type") ===
"_lobj") {
309 $this->content_obj->setResourceListType(
"_lobj");
310 } elseif ($this->request->getString(
"res_type") !==
"itgr") {
311 $this->content_obj->setResourceListType(
312 $this->request->getString(
"type")
315 $this->content_obj->setItemGroupRefId(
316 $this->request->getString(
"itgr")
319 $this->updated = $this->pg_obj->update();
320 if ($this->updated ===
true) {
321 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
323 $this->pg_obj->addHierIDs();
339 $item_presentation_manager =
$DIC->container()->internal()
347 $block_sequence = $item_presentation_manager->getItemBlockSequence();
348 foreach ($block_sequence->getBlocks() as $block) {
349 if (($block->getBlock() instanceof \
ILIAS\Container\Content\OtherBlock)) {
375 $item_presentation_manager =
$DIC->container()->internal()
382 $block_sequence = $item_presentation_manager->getItemBlockSequence();
384 foreach ($block_sequence->getBlocks() as $block) {
386 $tpl =
new ilTemplate(
"tpl.resource_block.html",
true,
true,
"components/ILIAS/COPage");
389 if (!($block->getBlock() instanceof \
ILIAS\Container\Content\ObjectivesBlock) &&
390 count($block->getItemRefIds()) > 0) {
391 foreach ($block->getItemRefIds() as
$ref_id) {
392 $data = $item_presentation_manager->getRawDataByRefId(
$ref_id);
393 if ($block->getBlock() instanceof \
ILIAS\Container\Content\OtherBlock) {
394 if (
$data[
"type"] ===
"itgr" || in_array(
$ref_id, $item_ref_ids)) {
434 } elseif (count($block->getObjectiveIds()) > 0) {
435 foreach ($block->getObjectiveIds() as $objective_id) {
472 if ($block->getBlock() instanceof \
ILIAS\Container\Content\TypeBlock) {
473 $type = $block->getId();
476 $title =
$lng->
txt(
"objs_" . $type);
479 $title = $pl->txt(
"objs_" . $type);
483 $a_content = str_replace(
"[list-" . $type .
"]",
$tpl->
get(), $a_content);
484 } elseif ($block->getBlock() instanceof \
ILIAS\Container\Content\SessionBlock) {
485 $type = $block->getId();
487 $a_content = str_replace(
"[list-" . $type .
"]",
$tpl->
get(), $a_content);
488 } elseif ($block->getBlock() instanceof \
ILIAS\Container\Content\ItemGroupBlock) {
489 $id = $block->getId();
493 $a_content = str_replace(
"[item-group-" .
$id .
"]",
$tpl->
get(), $a_content);
494 } elseif ($block->getBlock() instanceof \
ILIAS\Container\Content\ObjectivesBlock) {
495 $id = $block->getId();
497 $a_content = str_replace(
"[list-_lobj]",
$tpl->
get(), $a_content);
498 } elseif ($block->getBlock() instanceof \
ILIAS\Container\Content\OtherBlock) {
499 $id = $block->getId();
501 $a_content = str_replace(
"[list-_other]",
$tpl->
get(), $a_content);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
loadLanguageModule(string $a_module)
Load language module.
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...
parses the objects.xml it handles the xml-description of all ilias objects
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjectDefinition $obj_definition
static insertResourcesIntoPageContent(string $a_content)
Insert resources (see also ilContainerContentGUI::determinePageEmbeddedBlocks for presentation)
edit(bool $a_insert=false)
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
ILIAS Container InternalDomainService $container_domain
getContainerViewManager()
initForm(bool $a_insert=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
ilGlobalTemplateInterface $tpl
Content object of ilPageObject (see ILIAS DTD).
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.