51 $this->
access = $DIC->access();
53 $this->
toolbar = $DIC->toolbar();
54 $this->ui_factory = $DIC->ui()->factory();
55 $ilCtrl = $DIC->ctrl();
56 $ilTabs = $DIC->tabs();
57 $lng = $DIC->language();
60 $this->
ctrl = $ilCtrl;
61 $this->tabs_gui = $ilTabs;
64 $this->
object = $a_parent_obj;
68 $this->
object->getId()
71 $this->request = $DIC->container()
76 $this->
lng->loadLanguageModule(
"crs");
77 $cs = $DIC->contentStyle();
78 $this->content_style_domain = $cs->domain()->styleForRefId($a_parent_obj->
getRefId());
79 $this->content_style_gui = $cs->gui();
84 switch ($this->
ctrl->getNextClass($this)) {
85 case "ilcontainerstartobjectspagegui":
87 $this->tabs_gui->clearTargets();
88 $this->tabs_gui->setBackTarget(
89 $this->
lng->txt(
"back"),
90 $this->
ctrl->getLinkTarget($this,
"listStructure")
96 $new_page_object->setParentId($this->
object->getId());
97 $new_page_object->setId($this->
object->getId());
98 $new_page_object->createFromXML();
99 unset($new_page_object);
102 $this->content_style_gui->addCss(
107 $this->
ctrl->setReturnByClass(
"ilcontainerstartobjectspagegui",
"edit");
110 $this->content_style_domain->getEffectiveStyleId()
113 $ret = $this->
ctrl->forwardCommand($pgui);
115 $this->tpl->setContent($ret);
120 $cmd = $this->
ctrl->getCmd(
"listStructure");
131 $ref_id = $this->
object->getRefId();
132 if (!$ilAccess->checkAccess($a_cmd,
"",
$ref_id)) {
133 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
138 public function setTabs(
string $a_active =
"manage"): void
142 $this->tabs_gui->addSubTab(
144 $this->
lng->txt(
"cntr_manage"),
145 $this->
ctrl->getLinkTarget($this,
"listStructure")
148 $this->tabs_gui->activateSubTab($a_active);
159 $ilToolbar->addButton(
160 $this->
lng->txt(
'crs_add_starter'),
161 $this->
ctrl->getLinkTarget($this,
'selectStarter')
165 if (
$ilSetting->get(
"enable_cat_page_edit")) {
166 $ilToolbar->addButton(
167 $this->
lng->txt(
"cntr_text_media_editor"),
168 $this->
ctrl->getLinkTargetByClass(
"ilContainerStartObjectsPageGUI",
"edit")
173 if ($table->handleCommand()) {
177 $this->tpl->setContent($table->render());
182 $builder =
new ObjectsTableBuilder(
189 return $builder->getTable();
195 $pos = $table->getData();
196 if (is_array($pos)) {
198 foreach ($pos as $start_id) {
200 $this->start_object->setObjectPos($start_id, $counter);
203 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cntr_saved_sorting'),
true);
206 $this->
ctrl->redirect($this,
"listStructure");
214 if (count($start_obj_ids) === 0) {
215 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
216 $this->
ctrl->redirect($this,
"listStructure");
224 $cgui->setFormAction($this->
ctrl->getFormAction($this,
"listStructure"));
225 $cgui->setHeaderText($this->
lng->txt(
"crs_starter_delete_sure"));
226 $cgui->setCancel($this->
lng->txt(
"cancel"),
"listStructure");
227 $cgui->setConfirm($this->
lng->txt(
"remove"),
"deleteStarter");
230 $all = $this->start_object->getStartObjects();
231 foreach ($start_obj_ids as $starter_id) {
236 $cgui->addItem(
"starter[]", (
string) $starter_id, $title, $icon, $alt);
239 $this->tpl->setContent($cgui->getHTML());
246 if (count($this->request->getStartObjIds()) === 0) {
247 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
249 foreach ($this->request->getStartObjIds() as $starter_id) {
250 $this->start_object->delete((
int) $starter_id);
253 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_starter_deleted'),
true);
256 $this->
ctrl->redirect($this,
"listStructure");
265 if ($table->handleCommand()) {
269 $this->tpl->setContent($table->render());
274 $builder =
new PossibleObjectsTableBuilder(
281 return $builder->getTable();
291 if (count($selected_ref_ids) === 0) {
292 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
293 $this->
ctrl->redirect($this,
"selectStarter");
297 foreach ($selected_ref_ids as $item_ref_id) {
298 if (!$this->start_object->exists($item_ref_id)) {
300 $this->start_object->add($item_ref_id);
304 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_added_starters'),
true);
305 $this->
ctrl->redirect($this,
"listStructure");
307 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'crs_starters_already_assigned'),
true);
308 $this->
ctrl->redirect($this,
"selectStarter");
Container start objects page GUI class.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Style Content GUIService $content_style_gui
buildPossibleObjectsTable()
ILIAS Style Content Object ObjectFacade $content_style_domain
Container start objects page object.
addStarter(array $selected_ref_ids)
setStyleId(int $a_styleid)
__construct(ilObject $a_parent_obj)
askDeleteStarter(array $start_obj_ids)
static _lookupObjId(int $ref_id)
ilGlobalTemplateInterface $tpl
static _lookupTitle(int $obj_id)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
checkPermission(string $a_cmd)
static redirect(string $a_script)
StandardGUIRequest $request
ilContainerStartObjects $start_object
setTabs(string $a_active="manage")
static _lookupType(int $id, bool $reference=false)
Class ilContainerStartObjectsGUI.