ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCGridGUI Class Reference

Responsive Grid UI class. More...

+ Inheritance diagram for ilPCGridGUI:
+ Collaboration diagram for ilPCGridGUI:

Public Member Functions

 __construct ($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 insert ()
 Insert new grid. More...
 
 editProperties ()
 Edit grid cells. More...
 
 initCreationForm ()
 Init creation form. More...
 
 create ()
 Create new grid element. More...
 
 afterCreation ()
 After creation processing. More...
 
 edit ()
 List all cells. More...
 
 saveCells ()
 Save cell properties. More...
 
 addCell ()
 Add cell. More...
 
 confirmCellDeletion ()
 Confirm cell deletion. More...
 
 cancelCellDeletion ()
 Cancel cell deletion. More...
 
 deleteCells ()
 Delete Cells. More...
 
 setTabs ()
 Set tabs. More...
 
 saveCellData ()
 Save tabs properties in db and return to page edit screen. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 display validation errors More...
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions ($a_type)
 Get table templates. More...
 

Data Fields

const TEMPLATE_MANUAL = 0
 
const TEMPLATE_TWO_COLUMN = 1
 
const TEMPLATE_THREE_COLUMN = 2
 
const TEMPLATE_MAIN_SIDE = 3
 
const TEMPLATE_TWO_BY_TWO = 4
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 

Protected Attributes

 $toolbar
 
 $tabs
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Static Public Attributes inherited from ilPageContentGUI
static $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

Responsive Grid UI class.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 15 of file class.ilPCGridGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCGridGUI::__construct (   $a_pg_obj,
  $a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor.

Parameters
$a_pg_obj
$a_content_obj
$a_hier_id
string$a_pc_id

Definition at line 33 of file class.ilPCGridGUI.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

34  {
35  global $DIC;
36 
37  $this->ctrl = $DIC->ctrl();
38  $ilToolbar = $DIC->toolbar();
39  $ilTabs = $DIC->tabs();
40 
41  $this->toolbar = $ilToolbar;
42  $this->tabs = $ilTabs;
43  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
44  }
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ addCell()

ilPCGridGUI::addCell ( )

Add cell.

Definition at line 263 of file class.ilPCGridGUI.php.

264  {
265  $this->content_obj->addCell("", "", "", "");
266  $this->updated = $this->pg_obj->update();
267 
268  ilUtil::sendSuccess($this->lng->txt("cont_added_cell"), true);
269  $this->ctrl->redirect($this, "edit");
270  }

◆ afterCreation()

ilPCGridGUI::afterCreation ( )

After creation processing.

Definition at line 212 of file class.ilPCGridGUI.php.

References edit(), and ilPageContentGUI\setHierId().

Referenced by create().

213  {
214  $this->pg_obj->stripHierIDs();
215  $this->pg_obj->addHierIDs();
216  $this->ctrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
217  $this->ctrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
218  $this->content_obj->setHierId($this->content_obj->readHierId());
219  $this->setHierId($this->content_obj->readHierId());
220  $this->content_obj->setPCId($this->content_obj->readPCId());
221  $this->edit();
222  }
edit()
List all cells.
setHierId($a_hier_id)
get hierarchical id in dom object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelCellDeletion()

ilPCGridGUI::cancelCellDeletion ( )

Cancel cell deletion.

Definition at line 303 of file class.ilPCGridGUI.php.

304  {
305  $this->ctrl->redirect($this, "edit");
306  }

◆ confirmCellDeletion()

ilPCGridGUI::confirmCellDeletion ( )

Confirm cell deletion.

Definition at line 275 of file class.ilPCGridGUI.php.

References $_POST, $i, ilUtil\sendInfo(), and setTabs().

276  {
277  $this->setTabs();
278 
279  if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
280  ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
281  $this->ctrl->redirect($this, "edit");
282  } else {
283  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
284  $cgui = new ilConfirmationGUI();
285  $cgui->setFormAction($this->ctrl->getFormAction($this));
286  $cgui->setHeaderText($this->lng->txt("cont_grid_cell_confirm_deletion"));
287  $cgui->setCancel($this->lng->txt("cancel"), "cancelCellDeletion");
288  $cgui->setConfirm($this->lng->txt("delete"), "deleteCells");
289 
290  foreach ($_POST["tid"] as $k => $i) {
291  $id = explode(":", $k);
292  $id = explode("_", $id[0]);
293  $cgui->addItem("tid[]", $k, $this->lng->txt("cont_grid_cell") . " " . $id[count($id) - 1]);
294  }
295 
296  $this->tpl->setContent($cgui->getHTML());
297  }
298  }
setTabs()
Set tabs.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
$i
Definition: metadata.php:24
Confirmation screen class.
+ Here is the call graph for this function:

◆ create()

ilPCGridGUI::create ( )

Create new grid element.

Definition at line 155 of file class.ilPCGridGUI.php.

References $_POST, $i, afterCreation(), ilPageContentGUI\getPage(), initCreationForm(), and insert().

156  {
157  $form = $this->initCreationForm();
158  if ($form->checkInput()) {
159  $post_layout_template = (int) $_POST["layout_template"];
160  $this->content_obj = new ilPCGrid($this->getPage());
161  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
162 
163  switch ($post_layout_template) {
164  case self::TEMPLATE_TWO_COLUMN:
165  $this->content_obj->addGridCell(12, 6, 6, 6);
166  $this->content_obj->addGridCell(12, 6, 6, 6);
167  break;
168 
169  case self::TEMPLATE_THREE_COLUMN:
170  $this->content_obj->addGridCell(12, 4, 4, 4);
171  $this->content_obj->addGridCell(12, 4, 4, 4);
172  $this->content_obj->addGridCell(12, 4, 4, 4);
173  break;
174 
175  case self::TEMPLATE_MAIN_SIDE:
176  $this->content_obj->addGridCell(12, 6, 8, 9);
177  $this->content_obj->addGridCell(12, 6, 4, 3);
178  break;
179 
180  case self::TEMPLATE_TWO_BY_TWO:
181  $this->content_obj->addGridCell(12, 6, 6, 3);
182  $this->content_obj->addGridCell(12, 6, 6, 3);
183  $this->content_obj->addGridCell(12, 6, 6, 3);
184  $this->content_obj->addGridCell(12, 6, 6, 3);
185  break;
186 
187 
188  case self::TEMPLATE_MANUAL:
189  for ($i = 0; $i < (int) $_POST["number_of_cells"]; $i++) {
190  $this->content_obj->addGridCell($_POST["s"], $_POST["m"], $_POST["l"], $_POST["xl"]);
191  }
192  break;
193  }
194 
195  $this->updated = $this->pg_obj->update();
196 
197  if ($this->updated === true) {
198  $this->afterCreation();
199  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
200  } else {
201  $this->insert();
202  }
203  } else {
204  $form->setValuesByPost();
205  $this->tpl->setContent($form->getHTML());
206  }
207  }
afterCreation()
After creation processing.
Grid element.
initCreationForm()
Init creation form.
insert()
Insert new grid.
$_POST["username"]
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ deleteCells()

ilPCGridGUI::deleteCells ( )

Delete Cells.

Definition at line 311 of file class.ilPCGridGUI.php.

References $_POST, ilPageContentGUI\$ctrl, and $ilCtrl.

312  {
314 
315  if (is_array($_POST["tid"])) {
316  foreach ($_POST["tid"] as $tid) {
317  $ids = explode(":", $tid);
318  $this->content_obj->deleteGridCell($ids[0], $ids[1]);
319  }
320  }
321  $this->updated = $this->pg_obj->update();
322 
323  $ilCtrl->redirect($this, "edit");
324  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ edit()

ilPCGridGUI::edit ( )

List all cells.

Definition at line 232 of file class.ilPCGridGUI.php.

References setTabs().

Referenced by afterCreation().

233  {
234  $this->toolbar->addButton(
235  $this->lng->txt("cont_add_cell"),
236  $this->ctrl->getLinkTarget($this, "addCell")
237  );
238 
239  $this->setTabs();
240  $this->tabs->activateTab("settings");
241  include_once("./Services/COPage/classes/class.ilPCGridCellTableGUI.php");
242  $table_gui = new ilPCGridCellTableGUI($this, "edit", $this->content_obj);
243  $this->tpl->setContent($table_gui->getHTML());
244  }
setTabs()
Set tabs.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editProperties()

ilPCGridGUI::editProperties ( )

Edit grid cells.

Definition at line 82 of file class.ilPCGridGUI.php.

References ilPageContentGUI\displayValidationError(), and setTabs().

83  {
84  $this->displayValidationError();
85  $this->setTabs();
86 
87  $form = $this->initForm();
88  $this->getFormValues($form);
89  $html = $form->getHTML();
90  $this->tpl->setContent($html);
91  }
setTabs()
Set tabs.
displayValidationError()
display validation errors
+ Here is the call graph for this function:

◆ executeCommand()

ilPCGridGUI::executeCommand ( )

Execute command.

Definition at line 49 of file class.ilPCGridGUI.php.

References $ret.

50  {
51  // get next class that processes or forwards current command
52  $next_class = $this->ctrl->getNextClass($this);
53 
54  // get current command
55  $cmd = $this->ctrl->getCmd();
56 
57  switch ($next_class) {
58  default:
59  $ret = $this->$cmd();
60  break;
61  }
62 
63  return $ret;
64  }
$ret
Definition: parser.php:6

◆ initCreationForm()

ilPCGridGUI::initCreationForm ( )

Init creation form.

Returns
ilPropertyFormGUI

Definition at line 97 of file class.ilPCGridGUI.php.

References ilPageContentGUI\$lng, $si, ilPCGrid\getSizes(), ilPCGrid\getWidths(), ilNumberInputGUI\setMaxLength(), and ilRadioGroupInputGUI\setValue().

Referenced by create(), and insert().

98  {
99  $lng = $this->lng;
100 
101  // edit form
102  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
103  $form = new ilPropertyFormGUI();
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"));
107 
108  //
109  $radg = new ilRadioGroupInputGUI($lng->txt("cont_pc_grid"), "layout_template");
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);
122 
123 
124  // number of cells
125  $ni = new ilNumberInputGUI($this->lng->txt("cont_grid_nr_cells"), "number_of_cells");
126  $ni->setMaxLength(2);
127  $ni->setSize(2);
128  $op5->addSubItem($ni);
129 
130  /*$sh = new ilFormSectionHeaderGUI();
131  $sh->setTitle($this->lng->txt("cont_ed_grid_col_width"));
132  $sh->setInfo($this->lng->txt("cont_ed_grid_col_width_info"));
133  $form->addItem($sh);*/
134 
135  $options = array("" => "") + ilPCGrid::getWidths();
136 
137  // widths
138  foreach (ilPCGrid::getSizes() as $s) {
139  $si = new ilSelectInputGUI($this->lng->txt("cont_grid_width_" . $s), $s);
140  $si->setInfo($this->lng->txt("cont_grid_width_" . $s . "_info"));
141  $si->setOptions($options);
142  $op5->addSubItem($si);
143  }
144 
145  // save/cancel buttons
146  $form->addCommandButton("create_grid", $this->lng->txt("save"));
147  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
148 
149  return $form;
150  }
static getWidths()
Get widths.
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents a number property in a property form.
setMaxLength($a_maxlength)
Set Max Length.
static getSizes()
Get sizes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCGridGUI::insert ( )

Insert new grid.

Definition at line 69 of file class.ilPCGridGUI.php.

References ilPageContentGUI\displayValidationError(), and initCreationForm().

Referenced by create().

70  {
71  $this->displayValidationError();
72  $form = $this->initCreationForm();
73  if ($this->ctrl->getCmd() == "create") {
74  $form->setValuesByPost();
75  }
76  $this->tpl->setContent($form->getHTML());
77  }
initCreationForm()
Init creation form.
displayValidationError()
display validation errors
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCellData()

ilPCGridGUI::saveCellData ( )

Save tabs properties in db and return to page edit screen.

Definition at line 347 of file class.ilPCGridGUI.php.

References $_POST, and ilUtil\stripSlashesArray().

348  {
349  $width_s = ilUtil::stripSlashesArray($_POST["width_s"]);
350  $width_m = ilUtil::stripSlashesArray($_POST["width_m"]);
351  $width_l = ilUtil::stripSlashesArray($_POST["width_l"]);
352  $width_xl = ilUtil::stripSlashesArray($_POST["width_xl"]);
353  $this->content_obj->saveWidths($width_s, $width_m, $width_l, $width_xl);
354 
355  if (is_array($_POST["position"])) {
356  $positions = ilUtil::stripSlashesArray($_POST["position"]);
357  $this->content_obj->savePositions($positions);
358  }
359  $this->updated = $this->pg_obj->update();
360  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
361  $this->ctrl->redirect($this, "edit");
362  }
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
$_POST["username"]
+ Here is the call graph for this function:

◆ saveCells()

ilPCGridGUI::saveCells ( )

Save cell properties.

Definition at line 249 of file class.ilPCGridGUI.php.

References $_POST, and ilUtil\stripSlashesArray().

250  {
251  if (is_array($_POST["position"])) {
252  $positions = ilUtil::stripSlashesArray($_POST["position"]);
253  $this->content_obj->savePositions($positions);
254  }
255  $this->updated = $this->pg_obj->update();
256  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
257  $this->ctrl->redirect($this, "edit");
258  }
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
$_POST["username"]
+ Here is the call graph for this function:

◆ setTabs()

ilPCGridGUI::setTabs ( )

Set tabs.

Definition at line 330 of file class.ilPCGridGUI.php.

Referenced by confirmCellDeletion(), edit(), and editProperties().

331  {
332  $this->tabs->setBackTarget(
333  $this->lng->txt("pg"),
334  $this->ctrl->getParentReturn($this)
335  );
336 
337  $this->tabs->addTab(
338  "settings",
339  $this->lng->txt("settings"),
340  $this->ctrl->getLinkTarget($this, "edit")
341  );
342  }
+ Here is the caller graph for this function:

Field Documentation

◆ $tabs

ilPCGridGUI::$tabs
protected

Definition at line 24 of file class.ilPCGridGUI.php.

◆ $toolbar

ilPCGridGUI::$toolbar
protected

Definition at line 23 of file class.ilPCGridGUI.php.

◆ TEMPLATE_MAIN_SIDE

const ilPCGridGUI::TEMPLATE_MAIN_SIDE = 3

Definition at line 20 of file class.ilPCGridGUI.php.

◆ TEMPLATE_MANUAL

const ilPCGridGUI::TEMPLATE_MANUAL = 0

Definition at line 17 of file class.ilPCGridGUI.php.

◆ TEMPLATE_THREE_COLUMN

const ilPCGridGUI::TEMPLATE_THREE_COLUMN = 2

Definition at line 19 of file class.ilPCGridGUI.php.

◆ TEMPLATE_TWO_BY_TWO

const ilPCGridGUI::TEMPLATE_TWO_BY_TWO = 4

Definition at line 21 of file class.ilPCGridGUI.php.

◆ TEMPLATE_TWO_COLUMN

const ilPCGridGUI::TEMPLATE_TWO_COLUMN = 1

Definition at line 18 of file class.ilPCGridGUI.php.


The documentation for this class was generated from the following file: