ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilExportIDTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
14{
18 protected $access;
19
20 public $online_help_mode = false;
21
22
26 public function __construct(
27 $a_parent_obj,
28 $a_parent_cmd,
29 $a_validation = false,
30 $a_oh_mode = false
31 ) {
32 global $DIC;
33
34 $this->ctrl = $DIC->ctrl();
35 $this->lng = $DIC->language();
36 $this->access = $DIC->access();
37
38 $ilCtrl = $DIC->ctrl();
39 $lng = $DIC->language();
40
41 $this->setOnlineHelpMode($a_oh_mode);
42 $this->setId("lm_expids");
43 $this->validation = $a_validation;
44
45 parent::__construct($a_parent_obj, $a_parent_cmd);
46
47 if ($this->getOnlineHelpMode()) {
48 $this->setData(ilStructureObject::getChapterList($this->parent_obj->object->getId()));
49 $this->cnt_exp_ids = ilLMPageObject::getDuplicateExportIDs(
50 $this->parent_obj->object->getId(),
51 "st"
52 );
53 } else {
54 $this->setData(ilLMPageObject::getPageList($this->parent_obj->object->getId()));
55 $this->cnt_exp_ids = ilLMPageObject::getDuplicateExportIDs(
56 $this->parent_obj->object->getId()
57 );
58 }
59
60 $this->setTitle($lng->txt("cont_html_export_ids"));
61
62 $this->addColumn($this->lng->txt("pg"), "title");
63 $this->addColumn($this->lng->txt("cont_export_id"));
64
65 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
66 $this->setRowTemplate("tpl.export_id_row.html", "Modules/LearningModule");
67 $this->setDefaultOrderField("title");
68 $this->setDefaultOrderDirection("asc");
69
70 $this->addCommandButton("saveExportIDs", $lng->txt("save"));
71 }
72
78 public function setOnlineHelpMode($a_val)
79 {
80 $this->online_help_mode = $a_val;
81 }
82
88 public function getOnlineHelpMode()
89 {
91 }
92
96 protected function fillRow($a_set)
97 {
99
100 $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
101 $this->tpl->setVariable("PAGE_ID", $a_set["obj_id"]);
102
104 $this->parent_obj->object->getId(),
105 $a_set["obj_id"],
106 $a_set["type"]
107 );
108
109 if ($this->validation) {
110 if (!preg_match(
111 "/^[a-zA-Z_]*$/",
112 trim($_POST["exportid"][$a_set["obj_id"]])
113 )) {
114 // @todo: move to style
115 $this->tpl->setVariable(
116 "STYLE",
117 " style='background-color: #FCEAEA;' "
118 );
119 $this->tpl->setVariable(
120 "ALERT_IMG",
122 ilUtil::getImagePath("icon_alert.svg"),
123 $lng->txt("alert")
124 )
125 );
126 }
127 $this->tpl->setVariable(
128 "EXPORT_ID",
130 ilUtil::stripSlashes($_POST["exportid"][$a_set["obj_id"]])
131 )
132 );
133 } else {
134 $this->tpl->setVariable(
135 "EXPORT_ID",
137 );
138 }
139
140 if ($this->cnt_exp_ids[$exp_id] > 1) {
141 $this->tpl->setVariable(
142 "ITEM_ADD_TXT",
143 $lng->txt("cont_exp_id_used_multiple")
144 );
145 $this->tpl->setVariable(
146 "ALERT_IMG",
148 ilUtil::getImagePath("icon_alert.svg"),
149 $lng->txt("alert")
150 )
151 );
152 if (!$this->dup_info_given) {
153 ilUtil::sendInfo($lng->txt("content_some_export_ids_multiple_times"));
154 $this->dup_info_given = true;
155 }
156 }
157 }
158}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
getOnlineHelpMode()
Get online help mode.
setOnlineHelpMode($a_val)
Set online help mode.
fillRow($a_set)
Fill table row.
__construct( $a_parent_obj, $a_parent_cmd, $a_validation=false, $a_oh_mode=false)
Constructor.
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
static getDuplicateExportIDs($a_lm_id, $a_type="pg")
Get duplicate export IDs (count export ID usages)
static getPageList($lm_id)
static
static getChapterList($a_lm_id)
export (sub)structure objects of structure object (see ilias_co.dtd)
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46