<?php
namespace admin\view;

class ArticleArchiveManager {

  public function show()
  {
    global $lang;
    
    $delete_articles = "var articles = ''; 
                        $('input:checkbox:checked').each(
                          function() {
                            if ( articles != '' )
                              articles = articles + ':';
                            articles = articles + $(this).val();
                          }
                        );
                        $.prompt('" . $lang -> getTrans( 'T_TRWA_USUWANIE' ) . "');
                        xajax_deleteArticles( articles );";

    $out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_ARCHIWUM'), 'formularz', false, false, false, $delete_articles );

    $tab_comment[0] = $lang -> getTrans( 'T_NIE' );
    $tab_comment[1] = $lang -> getTrans( 'T_TAK' );
    $tab_comment[2] = $lang -> getTrans( 'T_DLA_ZAREJESTROWANYCH' );

    $tab = \System::getArticlesTitle();

    $dbrowse = new \DataBrowse( 'pcms_article' , 'archive = "1"' );
    $dbrowse -> addPosition( 'id'         , $lang -> getTrans( 'T_TYTUL' )        , '' , $tab , '' );
    $dbrowse -> addPosition( 'enabled'    , $lang -> getTrans( 'T_AKTYWNY' )      , '' , \System::getComboYesNo() );
    $dbrowse -> addPosition( 'show_title' , $lang -> getTrans( 'T_POKAZ_TYTUL' )  , '' , \System::getComboYesNo() );
    $dbrowse -> addPosition( 'print'      , $lang -> getTrans( 'T_DRUKUJ' )       , '' , \System::getComboYesNo() );
    $dbrowse -> addPosition( 'date_modify'  , $lang -> getTrans( 'T_DATA_MODYFIKACJI' ) );
    $dbrowse -> addPositionSimple( $lang -> getTrans( 'T_PRZYWROC' )  , '' , './?rw=restore' );
		$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' )	, '' , '' , \System::deleteAction() );
    $dbrowse -> setParam( 'id' );
    $dbrowse -> addSort( 'date_add DESC' );
    $dbrowse -> addLp();
    $dbrowse -> addCheckbox();
    $dbrowse -> addFiltr( 'id{trans}'   , $lang -> getTrans( 'T_TYTUL' )        , $tab );
    $dbrowse -> addFiltr( 'print'       , $lang -> getTrans( 'T_DRUKUJ' )       , \System::getComboYesNo() );
    $dbrowse -> addFiltr( 'enabled'     , $lang -> getTrans( 'T_AKTYWNY' )      , \System::getComboYesNo() );
    $dbrowse -> addFiltr( 'show_title'  , $lang -> getTrans( 'T_POKAZ_TYTUL' )  , \System::getComboYesNo() );
    $out .= $dbrowse -> draw();

    return $out;
  }
}
?>
