Menu

[r32]: / review / download_assigned_zip.php  Maximize  Restore  History

Download this file

156 lines (142 with data), 7.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
/*
* Copyright (C) 2006, 2007 Thomas Baigneres, Matthieu Finiasz
*
* This file is part of iChair.
*
* iChair is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* iChair is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
?><?php
include("../utils/tools.php");
$currentReviewer = Reviewer::getReviewerByLogin();
$reviewerNumber = $currentReviewer->getReviewerNumber();
if (!is_null($currentReviewer)) {
if (Tools::useZipReviews()) {
$zippath = Tools::getConfig('server/zipPath') . "zip";
$tmpdir;
do {
$tmpdir = "/tmp/".rand()."ZZZ".$currentReviewer->getReviewerNumber();
} while (file_exists($tmpdir));
mkdir($tmpdir);
$indexFile = fopen($tmpdir."/index.html", "w");
fwrite($indexFile, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />');
fwrite($indexFile,'<title>'.htmlentities(Tools::getConfig('conference/name'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').' - Your reviews</title>
<link href="zip.css" rel="stylesheet" type="text/css" />
</head>
<body>');
fwrite($indexFile,'<h1>'.htmlentities(Tools::getConfig('conference/name'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').' - Your reviews</h1>');
if(Tools::hasReviewGuidelinesHTML("..") || Tools::hasReviewGuidelinesPDF("..") || Tools::hasReviewGuidelinesTXT("..")) {
fwrite($indexFile, '<center><table><tr>');
if(Tools::hasReviewGuidelinesHTML("..")) {
copy("guidelines/guidelines.html", $tmpdir."/guidelines.html");
fwrite($indexFile, '<td><form action="guidelines.html" target="_blank" method="post"><input type="submit" class="buttonLink bigButton" value="Review Guidelines (HTML)" /></form></td>');
}
if(Tools::hasReviewGuidelinesPDF("..")) {
copy("guidelines/guidelines.pdf", $tmpdir."/guidelines.pdf");
fwrite($indexFile, '<td><form action="guidelines.pdf" target="_blank" method="post"><input type="submit" class="buttonLink bigButton" value="Review Guidelines (PDF)" /></form></td>');
}
if(Tools::hasReviewGuidelinesTXT("..")) {
copy("guidelines/guidelines.txt", $tmpdir."/guidelines.txt");
fwrite($indexFile, '<td><form action="guidelines.txt" target="_blank" method="post"><input type="submit" class="buttonLink bigButton" value="Review Guidelines (TXT)" /></form></td>');
}
fwrite($indexFile, '</tr></table></center>');
}
$articles = Article::getAllArticles();
$articleNumbers = $currentReviewer->getArticlesByStatus(Assignement::$ASSIGNED);
$allcategories;
if (Tools::useCategory()) {
$allcategories = Tools::getAllCategories();
}
foreach($articleNumbers as $articleNumber) {
$article = $articles[$articleNumber];
copy($article->getFolder()."".$article->getFile(), $tmpdir."/".$article->getFile());
$assignement = Assignement::getByNumbers($articleNumber, $reviewerNumber);
$file;
$isATempFile = false;
if(file_exists($article->getFolder() . $assignement->getXMLFileName())) {
$file = $article->getFolder() . $assignement->getXMLFileName();
} else {
$reviewDocument = Tools::createXMLReview(false,
$article->getArticleNumber(),
$article->getTitle(), $article->getAuthors(),
$currentReviewer->getFullName(), "",
"", "", "", "", "", "",
"", "", "");
$reviewDocument->formatOutput = true;
$reviewDocument->encoding = "iso-8859-1";
$file = tmpfile();
$isATempFile = true;
$reviewDocument->save("" . $file);
}
copy("" . $file, $tmpdir.sprintf("/review%04d.xml", $article->getArticleNumber()));
if ($isATempFile) {
unlink("" . $file);
}
fwrite($indexFile,'
<div class="paperBox">
<div class="paperBoxTitle">
<div class="paperBoxNumber">Article&nbsp;' . $articleNumber . '</div>');
$count=2;
if(Tools::useCategory()) {
fwrite($indexFile,'Category: ' . htmlentities($allcategories[$article->getCategory()], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1') . '<br/>');
$count--;
}
if(Tools::useKeywords()) {
fwrite($indexFile,'Keywords: ' . htmlentities($article->getKeywords(), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1') . '<br/>');
$count--;
}
for (;$count>0; $count--){
fwrite($indexFile,'&nbsp;<br/>');
}
if (!Tools::authorsAreAnonymous() && Tools::useCountry()) {
fwrite($indexFile,'
</div>
<div class="paperBoxDetails">' . Tools::printContinentDivs($article->getCountryArray(), False) . $article->printCustomCheckboxes(false, false) . '<div class="versionTitle">Title: '. htmlentities($article->getTitle(), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1') .'</div>');
} else {
fwrite($indexFile,'
</div>
<div class="paperBoxDetails">
<div><div><div>'. $article->printCustomCheckboxes(false, false) . '<div class="versionTitle">Title: '. htmlentities($article->getTitle(), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1') .'</div>');
}
if(!Tools::authorsAreAnonymous()) {
fwrite($indexFile,'<div class="versionAuthors">Authors: '.htmlentities($article->getAuthors(), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'</div>');
if(Tools::useAffiliations()) {
fwrite($indexFile, 'Affiliations: ' . htmlentities($article->getAffiliations(), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'<br/>');
}
if(Tools::useCountry()) {
fwrite($indexFile, 'Countries: ' . htmlentities($article->getCountry(), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1').'<br/>');
}
}
if(Tools::useAbstract()) {
fwrite($indexFile,'Abstract:<div class="versionAbstract">'.nl2br(htmlentities($article->getAbstract(), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1')).'</div>');
}
fwrite($indexFile,'</div></div></div></div><div class="floatRight"><form action="'.Tools::getConfig('server/location').'/review/review_article.php" method="post" target="_blank"><input type="hidden" name="articleNumber" value="'.$articleNumber.'"/><input type="submit" class="buttonLink" value="Online Review"/> </form> </div>');
fwrite($indexFile,'<div class="floatRight"><form action="'.$article->getFile().'" method="post"><input type="submit" class="buttonLink" value="Open File"/> </form> </div>');
fwrite($indexFile,'<div class="floatRight"><form action="'.sprintf("review%04d.xml", $article->getArticleNumber()).'" method="post"><input type="submit" class="buttonLink" value="Open XML Review"/> </form> </div>');
fwrite($indexFile,'<div class="clear"></div></div>');
}
fwrite($indexFile, '</body></html>');
fclose($indexFile);
copy("../css/zip_".Tools::getConfig("miscellaneous/reviewSkin").".css",$tmpdir."/zip.css");
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="assigned_' . $currentReviewer->getLogin() . '.zip"');
passthru('cd '.$tmpdir.'; zip -q -r1 - *');
exec("rm -r ".$tmpdir);
}
}
?>