ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6
16{
20 protected $access;
21
25 public function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
26 {
27 global $DIC;
28
29 $this->ctrl = $DIC->ctrl();
30 $this->lng = $DIC->language();
31 $this->access = $DIC->access();
32 $ilCtrl = $DIC->ctrl();
33 $lng = $DIC->language();
34 $ilAccess = $DIC->access();
35 $lng = $DIC->language();
36
37 $this->lm = $a_lm;
38 $this->lm_set = new ilSetting("lm");
39 parent::__construct($a_parent_obj, $a_parent_cmd);
40 $this->setData(ilLMPageObject::getPageList($this->lm->getId()));
41 $this->setTitle($lng->txt("cont_pages"));
42
43 $this->addColumn($this->lng->txt(""), "", "1");
44 $this->addColumn($this->lng->txt("type"), "", "1");
45 $this->addColumn($this->lng->txt("title"));
46 $this->addColumn($this->lng->txt("cont_usage"));
47
48 $this->setSelectAllCheckbox("id[]");
49
50 if ($this->lm->getLayoutPerPage()) {
51 $this->addColumn($this->lng->txt("cont_layout"));
52 }
53
54 $this->setLimit(9999);
55
56 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
57 $this->setRowTemplate("tpl.page_list_row.html", "Modules/LearningModule");
58
60 ilEditClipboard::getAction() == "copy") {
61 $this->addMultiCommand("pastePage", $lng->txt("pastePage"));
62 }
63
64 if ($this->lm->getLayoutPerPage()) {
65 $this->addMultiCommand("setPageLayout", $lng->txt("cont_set_layout"));
66 }
67
68 $this->addMultiCommand("activatePages", $lng->txt("cont_de_activate"));
69 $this->addMultiCommand("movePage", $lng->txt("movePage"));
70 $this->addMultiCommand("copyPage", $lng->txt("copyPage"));
71 $this->addMultiCommand("delete", $lng->txt("delete"));
72 $this->addMultiCommand("selectHeader", $lng->txt("selectHeader"));
73 $this->addMultiCommand("selectFooter", $lng->txt("selectFooter"));
74
75 // $this->addCommandButton("", $lng->txt(""));
76 }
77
81 protected function fillRow($a_set)
82 {
85 //var_dump($a_set);
86
87 // icon...
88
89 // check activation
90 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
92 $a_set["obj_id"],
93 $this->lm->getType(),
94 $this->lm_set->get("time_scheduled_page_activation")
95 );
96
97 // is page scheduled?
98 $img_sc = ($this->lm_set->get("time_scheduled_page_activation") &&
99 ilLMPage::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()))
100 ? "_sc"
101 : "";
102
103 if (!$active) {
104 $img = "icon_pg_d" . $img_sc . ".svg";
105 $alt = $lng->txt("cont_page_deactivated");
106 } else {
108 $a_set["obj_id"],
109 $this->lm->getType()
110 )) {
111 $img = "icon_pg_del" . $img_sc . ".svg";
112 $alt = $lng->txt("cont_page_deactivated_elements");
113 } else {
114 $img = "icon_pg" . $img_sc . ".svg";
115 $alt = $this->lng->txt("pg");
116 }
117 }
118 $this->tpl->setVariable("ICON", ilUtil::img(ilUtil::getImagePath($img), $alt));
119
120 // title/link
121 $ilCtrl->setParameter($this, "backcmd", "");
122 $ilCtrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_set["obj_id"]);
123 $this->tpl->setVariable(
124 "HREF_TITLE",
125 $ilCtrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit")
126 );
127 $this->tpl->setVariable("TITLE", $a_set["title"]);
128 $this->tpl->setVariable("ID", $a_set["obj_id"]);
129
130 // context
131 if ($this->lm->lm_tree->isInTree($a_set["obj_id"])) {
132 $path_str = $this->parent_obj->getContextPath($a_set["obj_id"]);
133 } else {
134 $path_str = "---";
135 }
136
137 // check whether page is header or footer
138 $add_str = "";
139 if ($a_set["obj_id"] == $this->lm->getHeaderPage()) {
140 $add_str = " <b>(" . $lng->txt("cont_header") . ")</b>";
141 }
142 if ($a_set["obj_id"] == $this->lm->getFooterPage()) {
143 $add_str.= " <b>(" . $lng->txt("cont_footer") . ")</b>";
144 }
145
146 $this->tpl->setVariable("USAGE", $path_str . $add_str);
147
148 // layout
149 if ($this->lm->getLayoutPerPage()) {
150 if (($l = ilLMObject::lookupLayout($a_set["obj_id"])) != "") {
151 $this->tpl->setVariable(
152 "LAYOUT",
153 $lng->txt("cont_layout_" . $l)
154 );
155 }
156 }
157 }
158}
global $l
Definition: afr.php:30
An exception for terminatinating execution or to throw for unit testing.
static lookupLayout($a_obj_id)
Lookup type.
static getPageList($lm_id)
static
TableGUI class for all pages of a learning module.
fillRow($a_set)
Fill table row.
__construct($a_parent_obj, $a_parent_cmd, $a_lm)
Constructor.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
ILIAS Setting Class.
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.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7