4 require_once(
"./Services/COPage/classes/class.ilPCGrid.php");
5 require_once(
"./Services/COPage/classes/class.ilPCGridCell.php");
6 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
27 public function __construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id =
"")
31 $this->ctrl = $DIC->ctrl();
32 $ilToolbar = $DIC->toolbar();
33 $ilTabs = $DIC->tabs();
35 $this->toolbar = $ilToolbar;
36 $this->tabs = $ilTabs;
37 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
46 $next_class = $this->ctrl->getNextClass($this);
49 $cmd = $this->ctrl->getCmd();
51 switch ($next_class) {
67 if ($this->ctrl->getCmd() ==
"create") {
68 $form->setValuesByPost();
70 $this->tpl->setContent(
$form->getHTML());
81 $form = $this->initForm();
82 $this->getFormValues(
$form);
84 $this->tpl->setContent(
$html);
94 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
96 $form->setFormAction($this->ctrl->getFormAction($this));
97 $form->setTitle($this->lng->txt(
"cont_ed_insert_grid"));
98 $form->setDescription($this->lng->txt(
"cont_ed_insert_grid_info"));
101 $ni =
new ilNumberInputGUI($this->lng->txt(
"cont_grid_nr_cells"),
"number_of_cells");
107 $sh->setTitle($this->lng->txt(
"cont_ed_grid_col_width"));
108 $sh->setInfo($this->lng->txt(
"cont_ed_grid_col_width_info"));
116 $si->setInfo($this->lng->txt(
"cont_grid_width_" . $s .
"_info"));
122 $form->addCommandButton(
"create_grid", $this->lng->txt(
"save"));
123 $form->addCommandButton(
"cancelCreate", $this->lng->txt(
"cancel"));
134 if (
$form->checkInput()) {
136 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
138 for (
$i = 0;
$i < (int)
$_POST[
"number_of_cells"];
$i++) {
142 $this->updated = $this->pg_obj->update();
144 if ($this->updated ===
true) {
151 $form->setValuesByPost();
152 $this->tpl->setContent(
$form->getHTML());
161 $this->pg_obj->stripHierIDs();
162 $this->pg_obj->addHierIDs();
163 $this->ctrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
164 $this->ctrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
165 $this->content_obj->setHierId($this->content_obj->readHierId());
166 $this->
setHierId($this->content_obj->readHierId());
167 $this->content_obj->setPCId($this->content_obj->readPCId());
181 $this->toolbar->addButton(
182 $this->lng->txt(
"cont_add_cell"),
183 $this->ctrl->getLinkTarget($this,
"addCell")
187 $this->tabs->activateTab(
"settings");
188 include_once(
"./Services/COPage/classes/class.ilPCGridCellTableGUI.php");
190 $this->tpl->setContent($table_gui->getHTML());
198 if (is_array(
$_POST[
"position"])) {
200 $this->content_obj->savePositions($positions);
202 $this->updated = $this->pg_obj->update();
204 $this->ctrl->redirect($this,
"edit");
212 $this->content_obj->addCell(
"",
"",
"",
"");
213 $this->updated = $this->pg_obj->update();
216 $this->ctrl->redirect($this,
"edit");
226 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
228 $this->ctrl->redirect($this,
"edit");
230 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
232 $cgui->setFormAction($this->ctrl->getFormAction($this));
233 $cgui->setHeaderText($this->lng->txt(
"cont_grid_cell_confirm_deletion"));
234 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelCellDeletion");
235 $cgui->setConfirm($this->lng->txt(
"delete"),
"deleteCells");
237 foreach (
$_POST[
"tid"] as $k =>
$i) {
238 $id = explode(
":", $k);
239 $id = explode(
"_",
$id[0]);
240 $cgui->addItem(
"tid[]", $k, $this->lng->txt(
"cont_grid_cell") .
" " .
$id[count(
$id) - 1]);
243 $this->tpl->setContent($cgui->getHTML());
252 $this->ctrl->redirect($this,
"edit");
262 if (is_array(
$_POST[
"tid"])) {
263 foreach (
$_POST[
"tid"] as $tid) {
264 $ids = explode(
":", $tid);
265 $this->content_obj->deleteGridCell($ids[0], $ids[1]);
268 $this->updated = $this->pg_obj->update();
270 $ilCtrl->redirect($this,
"edit");
279 $this->tabs->setBackTarget(
280 $this->lng->txt(
"pg"),
281 $this->ctrl->getParentReturn($this)
286 $this->lng->txt(
"settings"),
287 $this->ctrl->getLinkTarget($this,
"edit")
300 $this->content_obj->saveWidths($width_s, $width_m, $width_l, $width_xl);
302 if (is_array(
$_POST[
"position"])) {
304 $this->content_obj->savePositions($positions);
306 $this->updated = $this->pg_obj->update();
308 $this->ctrl->redirect($this,
"edit");
static getWidths()
Get widths.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
afterCreation()
After creation processing.
create()
Create new grid element.
initCreationForm()
Init creation form.
if(!array_key_exists('StateId', $_REQUEST)) $id
saveCells()
Save cell properties.
confirmCellDeletion()
Confirm cell deletion.
cancelCellDeletion()
Cancel cell deletion.
__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
Constructor.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
Responsive Grid UI class.
if(isset($_POST['submit'])) $form
saveCellData()
Save tabs properties in db and return to page edit screen.
displayValidationError()
display validation errors
deleteCells()
Delete Cells.
Create styles array
The data for the language used.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
executeCommand()
Execute command.
editProperties()
Edit grid cells.
setHierId($a_hier_id)
get hierarchical id in dom object
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
static getSizes()
Get sizes.
Confirmation screen class.