<?
namespace admin\view;

class EmailRestriction
{

    public function edit( $id )
	{
		global $lang , $sys;

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

		$dbedit = new \DataEdit( 'pcms_banned_email' , 'id' , $id );
		$dbedit -> addPosition( 'email'		, $lang -> getTrans( 'T_EMAIL' )	, 'text' );
		$out .= $dbedit -> draw();

		return $out;
	}
    
    /* ---------- */
    
    public function add()
    {
        global $lang , $sys;

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

		$dbedit = new \DataEdit( 'pcms_banned_email' , 'id' );
		$dbedit -> addPosition( 'email'		, $lang -> getTrans( 'T_EMAIL' )	, 'text' );
		$out .= $dbedit -> draw();

		return $out;
    }
    
    /* ---------- */
    
    public function show()
    {
        global $lang , $sys;

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

		$dbrowse = new \DataBrowse('pcms_banned_email');
		$dbrowse -> addPosition( 'email'	, $lang -> getTrans( 'T_EMAIL' ) 	, '' , '' , 'text-align:left;' , true );
		$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' )	, '' , 'index.php?rw=edit' );
		$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' )	, '' , '' , $sys -> deleteAction() );
		$dbrowse -> setParam( 'id' );
		$dbrowse -> addSort( 'email ASC' );
		$dbrowse -> addLp();
		$dbrowse -> addFiltr( 'email'	, $lang -> getTrans( 'T_EMAIL' ) );
		$out .= $dbrowse -> draw();

		return $out;
    }
}
?>