34 protected \ILIAS\COPage\InternalDomainService
$domain;
47 $this->
ctrl = $DIC->ctrl();
48 $ilToolbar =
$DIC->toolbar();
49 $ilTabs =
$DIC->tabs();
52 $this->
tabs = $ilTabs;
53 $this->domain =
$DIC->copage()->internal()->domain();
60 $next_class = $this->
ctrl->getNextClass($this);
63 $cmd = $this->
ctrl->getCmd();
65 switch ($next_class) {
76 if ($this->
ctrl->getCmd() ==
"create") {
77 $form->setValuesByPost();
79 $this->tpl->setContent($form->getHTML());
103 $form->setFormAction($this->
ctrl->getFormAction($this));
104 $form->setTitle($this->
lng->txt(
"cont_ed_insert_grid"));
105 $form->setDescription($this->
lng->txt(
"cont_ed_insert_grid_info"));
109 $radg->setValue(self::TEMPLATE_TWO_COLUMN);
110 $op1 =
new ilRadioOption(
$lng->
txt(
"cont_grid_t_two_column"), self::TEMPLATE_TWO_COLUMN,
$lng->
txt(
"cont_grid_t_two_column_info"));
111 $radg->addOption($op1);
112 $op2 =
new ilRadioOption(
$lng->
txt(
"cont_grid_t_three_column"), self::TEMPLATE_THREE_COLUMN,
$lng->
txt(
"cont_grid_t_three_column_info"));
113 $radg->addOption($op2);
115 $radg->addOption($op3);
116 $op4 =
new ilRadioOption(
$lng->
txt(
"cont_grid_t_two_by_two"), self::TEMPLATE_TWO_BY_TWO,
$lng->
txt(
"cont_grid_t_two_by_two_info"));
117 $radg->addOption($op4);
119 $radg->addOption($op5);
120 $form->addItem($radg);
125 $ni->setMaxLength(2);
127 $op5->addSubItem($ni);
139 $si->setInfo($this->
lng->txt(
"cont_grid_width_" . $s .
"_info"));
141 $op5->addSubItem($si);
145 $form->addCommandButton(
"create", $this->
lng->txt(
"save"));
146 $form->addCommandButton(
"cancelCreate", $this->
lng->txt(
"cancel"));
157 if ($form->checkInput()) {
158 $post_layout_template = (
int) $form->getInput(
"layout_template");
160 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
161 $this->content_obj->applyTemplate(
162 $post_layout_template,
163 (
int) $form->getInput(
"number_of_cells"),
164 (
int) $form->getInput(
"s"),
165 (
int) $form->getInput(
"m"),
166 (
int) $form->getInput(
"l"),
167 (
int) $form->getInput(
"xl")
169 $this->updated = $this->pg_obj->update();
171 if ($this->updated ===
true) {
178 $form->setValuesByPost();
179 $this->tpl->setContent($form->getHTML());
185 $this->pg_obj->stripHierIDs();
186 $this->pg_obj->addHierIDs();
187 $this->
ctrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
188 $this->
ctrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
189 $this->content_obj->setHierId($this->content_obj->readHierId());
190 $this->
setHierId($this->content_obj->readHierId());
191 $this->content_obj->setPcId($this->content_obj->readPCId());
206 $this->
lng->txt(
"cont_add_cell"),
207 $this->ctrl->getLinkTarget($this,
"addCell")
211 $this->
tabs->activateTab(
"settings");
213 $table = $this->gui->pc()->gridCellTableBuilder(
219 if ($table->handleCommand()) {
223 $this->tpl->setContent($table->render());
228 return $this->gui->pc()->gridCellTableBuilder(
242 $ordered_ids = $table->getData();
244 if (is_array($ordered_ids) && count($ordered_ids) > 0) {
245 $this->content_obj->savePositions($ordered_ids);
247 $this->updated = $this->pg_obj->update();
248 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
249 $this->
ctrl->redirect($this,
"edit");
255 $this->gui->modal($this->
lng->txt(
"cont_ed_grid_col_widths"))
262 $this->
ctrl->setParameter($this,
"tid",
$id);
265 $data = $this->content_obj->getCellData();
267 foreach (
$data as $row) {
268 if ($row[
"hier_id"] .
":" . $row[
"pc_id"] ===
$id) {
274 $form = $this->gui->form([self::class],
"saveWidths");
278 $this->
lng->txt(
"cont_grid_width_" . $s),
290 $id = $this->request->getString(
"tid");
292 if ($form->isValid()) {
293 $w_s = [
$id => $form->getData(
"width_s")];
294 $w_m = [
$id => $form->getData(
"width_m")];
295 $w_l = [
$id => $form->getData(
"width_l")];
296 $w_xl = [
$id => $form->getData(
"width_xl")];
297 $this->content_obj->saveWidths($w_s, $w_m, $w_l, $w_xl);
298 $this->updated = $this->pg_obj->update();
299 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
300 $this->
ctrl->redirect($this,
"edit");
310 $this->content_obj->addCell();
311 $this->updated = $this->pg_obj->update();
313 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"cont_added_cell"),
true);
314 $this->
ctrl->redirect($this,
"edit");
323 $ids = $table->getItemIds();
325 if (count($ids) === 0) {
326 $this->
ctrl->redirect($this,
"edit");
329 $retrieval = $this->domain->pc()->gridCellRetrieval($this->content_obj);
330 $data = $retrieval->getData([]);
333 foreach (
$data as $row) {
334 if (in_array($row[
"id"], $ids)) {
335 $items[$row[
"id"]] = $this->
lng->txt(
"cont_grid_cell") .
" " . $cnt;
340 $table->renderDeletionConfirmation(
341 $this->
lng->txt(
"delete"),
342 $this->lng->txt(
"cont_grid_cell_confirm_deletion"),
353 $this->
ctrl->redirect($this,
"edit");
364 $ids = $table->getItemIds();
366 foreach ($ids as $tid) {
367 $ids = explode(
":", $tid);
368 $this->content_obj->deleteGridCell($ids[0], $ids[1]);
370 $this->updated = $this->pg_obj->update();
372 $ilCtrl->redirect($this,
"edit");
377 $this->
tabs->setBackTarget(
378 $this->
lng->txt(
"pg"),
379 $this->ctrl->getParentReturn($this)
384 $this->
lng->txt(
"settings"),
385 $this->ctrl->getLinkTarget($this,
"edit")
394 $width_s = $this->request->getStringArray(
"width_s");
395 $width_m = $this->request->getStringArray(
"width_m");
396 $width_l = $this->request->getStringArray(
"width_l");
397 $width_xl = $this->request->getStringArray(
"width_xl");
398 $this->content_obj->saveWidths($width_s, $width_m, $width_l, $width_xl);
400 $pos = $this->request->getStringArray(
"position");
401 if (count($pos) > 0) {
402 $this->content_obj->savePositions($pos);
404 $this->updated = $this->pg_obj->update();
405 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
406 $this->
ctrl->redirect($this,
"edit");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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...
Responsive Grid UI class.
getEditWidthsForm(string $id)
create()
Create new grid element.
const TEMPLATE_TWO_COLUMN
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
cancelCellDeletion()
Cancel cell deletion.
const TEMPLATE_TWO_BY_TWO
ILIAS COPage InternalDomainService $domain
confirmCellDeletion(array $tids)
Confirm cell deletion.
initCreationForm()
Init creation form.
deleteCells()
Delete Cells.
saveCellData()
Save tabs properties in db and return to page edit screen.
const TEMPLATE_THREE_COLUMN
savePositions()
Save positions.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getSizes()
Get sizes.
static getWidths()
Get widths.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
setHierId(string $a_hier_id)
set hierarchical id in dom object
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc