try again. If the problem persists, please contact the Chair.'), ($_SERVER['PHP_SELF'] . '?pid=' . (is_numeric($_POST['pid']) ? $_POST['pid'] : ''))) . '
';
$OC_reviewQuestionsARkeys = array_keys($OC_reviewQuestionsAR);
foreach ($_POST as $k => $v) {
if (($k == 'submit') || ($k == 'token')) { continue; }
if (in_array($k, $OC_reviewQuestionsARkeys)) {
$w .= "
\n
\n" . safeHTMLstr($OC_reviewQuestionsAR[$k]['short']) . " ";
if ($OC_reviewQuestionsAR[$k]['usekey']) {
$w .= $OC_reviewQuestionsAR[$k]['values'][$v];
} else {
$w .= safeHTMLstr($v);
}
} else {
$w .= "
\n
\n" . safeHTMLstr($k) . ": " . safeHTMLstr($v);
}
}
$w .= '
';
warn($w);
}
// Email review copy - do it here in case of errors/problems below
if (isset($_POST['emailcopy']) && ($_POST['emailcopy'] == "1")) {
// ocIgnore included so poEdit picks up (DB) template translation
//T: [:sid:] is the numeric submission ID
$ocIgnoreSubject = oc_('Review of submission [:sid:]');
//T: [:OC_confName:] is the event name; [:sid:] is the numeric submission ID
$ocIgnoreBody = oc_('Following is a copy of your review for submission number [:sid:] submitted to [:OC_confName:]. Note that you will receive this email even if an error occurred during submission.
[:fields:]');
list($mailsubject, $msg) = oc_getTemplate('committee-review');
$fields = oc_genFieldMessage($GLOBALS['OC_reviewQuestionsFieldsetAR'], $GLOBALS['OC_reviewQuestionsAR'], $_POST);
$templateExtraAR = array(
'sid' => $thepid,
'fields' => $fields
);
$mailsubject = oc_replaceVariables($mailsubject, $templateExtraAR);
$msg = oc_replaceVariables($msg, $templateExtraAR);
if (oc_hookSet('committee-review-msg')) {
foreach ($GLOBALS['OC_hooksAR']['committee-review-msg'] as $v) {
require_once $v;
}
}
if (!sendEmail($review['email'], $mailsubject, $msg)) {
print '' . oc_('We were unable to send copy of the review via email') . '
';
}
}
// Validate fields
$qfields = array();
$err = '';
foreach ($GLOBALS['OC_reviewQuestionsFieldsetAR'] as $fsid => $fs) {
foreach ($fs['fields'] as $fid) {
if (isset($GLOBALS['OC_reviewQuestionsAR'][$fid])) {
oc_validateField($fid, $GLOBALS['OC_reviewQuestionsAR'], $qfields, $err);
}
}
}
// Check for completion and calculate score
$score = null;
if (isset($_POST['completed']) && ($_POST['completed'] == 1)) {
$completed = 'T';
} else {
$completed = 'F';
}
foreach ($OC_reviewQuestionsAR as $fid => $far) {
if (isset($far['score']) && $far['score'] && isset($_POST[$fid]) && preg_match("/^\d+$/", $_POST[$fid])) {
if (
$useFieldValueForScore
&& isset($far['values'])
&& isset($far['values'][$_POST[$fid]])
&& preg_match("/^[0-9]+$/", $far['values'][$_POST[$fid]])
) {
$scoreValue = $far['values'][$_POST[$fid]];
} else {
$scoreValue = $_POST[$fid];
}
if ($score === null) {
$score = $scoreValue;
} else {
$score += $scoreValue;
}
}
if (($completed == 'T') && isset($far['required']) && $far['required'] && !isset($qfields[$fid])) {
$completed = 'F';
}
}
// Hooks
if (oc_hookSet('committee-review-validate')) {
foreach ($GLOBALS['OC_hooksAR']['committee-review-validate'] as $v) {
require_once $v;
}
}
// Error?
if (!empty($err)) {
print '' . oc_('Your review has not been saved.') . ' ' . oc_('Please check the following:') . '
';
printReviewForm($_POST, $thepid);
return;
}
// Update sessions
$sfields = array();
if (isset($qfields['sessions'])) {
if ($qfields['sessions'] != 'NULL') {
if (!preg_match("/^'[\d\,]*'$/", $qfields['sessions'])) {
$err .= '' . sprintf(oc_('%s field does not appear to be valid'), oc_('Session(s)')) . ''; // should only trigger if validation above fails
} else {
$sfields = explode(',', trim($qfields['sessions'], "'"));
}
}
unset($qfields['sessions']);
}
// Compose sql and update
$q = "UPDATE `" . OCC_TABLE_PAPERREVIEWER . "` SET `updated`='" . safeSQLstr(date('Y-m-d')) . "', ";
if ($score !== null) {
$q .= "`score`=" . (int) $score . ", ";
}
foreach ($qfields as $qid => $qval) {
$q .= "`" . $qid . "`=" . $qval . ", ";
}
$q .= "`completed`='" . safeSQLstr($completed) . "' WHERE `paperid`='" . safeSQLstr($thepid) . "' AND `reviewerid`='" . safeSQLstr(safeSQLstr($_SESSION[OCC_SESSION_VAR_NAME]['acreviewerid'])) . "'";
ocsql_query($q) or err("Unable to submit review");
// Update papersession
if (isset($OC_reviewQuestionsAR['sessions'])) {
$q2 = "DELETE FROM `" . OCC_TABLE_PAPERSESSION . "` WHERE `paperid`='" . safeSQLstr($thepid) . "' AND `reviewerid`='" . safeSQLstr($_SESSION[OCC_SESSION_VAR_NAME]['acreviewerid']) . "'";
ocsql_query($q2) or err("Unable to update sessions");
if (!empty($sfields) && ($sfields != 'NULL')) {
$q3 = "INSERT INTO `" . OCC_TABLE_PAPERSESSION . "` (`paperid`,`reviewerid`,`topicid`) VALUES";
foreach ($sfields as $s) {
$q3 .= " ('" . safeSQLstr($thepid) . "','" . safeSQLstr($_SESSION[OCC_SESSION_VAR_NAME]['acreviewerid']) . "','" . safeSQLstr($s) . "'),";
}
ocsql_query(rtrim($q3, ',')) or err(oc_('Unable to add sessions'));
}
}
if (oc_hookSet('committee-review-save')) {
foreach ($GLOBALS['OC_hooksAR']['committee-review-save'] as $v) {
require_once $v;
}
}
print '' . oc_('Review has been submitted.') . '
';
if (isset($_POST['completed']) && ($_POST['completed'] == 1) && ($completed == 'F')) {
print '' . oc_('However as not all required questions were answered, the review was not marked as completed.') . '
';
}
print '» ' . oc_('Return to Review') . '
';
//T: Member = Committee Member -- see "Member Home" string
print '» ' . oc_('Return to Member home page') . '
';
}// function saveReviewForm
function printReviewForm($review, $thepid) {
global $OC_configAR, $OC_reviewQuestionsAR;
print '' . safeHTMLstr($review['title']) . '';
if (isset($review['type']) && !empty($review['type'])) {
print '
(' . safeHTMLstr($review['type']) . ')';
}
print '
' . oc_('Submission ID') . ': ' . safeHTMLstr($thepid);
if (isset($OC_configAR['OC_reviewerSeeAdvocate']) && $OC_configAR['OC_reviewerSeeAdvocate'] && isset($review['advocate_name']) && !empty($review['advocate_name'])) {
print '
' . oc_('Advocate') . ': ' . safeHTMLstr($review['advocate_name']) . '';
}
print '
';
$tip = '
' . oc_("TIP: Use a local text editor to write your review, and then select/copy the information below. This way, in case of a network outage, you won't lose the review.") . '
';
print '