Please go back and select at least one submission and one advocate

'; } else { // Get conflicts? if ($OC_configAR['OC_allowConflictOverride'] && isset($_POST['conflict_override']) && ($_POST['conflict_override'] == 1)) { $conflictAR = array(); } else { $conflictAR = getConflicts(); } // Assign advocates (and reviewers?) // NOTE: Although a foreach is used below for future expansion, there should only be 1 advocate $advocateAssignmentAR = array(); // keep track of advocates w/successful assignments foreach ($_POST['advocates'] as $i) { if (!is_numeric($i)) { err('Invalid advocate ID: ' . safeHTMLstr($i)); } $count = 0; // keep track of # of successful assignments foreach ($_POST['papers'] as $j) { if (!is_numeric($j)) { err('Invalid submission ID: ' . safeHTMLstr($j)); } // Check for conflict if (in_array("$j-$i",$conflictAR)) { print "

! Submission $j is in conflict with advocate $i.

\n"; continue; } // Delete current assignment? if (isset($_POST['assignment_override']) && ($_POST['assignment_override'] == 1)) { issueSQL("DELETE FROM " . OCC_TABLE_PAPERADVOCATE . " WHERE paperid=" . $j); } // Make assignment $q = "INSERT INTO " . OCC_TABLE_PAPERADVOCATE . " (paperid,advocateid) VALUES ($j,$i)"; ocsql_query($q); if (($merr = mysql_errno()) != 0) { if ($merr == 1062) { // Duplicate entry print "! Submission $j already has an advocate assigned. Please delete the existing advocate first before assigning a new one, or select Override Current Assingment.

\n"; } else { print "!! Error assigning submission $j to advocate $i (" . mysql_error() . ")

\n"; } } else { print "

Submission $j assigned to advocate $i.\n"; $count++; // Also assign a reviewer? if (isset($_POST['asrev']) && ($_POST['asrev'] == "yes")) { $q = "INSERT INTO " . OCC_TABLE_PAPERREVIEWER . " (paperid,reviewerid) VALUES ($j,$i)"; ocsql_query($q); if (($merr = mysql_errno()) != 0) { if ($merr == 1062) { // Duplicate entry print "

! Submission $j has already been assigned reviewer $i.

\n"; } else { print "!! Error assigning submission $j to reviewer $i (" . mysql_error() . ")

\n"; } } } } } if ($count > 0) { $advocateAssignmentAR[] = $i; } } // Notify? if (isset($_POST['notify']) && ($_POST['notify'] == 1) && !empty($advocateAssignmentAR)) { $q = "SELECT reviewerid, CONCAT_WS(' ',name_first,name_last) AS name, email FROM " . OCC_TABLE_REVIEWER . " WHERE reviewerid IN (" . implode(',',$advocateAssignmentAR) . ")"; $r = ocsql_query($q) or err('Unable not get advocate email address(es) for notification ' . mysql_errno()); $msg = sprintf(oc_('New assignments have been made for you to advocate in the %s OpenConf system.'), $OC_configAR['OC_confNameFull']) . "\n\n" . oc_('Thank you.') . "\n"; while ($l = mysql_fetch_array($r)) { if (sendEmail($l['email'], oc_('New Advocate Assignment(s)'), $msg)) { print '

Notification sent to ' . $l['name'] . ' (' . $l['reviewerid'] . ')

'; } else { print '

!! Unable to email notification to ' . $l['name'] . ' (' . $l['reviewerid'] . ')

'; } } } } } else { $pq = "SELECT " . OCC_TABLE_PAPER . ".paperid, " . OCC_TABLE_PAPER . ".title, " . OCC_TABLE_PAPERADVOCATE . ".advocateid FROM " . OCC_TABLE_PAPER . " LEFT JOIN " . OCC_TABLE_PAPERADVOCATE . " ON " . OCC_TABLE_PAPER . ".paperid=" . OCC_TABLE_PAPERADVOCATE . ".paperid ORDER BY " . OCC_TABLE_PAPER . ".paperid"; $pr = ocsql_query($pq) or err("Unable to get submissions"); // Get pad size for paper id's - yes, we really need the max id, but this should do:) $psize = oc_strlen((string) mysql_num_rows($pr)); if (mysql_num_rows($pr) == 0) { print 'No submissions have been made yet

'; } else { if (!isset($_GET['s']) || ($_GET['s'] == "id")) { $idsortstr = 'ID'; $nsortstr = 'Name'; $rsortstr = '# Submission'; $legend = "[ Advocate ID - $nsortstr ($rsortstr) ]"; $sortby = OCC_TABLE_REVIEWER . ".reviewerid"; } elseif ($_GET['s'] == "reviews") { $rsortstr = '# Reviews'; $idsortstr = 'ID'; $nsortstr = 'Name'; $legend = "[ # Submissions - Advocate $nsortstr - $idsortstr ]"; $sortby = "acount, " . OCC_TABLE_REVIEWER . ".name_last, " . OCC_TABLE_REVIEWER . ".name_first"; } else { $idsortstr = 'ID'; $nsortstr = 'Name'; $rsortstr = '# Submissions'; $legend = "[ Advocate Name - $idsortstr ($rsortstr) ]"; $sortby = OCC_TABLE_REVIEWER . ".name_last, " . OCC_TABLE_REVIEWER . ".name_first"; } $rq = "SELECT " . OCC_TABLE_REVIEWER . ".reviewerid, CONCAT_WS(' '," . OCC_TABLE_REVIEWER . ".name_first," . OCC_TABLE_REVIEWER . ".name_last) AS name, count(" . OCC_TABLE_PAPERADVOCATE . ".advocateid) AS acount FROM " . OCC_TABLE_REVIEWER . " LEFT JOIN " . OCC_TABLE_PAPERADVOCATE . " ON " . OCC_TABLE_REVIEWER . ".reviewerid=" . OCC_TABLE_PAPERADVOCATE . ".advocateid WHERE " . OCC_TABLE_REVIEWER . ".onprogramcommittee='T' GROUP BY " . OCC_TABLE_REVIEWER . ".reviewerid ORDER BY $sortby"; $rr = ocsql_query($rq) or err("Unable to get program committee members"); // Get pad size for advocate id's - yes, we really need the max id, but this should do:) $rsize = oc_strlen((string) mysql_num_rows($rr)); if (mysql_num_rows($rr) == 0) { print 'No program committee members have signed up yet

'; } else { print '

Select Submission(s):

[ Submission ID - Title (Advocate ID or ***) ]

Select Advocate:   (You may only assign one advocate per submission)

Tip: Click on ID, Name, or Submissions on the line below to re-sort this list (page will reload)

' . $legend . '

Options:

Assign as Reviewer – check box to also assign advocate as reviewer of submission

Override Current Assignment – check box to change advocate if one already assigned

'; if ($OC_configAR['OC_allowConflictOverride']) { print '

Override Conflicts – check box to make assignments even if there is a conflict

'; } print '

Notify Advocate(s) – check box to notify advocate(s) that new assignments have been made

'; } } } printFooter(); ?>