<?php
namespace admin\controls;

class SContainers {

  public function getContent()
  {
    $rw = \System::formGet( 'rw' );

    if ( $rw == 'del' && \admin\factory\SContainers::deleteContainer( \System::formGetInt( 'id' ) ) )
      \System::setAlert( 'Wybrany kontener został usunięty.' );
    
    if ( $rw == 'edit' )
      return \admin\view\SContainers::editContainer( \System::formGet( 'id' ) );

    if ( $rw == 'add' )
      return \admin\view\SContainers::editContainer();

    if ( $rw == 'save' )
      \admin\factory\SContainers::saveContainer();

    if ( $rw == 'save_new')
      \admin\factory\SContainers::addContainer();      

    return \admin\view\SContainers::showContainerList();
  }
}
