Files
rockowa.com/autoload/admin/view/class.PageManager.php
2023-05-08 09:03:09 +02:00

152 lines
4.5 KiB
PHP

<?
/* 2011-09-26 - dodanie typu strony LINK */
namespace admin\view;
class PageManager
{
public function showAssignedArticles( $id )
{
global $lang;
$out = \admin\view\PagePanel::show( false , false , true , $lang -> getTrans( 'T_PRZYPISANE_ARTYKULY' ) );
$tpl = new \Savant3();
$tpl -> _articles = \admin\factory\PageManager::getAssignedArticles( $id );
$out .= $tpl -> fetch( 'templates/page-articles-list.php' );
return $out;
}
public function edit( $id )
{
global $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_STRONY' ) );
$menu = \System::getMenuList();
$page_types = \System::getPageTypes();
$sort_types = \System::getSortTypes();
$row = \admin\factory\PageManager::getPageParam( $id );
$language = \admin\factory\PageManager::getPageParamLanguage( $id );
$tpl = new \Savant3;
$tpl -> _id = $id;
$tpl -> _link = $row['link'];
$tpl -> _enabled = $row['enabled'];
$tpl -> _article_number = $row['article_number'];
$tpl -> _show_title = $row['show_title'];
$tpl -> _sort_type = $row['id_sort_type'];
$tpl -> _page_type_id = $row['id_page_type'];
$tpl -> _menu = $row['id_menu'];
$tpl -> _language = $language;
$tpl -> _menu = $menu;
$tpl -> _pages = $page_types;
$tpl -> _sort = $sort_types;
$tpl -> _rw = 'edit';
$tpl -> _order = $row['o'];
$tpl -> _menu_id = \System::getSessionVar( 'menu_id' );
$out .= $tpl -> fetch( 'templates/page-edit.php' );
return $out;
}
public function showMenuList()
{
global $lang;
$out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_STRONY' ) );
$dbrowse = new \DataBrowse( 'pcms_menu' );
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) , '' , '' , '' , true );
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , \System::getComboYesNo() );
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_POKAZ' ) , '' , 'index.php?act=menu_page' );
$dbrowse -> addLP();
$dbrowse -> addSort( 'id ASC' );
$dbrowse -> setParam( 'id' );
$out .= $dbrowse -> draw();
return $out;
}
public function show( $menu_id )
{
global $sys , $lang , $bs;
$lpk = 25;
if ( $sys -> formGetInt('r') )
$sys -> setSessionVar( 'pcms_page_limit' , $sys -> formGetInt( 'r' ) );
$limit = $sys -> getSessionVar( 'pcms_page_limit' );
$limit = $sys -> checkBrowseLimit( $limit );
$link = 'index.php';
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_STRONY' ) , '' , true );
$count_page = \System::getCountPages( $menu_id );
$tpl = new \Savant3;
$ls = ceil( $count_page / $lpk );
if ( $bs < 1 )
$bs = 1;
else if ( $bs > $ls )
$bs = $ls;
$a = $sys -> getPagingVar( "a" , $bs , $ls );
$b = $sys -> getPagingVar( "b" , $bs , $ls );
$tpl -> _a = $bs - $b;
$tpl -> _b = $bs + $a;
$tpl -> _ls = $ls;
$tpl -> _link = $link;
$tpl -> _bs = $bs;
$from = $lpk * ( $bs - 1 );
if ( $from < 0 )
$from = 0;
$lp = $from + 1;
$pages = \admin\factory\PageManager::getPages( $menu_id , $from , $lpk );
$tpl -> _pages = $pages;
$tpl -> _bs = $bs;
$tpl -> _limit = $lpk;
$tpl -> _total = $count_page;
$tpl -> _start = $lpk * ( $bs - 1 ) + 1 < 0 ? 0 : $lpk * ( $bs - 1 ) + 1;
if ( $count_page == 0 )
$tpl -> _start = 0;
$tpl -> _end = $lpk * $bs > $count_page ? $count_page : $lpk * $bs;
$out .= $tpl -> fetch( 'templates/page-definition.php' );
return $out;
}
public function add()
{
global $db , $sys , $lang;
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_STRONY' ) );
$menu = \System::getMenuList();
$page_types = \System::getPageTypes();
$sort_types = \System::getSortTypes();
$language = \System::getLangs();
$order = \admin\factory\PageManager::selectMaxOrder();
$tpl = new \Savant3;
$tpl -> _language = $language;
$tpl -> _menu = $menu;
$tpl -> _pages = $page_types;
$tpl -> _sort = $sort_types;
$tpl -> _rw = 'add';
$tpl -> _order = $order;
$tpl -> _menu_id = \System::getSessionVar( 'menu_id' );
$out .= $tpl -> fetch( 'templates/page-edit.php' );
return $out;
}
}
?>