<?php
class links_frame_header
{
	var $mydirname;
	var $controller_name;
	var $Links;

	/** Constructor
	 *
	**/
	function __construct($mydirname)
	{
		$this->mydirname = $mydirname;
		$this->controller_name = str_replace('links_', '', get_class($this));
		$this->Links = links_Base::getInstance($this->mydirname);
		$this->Links->setControllerName($this->controller_name);
		$this->Links->breadcrumbs();

	}

	function index($lid)
	{
		global $xoopsConfig;

		if ($link = $this->Links->getDataByLid($lid)) {

			// require_once XOOPS_ROOT_PATH.'/class/template.php' ;
			$tpl = new icms_view_Tpl();
			$tpl->register_function('my_make_uri', 'smarty_function_my_make_uri');
			$data = array(
					'link'         => $link,
					'sitename'     => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES, _CHARSET),
					'uri_options'  => $this->Links->uri_option_arr,
					'mydirname'    => $this->mydirname,
					'request_perm' => $this->Links->request_perm,
				);
			$tpl->assign($data);
			$template = $this->Links->getTemplatePrefix() . '_frame_header.html';
			$tpl->display('db:'. $template);

		} else {
			die('NO DATA');
		}
	}

}
