ILIAS  release_7 Revision v7.30-3-g800a261c036
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 @access 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...
 
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. 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
 redirectToParent ($hier_id="")
 Redirect to parent. More...
 
 getParentReturn ($hier_id="")
 
- 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

Reimplemented from ilPageContentGUI.

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

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 }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addCell()

ilPCGridGUI::addCell ( )

Add cell.

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

239 {
240 $this->content_obj->addCell("", "", "", "");
241 $this->updated = $this->pg_obj->update();
242
243 ilUtil::sendSuccess($this->lng->txt("cont_added_cell"), true);
244 $this->ctrl->redirect($this, "edit");
245 }

◆ afterCreation()

ilPCGridGUI::afterCreation ( )

After creation processing.

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

188 {
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());
196 $this->edit();
197 }
edit()
List all cells.
setHierId($a_hier_id)
get hierarchical id in dom object

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

Referenced by create().

+ 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 278 of file class.ilPCGridGUI.php.

279 {
280 $this->ctrl->redirect($this, "edit");
281 }

◆ confirmCellDeletion()

ilPCGridGUI::confirmCellDeletion ( )

Confirm cell deletion.

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

251 {
252 $this->setTabs();
253
254 if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
255 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
256 $this->ctrl->redirect($this, "edit");
257 } else {
258 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
259 $cgui = new ilConfirmationGUI();
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");
264
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]);
269 }
270
271 $this->tpl->setContent($cgui->getHTML());
272 }
273 }
$_POST["username"]
Confirmation screen class.
setTabs()
Set tabs.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$i
Definition: metadata.php:24

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

+ Here is the call graph for this function:

◆ create()

ilPCGridGUI::create ( )

Create new grid element.

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

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 $this->content_obj->applyTemplate(
163 $post_layout_template,
164 (int) $_POST["number_of_cells"],
165 $_POST["s"],
166 $_POST["m"],
167 $_POST["l"],
168 $_POST["xl"]
169 );
170 $this->updated = $this->pg_obj->update();
171
172 if ($this->updated === true) {
173 $this->afterCreation();
174 //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
175 } else {
176 $this->insert();
177 }
178 } else {
179 $form->setValuesByPost();
180 $this->tpl->setContent($form->getHTML());
181 }
182 }
insert()
Insert new grid.
initCreationForm()
Init creation form.
afterCreation()
After creation processing.
Grid element.

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

+ Here is the call graph for this function:

◆ deleteCells()

ilPCGridGUI::deleteCells ( )

Delete Cells.

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

287 {
288 $ilCtrl = $this->ctrl;
289
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]);
294 }
295 }
296 $this->updated = $this->pg_obj->update();
297
298 $ilCtrl->redirect($this, "edit");
299 }

References $_POST, and ilPageContentGUI\$ctrl.

◆ edit()

ilPCGridGUI::edit ( )

List all cells.

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

208 {
209 $this->toolbar->addButton(
210 $this->lng->txt("cont_add_cell"),
211 $this->ctrl->getLinkTarget($this, "addCell")
212 );
213
214 $this->setTabs();
215 $this->tabs->activateTab("settings");
216 include_once("./Services/COPage/classes/class.ilPCGridCellTableGUI.php");
217 $table_gui = new ilPCGridCellTableGUI($this, "edit", $this->content_obj);
218 $this->tpl->setContent($table_gui->getHTML());
219 }

References setTabs().

Referenced by afterCreation().

+ 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.

83 {
85 $this->setTabs();
86
87 $form = $this->initForm();
88 $this->getFormValues($form);
89 $html = $form->getHTML();
90 $this->tpl->setContent($html);
91 }
displayValidationError()
display validation errors

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

+ Here is the call graph for this function:

◆ executeCommand()

ilPCGridGUI::executeCommand ( )

Execute command.

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

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

References $ret.

◆ initCreationForm()

ilPCGridGUI::initCreationForm ( )

Init creation form.

Returns
ilPropertyFormGUI

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

98 {
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 }
This class represents a number property in a property form.
static getSizes()
Get sizes.
static getWidths()
Get widths.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.

References ilPageContentGUI\$lng, $si, ilPCGrid\getSizes(), and ilPCGrid\getWidths().

Referenced by create(), and insert().

+ 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.

70 {
72 $form = $this->initCreationForm();
73 if ($this->ctrl->getCmd() == "create") {
74 $form->setValuesByPost();
75 }
76 $this->tpl->setContent($form->getHTML());
77 }

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

Referenced by create().

+ 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 322 of file class.ilPCGridGUI.php.

323 {
324 $width_s = ilUtil::stripSlashesArray($_POST["width_s"]);
325 $width_m = ilUtil::stripSlashesArray($_POST["width_m"]);
326 $width_l = ilUtil::stripSlashesArray($_POST["width_l"]);
327 $width_xl = ilUtil::stripSlashesArray($_POST["width_xl"]);
328 $this->content_obj->saveWidths($width_s, $width_m, $width_l, $width_xl);
329
330 if (is_array($_POST["position"])) {
331 $positions = ilUtil::stripSlashesArray($_POST["position"]);
332 $this->content_obj->savePositions($positions);
333 }
334 $this->updated = $this->pg_obj->update();
335 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
336 $this->ctrl->redirect($this, "edit");
337 }
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.

References $_POST, and ilUtil\stripSlashesArray().

+ Here is the call graph for this function:

◆ saveCells()

ilPCGridGUI::saveCells ( )

Save cell properties.

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

225 {
226 if (is_array($_POST["position"])) {
227 $positions = ilUtil::stripSlashesArray($_POST["position"]);
228 $this->content_obj->savePositions($positions);
229 }
230 $this->updated = $this->pg_obj->update();
231 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
232 $this->ctrl->redirect($this, "edit");
233 }

References $_POST, and ilUtil\stripSlashesArray().

+ Here is the call graph for this function:

◆ setTabs()

ilPCGridGUI::setTabs ( )

Set tabs.

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

306 {
307 $this->tabs->setBackTarget(
308 $this->lng->txt("pg"),
309 $this->ctrl->getParentReturn($this)
310 );
311
312 $this->tabs->addTab(
313 "settings",
314 $this->lng->txt("settings"),
315 $this->ctrl->getLinkTarget($this, "edit")
316 );
317 }

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

+ 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.

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_MANUAL

const ilPCGridGUI::TEMPLATE_MANUAL = 0

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

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_THREE_COLUMN

const ilPCGridGUI::TEMPLATE_THREE_COLUMN = 2

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

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_TWO_BY_TWO

const ilPCGridGUI::TEMPLATE_TWO_BY_TWO = 4

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

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_TWO_COLUMN

const ilPCGridGUI::TEMPLATE_TWO_COLUMN = 1

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

Referenced by ilPCGrid\applyTemplate().


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