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
33include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
34
35class ilMaterialExplorer extends ilTreeExplorerGUI
36{
37    protected $current_type; // [string]
38
39    public function __construct($a_parent_obj, $a_parent_cmd, $a_selectable_type)
40    {
41        global $DIC;
42
43        $this->tree = $DIC->repositoryTree();
44        $this->ctrl = $DIC->ctrl();
45        $tree = $DIC->repositoryTree();
46
47        parent::__construct("rep_exp", $a_parent_obj, $a_parent_cmd, $tree);
48
49        $this->current_type = $a_selectable_type;
50
51        $this->setTypeWhiteList(array("root", "cat", "grp", "fold", "crs", $this->current_type));
52        $this->setSkipRootNode(true);
53        $this->setAjax(true);
54    }
55
56    public function getNodeContent($a_node)
57    {
58        return $a_node["title"];
59    }
60
61    public function getNodeIcon($a_node)
62    {
63        $obj_id = ilObject::_lookupObjId($a_node["child"]);
64        return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
65    }
66
67    public function getNodeHref($a_node)
68    {
69        $ilCtrl = $this->ctrl;
70
71        $ilCtrl->setParameter($this->parent_obj, 'source_id', $a_node["child"]);
72        return $ilCtrl->getLinkTarget($this->parent_obj, 'linkChilds');
73    }
74
75    public function isNodeClickable($a_node)
76    {
77        return ($a_node["type"] == $this->current_type);
78    }
79}
80