<?
namespace admin\view;

class GuestBookManager
{
	public function show()
	{
		global $lang;

		$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_KSIEGA_GOSCI' ) );

		$dbrowse = new \DataBrowse( 'pcms_guest_book' );
		$dbrowse -> addPosition( 'signature'	, $lang -> getTrans( 'T_PODPIS' )	, '' ,	'' , '' , true );
		$dbrowse -> addPosition( 'text'			, $lang -> getTrans( 'T_TEKST' )	, '' ,	'' , '' , true );
		$dbrowse -> addPosition( 'date'			, $lang -> getTrans( 'T_DATA' )		, '' ,	'' , '' , true );
		$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' )	, '' , 'index.php?rw=edit' );
		$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' )	, '' , '' , \System::deleteAction() );
		$dbrowse -> setParam( 'id' );
		$dbrowse -> addSort( 'date DESC' );
		$dbrowse -> addLp();
		$dbrowse -> addFiltr( 'signature'	, $lang -> getTrans( 'T_PODPIS' ) 	, 'text' );
		$dbrowse -> addFiltr( 'text'		, $lang -> getTrans( 'T_TEKST' )	, 'text' );
		$out .= $dbrowse -> draw();

		return $out;
	}

	public function edit( $id = '' )
	{
		global $lang;

		$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_KSIEGA_GOSCI' ) );

		$dbedit = new \DataEdit( 'pcms_guest_book' , 'id' , $id );
		$dbedit -> addPosition( 'signature'	, $lang -> getTrans( 'T_PODPIS' )	, 'text' );
		$dbedit -> addPosition( 'text'		, $lang -> getTrans( 'T_TEKST' )	, 'textarea' );
		$dbedit -> addPosition( 'date'		, $lang -> getTrans( 'T_DATA' )		, 'text' );
		$out .= $dbedit -> draw();

		return $out;
	}
}
?>