Exemplo n.º 1
0
 /**
  * Constructs the IcfTemplating object
  */
 function IcfTemplating($page = "")
 {
     // Load configuration
     $icfConfig = new IcfConfig();
     $this->tpl =& new Savant2();
     // add a template path
     $this->tpl->addPath("template", $icfConfig->cfg_site_beTemplatePath);
     $this->tpl->assign("templatePath", $icfConfig->cfg_site_beTemplateUrl);
     $this->tpl->assign("basePath", $icfConfig->cfg_site_feBaseUrl);
     // multilingual support
     require_once $this->getStringsFile($icfConfig);
     // Session support
     $session = new Session();
     $this->tpl->assign("user", $session->getSessionUser());
     // basic toolbar support
     $toolbarItem = new icfToolbarItem();
     $toolbarItem->setName("exit");
     $toolbarItem->setTitle($text["exit"]);
     $toolbarItem->setUrl("login.php");
     $toolbarItem->setImage("/images/exit.png");
     $toolbarItem->setImage2("/images/exit_f2.png");
     $toolbar = new IcfToolbar();
     $toolbar->addToolbarItem($toolbarItem);
     // Menu support
     $menu = new IcfMenu();
     // Only work it if the session is valid
     $session = new Session();
     if ($session->isValid() == true) {
         $user = $session->getSessionUser();
         // Classes whose objects the user can create
         $baseClassMapper = new BaseClassMapper();
         $classes = $baseClassMapper->findByPermission(Action::ADD_OBJECTS_ACTION(), $user);
         $menu->setContents($classes);
         // The folders
         $folderMapper = new FolderMapper();
         $rootFolder = $folderMapper->getRoot();
         $folderArray = array(0 => $rootFolder);
         $menu->setFolders($folderArray);
     }
     // Set the generated content in the context of this request (available for client pages to change it)
     $this->setText($text);
     $this->setToolbar($toolbar);
     $this->setMenu($menu);
 }
Exemplo n.º 2
0
 /**
  * Looks up the folders allowed for the user in the session that can be used to add a new class object
  * @param $class Class whose instance are to be added
  * @return Array - An array that includes for each position other array with: id, title, parentId, closed, open, mode
  */
 function getFolderArray($class, $object = null)
 {
     // Get root folders
     $folderMapper = new FolderMapper();
     $folder = $folderMapper->getRoot();
     $folderArray = array(0 => $folder);
     $allowedFolderArray = array();
     return $this->getFolderArrayRecursive($folderArray, $class, $allowedFolderArray, $object);
 }