4require_once(
"./Services/COPage/classes/class.ilPCGrid.php");
5require_once(
"./Services/COPage/classes/class.ilPCGridCell.php");
6require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
33 public function __construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id =
"")
37 $this->ctrl =
$DIC->ctrl();
38 $ilToolbar =
$DIC->toolbar();
39 $ilTabs =
$DIC->tabs();
41 $this->toolbar = $ilToolbar;
42 $this->tabs = $ilTabs;
52 $next_class = $this->ctrl->getNextClass($this);
55 $cmd = $this->ctrl->getCmd();
57 switch ($next_class) {
73 if ($this->ctrl->getCmd() ==
"create") {
74 $form->setValuesByPost();
76 $this->tpl->setContent($form->getHTML());
87 $form = $this->initForm();
88 $this->getFormValues($form);
89 $html = $form->getHTML();
90 $this->tpl->setContent($html);
102 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
104 $form->setFormAction($this->ctrl->getFormAction($this));
105 $form->setTitle($this->lng->txt(
"cont_ed_insert_grid"));
106 $form->setDescription($this->lng->txt(
"cont_ed_insert_grid_info"));
110 $radg->setValue(self::TEMPLATE_TWO_COLUMN);
111 $op1 =
new ilRadioOption(
$lng->txt(
"cont_grid_t_two_column"), self::TEMPLATE_TWO_COLUMN,
$lng->txt(
"cont_grid_t_two_column_info"));
112 $radg->addOption($op1);
113 $op2 =
new ilRadioOption(
$lng->txt(
"cont_grid_t_three_column"), self::TEMPLATE_THREE_COLUMN,
$lng->txt(
"cont_grid_t_three_column_info"));
114 $radg->addOption($op2);
115 $op3 =
new ilRadioOption(
$lng->txt(
"cont_grid_t_main_side"), self::TEMPLATE_MAIN_SIDE,
$lng->txt(
"cont_grid_t_main_side_info"));
116 $radg->addOption($op3);
117 $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"));
118 $radg->addOption($op4);
119 $op5 =
new ilRadioOption(
$lng->txt(
"cont_grid_t_manual"), self::TEMPLATE_MANUAL,
$lng->txt(
"cont_grid_t_manual_info"));
120 $radg->addOption($op5);
121 $form->addItem($radg);
125 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_grid_nr_cells"),
"number_of_cells");
126 $ni->setMaxLength(2);
128 $op5->addSubItem($ni);
140 $si->setInfo($this->lng->txt(
"cont_grid_width_" . $s .
"_info"));
141 $si->setOptions($options);
142 $op5->addSubItem(
$si);
146 $form->addCommandButton(
"create_grid", $this->lng->txt(
"save"));
147 $form->addCommandButton(
"cancelCreate", $this->lng->txt(
"cancel"));
158 if ($form->checkInput()) {
159 $post_layout_template = (int)
$_POST[
"layout_template"];
161 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
162 $this->content_obj->applyTemplate(
163 $post_layout_template,
164 (
int)
$_POST[
"number_of_cells"],
170 $this->updated = $this->pg_obj->update();
172 if ($this->updated ===
true) {
179 $form->setValuesByPost();
180 $this->tpl->setContent($form->getHTML());
189 $this->pg_obj->stripHierIDs();
190 $this->pg_obj->addHierIDs();
191 $this->ctrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
192 $this->ctrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
193 $this->content_obj->setHierId($this->content_obj->readHierId());
194 $this->
setHierId($this->content_obj->readHierId());
195 $this->content_obj->setPCId($this->content_obj->readPCId());
209 $this->toolbar->addButton(
210 $this->lng->txt(
"cont_add_cell"),
211 $this->ctrl->getLinkTarget($this,
"addCell")
215 $this->tabs->activateTab(
"settings");
216 include_once(
"./Services/COPage/classes/class.ilPCGridCellTableGUI.php");
218 $this->tpl->setContent($table_gui->getHTML());
226 if (is_array(
$_POST[
"position"])) {
228 $this->content_obj->savePositions($positions);
230 $this->updated = $this->pg_obj->update();
231 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
232 $this->ctrl->redirect($this,
"edit");
240 $this->content_obj->addCell(
"",
"",
"",
"");
241 $this->updated = $this->pg_obj->update();
243 ilUtil::sendSuccess($this->lng->txt(
"cont_added_cell"),
true);
244 $this->ctrl->redirect($this,
"edit");
254 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
256 $this->ctrl->redirect($this,
"edit");
258 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
260 $cgui->setFormAction($this->ctrl->getFormAction($this));
261 $cgui->setHeaderText($this->lng->txt(
"cont_grid_cell_confirm_deletion"));
262 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelCellDeletion");
263 $cgui->setConfirm($this->lng->txt(
"delete"),
"deleteCells");
265 foreach (
$_POST[
"tid"] as $k =>
$i) {
266 $id = explode(
":", $k);
267 $id = explode(
"_", $id[0]);
268 $cgui->addItem(
"tid[]", $k, $this->lng->txt(
"cont_grid_cell") .
" " . $id[count($id) - 1]);
271 $this->tpl->setContent($cgui->getHTML());
280 $this->ctrl->redirect($this,
"edit");
290 if (is_array(
$_POST[
"tid"])) {
291 foreach (
$_POST[
"tid"] as $tid) {
292 $ids = explode(
":", $tid);
293 $this->content_obj->deleteGridCell($ids[0], $ids[1]);
296 $this->updated = $this->pg_obj->update();
298 $ilCtrl->redirect($this,
"edit");
307 $this->tabs->setBackTarget(
308 $this->lng->txt(
"pg"),
309 $this->ctrl->getParentReturn($this)
314 $this->lng->txt(
"settings"),
315 $this->ctrl->getLinkTarget($this,
"edit")
328 $this->content_obj->saveWidths($width_s, $width_m, $width_l, $width_xl);
330 if (is_array(
$_POST[
"position"])) {
332 $this->content_obj->savePositions($positions);
334 $this->updated = $this->pg_obj->update();
335 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
336 $this->ctrl->redirect($this,
"edit");
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
Responsive Grid UI class.
confirmCellDeletion()
Confirm cell deletion.
create()
Create new grid element.
editProperties()
Edit grid cells.
const TEMPLATE_TWO_COLUMN
cancelCellDeletion()
Cancel cell deletion.
const TEMPLATE_TWO_BY_TWO
executeCommand()
Execute command.
initCreationForm()
Init creation form.
saveCells()
Save cell properties.
deleteCells()
Delete Cells.
saveCellData()
Save tabs properties in db and return to page edit screen.
__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
Constructor.
afterCreation()
After creation processing.
const TEMPLATE_THREE_COLUMN
static getSizes()
Get sizes.
static getWidths()
Get widths.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
displayValidationError()
display validation errors
setHierId($a_hier_id)
get hierarchical id in dom object
This class represents an option in a radio group.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc