ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCGridGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 insert ()
 
 initCreationForm ()
 Init creation form. More...
 
 create ()
 Create new grid element. More...
 
 afterCreation ()
 
 saveCells ()
 Save cell properties. More...
 
 addCell ()
 Add cell. More...
 
 confirmCellDeletion ()
 Confirm cell deletion. More...
 
 cancelCellDeletion ()
 Cancel cell deletion. More...
 
 deleteCells ()
 Delete Cells. More...
 
 setTabs ()
 
 saveCellData ()
 Save tabs properties in db and return to page edit screen. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 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 ()
 
 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 (string $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
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
php4DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 

Protected Attributes

ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 
- Protected Attributes inherited from ilPageContentGUI
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Static Public Attributes inherited from ilPageContentGUI
static string $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 (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Responsive Grid UI class

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

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

Constructor & Destructor Documentation

◆ __construct()

ilPCGridGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

40  {
41  global $DIC;
42 
43  $this->ctrl = $DIC->ctrl();
44  $ilToolbar = $DIC->toolbar();
45  $ilTabs = $DIC->tabs();
46 
47  $this->toolbar = $ilToolbar;
48  $this->tabs = $ilTabs;
49  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
50  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addCell()

ilPCGridGUI::addCell ( )

Add cell.

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

230  : void
231  {
232  $this->content_obj->addCell();
233  $this->updated = $this->pg_obj->update();
234 
235  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_added_cell"), true);
236  $this->ctrl->redirect($this, "edit");
237  }
+ Here is the call graph for this function:

◆ afterCreation()

ilPCGridGUI::afterCreation ( )

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

References ilPageContentGUI\$content_obj, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilPageContentGUI\setHierId(), setTabs(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

Referenced by create().

178  : void
179  {
180  $this->pg_obj->stripHierIDs();
181  $this->pg_obj->addHierIDs();
182  $this->ctrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
183  $this->ctrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
184  $this->content_obj->setHierId($this->content_obj->readHierId());
185  $this->setHierId($this->content_obj->readHierId());
186  $this->content_obj->setPcId($this->content_obj->readPCId());
187  $this->edit();
188  }
setHierId(string $a_hier_id)
set 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 270 of file class.ilPCGridGUI.php.

References ILIAS\Repository\ctrl().

270  : void
271  {
272  $this->ctrl->redirect($this, "edit");
273  }
+ Here is the call graph for this function:

◆ confirmCellDeletion()

ilPCGridGUI::confirmCellDeletion ( )

Confirm cell deletion.

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

References $i, $id, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and setTabs().

242  : void
243  {
244  $this->setTabs();
245 
246  $tid = $this->request->getStringArray("tid");
247  if (count($tid) == 0) {
248  $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_checkbox"), true);
249  $this->ctrl->redirect($this, "edit");
250  } else {
251  $cgui = new ilConfirmationGUI();
252  $cgui->setFormAction($this->ctrl->getFormAction($this));
253  $cgui->setHeaderText($this->lng->txt("cont_grid_cell_confirm_deletion"));
254  $cgui->setCancel($this->lng->txt("cancel"), "cancelCellDeletion");
255  $cgui->setConfirm($this->lng->txt("delete"), "deleteCells");
256 
257  foreach ($tid as $k => $i) {
258  $id = explode(":", $k);
259  $id = explode("_", $id[0]);
260  $cgui->addItem("tid[]", $k, $this->lng->txt("cont_grid_cell") . " " . $id[count($id) - 1]);
261  }
262 
263  $this->tpl->setContent($cgui->getHTML());
264  }
265  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$i
Definition: metadata.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ create()

ilPCGridGUI::create ( )

Create new grid element.

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

References afterCreation(), ilPageContentGUI\getPage(), initCreationForm(), insert(), and ILIAS\Repository\int().

149  : void
150  {
151  $form = $this->initCreationForm();
152  if ($form->checkInput()) {
153  $post_layout_template = (int) $form->getInput("layout_template");
154  $this->content_obj = new ilPCGrid($this->getPage());
155  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
156  $this->content_obj->applyTemplate(
157  $post_layout_template,
158  (int) $form->getInput("number_of_cells"),
159  (int) $form->getInput("s"),
160  (int) $form->getInput("m"),
161  (int) $form->getInput("l"),
162  (int) $form->getInput("xl")
163  );
164  $this->updated = $this->pg_obj->update();
165 
166  if ($this->updated === true) {
167  $this->afterCreation();
168  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
169  } else {
170  $this->insert();
171  }
172  } else {
173  $form->setValuesByPost();
174  $this->tpl->setContent($form->getHTML());
175  }
176  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initCreationForm()
Init creation form.
+ Here is the call graph for this function:

◆ deleteCells()

ilPCGridGUI::deleteCells ( )

Delete Cells.

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

References ilPageContentGUI\$ctrl.

278  : void
279  {
280  $ilCtrl = $this->ctrl;
281 
282  $tids = $this->request->getStringArray("tid");
283  foreach ($tids as $tid) {
284  $ids = explode(":", $tid);
285  $this->content_obj->deleteGridCell($ids[0], $ids[1]);
286  }
287  $this->updated = $this->pg_obj->update();
288 
289  $ilCtrl->redirect($this, "edit");
290  }

◆ executeCommand()

ilPCGridGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

52  : void
53  {
54  // get next class that processes or forwards current command
55  $next_class = $this->ctrl->getNextClass($this);
56 
57  // get current command
58  $cmd = $this->ctrl->getCmd();
59 
60  switch ($next_class) {
61  default:
62  $this->$cmd();
63  break;
64  }
65  }
+ Here is the call graph for this function:

◆ initCreationForm()

ilPCGridGUI::initCreationForm ( )

Init creation form.

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

References ilPageContentGUI\$lng, ILIAS\Repository\ctrl(), ilPCGrid\getSizes(), ilPCGrid\getWidths(), ILIAS\Repository\lng(), ilNumberInputGUI\setMaxLength(), ilRadioGroupInputGUI\setValue(), and ilLanguage\txt().

Referenced by create(), ilPCGridEditorGUI\getEditComponentForm(), and insert().

93  {
94  $lng = $this->lng;
95 
96  // edit form
97  $form = new ilPropertyFormGUI();
98  $form->setFormAction($this->ctrl->getFormAction($this));
99  $form->setTitle($this->lng->txt("cont_ed_insert_grid"));
100  $form->setDescription($this->lng->txt("cont_ed_insert_grid_info"));
101 
102  //
103  $radg = new ilRadioGroupInputGUI($lng->txt("cont_pc_grid"), "layout_template");
104  $radg->setValue(self::TEMPLATE_TWO_COLUMN);
105  $op1 = new ilRadioOption($lng->txt("cont_grid_t_two_column"), self::TEMPLATE_TWO_COLUMN, $lng->txt("cont_grid_t_two_column_info"));
106  $radg->addOption($op1);
107  $op2 = new ilRadioOption($lng->txt("cont_grid_t_three_column"), self::TEMPLATE_THREE_COLUMN, $lng->txt("cont_grid_t_three_column_info"));
108  $radg->addOption($op2);
109  $op3 = new ilRadioOption($lng->txt("cont_grid_t_main_side"), self::TEMPLATE_MAIN_SIDE, $lng->txt("cont_grid_t_main_side_info"));
110  $radg->addOption($op3);
111  $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"));
112  $radg->addOption($op4);
113  $op5 = new ilRadioOption($lng->txt("cont_grid_t_manual"), self::TEMPLATE_MANUAL, $lng->txt("cont_grid_t_manual_info"));
114  $radg->addOption($op5);
115  $form->addItem($radg);
116 
117 
118  // number of cells
119  $ni = new ilNumberInputGUI($this->lng->txt("cont_grid_nr_cells"), "number_of_cells");
120  $ni->setMaxLength(2);
121  $ni->setSize(2);
122  $op5->addSubItem($ni);
123 
124  /*$sh = new ilFormSectionHeaderGUI();
125  $sh->setTitle($this->lng->txt("cont_ed_grid_col_width"));
126  $sh->setInfo($this->lng->txt("cont_ed_grid_col_width_info"));
127  $form->addItem($sh);*/
128 
129  $options = array("" => "") + ilPCGrid::getWidths();
130 
131  // widths
132  foreach (ilPCGrid::getSizes() as $s) {
133  $si = new ilSelectInputGUI($this->lng->txt("cont_grid_width_" . $s), $s);
134  $si->setInfo($this->lng->txt("cont_grid_width_" . $s . "_info"));
135  $si->setOptions($options);
136  $op5->addSubItem($si);
137  }
138 
139  // save/cancel buttons
140  $form->addCommandButton("create_grid", $this->lng->txt("save"));
141  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
142 
143  return $form;
144  }
static getWidths()
Get widths.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setMaxLength(int $a_maxlength)
This class represents a property in a property form.
This class represents a number property in a property form.
static getSizes()
Get sizes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCGridGUI::insert ( )

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

References ILIAS\Repository\ctrl(), ilPageContentGUI\displayValidationError(), and initCreationForm().

Referenced by create().

67  : void
68  {
69  $this->displayValidationError();
70  $form = $this->initCreationForm();
71  if ($this->ctrl->getCmd() == "create") {
72  $form->setValuesByPost();
73  }
74  $this->tpl->setContent($form->getHTML());
75  }
initCreationForm()
Init creation form.
+ 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 309 of file class.ilPCGridGUI.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

309  : void
310  {
311  $width_s = $this->request->getStringArray("width_s");
312  $width_m = $this->request->getStringArray("width_m");
313  $width_l = $this->request->getStringArray("width_l");
314  $width_xl = $this->request->getStringArray("width_xl");
315  $this->content_obj->saveWidths($width_s, $width_m, $width_l, $width_xl);
316 
317  $pos = $this->request->getStringArray("position");
318  if (count($pos) > 0) {
319  $this->content_obj->savePositions($pos);
320  }
321  $this->updated = $this->pg_obj->update();
322  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
323  $this->ctrl->redirect($this, "edit");
324  }
+ Here is the call graph for this function:

◆ saveCells()

ilPCGridGUI::saveCells ( )

Save cell properties.

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

216  : void
217  {
218  $pos = $this->request->getStringArray("position");
219  if (count($pos) > 0) {
220  $this->content_obj->savePositions($pos);
221  }
222  $this->updated = $this->pg_obj->update();
223  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
224  $this->ctrl->redirect($this, "edit");
225  }
+ Here is the call graph for this function:

◆ setTabs()

ilPCGridGUI::setTabs ( )

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by afterCreation(), and confirmCellDeletion().

292  : void
293  {
294  $this->tabs->setBackTarget(
295  $this->lng->txt("pg"),
296  $this->ctrl->getParentReturn($this)
297  );
298 
299  $this->tabs->addTab(
300  "settings",
301  $this->lng->txt("settings"),
302  $this->ctrl->getLinkTarget($this, "edit")
303  );
304  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $tabs

ilTabsGUI ilPCGridGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilPCGridGUI::$toolbar
protected

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

◆ TEMPLATE_MAIN_SIDE

const ilPCGridGUI::TEMPLATE_MAIN_SIDE = 3

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

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_MANUAL

const ilPCGridGUI::TEMPLATE_MANUAL = 0

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

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_THREE_COLUMN

const ilPCGridGUI::TEMPLATE_THREE_COLUMN = 2

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

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_TWO_BY_TWO

const ilPCGridGUI::TEMPLATE_TWO_BY_TWO = 4

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

Referenced by ilPCGrid\applyTemplate().

◆ TEMPLATE_TWO_COLUMN

const ilPCGridGUI::TEMPLATE_TWO_COLUMN = 1

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

Referenced by ilPCGrid\applyTemplate().


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