ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilPCDataTableGUI 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 ilPCDataTableGUI:
+ Collaboration diagram for ilPCDataTableGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 execute command More...
 
 update (bool $a_redirect=true)
 Update table data in dom and update page in db. More...
 
 updateJS ()
 Update via JavaScript. More...
 
 getNewTableObject ()
 Get new table object. More...
 
 afterCreation ()
 After creation processing. More...
 
 tableAction ()
 Perform operation on table (adding, moving, deleting rows/cols) More...
 
 setTabs (string $data_tab_txt_key="")
 Set tabs. More...
 
 initCreationForm ()
 
 initEditingForm ()
 
 initImportForm ()
 
 initCellPropertiesForm ()
 
- Public Member Functions inherited from ilPCTableGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 setBasicTableCellStyles ()
 
 executeCommand ()
 
 setTabs (string $data_tab_txt_key="")
 
 setCellPropertiesSubTabs ()
 
 getTemplateOptions (string $a_type="")
 Get table templates. More...
 
 edit ()
 
 editProperties ()
 
 initPropertiesForm (string $a_mode="edit")
 
 getPropertiesFormValues ()
 
 editCellStyle ()
 
 editCellWidth ()
 
 editCellSpan ()
 
 setStyles ()
 Set cell styles. More...
 
 setWidths ()
 Set cell widths. More...
 
 setSpans ()
 Set cell spans. More...
 
 setProperties ()
 Set properties from input form. More...
 
 saveProperties ()
 save table properties in db and return to page edit screen More...
 
 rightAlign ()
 
 leftAlign ()
 
 centerAlign ()
 
 leftFloatAlign ()
 
 rightFloatAlign ()
 
 insert ()
 
 getNewTableObject ()
 
 create ()
 create new table in dom and update page in db More...
 
 afterCreation ()
 
 editCellAlignment ()
 
 setAlignment ()
 Set cell alignments. More...
 
 editData ()
 Edit data of table. 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 ()
 
 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...
 

Protected Member Functions

 getFormTitle (string $a_mode="edit")
 
 getCellContent (int $i, int $j)
 
 getCharacteristicPreview (string $key, string $characteristic)
 
- Protected Member Functions inherited from ilPCTableGUI
 getFormTitle (string $a_mode="edit")
 
 getColumnCaption (int $nr)
 
 getCellContent (int $i, int $j)
 
 renderCell (string $content, bool $unmask=true, ?ilPageObject $page_object=null)
 Static render table function. More...
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 
 setEditorToolContext ()
 
 initEditor ()
 
 getEditorScriptTag (string $form_pc_id="", string $form_cname="")
 

Protected Attributes

ILIAS Style Content Preview PreviewGUI $style_preview
 
ILIAS HTTP Services $http
 
ilGlobalTemplateInterface $main_tpl
 
- Protected Attributes inherited from ilPCTableGUI
ILIAS COPage Dom DomUtil $dom_util
 
ILIAS COPage PC PCDefinition $pc_definition
 
ILIAS COPage Xsl XslManager $xsl
 
ilPropertyFormGUI $form
 
ilTabsGUI $tabs
 
ilObjUser $user
 
- Protected Attributes inherited from ilPageContentGUI
ILIAS COPage Editor GUIService $editor_gui
 
ILIAS COPage InternalGUIService $gui
 
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
LOMServices $lom_services
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPCTableGUI
static _renderTable (string $content, string $a_mode="table_edit", string $a_submode="", ?ilPCTable $a_table_obj=null, bool $unmask=true, ?ilPageObject $page_object=null)
 
static _addStyleCheckboxes (string $a_output, ilPCTable $a_table)
 Add style checkboxes in edit mode. More...
 
static _addAlignmentCheckboxes (string $a_output, ilPCTable $a_table)
 Add alignment checkboxes in edit mode. More...
 
static _addWidthInputs (string $a_output, ilPCTable $a_table)
 Add width inputs. More...
 
static _addSpanInputs (string $a_output, ilPCTable $a_table)
 Add span inputs. More...
 
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
DOMDocument $dom
 
array bool null $updated = null
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 
- 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;"
 
- 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 Class ilPCTableGUI User Interface for Data Table Editing

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilPCTableGUI.

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

35 {
36 global $DIC;
37
38 $this->main_tpl = $DIC->ui()->mainTemplate();
39 $this->lng = $DIC->language();
40 $this->ctrl = $DIC->ctrl();
41 $this->tabs = $DIC->tabs();
42 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
43 $this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
44 $this->tool_context = $DIC->globalScreen()->tool()->context();
45 $this->http = $DIC->http();
46 $this->style_preview = $DIC->contentStyle()->gui()->preview();
47 }
setCharacteristics(array $a_chars)
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilPageContentGUI\setCharacteristics(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Member Function Documentation

◆ afterCreation()

ilPCDataTableGUI::afterCreation ( )

After creation processing.

Reimplemented from ilPCTableGUI.

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

224 : void
225 {
226 $ilCtrl = $this->ctrl;
227
228 $this->pg_obj->stripHierIDs();
229 $this->pg_obj->addHierIDs();
230 $ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
231 $ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
232 $ilCtrl->redirect($this, "editData");
233 }
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc

References ilPageContentGUI\$ctrl, and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ executeCommand()

ilPCDataTableGUI::executeCommand ( )

execute command

Returns
mixed

Reimplemented from ilPCTableGUI.

Definition at line 61 of file class.ilPCDataTableGUI.php.

61 : mixed
62 {
63 $this->getCharacteristicsOfCurrentStyle(["table"]); // scorm-2004
64
65 // get next class that processes or forwards current command
66 $next_class = $this->ctrl->getNextClass($this);
67
68 // get current command
69 $cmd = $this->ctrl->getCmd();
70
71 switch ($next_class) {
72 default:
73 $ret = $this->$cmd();
74 break;
75 }
76
77 return $ret;
78 }
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.

References ILIAS\Repository\ctrl(), and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

+ Here is the call graph for this function:

◆ getCellContent()

ilPCDataTableGUI::getCellContent ( int  $i,
int  $j 
)
protected

Reimplemented from ilPCTableGUI.

Definition at line 268 of file class.ilPCDataTableGUI.php.

268 : string
269 {
270 $cmd = $this->ctrl->getCmd();
271 if ($cmd == "update") {
272 $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false);
273 } else {
275 $this->content_obj->getCellText($i, $j),
276 true,
277 false
278 );
280 $s_text,
281 "TableContent",
282 $this->content_obj->readPCId() . "_" . $i . "_" . $j
283 );
284 }
285
286 // #20628
287 $s_text = str_replace("{", "{", $s_text);
288 $s_text = str_replace("}", "}", $s_text);
289 return $s_text;
290 }
static xml2outputJS(string $s_text)
Prepare content for js output.
static xml2output(string $a_text, bool $a_wysiwyg=false, bool $a_replace_lists=true, bool $unmask=true)
Converts xml from DB to output in edit textarea.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References ILIAS\Repository\ctrl(), ilUtil\stripSlashes(), ilPCParagraph\xml2output(), and ilPCParagraphGUI\xml2outputJS().

+ Here is the call graph for this function:

◆ getCharacteristicPreview()

ilPCDataTableGUI::getCharacteristicPreview ( string  $key,
string  $characteristic 
)
protected

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

292 : string
293 {
294 $style = $this->getStyle();
295 if ($style === null) {
296 $html = '<table class="ilc_table_' . $key . '"><tr><td>&nbsp;</td></tr></table>';
297 } elseif (strpos($key, ":") > 0) {
298 $template = explode(":", $key);
299 $html = $this->style_preview->getTemplatePreview(
300 $style->getId(),
301 "table",
302 (int) $template[1],
303 true
304 );
305 } else {
306 $html = $this->style_preview->getTemplatePreview(
307 $style->getId(),
308 "table",
309 0,
310 true
311 );
312 }
313
314 return $html . '<div>' . $characteristic . "</div>";
315 }

References ilPageContentGUI\$style, ilObject\getId(), and ilPageContentGUI\getStyle().

+ Here is the call graph for this function:

◆ getFormTitle()

ilPCDataTableGUI::getFormTitle ( string  $a_mode = "edit")
protected

Reimplemented from ilPCTableGUI.

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

49 : string
50 {
51 if ($a_mode === "create") {
52 return $this->lng->txt("cont_ed_insert_dtab");
53 }
54 return $this->lng->txt("cont_table_properties");
55 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getNewTableObject()

ilPCDataTableGUI::getNewTableObject ( )

Get new table object.

Reimplemented from ilPCTableGUI.

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

217 {
218 return new ilPCDataTable($this->getPage());
219 }
Class ilPCDataTable.

References ilPageContentGUI\getPage().

+ Here is the call graph for this function:

◆ initCellPropertiesForm()

ilPCDataTableGUI::initCellPropertiesForm ( )

Definition at line 513 of file class.ilPCDataTableGUI.php.

515
516 $ilCtrl = $this->ctrl;
518 $ilUser = $this->user;
519
520 $form = new ilPropertyFormGUI();
521 $form->setFormAction($ilCtrl->getFormAction($this));
522 $form->setShowTopButtons(false);
523 $form->setTitle($this->lng->txt("cont_cell_properties"));
524
525 $style_cb = new ilCheckboxInputGUI($lng->txt("cont_change_style"), "style_cb");
526
528 $this->lng->txt("cont_style"),
529 "style"
530 );
531 //$style->setPullRight(false);
533 $this->getCharacteristicsOfCurrentStyle(["table_cell"]); // scorm-2004
534 $chars = $this->getCharacteristics(); // scorm-2004
535 $options = array_merge(array("" => $this->lng->txt("none")), $chars); // scorm-2004
536 foreach ($options as $k => $option) {
537 $class = "";
538 if ($k !== "") {
539 $class = ' class="' . ilLegacyFormElementsUtil::prepareFormOutput("ilc_table_cell_" . $k) . '"';
540 }
541 $html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td' . $class . '>' .
542 ilLegacyFormElementsUtil::prepareFormOutput($option) . '</td></tr></table>';
543 $style->addOption(new ilRadioOption($html, (string) $k));
544 }
545
546 if (count($options) > 1) {
547 $style->setValue("");
548 $style_cb->addSubItem($style);
549 $form->addItem($style_cb);
550 }
551
552 $width_cb = new ilCheckboxInputGUI($lng->txt("cont_change_width"), "width_cb");
553 $ti = new ilTextInputGUI($lng->txt("cont_width_px_perc"), "width");
554 $ti->setMaxLength(20);
555 $ti->setInfo($lng->txt("cont_width_px_perc_info"));
556 $ti->setSize(7);
557 $width_cb->addSubItem($ti);
558 $form->addItem($width_cb);
559
560 // alignment
561 $al_cb = new ilCheckboxInputGUI($lng->txt("cont_change_alignment"), "al_cb");
562 $options = array(
563 "" => $lng->txt("default"),
564 "Left" => $lng->txt("cont_left"),
565 "Center" => $lng->txt("cont_center"),
566 "Right" => $lng->txt("cont_right")
567 );
568 $si = new ilSelectInputGUI($lng->txt("cont_alignment"), "alignment");
569 $si->setOptions($options);
570 $al_cb->addSubItem($si);
571 $form->addItem($al_cb);
572
573 return $form;
574 }
This class represents a checkbox property in a property form.
setFormAction(string $a_formaction)
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
ilPropertyFormGUI $form
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.
This class represents a text property in a property form.

◆ initCreationForm()

ilPCDataTableGUI::initCreationForm ( )

Definition at line 317 of file class.ilPCDataTableGUI.php.

319
320 $a_seleted_value = "";
321 $ilCtrl = $this->ctrl;
323 $ilUser = $this->user;
324
325 $form = new ilPropertyFormGUI();
326 $form->setFormAction($ilCtrl->getFormAction($this));
327 $form->setShowTopButtons(false);
328 $form->setTitle($this->getFormTitle("create"));
329
330 $nr = array();
331 for ($i = 1; $i <= 20; $i++) {
332 $nr[$i] = $i;
333 }
334
335 // cols
336 $cols = new ilSelectInputGUI($this->lng->txt("cont_nr_cols"), "nr_cols");
337 $cols->setOptions($nr);
338 $cols->setValue(2);
339 $form->addItem($cols);
340
341 // rows
342 $rows = new ilSelectInputGUI($this->lng->txt("cont_nr_rows"), "nr_rows");
343 $rows->setOptions($nr);
344 $rows->setValue(2);
346
347 // table templates and table classes
348 $char_prop = new ilRadioGroupInputGUI(
349 $this->lng->txt("cont_table_style"),
350 "characteristic"
351 );
352 $chars = $this->getCharacteristics();
353 $templates = $this->getTemplateOptions();
354 $chars = array_merge($templates, $chars);
355 if (is_object($this->content_obj)) {
356 if (($chars[$a_seleted_value] ?? "") == "" && ($this->content_obj->getClass() != "")) {
357 $chars = array_merge(
358 array($this->content_obj->getClass() => $this->content_obj->getClass()),
359 $chars
360 );
361 }
362 }
363 $options = [];
364 foreach ($chars as $k => $char) {
365 $html = $this->getCharacteristicPreview($k, $char);
366 //$char_prop->addOption($k, $char, $html);
367 $options[$k] = $char;
368 $ro = new ilRadioOption($html, $k);
369 $char_prop->addOption($ro);
370 }
371 if (count($chars) > 1) {
372 $char_prop->setValue("StandardTable");
373 $form->addItem($char_prop);
374 }
375
376 // row header
377 $cb = new ilCheckboxInputGUI($lng->txt("cont_has_row_header"), "has_row_header");
378 $form->addItem($cb);
379
380 $form->addCommandButton("create", $lng->txt("save"));
381 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
382
383 return $form;
384 }
getFormTitle(string $a_mode="edit")
getCharacteristicPreview(string $key, string $characteristic)
getTemplateOptions(string $a_type="")
Get table templates.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")

◆ initEditingForm()

ilPCDataTableGUI::initEditingForm ( )

Definition at line 386 of file class.ilPCDataTableGUI.php.

388
389 $a_seleted_value = "";
390 $ilCtrl = $this->ctrl;
392 $ilUser = $this->user;
393
394 $form = new ilPropertyFormGUI();
395 $form->setFormAction($ilCtrl->getFormAction($this));
396 $form->setShowTopButtons(false);
397 $form->setTitle($this->getFormTitle("edit"));
398
399 // table templates and table classes
400 $char_prop = new ilRadioGroupInputGUI(
401 $this->lng->txt("cont_table_style"),
402 "characteristic"
403 );
404 $chars = $this->getCharacteristics();
405 $templates = $this->getTemplateOptions();
406 $chars = array_merge($templates, $chars);
407 if (is_object($this->content_obj)) {
408 if (($chars[$a_seleted_value] ?? "") == "" && ($this->content_obj->getClass() != "")) {
409 $chars = array_merge(
410 array($this->content_obj->getClass() => $this->content_obj->getClass()),
411 $chars
412 );
413 }
414 }
415 $options = [];
416 foreach ($chars as $k => $char) {
417 $html = $this->getCharacteristicPreview($k, $char);
418 $options[$k] = $char;
419 $ro = new ilRadioOption($html, $k);
420 $char_prop->addOption($ro);
421 }
422 //$char_prop->setOptions($options);
423 if (count($chars) > 1) {
424 if ($this->content_obj->getTemplate() !== "") {
425 $val = "t:" .
426 ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()) . ":" .
427 $this->content_obj->getTemplate();
428 } else {
429 $val = $this->content_obj->getClass();
430 }
431 $char_prop->setValue($val);
432 $form->addItem($char_prop);
433 }
434
435 // row header
436 $cb = new ilCheckboxInputGUI($lng->txt("cont_has_row_header"), "has_row_header");
437 if ($this->content_obj->getHeaderRows() > 0) {
438 $cb->setChecked(true);
439 }
440 $form->addItem($cb);
441
442 return $form;
443 }
static _lookupTemplateIdByName(int $a_style_id, string $a_name)
Lookup table template preview.

◆ initImportForm()

ilPCDataTableGUI::initImportForm ( )

Definition at line 445 of file class.ilPCDataTableGUI.php.

447
448 $a_seleted_value = "";
449 $ilCtrl = $this->ctrl;
451 $ilUser = $this->user;
452
453 $form = new ilPropertyFormGUI();
454 $form->setFormAction($ilCtrl->getFormAction($this));
455 $form->setShowTopButtons(false);
456 $form->setTitle($this->getFormTitle("create"));
457
458 $hi = new ilHiddenInputGUI("import");
459 $hi->setValue("1");
460 $form->addItem($hi);
461
462 $import_data = new ilTextAreaInputGUI("", "import_table");
463 $import_data->setInfo($this->lng->txt("cont_table_import_info"));
464 $import_data->setRows(8);
465 $import_data->setCols(50);
466 $form->addItem($import_data);
467
468 // table templates and table classes
469 $char_prop = new ilSelectInputGUI(
470 $this->lng->txt("cont_table_style"),
471 "import_characteristic"
472 );
473 $chars = $this->getCharacteristics();
474 $templates = $this->getTemplateOptions();
475 $chars = array_merge($templates, $chars);
476 if (is_object($this->content_obj)) {
477 if (($chars[$a_seleted_value] ?? "") == "" && ($this->content_obj->getClass() != "")) {
478 $chars = array_merge(
479 array($this->content_obj->getClass() => $this->content_obj->getClass()),
480 $chars
481 );
482 }
483 }
484 $options = [];
485 foreach ($chars as $k => $char) {
486 if (strpos($k, ":") > 0) {
487 $t = explode(":", $k);
488 $html = $this->style->lookupTemplatePreview($t[1]) . '<div style="clear:both;" class="small">' . $char . "</div>";
489 } else {
490 $html = '<table class="ilc_table_' . $k . '"><tr><td class="small">' .
491 $char . '</td></tr></table>';
492 }
493 //$char_prop->addOption($k, $char, $html);
494 $options[$k] = $char;
495 }
496 if (count($chars) > 1) {
497 $char_prop->setOptions($options);
498 $char_prop->setValue("StandardTable");
499 $form->addItem($char_prop);
500 }
501
502 // row header
503 $cb = new ilCheckboxInputGUI($lng->txt("cont_has_row_header"), "has_row_header");
504 $form->addItem($cb);
505
506
507 $form->addCommandButton("create", $lng->txt("save"));
508 $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
509
510 return $form;
511 }
This class represents a hidden form property in a property form.
This class represents a text area property in a property form.

◆ setTabs()

ilPCDataTableGUI::setTabs ( string  $data_tab_txt_key = "")

Set tabs.

Reimplemented from ilPCTableGUI.

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

263 : void
264 {
265 parent::setTabs("cont_ed_edit_data");
266 }

◆ tableAction()

ilPCDataTableGUI::tableAction ( )

Perform operation on table (adding, moving, deleting rows/cols)

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

238 : void
239 {
240 $ilCtrl = $this->ctrl;
241
242 $this->update(false);
243 $this->pg_obj->addHierIDs();
244
245 $type = $this->request->getString("type");
246 $action = $this->request->getString("action");
247 $id = $this->request->getInt("id");
248
249 $cell_hier_id = ($type == "col")
250 ? $this->hier_id . "_1_" . ($id + 1)
251 : $this->hier_id . "_" . ($id + 1) . "_1";
252 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
253 if (is_object($cell_obj)) {
254 $cell_obj->$action();
255 $this->edit_repo->setPageError($this->pg_obj->update());
256 }
257 $ilCtrl->redirect($this, "editData");
258 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
update(bool $a_redirect=true)
Update table data in dom and update page in db.

References ilPageContentGUI\$ctrl, $id, and update().

+ Here is the call graph for this function:

◆ update()

ilPCDataTableGUI::update ( bool  $a_redirect = true)

Update table data in dom and update page in db.

Definition at line 88 of file class.ilPCDataTableGUI.php.

88 : void
89 {
91
92 // handle input data
93 $data = array();
94 $cell = $this->request->getArrayArray("cell");
95 if (is_array($cell)) {
96 foreach ($cell as $i => $row) {
97 if (is_array($row)) {
98 foreach ($row as $j => $cell) {
99 $data[$i][$j] =
101 $cell,
102 $this->content_obj->getLanguage()
103 );
104 }
105 }
106 }
107 }
108
109 $this->updated = $this->content_obj->setData($data);
110
111 if ($this->updated !== true) {
112 $this->editData();
113 return;
114 }
115
116 $this->updated = $this->pg_obj->update();
117
118 if ($a_redirect) {
119 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
120 $this->ctrl->redirect($this, "editData");
121 }
122 }
static _input2xml(string $a_text, string $a_lang, bool $a_wysiwyg=false, bool $a_handle_lists=true)
Converts user input to xml User input comes as bb code information, e.g.
editData()
Edit data of table.
$data
Definition: storeScorm.php:45

References $data, ilPageContentGUI\$lng, ilPCParagraph\_input2xml(), ILIAS\Repository\ctrl(), ilPCTableGUI\editData(), and ilLanguage\txt().

Referenced by tableAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateJS()

ilPCDataTableGUI::updateJS ( )

Update via JavaScript.

Definition at line 127 of file class.ilPCDataTableGUI.php.

127 : void
128 {
130 $ilCtrl = $this->ctrl;
131
132 if ($this->request->getString("cancel_update") != "") {
133 // $this->ctrl->redirect($this, "editData");
134 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
135 }
136
137 // handle input data
138 $data = array();
139 $post = $this->http->request()->getParsedBody();
140 foreach ($post as $k => $content) {
141 if (substr($k, 0, 5) != "cell_") {
142 continue;
143 }
144
145 // determine cell content
146 $div = ilUtil::stripSlashes($content, false);
147 $p1 = strpos($div, '>');
148 $div = substr($div, $p1 + 1);
149 $div = "<div class='ilc_text_block_TableContent'>" . $div;
151 if ($text === false) {
152 $ilCtrl->returnToParent($this, "jump" . $this->hier_id);
153 }
154 $text = $text["text"];
155
157 $text,
158 $this->content_obj->getLanguage(),
159 true,
160 false
161 );
163
164 // set content in data array
165 $id = explode("_", $k);
166 $data[(int) $id[1]][(int) $id[2]] = $text;
167 }
168
169 // update data
170 $this->updated = $this->content_obj->setData($data);
171
172 if ($this->updated !== true) {
173 $this->editData();
174 return;
175 }
176
177 $this->updated = $this->pg_obj->update();
178
179 $tab_cmd_id = $this->request->getInt("tab_cmd_id");
180 $tab_cmd_type = $this->request->getString("tab_cmd_type");
181 $tab_cmd = $this->request->getString("tab_cmd");
182
183 // perform table action? (move...?)
184 //$this->update(false);
185 $this->pg_obj->addHierIDs();
186 $failed = false;
187 if ($tab_cmd != "") {
188 $cell_hier_id = ($tab_cmd_type == "col")
189 ? $this->hier_id . "_1_" . ($tab_cmd_id + 1)
190 : $this->hier_id . "_" . ($tab_cmd_id + 1) . "_1";
191 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
192 if (is_object($cell_obj)) {
193 $cell_obj->$tab_cmd();
194 $ret = $this->pg_obj->update();
195 if ($ret !== true) {
196 $this->main_tpl->setOnScreenMessage('failure', $ret[0][1], true);
197 $failed = true;
198 }
199 }
200 }
201
202 if (!$failed) {
203 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
204 }
205 if ($this->request->getString("save_return") != "") {
206 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
207 } else {
208 $this->ctrl->redirect($this, "editData");
209 }
210 }
static handleAjaxContentPost(string $text)
Post input2xml handling of ajax content.
static handleAjaxContent(string $a_content)
Handle ajax content.
$text
Definition: xapiexit.php:21

References ilPageContentGUI\$ctrl, $data, $id, ilPageContentGUI\$lng, $text, ilPCParagraph\_input2xml(), ILIAS\Repository\ctrl(), ilPCTableGUI\editData(), ilPCParagraph\handleAjaxContent(), ilPCParagraph\handleAjaxContentPost(), ILIAS\FileDelivery\http(), ILIAS\Repository\int(), ilUtil\stripSlashes(), and ilLanguage\txt().

+ Here is the call graph for this function:

Field Documentation

◆ $http

ILIAS HTTP Services ilPCDataTableGUI::$http
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilPCDataTableGUI::$main_tpl
protected

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

◆ $style_preview

ILIAS Style Content Preview PreviewGUI ilPCDataTableGUI::$style_preview
protected

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


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