/**
  * 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);
 }
 /**
  * Constructs HomeController, executing the method given as parameter
  *
  * @param $method Name of the method to execute
  * @param &tpl Template method implementation
  */
 function HomeController($method = null, $icfTemplating)
 {
     $this->tpl = $icfTemplating->getTpl();
     $this->text = $icfTemplating->getText();
     // Title of the page
     $this->tpl->assign('pageTitle', $this->text['home']);
     // Pending contents
     $objectMapper = new ObjectMapper();
     $objects = $objectMapper->findPending();
     $objectsCount = count($objects);
     $this->controllerData["pending"] = $objectsCount;
     // Allowed classes to add
     $session = new Session();
     $baseClassMapper = new BaseClassMapper();
     $classArray = $baseClassMapper->findByPermission(Action::ADD_OBJECTS_ACTION(), $session->getSessionUser());
     $this->tpl->assign("classArray", $classArray);
     switch ($method) {
         default:
             $this->show_view();
     }
 }