classes/notification/form/NotificationSettingsForm.inc.php

Go to the documentation of this file.
00001 <?php
00018 // $Id$
00019 
00020 
00021 import('notification.form.PKPNotificationSettingsForm');
00022 
00023 class NotificationSettingsForm extends PKPNotificationSettingsForm {
00027    function NotificationSettingsForm() {
00028       parent::PKPNotificationSettingsForm();
00029    }
00030 
00034    function readInputData() {
00035       $this->readUserVars(
00036          array(
00037             'notificationPaperSubmitted',
00038             'notificationMetadataModified',
00039             'notificationSuppFileModified',
00040             'notificationGalleyModified',
00041             'notificationSubmissionComment',
00042             'notificationReviewerComment',
00043             'notificationReviewerFormComment',
00044             'notificationDirectorDecisionComment',
00045             'notificationUserComment',
00046             'notificationNewAnnouncement',
00047             'emailNotificationPaperSubmitted',
00048             'emailNotificationMetadataModified',
00049             'emailNotificationSuppFileModified',
00050             'emailNotificationGalleyModified',
00051             'emailNotificationSubmissionComment',
00052             'emailNotificationReviewerComment',
00053             'emailNotificationReviewerFormComment',
00054             'emailNotificationDirectorDecisionComment', 
00055             'emailNotificationUserComment',
00056             'emailNotificationNewAnnouncement'
00057          )
00058       );
00059    }
00060    
00064    function display() {
00065       $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
00066       $conferences =& $conferenceDao->getConferenceTitles();
00067       
00068       $canOnlyRead = true;
00069       $canOnlyReview = false;
00070       
00071       if (Validation::isReviewer()) {
00072          $canOnlyRead = false;
00073          $canOnlyReview = true;
00074       }
00075       if (Validation::isSiteAdmin() || Validation::isConferenceManager() || Validation::isDirector()) {
00076          $canOnlyRead = false;
00077          $canOnlyReview = false;
00078       }
00079 
00080       $templateMgr =& TemplateManager::getManager();
00081       $templateMgr->assign('canOnlyRead', $canOnlyRead);
00082       $templateMgr->assign('canOnlyReview', $canOnlyReview);
00083       return parent::display();
00084    }
00085 
00089    function execute() {    
00090       $user = Request::getUser();
00091       $userId = $user->getId();
00092       
00093       // Notification settings
00094       $settings = array();
00095       if(!$this->getData('notificationPaperSubmitted')) $settings[] = NOTIFICATION_TYPE_PAPER_SUBMITTED;
00096       if(!$this->getData('notificationMetadataModified')) $settings[] = NOTIFICATION_TYPE_METADATA_MODIFIED;
00097       if(!$this->getData('notificationSuppFileModified')) $settings[] = NOTIFICATION_TYPE_SUPP_FILE_MODIFIED;
00098       if(!$this->getData('notificationGalleyModified')) $settings[] = NOTIFICATION_TYPE_GALLEY_MODIFIED;
00099       if(!$this->getData('notificationSubmissionComment')) $settings[] = NOTIFICATION_TYPE_SUBMISSION_COMMENT;
00100       if(!$this->getData('notificationReviewerComment')) $settings[] = NOTIFICATION_TYPE_REVIEWER_COMMENT;
00101       if(!$this->getData('notificationReviewerFormComment')) $settings[] = NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT;
00102       if(!$this->getData('notificationDirectorDecisionComment')) $settings[] = NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT; 
00103       if(!$this->getData('notificationUserComment')) $settings[] = NOTIFICATION_TYPE_USER_COMMENT;
00104       if(!$this->getData('notificationNewAnnouncement')) $settings[] = NOTIFICATION_TYPE_NEW_ANNOUNCEMENT;
00105       
00106       // Email settings
00107       $emailSettings = array();
00108       if($this->getData('emailNotificationPaperSubmitted')) $emailSettings[] = NOTIFICATION_TYPE_PAPER_SUBMITTED;
00109       if($this->getData('emailNotificationMetadataModified')) $emailSettings[] = NOTIFICATION_TYPE_METADATA_MODIFIED;
00110       if($this->getData('emailNotificationSuppFileModified')) $emailSettings[] = NOTIFICATION_TYPE_SUPP_FILE_MODIFIED;
00111       if($this->getData('emailNotificationGalleyModified')) $emailSettings[] = NOTIFICATION_TYPE_GALLEY_MODIFIED;
00112       if($this->getData('emailNotificationSubmissionComment')) $emailSettings[] = NOTIFICATION_TYPE_SUBMISSION_COMMENT;
00113       if($this->getData('emailNotificationReviewerComment')) $emailSettings[] = NOTIFICATION_TYPE_REVIEWER_COMMENT;
00114       if($this->getData('emailNotificationReviewerFormComment')) $emailSettings[] = NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT;
00115       if($this->getData('emailNotificationDirectorDecisionComment')) $emailSettings[] = NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT;
00116       if($this->getData('emailNotificationUserComment')) $emailSettings[] = NOTIFICATION_TYPE_USER_COMMENT;
00117       if($this->getData('emailNotificationNewAnnouncement')) $emailSettings[] = NOTIFICATION_TYPE_NEW_ANNOUNCEMENT;
00118       
00119       $notificationSettingsDao =& DAORegistry::getDAO('NotificationSettingsDAO');
00120       $notificationSettingsDao->updateNotificationSettings($settings, $userId);
00121       $notificationSettingsDao->updateNotificationEmailSettings($emailSettings, $userId);
00122       
00123       return true;
00124    }
00125 
00126 
00127 }
00128 
00129 ?>

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