1<?php
2/*
3    +-----------------------------------------------------------------------------+
4    | ILIAS open source                                                           |
5    +-----------------------------------------------------------------------------+
6    | Copyright (c) 1998-2001 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/*
25* Material Explorer for survey question pools
26*
27* @author Helmut Schottmüller <helmut.schottmueller@mac.com>
28* @version $Id$
29*
30* @ingroup ModulesSurveyQuestionPool
31*/
32
33class ilMaterialExplorer extends ilTreeExplorerGUI
34{
35    protected $current_type; // [string]
36
37    public function __construct($a_parent_obj, $a_parent_cmd, $a_selectable_type)
38    {
39        global $DIC;
40
41        $this->tree = $DIC->repositoryTree();
42        $this->ctrl = $DIC->ctrl();
43        $tree = $DIC->repositoryTree();
44
45        parent::__construct("mat_rep_exp", $a_parent_obj, $a_parent_cmd, $tree);
46
47        $this->current_type = $a_selectable_type;
48
49        $this->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs", $this->current_type));
50        $this->setSkipRootNode(true);
51        $this->setAjax(true);
52    }
53
54    public function getNodeContent($a_node)
55    {
56        return $a_node["title"];
57    }
58
59    public function getNodeIcon($a_node)
60    {
61        $obj_id = ilObject::_lookupObjId($a_node["child"]);
62        return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
63    }
64
65    public function getNodeHref($a_node)
66    {
67        $ilCtrl = $this->ctrl;
68
69        $ilCtrl->setParameter($this->parent_obj, 'source_id', $a_node["child"]);
70        return $ilCtrl->getLinkTarget($this->parent_obj, 'linkChilds');
71    }
72
73    public function isNodeClickable($a_node)
74    {
75        return ($a_node["type"] == $this->current_type);
76    }
77}
78