ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLMPagesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
20  function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng;
23 
24  $this->lm = $a_lm;
25  $this->lm_set = new ilSetting("lm");
26  parent::__construct($a_parent_obj, $a_parent_cmd);
27  $this->setData(ilLMPageObject::getPageList($this->lm->getId()));
28  $this->setTitle($lng->txt("cont_pages"));
29 
30  $this->addColumn($this->lng->txt(""), "", "1");
31  $this->addColumn($this->lng->txt("type"), "", "1");
32  $this->addColumn($this->lng->txt("title"));
33  $this->addColumn($this->lng->txt("cont_usage"));
34 
35  $this->setSelectAllCheckbox("id[]");
36 
37  if ($this->lm->getLayoutPerPage())
38  {
39  $this->addColumn($this->lng->txt("cont_layout"));
40  }
41 
42  $this->setLimit(9999);
43 
44  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
45  $this->setRowTemplate("tpl.page_list_row.html", "Modules/LearningModule");
46 
48  ilEditClipboard::getAction() == "copy")
49  {
50  $this->addMultiCommand("pastePage", $lng->txt("pastePage"));
51  }
52 
53  if ($this->lm->getLayoutPerPage())
54  {
55  $this->addMultiCommand("setPageLayout", $lng->txt("cont_set_layout"));
56  }
57 
58  $this->addMultiCommand("activatePages", $lng->txt("cont_de_activate"));
59  $this->addMultiCommand("movePage", $lng->txt("movePage"));
60  $this->addMultiCommand("copyPage", $lng->txt("copyPage"));
61  $this->addMultiCommand("delete", $lng->txt("delete"));
62  $this->addMultiCommand("selectHeader", $lng->txt("selectHeader"));
63  $this->addMultiCommand("selectFooter", $lng->txt("selectFooter"));
64 
65 // $this->addCommandButton("", $lng->txt(""));
66  }
67 
71  protected function fillRow($a_set)
72  {
73  global $lng, $ilCtrl;
74 //var_dump($a_set);
75 
76  // icon...
77 
78  // check activation
79  include_once("./Services/COPage/classes/class.ilPageObject.php");
80  $active = ilPageObject::_lookupActive($a_set["obj_id"], $this->lm->getType(),
81  $this->lm_set->get("time_scheduled_page_activation"));
82 
83  // is page scheduled?
84  $img_sc = ($this->lm_set->get("time_scheduled_page_activation") &&
85  ilPageObject::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()))
86  ? "_sc"
87  : "";
88 
89  if (!$active)
90  {
91  $img = "icon_pg_d".$img_sc.".gif";
92  $alt = $lng->txt("cont_page_deactivated");
93  }
94  else
95  {
97  $this->lm->getType()))
98  {
99  $img = "icon_pg_del".$img_sc.".gif";
100  $alt = $lng->txt("cont_page_deactivated_elements");
101  }
102  else
103  {
104  $img = "icon_pg".$img_sc.".gif";
105  $alt = $this->lng->txt("pg");
106  }
107  }
108  $this->tpl->setVariable("ICON", ilUtil::img(ilUtil::getImagePath($img), $alt));
109 
110  // title/link
111  $ilCtrl->setParameter($this, "backcmd", "");
112  $ilCtrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_set["obj_id"]);
113  $this->tpl->setVariable("HREF_TITLE",
114  $ilCtrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit"));
115  $this->tpl->setVariable("TITLE", $a_set["title"]);
116  $this->tpl->setVariable("ID", $a_set["obj_id"]);
117 
118  // context
119  if ($this->lm->lm_tree->isInTree($a_set["obj_id"]))
120  {
121  $path_str = $this->parent_obj->getContextPath($a_set["obj_id"]);
122  }
123  else
124  {
125  $path_str = "---";
126  }
127 
128  // check whether page is header or footer
129  $add_str = "";
130  if ($a_set["obj_id"] == $this->lm->getHeaderPage())
131  {
132  $add_str = " <b>(".$lng->txt("cont_header").")</b>";
133  }
134  if ($a_set["obj_id"] == $this->lm->getFooterPage())
135  {
136  $add_str = " <b>(".$lng->txt("cont_footer").")</b>";
137  }
138 
139  $this->tpl->setVariable("USAGE", $path_str.$add_str);
140 
141  // layout
142  if ($this->lm->getLayoutPerPage())
143  {
144  if (($l = ilLMObject::lookupLayout($a_set["obj_id"])) != "")
145  {
146  $this->tpl->setVariable("LAYOUT",
147  $lng->txt("cont_layout_".$l));
148  }
149  }
150  }
151 
152 }
153 ?>