/** * 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 program of the conference */ function programAction() { $confSessionTbl = new ConfSession(); $this->view->setFile("content", "program.xml"); $this->view->set_block("content", "DATE", "DATES"); $this->view->set_block("DATE", "SESSION_DETAIL", "SESSIONS"); $this->view->set_block("SESSION_DETAIL", "PAPER_DETAIL", "PAPERS"); $this->view->set_block("SESSION_DETAIL", "PAPER_DOWNLOAD", " "); $this->view->set_block("SESSION_DETAIL", "CHAIR", "SHOW_CHAIR"); $this->view->set_block("SESSION_DETAIL", "ROOM", "SHOW_ROOM"); // Check whether the links to CR files are required $listFiles = array(); if (isset($_REQUEST['with_links'])) { // Get the list of required files in the proceedings phase $requiredFileTbl = new RequiredFile(); $requiredFiles = $requiredFileTbl->fetchAll("id_phase = " . Config::PROCEEDINGS_PHASE); foreach ($requiredFiles as $requiredFile) { $listFiles[$requiredFile->file_code] = $requiredFile->file_extension; } // Directory of the CR files: the "proceedings" subdirectory must // be copied under the current directory when the program is published. $fileDir = $this->zmax_context->config->app->upload_path . DIRECTORY_SEPARATOR; } else { $this->view->download_link = ""; } // First, loop on the dates $q_dates = "SELECT DISTINCT slot_date, UNIX_TIMESTAMP(slot_date) AS timestamp FROM Slot s ORDER BY slot_date"; $rDates = $this->zmax_context->db->query($q_dates); while ($date = $rDates->fetch(Zend_Db::FETCH_OBJ)) { $this->view->SESSIONS = ""; $zDate = new Zend_Date($date->timestamp, Zend_Date::TIMESTAMP); $this->view->date = $zDate->toString("EEEE d MMM yyyy", $this->zmax_context->locale); $q_sessions = "SELECT c.id, name, chair, comment as sess_comment, room, " . " end as slot_end, begin as slot_begin " . " FROM ConfSession c, Slot s " . " WHERE s.id=c.id_slot AND slot_date='{$date->slot_date}'" . " ORDER BY slot_date, begin, end, c.id"; $rSess = $this->zmax_context->db->query($q_sessions); while ($session = $rSess->fetch(Zend_Db::FETCH_OBJ)) { $this->view->PAPERS = ""; $this->view->conf_session_name = $session->name; $this->view->conf_slot_name = substr($session->slot_begin, 0, 5) . "-" . substr($session->slot_end, 0, 5); $this->view->conf_session_comment = $session->sess_comment; $this->view->conf_session_chair = $session->chair; $this->view->conf_session_room = $session->room; if (empty($session->room)) { $this->view->SHOW_ROOM = ""; } else { $this->view->assign("SHOW_ROOM", "ROOM"); } if (empty($session->chair)) { $this->view->SHOW_CHAIR = ""; } else { $this->view->assign("SHOW_CHAIR", "CHAIR"); } // Now, loop on accepter papers $q_papers = "SELECT * FROM Paper " . "WHERE id_conf_session='{$session->id}' ORDER BY position_in_session"; $rp = $this->zmax_context->db->query($q_papers); while ($paper = $rp->fetch(Zend_Db::FETCH_OBJ)) { $this->view->paper_authors = PaperRow::getPaperAuthors($this->zmax_context->db, $paper); $this->view->paper_title = $paper->title; // Take the name of the camera ready file $iFile = 0; foreach ($listFiles as $code => $ext) { $iFile++; $filePath = "." . DIRECTORY_SEPARATOR . "proceedings" . DIRECTORY_SEPARATOR . $code . "_" . $paper->id . "." . $ext; if (file_exists($filePath)) { $this->view->file_path = $filePath; // $this->texts->author->get($code) . "</a>"; $this->view->append("PAPERS", "PAPER_DOWNLOAD"); } else { // No file to download $this->view->append("PAPERS", "PAPER_DETAIL"); } } // No file? Show the paper anyway if ($iFile == 0) { $this->view->append("PAPERS", "PAPER_DETAIL"); } } $this->view->append("SESSIONS", "SESSION_DETAIL"); } $this->view->append("DATES", "DATE"); } echo $this->view->render("layout"); }
/** * List of papers with their reviews */ private function papersReviews($view, $templateName, $html = true, $anonymized = false) { $db = Zend_Db_Table::getDefaultAdapter(); $paperTbl = new Paper(); $paperStatusTbl = new PaperStatus(); $criteriaTbl = new Criteria(); $reviewTbl = new Review(); $reviewMarkTbl = new ReviewMark(); $registry = Zend_registry::getInstance(); $config = $registry->get("Config"); $config->putInView($view); // Set the mail types $view->someUser = Mail::SOME_USER; // Extract the block for each paper $view->setBlock($templateName, "PAPER_DETAIL", "PAPERS"); $view->setBlock($templateName, "REVIEW_CRITERIA", "REVIEW_CRITERIAS"); $view->setBlock("PAPER_DETAIL", "PAPER_INFO", "PAPER_DATA"); $view->setBlock("PAPER_DETAIL", "REVIEW_MARK", "REVIEW_MARKS"); $view->setBlock("PAPER_DETAIL", "REVIEWER", "REVIEWER_INFO"); // Header of the table, taken from table Criteria $criterias = $criteriaTbl->fetchAll(); $listCriterias = array(); foreach ($criterias as $criteria) { $criteria->putInView($view); $listCriterias[] = $criteria; $view->append("REVIEW_CRITERIAS", "REVIEW_CRITERIA"); } // Sort the papers on the average 'overall' field $query = "SELECT p.*, round(AVG(overall),4) AS overall " . "FROM Paper p LEFT JOIN Review r ON p.id=r.idPaper " . " WHERE inCurrentSelection='Y' GROUP BY p.id"; $result = $db->query($query); $arrPaper = $rankPaper = array(); while ($paper = $result->fetch(Zend_Db::FETCH_OBJ)) { $arrPaper[$paper->id] = $paper; $rankPaper[$paper->id] = $paper->overall; } // Get the status list $statusList = $db->fetchPairs("SELECT * FROM PaperStatus WHERE final_status='Y'"); // Sort in descending order arsort($rankPaper); reset($rankPaper); // List the papers in order $iPaper = 0; foreach ($rankPaper as $idPaper => $overall) { $paper = $arrPaper[$idPaper]; // Choose the CSS class $view->css_class = Config::CssCLass($iPaper++); $view->paper_id = $paper->id; $view->paper_title = $paper->title; if (!$anonymized) { $view->paper_authors = PaperRow::getPaperAuthors($db, $paper); } else { $view->paper_authors = "[anonymized]"; } $view->paper_email_contact = $paper->emailContact; $view->paper_rank = $iPaper; $view->paper_overall = $overall; $view->form_status = Zmax_View_Phplib::checkboxField("radio", "status[{$paper->id}]", $statusList, $paper->status, array("length" => 2)); // Now, loop on reviews $qRev = "SELECT * FROM Review r, User u " . " WHERE idPaper='{$paper->id}' AND u.id=r.id_user"; $resRev = $db->query($qRev); $countReviews = 0; $mail_reviewers = $comma = ""; while ($review = $resRev->fetch(Zend_Db::FETCH_OBJ)) { $countReviews++; $mail_reviewers .= $comma . $review->email; $comma = ", "; } $view->paper_nb_reviewers = Max(1, $countReviews); //echo "Mail reviewers = $mail_reviewers<br/>"; $view->paper_email_reviewers = $mail_reviewers; $view->append("PAPER_DATA", "PAPER_INFO"); $resRev = $db->query($qRev); $iReview = 0; while ($review = $resRev->fetch(Zend_Db::FETCH_OBJ)) { $iReview++; $view->reviewer_id = $review->id; if ($anonymized == false) { $view->reviewer_fname = $review->first_name; $view->reviewer_lname = $review->last_name; $view->external_reviewer_fname = $review->fname_ext_reviewer; $view->external_reviewer_lname = $review->lname_ext_reviewer; $view->review_comments = $review->comments; } else { $view->reviewer_fname = $iReview; $view->reviewer_lname = ""; $view->external_reviewer_fname = ""; $view->external_reviewer_lname = ""; $view->review_comments = ""; } $view->reviewer_email = $review->email; $view->review_overall = $review->overall; $view->review_summary = $review->summary; $view->review_details = $review->details; if ($review->reviewerExpertise >= 1 and $review->reviewerExpertise <= 3) { $view->reviewer_expertise = Config::$Expertise[$review->reviewerExpertise]; } // Avoid to introduce Latex commands in Latex files .... if (!$html) { $view->review_summary = str_replace("\\", "", $view->review_summary); $view->review_details = str_replace("\\", "", $view->review_details); $view->review_comments = str_replace("\\", "", $view->review_comments); } $view->assign("REVIEWER_INFO", "REVIEWER"); reset($listCriterias); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $criteria) { $reviewMark = $reviewMarkTbl->find($review->idPaper, $review->id_user, $criteria->id)->current(); if (!is_object($reviewMark)) { $reviewMark = $reviewMarkTbl->createRow(); // for default values } $reviewMark->putInView($view); $view->criteria_label = $criteria->label; $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->append("PAPERS", "PAPER_DETAIL"); // The paper data is shown only once for all the reviews $view->set_var("PAPER_DATA", " "); } // Show the paper even without reviewer if ($countReviews == 0) { $review = $reviewTbl->createRow(); $review->putInView($view); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $id => $label) { $reviewMark = $reviewMarkTbl->createRow(); $reviewMark->putInView($view); $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->set_var("REVIEWER_INFO", ""); $view->append("PAPERS", "PAPER_DETAIL"); $view->set_var("PAPER_DATA", ""); } // Summary for the paper if ($html) { $statPaper = Paper::getStats($paper->id, $listCriterias); $markFieldName = "ReviewMark" . "->mark"; $overallFieldName = "review_overall"; $view->set_var("NB_REVIEWERS", 1); if ($html) { $view->set_var("PAPER_DATA", "<td> </td><th>Summary</th>"); } $view->set_var("REVIEWER_INFO", " "); $view->set_var($overallFieldName, $paper->overall); reset($listCriterias); $view->set_var("REVIEW_MARKS", ""); foreach ($listCriterias as $c) { $view->setVar($markFieldName, $statPaper[$c->id]); $view->append("REVIEW_MARKS", "REVIEW_MARK"); } $view->append("PAPERS", "PAPER_DETAIL"); $view->set_var("PAPER_DATA", ""); } } }
function assignAction() { $this->view->setFile("content", "assign.xml"); $this->view->initial_message = ""; // Sort either by topic or by status if (isset($_REQUEST['sort_topic'])) { $sortOption = "topic"; } else { $sortOption = "status"; } // Check whether papers are assigned to sessions if (isset($_REQUEST['form_assign_session'])) { foreach ($_REQUEST['conf_session'] as $id_paper => $id_session) { if (!empty($id_session)) { if (isset($_REQUEST['position_in_session'][$id_paper])) { $pos_in_session = trim($_REQUEST['position_in_session'][$id_paper]); } else { $pos_in_session = ""; } if (!empty($pos_in_session)) { $this->zmax_context->db->query("UPDATE Paper SET id_conf_session='{$id_session}', " . "position_in_session='{$pos_in_session}' " . "WHERE id='{$id_paper}'"); } else { $this->db->query("UPDATE Paper SET id_conf_session='{$id_session}' " . "WHERE id='{$id_paper}'"); } } } } /* First extract the 'blocks' describing a line from the template */ $this->view->set_block("content", "PAPER_DETAIL", "PAPERS"); $conf_sessions = $this->zmax_context->db->fetchPairs("SELECT id, name FROM ConfSession"); $conf_sessions[0] = $this->texts->admin->not_yet_assigned; ksort($conf_sessions); // Get the list of required files in the proceedings phase $listFiles = array(); $requiredFileTbl = new RequiredFile(); $requiredFiles = $requiredFileTbl->fetchAll("id_phase = " . Config::PROCEEDINGS_PHASE); foreach ($requiredFiles as $requiredFile) { $listFiles[$requiredFile->file_code] = $requiredFile->file_extension; } // Directory of the CR files $fileDir = ".." . DIRECTORY_SEPARATOR . $this->zmax_context->config->app->upload_path . DIRECTORY_SEPARATOR . "proceedings" . DIRECTORY_SEPARATOR; // OK. Now execute the query, fetch the papers, display $query = "SELECT p.id, p.title, p.CR as cr, p.emailContact, t.label AS topic, IFNULL(id_conf_session,0) id_conf_session, " . " IFNULL(position_in_session,999) position_in_session, s.label " . " FROM Paper as p, PaperStatus s, ResearchTopic t WHERE p.status=s.id " . " AND cameraReadyRequired ='Y' AND t.id=p.topic " . "ORDER BY id_conf_session DESC, position_in_session ASC, {$sortOption}"; $rPapers = $this->zmax_context->db->query($query); $i = 0; while ($paper = $rPapers->fetch(Zend_Db::FETCH_OBJ)) { $this->view->css_class = Config::CssCLass($i++); $this->view->session_list = Zmax_View_Phplib::selectField("conf_session[{$paper->id}]", $conf_sessions, $paper->id_conf_session); $this->view->paper_id = $paper->id; $this->view->paper_title = $paper->title; $this->view->paper_status = $paper->label; $this->view->paper_topic = $paper->topic; $this->view->paper_position_in_session = $paper->position_in_session; $this->view->paper_authors = PaperRow::getPaperAuthors($this->zmax_context->db, $paper); $this->view->paper_email_contact = $paper->emailContact; $this->view->someUser = Mail::SOME_USER; if (!$this->config->isPhaseOpen(Config::PROCEEDINGS_PHASE)) { $this->view->cr_paper = $this->texts->admin->camera_ready_not_open; } else { // Take the name of the camera ready file foreach ($listFiles as $code => $ext) { $filePath = $fileDir . $code . "_" . $paper->id . "." . $ext; if (file_exists($filePath)) { $this->view->download_link = $this->texts->camera_ready_uploaded; } else { $this->view->download_link = $this->texts->camera_ready_not_uploaded; } } } $this->view->append("PAPERS", "PAPER_DETAIL"); } echo $this->view->render("layout"); }
/** * Create and return the list of abstracts * * The template must be organized with the following block hierarchy * day * session * paper * index * abstract * @return unknown_type */ function exportAbstracts($templateName, $exportType = self::LATEX) { $this->_view->set_file("proceedings", $templateName); $this->_view->setBlock("proceedings", "day", "days"); $this->_view->setBlock("day", "session", "sessions"); $this->_view->setBlock("session", "paper", "papers"); try { $this->_view->setBlock("paper", "index", "indexes"); } catch (Exception $e) { } $this->_view->setBlock("paper", "abstract", "abstracts"); // Get the list of countries $countries = $this->_db->fetchPairs("SELECT code, name FROM Country"); $iPaper = 0; $q_days = "SELECT DISTINCT UNIX_TIMESTAMP(slot_date) AS slot_date FROM Slot s " . " ORDER BY slot_date"; $rDays = $this->_db->query($q_days); while ($day = $rDays->fetch(Zend_Db::FETCH_OBJ)) { $this->_view->slot_date = date("l, F j", $day->slot_date); $this->_view->sessions = ""; $q_sessions = "SELECT c.id, name, chair, comment as sess_comment, room, " . " end as slot_end, begin as slot_begin, UNIX_TIMESTAMP(slot_date) AS timestamp " . " FROM ConfSession c, Slot s " . " WHERE s.id=c.id_slot AND UNIX_TIMESTAMP(slot_date) = '{$day->slot_date}'" . " ORDER BY slot_date, begin, end, c.id"; $rSess = $this->_db->query($q_sessions); while ($session = $rSess->fetch(Zend_Db::FETCH_OBJ)) { $this->_view->conf_session_name = $session->name; $this->_view->conf_slot_name = substr($session->slot_begin, 0, 5) . "-" . substr($session->slot_end, 0, 5); $this->_view->conf_session_comment = $session->sess_comment; $this->_view->conf_session_chair = $session->chair; $this->_view->conf_session_room = $session->room; $this->_view->papers = ""; $q_papers = "SELECT * FROM Paper " . "WHERE id_conf_session='{$session->id}' ORDER BY position_in_session"; $rp = $this->_db->query($q_papers); while ($paper = $rp->fetch(Zend_Db::FETCH_OBJ)) { $iPaper++; $this->_view->indexes = ""; $this->_view->abstracts = ""; $this->_view->paper_title = $paper->title; $this->_view->paper_position = $iPaper; $this->_view->paper_id = $paper->id; $this->_view->paper_authors = PaperRow::getPaperAuthors($this->_db, $paper); $this->_view->authors_affiliations = ""; // Instanciate the entities in PAPER_DETAIL. $queryAuthors = "SELECT u.last_name, u.first_name, u.affiliation, u.country_code from User u, Author a " . " WHERE a.id_paper='{$paper->id}' AND u.id=a.id_user "; $rAuthors = $this->_db->query($queryAuthors); $comma = ""; while ($author = $rAuthors->fetch(Zend_Db::FETCH_OBJ)) { $countryName = $countries[$author->country_code]; $this->_view->author = $author->last_name . ", " . $author->first_name; $this->_view->authors_affiliations .= $comma . $author->affiliation . " ({$countryName})"; $comma = ", "; try { $this->_view->append("indexes", "index"); } catch (Exception $e) { } } $queryAbstracts = "SELECT * from AbstractSection u, Abstract a " . " WHERE a.id_paper='{$paper->id}' AND u.id=a.id_section ORDER BY position "; $rAbstracts = $this->_db->query($queryAbstracts); while ($abstract = $rAbstracts->fetch(Zend_Db::FETCH_OBJ)) { $this->_view->section_name = $this->_texts->author->get($abstract->section_name); $this->_view->abstract_content = $abstract->content; $this->_view->append("abstracts", "abstract"); } $this->_view->append("papers", "paper"); } $this->_view->append("sessions", "session"); } $this->_view->append("days", "day"); } $this->_view->assign("result", "proceedings"); $contents = $this->_view->result; // Get rid of Mac non-printable characters if ($exportType == self::LATEX) { $contents = $this->replaceBadChars($contents); } return $contents; }