/** * Gets the class object */ function getClass() { if ($this->class == null) { $baseClassMapper = new BaseClassMapper(); $this->class = $baseClassMapper->get($this->classID); } return $this->class; }
/** * 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(); } }
/** * Constructs AddController */ function AddController() { // Construct... $this->Controller(); // Get parameters $this->classId = $_REQUEST["classId"]; $this->objectId = $_REQUEST["objectId"]; // Set the object in context if ($this->objectId != null && $this->objectId != "") { $objectMapper = new ObjectMapper(); $this->object = $objectMapper->get($this->objectId); $this->classId = $this->object->getClassID(); } assert($this->classId != null && $this->classId != ""); // Set the class in context $baseClassMapper = new BaseClassMapper(); $this->class =& $baseClassMapper->get($this->classId); // Set dateFormat $dateFormat = DateFormatFactory::getDateFormat(); $this->tpl->assign("dateFormat", $dateFormat); }
/** * Gets the class sent in controllerData * @return BaseClass - baseClass object */ function getClass() { $controllerData =& $this->getControllerData(); $classId = $controllerData["classIdSelect"]; $baseClassMapper = new BaseClassMapper(); $class = $baseClassMapper->get($classId); return $class; }
/** * Searches objects by text parameters * @param $classId Id of the class * @param $text Text to lookup in the objects * @param $fullTextSearch if true, the text is searched in all text fields and every coincidence is returned. * If false, it is only looked up in the title. */ function findByText($classId, $text, $fullTextSearch, $folderId = -1) { $objectQuery = new Query("Object"); $criteriaGroup = new CriteriaGroup(CriteriaGroup::getAndSeparator()); // Lookup by class... $criteria = new Criteria($objectQuery, "classID", $classId); $criteriaGroup->addCriterion($criteria); if ($folderId != -1 && $folderId != null) { // Lookup by folder... $objectFolderQuery =& $objectQuery->queryRelationedClass("ObjectFolder"); $folderCriteria = new Criteria($objectFolderQuery, "folderID", $folderId); $criteriaGroup->addCriterion($folderCriteria); } // ... and criterias sent if ($fullTextSearch) { // by fullTextIndex $criteria = new Criteria($objectQuery, "fullTextIndex", $text, Criteria::likeType()); $criteriaGroup->addCriterion($criteria); } else { // Issue a query to ObjectAttribute entity $objectAttributeQuery =& $objectQuery->queryRelationedClass("ObjectAttribute"); // Get the class $baseClassMapper = new BaseClassMapper(); $class = $baseClassMapper->get($classId); /* @var $class BaseClass */ // Get the fields that compose the title $titleClassAttributesArray = $class->getTitleClassAttributes(); // We need to query all title fields using the given value with OR (anyone can match) $criteriaGroupTitle = new CriteriaGroup(CriteriaGroup::getOrSeparator()); foreach ($titleClassAttributesArray as $titleClassAttribute) { // Must belong to the given class and LIKE the given title $criteriaGroupItem = new CriteriaGroup(); /* @var $titleClassAttribute ClassAttribute */ $criteriaGroupItem->addCriterion($criteria); $criteria = new Criteria($objectAttributeQuery, "classAttributeId", $titleClassAttribute->getId()); $criteriaGroupItem->addCriterion($criteria); $criteria = new Criteria($objectAttributeQuery, "value", $text, Criteria::likeType()); $criteriaGroupItem->addCriterion($criteria); $criteriaGroupTitle->addCriterion($criteriaGroupItem); } // Set the title criteria $criteriaGroup->addCriterion($criteriaGroupTitle); } $objectQuery->setCriterion($criteriaGroup); // Execute the query and map the results $objectMapper = new ObjectMapper(); $rv = $objectMapper->mapAll($objectQuery->execute()); return $rv; }
/** * Gets the child class associated to this object * @return BaseClass - BaseClass object */ function getChild() { if (is_null($this->child)) { $baseClassMapper = new BaseClassMapper(); $this->child = $baseClassMapper->get($this->getChildID()); } return $this->child; }
function displayUpdateFolderView() { $controllerData =& $this->getControllerData(); // Classes to link $baseClassMapper = new BaseClassMapper(); $classes =& $baseClassMapper->getAll(); $controllerData["classes"] =& $classes; $this->setUpdateFolderViewToolbar(); $this->tpl->assign("method", "updateFolder"); $this->displayView("addFolder.tpl.php"); }