pages/manager/ManagerHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('handler.Handler');
00018 
00019 class ManagerHandler extends Handler { 
00023    function ManagerHandler() {
00024       parent::Handler();
00025 
00026       $this->addCheck(new HandlerValidatorConference($this));     
00027       $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_CONFERENCE_MANAGER)));
00028    }
00029    
00033    function index() {
00034       // Manager requests should come to the Conference context, not Sched Conf
00035       if (Request::getRequestedSchedConfPath() != 'index') Request::redirect(null, 'index', 'manager');
00036       $this->validate();
00037       $this->setupTemplate();
00038       
00039       $conference =& Request::getConference();
00040       $templateMgr =& TemplateManager::getManager();
00041 
00042       $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00043       $schedConfs =& $schedConfDao->getSchedConfsByConferenceId($conference->getId());
00044       $templateMgr->assign_by_ref('schedConfs', $schedConfs);
00045 
00046       $templateMgr->assign('announcementsEnabled', $conference->getSetting('enableAnnouncements'));
00047       $templateMgr->assign('loggingEnabled', $conference->getSetting('conferenceEventLog'));
00048 
00049       $templateMgr->assign('helpTopicId','conference.index');
00050       $templateMgr->display(ROLE_PATH_CONFERENCE_MANAGER . '/index.tpl');
00051    }
00052 
00053 
00057    function email($args) {
00058       $this->validate();
00059       $this->setupTemplate(true);
00060       
00061       $conference =& Request::getConference();
00062       $schedConf =& Request::getSchedConf();
00063 
00064       $templateMgr =& TemplateManager::getManager();
00065       $templateMgr->assign('helpTopicId', 'conference.users.emailUsers');
00066 
00067       $userDao =& DAORegistry::getDAO('UserDAO');
00068 
00069       $site =& Request::getSite();
00070       $user =& Request::getUser();
00071 
00072       import('mail.MailTemplate');
00073       $email = new MailTemplate(Request::getUserVar('template'), Request::getUserVar('locale'));
00074 
00075       if (Request::getUserVar('send') && !$email->hasErrors()) {
00076          $email->send();
00077          Request::redirect(null, null, Request::getRequestedPage());
00078       } else {
00079          $email->assignParams(); // FIXME Forces default parameters to be assigned (should do this automatically in MailTemplate?)
00080          if (!Request::getUserVar('continued')) {
00081             if (($groupId = Request::getUserVar('toGroup')) != '') {
00082                // Special case for emailing entire groups:
00083                // Check for a group ID and add recipients.
00084                $groupDao =& DAORegistry::getDAO('GroupDAO');
00085                $group =& $groupDao->getGroup($groupId, ASSOC_TYPE_SCHED_CONF, $schedConf->getId());
00086                if ($group) {
00087                   $groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
00088                   $memberships =& $groupMembershipDao->getMemberships($group->getId());
00089                   $memberships =& $memberships->toArray();
00090                   foreach ($memberships as $membership) {
00091                      $user =& $membership->getUser();
00092                      $email->addRecipient($user->getEmail(), $user->getFullName());
00093                   }
00094                }
00095             }
00096             if (count($email->getRecipients())==0) $email->addRecipient($user->getEmail(), $user->getFullName());
00097          }
00098          $email->displayEditForm(Request::url(null, null, null, 'email'), array(), 'manager/people/email.tpl');
00099       }
00100    }     
00101 
00106    function setupTemplate($subclass = false) {
00107       parent::setupTemplate();
00108       AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OCS_MANAGER, LOCALE_COMPONENT_PKP_ADMIN));
00109       $templateMgr =& TemplateManager::getManager();
00110       $pageHierarchy = array();
00111 
00112       $conference =& Request::getConference();
00113       $schedConf =& Request::getSchedConf();
00114 
00115       if ($schedConf) {
00116          $pageHierarchy[] = array(Request::url(null, null, 'index'), $schedConf->getFullTitle(), true);
00117       } elseif ($conference) {
00118          $pageHierarchy[] = array(Request::url(null, 'index', 'index'), $conference->getConferenceTitle(), true);
00119       }
00120 
00121       if ($subclass) {
00122          $pageHierarchy[] = array(Request::url(null, null, 'user'), 'navigation.user');
00123          $pageHierarchy[] = array(Request::url(null, 'index', 'manager'), 'manager.conferenceSiteManagement');
00124       } else {
00125          $pageHierarchy[] = array(Request::url(null, null, 'user'), 'navigation.user');
00126       }
00127 
00128       $templateMgr->assign('pageHierarchy', $pageHierarchy);
00129    }
00130 }
00131 
00132 ?>

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