/** * 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(); } }
/** * Shows the home view */ function show_view() { // Sets the title $this->tpl->assign('pageTitle', $this->text['pending']); // Add items to toolbar $toolbar =& $this->icfTemplating->getToolbar(); $ti = new icfToolbarItem(); $ti->setName("publishButton"); $ti->setTitle($this->text["publish"]); $ti->setUrl("#"); $ti->setImage("/images/publish.png"); $ti->setImage2("/images/publish_f2.png"); $ti->setOnclick("publishButton_onClick()"); $toolbar->addToolbarItem($ti); // Set toolbar $this->icfTemplating->setToolbar($toolbar); // Get the pending objects $objectMapper = new ObjectMapper(); $objects = $objectMapper->findPending(); $this->controllerData["objects"] = $objects; $this->tpl->assign("controllerData", $this->controllerData); $this->tpl->display("pending.tpl.php"); }