function InstanciatePaperVars($paper, &$tpl, $db, $id_session = "", $html = true) { $config = GetConfig($db); // Instanciate template variables related to a paper $tpl->set_var("PAPER_ID", $paper->id); $tpl->set_var("PAPER_TITLE", String2HTML($paper->title, $html)); $blind_review = false; /* if (empty($id_session)) $id_session = session_id(); $session = GetSession ($id_session, $db); if (is_object($session)) { // If blind review is 'Y', hide the authors names, // except for chairs if ($config["blind_review"] == "Y" and !strstr($session->roles, "C")) $blind_review = true; } */ // $tpl->set_var("PAPER_AUTHORS", String2HTML(GetAuthors($paper->id, $db, $blind_review, // "string", $paper->authors), $html)); $tpl->set_var("PAPER_ABSTRACT", String2HTML($paper->abstract, $html)); $tpl->set_var("PAPER_EMAIL_CONTACT", $paper->emailContact); // $tpl->set_var("PAPER_WEIGHT", $paper->assignmentWeight); $tpl->set_var("PAPER_TOPIC", String2HTML(LibelleCodif("ResearchTopic", $paper->topic, $db), $html)); $tpl->set_var("PAPER_OTHER_TOPICS", GetPaperTopics($paper->id, $db, "string")); $tpl->set_var("PAPER_NB_REVIEWERS", CountReviewers($paper->id, $db)); $tpl->set_var("PAPER_FILE_SIZE", $paper->fileSize); $tpl->set_var("PAPER_ID_CONF_SESSION", $paper->id_conf_session); $tpl->set_var("PAPER_POSITION_IN_SESSION", $paper->position_in_session); }
/** * Create a string with the reviews of a paper */ public function showReviews($idPaper, $template, &$tpl, $db, $emailReviewer = "", $html = false) { global $EXPERTISE; global $SCALE; // Handle NULL values $SCALE[""] = "?"; $EXPERTISE[""] = "?"; $config = GetConfig($db); // Extract the block with marks. Check that it has // not been done before if (!isset($tpl->varkeys["REVIEW_MARK"])) { $tpl->set_block($template, "REVIEW_MARK", "REVIEW_MARKS"); } else { $tpl->set_var("REVIEW_MARKS", ""); } // Extracts the block with questions if (!isset($tpl->varkeys["REVIEW_QUESTION"])) { $tpl->set_block($template, "REVIEW_QUESTION", "REVIEW_QUESTIONS"); } $tpl->set_var("REVIEW_QUESTIONS", ""); // Select one or all reviews, depending on the emailReviewer variable if (empty($emailReviewer)) { $qRev = "SELECT idPaper,email FROM Review " . "WHERE idPaper='{$idPaper}'"; } else { $qRev = "SELECT idPaper, email FROM Review " . "WHERE idPaper='{$idPaper}' " . " and email='{$emailReviewer}'"; } // Initialize the REVIEWS entity to empty string $tpl->set_var("REVIEWS", ""); $listC = GetListCriterias($db); $resRev = $db->execRequete($qRev); $i = 1; while ($rid = $db->ligneSuivante($resRev)) { // Get the review + the marks $email = $rid['email']; $review = GetReview($rid['idPaper'], $email, $db); $reviewer = GetMember($review['email'], $db); $tpl->set_var("REVIEWER_NAME", $reviewer['firstName'] . " " . $reviewer['lastName']); $tpl->set_var("REVIEW_EXT_REV_NAME", $review['fname_ext_reviewer'] . " " . $review['lname_ext_reviewer']); $tpl->set_var("REVIEWER_NO", $i++); $tpl->set_var("REVIEW_OVERALL", $review['overall']); // Show the marks $tpl->set_var("REVIEW_MARKS", ""); $j = 0; foreach ($listC as $id => $crVals) { // Choose the CSS class if ($j++ % 2 == 0) { $tpl->set_var("CSS_CLASS", "even"); } else { $tpl->set_var("CSS_CLASS", "odd"); } $tpl->set_var("CRITERIA", ucfirst($crVals['label'])); $tpl->set_var("MARK", $SCALE[$review[$id]]); $tpl->parse("REVIEW_MARKS", "REVIEW_MARK", true); } $tpl->set_var("REVIEWER_EXPERTISE", $EXPERTISE[$review['reviewerExpertise']]); if ($html) { $tpl->set_var("REVIEW_SUMMARY", String2HTML($review['summary'])); $tpl->set_var("REVIEW_DETAILS", String2HTML($review['details'])); $tpl->set_var("REVIEW_COMMENTS", String2HTML($review['comments'])); } else { $tpl->set_var("REVIEW_SUMMARY", $review['summary']); $tpl->set_var("REVIEW_DETAILS", $review['details']); $tpl->set_var("REVIEW_COMMENTS", $review['comments']); } // Put the questions $q_questions = "SELECT * FROM ReviewQuestion q, RQChoice c, " . " ReviewAnswer a " . " WHERE q.id=c.id_question AND a.id_answer=c.id_choice " . " AND id_paper={$idPaper} AND email='{$email}' AND public='Y'"; $tpl->set_var("REVIEW_QUESTIONS", ""); $rq = $db->execRequete($q_questions); while ($question = $db->objetSuivant($rq)) { if ($j++ % 2 == 0) { $tpl->set_var("CSS_CLASS", "even"); } else { $tpl->set_var("CSS_CLASS", "odd"); } $tpl->set_var("QUESTION", $question->question); $tpl->set_var("ANSWER", $question->choice); $tpl->parse("REVIEW_QUESTIONS", "REVIEW_QUESTION", true); } $tpl->parse("REVIEWS", $template, true); } return $tpl->get_var("REVIEWS"); }