protected function getFeeds($type) { if (isset($this->feeds[$type])) { return $this->feeds[$type]; } $feeds = array(); switch ($type) { case 'static': $feeds = $this->loadFeedData(); break; case 'user': case 'resource': $section = $type == 'user' ? 'user_calendars' : 'resources'; $sectionData = $this->getOptionalModuleSection($section); $controller = false; if (isset($sectionData['MODEL_CLASS']) || isset($sectionData['RETRIEVER_CLASS']) || isset($sectionData['CONTROLLER_CLASS'])) { try { if (isset($sectionData['CONTROLLER_CLASS'])) { $modelClass = $sectionData['CONTROLLER_CLASS']; } else { $modelClass = isset($sectionData['MODEL_CLASS']) ? $sectionData['MODEL_CLASS'] : 'CalendarListModel'; } $controller = CalendarDataModel::factory($modelClass, $sectionData); } catch (KurogoException $e) { $controller = CalendarListController::factory($sectionData['CONTROLLER_CLASS'], $sectionData); } switch ($type) { case 'resource': $feeds = $controller->getResources(); break; case 'user': $feeds = $controller->getUserCalendars(); break; } } break; case 'category': $sectionData = $this->getOptionalModuleSection('categories'); $controllerClass = isset($sectionData['CONTROLLER_CLASS']) ? $sectionData['CONTROLLER_CLASS'] : ''; if (strlen($controllerClass)) { $controller = DataController::factory($controllerClass, $sectionData); foreach ($controller->items() as $category) { $feeds[$category->getId()] = array('TITLE' => $category->getName(), 'CATEGORY' => $category->getId(), 'BASE_URL' => $sectionData['EVENT_BASE_URL'], 'CONTROLLER_CLASS' => $sectionData['EVENT_CONTROLLER_CLASS']); } } break; default: throw new KurogoConfigurationException($this->getLocalizedString('ERROR_INVALID_FEED', $type)); } if ($feeds) { foreach ($feeds as $id => &$feed) { $feed['type'] = $type; } $this->feeds[$type] = $feeds; } return $feeds; }
protected function init($args) { parent::init($args); //either get the specified authority or attempt to get a GoogleApps authority $authorityIndex = isset($args['AUTHORITY']) ? $args['AUTHORITY'] : 'GoogleAppsAuthentication'; $authority = AuthenticationAuthority::getAuthenticationAuthority($authorityIndex); //make sure we're getting a google apps authority if ($authority instanceof GoogleAppsAuthentication) { $this->authority = $authority; } }
protected function getFeeds($type) { if (isset($this->feeds[$type])) { return $this->feeds[$type]; } $feeds = array(); switch ($type) { case 'static': $feeds = $this->loadFeedData(); break; case 'user': $sectionData = $this->getOptionalModuleSection('user_calendars'); $listController = isset($sectionData['CONTROLLER_CLASS']) ? $sectionData['CONTROLLER_CLASS'] : ''; if (strlen($listController)) { $sectionData = array_merge($sectionData, array('SESSION' => $this->getSession())); $controller = CalendarListController::factory($listController, $sectionData); $feeds = $controller->getUserCalendars(); } break; case 'resource': $sectionData = $this->getOptionalModuleSection('resources'); $listController = isset($sectionData['CONTROLLER_CLASS']) ? $sectionData['CONTROLLER_CLASS'] : ''; if (strlen($listController)) { $sectionData = array_merge($sectionData, array('SESSION' => $this->getSession())); $controller = CalendarListController::factory($listController, $sectionData); $feeds = $controller->getResources(); } break; case 'category': $sectionData = $this->getOptionalModuleSection('categories'); $controllerClass = isset($sectionData['CONTROLLER_CLASS']) ? $sectionData['CONTROLLER_CLASS'] : ''; if (strlen($controllerClass)) { $controller = DataController::factory($controllerClass, $sectionData); foreach ($controller->items() as $category) { $feeds[$category->getId()] = array('TITLE' => $category->getName(), 'CATEGORY' => $category->getId(), 'BASE_URL' => $sectionData['EVENT_BASE_URL'], 'CONTROLLER_CLASS' => $sectionData['EVENT_CONTROLLER_CLASS']); } } break; default: throw new KurogoConfigurationException($this->getLocalizedString('ERROR_INVALID_FEED', $type)); } if ($feeds) { foreach ($feeds as $id => &$feed) { $feed['type'] = $type; } $this->feeds[$type] = $feeds; } return $feeds; }
protected function getFeeds($type) { if (isset($this->feeds[$type])) { return $this->feeds[$type]; } $feeds = array(); switch ($type) { case 'static': $feeds = $this->loadFeedData(); break; case 'user': case 'resource': $typeController = $type=='user' ? 'UserCalendarListController' :'ResourceListController'; $sectionData = $this->getOptionalModuleSection('calendar_list'); $listController = isset($sectionData[$typeController]) ? $sectionData[$typeController] : ''; if (strlen($listController)) { $sectionData = array_merge($sectionData, array('SESSION'=>$this->getSession())); $controller = CalendarListController::factory($listController, $sectionData); switch ($type) { case 'resource': $feeds = $controller->getResources(); break; case 'user': $feeds = $controller->getUserCalendars(); break; } } break; default: throw new Exception("Invalid feed type $type"); } if ($feeds) { $this->feeds[$type] = $feeds; } return $feeds; }
protected function getFeeds($type) { if (isset($this->feeds[$type])) { return $this->feeds[$type]; } $feeds = array(); switch ($type) { case 'static': $feeds = $this->loadFeedData(); break; case 'user': case 'resource': $section = $type == 'user' ? 'user_calendars' : 'resources'; $sectionData = $this->getOptionalModuleSection($section); $listController = isset($sectionData['CONTROLLER_CLASS']) ? $sectionData['CONTROLLER_CLASS'] : ''; if (strlen($listController)) { $controller = CalendarListController::factory($listController, $sectionData); switch ($type) { case 'resource': $feeds = $controller->getResources(); break; case 'user': $feeds = $controller->getUserCalendars(); break; } } break; default: throw new KurogoConfigurationException($this->getLocalizedString('ERROR_INVALID_FEED', $type)); } if ($feeds) { $this->feeds[$type] = $feeds; } return $feeds; }
protected function getFeeds($type) { if (isset($this->feeds[$type])) { return $this->feeds[$type]; } $feeds = array(); switch ($type) { case 'static': $feeds = $this->loadFeedData(); break; case 'user': case 'resource': $section = $type == 'user' ? 'user_calendars' : 'resources'; $sectionData = $this->getOptionalModuleSection($section); $controller = false; if (isset($sectionData['MODEL_CLASS']) || isset($sectionData['RETRIEVER_CLASS']) || isset($sectionData['CONTROLLER_CLASS'])) { try { if (isset($sectionData['CONTROLLER_CLASS'])) { $modelClass = $sectionData['CONTROLLER_CLASS']; } else { $modelClass = isset($sectionData['MODEL_CLASS']) ? $sectionData['MODEL_CLASS'] : 'CalendarListModel'; } $controller = CalendarDataModel::factory($modelClass, $sectionData); } catch (KurogoException $e) { $controller = CalendarListController::factory($sectionData['CONTROLLER_CLASS'], $sectionData); } switch ($type) { case 'resource': $feeds = $controller->getResources(); break; case 'user': $feeds = $controller->getUserCalendars(); break; } } break; default: throw new KurogoConfigurationException($this->getLocalizedString('ERROR_INVALID_FEED', $type)); } if ($feeds) { $this->feeds[$type] = $feeds; } return $feeds; }