<?php
namespace admin\controls;

class Adverts {

  public static function getContent()
	{
		$rw = \System::formGet( 'rw' );
    
    if ( $rw == 'del' )
    {
      if ( \admin\factory\Adverts::deleteAdvert( \System::formGetInt( 'id' ) ) )
        \System::setAlert( 'Reklama została usunięta.' );
      header( 'Location: ./' );
      exit;
    }

		if ( $rw == 'edit' )
      return \admin\view\Adverts::editAdvert( \System::formGetInt( 'id' ) );
    
		if ( $rw == 'add' )
      return \admin\view\Adverts::editAdvert();
    
    return \admin\view\Adverts::showAdverts();
	}
}
?>
