1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Export/classes/class.ilExportTableGUI.php';
5require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
6
7/**
8 *
9 * @author Helmut Schottmüller <ilias@aurealis.de>
10 * @version $Id$
11 *
12 * @ingroup ModulesTest
13 */
14
15class ilTestExportTableGUI extends ilExportTableGUI
16{
17    protected $counter;
18    protected $confirmdelete;
19
20    /**
21     * Constructor
22     *
23     * @access public
24     * @param
25     * @return
26     */
27    public function __construct($a_parent_obj, $a_parent_cmd, $a_exp_obj)
28    {
29        parent::__construct($a_parent_obj, $a_parent_cmd, $a_exp_obj);
30
31        // NOT REQUIRED ANYMORE, PROBLEM NOW FIXED IN THE ROOT
32        // KEEP CODE, JF OPINIONS / ROOT FIXINGS CAN CHANGE
33        //$this->addCustomColumn($this->lng->txt('actions'), $this, 'formatActionsList');
34    }
35
36    /**
37     * @param string $type
38     * @param string $filename
39     */
40    protected function formatActionsList($type, $filename)
41    {
42        /**
43         * @var $ilCtrl ilCtrl
44         */
45        global $DIC;
46        $ilCtrl = $DIC['ilCtrl'];
47
48        $list = new ilAdvancedSelectionListGUI();
49        $list->setListTitle($this->lng->txt('actions'));
50        $ilCtrl->setParameter($this->getParentObject(), 'file', $filename);
51        $list->addItem($this->lng->txt('download'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'download'));
52        $ilCtrl->setParameter($this->getParentObject(), 'file', '');
53        return $list->getHTML();
54    }
55
56    /***
57     *
58     */
59    protected function initMultiCommands()
60    {
61        $this->addMultiCommand('confirmDeletion', $this->lng->txt('delete'));
62    }
63
64    /**
65     * Overwrite method because data is passed from outside
66     */
67    public function getExportFiles()
68    {
69        return array();
70    }
71
72    /**
73     *
74     */
75    protected function initColumns()
76    {
77        $this->addColumn($this->lng->txt(''), '', '1', true);
78        $this->addColumn($this->lng->txt('file'), 'file');
79        $this->addColumn($this->lng->txt('size'), 'size');
80        $this->addColumn($this->lng->txt('date'), 'timestamp');
81    }
82
83    /**
84     * @param string $column
85     * @return bool
86     */
87    public function numericOrdering($column)
88    {
89        if (in_array($column, array('size', 'date'))) {
90            return true;
91        }
92
93        return false;
94    }
95
96    /**
97     * @param array $row
98     * @return string
99     */
100    protected function getRowId(array $row)
101    {
102        return $row['file'];
103    }
104}
105