/** * Return the announcment(s) for the given scope. * If no scope is given, the global announcment will * be returned. In any case, a published global announcment * will be stored in the "global" attribute in the bean. * If the published flag is set, the method will return the * content value if published or an empty string if not. * * @param string $scope (e.g. Exhibition, Program, Course, Global) * @param boolean $published Return just the published value? [false] * @param boolean $global Also set and return the published global content? [false] * @return bean The announcment bean for the given scope */ public function getAnnouncement($scope, $published = false, $global = false) { global $logger; $logger->debug(get_class($this) . "::getAnnouncment({$scope})"); $notice = new Announcement(); // get the scoped announcement if ($scope != null) { $section = $this->fetch($scope); $snotice = $section->content; if ($published && !$section->published) { $snotice = ""; } } // get the global announcement if ($global) { $global = $this->fetch('Global'); $gnotice = $global->content; if ($published && !$global->published) { $gnotice = ""; } $notice->setGlobal($gnotice); } $notice->setContent($snotice); $notice->setScope($scope); if ($section != null) { $notice->setPublished($section->getPublished()); $notice->setOid($section->getOid()); } return $notice; }