public function loadNavigation()
 {
     foreach ($this->folderMap as $folder) {
         $folder = (object) $folder;
         $loader = new PageLoader($this->config, $folder->url, $folder->name);
         $project = $loader->load();
         if (!$project) {
             continue;
         }
         $title = $project->get('MenuTitle') ? $project->get('MenuTitle') : $project->get('Title');
         $url = $this->config->pathFor('project', strtolower($folder->url));
         $itemDefaults = array('Title' => $title, 'Url' => $url);
         $navItem = array();
         if (method_exists($this->config, 'updateNavigationItem')) {
             $this->config->updateNavigationItem($navItem, $project);
         }
         $link = array_merge($itemDefaults, $navItem);
         $project->addData($link);
         if (!$project->get('HideInNavigation')) {
             $this->links[] = $link;
         }
         $this->navigationItems[] = $project;
     }
 }
Example #2
0
 public static function get_page_list()
 {
     return PageLoader::instance()->get_element_keys();
 }
Example #3
0
 private static function init()
 {
     //suffisso .page.php, scan recursively, keep dir as namespaces
     self::$instance = new PageLoader(self::PAGE_FILENAME_SUFFIX, true, true);
     //self::$instance->autoconfigure();
 }
Example #4
0
set_include_path(get_include_path() . PATH_SEPARATOR . 'application/conf/' . PATH_SEPARATOR . 'application/class/' . PATH_SEPARATOR . 'application/library/' . PATH_SEPARATOR . 'application/mvc/models/autoLoadedClass/');
require_once 'AutoLoader.php';
session_start();
setlocale(LC_TIME, "fr_FR.utf8");
header('Content-type: text/html; charset=UTF-8');
//test d'admin
if ($_POST["password"] != null && $_POST["login"] != null) {
    $xml = simplexml_load_file("application/conf/admin.xml");
    if ($_POST["password"] == $xml->Password["value"] && $_POST["login"] == $xml->Login["value"]) {
        $_SESSION["user"]->setRole("admin");
    } else {
        $_SESSION["user"]->setRole("guest");
    }
}
$tplEngine = new SimpleTemplate();
//initialize ACL
$_SESSION["user"] = $_SESSION["user"] == null ? new User() : $_SESSION["user"];
$tplEngine->initACL("application/conf/ACL.xml", $_SESSION["user"]->getRole());
//get MVC map
$pages = PageLoader::loadFromXML("application/conf/MVCMap.xml");
if (isset($_REQUEST["displayPage"]) && $_REQUEST["displayPage"] != "") {
    $displayPage = !is_null($pages[strtolower($_REQUEST["displayPage"])]) ? $pages[strtolower($_REQUEST["displayPage"])] : $pages["404"];
    define("MODEL", $displayPage["Model"]);
    define("VIEW", $displayPage["View"]);
    $page = $tplEngine->getPage($displayPage["Model"], $displayPage["View"]);
} else {
    define("MODEL", $pages['home']["Model"]);
    define("VIEW", $pages['home']["View"]);
    $page = $tplEngine->getPage($pages['home']["Model"], $pages['home']["View"]);
}
echo $page;
Example #5
0
 /**
  * @param $alias
  */
 public function load($alias)
 {
     $data = $this->pageLoader->load($alias);
     $this->setData($data['data']);
     $this->setSegments($data['segments']);
 }