pages/announcement/AnnouncementHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 
00018 import('announcement.PKPAnnouncementHandler');
00019 import('handler.validation.HandlerValidatorConference');
00020 
00021 class AnnouncementHandler extends PKPAnnouncementHandler {
00025    function AnnouncementHandler() {
00026       parent::PKPAnnouncementHandler();
00027 
00028       $this->addCheck(new HandlerValidatorConference($this));
00029    }
00030 
00031    function _getAnnouncementsEnabled() {
00032       $conference =& Request::getConference();
00033       return $conference->getSetting('enableAnnouncements');
00034    }
00035 
00036    function &_getAnnouncements($rangeInfo = null) {
00037       $conference =& Request::getConference();
00038       $schedConf =& Request::getSchedConf();
00039 
00040       $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
00041       if($schedConf) {
00042          $announcements =& $announcementDao->getAnnouncementsNotExpiredByConferenceId($conference->getId(), $schedConf->getId(), $rangeInfo);
00043          $announcementsIntroduction = $schedConf->getLocalizedSetting('announcementsIntroduction');
00044       } else {
00045          $announcements =& $announcementDao->getAnnouncementsNotExpiredByAssocId(ASSOC_TYPE_CONFERENCE, $conference->getId(), $rangeInfo);
00046          $announcementsIntroduction = $conference->getLocalizedSetting('announcementsIntroduction');
00047       }
00048 
00049       return $announcements;
00050    }
00051    
00052    function _getAnnouncementsIntroduction() {
00053       $conference =& Request::getConference();
00054       $schedConf =& Request::getSchedConf();
00055       
00056       if($schedConf) {
00057          return $schedConf->getLocalizedSetting('announcementsIntroduction');
00058       } else {
00059          return $conference->getLocalizedSetting('announcementsIntroduction');
00060       }
00061    }
00062       
00063    function _announcementIsValid($announcementId) {
00064       if ($announcementId == null) return false;
00065 
00066       $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
00067       switch ($announcementDao->getAnnouncementAssocType($announcementId)) {
00068          case ASSOC_TYPE_CONFERENCE:
00069             $conference =& Request::getConference();
00070             return (
00071                $conference &&
00072                $announcementDao->getAnnouncementAssocId($announcementId) == $conference->getId()
00073             );
00074          case ASSOC_TYPE_SCHED_CONF:
00075             $schedConf =& Request::getSchedConf(); 
00076             return (
00077                $schedConf &&
00078                $announcementDao->getAnnouncementAssocId($announcementId) == $schedConf->getId()
00079             );
00080          default:
00081             return false;
00082       }
00083    }
00084 }
00085 
00086 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7