コード例 #1
0
ファイル: WebAppHandler.php プロジェクト: innomatic/innomedia
 public function doGet(\Innomatic\Webapp\WebAppRequest $req, \Innomatic\Webapp\WebAppResponse $res)
 {
     // Start Innomatic
     $innomatic = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer');
     $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_EXTERNAL);
     $root = \Innomatic\Core\RootContainer::instance('\\Innomatic\\Core\\RootContainer');
     $innomatic_home = $root->getHome() . 'innomatic/';
     $innomatic->bootstrap($innomatic_home, $innomatic_home . 'core/conf/innomatic.ini');
     // Start Innomatic domain
     \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->startDomain(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getName());
     // Innomedia page
     $scope_page = 'frontend';
     // Check if the page exists in the page tree
     $pageSearch = PageTree::findPageByPath(substr($req->getPathInfo(), 1));
     if ($pageSearch === false) {
         // This is a static page (excluding the home page).
         $location = explode('/', $req->getPathInfo());
         $module_name = isset($location[1]) ? $location[1] : '';
         $page_name = isset($location[2]) ? $location[2] : '';
         $pageId = isset($location[3]) ? $location[3] : 0;
     } else {
         // This is the home page or a content page.
         $module_name = $pageSearch['module'];
         $page_name = $pageSearch['page'];
         $pageId = $pageSearch['page_id'];
     }
     // Define Innomatic context
     $home = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getHome();
     $context = Context::instance('\\Innomedia\\Context');
     $context->setRequest($req)->setResponse($res)->process();
     // Build Innomedia page
     $page = new Page($module_name, $page_name, $pageId, $scope_page);
     $page->parsePage();
     // Check if the page is valid
     if (!$page->isValid()) {
         $res->sendError(\Innomatic\Webapp\WebAppResponse::SC_NOT_FOUND, $req->getRequestURI());
     } else {
         $page->build();
     }
 }
コード例 #2
0
 /**
  * Override the constructor from the PageTree
  * @see Cx\Core\PageTree::__construct()
  * @param type $entityManager
  * @param type $license
  * @param type $maxDepth
  * @param type $rootNode
  * @param type $lang
  * @param type $currentPage
  * @param type $skipInvisible
  * @param type $considerLogin
  */
 public function __construct($entityManager, $license, $maxDepth = 0, $rootNode = null, $lang = null, $currentPage = null, $skipInvisible = true, $considerLogin = false)
 {
     parent::__construct($entityManager, $license, $maxDepth, $rootNode, $lang, $currentPage, $skipInvisible, $considerLogin);
 }
コード例 #3
0
ファイル: Page.php プロジェクト: innomatic/innomedia
 public function getPageUrl($fullPath = false)
 {
     $url = '';
     // If this is a content page, try to get the url from its page path.
     if (strlen($this->id)) {
         $tree = new PageTree();
         $url = $tree->getPagePath($this->id);
     }
     // If the page path was not found, or the page is static, build the url
     // from the module and page name.
     if ($url === false or strlen($url) == 0) {
         $url = $this->module . '/' . $this->page;
         if (strlen($this->id)) {
             $url .= '/' . $this->id;
         }
     }
     // If $fullPath is set to true, return an absolute url.
     if ($fullPath) {
         $webAppUrl = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->domaindata['webappurl'];
         if (substr($webAppUrl, -1) != '/') {
             $url = '/' . $url;
         }
         $url = $webAppUrl . $url;
     }
     return $url;
 }