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 24include_once('./Services/UIComponent/Explorer/classes/class.ilExplorer.php'); 25 26/** 27* 28* 29* @author Stefan Meyer <meyer@leifos.com> 30* @version $Id$ 31* 32* 33* @ingroup 34*/ 35class ilContainerSelectionExplorer extends ilExplorer 36{ 37 /** 38 * @var ilAccessHandler 39 */ 40 protected $access; 41 42 /** 43 * @var ilLanguage 44 */ 45 protected $lng; 46 47 protected $target_type; 48 49 /** 50 * Constructor 51 */ 52 public function __construct($a_target) 53 { 54 global $DIC; 55 56 $this->access = $DIC->access(); 57 $this->lng = $DIC->language(); 58 $tree = $DIC->repositoryTree(); 59 60 parent::__construct($a_target); 61 62 $this->tree = $tree; 63 $this->root_id = $this->tree->readRootId(); 64 $this->order_column = "title"; 65 66 $this->setSessionExpandVariable("ref_repexpand"); 67 68 69 $this->addFilter("root"); 70 $this->addFilter("cat"); 71 $this->addFilter("grp"); 72 #$this->addFilter("fold"); 73 $this->addFilter("crs"); 74 75 $this->setFilterMode(IL_FM_POSITIVE); 76 $this->setFiltered(true); 77 $this->setTitleLength(ilObject::TITLE_LENGTH); 78 79 $this->checkPermissions(true); 80 } 81 82 /** 83 * set target type 84 * @param 85 * @return 86 */ 87 public function setTargetType($a_type) 88 { 89 $this->target_type = $a_type; 90 } 91 92 /** 93 * get target type 94 * @param 95 * @return 96 */ 97 public function getTargetType() 98 { 99 return $this->target_type; 100 } 101 102 /** 103 * check if item is clickable 104 * @param 105 * @return 106 */ 107 public function isClickable($a_type, $a_id = 0) 108 { 109 $ilAccess = $this->access; 110 111 if ($this->getTargetType() == $a_type) { 112 if ($ilAccess->checkAccess('visible', '', $a_id)) { 113 return true; 114 } 115 } 116 return false; 117 } 118 119 /** 120 * Visible permission is sufficient 121 * @param type $a_ref_id 122 * @param type $a_type 123 * @return type 124 */ 125 public function isVisible($a_ref_id, $a_type) 126 { 127 $ilAccess = $this->access; 128 129 return $ilAccess->checkAccess('visible', '', $a_ref_id); 130 } 131 132 /** 133 * overwritten method from base class 134 * @access public 135 * @param integer obj_id 136 * @param integer array options 137 */ 138 public function formatHeader($a_tpl, $a_obj_id, $a_option) 139 { 140 $lng = $this->lng; 141 142 $tpl = new ilTemplate("tpl.tree.html", true, true, "Services/UIComponent/Explorer"); 143 144 $tpl->setCurrentBlock("text"); 145 $tpl->setVariable("OBJ_TITLE", $lng->txt("repository")); 146 $tpl->parseCurrentBlock(); 147 148 $this->output[] = $tpl->get(); 149 } 150} 151