/** * This class implements the Singleton pattern. There is only ever * one instance of the this class and it is accessed only via the * ClassName::instance() method. * * @return object * @access public * @since 5/26/05 * @static */ public static function instance() { if (!isset(self::$instance)) { self::$instance = new PortalManager(); } return self::$instance; }
/** * Answer an array of slot-names in other folders in the Main category. * * @return array * @access private * @since 4/1/08 */ private function getOtherCategorizedSlotNames() { $portalMgr = PortalManager::instance(); $slotNames = array(); $foldersToIgnoreFrom = array('upcoming_classes', 'current_classes', 'past_classes', 'personal'); foreach ($foldersToIgnoreFrom as $folderId) { $folder = $portalMgr->getFolder($folderId); if ($folder->getIdString() != $this->getIdString()) { foreach ($folder->getSlots() as $slot) { $slotNames[] = $slot->getShortname(); } } } return $slotNames; }
/** * Answer the current Folder id * * @return string * @access private * @since 4/1/08 */ private function getCurrentFolderId() { if (!isset($this->currentFolderId)) { if (RequestContext::value('folder')) { try { $portalMgr = PortalManager::instance(); $folder = $portalMgr->getFolder(RequestContext::value('folder')); $this->currentFolderId = $folder->getIdString(); } catch (UnknownIdException $e) { $this->currentFolderId = 'recent_access'; } } else { if (UserData::instance()->getPreference('segue_portal_last_folder')) { $harmoni = Harmoni::instance(); $this->currentFolderId = UserData::instance()->getPreference('segue_portal_last_folder'); if (!strlen(RequestContext::value('starting_number')) && UserData::instance()->getPreference('segue_portal_starting_number')) { $harmoni->request->setRequestParam('starting_number', UserData::instance()->getPreference('segue_portal_starting_number')); } try { $portalMgr = PortalManager::instance(); $folder = $portalMgr->getFolder($this->currentFolderId); $this->currentFolderId = $folder->getIdString(); } catch (UnknownIdException $e) { $this->currentFolderId = 'personal'; $harmoni->request->setRequestParam('starting_number', '0'); } } else { $this->currentFolderId = 'recent_access'; } } } UserData::instance()->setPreference('segue_portal_last_folder', $this->currentFolderId); UserData::instance()->setPreference('segue_portal_starting_number', strval(intval(RequestContext::value('starting_number')))); return $this->currentFolderId; }