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' => 'deleted', 'Withdraw' => 'withdrawn', 'Restore' => 'restored' ); if (isset($_POST['subaction']) && preg_match("/^(Delete|Withdraw|Restore) Submissions$/", $_POST['subaction'], $matches) && !empty($_POST['papers'])) { $action = $matches[1]; // Check for valid submission if (!validToken('chair')) { warn('Invalid submission'); } foreach ($_POST['papers'] as $paperid) { if (preg_match("/^\d+$/",$paperid)) { // restore paper? if ($action == 'Restore') { print "restoring id $paperid ...

\n"; restorePaper($paperid); } else { // withdraw paper? $log = true; if ($action == 'Withdraw') { print "withdrawing id $paperid ...

\n"; if (! withdrawPaper($paperid, OCC_WORD_CHAIR)) { print "     SUBMISSION NOT FOUND

\n"; } $log = false; } else { print "deleting id $paperid ...

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

\n"; } } print ' Submission(s) have been ' . $verbAR[$action] . '.

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') ? 'S' : ' ') . '' . 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(); ?>