Implement additional materials download for fairs user

This commit is contained in:
dave 2010-01-28 19:05:35 +00:00
parent 7a2f4c0d3a
commit a55dd4b9be

View File

@ -25,6 +25,8 @@
require_once('../common.inc.php');
require_once('../user.inc.php');
require_once('../projects.inc.php');
require_once('../fair_additional_materials.inc.php');
$auth_type = user_auth_required(array('fair','committee'), 'admin');
$award_awards_id = intval($_GET['award_awards_id']);
@ -117,6 +119,7 @@ case 'award_load':
award_awards.criteria,
award_awards.order AS awards_order,
award_awards.per_fair,
award_awards.external_additional_materials,
award_types.type
FROM
award_awards ,
@ -151,6 +154,7 @@ case 'edit_load':
award_awards.criteria,
award_awards.order AS awards_order,
award_awards.per_fair,
award_awards.external_additional_materials,
award_types.type
FROM
award_awards ,
@ -192,6 +196,24 @@ case 'edit_load':
/* Print the award with editor */
print_award($r, $fairs_id, true, $editor_data);
exit;
case 'additional_materials':
$fairs_id = intval($_GET['fairs_id']);
$q = mysql_query("SELECT award_source_fairs_id,external_identifier FROM award_awards WHERE id='$award_awards_id'");
if($fairs_id == 0) {
echo "Unsupported Action: Can't get additional materials for fairs_id=0";
exit;
}
$a = mysql_fetch_assoc($q);
$q = mysql_query("SELECT * FROM fairs WHERE id='$fairs_id'");
$fair = mysql_fetch_assoc($q);
$pdf = fair_additional_materials($fair, $a, $config['FAIRYEAR']);
foreach($pdf['header'] as $h) header($h);
// echo base64_decode($pdf['data64']);
base64_decode($pdf['data64']);
exit;
}
@ -323,7 +345,6 @@ function set_eli(prize_id)
}
$(document).ready(function() {
$("#winner_editor").dialog({
@ -369,6 +390,7 @@ $q=mysql_query("SELECT
award_awards.name,
award_awards.order AS awards_order,
award_awards.per_fair,
award_awards.external_additional_materials,
award_types.type,
sponsors.organization
FROM
@ -462,6 +484,14 @@ function print_award(&$r, $fairs_id, $editor=false, $editor_data=array())
`order`");
echo mysql_error();
if($r['external_additional_materials'] == 1 && $editor==false) {
echo "<div align=\"right\">";
echo "<a href=\"{$_SERVER['PHP_SELF']}?action=additional_materials&award_awards_id={$r['id']}&fairs_id={$fairs_id}\" target=\"_blank\">";
echo "<button>".i18n('Download Additional Materials').'</button></a><br/>';
echo "</div>";
}
while($pr=mysql_fetch_object($q)) {
if($editor == true) {