'Weighted Topic Match', 'include' => 'assign_auto_advocates_weighted_topic_match.inc' ), array( 'algorithm' => 'Topic Match', 'include' => 'assign_auto_advocates_topic_match.inc' ), ); // Check for addt'l (hook) algorithms if (oc_hookSet('assign_auto_advocates-algorithm')) { foreach ($OC_hooksAR['assign_auto_advocates-algorithm'] as $k => $v) { $OC_algorithmAR[] = $v; } } // Submit - Commit assignments to database? if (isset($_POST['submit']) && ($_POST['submit'] == "Make Assignments")) { // Check for valid submission if (!validToken('chair')) { warn('Invalid submission'); } if (!isset($_SESSION['OPENCONFCHAIRVARS']['aAssignments'])) { err("No advocates set"); } // Keep or delete current assignments $currAR = array(); if ($_POST['keep'] == 'Yes') { $aq = "SELECT paperid, advocateid FROM " . OCC_TABLE_PAPERADVOCATE; $ar = ocsql_query($aq) or err("Unable to access database"); while ($al = mysql_fetch_array($ar)) { $currAR[] = $al['paperid'] . '-' . $al['advocateid']; } } else { $q = "DELETE FROM " . OCC_TABLE_PAPERADVOCATE; issueSQL($q); } // Add advocates foreach ($_SESSION['OPENCONFCHAIRVARS']['aAssignments'] as $pid => $aid) { if (!$aid || in_array($pid . '-' . $aid, $currAR)) { continue; } $q = "INSERT INTO " . OCC_TABLE_PAPERADVOCATE . " (paperid,advocateid) VALUES ('$pid','$aid')"; issueSQL($q); } // Okey Dokey print '
Assignments have been made
'; unset($_SESSION['OPENCONFCHAIRVARS']['aAssignments']); printFooter(); exit; } // Check whether any reviewers or advocates assigned yet $aq = "SELECT paperid, advocateid FROM " . OCC_TABLE_PAPERADVOCATE; $ar = ocsql_query($aq) or err("Unable to access database"); $patot = mysql_num_rows($ar); $q = "SELECT count(*) as rtot FROM " . OCC_TABLE_PAPERREVIEWER; $r = ocsql_query($q) or err("Unable to access database"); $rl = mysql_fetch_array($r); if (($patot > 0) || ($rl['rtot'] > 0)) { print 'Advocates or Reviewers appear to have already been assigned. Existing advocate assignments will be deleted unless you choose Yes to Keep Existing Assignments below.
'; } // Get number of papers and initialize paper count array $pAR = array(); // paper advocate array $pTitleAR = array(); // paper title array $q = "SELECT paperid, title FROM " . OCC_TABLE_PAPER . " ORDER BY paperid"; $r = ocsql_query($q) or err("Unable to get papers ".mysql_errno()); if (($ptot = mysql_num_rows($r)) == 0) { warn('No submissions have been made yet.'); } while ($l=mysql_fetch_array($r)) { $pAR[$l['paperid']] = ""; $pTitleAR[$l['paperid']] = $l['title']; } // Get number of advocates and initialize advocate count array $aNameAR = array(); // advocate name array $aAR = array(); // advocate papers array $q = "SELECT reviewerid, CONCAT_WS(' '," . OCC_TABLE_REVIEWER . ".name_first," . OCC_TABLE_REVIEWER . ".name_last) AS name FROM " . OCC_TABLE_REVIEWER . " WHERE onprogramcommittee='T' ORDER BY reviewerid"; $r = ocsql_query($q) or err("Unable to get advocates ".mysql_errno()); if (($atot = mysql_num_rows($r)) == 0) { warn('No program committee members have signed up yet.'); } while ($l=mysql_fetch_array($r)) { $aAR[$l['reviewerid']] = array(); $aNameAR[$l['reviewerid']] = $l['name']; } // Get conflicts $nAR = getConflicts(); // Calculate max # of papers each advocate should advocate (pronunciation test) if (isset($_POST['ppa']) && preg_match("/^\d+$/",$_POST['ppa'])) { $papersPerAdvocate = $_POST['ppa']; } else { $papersPerAdvocate = ceil($ptot/$atot); # +count($nAR) to $ptot ? } // Set min # of papers each advocate should be assigned if (isset($_POST['ppat']) && preg_match("/^\d+$/",$_POST['ppat'])) { $ppaThreshold = $_POST['ppat']; } else { $ppaThreshold = floor($papersPerAdvocate/2); } // Keep assignments already made? if (($patot > 0) && isset($_POST['keep']) && ($_POST['keep'] == 'Yes')) { while ($al = mysql_fetch_array($ar)) { $pAR[$al['paperid']] = $al['advocateid']; array_push($aAR[$al['advocateid']],$al['paperid']); } } // Algorithm to use if (isset($_POST['algo']) && ctype_digit($_POST['algo'])) { $algo = $_POST['algo']; } else { $algo = 0; // default to first defined algorithm above } if (isset($OC_algorithmAR[$algo]['include']) && is_file($OC_algorithmAR[$algo]['include'])) { require_once $OC_algorithmAR[$algo]['include']; } else { err("Algorithm choice unknown"); exit; } // Remedy missing advocates by assigning advocates w/lowest #s (if set) if (isset($_POST['remedy']) && in_array("random",$_POST['remedy'])) { foreach (array_keys($pAR) as $k) { if (empty($pAR[$k])) { // Create an ordered array of advocates w/least # of reviews $acountAR = array(); foreach (array_keys($aAR) as $k2) { $acountAR[$k2] = count($aAR[$k2]); } asort($acountAR); reset($acountAR); // Assign advocate while (key($acountAR) && empty($pAR[$k])) { // check for no conflict if (!in_array($k.'-'.key($acountAR),$nAR)) { $pAR[$k] = key($acountAR); array_push($aAR[key($acountAR)],$k); } next($acountAR); } } } } // Remember assignments $_SESSION['OPENCONFCHAIRVARS']['aAssignments'] = $pAR; // Display form print 'Below you will find OpenConf\'s advocate suggestion for each submission. You may fine tune these automated assignments by changing the following options and clicking Re-Evaluate Assignments. Once you are satisfied, click the Make Assignments button to commit them to the database. You can manually add/delete advocates afterwards through the Assign Advocates Manually menu.
Note that an advocate/submission pair is automatically disqualified if an advocate\'s email '; if (! $OC_configAR['OC_allowOrgConflict']) { print 'or organization '; } print 'is the same as one of the submission\'s authors, or the Chair has manually indicated a conflict.
'; function fmtNumSpacing ($n,$dir="l") { $sp = ""; if ($n < 10) { $sp = " "; } elseif ($n < 100) { $sp = " "; } if ($dir=="l") { return($sp.$n); } else { return($n.$sp); } } function fmtStrSpacing ($str,$len) { $a = substr($str,0,$len); for ($i=oc_strlen($a); $i<$len; $i++) { $a .= " "; } return $a; } print '
* Unable to assign advocate Click title for submission info (new window) Submission ID (Title) (Advocate) '; foreach ($pAR as $k => $v) { $tmpStr = fmtNumSpacing($k).' (' . safeHTMLstr(fmtStrSpacing($pTitleAR[$k],20)) . ") ("; if (!empty($v)) { $tmpStr .= safeHTMLstr(fmtStrSpacing($pAR[$k] . "-" . $aNameAR[$pAR[$k]],15)); print $tmpStr.")\n"; } else { $tmpStr .= fmtStrSpacing("",15); print '' . $tmpStr . ") *\n"; } } print ' | * below threshold Click name for reviewer info (new window) Place cursor on No. Submissions for assignments No. Submissions per Advocate ID (Name) '; foreach ($aAR as $k => $v) { $titleStr = "Submissions for Advocate $k - " . $aNameAR[$k] . ":\n\n"; foreach ($v as $vv) { $titleStr .= "$vv - ". safeHTMLstr(substr($pTitleAR[$vv],0,40))."\n"; } $tmpStr = '' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '' . safeHTMLstr($titleStr) . ' (' . safeHTMLstr(fmtStrSpacing($aNameAR[$k],25)).")"; if (count($v) <= $ppaThreshold) { print ''.$tmpStr." *\n"; } else { print $tmpStr . "\n"; } } print " |