function execute()
 {
     $meeting =& $this->meeting;
     $submission =& $this->submission;
     import('classes.file.MinutesFileManager');
     $minutesUploader = new MinutesFileManager($meeting->getId(), null, $submission->getId());
     $minutesFile = $minutesUploader->uploadReview("minutesFile", $submission->getId());
 }
 function savePdf()
 {
     $meeting =& $this->meeting;
     $submission =& $this->submission;
     $summary = $submission->getSummaryFile() != null ? $submission->getSummaryFile() : $this->getData('summary');
     $specificDiscussionText = $this->getData('discussionText');
     $discussionType = $this->getData('discussionType');
     $typeOther = $this->getData('typeOther');
     $isUnanimous = $this->getData('unanimous') == "Yes" ? true : false;
     $decision = $this->getData("decision");
     $votes = $this->getData("votes");
     $minorityReason = $this->getData("minorityReason");
     $chairReview = $this->getData('chairReview');
     $abstract = $submission->getLocalizedAbstract();
     $pdf = new PDF();
     $pdf->AddPage();
     $pdf->ChapterTitle('CONTINUING REVIEW of ' . $submission->getProposalId());
     $pdf->ChapterItemKeyVal('Protocol Title', $abstract->getScientificTitle(), "BU");
     $pdf->ChapterItemKeyVal('Principal Investigator (PI)', $submission->getAuthorString(), "BU");
     $pdf->ChapterItemKeyVal('Unique project identification # assigned', $submission->getProposalId(), "BU");
     $pdf->ChapterItemKeyVal('Responsible Staff Member', $submission->getUser()->getFullName(), "BU");
     if ($isUnanimous) {
         switch ($decision) {
             case SUBMISSION_SECTION_DECISION_APPROVED:
                 $decisionStr = "The proposal was accepted in principal unanimously by all the members of the ERC present in the meeting, and was approved with clarifications mentioned above.";
                 break;
             case SUBMISSION_SECTION_DECISION_RESUBMIT:
                 $decisionStr = "The proposal was assigned for revision and resubmission in principal unanimously by all the members of the ERC present in the meeting provided with the considerations and conditions mentioned above.";
                 break;
             case SUBMISSION_SECTION_DECISION_DECLINED:
                 $decisionStr = "The proposal was not accepted in principal unanimously by all the members of the ERC present in the meeting due to concerns stated above.";
                 break;
         }
     } else {
         switch ($decision) {
             case SUBMISSION_SECTION_DECISION_APPROVED:
                 $decisionStr = "The proposal was accepted in principal by the majority of the ERC members present in the meeting and was approved with clarifications mentioned above.";
                 break;
             case SUBMISSION_SECTION_DECISION_RESUBMIT:
                 $decisionStr = "The proposal was assigned for revision and resubmission in principal by the majority of the ERC members present in the meeting provided with the considerations and conditions mentioned above.";
                 break;
             case SUBMISSION_SECTION_DECISION_DECLINED:
                 $decisionStr = "The proposal was not accepted in principal unanimously by the majority of the ERC members present in the meeting due to concerns stated above.";
                 break;
         }
         $votesStr = "The distribution of votes are as follows. " . $this->getData('votesApprove') . " member(s) voted for, " . $this->getData('votesNotApprove') . " member(s) voted against, " . $this->getData('votesAbstain') . " member(s) abstained.";
         $reasonsStr = "Reasons for minority opinions are as follows: {$minorityReason}";
     }
     $pdf->ChapterItemKey('IRB Decision and Votes', "BU");
     $pdf->ChapterItemVal($decisionStr);
     if (!$isUnanimous) {
         $pdf->ChapterItemVal($votesStr);
         $pdf->ChapterItemVal($reasonsStr);
         if ($chairReview != null) {
             $pdf->ChapterItemVal($chairReview);
         }
     }
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $filename = $abstract->getScientificTitle() . ".pdf";
     $meetingFilesDir = Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/meetings/' . $meeting->getId() . "/continuingReviews/" . $filename;
     import('classes.file.MinutesFileManager');
     $minutesFileManager = new MinutesFileManager($meeting->getId(), "continuingReviews", $submission->getId());
     if ($minutesFileManager->createDirectory()) {
         $pdf->Output($meetingFilesDir, "F");
     }
 }
 /**
  * PRIVATE routine to upload the file and add it to the database.
  * @param $fileName string index into the $_FILES array
  * @param $type string identifying type
  * @param $fileId int ID of an existing file to update
  * @return int the file ID (false if upload failed)
  */
 function handleUpload($fileName, $type, $fileId = null)
 {
     if (HookRegistry::call('MinutesFileManager::handleUpload', array(&$fileName, &$type, &$fileId, &$result))) {
         return $result;
     }
     $minutesFileDao =& DAORegistry::getDAO('MinutesFileDAO');
     $typePath = $this->typeToPath($type);
     $dir = $this->filesDir . $typePath . '/';
     if (!$fileId) {
         // Insert dummy file to generate file id FIXME?
         $dummyFile = true;
         $minutesFile =& $this->generateDummyFile($this->meeting);
     } else {
         $dummyFile = false;
         $minutesFile = new MinutesFile();
         $minutesFile->setMeetingId($this->meetingId);
         $minutesFile->setFileId($fileId);
         $minutesFile->setDateCreated(Core::getCurrentDate());
     }
     $minutesFile->setFileType($_FILES[$fileName]['type']);
     $minutesFile->setFileSize($_FILES[$fileName]['size']);
     $minutesFile->setOriginalFileName(MinutesFileManager::truncateFileName($_FILES[$fileName]['name'], 127));
     $minutesFile->setType($typePath);
     $newFileName = $this->generateFilename($minutesFile, $typePath, $this->getUploadedFileName($fileName));
     if (!$this->uploadFile($fileName, $dir . $newFileName)) {
         // Delete the dummy file we inserted
         $minutesFileDao->deleteMinutesFileById($minutesFile->getFileId());
         return false;
     }
     if ($dummyFile) {
         $minutesFileDao->updateMinutesFile($minutesFile);
     } else {
         $minutesFileDao->insertMinutesFile($minutesFile);
     }
     return $minutesFile->getFileId();
 }
Beispiel #4
0
 function savePdf()
 {
     $meeting =& $this->meeting;
     $meetingAttendanceDao =& DAORegistry::getDAO("MeetingAttendanceDAO");
     $meetingAttendances =& $meetingAttendanceDao->getMeetingAttendancesByMeetingId($meeting->getId());
     $suppGuestNames = $this->getData("suppGuestName");
     $suppGuestAffiliations = $this->getData("suppGuestAffiliation");
     $meetingDateTime = date("d F Y g:ia", strtotime($meeting->getDate()));
     $meetingDate = date("d F Y", strtotime($meeting->getDate()));
     $details = Locale::translate('editor.meeting.attendanceReport.intro1') . ' ' . $this->getData("venue") . ' ' . Locale::translate('common.date.on') . ' ' . $meetingDateTime . ' ' . Locale::translate('editor.meeting.attendanceReport.intro2') . ' ' . $this->quorum . ' ' . Locale::translate('editor.meeting.attendanceReport.intro3') . ' ' . $this->getData('adjourned') . ".";
     $journal = Request::getJournal();
     $user = Request::getUser();
     import('classes.lib.tcpdf.pdf');
     $pdf = new PDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor($user->getFullName());
     $pdf->SetTitle($journal->getJournalTitle());
     $pdf->SetSubject($meeting->getPublicId() . ' - ' . Locale::translate('editor.minutes.attendance'));
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 020', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, 58, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->AddPage();
     $pdf->SetFont('dejavusans', 'B', 13);
     $sectionDao =& DAORegistry::getDAO("SectionDAO");
     $erc =& $sectionDao->getSection($meeting->getUploader());
     $pdf->SetFont('dejavusans', 'I', 13);
     $pdf->MultiCell(0, 6, $erc->getSectionTitle(), 0, 'C');
     $pdf->MultiCell(0, 6, Locale::translate('editor.meeting.attendanceReport.meetingDate') . ' ' . $meetingDate, 0, 'C');
     $pdf->ln();
     $memberCount = 0;
     $pdf->SetFont('dejavusans', 'BU', 12);
     $pdf->MultiCell(0, 6, Locale::translate('editor.meeting.attendanceReport.membersPresent'), 0, 'L');
     $pdf->ln();
     $pdf->SetFont('dejavusans', '', 12);
     foreach ($meetingAttendances as $meetingAttendance) {
         if ($meetingAttendance->getWasPresent() == 1) {
             $member =& $meetingAttendance->getUser();
             $pdf->MultiCell(0, 6, $member->getFullName(), 0, 'L');
             $memberCount++;
         }
     }
     if ($memberCount == 0) {
         $pdf->MultiCell(0, 6, Locale::translate('common.none'), 0, 'L');
     }
     $pdf->ln();
     $memberCount = 0;
     $pdf->SetFont('dejavusans', 'BU', 12);
     $pdf->MultiCell(0, 6, Locale::translate('editor.meeting.attendanceReport.membersAbsent'), 0, 'L');
     $pdf->ln();
     $pdf->SetFont('dejavusans', '', 12);
     foreach ($meetingAttendances as $meetingAttendance) {
         if ($meetingAttendance->getWasPresent() == 2) {
             $member =& $meetingAttendance->getUser();
             $pdf->MultiCell(0, 6, $member->getFullName() . ' (' . Locale::translate('editor.meeting.attendanceReport.reasonForAbsence') . ' ' . $meetingAttendance->getReasonForAbsence() . ')', 0, 'L');
             $memberCount++;
         }
     }
     if ($memberCount == 0) {
         $pdf->MultiCell(0, 6, Locale::translate('common.none'), 0, 'L');
     }
     $pdf->ln();
     if (count($suppGuestNames) > 0) {
         $suppGuestCount = 0;
         foreach ($suppGuestNames as $key => $guest) {
             if ($guest != "" && $guest != null) {
                 if ($suppGuestCount == 0) {
                     $pdf->SetFont('dejavusans', 'BU', 12);
                     $pdf->MultiCell(0, 6, Locale::translate('editor.meeting.attendanceReport.suppGuest'), 0, 'L');
                     $pdf->ln();
                     $pdf->SetFont('dejavusans', '', 12);
                 }
                 $pdf->MultiCell(0, 6, $guest . ' (' . $suppGuestAffiliations[$key] . ')', 0, 'L');
                 $suppGuestCount++;
             }
         }
         $pdf->ln();
     }
     $pdf->MultiCell(0, 6, $details, 0, 'L');
     $pdf->ln();
     if ($this->getData("announcements")) {
         $pdf->SetFont('dejavusans', 'BU', 12);
         $pdf->MultiCell(0, 6, Locale::translate('editor.meeting.attendanceReport.announcements'), 0, 'L');
         $pdf->ln();
         $pdf->SetFont('dejavusans', '', 12);
         $pdf->MultiCell(0, 6, $this->getData("announcements"), 0, 'L');
         $pdf->ln();
     }
     $pdf->SetFont('dejavusans', 'BU', 12);
     $pdf->MultiCell(0, 6, Locale::translate('editor.meeting.attendanceReport.submittedBy'), 0, 'L');
     $pdf->ln();
     $pdf->SetFont('dejavusans', '', 12);
     $pdf->MultiCell(0, 6, $user->getFullName(), 0, 'L');
     $pdf->ln();
     import('classes.file.MinutesFileManager');
     $minutesFileManager = new MinutesFileManager($meeting->getId());
     $minutesFileManager->handleWrite($pdf, MINUTES_FILE_ATTENDANCE);
 }
Beispiel #5
0
 function uploadFile($args)
 {
     $meetingId = isset($args[0]) ? (int) $args[0] : 0;
     $type = isset($args[1]) ? (string) $args[1] : '';
     $this->validate($meetingId);
     import('classes.file.MinutesFileManager');
     $minutesFileManager = new MinutesFileManager($meetingId);
     $minutesFileManager->handleUpload('uploadMinutesFile', $type);
     Request::redirect(null, null, 'manageMinutes', $meetingId);
 }