Location: PHPKode > projects > phpAWE > phpAWE.0.4.beta.demo-page/install/data/index.php
<?php

// library init required for every website //
// build with this project //

// <editor-fold defaultstate="collapsed" desc="Library Init">

// BASE CONFIG //
$PHP_AWE_DIR  = "awe/";       
$PHP_AWE_BASE_FUNC = "base.php";
$PHP_AWE_UTILS_FUNC= "utils.php";
$PHP_AWE_CONFIG_DIR = $PHP_AWE_DIR."config/";    
$PHP_AWE_CONF_FILE = "config.php";
$PHP_AWE_DB_CONFIG = "db.php";

set_include_path($PHP_AWE_DIR."classes");

// INCLUDE BASE ENGINE //
require($PHP_AWE_DIR.$PHP_AWE_BASE_FUNC);
require($PHP_AWE_DIR.$PHP_AWE_UTILS_FUNC);

// primitive main page start (need to be fixed)
if (!$_GET[id1]) $_GET[id1] = 1;

session_start();

// Global template system handling //
if ($_GET[style]) {$currentLayout = $_GET[style]."/"; sessionSet(currentLayout,$currentLayout);}
if (!sessionGet(currentLayout)) {sessionSet(currentLayout,"default/"); $currentLayout ="default/";}
else $currentLayout = sessionGet(currentLayout);

// Page active language handling //
if ($_GET[lang]) {$activeLanguage = $_GET[lang]; sessionSet(activeLanguage, $activeLanguage);}
if (!sessionGet(activeLanguage)) {sessionSet(activeLanguage,"pl"); $activeLanguage ="pl";}
else $activeLanguage = sessionGet(activeLanguage);

// Loadnig of configuration files //
require($PHP_AWE_CONFIG_DIR.$PHP_AWE_CONF_FILE);
require($PHP_AWE_CONFIG_DIR.$PHP_AWE_DB_CONFIG);

// MySql connection codepage setup
sessionSet($aweSqlCharset, "latin2");
sessionSet($aweSqlCollation, "latin2_general_ci" );

// Set the default visibility settings //
sessionSet($aweSqlHiddenField, 0);
sessionSet($aweSqlSystemField, 0);

// Creation of page menu object //
$awePageMenu = new TawePageTree("PageMenu", "id", null);

// Creation of page view object //
$awePageView = new TawePageView("PageView");

// Creation of basic page item object //
$awePageItem = new TawePageItem("PageItem", "itemid", $awePageMenu);

// Creation of page navigation bar 
$aweNavBar = new TaweNavigationBar("NavBar", null);

// </editor-fold>


// <editor-fold defaultstate="collapsed" desc="Core Elements Display Creation">

// Loading page main template file //
$body = $awePageView->view($awePageMenu->itemTopSelectedId($_GET));

// Insert generated page menu into template //
$body = str_replace("%main-menu%",
    $awePageMenu->view(
        "getSuccessors",
        array(0,"pos"),
        $_GET,
        array("main-menu1"),
        array("distinct_selected"),
        "",
        "",
        0,
        ""
    )
    , $body);

if ($_GET[id1]) {                  
    $body = str_replace("%main-menu2%",
        $awePageMenu->view(
            "getSuccessors",
            array($_GET[id1],"pos"),
            $_GET,
            array("main-menu2"),
            array("distinct_selected"),
            "",
            "",
            1,
            "."
        )
        , $body);
} else $body = str_replace("%main-menu2%", "" ,$body);


// Insert navigation bar into template //

if ($awePageMenu->itemTopSelectedId($_GET))

$body = str_replace("%navigation-bar%",
    $aweNavBar->view(
        "getData",
        array($_GET, array($awePageMenu, $awePageItem)),
        $_GET,
        "standard",
        "distinct_last"
    )
    , $body);


else $body= str_replace("%navigation-bar%", "", $body);

// </editor-fold>


// <editor-fold defaultstate="collapsed" desc="Demo Elements Display Creation">

// Two different navigation bar templates //
$nav_demo = $aweNavBar->view(
    "getData",
    array($_GET, array($awePageMenu, $awePageItem)),
    $_GET,
    "demo1",
    "distinct_last"
);

$nav_demo .= $aweNavBar->view(
    "getData",
    array($_GET, array($awePageMenu, $awePageItem)),
    $_GET,
    "demo2",
    "distinct_last"
);

$body = str_replace("%nav-demo%", $nav_demo  , $body);


// Two different page tree templates //
$dir_demo = $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("demo1"),
    array("distinct_selected"),
    "expand_all",
    "",
    2,
    ""
);

$dir_demo .= $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("demo2"),
    array("distinct_selected"),
    "expand_all",
    "",
    2,
    ""
);

$body = str_replace("%dir-demo%", $dir_demo, $body);

// Tdwo different page item templates //

$list_demo = $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "demo1",
    "",
    ""
);

$list_demo .= $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "demo2",
    "",
    ""
);

$body = str_replace("%list-demo%", $list_demo, $body); 

// Expanding visible data via templates //

$data_demo1 = $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "data-demo1",
    "",
    ""
);

$body = str_replace("%data-demo1%", $data_demo1, $body);     

$data_demo2 = $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "data-demo2",
    "",
    ""
);

$body = str_replace("%data-demo2%", $data_demo2, $body);    

$data_demo3 = $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "data-demo3",
    "",
    ""
);

$body = str_replace("%data-demo3%", $data_demo3, $body); 

// visibility controll //

sessionSet($aweSqlHiddenField, 1);

$vis_demo1 = $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "vis-demo1",
    "",
    "");

$body = str_replace("%vis-demo1%", $vis_demo1, $body);  

sessionSet($aweSqlHiddenField, 0);

$vis_demo2 = $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "vis-demo1",
    "",
    "");

$body = str_replace("%vis-demo2%", $vis_demo2, $body);  

// advanced customization for page tree object //

$fol_demo1 = $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("fol-demo1"),
    "",
    "",
    "",
    0,
    ".jpg"
);

$body = str_replace("%fol-demo1%", $fol_demo1, $body); 

$fol_demo2 = $awePageMenu->view(
    "getSuccessors",
    array(2,"pos"),
    $_GET,
    array("fol-demo1"),
    "",
    "",
    "",
    0,
    ""
);

$body = str_replace("%fol-demo2%", $fol_demo2, $body); 

$fol_demo3 = $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("fol-demo1"),
    "",
    "expand_selected",
    "",
    2,
    ""
);

$body = str_replace("%fol-demo3%", $fol_demo3, $body); 

$fol_demo4 =  $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("fol-demo1","fol-demo2"),
    "",
    "expand_selected",
    "",
    2,
    ""
);

$body = str_replace("%fol-demo4%", $fol_demo4, $body); 

$fol_demo5 =  $awePageMenu->view(   "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("fol-demo1","fol-demo2"),
    "",
    "expand_all",
    "",
    2,
    ""
);

$body = str_replace("%fol-demo5%", $fol_demo5, $body); 

$fol_demo6 =  $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("fol-demo1","fol-demo2"),
    "distinct_selected",
    "expand_all",
    "",
    2,
    ""
);

$body = str_replace("%fol-demo6%", $fol_demo6, $body); 

$fol_demo7 =  $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("fol-demo1","fol-demo2"),
    "distinct_selected|distinct_first|distinct_last",
    "expand_all",
    "",
    2,
    ""
);

$body = str_replace("%fol-demo7%", $fol_demo7, $body); 

$fol_demo8 =  $awePageMenu->view(
    "getSuccessors",
    array(0,"pos"),
    $_GET,
    array("fol-demo1","fol-demo2"),
    "distinct_selected|distinct_first|distinct_last",
    "expand_all",
    "distinct_active_level",
    2,
    ""
);

$body = str_replace("%fol-demo8%", $fol_demo8, $body); 

$body = str_replace("%fol-demo9%", "<iframe style=\"width:500px; height:400px;\" src=\"fol-demo.php\"></iframe>", $body);


// Advanced customization for item list object //


$obj_demo1 =  $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "obj-demo1",
    "",
    ""
);

$body = str_replace("%obj-demo1%", $obj_demo1, $body);

$obj_demo2 =  $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "obj-demo1",
    "distinct_selected",
    ""
);


$body = str_replace("%obj-demo2%", $obj_demo2, $body);

$obj_demo3 =  $awePageItem->view(
    "getDirlist",
    array($awePageMenu->itemTopSelectedId($_GET), 0),
    $_GET,
    "obj-demo1",
    "distinct_selected|distinct_first|distinct_last",
    ""
);


$body = str_replace("%obj-demo3%", $obj_demo3, $body);

$obj_demo4 =  $awePageItem->view(
    "getNewest",
    array(10),
    $_GET,
    "obj-demo1",
    "distinct_selected|distinct_first|distinct_last",
    ""
);


$body = str_replace("%obj-demo4%", $obj_demo4, $body);

// Advanced navigation bar demo //

$nav_demo3 = $aweNavBar->view("getData", 
    array($_GET, array($awePageMenu, $awePageItem)),
    $_GET,
    "demo1",
    ""
);

$body = str_replace("%nav-demo3%", $nav_demo3  , $body);

$nav_demo4 = $aweNavBar->view("getData", 
    array($_GET, array($awePageMenu, $awePageItem)),
    $_GET,
    "demo1",
    "distinct_last"
);

$body = str_replace("%nav-demo4%", $nav_demo4  , $body);


// </editor-fold>


echo $body;


?>
Return current item: phpAWE