ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSCORM2004ExportTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once('./Services/Table/classes/class.ilTable2GUI.php');
25 
35 {
36  protected $confirmdelete;
37  protected $counter;
38 
46  public function __construct($a_parent_obj, $a_parent_cmd, $confirmdelete = false)
47  {
48  global $DIC;
49 
50  parent::__construct($a_parent_obj, $a_parent_cmd);
51 
52  $lng = $DIC->language();
53  $ilCtrl = $DIC->ctrl();
54 
55  $this->lng = $lng;
56  $this->ctrl = $ilCtrl;
57  $this->confirmdelete = $confirmdelete;
58  $this->counter = 0;
59 
60  $lng->loadLanguageModule("exp");
61  $this->setTitle($lng->txt("exp_export_files"));
62 
63  $this->setFormName('phrases');
64  $this->setStyle('table', 'fullwidth');
65  if (!$confirmdelete) {
66  $this->addColumn('', '', '1%');
67  }
68  $this->addColumn($this->lng->txt("type"), 'type');
69  $this->addColumn($this->lng->txt("file"), 'file');
70  $this->addColumn($this->lng->txt("size"), 'size');
71  $this->addColumn($this->lng->txt("date"), 'date');
72 
73  if ($confirmdelete) {
74  $this->addCommandButton('deleteExportFile', $this->lng->txt('confirm'));
75  $this->addCommandButton('cancelDeleteExportFile', $this->lng->txt('cancel'));
76  } else {
77  $this->addColumn($this->lng->txt("action"));
78  //$this->addMultiCommand('downloadExportFile', $this->lng->txt('download'));
79  $this->addMultiCommand('confirmDeleteExportFile', $this->lng->txt('delete'));
80  }
81 
82  $this->setRowTemplate("tpl.scorm2004_export_row.html", "Modules/Scorm2004");
83 
84  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
85  $this->setDefaultOrderField("file");
86  $this->setDefaultOrderDirection("desc");
87 
88  if ($confirmdelete) {
89  $this->disable('sort');
90  $this->disable('select_all');
91  } else {
92  $this->setPrefix('file');
93  $this->setSelectAllCheckbox('file');
94  $this->enable('sort');
95  $this->enable('select_all');
96  }
97  $this->enable('header');
98  }
99 
105  public function fillRow($data)
106  {
107  $lng = $this->lng;
109 
110  if (!$this->confirmdelete) {
111  $this->tpl->setCurrentBlock('checkbox');
112  $this->tpl->setVariable('CB_ID', $this->counter);
113  $this->tpl->setVariable('CB_FILENAME', ilUtil::prepareFormOutput($data['file']));
114  $this->tpl->setVariable("FILETYPE", $data["filetype"]);
115  $this->tpl->parseCurrentBlock();
116 
117  $this->tpl->setCurrentBlock('action');
118  $ilCtrl->setParameter($this->getParentObject(), "file", rawurlencode($data['file']));
119  $ilCtrl->setParameter($this->getParentObject(), "type", rawurlencode($data["filetype"]));
120  $this->tpl->setVariable("DOWNLOAD_HREF", $ilCtrl->getLinkTarget($this->getParentObject(), "downloadExportFile"));
121  $this->tpl->setVariable("DOWNLOAD_TXT", $lng->txt("download"));
122  $this->tpl->parseCurrentBlock();
123  } else {
124  $this->tpl->setCurrentBlock('hidden');
125  $this->tpl->setVariable('HIDDEN_FILENAME', ilUtil::prepareFormOutput($data['file']));
126  $this->tpl->setVariable('HIDDEN_TYPE', ilUtil::prepareFormOutput($data['type']));
127  $this->tpl->parseCurrentBlock();
128  }
129  $this->tpl->setVariable('CB_ID', $this->counter);
130  $this->tpl->setVariable("FILENAME", ilUtil::prepareFormOutput($data['file']));
131  $this->tpl->setVariable("SIZE", $data["size"]);
132  $this->tpl->setVariable("DATE", $data["date"]);
133  $this->tpl->setVariable("TYPE", $data["type"]);
134  $this->counter++;
135  }
136 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
__construct($a_parent_obj, $a_parent_cmd, $confirmdelete=false)
Constructor.
setStyle($a_element, $a_style)
global $DIC
Definition: saml.php:7
getParentObject()
Get parent object.
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.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
setPrefix($a_prefix)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
setFormName($a_formname="")
Set Form name.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.