ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPageLayoutTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("Services/Table/classes/class.ilTable2GUI.php");
5 
14 {
15 
16  function __construct($a_parent_obj, $a_parent_cmd)
17  {
18  global $ilCtrl, $lng, $rbacsystem;
19 
20  $lng->loadLanguageModule("content");
21 
22  parent::__construct($a_parent_obj, $a_parent_cmd);
23  $this->addColumn("", "", "2%");
24 
25  $this->addColumn($lng->txt("active"));
26  $this->addColumn($lng->txt("thumbnail"));
27  $this->addColumn($lng->txt("title"));
28  $this->addColumn($lng->txt("description"));
29  $this->addColumn($lng->txt("obj_sty"));
30  $this->addColumn($lng->txt("type"));
31  $this->addColumn($lng->txt("modules"));
32  $this->addColumn($lng->txt("actions"));
33 
34  // show command buttons, if write permission is given
35  if ($rbacsystem->checkAccess("write",$this->parent_obj->object->getRefId()))
36  {
37  $this->addMultiCommand("activate", $lng->txt("activate"));
38  $this->addMultiCommand("deactivate", $lng->txt("deactivate"));
39  $this->addMultiCommand("deletePgl", $lng->txt("delete"));
40  $this->addCommandButton("savePageLayoutTypes", $lng->txt("cont_save_types"));
41  }
42 
43  $this->getPageLayouts();
44 
45  $this->setSelectAllCheckbox("pglayout");
46  $this->setEnableHeader(true);
47  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
48  $this->setRowTemplate("tpl.stys_pglayout_table_row.html",
49  "Services/Style");
50  $this->setTitle($lng->txt("page_layouts"));
51 
52  //build form
53  /*
54  $opts = ilUtil::formSelect(12,"new_type",array($lng->txt("page_layout")));
55  $this->tpl->setCurrentBlock("add_object");
56  $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
57  $this->tpl->setVariable("BTN_NAME", "createPgGUI");
58  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
59  $this->tpl->parseCurrentBlock();
60  */
61  }
62 
66  function getPageLayouts() {
68  $this->all_mods = ilPageLayout::getAvailableModules();
69  }
70 
75  protected function fillRow($a_set)
76  {
77  global $lng, $ilCtrl;
78 
79  // action
80  $ilCtrl->setParameter($this->parent_obj, "layout_id", $a_set['layout_id']);
81  $this->tpl->setCurrentBlock("action");
82  $this->tpl->setVariable("HREF_ACTION",
83  $ilCtrl->getLinkTarget($this->parent_obj, "exportLayout"));
84  $this->tpl->setVariable("TXT_ACTION", $lng->txt("export"));
85  $this->tpl->parseCurrentBlock();
86  $ilCtrl->setParameter($this->parent_obj, "layout_id", "");
87 
88  // modules
89  $this->tpl->setCurrentBlock("mod");
90  foreach($this->all_mods as $mod_id => $mod_caption)
91  {
92  if(($mod_id == ilPageLayout::MODULE_SCORM && $a_set["mod_scorm"]) ||
93  ($mod_id == ilPageLayout::MODULE_PORTFOLIO && $a_set["mod_portfolio"]))
94  {
95  $this->tpl->setVariable("MOD_STATUS", " checked=\"checked\"");
96  }
97  $this->tpl->setVariable("MODULE_ID", $mod_id);
98  $this->tpl->setVariable("LAYOUT_ID", $a_set["layout_id"]);
99  $this->tpl->setVariable("MOD_NAME", $mod_caption);
100  $this->tpl->parseCurrentBlock();
101  }
102 
103  if ($a_set['active'])
104  {
105  $this->tpl->setVariable("IMG_ACTIVE",ilUtil::getImagePath("icon_ok.svg"));
106  }
107  else
108  {
109  $this->tpl->setVariable("IMG_ACTIVE",ilUtil::getImagePath("icon_not_ok.svg"));
110  }
111  $this->tpl->setVariable("VAL_TITLE", $a_set['title']);
112  $this->tpl->setVariable("VAL_DESCRIPTION", $a_set['description']);
113  $this->tpl->setVariable("CHECKBOX_ID", $a_set['layout_id']);
114 
115  $ilCtrl->setParameterByClass("ilobjstylesettingsgui", "obj_id", $a_set['layout_id']);
116  $this->tpl->setVariable("HREF_EDIT_PGLAYOUT",$ilCtrl->getLinkTargetByClass("ilobjstylesettingsgui","editPg"));
117 
118  $pgl_obj = new ilPageLayout($a_set['layout_id']);
119  $this->tpl->setVariable("VAL_PREVIEW_HTML",$pgl_obj->getPreview());
120 
121  if ($a_set["style_id"] > 0)
122  {
123  $this->tpl->setVariable("STYLE",
124  ilObject::_lookupTitle($a_set["style_id"]));
125  }
126 
127  $this->tpl->setVariable("TYPE",
128  ilUtil::formSelect($a_set["special_page"], "type[".$a_set["layout_id"]."]",
129  array("0" => $lng->txt("cont_layout_template"),
130  "1" => $lng->txt("cont_special_page")),
131  false, true)
132  );
133 
134  }
135 
136 }
137 ?>