ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

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...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- 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 27 of file class.ilPCGridGUI.php.

References $DIC.

28  {
29  global $DIC;
30 
31  $this->ctrl = $DIC->ctrl();
32  $ilToolbar = $DIC->toolbar();
33  $ilTabs = $DIC->tabs();
34 
35  $this->toolbar = $ilToolbar;
36  $this->tabs = $ilTabs;
37  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
38  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ addCell()

ilPCGridGUI::addCell ( )

Add cell.

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

References ilUtil\sendSuccess().

211  {
212  $this->content_obj->addCell("", "", "", "");
213  $this->updated = $this->pg_obj->update();
214 
215  ilUtil::sendSuccess($this->lng->txt("cont_added_cell"), true);
216  $this->ctrl->redirect($this, "edit");
217  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
+ Here is the call graph for this function:

◆ afterCreation()

ilPCGridGUI::afterCreation ( )

After creation processing.

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

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

Referenced by create().

160  {
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());
168  $this->edit();
169  }
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 250 of file class.ilPCGridGUI.php.

251  {
252  $this->ctrl->redirect($this, "edit");
253  }

◆ confirmCellDeletion()

ilPCGridGUI::confirmCellDeletion ( )

Confirm cell deletion.

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

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

223  {
224  $this->setTabs();
225 
226  if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
227  ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
228  $this->ctrl->redirect($this, "edit");
229  } else {
230  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
231  $cgui = new ilConfirmationGUI();
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");
236 
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]);
241  }
242 
243  $this->tpl->setContent($cgui->getHTML());
244  }
245  }
setTabs()
Set tabs.
if(!array_key_exists('StateId', $_REQUEST)) $id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$i
Definition: disco.tpl.php:19
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ create()

ilPCGridGUI::create ( )

Create new grid element.

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

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

132  {
133  $form = $this->initCreationForm();
134  if ($form->checkInput()) {
135  $this->content_obj = new ilPCGrid($this->getPage());
136  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
137 
138  for ($i = 0; $i < (int) $_POST["number_of_cells"]; $i++) {
139  $this->content_obj->addGridCell($_POST["s"], $_POST["m"], $_POST["l"], $_POST["xl"]);
140  }
141 
142  $this->updated = $this->pg_obj->update();
143 
144  if ($this->updated === true) {
145  $this->afterCreation();
146  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
147  } else {
148  $this->insert();
149  }
150  } else {
151  $form->setValuesByPost();
152  $this->tpl->setContent($form->getHTML());
153  }
154  }
afterCreation()
After creation processing.
Grid element.
initCreationForm()
Init creation form.
if(isset($_POST['submit'])) $form
$i
Definition: disco.tpl.php:19
insert()
Insert new grid.
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteCells()

ilPCGridGUI::deleteCells ( )

Delete Cells.

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

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

259  {
261 
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]);
266  }
267  }
268  $this->updated = $this->pg_obj->update();
269 
270  $ilCtrl->redirect($this, "edit");
271  }
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]

◆ edit()

ilPCGridGUI::edit ( )

List all cells.

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

References setTabs().

Referenced by afterCreation().

180  {
181  $this->toolbar->addButton(
182  $this->lng->txt("cont_add_cell"),
183  $this->ctrl->getLinkTarget($this, "addCell")
184  );
185 
186  $this->setTabs();
187  $this->tabs->activateTab("settings");
188  include_once("./Services/COPage/classes/class.ilPCGridCellTableGUI.php");
189  $table_gui = new ilPCGridCellTableGUI($this, "edit", $this->content_obj);
190  $this->tpl->setContent($table_gui->getHTML());
191  }
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 76 of file class.ilPCGridGUI.php.

References $form, $html, ilPageContentGUI\displayValidationError(), and setTabs().

77  {
78  $this->displayValidationError();
79  $this->setTabs();
80 
81  $form = $this->initForm();
82  $this->getFormValues($form);
83  $html = $form->getHTML();
84  $this->tpl->setContent($html);
85  }
setTabs()
Set tabs.
if(isset($_POST['submit'])) $form
displayValidationError()
display validation errors
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ executeCommand()

ilPCGridGUI::executeCommand ( )

Execute command.

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

References $ret.

44  {
45  // get next class that processes or forwards current command
46  $next_class = $this->ctrl->getNextClass($this);
47 
48  // get current command
49  $cmd = $this->ctrl->getCmd();
50 
51  switch ($next_class) {
52  default:
53  $ret = $this->$cmd();
54  break;
55  }
56 
57  return $ret;
58  }
$ret
Definition: parser.php:6

◆ initCreationForm()

ilPCGridGUI::initCreationForm ( )

Init creation form.

Returns
ilPropertyFormGUI

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

References $form, $options, $s, $si, array, ilPCGrid\getSizes(), ilPCGrid\getWidths(), and ilNumberInputGUI\setMaxLength().

Referenced by create(), and insert().

92  {
93  // edit form
94  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
95  $form = new ilPropertyFormGUI();
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"));
99 
100  // number of cells
101  $ni = new ilNumberInputGUI($this->lng->txt("cont_grid_nr_cells"), "number_of_cells");
102  $ni->setMaxLength(2);
103  $ni->setSize(2);
104  $form->addItem($ni);
105 
106  $sh = new ilFormSectionHeaderGUI();
107  $sh->setTitle($this->lng->txt("cont_ed_grid_col_width"));
108  $sh->setInfo($this->lng->txt("cont_ed_grid_col_width_info"));
109  $form->addItem($sh);
110 
111  $options = array("" => "") + ilPCGrid::getWidths();
112 
113  // widths
114  foreach (ilPCGrid::getSizes() as $s) {
115  $si = new ilSelectInputGUI($this->lng->txt("cont_grid_width_" . $s), $s);
116  $si->setInfo($this->lng->txt("cont_grid_width_" . $s . "_info"));
117  $si->setOptions($options);
118  $form->addItem($si);
119  }
120 
121  // save/cancel buttons
122  $form->addCommandButton("create_grid", $this->lng->txt("save"));
123  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
124 
125  return $form;
126  }
static getWidths()
Get widths.
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a section header in a property form.
$s
Definition: pwgen.php:45
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
Create styles array
The data for the language used.
setMaxLength($a_maxlength)
Set Max Length.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
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 63 of file class.ilPCGridGUI.php.

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

Referenced by create().

64  {
65  $this->displayValidationError();
66  $form = $this->initCreationForm();
67  if ($this->ctrl->getCmd() == "create") {
68  $form->setValuesByPost();
69  }
70  $this->tpl->setContent($form->getHTML());
71  }
initCreationForm()
Init creation form.
if(isset($_POST['submit'])) $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 294 of file class.ilPCGridGUI.php.

References $_POST, ilUtil\sendSuccess(), and ilUtil\stripSlashesArray().

295  {
296  $width_s = ilUtil::stripSlashesArray($_POST["width_s"]);
297  $width_m = ilUtil::stripSlashesArray($_POST["width_m"]);
298  $width_l = ilUtil::stripSlashesArray($_POST["width_l"]);
299  $width_xl = ilUtil::stripSlashesArray($_POST["width_xl"]);
300  $this->content_obj->saveWidths($width_s, $width_m, $width_l, $width_xl);
301 
302  if (is_array($_POST["position"])) {
303  $positions = ilUtil::stripSlashesArray($_POST["position"]);
304  $this->content_obj->savePositions($positions);
305  }
306  $this->updated = $this->pg_obj->update();
307  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
308  $this->ctrl->redirect($this, "edit");
309  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 196 of file class.ilPCGridGUI.php.

References $_POST, ilUtil\sendSuccess(), and ilUtil\stripSlashesArray().

197  {
198  if (is_array($_POST["position"])) {
199  $positions = ilUtil::stripSlashesArray($_POST["position"]);
200  $this->content_obj->savePositions($positions);
201  }
202  $this->updated = $this->pg_obj->update();
203  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
204  $this->ctrl->redirect($this, "edit");
205  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 277 of file class.ilPCGridGUI.php.

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

278  {
279  $this->tabs->setBackTarget(
280  $this->lng->txt("pg"),
281  $this->ctrl->getParentReturn($this)
282  );
283 
284  $this->tabs->addTab(
285  "settings",
286  $this->lng->txt("settings"),
287  $this->ctrl->getLinkTarget($this, "edit")
288  );
289  }
+ Here is the caller graph for this function:

Field Documentation

◆ $tabs

ilPCGridGUI::$tabs
protected

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

◆ $toolbar

ilPCGridGUI::$toolbar
protected

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


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