ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
16  var $online_help_mode = false;
17 
18 
22  function __construct($a_parent_obj, $a_parent_cmd, $a_validation = false,
23  $a_oh_mode = false)
24  {
25  global $ilCtrl, $lng, $ilAccess, $lng;
26 
27  $this->setOnlineHelpMode($a_oh_mode);
28  $this->setId("lm_expids");
29  $this->validation = $a_validation;
30 
31  parent::__construct($a_parent_obj, $a_parent_cmd);
32  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
33 
34  if ($this->getOnlineHelpMode())
35  {
36  $this->setData(ilStructureObject::getChapterList($this->parent_obj->object->getId()));
37  $this->cnt_exp_ids = ilLMPageObject::getDuplicateExportIDs(
38  $this->parent_obj->object->getId(), "st");
39  }
40  else
41  {
42  $this->setData(ilLMPageObject::getPageList($this->parent_obj->object->getId()));
43  $this->cnt_exp_ids = ilLMPageObject::getDuplicateExportIDs(
44  $this->parent_obj->object->getId());
45  }
46 
47  $this->setTitle($lng->txt("cont_html_export_ids"));
48 
49  $this->addColumn($this->lng->txt("pg"), "title");
50  $this->addColumn($this->lng->txt("cont_export_id"));
51 
52  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
53  $this->setRowTemplate("tpl.export_id_row.html", "Modules/LearningModule");
54  $this->setDefaultOrderField("title");
55  $this->setDefaultOrderDirection("asc");
56 
57  $this->addCommandButton("saveExportIDs", $lng->txt("save"));
58  }
59 
65  function setOnlineHelpMode($a_val)
66  {
67  $this->online_help_mode = $a_val;
68  }
69 
75  function getOnlineHelpMode()
76  {
78  }
79 
83  protected function fillRow($a_set)
84  {
85  global $lng;
86 
87  $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
88  $this->tpl->setVariable("PAGE_ID", $a_set["obj_id"]);
89 
91  $this->parent_obj->object->getId(), $a_set["obj_id"], $a_set["type"]);
92 
93  if ($this->validation)
94  {
95  if (!preg_match("/^[a-zA-Z_]*$/",
96  trim($_POST["exportid"][$a_set["obj_id"]])))
97  {
98  // @todo: move to style
99  $this->tpl->setVariable("STYLE",
100  " style='background-color: #FCEAEA;' ");
101  $this->tpl->setVariable("ALERT_IMG",
102  ilUtil::img(ilUtil::getImagePath("icon_alert_s.png"),
103  $lng->txt("alert"))
104  );
105  }
106  $this->tpl->setVariable("EXPORT_ID",
108  ilUtil::stripSlashes($_POST["exportid"][$a_set["obj_id"]])));
109  }
110  else
111  {
112  $this->tpl->setVariable("EXPORT_ID",
113  ilUtil::prepareFormOutput($exp_id));
114  }
115 
116  if ($this->cnt_exp_ids[$exp_id] > 1)
117  {
118  $this->tpl->setVariable("ITEM_ADD_TXT",
119  $lng->txt("cont_exp_id_used_multiple"));
120  $this->tpl->setVariable("ALERT_IMG",
121  ilUtil::img(ilUtil::getImagePath("icon_alert_s.png"),
122  $lng->txt("alert"))
123  );
124  if (!$this->dup_info_given)
125  {
126  ilUtil::sendInfo($lng->txt("content_some_export_ids_multiple_times"));
127  $this->dup_info_given = true;
128  }
129  }
130  }
131 
132 }
133 
134 ?>