Show a disabled button for awards with additional materials that have no

winners.
This commit is contained in:
dave 2010-02-10 05:36:15 +00:00
parent d38c57de79
commit 33a9ee5401

View File

@ -202,9 +202,9 @@ case 'edit_load':
case 'additional_materials': case 'additional_materials':
$fairs_id = intval($_GET['fairs_id']); $fairs_id = intval($_GET['fairs_id']);
$q = mysql_query("SELECT award_source_fairs_id,external_identifier FROM award_awards WHERE id='$award_awards_id'"); $q = mysql_query("SELECT * FROM award_awards WHERE id='$award_awards_id'");
if($fairs_id == 0) { if($fairs_id == 0) {
echo "Unsupported Action: Can't get additional materials for fairs_id=0"; echo "Unsupported Action: Can't get additional materials for fairs_id=0. Edit the project and set it's fair to anything except 'Local/Unspecified'.";
exit; exit;
} }
$a = mysql_fetch_assoc($q); $a = mysql_fetch_assoc($q);
@ -486,15 +486,9 @@ function print_award(&$r, $fairs_id, $editor=false, $editor_data=array())
ORDER BY ORDER BY
`order`"); `order`");
echo mysql_error(); echo mysql_error();
if($r['external_additional_materials'] == 1 && $editor==false && $r['award_source_fairs_id'] == NULL) { echo "<table width=\"100%\"><tr><td>";
echo "<div align=\"right\">"; $has_winners = false;
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)) { while($pr=mysql_fetch_object($q)) {
if($editor == true) { if($editor == true) {
@ -552,6 +546,7 @@ function print_award(&$r, $fairs_id, $editor=false, $editor_data=array())
} }
$winners[] = $w['projects_id']; $winners[] = $w['projects_id'];
} }
$has_winners = true;
echo "({$w['projectnumber']}) {$w['title']}"; echo "({$w['projectnumber']}) {$w['title']}";
echo "<br />"; echo "<br />";
} else { } else {
@ -612,6 +607,19 @@ function print_award(&$r, $fairs_id, $editor=false, $editor_data=array())
<? <?
} }
} }
echo "</td><td align=\"right\">";
if($r['external_additional_materials'] == 1 && $editor==false && $r['award_source_fairs_id'] == NULL) {
$d = 'disabled="disabled"';
$a = '';
if($has_winners == true) {
echo "<a href=\"{$_SERVER['PHP_SELF']}?action=additional_materials&award_awards_id={$r['id']}&fairs_id={$fairs_id}\" target=\"_blank\">";
$d = '';
$a = '</a>';
}
echo "<button $d title=\"".i18n("Download additional material (currently only a nomination form)")."\">".i18n('Download Additional Materials')."</button>$a<br/>";
}
echo "</td></tr></table>";
} }
send_footer(); send_footer();