first commit

This commit is contained in:
2023-09-04 21:59:34 +02:00
commit 650ef5b3e1
196 changed files with 24080 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace menu;
class FMenu {
public static function loadMenu( $id )
{
global $db;
$query = $db -> prepare( 'SELECT * FROM pp_menu WHERE id = :id AND enabled = "1"' );
$query -> bindValue( ':id', $id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
{
$menu = new \menu\Menu;
$menu -> set_id( $id );
$menu -> set_sites( self::loadMenuPages( $id ) );
$menu -> set_type( $row['type'] );
}
$query -> closeCursor();
return $menu;
}
public static function loadMenuPages( $id, $parent_id = 0 )
{
global $db , $cache , $config;
$current_lang = \System::getSessionVar( 'current_lang' );
$key = 'loadMenu:' . $id . ':' . $current_lang . ':' . $parent_id;
if ( !$sites = $cache -> fetch( $key . 'a' ) )
{
$query = $db -> prepare( 'SELECT id FROM pp_pages WHERE id_menu = :id_menu AND enabled = :enabled AND parent_id = :parent_id ORDER BY o' );
$query -> bindValue( ':id_menu', $id, \PDO::PARAM_INT );
$query -> bindValue( ':enabled', 1, \PDO::PARAM_INT );
$query -> bindValue( ':parent_id', $parent_id, \PDO::PARAM_INT );
$query -> execute();
if ( $query -> rowCount() ) while( $row = $query -> fetch() )
{
$site = new \site\Site( $row['id'] );
$site -> _values['subpages'] = self::loadMenuPages( $id, $row['id'] );
$sites[] = $site;
}
$query -> closeCursor();
$cache -> store( $key , $sites , $config['cache_expire'] );
}
return $sites;
}
}
?>

View File

@@ -0,0 +1,38 @@
<?php
namespace menu;
class Menu {
private $_sites;
private $_id;
private $_type;
public function get_type() {
return $this->_type;
}
public function set_type($_type) {
$this->_type = $_type;
}
public function get_sites()
{
return $this->_sites;
}
public function set_sites($_sites)
{
$this->_sites = $_sites;
}
public function get_id()
{
return $this->_id;
}
public function set_id($_id)
{
$this->_id = $_id;
}
}
?>

View File

@@ -0,0 +1,24 @@
<?php
namespace menu;
class VMenu {
public static function drawSubpages( $pages, $menu_id , $step = 0, $type = 0 )
{
$tpl = new \Savant3;
$tpl -> _pages = $pages;
$tpl -> _menu_id = $menu_id;
$tpl -> _step = $step;
$tpl -> _type = $type;
return $tpl -> fetch( 'menu/subpages' );
}
public static function show( $id )
{
$tpl = new \Savant3;
$tpl -> _menu = \menu\FMenu::loadMenu( $id );
return $tpl -> fetch( 'menu/pages' );
}
}
?>