File'; // table header used for file column $formatField = '`format`'; // paper table format field beginChairSession(); oc_addJS('chair/list_papers.js'); // Retrieve submission types - do it here as used for filtering validation below $subTypeAR = array(); $r = ocsql_query("SELECT DISTINCT `type` FROM `" . OCC_TABLE_PAPER . "` WHERE `type` IS NOT NULL AND `type`!='' ORDER BY `type`") or err('Unable to retrieve submission types', 'Submissions', 1); while ($l = ocsql_fetch_assoc($r)) { $subTypeAR[$l['type']] = substr($l['type'], 0, 50); } // Filter? $atype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] : ''); // accepteance type $stype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] : ''); // submission type if (isset($_POST['fsubmit']) && ($_POST['fsubmit'] == 'Filter')) { if (!isset($_POST['atype']) || empty($_POST['atype'])) { $atype = ''; } elseif (($_POST['atype'] == 'Pending') || isset($OC_acceptanceColorAR[$_POST['atype']])) { $atype = $_POST['atype']; } $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] = $atype; if (!isset($_POST['stype']) || empty($_POST['stype']) || !isset($subTypeAR[$_POST['stype']])) { $stype = ''; } else { $stype = $_POST['stype']; } $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] = $stype; session_write_close(); } printHeader("Submissions",1); $verbAR = array( 'Delete Submissions' => 'deleted', 'Delete Withdrawn Submissions' => 'deleted', 'Withdraw Submissions' => 'withdrawn', 'Restore Submissions' => 'restored' ); if (isset($_POST['subaction']) && isset($verbAR[$_POST['subaction']])) { // Check for valid submission if (!validToken('chair')) { warn('Invalid submission'); } if (preg_match("/^(Delete|Withdraw) Submissions$/", $_POST['subaction']) && isset($_POST['papers']) && !empty($_POST['papers'])) { foreach ($_POST['papers'] as $paperid) { if (preg_match("/^\d+$/",$paperid)) { // withdraw? $log = true; if ($_POST['subaction'] == 'Withdraw Submissions') { print "

withdrawing id $paperid ... "; if (! withdrawPaper($paperid, OCC_WORD_CHAIR)) { print 'SUBMISSION NOT FOUND'; } print "

\n"; $log = false; } else { print "

deleting id $paperid ...

\n"; } // delete paper deletePaper($paperid, $log); } else { print "Unable to process submission id " . safeHTMLstr($paperid) . ".

\n"; } } if (($miv = ini_get('max_input_vars')) && (count($_POST['papers']) > ($miv - 10))) { print '

The number of submissions selected may have been greater than supported by this server. Additional passes may be required.

'; } } elseif (preg_match("/^(Restore|Delete Withdrawn) Submissions$/", $_POST['subaction']) && isset($_POST['wpapers']) && !empty($_POST['wpapers'])) { foreach ($_POST['wpapers'] as $paperid) { if (preg_match("/^\d+$/",$paperid)) { if ($_POST['subaction'] == 'Restore Submissions') { // restore? print "

restoring id $paperid ... "; $ret = restorePaper($paperid); if ($ret != $paperid) { if ($ret === null) { print 'SUBMISSION NOT FOUND'; } else { print 'Duplicate ID -- New ID Assigned: ' . safeHTMLstr($ret) . ''; } } print "

\n"; } elseif ($_POST['subaction'] == 'Delete Withdrawn Submissions') { // delete withdrawn? print "

deleting withdrawn id $paperid ... "; if ( ! ocsql_query("DELETE FROM `" . OCC_TABLE_WITHDRAWN . "` WHERE `paperid`='" . safeSQLstr($paperid) . "' LIMIT 1") ) { print 'DELETION FAILED'; } print "

\n"; } } else { print "Unable to process submission id " . safeHTMLstr($paperid) . ".

\n"; } } if (($miv = ini_get('max_input_vars')) && (count($_POST['wpapers']) > ($miv - 10))) { print '

The number of submissions selected may have been greater than supported by this server. Additional passes may be required.

'; } } print '

Return to Submission Listings

'; printFooter(); exit; } // Headers & Sorting $rsortstr = 'ID'; $tsortstr = 'Title'; $nsortstr = 'Contact ' . OCC_WORD_AUTHOR . ''; $ssortstr = 'Stud.'; $stsortstr = 'Type'; if (!isset($_GET['s'])) { $_GET['s'] = 'id'; } switch ($_GET['s']) { case 'id': $sortby = "`paperid`"; $rsortstr = 'ID
' . $OC_sortImg; break; case 'title': $sortby = "`title`"; $tsortstr = 'Title
' . $OC_sortImg; break; case 'student': $sortby = "`student`, `paperid`"; $ssortstr = 'Stud.
' . $OC_sortImg; break; case 'type': $sortby = "`type`, `paperid`"; $stsortstr = 'Type
' . $OC_sortImg; break; case 'name': default: $sortby = "`name_last`, `name_first`"; $nsortstr = 'Contact ' . OCC_WORD_AUTHOR . '
' . $OC_sortImg; $_GET['s'] = 'id'; break; } // Display Filter $aAR = array_keys($OC_acceptanceColorAR); $aAR[] = 'Pending'; print '
 '; if (count($subTypeAR) > 0) { print '  '; } print '
'; // Students? $OC_trackStudent = false; $sr = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "` WHERE `student`='T'") or err('Unable to check student field'); if (($sl = ocsql_fetch_assoc($sr)) && ($sl['count'] > 0)) { $OC_trackStudent = true; } // Type? $OC_trackType = false; $sr = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "` WHERE `type`!='' AND `type` IS NOT NULL") or err('Unable to check type field'); if (($sl = ocsql_fetch_assoc($sr)) && ($sl['count'] > 0)) { $OC_trackType = true; } // Extra fields init for hook $extraFields = ''; // Hook if (oc_hookSet('chair-list_papers-preprocess')) { foreach ($OC_hooksAR['chair-list_papers-preprocess'] as $v) { require_once $v; } } // Iterate through subs $q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, CONCAT_WS(' ', `name_first`, `name_last`) AS `name`, `" . OCC_TABLE_PAPER . "`.`accepted`, `" . OCC_TABLE_PAPER . "`.`title`, " . $formatField . ", `" . OCC_TABLE_PAPER . "`.`student`, `" . OCC_TABLE_PAPER . "`.`type`" . $extraFields . " FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_AUTHOR . "` ON (`" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid`) WHERE 1=1 "; switch($atype) { case '': break; case 'Pending': $q .= "AND (`accepted`='' OR `accepted` IS NULL) "; break; default: $q .= "AND `accepted`='" . safeSQLstr($atype) . "' "; break; } switch($stype) { case '': break; default: $q .= "AND `type`='" . safeSQLstr($stype) . "' "; break; } $q .= "ORDER BY $sortby"; $r = ocsql_query($q) or err("Unable to get submissions"); if (ocsql_num_rows($r) == 0) { print '

No submissions available.

'; } else { print '

Number of Submissions: ' . ocsql_num_rows($r) . '

'; if ($OC_trackStudent) { print ''; } if ($OC_trackType) { print ''; } print $fileTableHeader . ' '; $row = 1; $missingFileAR = array(); // global var hack bec. call_user_func does not allow pass by reference for non-object $OC_downloadZipAR = array(); while ($l = ocsql_fetch_array($r)) { print ''; if ($OC_trackStudent) { print ''; } if ($OC_trackType) { print ''; } print oc_printFileCells($l, true) . "\n"; $accCountAR[(empty($l['accepted']) ? 'Pending' : $l['accepted'])][] = $l['paperid']; if ($row==1) { $row=2; } else { $row=1; } } $skipCells = 4 + ($OC_trackStudent ? 1 : 0) + ($OC_trackType ? 1 : 0); print ''; if (class_exists('ZipArchive')) { if (oc_hookSet('print_file_cells_zip')) { $str = call_user_func($GLOBALS['OC_hooksAR']['print_file_cells_zip'][0], $row, 0, 0, false); // only one hook allowed here print $str; } elseif (isset($OC_downloadZipAR[1]) && ($OC_downloadZipAR[1] > 1)) { print ''; } } print '
' . $rsortstr . '' . $tsortstr . '' . $nsortstr . '' . $ssortstr . '' . $stsortstr . '
' . $l['paperid'] . '' . safeHTMLstr($l['title']) . '' . safeHTMLstr($l['name']) . ''. (($l['student'] == 'T') ? '' : ' ') . '' . varValue('type', $l, ' ', true) . '
 
' . oc_('Download All') . '
ZIP

Note: When deleting a submission, all records associated with the submission are permanently removed. When withdrawing a submission, all reviews and assignments, uploaded files, etc, are permanently removed; the submission and ' . oc_strtolower(OCC_WORD_AUTHOR) . ' table data however may be restored if submission-related modules have not been uninstalled.

'; } $q = "SELECT `paperid`, `title`, `contact_author`, `contact_email`, `withdraw_date`, `withdrawn_by` FROM `" . OCC_TABLE_WITHDRAWN . "` ORDER BY `paperid`"; $r = ocsql_query($q) or err('Unable to check for withdrawn submissions'); if ((ocsql_num_rows($r) > 0) && empty($atype) && empty($stype)) { print '


Withdrawn Submissions

'; $row = 1; while ($l = ocsql_fetch_assoc($r)) { print ''; if ($row==1) { $row=2; } else { $row=1; } } print '
IDTitleContact ' . OCC_WORD_AUTHOR . 'Withdrawn By / On
' . $l['paperid'] . '' . safeHTMLstr($l['title']) . '' . safeHTMLstr($l['contact_author']) . '' . safeHTMLstr($l['withdrawn_by']) . ' / ' . safeHTMLstr($l['withdraw_date']) . '
 

Note: Restoring a withdrawn submission will not restore all the submission data, only the information stored in the submission (paper) and ' . oc_strtolower(OCC_WORD_AUTHOR) . 's (author) table.

'; } printFooter(); ?>