예제 #1
1
 /**
  * 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;
 }
예제 #2
0
 /**
  * Gets the list of announcment beans from the request
  * 
  * @return array of announcment beans
  */
 private function getBeanFromRequest()
 {
     $sections = array('Global', 'Exhibition', 'Program', 'Course', 'Venue');
     $beans = array();
     foreach ($sections as $scope) {
         $bean = new Announcement();
         $pub_key = $scope . "_published";
         $oid_key = $scope . "_oid";
         $bean->setPublished($_REQUEST[$pub_key]);
         $bean->setOid($_REQUEST[$oid_key]);
         $bean->setScope($scope);
         $bean->setContent($_REQUEST[$scope]);
         $beans[$scope] = $bean;
     }
     return $beans;
 }