/** * Constructor * @param announcementId int leave as default for new announcement */ function AnnouncementForm($announcementId = null) { parent::PKPAnnouncementForm($announcementId); $journal =& Request::getJournal(); // If provided, announcement type is valid $this->addCheck(new FormValidatorCustom($this, 'typeId', 'optional', 'manager.announcements.form.typeIdValid', create_function('$typeId, $journalId', '$announcementTypeDao =& DAORegistry::getDAO(\'AnnouncementTypeDAO\'); return $announcementTypeDao->announcementTypeExistsByTypeId($typeId, ASSOC_TYPE_JOURNAL, $journalId);'), array($journal->getId()))); }
/** * Constructor * @param $journalId int * @param $announcementId int leave as default for new announcement * @param $readOnly boolean */ function AnnouncementForm($journalId, $announcementId = null, $readOnly = false) { parent::PKPAnnouncementForm($journalId, $announcementId); $this->_readOnly = $readOnly; // Validate date expire. $this->addCheck(new FormValidatorCustom($this, 'dateExpire', 'optional', 'manager.announcements.form.dateExpireValid', create_function('$dateExpire', '$today = getDate(); $todayTimestamp = mktime(0, 0, 0, $today[\'mon\'], $today[\'mday\'], $today[\'year\']); return (strtotime($dateExpire) > $todayTimestamp);'))); // If provided, announcement type is valid $this->addCheck(new FormValidatorCustom($this, 'typeId', 'optional', 'manager.announcements.form.typeIdValid', create_function('$typeId, $journalId', '$announcementTypeDao = DAORegistry::getDAO(\'AnnouncementTypeDAO\'); if((int)$typeId === 0) { return true; } else { return $announcementTypeDao->announcementTypeExistsByTypeId($typeId, ASSOC_TYPE_JOURNAL, $journalId);}'), array($journalId))); }
/** * Constructor * @param announcementId int leave as default for new announcement */ function AnnouncementForm($announcementId = null) { parent::PKPAnnouncementForm($announcementId); $conference =& Request::getConference(); // If provided, announcement type is valid $this->addCheck(new FormValidatorCustom($this, 'typeId', 'optional', 'manager.announcements.form.typeIdValid', create_function('$typeId, $conferenceId', '$announcementTypeDao =& DAORegistry::getDAO(\'AnnouncementTypeDAO\'); return $announcementTypeDao->announcementTypeExistsByTypeId($typeId, ASSOC_TYPE_CONFERENCE, $conferenceId);'), array($conference->getId()))); // If supplied, the scheduled conference exists and belongs to the conference $this->addCheck(new FormValidatorCustom($this, 'schedConfId', 'required', 'manager.announcements.form.schedConfIdValid', create_function('$schedConfId, $conferenceId', 'if ($schedConfId == 0) return true; $schedConfDao =& DAORegistry::getDAO(\'SchedConfDAO\'); $schedConf =& $schedConfDao->getSchedConf($schedConfId); if(!$schedConf) return false; return ($schedConf->getConferenceId() == $conferenceId);'), array($conference->getId()))); }