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