<?php
/*
	+-----------------------------------------------------------------------------+
	| ILIAS open source                                                           |
	+-----------------------------------------------------------------------------+
	| Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
	|                                                                             |
	| This program is free software; you can redistribute it and/or               |
	| modify it under the terms of the GNU General Public License                 |
	| as published by the Free Software Foundation; either version 2              |
	| of the License, or (at your option) any later version.                      |
	|                                                                             |
	| This program is distributed in the hope that it will be useful,             |
	| but WITHOUT ANY WARRANTY; without even the implied warranty of              |
	| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
	| GNU General Public License for more details.                                |
	|                                                                             |
	| You should have received a copy of the GNU General Public License           |
	| along with this program; if not, write to the Free Software                 |
	| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
	+-----------------------------------------------------------------------------+
*/

require_once("classes/class.ilExplorer.php");

/*
* Explorer for Media Pools
*
* @author Alex Killing <alex.killing@gmx.de>
* @version $Id: class.ilMediaPoolExplorer.php 14774 2007-09-20 10:35:04Z akill $
*
* @ingroup ModulesMediaPool
*/
class ilMediaPoolExplorer extends ilExplorer
{

	/**
	 * id of root folder
	 * @var int root folder id
	 * @access private
	 */
	var $root_id;
	var $media_pool;
	var $output;

	/**
	* Constructor
	* @access	public
	* @param	string	scriptname
	* @param    int user_id
	*/
	function ilMediaPoolExplorer($a_target, &$a_media_pool)
	{
		parent::ilExplorer($a_target);

		$this->tree =& $a_media_pool->getTree();
		$this->root_id = $this->tree->readRootId();
		$this->media_pool =& $a_media_pool;
		$this->order_column = "";
		$this->setSessionExpandVariable("mepexpand");
		$this->checkPermissions(false);
		$this->setPostSort(false);
	}


	/**
	* overwritten method from base class
	* @access	public
	* @param	integer obj_id
	* @param	integer array options
	* @return	string
	*/
	function formatHeader(&$tpl, $a_obj_id,$a_option)
	{
		global $lng, $ilias;

		//$tpl = new ilTemplate("tpl.tree.html", true, true);

		$tpl->setCurrentBlock("icon");
		$tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_mep_s.gif"));
		$tpl->setVariable("TXT_ALT_IMG",
			ilUtil::shortenText($this->media_pool->getTitle(), $this->textwidth, true));
		$tpl->parseCurrentBlock();

		$tpl->setCurrentBlock("link");
		$tpl->setVariable("TITLE", ilUtil::shortenText($this->media_pool->getTitle(), $this->textwidth, true));
		$tpl->setVariable("LINK_TARGET", $this->target);
		$tpl->setVariable("TARGET", " target=\"".$this->frame_target."\"");
		$tpl->parseCurrentBlock();

		$tpl->setCurrentBlock("element");
		$tpl->parseCurrentBlock();

		//$this->output[] = $tpl->get();
	}

} // END class ilLMExplorer
?>
