pages/manager/AnnouncementHandler.inc.php

00001 <?php
00002 
00015 //$Id$
00016 
00017 import('manager.PKPAnnouncementHandler');
00018 
00019 class AnnouncementHandler extends PKPAnnouncementHandler {
00023    function AnnouncementHandler() {
00024       parent::PKPAnnouncementHandler();
00025    }
00029    function announcements() {
00030       $templateMgr =& TemplateManager::getManager();     
00031 
00032       $conference =& Request::getConference();
00033       if ( $conference ) {
00034          $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00035          $schedConfs =& $schedConfDao->getSchedConfsByConferenceId($conference->getId());
00036          $schedConfNames = array(0 => __('common.all'));
00037          foreach($schedConfs->toArray() as $schedConf) {
00038             $schedConfNames[$schedConf->getId()] = $schedConf->getSchedConfTitle();
00039          }
00040 
00041          $templateMgr->assign_by_ref('schedConfNames', $schedConfNames);
00042       }
00043       
00044       //TODO: move this assignment to the abstracted templates or generalize the key 
00045       $templateMgr->assign('helpTopicId', 'conference.generalManagement.announcements');  
00046       parent::announcements();
00047    }
00048 
00052    function announcementTypes() {
00053       $templateMgr =& TemplateManager::getManager();
00054       //TODO: move this assignment to the abstracted templates or generalize the key 
00055       $templateMgr->assign('helpTopicId', 'conference.generalManagement.announcements');
00056       parent::announcementTypes();
00057    }     
00058 
00059    function &_getAnnouncements($rangeInfo = null) {
00060       $conference =& Request::getConference();
00061       $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
00062       $announcements =& $announcementDao->getAnnouncementsByConferenceId($conference->getId(), -1, $rangeInfo);
00063 
00064       return $announcements;
00065    }
00066    
00067    function &_getAnnouncementTypes($rangeInfo = null) {
00068       $conference =& Request::getConference();
00069       $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
00070       $announcements =& $announcementTypeDao->getAnnouncementTypesByAssocId(ASSOC_TYPE_CONFERENCE, $conference->getId(), $rangeInfo);
00071 
00072       return $announcements;
00073    }  
00074 
00080    function _announcementIsValid($announcementId) {
00081       if ($announcementId == null) 
00082          return true;
00083 
00084       $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
00085       $announcement =& $announcementDao->getAnnouncement($announcementId);
00086       if ( !$announcement ) return false;
00087       
00088       $conference =& Request::getConference();
00089       if ( $conference 
00090          && $announcement->getAssocType() == ASSOC_TYPE_CONFERENCE 
00091          && $announcement->getAssocId() == $conference->getId())
00092             return true;
00093       
00094       // if its a schedConf announcements, make sure it is for a schedConf that belongs to the current conference
00095       if ( $announcement->getAssocType() == ASSOC_TYPE_SCHED_CONF ) {
00096          $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00097          $schedConf =& $schedConfDao->getSchedConf($announcement->getAssocId());
00098          if ( $schedConf 
00099             && $conference 
00100             && $schedConf->getConferenceId() == $conference->getId() ) 
00101                return true;
00102       }
00103                
00104       return false;
00105    }  
00106 
00112    function _announcementTypeIsValid($typeId) {
00113       $conference =& Request::getConference();
00114       $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
00115       return (($typeId != null && $announcementTypeDao->getAnnouncementTypeAssocId($typeId) == $conference->getId()) || $typeId == null);
00116    }
00117 }
00118 
00119 ?>

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