Files
rm.rzeszow.pl/autoload/admin/controls/class.Articles.php
2023-09-04 21:59:34 +02:00

105 lines
2.8 KiB
PHP

<?php
namespace admin\controls;
class Articles
{
public static function getContentArticleSort()
{
return \admin\view\Articles::drawPagesArticles();
}
public static function getContentArticlesArchive()
{
$rw = \System::formGet( 'rw' );
if ( $rw == 'show' )
return false;
else
{
if ( $rw == 'restore' && \admin\factory\Articles::restoreArticle( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został przywrócony.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'del' && \admin\factory\Articles::deleteArticle( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został usunięty.' );
header( 'Location: ./' );
exit;
}
return \admin\view\Articles::showArticlesArchive();
}
}
public static function getContentArticles()
{
$rw = \System::formGet( 'rw' );
if ( \System::formGet( 'act' ) )
{
\System::setSessionVar( 'act' , \System::formGet( 'act' ) );
\System::setSessionVar( 'art_id' , \System::formGet( 'id' ) );
}
$act = \System::getSessionVar( 'act' );
if ( $act == 'show_versions' )
{
if ( $rw == 'restore' && \admin\factory\Articles::restoreArticleVersion( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został przywrócony.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'show' )
return \admin\view\Articles::drawArticle( \System::formGetInt( 'id' ) );
return \admin\view\Articles::showVersions( \System::getSessionVar( 'art_id' ) );
}
else
{
\admin\factory\Articles::deleteNonAssignImages();
if ( $rw == 'change-enabled' && \admin\factory\Articles::changeArticleEnabled( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Widoczność artykułu została zmieniona.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'del' && \admin\factory\Articles::setAsArchive( \System::formGetInt( 'id' ) ) )
{
\System::setAlert( 'Artykuł został przeniesiony do archiwum.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'save' && \admin\factory\Articles::saveArticle() )
{
\System::setAlert( 'Artykuł został zapisany.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'add_new' && \admin\factory\Articles::addArticle() )
{
\System::setAlert( 'Artykuł został dodany.' );
header( 'Location: ./' );
exit;
}
if ( $rw == 'edit' )
return \admin\view\Articles::editArticle( \System::formGetInt( 'id' ) );
if ( $rw == 'add' )
return \admin\view\Articles::addArticle();
return \admin\view\Articles::showArticles();
}
}
}
?>