/** * Send the status to authors, with anonymous reviews */ function notifyAction() { $db = $this->zmax_context->db; $paperTbl = new Paper(); $paperStatusTbl = new PaperStatus(); // Load the reviews template $this->view->setFile("review", "review4author.xml"); $this->view->setBlock("review", "review_mark", "review_marks"); $this->view->setBlock("review", "review_answer", "review_answers"); // Set the subject $subject = $this->texts->mail->subj_notification; if (isset($_REQUEST['id_paper'])) { // Mail for one paper $idPaper = $_REQUEST['id_paper']; $this->view->setFile("content", "showmessage.xml"); $this->view->setBlock("content", "WARNING_TEMPLATE", " "); $paper = $paperTbl->find($idPaper)->current(); if (!empty($paper->status)) { $paper->putInView($this->view); $this->view->reviews = $paper->showReviews($this->view); $statusRow = $paperStatusTbl->find($paper->status)->current(); $mail = new Mail(Mail::SOME_USER, $subject, $this->view->getScriptPaths()); $mail->setTo($paper->emailContact); $mail->setFormat(Mail::FORMAT_HTML); $mail->loadTemplate($this->lang, $statusRow->mailTemplate); // We know the paper, so we can instantiate the mail entities $this->view->setVar("mailTemplate", $mail->getTemplate()); $this->view->assign("mailTemplate", "mailTemplate"); $mail->setTemplate($this->view->mailTemplate); // Put in the view $mail->putInView($this->view); } else { $this->content = "Cannot send notification without a status<br/>"; } echo $this->view->render("layout"); return; } else { // Batch mail. Check that all papers have a status, // and that there are no missing reviews $this->view->setFile("content", "notify.xml"); $this->view->setBlock("content", "TEMPLATE", "TEMPLATES"); $res = $db->query("SELECT count(*) AS count FROM Paper p, PaperStatus s " . " WHERE p.status = s.id AND final_status != 'Y'"); $p = $res->fetch(Zend_Db::FETCH_OBJ); if ($p->count > 0) { $this->view->content = "Cannot send notification mails: some papers do not have a status"; echo $this->view->render("layout"); exit; } $qReview = "SELECT count(*) AS count FROM Review WHERE overall IS NULL"; $res = $db->query($qReview); $p = $res->fetch(Zend_Db::FETCH_OBJ); if ($p->count > 0) { $this->view->content = "Cannot send notification mails: missing reviews"; echo $this->view->render("layout"); exit; } // OK. Now give the list of the templates that will be used $i = 0; $paperStatusList = $paperStatusTbl->fetchAll("final_status = 'Y'"); $mail = new Mail(Mail::SOME_USER, "", $this->view->getScriptPaths()); foreach ($paperStatusList as $paperStatus) { $this->view->css_class = Config::CssCLass($i++); $paperStatus->putInView($this->view); $mail->loadTemplate($this->lang, $paperStatus->mailTemplate); $this->view->setVar("template_content-{$paperStatus->id}", $mail->getTemplate()); $this->view->assign("template_content", "template_content-{$paperStatus->id}"); $this->view->append("TEMPLATES", "TEMPLATE"); } // Send the notification mails. $messages = ""; if (isset($_REQUEST['confirmed']) or isset($_REQUEST['export'])) { PaperRow::$loadAbstracts = false; $papers = $paperTbl->fetchAll(); $mail = new Mail(Mail::SOME_USER, $subject, $this->view->getScriptPaths()); $mail->setFormat(Mail::FORMAT_HTML); $mail->setCopyToChair(true); foreach ($papers as $paper) { $statusRow = $paperStatusTbl->find($paper->status)->current(); $mail->setTo($paper->emailContact); $mail->loadTemplate($this->lang, $statusRow->mailTemplate); $paper->putInView($mail->getEngine()); $mail->getEngine()->reviews = $paper->showReviews($this->view); if (isset($_REQUEST['confirmed'])) { $mail->send(); } else { $messages .= $mail->getMessage() . "\n\n"; } } } } if (isset($_REQUEST['export'])) { header("Content-disposition: attachment; filename=notificationMails.txt"); header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: text\n"); header("Content-Length: " . strlen($messages)); header("Pragma: no-cache"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public"); header("Expires: 0"); echo $messages; } else { echo $this->view->render("layout"); } }
/** * Show the list of papers with a given status */ function acceptedAction() { // There should be a 'status' parameter $paperTbl = new Paper(); $paperStatusTbl = new PaperStatus(); $status = $this->getRequest()->getParam("status"); $paperStatus = $paperStatusTbl->find($status)->current(); // Is the 'text' format required ? if (isset($_REQUEST['format']) and $_REQUEST['format'] == "text") { $textFormat = true; $this->view->setFile("content", "accepted_simple.txt"); } else { $textFormat = false; $this->view->setFile("content", "accepted_simple.xml"); } $this->view->setBlock("content", "PAPER", "PAPERS"); $paperStatus->putInView($this->view); $paperTbl = new Paper(); $no = 1; $papers = $paperTbl->fetchAll("status='{$status}'"); foreach ($papers as $paper) { $paper->putInView($this->view); $this->view->no = $no++; $this->view->append("PAPERS", "PAPER"); } //Function from MyReview V1. Allows assignment of accepted papers to sessions. /* AdmListAcceptedPapers ($_REQUEST['status'], $this->view, $this->db_v1, 1, $this->zmax_context->texts);*/ if ($textFormat) { Header("Content-type: text/plain"); $this->view->assign("result", "content"); echo utf8_decode($this->view->result); } else { echo $this->view->render("layout"); } }