<?php
// $Id: link_list.php,v 1.6 2006/09/15 14:18:59 ohwada Exp $

// 2006-09-10 K.OHWADA
// Notice: Only variables should be assigned by reference

// 2006-07-10 K.OHWADA
// use happy_linux_page_frame

// 2006-06-04 K.OHWADA
// change to contant RSSC_ROOT_PATH

//=========================================================
// RSS Center Module
// 2006-01-01 K.OHWADA
//=========================================================

include 'admin_header.php';

//=========================================================
// class admin_link_list
//=========================================================
class admin_link_list extends happy_linux_page_frame
{

// handler
	var $_feed_handler;

//---------------------------------------------------------
// constructor
//---------------------------------------------------------
function admin_link_list()
{
	$this->happy_linux_page_frame();
	$this->set_handler('link', RSSC_DIRNAME);
	$this->set_id_name('lid');
	$this->set_lang_title( _AM_RSSC_LIST_LINK );

// handler
	$this->_feed_handler =& rssc_get_handler('feed', RSSC_DIRNAME);
}

function &getInstance()
{
	static $instance;
	if (!isset($instance)) 
	{
		$instance = new admin_link_list();
	}
	return $instance;
}

//---------------------------------------------------------
// handler
//---------------------------------------------------------
// Notice: Only variables should be assigned by reference
function &_get_table_header()
{
	$edit = _RSSC_LINK_ID.'<br />('._EDIT.')';

	$arr = array(
		$edit,
		_AM_RSSC_SHOW_RSS,
		_AM_RSSC_SHOW_FEED,
		_RSSC_SITE_TITLE,
		_RSSC_RDF_URL, 
		_RSSC_RSS_URL, 
		_RSSC_ATOM_URL, 
	);

	return $arr;
}

function &_get_cols( &$obj )
{
	$jump = 'link_manage.php?op=mod_form&amp;lid=';
	list($href1, $href2) = $this->_get_linkfeed($obj);

	$lid = $obj->getVar('lid');
	$url_view_lid = RSSC_URL."/single_link.php?lid=".$lid;
	$url_text_gif = RSSC_URL."/images/text.gif";
	$img_link  = $this->build_html_img_tag($url_text_gif, 0, 0, 0, 'link');
	$view_link = $this->build_html_a_href_name($url_view_lid, $img_link, '', false);
	$link_link = $this->_build_page_id_link_by_obj( $obj, 'lid', $jump);

	$arr = array(
		$view_link.'&nbsp;&nbsp;'.$link_link,
		$href1,
		$href2,
		$this->_build_page_name_link_by_obj($obj, 'url',      'title', '_blank'),
		$this->_build_page_name_link_by_obj($obj, 'rdf_url',  '',      '_blank'),
		$this->_build_page_name_link_by_obj($obj, 'rss_url',  '',      '_blank'),
		$this->_build_page_name_link_by_obj($obj, 'atom_url', '',      '_blank'),
	);

	return $arr;
}

function _get_linkfeed(&$obj)
{
	$lid   = $obj->getVar('lid');
	$lid_p = sprintf("%03d",$lid);
	$count = $this->_feed_handler->get_count_by_lid( $lid );

	if ($count)
	{
		$name_feed = "FEED ($count)";
	}
	else
	{
		$name_feed = "FEED";
	}

	$jump_rss  = "parse_rss.php?lid=".$lid;
	$jump_feed = "feed_list.php?lid=".$lid;
	$href1 = $this->build_html_a_href_name($jump_rss, 'RSS');
	$href2 = $this->build_html_a_href_name($jump_feed, $name_feed);

	return array($href1, $href2);
}

// --- class end ---
}


//=========================================================
// main
//=========================================================
xoops_cp_header();

rssc_admin_print_header();
rssc_admin_print_menu();

$list =& admin_link_list::getInstance();
$list->_show();

xoops_cp_footer();
exit();
// --- end of main ---

?>