<?
// po poprawkach
namespace admin\view;

class Restriction
{  
  public function editBannedEmail( $id = '' )
  {
    $id ? $value = 'Zapisz' : $value = 'Dodaj';
		$out = \admin\view\PagePanel::show( false, $value, true, 'Zbanowane adresy email' );

		$dbedit = new \DataEdit( 'pp_banned_email', 'id', $id );
		$dbedit -> addPosition( 'email', 'Email', 'text' );
		$out .= $dbedit -> draw();

		return $out;
  }
  
  public function showBannedEmails()
  {
    $out = \admin\view\PagePanel::show( 'Dodaj nowy', false, false, 'Zbanowane adresy email' );

		$dbrowse = new \DataBrowse('pp_banned_email');
		$dbrowse -> addPosition( 'email', 'Email', '', '', '', 'email' );
		$dbrowse -> addPositionSimple( 'edytuj',  '', './?rw=edit' );
		$dbrowse -> addPositionSimple( 'usuń',    '', '', \System::deleteAction() );
		$dbrowse -> setParam( 'id' );
		$dbrowse -> addSort( 'email ASC' );
		$dbrowse -> addLp();
		$dbrowse -> addFiltr( 'email', 'Email' );
		$out .= $dbrowse -> draw();

		return $out;    
  }

  public function editBannedLogin( $id = '' )
  {
    $id ? $value = 'Zapisz' : $value = 'Dodaj';
    
    $out = \admin\view\PagePanel::show( false, $value, true, "Zbanowane loginy" );

    $dbedit = new \DataEdit( 'pp_banned_login', 'id', $id );
    $dbedit -> addPosition( 'login', 'Login', 'text' );
    $out .= $dbedit -> draw();

    return $out;
  }

  public function showBannedLogins()
  {
    $out = \admin\view\PagePanel::show( 'Dodaj nowy', false, false, "Zbanowane loginy" );

    $dbrowse = new \DataBrowse( 'pp_banned_login' );
    $dbrowse -> addPosition( 'login', 'Login', '', '', '', 'login' );
    $dbrowse -> addPositionSimple( 'edytuj',  '', './?rw=edit' );
    $dbrowse -> addPositionSimple( 'usuń',    '', '', \System::deleteAction() );
    $dbrowse -> setParam( 'id' );
    $dbrowse -> addSort( 'login ASC' );
    $dbrowse -> addLp();
    $dbrowse -> addFiltr( 'login', 'Login' );
    $out .= $dbrowse -> draw();

    return $out;
  }
}
?>