forked from science-ation/science-ation
- Make the main award table sortable by dragging
- Implement new/delete award (still needs some eyecandy) - Update the order tables to recalc the order without fetching it from the server - Only thing left to do is make sure saving eligiblity works. :
This commit is contained in:
parent
0f16a90efc
commit
d50debde12
@ -29,48 +29,31 @@
|
||||
switch($_GET['action']) {
|
||||
case 'awardinfo_load':
|
||||
$id = intval($_GET['id']);
|
||||
$q=mysql_query("SELECT award_awards.id,
|
||||
award_awards.name,
|
||||
award_awards.criteria,
|
||||
award_awards.description,
|
||||
award_awards.order,
|
||||
award_awards.presenter,
|
||||
award_awards.excludefromac,
|
||||
award_awards.cwsfaward,
|
||||
award_awards.self_nominate,
|
||||
award_awards.schedule_judges,
|
||||
award_types.id AS award_types_id,
|
||||
award_types.type,
|
||||
sponsors.id AS sponsors_id,
|
||||
sponsors.organization
|
||||
FROM
|
||||
award_awards,
|
||||
award_types,
|
||||
sponsors
|
||||
WHERE
|
||||
award_awards.id='$id'
|
||||
AND award_awards.sponsors_id=sponsors.id
|
||||
AND award_awards.award_types_id=award_types.id
|
||||
");
|
||||
echo mysql_error();
|
||||
$r = mysql_fetch_assoc($q);
|
||||
$ret = array();
|
||||
$ret['id'] = $r['id'];
|
||||
$ret['name'] = $r['name'];
|
||||
$ret['order'] = $r['order'];
|
||||
$ret['criteria'] = $r['criteria'];
|
||||
$ret['description'] = $r['description'];
|
||||
$ret['presenter'] = $r['presenter'];
|
||||
$ret['award_types_id'] = $r['award_types_id'];
|
||||
$ret['sponsors_id'] = $r['sponsors_id'];
|
||||
$ret['excludefromac'] = $r['excludefromac'];
|
||||
$ret['cwsfaward'] = $r['cwsfaward'];
|
||||
$ret['self_nominate'] = $r['self_nominate'];
|
||||
$ret['schedule_judges'] = $r['schedule_judges'];
|
||||
$q=mysql_query("SELECT * FROM award_awards WHERE id='$id'");
|
||||
$ret = mysql_fetch_assoc($q);
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
case 'awardinfo_save':
|
||||
|
||||
|
||||
case 'award_create':
|
||||
$q=mysql_query("INSERT INTO award_awards (year,self_nominate,schedule_judges)
|
||||
VALUES ('{$config['FAIRYEAR']}','yes','yes')");
|
||||
$ret = array('id' => mysql_insert_id() );
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
|
||||
case 'award_delete':
|
||||
$id=intval($_GET['id']);
|
||||
mysql_query("DELETE FROM award_prizes WHERE award_awards_id='$id'");
|
||||
mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'");
|
||||
mysql_query("DELETE FROM award_awards_projectdivisions WHERE award_awards_id='$id'");
|
||||
mysql_query("DELETE FROM award_awards WHERE id='$id'");
|
||||
exit;
|
||||
|
||||
case 'awardinfo_save':
|
||||
/* Scrub the data while we save it */
|
||||
$id=intval($_GET['id']);
|
||||
|
||||
$q = "UPDATE award_awards SET
|
||||
name='".mysql_escape_string(stripslashes($_GET['name']))."',
|
||||
`order`='".intval($_GET['order'])."',
|
||||
@ -84,39 +67,8 @@
|
||||
criteria='".mysql_escape_string(stripslashes($_GET['criteria']))."',
|
||||
description='".mysql_escape_string(stripslashes($_GET['description']))."'
|
||||
WHERE id='$id'";
|
||||
echo $q;
|
||||
echo happy(i18n('Settings Saved'));
|
||||
// mysql_query($q);
|
||||
/*
|
||||
//whipe out any old award-category links
|
||||
mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'");
|
||||
|
||||
//now add the new ones
|
||||
if(is_array($_POST['eligiblecategories']))
|
||||
{
|
||||
foreach($_POST['eligiblecategories'] AS $cat)
|
||||
{
|
||||
mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year) VALUES ('$id','$cat','".$config['FAIRYEAR']."')");
|
||||
}
|
||||
}
|
||||
|
||||
//whipe out any old award-divisions links
|
||||
mysql_query("DELETE FROM award_awards_projectdivisions WHERE award_awards_id='$id'");
|
||||
|
||||
//now add the new ones
|
||||
if(is_array($_POST['eligibledivisions']))
|
||||
{
|
||||
foreach($_POST['eligibledivisions'] AS $div)
|
||||
{
|
||||
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year) VALUES ('$id','$div','".$config['FAIRYEAR']."')");
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['save']=="add")
|
||||
echo happy("Award successfully added");
|
||||
else
|
||||
echo happy("Successfully saved changes to award");
|
||||
*/
|
||||
echo happy(i18n('Award Info Saved'));
|
||||
mysql_query($q);
|
||||
exit;
|
||||
|
||||
case 'eligibilty_load':
|
||||
@ -136,6 +88,34 @@
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
|
||||
case 'eligibility_save':
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
//now add the new ones
|
||||
if(!is_array($_GET['categories']) || !is_array($_GET['divisions'])) {
|
||||
echo error(i18n("Invalid data"));
|
||||
exit;
|
||||
}
|
||||
|
||||
//wipe out any old award-category links
|
||||
mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'");
|
||||
|
||||
foreach($_GET['categories'] AS $cat) {
|
||||
mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year)
|
||||
VALUES ('$id','$cat','{$config['FAIRYEAR']}')");
|
||||
}
|
||||
|
||||
//wipe out any old award-divisions links
|
||||
mysql_query("DELETE FROM award_awards_projectdivisions WHERE award_awards_id='$id'");
|
||||
|
||||
//now add the new ones
|
||||
foreach($_POST['eligibledivisions'] AS $div) {
|
||||
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year)
|
||||
VALUES ('$id','$div','{$config['FAIRYEAR']}')");
|
||||
}
|
||||
echo happy(i18n("Saved."));
|
||||
exit;
|
||||
|
||||
case 'prize_order':
|
||||
$order = 0;
|
||||
foreach ($_GET['prizelist'] as $position=>$id) {
|
||||
@ -143,7 +123,18 @@
|
||||
$order++;
|
||||
mysql_query("UPDATE `award_prizes` SET `order`='$order' WHERE `id`='$id'");
|
||||
}
|
||||
echo happy(i18n("Order Updated."));
|
||||
// print_r($_GET);
|
||||
// echo happy(i18n("Order Updated."));
|
||||
exit;
|
||||
|
||||
case 'award_order':
|
||||
$order = 0;
|
||||
foreach ($_GET['awardlist'] as $position=>$id) {
|
||||
if($id == '') continue;
|
||||
$order++;
|
||||
mysql_query("UPDATE `award_awards` SET `order`='$order' WHERE `id`='$id'");
|
||||
}
|
||||
// echo happy(i18n("Order Updated."));
|
||||
exit;
|
||||
|
||||
case 'prizeinfo_load':
|
||||
@ -196,80 +187,18 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_GET['action']=="edit" || $_GET['action']=="add") {
|
||||
send_header(($_GET['action']=="edit") ? "Edit Award" : "Add Award",
|
||||
array('Committee Main' => 'committee_main.php',
|
||||
'Administration' => 'admin/index.php',
|
||||
'Awards Main' => 'admin/awards.php',
|
||||
'Awards Management' => 'admin/award_awards.php') );
|
||||
} else {
|
||||
send_header("Awards Management",
|
||||
array('Committee Main' => 'committee_main.php',
|
||||
'Administration' => 'admin/index.php',
|
||||
'Awards Main' => 'admin/awards.php') );
|
||||
}
|
||||
|
||||
|
||||
if($_GET['sponsors_id'] && $_GET['sponsors_id']!="all")
|
||||
$_SESSION['sponsors_id']=$_GET['sponsors_id'];
|
||||
else if($_GET['sponsors_id']=="all")
|
||||
unset($_SESSION['sponsors_id']);
|
||||
|
||||
if($_GET['award_types_id'] && $_GET['award_types_id']!="all")
|
||||
$_SESSION['award_types_id']=$_GET['award_types_id'];
|
||||
else if($_GET['award_types_id']=="all")
|
||||
unset($_SESSION['award_types_id']);
|
||||
|
||||
/*
|
||||
if($_GET['award_sponsors_confirmed'] && $_GET['award_sponsors_confirmed']!="all")
|
||||
$_SESSION['award_sponsors_confirmed']=$_GET['award_sponsors_confirmed'];
|
||||
|
||||
if($_GET['sponsors_id']=="all")
|
||||
unset($_SESSION['sponsors_id']);
|
||||
if($_GET['award_types_id']=="all")
|
||||
unset($_SESSION['award_types_id']);
|
||||
if($_GET['award_sponsors_confirmed']=="all")
|
||||
unset($_SESSION['award_sponsors_confirmed']);
|
||||
*/
|
||||
|
||||
$award_types_id=$_SESSION['award_types_id'];
|
||||
$sponsors_id=$_SESSION['sponsors_id'];
|
||||
//$award_sponsors_confirmed=$_SESSION['award_sponsors_confirmed'];
|
||||
|
||||
|
||||
function popup_begin($name, $title, $width=0, $height=0)
|
||||
{
|
||||
echo "<div id=\"popup_$name\" title=\"$title\" >";
|
||||
}
|
||||
function popup_end()
|
||||
{
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once('../htabs.inc.php');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript" src="../js/jquery.tablednd_0_5.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var award_id = 0;
|
||||
function popup_editor(id)
|
||||
{
|
||||
var w = (document.documentElement.clientWidth * 0.8);
|
||||
var h = (document.documentElement.clientHeight * 0.8);
|
||||
|
||||
$('#popup_editor').dialog('option', 'width', w);
|
||||
$('#popup_editor').dialog('option', 'height', h);
|
||||
$("#popup_editor").dialog('open');
|
||||
|
||||
award_id = id;
|
||||
htabs_open("editortabs");
|
||||
|
||||
}
|
||||
|
||||
function update_awardinfo()
|
||||
{
|
||||
@ -316,22 +245,16 @@ function update_prizeinfo()
|
||||
/* This is wasteful, but it saves inlining the code below */
|
||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=prizeinfo_load&id="+id,
|
||||
function(json) {
|
||||
$("#prizelist").html("");
|
||||
$("#prizelist").append( "<tr><th style=\"width:4em\"><?=i18n("Script Order")?></th>"+
|
||||
"<th><?=i18n("# Available")?></th>"+
|
||||
"<th style=\"width: 15em\"><?=i18n("Prize Description")?></th>"+
|
||||
"<th><?=i18n("Cash")?></th>"+
|
||||
"<th><?=i18n("Scholarship")?></th>"+
|
||||
"<th><?=i18n("Value")?></th>"+
|
||||
"<th><?=i18n("Actions")?></th></tr>");
|
||||
$(".prizelist_tr").remove();
|
||||
for( var i in json ) {
|
||||
var p = json[i];
|
||||
$("#prizelist").append("<tr id=\""+p.id+"\"><td style=\"text-align:center;\">"+p.order+"</td>"+
|
||||
"<td style=\"text-align:center;\">"+p.number+"</td>"+
|
||||
"<td>"+p.prize+"</td>"+
|
||||
"<td style=\"width:4em; text-align:right; padding-left:2em; padding-right:2em;\">"+p.cash+"</td>"+
|
||||
"<td style=\"width:4em; text-align:right; padding-left:2em; padding-right:2em;\">"+p.scholarship+"</td>"+
|
||||
"<td style=\"width:4em; text-align:right; padding-left:2em; padding-right:2em;\">"+p.value+"</td>"+
|
||||
var oc = " onclick=\"edit_prize("+p.id+");\" ";
|
||||
$("#prizelist").append("<tr class=\"prizelist_tr\" id=\""+p.id+"\"><td class=\"drag_handle\" style=\"cursor:move; text-align:center;\" id=\"prizelist_order_"+p.id+"\">"+p.order+"</td>"+
|
||||
"<td style=\"cursor:pointer; text-align:center;\" "+oc+" >"+p.number+"</td>"+
|
||||
"<td style=\"cursor:pointer;\" "+oc+" >"+p.prize+"</td>"+
|
||||
"<td style=\"cursor:pointer; width:4em; text-align:right; padding-left:2em; padding-right:2em;\" "+oc+">"+p.cash+"</td>"+
|
||||
"<td style=\"cursor:pointer; width:4em; text-align:right; padding-left:2em; padding-right:2em;\" "+oc+">"+p.scholarship+"</td>"+
|
||||
"<td style=\"cursor:pointer; width:4em; text-align:right; padding-left:2em; padding-right:2em;\" "+oc+">"+p.value+"</td>"+
|
||||
"<td style=\"text-align:center;\">"+
|
||||
" <a onclick=\"edit_prize("+p.id+");\" href=\"#\"><img border=\"0\" src=\"<?=$config['SFIABDIRECTORY']?>/images/16/edit.<?=$config['icon_extension']?>\"></a> "+
|
||||
"<a onclick=\"prize_delete("+p.id+");\" href=\"#\" ><img border=0 src=\"<?=$config['SFIABDIRECTORY']?>/images/16/button_cancel.<?=$config['icon_extension']?>\"></a>"+
|
||||
@ -341,9 +264,13 @@ function update_prizeinfo()
|
||||
onDrop: function(table, row) {
|
||||
var order = $.tableDnD.serialize();
|
||||
$("#prizeinfo_info").load("<?=$_SERVER['PHP_SELF']?>?action=prize_order&"+order);
|
||||
update_prizeinfo();
|
||||
/* Change the order */
|
||||
var rows = table.tBodies[0].rows;
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
$("#prizelist_order_"+rows[i].id).html(i);
|
||||
}
|
||||
|
||||
},
|
||||
dragHandle: "drag_handle",
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -398,17 +325,13 @@ function prize_create()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// When the document is ready set up our sortable with it's inherant function(s)
|
||||
/* Setup the popup window */
|
||||
$(document).ready(function() {
|
||||
$("#popup_editor").dialog({
|
||||
bgiframe: true,
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
bgiframe: true, autoOpen: false,
|
||||
modal: true, resizable: false,
|
||||
draggable: false
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -418,18 +341,16 @@ $(document).ready(function() {
|
||||
echo "<div id=\"popup_editor\" title=\"Award Editor\" style=\"display: none\">";
|
||||
|
||||
htabs_begin('editortabs', array('awardinfo' => array('label' =>'Award',
|
||||
'title' => 'Award Info',
|
||||
'callback' => 'update_awardinfo'),
|
||||
'eligibility' => array('label' =>'Eligibility',
|
||||
'title' => 'Eligibility',
|
||||
'callback' => 'update_eligibility'),
|
||||
'prizes'=> array('label' => 'Prizes',
|
||||
'title' => 'Prizes',
|
||||
'callback' => 'update_prizeinfo'),
|
||||
),'awardinfo');
|
||||
|
||||
htabs_tab_begin('awardinfo');
|
||||
?>
|
||||
<h2><?=i18n("Award Info")?></h2>
|
||||
<div id="awardinfo_info"></div>
|
||||
<form id="awardinfo">
|
||||
<input type="hidden" name="id" id="awardinfo_id" value="0" />
|
||||
@ -464,33 +385,39 @@ htabs_tab_begin('awardinfo');
|
||||
while($tr=mysql_fetch_object($tq)) {
|
||||
echo "<option value=\"$tr->id\">".i18n($tr->type)."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td class=\"left\">".i18n("Criteria").":</td><td class=\"right\"><textarea id=\"awardinfo_criteria\" name=\"criteria\" rows=\"3\" cols=\"50\">Loading...</textarea><script type=\"text/javascript\">translateButton('criteria');</script></td></tr>\n";
|
||||
echo "<tr><td class=\"left\">".i18n("Description").":</td><td class=\"right\"><textarea id=\"awardinfo_description\" name=\"description\" rows=\"3\" cols=\"50\">Loading...</textarea><script type=\"text/javascript\">translateButton('description');</script></td></tr>\n";
|
||||
echo "</table>";
|
||||
echo "<h1>Options</h1>";
|
||||
echo '<table class="tableedit">';
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_excludefromac\" name=\"excludefromac\" value=\"1\"></td><td class=\"right\">".i18n("Exclude this award from the award ceremony script")."</td></tr>";
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_cwsfaward\" name=\"cwsfaward\" value=\"1\"></td><td class=\"right\">".i18n("This award identifies the students that will be attending the Canada-Wide Science Fair")."</td></tr>";
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_selfnominate\" name=\"self_nominate\" value=\"yes\"></td><td class=\"right\">".i18n("Students can self-nominate for this award (this is usually checked for special awards)")."</td></tr>";
|
||||
echo "<tr><td class=\"left\">";
|
||||
echo "<input type=\"checkbox\" id=\"awardinfo_schedulejudges\" name=\"schedule_judges\" value=\"yes\"></td><td class=\"right\">".i18n("Allow the Automatic Judge Scheduler to assign judges to this award (usually checked)")."</td></tr>";
|
||||
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
echo "<input type=\"submit\" onClick=\"save_awardinfo();\" value=\"Save\" />\n";
|
||||
|
||||
?>
|
||||
</select></td></tr>
|
||||
<tr><td class="left"><?=i18n("Criteria")?>:</td>
|
||||
<td class="right"><textarea id="awardinfo_criteria" name="criteria" rows="3" cols="50">Loading...</textarea><script type="text/javascript">translateButton('criteria');</script></td></tr>
|
||||
<tr><td class="left"><?=i18n("Description")?>:</td>
|
||||
<td class="right"><textarea id="awardinfo_description" name="description" rows="3" cols="50">Loading...</textarea><script type="text/javascript">translateButton('description');</script></td></tr>
|
||||
</table>
|
||||
|
||||
<h2>Options</h2>
|
||||
<table class="tableedit">
|
||||
<tr><td class="left">
|
||||
<input type="checkbox" id="awardinfo_excludefromac" name="excludefromac" value="1"></td>
|
||||
<td class="right"><?=i18n("Exclude this award from the award ceremony script")?></td></tr>
|
||||
<tr><td class="left">
|
||||
<input type="checkbox" id="awardinfo_cwsfaward" name="cwsfaward" value="1"></td>
|
||||
<td class="right"><?=i18n("This award identifies the students that will be attending the Canada-Wide Science Fair")?></td></tr>
|
||||
<tr><td class="left">
|
||||
<input type="checkbox" id="awardinfo_selfnominate" name="self_nominate" value="yes"></td>
|
||||
<td class="right"><?=i18n("Students can self-nominate for this award (this is usually checked for special awards)")?></td></tr>
|
||||
<tr><td class="left">
|
||||
<input type="checkbox" id="awardinfo_schedulejudges" name="schedule_judges" value="yes"></td>
|
||||
<td class="right"><?=i18n("Allow the Automatic Judge Scheduler to assign judges to this award (usually checked)")?></td></tr>
|
||||
</table></form>
|
||||
<input type="submit" onClick="save_awardinfo();" value="Save" />
|
||||
<?
|
||||
htabs_tab_end();
|
||||
|
||||
htabs_tab_begin('eligibility');
|
||||
echo "<table class=\"tableedit\">";
|
||||
echo "<tr><td class=\"left\">".i18n("Age Categories").":</td><td class=\"right\">";
|
||||
?>
|
||||
<h2><?=i18n("Award Info")?></h2>
|
||||
<table class="tableedit">
|
||||
<tr><td class="left"><?=i18n("Age Categories")?>:</td><td class="right">
|
||||
<?
|
||||
// if(count($currentcategories)==0) $class="class=\"error\""; else $class="";
|
||||
|
||||
//now select all the categories so we can list them all
|
||||
@ -517,9 +444,19 @@ htabs_tab_end();
|
||||
|
||||
htabs_tab_begin('prizes');
|
||||
?>
|
||||
<br />
|
||||
<div id="prizeinfo_info"></div>
|
||||
<table id="prizelist" class="tableview"> </table>
|
||||
<h2><?=i18n("Prizes")?></h2>
|
||||
<br />
|
||||
<table id="prizelist" class="tableview">
|
||||
<tr class="nodrop nodrag">
|
||||
<th style="width:4em"><?=i18n("Script Order")?></th>
|
||||
<th><?=i18n("# Available")?></th>
|
||||
<th style="width: 15em"><?=i18n("Prize Description")?></th>
|
||||
<th><?=i18n("Cash")?></th>
|
||||
<th><?=i18n("Scholarship")?></th>
|
||||
<th><?=i18n("Value")?></th>
|
||||
<th><?=i18n("Actions")?></th>
|
||||
</tr></table>
|
||||
<br >
|
||||
* <?=i18n("Click on the Script Order and drag to re-order the prizes")?>
|
||||
<br >
|
||||
@ -578,320 +515,121 @@ htabs_end();
|
||||
echo '</div>';
|
||||
|
||||
|
||||
if($_POST['save']=="edit" || $_POST['save']=="add")
|
||||
/* Here's all the code for the award list, except for the AJAX queries which are
|
||||
* at the top of this file */
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
function popup_editor(id)
|
||||
{
|
||||
if(!$_POST['award_types_id']) {
|
||||
echo error(i18n("Award Type is required"));
|
||||
$_GET['action']=$_POST['save'];
|
||||
var w = (document.documentElement.clientWidth * 0.8);
|
||||
var h = (document.documentElement.clientHeight * 0.8);
|
||||
|
||||
$('#popup_editor').dialog('option', 'width', w);
|
||||
$('#popup_editor').dialog('option', 'height', h);
|
||||
$("#popup_editor").dialog('open');
|
||||
|
||||
award_id = id;
|
||||
htabs_open("editortabs");
|
||||
return 0;
|
||||
}
|
||||
else if(!$_POST['sponsors_id']) {
|
||||
echo error(i18n("Award Sponsor is required"));
|
||||
$_GET['action']=$_POST['save'];
|
||||
}
|
||||
else
|
||||
|
||||
function award_create()
|
||||
{
|
||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=award_create",
|
||||
function(json) {
|
||||
popup_editor(json.id);
|
||||
/* Ensure we open on the first tab */
|
||||
// $("#htabs_awardinfo_tab").click();
|
||||
});
|
||||
// alert("ok");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if($_POST['save']=="add")
|
||||
function award_delete(id)
|
||||
{
|
||||
$q=mysql_query("INSERT INTO award_awards (sponsors_id,award_types_id,year) VALUES ('".$_POST['sponsors_id']."','".$_POST['award_types_id']."','".$config['FAIRYEAR']."')");
|
||||
$id=mysql_insert_id();
|
||||
}
|
||||
else
|
||||
$id=$_POST['id'];
|
||||
|
||||
$self_nominate = ($_POST['self_nominate'] == 'yes') ? 'yes' : 'no';
|
||||
$schedule_judges = ($_POST['schedule_judges'] == 'yes') ? 'yes' : 'no';
|
||||
$exec="UPDATE award_awards SET ".
|
||||
"name='".mysql_escape_string(stripslashes($_POST['name']))."', ".
|
||||
"`order`='".mysql_escape_string(stripslashes($_POST['order']))."', ".
|
||||
"sponsors_id='".mysql_escape_string(stripslashes($_POST['sponsors_id']))."', ".
|
||||
"award_types_id='".mysql_escape_string(stripslashes($_POST['award_types_id']))."', ".
|
||||
"presenter='".mysql_escape_string(stripslashes($_POST['presenter']))."', ".
|
||||
"excludefromac='".mysql_escape_string(stripslashes($_POST['excludefromac']))."', ".
|
||||
"cwsfaward='".mysql_escape_string(stripslashes($_POST['cwsfaward']))."', ".
|
||||
"self_nominate='$self_nominate', ".
|
||||
"schedule_judges='$schedule_judges', ".
|
||||
"criteria='".mysql_escape_string(stripslashes($_POST['criteria']))."', ".
|
||||
"description='".mysql_escape_string(stripslashes($_POST['description']))."' ".
|
||||
"WHERE id='$id'";
|
||||
|
||||
mysql_query($exec);
|
||||
echo mysql_error();
|
||||
|
||||
//whipe out any old award-category links
|
||||
mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'");
|
||||
|
||||
//now add the new ones
|
||||
if(is_array($_POST['eligiblecategories']))
|
||||
{
|
||||
foreach($_POST['eligiblecategories'] AS $cat)
|
||||
{
|
||||
mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year) VALUES ('$id','$cat','".$config['FAIRYEAR']."')");
|
||||
}
|
||||
var conf = confirmClick('<?=i18n("Are you sure you want to remove this award?")?>');
|
||||
if(conf == true) {
|
||||
$("#info_info").load("<?$_SERVER['PHP_SELF']?>?action=award_delete&id="+id);
|
||||
/* The TRs need to have just a numeric ID, which could conflict with other lists, so
|
||||
* tag each TR with a class too, and select both the class and the ID */
|
||||
$(".awardlist_tr#"+id).fadeTo('slow', 0);
|
||||
$(".awardlist_tr#"+id).remove();
|
||||
}
|
||||
|
||||
//whipe out any old award-divisions links
|
||||
mysql_query("DELETE FROM award_awards_projectdivisions WHERE award_awards_id='$id'");
|
||||
|
||||
//now add the new ones
|
||||
if(is_array($_POST['eligibledivisions']))
|
||||
{
|
||||
foreach($_POST['eligibledivisions'] AS $div)
|
||||
{
|
||||
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year) VALUES ('$id','$div','".$config['FAIRYEAR']."')");
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['save']=="add")
|
||||
echo happy("Award successfully added");
|
||||
else
|
||||
echo happy("Successfully saved changes to award");
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$("#awardlist").tableDnD({
|
||||
onDrop: function(table, row) {
|
||||
var order = $.tableDnD.serialize();
|
||||
// $(row).fadeTo('fast',1);
|
||||
$("#award_info").load("<?=$_SERVER['PHP_SELF']?>?action=award_order&"+order);
|
||||
|
||||
/* Change the order */
|
||||
var rows = table.tBodies[0].rows;
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
$("#awardlist_order_"+rows[i].id).html(i);
|
||||
}
|
||||
},
|
||||
onDragStart: function(table, row) {
|
||||
// $(row).fadeTo('fast',0.2);
|
||||
},
|
||||
dragHandle: "drag_handle"
|
||||
});
|
||||
|
||||
if($_POST['action']=="reorder")
|
||||
{
|
||||
if(is_array($_POST['reorder']))
|
||||
{
|
||||
foreach($_POST['reorder'] AS $key=>$val)
|
||||
{
|
||||
mysql_query("UPDATE award_awards SET `order`='$val' WHERE id='$key'");
|
||||
}
|
||||
echo happy("Awards successfully reordered");
|
||||
}
|
||||
}
|
||||
// $(".awardlist_tr#166").css('background-color','red');
|
||||
|
||||
if($_GET['action']=="delete" && $_GET['delete'])
|
||||
{
|
||||
mysql_query("DELETE FROM award_awards WHERE id='".$_GET['delete']."'");
|
||||
echo happy("Award successfully deleted");
|
||||
}
|
||||
});
|
||||
|
||||
if($_GET['action']=="edit" || $_GET['action']=="add")
|
||||
{
|
||||
//define these here so we dont forget :)
|
||||
$currentcategories=array();
|
||||
$currentdivisions=array();
|
||||
</script>
|
||||
|
||||
if($_GET['action']=="edit")
|
||||
{
|
||||
$buttontext="Save Award";
|
||||
<div id="info_info"></div>
|
||||
|
||||
$q=mysql_query("SELECT
|
||||
award_awards.id,
|
||||
award_awards.name,
|
||||
award_awards.criteria,
|
||||
award_awards.description,
|
||||
award_awards.order,
|
||||
award_awards.presenter,
|
||||
award_awards.excludefromac,
|
||||
award_awards.cwsfaward,
|
||||
award_awards.self_nominate,
|
||||
award_awards.schedule_judges,
|
||||
award_types.id AS award_types_id,
|
||||
award_types.type,
|
||||
sponsors.id AS sponsors_id,
|
||||
sponsors.organization
|
||||
|
||||
FROM
|
||||
award_awards,
|
||||
award_types,
|
||||
sponsors
|
||||
WHERE
|
||||
award_awards.year='".$config['FAIRYEAR']."'
|
||||
AND award_awards.id='".$_GET['edit']."'
|
||||
AND award_awards.sponsors_id=sponsors.id
|
||||
AND award_awards.award_types_id=award_types.id
|
||||
");
|
||||
<?
|
||||
|
||||
|
||||
echo mysql_error();
|
||||
$r=mysql_fetch_object($q);
|
||||
$award_awards_id=$r->id;
|
||||
$award_awards_name=$r->name;
|
||||
$award_awards_order=$r->order;
|
||||
$award_awards_criteria=$r->criteria;
|
||||
$award_awards_description=$r->description;
|
||||
$award_types_id=$r->award_types_id;
|
||||
$award_type=$r->type;
|
||||
$sponsors_id=$r->sponsors_id;
|
||||
$award_sponsor=$r->organization;
|
||||
$award_awards_presenter=$r->presenter;
|
||||
$award_awards_excludefromac=$r->excludefromac;
|
||||
$award_awards_cwsfaward=$r->cwsfaward;
|
||||
$award_awards_self_nominate=$r->self_nominate;
|
||||
$award_awards_schedule_judges=$r->schedule_judges;
|
||||
/* List filtering */
|
||||
if($_GET['sponsors_id'] && $_GET['sponsors_id']!="all")
|
||||
$_SESSION['sponsors_id']=$_GET['sponsors_id'];
|
||||
else if($_GET['sponsors_id']=="all")
|
||||
unset($_SESSION['sponsors_id']);
|
||||
|
||||
if($_GET['award_types_id'] && $_GET['award_types_id']!="all")
|
||||
$_SESSION['award_types_id']=$_GET['award_types_id'];
|
||||
else if($_GET['award_types_id']=="all")
|
||||
unset($_SESSION['award_types_id']);
|
||||
|
||||
//select the current categories that this award is linked to
|
||||
$ccq=mysql_query("SELECT * FROM award_awards_projectcategories WHERE award_awards_id='$r->id'");
|
||||
while($ccr=mysql_fetch_object($ccq))
|
||||
$currentcategories[]=$ccr->projectcategories_id;
|
||||
/*
|
||||
if($_GET['award_sponsors_confirmed'] && $_GET['award_sponsors_confirmed']!="all")
|
||||
$_SESSION['award_sponsors_confirmed']=$_GET['award_sponsors_confirmed'];
|
||||
|
||||
//select the current categories that this award is linked to
|
||||
$cdq=mysql_query("SELECT * FROM award_awards_projectdivisions WHERE award_awards_id='$r->id'");
|
||||
while($cdr=mysql_fetch_object($cdq))
|
||||
$currentdivisions[]=$cdr->projectdivisions_id;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if($_GET['action']=="add")
|
||||
{
|
||||
$buttontext="Add Award";
|
||||
$firstsponsor="<option value=\"\">".i18n("Choose a sponsor")."</option>\n";
|
||||
$firsttype="<option value=\"\">".i18n("Choose an award type")."</option>\n";
|
||||
/* We want these two on by default for new
|
||||
* awards */
|
||||
$award_awards_self_nominate = 'yes';
|
||||
$award_awards_schedule_judges = 'yes';
|
||||
}
|
||||
$buttontext=i18n($buttontext);
|
||||
|
||||
//if we have POST values, then they should be used instead of the db values
|
||||
//esp for adding, if there is an error then the POST values will be redisplayed
|
||||
if($_POST['name']) $award_awards_name=$_POST['name'];
|
||||
if($_POST['order']) $award_awards_order=$_POST['order'];
|
||||
if($_POST['criteria']) $award_awards_criteria=$_POST['criteria'];
|
||||
if($_POST['description']) $award_awards_criteria=$_POST['description'];
|
||||
if($_POST['award_types_id']) $award_types_id=$_POST['award_types_id'];
|
||||
if($_POST['sponsors_id']) $sponsors_id=$_POST['sponsors_id'];
|
||||
if($_POST['eligiblecategories']) $currentcategories=$_POST['eligiblecategories'];
|
||||
if($_POST['eligibledivisions']) $currentdivisions=$_POST['eligibledivisions'];
|
||||
if($_POST['presenter']) $award_awards_presenter=$_POST['presenter'];
|
||||
if($_POST['excludefromac']) $award_awards_excludefromac=$_POST['excludefromac'];
|
||||
if($_POST['cwsfaward']) $award_awards_cwsfaward=$_POST['cwsfaward'];
|
||||
if($_POST['self_nominate']) $award_awards_self_nominate=$_POST['self_nominate'];
|
||||
if($_POST['schedule_judges']) $award_awards_schedule_judges=$_POST['schedule_judges'];
|
||||
|
||||
|
||||
echo "<form method=\"post\" action=\"award_awards.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"save\" value=\"".$_GET['action']."\">\n";
|
||||
|
||||
if($_GET['action']=="edit")
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"".$_GET['edit']."\">\n";
|
||||
|
||||
echo "<table class=\"tableedit\">\n";
|
||||
// echo "<tr><td>".i18n("Name")."</td><td><input type=\"text\" id=\"name\" name=\"name\" value=\"".htmlspecialchars($award_awards_name)."\" size=\"50\" maxlength=\"128\" /><script type=\"text/javascript\">translateButton('name');</script></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Order")."</td><td><input type=\"text\" name=\"order\" value=\"".htmlspecialchars($award_awards_order)."\" size=\"5\" maxlength=\"5\" />(".i18n("presentation order").")</td></tr>\n";
|
||||
echo "<tr><td>".i18n("Sponsor")."</td><td>";
|
||||
$sq=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization");
|
||||
echo "<select name=\"sponsors_id\">";
|
||||
//only show the "choose a sponsor" option if we are adding,if we are editing, then they must have already chosen one.
|
||||
echo $firstsponsor;
|
||||
while($sr=mysql_fetch_object($sq))
|
||||
{
|
||||
if($sr->id == $sponsors_id)
|
||||
$sel="selected=\"selected\"";
|
||||
else
|
||||
$sel="";
|
||||
echo "<option $sel value=\"$sr->id\">".i18n($sr->organization)."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td>".i18n("Presenter")."</td><td><input type=\"text\" name=\"presenter\" value=\"".htmlspecialchars($award_awards_presenter)."\" size=\"50\" maxlength=\"128\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Type")."</td><td>";
|
||||
$tq=mysql_query("SELECT id,type FROM award_types WHERE year='{$config['FAIRYEAR']}' ORDER BY type");
|
||||
echo "<select name=\"award_types_id\">";
|
||||
//only show the "choose a type" option if we are adding,if we are editing, then they must have already chosen one.
|
||||
echo $firsttype;
|
||||
while($tr=mysql_fetch_object($tq))
|
||||
{
|
||||
if($tr->id == $award_types_id)
|
||||
$sel="selected=\"selected\"";
|
||||
else
|
||||
$sel="";
|
||||
echo "<option $sel value=\"$tr->id\">".i18n($tr->type)."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</td></tr>";
|
||||
|
||||
// echo "<tr><td>".i18n("Criteria")."</td><td><textarea id=\"criteria\" name=\"criteria\" rows=\"3\" cols=\"50\">".htmlspecialchars($award_awards_criteria)."</textarea><script type=\"text/javascript\">translateButton('criteria');</script></td></tr>\n";
|
||||
// echo "<tr><td>".i18n("Description")."</td><td><textarea id=\"description\" name=\"description\" rows=\"3\" cols=\"50\">".htmlspecialchars($award_awards_description)."</textarea><script type=\"text/javascript\">translateButton('description');</script></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Eligibility")."</td><td>";
|
||||
|
||||
echo "<table>";
|
||||
echo "<tr>";
|
||||
echo "<th>".i18n("Age Categories")."</th>";
|
||||
echo "<th>".i18n("Divisions")."</th>";
|
||||
echo "</tr>";
|
||||
if(count($currentcategories)==0) $class="class=\"error\""; else $class="";
|
||||
echo "<tr><td $class>";
|
||||
|
||||
//now select all the categories so we can list them all
|
||||
$cq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade");
|
||||
echo mysql_error();
|
||||
while($cr=mysql_fetch_object($cq))
|
||||
{
|
||||
if(in_array($cr->id,$currentcategories))
|
||||
$ch="checked=\"checked\"";
|
||||
else
|
||||
$ch="";
|
||||
|
||||
echo "<input $ch type=\"checkbox\" name=\"eligiblecategories[]\" value=\"$cr->id\" />".i18n($cr->category)."<br />";
|
||||
}
|
||||
echo "</td>";
|
||||
if(count($currentdivisions)==0) $class="class=\"error\""; else $class="";
|
||||
echo "<td $class>";
|
||||
|
||||
$dq=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
|
||||
echo mysql_error();
|
||||
while($dr=mysql_fetch_object($dq))
|
||||
{
|
||||
if(in_array($dr->id,$currentdivisions))
|
||||
$ch="checked=\"checked\"";
|
||||
else
|
||||
$ch="";
|
||||
echo "<input $ch type=\"checkbox\" name=\"eligibledivisions[]\" value=\"$dr->id\" />".i18n($dr->division)."<br />";
|
||||
}
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
if(count($currentcategories)==0 || count($currentdivisions)==0)
|
||||
echo "<tr><td colspan=\"2\" class=\"error\">".i18n("At least one age category and one division must be selected")."</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr><td align=\"right\">";
|
||||
if($award_awards_excludefromac==1) $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"checkbox\" name=\"excludefromac\" value=\"1\"></td><td>".i18n("Exclude this award from the award ceremony script")."</td></tr>";
|
||||
echo "<tr><td align=\"right\">";
|
||||
if($award_awards_cwsfaward==1) $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"checkbox\" name=\"cwsfaward\" value=\"1\"></td><td>".i18n("This award identifies the students that will be attending the Canada-Wide Science Fair")."</td></tr>";
|
||||
echo "<tr><td align=\"right\">";
|
||||
$ch = ($award_awards_self_nominate=='yes') ? "checked=\"checked\"" : '';
|
||||
echo "<input $ch type=\"checkbox\" name=\"self_nominate\" value=\"yes\"></td><td>".i18n("Students can self-nominate for this award (this is usually checked for special awards)")."</td></tr>";
|
||||
echo "<tr><td align=\"right\">";
|
||||
$ch = ($award_awards_schedule_judges=='yes') ? "checked=\"checked\"" : '';
|
||||
echo "<input $ch type=\"checkbox\" name=\"schedule_judges\" value=\"yes\"></td><td>".i18n("Allow the Automatic Judge Scheduler to assign judges to this award (usually checked)")."</td></tr>";
|
||||
|
||||
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if($_GET['sponsors_id']=="all")
|
||||
unset($_SESSION['sponsors_id']);
|
||||
if($_GET['award_types_id']=="all")
|
||||
unset($_SESSION['award_types_id']);
|
||||
if($_GET['award_sponsors_confirmed']=="all")
|
||||
unset($_SESSION['award_sponsors_confirmed']);
|
||||
*/
|
||||
|
||||
$award_types_id=$_SESSION['award_types_id'];
|
||||
$sponsors_id=$_SESSION['sponsors_id'];
|
||||
//$award_sponsors_confirmed=$_SESSION['award_sponsors_confirmed'];
|
||||
|
||||
echo "<br />";
|
||||
echo i18n("Filter By:");
|
||||
echo "<form method=\"get\" action=\"award_awards.php\" name=\"filterchange\">";
|
||||
|
||||
echo "<table><tr><td colspan=\"2\">";
|
||||
|
||||
$q=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization");
|
||||
echo "<select name=\"sponsors_id\" onchange=\"document.forms.filterchange.submit()\">";
|
||||
echo "<option value=\"all\">".i18n("All Sponsors")."</option>";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->id == $sponsors_id)
|
||||
{
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
if($r->id == $sponsors_id) {
|
||||
$sel="selected=\"selected\"";
|
||||
$sponsors_organization=$r->organization;
|
||||
}
|
||||
else
|
||||
} else
|
||||
$sel="";
|
||||
echo "<option $sel value=\"$r->id\">".i18n($r->organization)."</option>";
|
||||
}
|
||||
@ -902,14 +640,11 @@ echo mysql_error();
|
||||
$q=mysql_query("SELECT id,type FROM award_types WHERE year='{$config['FAIRYEAR']}' ORDER BY type");
|
||||
echo "<select name=\"award_types_id\" onchange=\"document.forms.filterchange.submit()\">";
|
||||
echo "<option value=\"all\">".i18n("All Award Types")."</option>";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->id == $award_types_id)
|
||||
{
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
if($r->id == $award_types_id) {
|
||||
$sel="selected=\"selected\"";
|
||||
$award_types_type=$r->type;
|
||||
}
|
||||
else
|
||||
} else
|
||||
$sel="";
|
||||
echo "<option $sel value=\"$r->id\">".i18n($r->type)."</option>";
|
||||
}
|
||||
@ -932,11 +667,15 @@ echo mysql_error();
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
?>
|
||||
<br />
|
||||
<a href="#" onClick="award_create();"><?=i18n("Create New Award")?></a>
|
||||
<br /><br />
|
||||
|
||||
|
||||
echo "<br />";
|
||||
echo "<a href=\"award_awards.php?sponsors_id=$sponsors_id&award_types_id=$award_types_id&action=add\">".i18n("Add New Award")."</a>\n";
|
||||
echo "<br />";
|
||||
<?
|
||||
/* For some reason, this submit button opens the dialog then it closes right away, but it doesn't
|
||||
* if the entry is done through the a href */
|
||||
//<input type="submit" onClick="award_create();" value="<?=i18n("Create New Award")>" />
|
||||
|
||||
if($sponsors_id) $where_asi="AND sponsors_id='$sponsors_id'";
|
||||
if($award_types_id) $where_ati="AND award_types_id='$award_types_id'";
|
||||
@ -951,30 +690,26 @@ echo mysql_error();
|
||||
award_awards.award_source_fairs_id,
|
||||
award_types.type,
|
||||
sponsors.organization
|
||||
|
||||
FROM
|
||||
award_awards,
|
||||
award_types,
|
||||
sponsors
|
||||
WHERE
|
||||
award_awards.year='".$config['FAIRYEAR']."'
|
||||
award_awards.year='{$config['FAIRYEAR']}'
|
||||
$where_asi
|
||||
$where_ati
|
||||
$where_asc
|
||||
AND award_awards.sponsors_id=sponsors.id
|
||||
AND award_awards.award_types_id=award_types.id
|
||||
AND award_types.year='".$config['FAIRYEAR']."'
|
||||
AND award_types.year='{$config['FAIRYEAR']}'
|
||||
ORDER BY `$orderby`");
|
||||
|
||||
echo mysql_error();
|
||||
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
echo "<form method=\"post\" action=\"award_awards.php\">";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"reorder\">";
|
||||
|
||||
echo "<table class=\"tableview\">";
|
||||
echo "<tr>";
|
||||
echo "<table id=\"awardlist\" class=\"tableview\" >";
|
||||
echo "<tr class=\"nodrop nodrag\">";
|
||||
echo " <th>".i18n("Order")."</th>";
|
||||
echo " <th>".i18n("Sponsor")."</th>";
|
||||
echo " <th>".i18n("Type")."</th>";
|
||||
@ -985,29 +720,23 @@ echo mysql_error();
|
||||
|
||||
|
||||
$hasexternal=false;
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->award_source_fairs_id){ $cl="class=\"externalaward\""; $hasexternal=true; } else $cl="";
|
||||
echo "<tr $cl>\n";
|
||||
echo " <td><input type=\"text\" name=\"reorder[$r->id]\" value=\"$r->order\" size=\"3\" /></td>\n";
|
||||
echo " <td>$r->organization</td>\n";
|
||||
echo " <td>$r->type</td>\n";
|
||||
echo " <td><a onclick=\"popup_editor({$r->id});\">$r->name</a></td>\n";
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
$cl = ($r->award_source_fairs_id) ? externalaward : '';
|
||||
$eh = "style=\"cursor:pointer;\" onclick=\"popup_editor({$r->id});\"";
|
||||
echo "<tr class=\"$cl awardlist_tr\" id=\"{$r->id}\" >\n";
|
||||
echo " <td id=\"awardlist_order_{$r->id}\" class=\"drag_handle\" style=\"cursor:move; text-align:right;\">{$r->order}</td>\n";
|
||||
echo " <td $eh>{$r->organization}</td>\n";
|
||||
echo " <td $eh>{$r->type}</td>\n";
|
||||
echo " <td $eh>{$r->name}</td>\n";
|
||||
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_prizes WHERE award_awards_id='$r->id'");
|
||||
$numr=mysql_fetch_object($numq);
|
||||
$numprizes=$numr->num;
|
||||
|
||||
|
||||
echo " <td align=\"center\" valign=\"top\">";
|
||||
echo "$numprizes ";
|
||||
echo "<a href=\"award_prizes.php?award_awards_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
||||
echo "</td>";
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_prizes WHERE award_awards_id='{$r->id}'");
|
||||
$numr=mysql_fetch_assoc($numq);
|
||||
echo " <td $eh align=\"center\">{$numr['num']}</td>";
|
||||
|
||||
echo " <td align=\"center\">";
|
||||
echo "<a href=\"award_awards.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
|
||||
echo "<img border=\"0\" src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\">";
|
||||
echo " ";
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this award?')\" href=\"award_awards.php?action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo "<a onclick=\"award_delete({$r->id});\" href=\"#\" ><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.{$config['icon_extension']}\"></a>";
|
||||
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
@ -1015,13 +744,11 @@ echo mysql_error();
|
||||
if($hasexternal)
|
||||
echo "<tr class=\"externalaward\"><td colspan=\"6\">".i18n("Indicates award imported from an external source")."</td></tr>";
|
||||
echo "</table>\n";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Re-order awards")."\" />";
|
||||
echo "</form>";
|
||||
}
|
||||
echo "<br />";
|
||||
echo "<a href=\"award_prizes.php?award_awards_id=-1\">Edit prizes for the generic prize template</a>";
|
||||
|
||||
}
|
||||
|
||||
send_footer();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user