76 lines
2.2 KiB
PHP
76 lines
2.2 KiB
PHP
<?php
|
|
namespace admin\view;
|
|
|
|
class LayoutManager {
|
|
|
|
public function show()
|
|
{
|
|
global $lang , $sys;
|
|
|
|
$out = \admin\view\PagePanel::show( true , false , false , $lang -> getTrans( 'T_SZABLONY' ) );
|
|
|
|
$dbrowse = new \DataBrowse( 'pcms_layout' );
|
|
$dbrowse -> addPosition( 'name' , $lang -> getTrans( 'T_NAZWA' ) );
|
|
$dbrowse -> addPosition( 'enabled' , $lang -> getTrans( 'T_AKTYWNY' ) , '' , $sys -> getComboYesNo() , 'text-align:center;' );
|
|
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_EDYTUJ' ) , '' , 'index.php?rw=edit' );
|
|
$dbrowse -> addPositionSimple( $lang -> getTrans( 'T_USUN' ) , '' , '' , $sys -> deleteAction() );
|
|
$dbrowse -> setParam( 'id' );
|
|
$dbrowse -> addSort( 'name ASC' );
|
|
$dbrowse -> addLp();
|
|
$out .= $dbrowse -> draw();
|
|
|
|
return $out;
|
|
}
|
|
|
|
/* -------- */
|
|
public function add()
|
|
{
|
|
global $lang , $sys;
|
|
|
|
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_SZABLONY' ) );
|
|
|
|
$pages = \admin\factory\LayoutManager::getPages();
|
|
|
|
$tpl = new \Savant3;
|
|
$tpl -> _rw = 'save_new';
|
|
$tpl -> _pages = $pages;
|
|
$out .= $tpl -> fetch( 'templates/layout-edit.php' );
|
|
return $out;
|
|
}
|
|
|
|
/* --------- */
|
|
|
|
public function edit( $id )
|
|
{
|
|
global $lang , $sys , $db;
|
|
|
|
$out = \admin\view\PagePanel::show( false , true , true , $lang -> getTrans( 'T_SZABLONY' ) , 'formularz' , false , false , 'saveLayout()' );
|
|
|
|
$pages = \admin\factory\LayoutManager::getPages();
|
|
$pages_act = \admin\factory\LayoutManager::getSelectedPages( $id );
|
|
|
|
$tpl = new \Savant3;
|
|
$tpl -> _rw = 'save';
|
|
$tpl -> _id = $id;
|
|
$tpl -> _pages = $pages;
|
|
$tpl -> _pages_act = $pages_act;
|
|
|
|
$query = $db -> prepare( 'SELECT name , html , css , javascript , enabled FROM pcms_layout WHERE id = :id' );
|
|
$query -> bindValue( ':id' , $id , \PDO::PARAM_INT );
|
|
$query -> execute();
|
|
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
|
|
{
|
|
$tpl -> _name = $row['name'];
|
|
$tpl -> _html = $row['html'];
|
|
$tpl -> _css = $row['css'];
|
|
$tpl -> _js = $row['javascript'];
|
|
$tpl -> _enabled = $row['enabled'];
|
|
}
|
|
$query -> closeCursor();
|
|
|
|
$out .= $tpl -> fetch( 'templates/layout-edit.php' );
|
|
|
|
return $out;
|
|
}
|
|
}
|
|
?>
|