forked from science-ation/science-ation
Merge Jamie's changes from Peterborough, allowing different divisions to be available to the different age categories. -- default is 'no'
This commit is contained in:
parent
a9ffdf7ee4
commit
a20dfdbd7a
@ -85,7 +85,11 @@
|
||||
|
||||
if($_GET['action']=="remove" && $_GET['remove'])
|
||||
{
|
||||
mysql_query("DELETE FROM projectcategories WHERE id='".$_GET['remove']."'");
|
||||
//###### Feature Specific - filtering divisions by category - not conditional, cause even if they have the filtering turned off..if any links
|
||||
//for this division exist they should be deleted
|
||||
mysql_query("DELETE FROM projectcategoriesdivisions_link where projectcategories_id='".$_GET['remove']."' AND year='".$config['FAIRYEAR']."'");
|
||||
//####
|
||||
mysql_query("DELETE FROM projectcategories WHERE id='".$_GET['remove']."' AND year='".$config['FAIRYEAR']."'");
|
||||
echo happy(i18n("Category successfully removed"));
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,20 @@
|
||||
"division='".mysql_escape_string(stripslashes($_POST['division']))."', ".
|
||||
"division_shortform='".mysql_escape_string(stripslashes($_POST['division_shortform']))."' ".
|
||||
"WHERE id='".$_POST['saveid']."'");
|
||||
|
||||
//###### Feature Specific - filtering divisions by category
|
||||
if($config['filterdivisionbycategory']=="yes"){
|
||||
mysql_query("DELETE FROM projectcategoriesdivisions_link WHERE projectdivisions_id='".$_POST['saveid']."' AND year='".$config['FAIRYEAR']."'");
|
||||
|
||||
foreach($_POST['divcat'] as $tempcat){
|
||||
mysql_query("INSERT INTO projectcategoriesdivisions_link (projectdivisions_id,projectcategories_id,year) VALUES ( ".
|
||||
"'".$_POST['id']."', ".
|
||||
"'".$tempcat."', ".
|
||||
"'".$config['FAIRYEAR']."') ");
|
||||
}
|
||||
}
|
||||
//###########
|
||||
|
||||
echo happy(i18n("Division successfully saved"));
|
||||
}
|
||||
}
|
||||
@ -68,6 +82,17 @@
|
||||
"'".mysql_escape_string(stripslashes($_POST['division']))."', ".
|
||||
"'".mysql_escape_string(stripslashes($_POST['division_shortform']))."', ".
|
||||
"'".$config['FAIRYEAR']."') ");
|
||||
|
||||
|
||||
//###### Feature Specific - filtering divisions by category
|
||||
if($config['filterdivisionbycategory']=="yes"){
|
||||
foreach($_POST['divcat'] as $tempcat){
|
||||
mysql_query("INSERT INTO projectcategoriesdivisions_link (projectdivisions_id,projectcategories_id,year) VALUES ( ".
|
||||
"'".$tempcat."', ".
|
||||
"'".$config['FAIRYEAR']."') ");
|
||||
}
|
||||
}
|
||||
//#######
|
||||
echo happy(i18n("Division successfully added"));
|
||||
}
|
||||
}
|
||||
@ -79,7 +104,10 @@
|
||||
|
||||
if($_GET['action']=="remove" && $_GET['remove'])
|
||||
{
|
||||
mysql_query("DELETE FROM projectdivisions WHERE id='".$_GET['remove']."'");
|
||||
//###### Feature Specific - filtering divisions by category - not conditional, cause even if they have the filtering turned off..if any links
|
||||
//for this division exist they should be deleted
|
||||
mysql_query("DELETE FROM projectcategoriesdivisions_link where projectdivisions_id='".$_GET['remove']."' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM projectdivisions WHERE id='".$_GET['remove']."' AND year='".$config['FAIRYEAR']."'");
|
||||
echo happy(i18n("Division successfully removed"));
|
||||
}
|
||||
|
||||
@ -95,6 +123,10 @@
|
||||
echo "<th>".i18n("Division ID")."</th>\n";
|
||||
echo "<th>".i18n("Division Name")."</th>\n";
|
||||
echo "<th>".i18n("Short Form")."</th>\n";
|
||||
//###### Feature Specific - filtering divisions by category
|
||||
if($config['filterdivisionbycategory']=="yes")
|
||||
echo "<th>".i18n("Categories")."</th>\n";
|
||||
//#####
|
||||
echo "<th>".i18n("Actions")."</th>\n";
|
||||
echo "</tr>";
|
||||
|
||||
@ -116,6 +148,23 @@
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$divisionr->id\" /></td>";
|
||||
echo " <td><input type=\"text\" size=\"40\" name=\"division\" value=\"$divisionr->division\" /></td>";
|
||||
echo " <td align=\"center\"><input type=\"text\" size=\"5\" name=\"division_shortform\" value=\"$divisionr->division_shortform\" /></td>";
|
||||
|
||||
//###### Feature Specific - filtering divisions by category
|
||||
if($config['filterdivisionbycategory']=="yes"){
|
||||
echo " <td>";
|
||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade");
|
||||
while($categoryr=mysql_fetch_object($q)){
|
||||
$query="SELECT * FROM projectcategoriesdivisions_link WHERE projectdivisions_id=".$divisionr->id." AND projectcategories_id=".$categoryr->id." AND year='".$config['FAIRYEAR']."'";
|
||||
$t=mysql_query($query);
|
||||
if($t && mysql_num_rows($t)>0)
|
||||
echo "<input type=\"checkbox\" size=\"5\" name=\"divcat[]\" value=\"$categoryr->id\" checked=\"checked\" /> $categoryr->category<br/>";
|
||||
else
|
||||
echo "<input type=\"checkbox\" size=\"5\" name=\"divcat[]\" value=\"$categoryr->id\" /> $categoryr->category<br/>";
|
||||
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
|
||||
echo " <td><input type=\"submit\" value=\"".i18n($buttontext)."\" /></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
@ -128,6 +177,26 @@
|
||||
echo " <td>$r->id</td>";
|
||||
echo " <td>".i18n($r->division)."</td>";
|
||||
echo " <td align=\"center\">$r->division_shortform</td>";
|
||||
//###### Feature Specific - filtering divisions by category
|
||||
if($config['filterdivisionbycategory']=="yes"){
|
||||
|
||||
$c=mysql_query("SELECT category FROM projectcategoriesdivisions_link, projectcategories
|
||||
WHERE projectcategoriesdivisions_link.projectcategories_id = projectcategories.id
|
||||
AND projectdivisions_id='$r->id'
|
||||
AND projectcategoriedivisions_link.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY projectcategories.mingrade");
|
||||
if(!$c){
|
||||
$tempcat=" ";
|
||||
}else{
|
||||
$tempcat="";
|
||||
while($categoryr=mysql_fetch_object($c)){
|
||||
$tempcat.=",".$categoryr->category;
|
||||
}
|
||||
$tempcat=substr($tempcat,1);
|
||||
}
|
||||
echo "<td> {$tempcat} </td>";
|
||||
}
|
||||
//############
|
||||
echo " <td>";
|
||||
echo "<a title=\"Edit\" href=\"".$_SERVER['PHP_SELF']."?action=edit&edit=$r->id\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\" border=0></a>";
|
||||
echo " ";
|
||||
|
@ -9,3 +9,12 @@ DELETE FROM `judges_schedulerconfig` WHERE var='timeslot_break';
|
||||
ALTER TABLE `award_awards` ADD `excludefromac` TINYINT( 1 ) DEFAULT '0' NOT NULL;
|
||||
ALTER TABLE `award_prizes` ADD `excludefromac` TINYINT( 1 ) DEFAULT '0' NOT NULL;
|
||||
UPDATE `config` SET `description`='C=Category, D=Division, N=2 digit Number' WHERE `var`='project_num_format';
|
||||
INSERT INTO `config` VALUES ('filterdivisionbycategory', 'no', 'Allows for setup of divisions on a categorical basis. Students can then only choose divisions that apply to their category. Only use if you want to offer a different set of divisions to each age category (no, yes).', -1);
|
||||
CREATE TABLE `projectcategoriesdivisions_link` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`projectdivisions_id` int(10) unsigned NOT NULL default '0',
|
||||
`projectcategories_id` int(10) unsigned NOT NULL default '0',
|
||||
`year` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `categories_id` (`projectcategories_id`)
|
||||
) TYPE=MyISAM;
|
||||
|
@ -195,7 +195,13 @@ function countwords()
|
||||
echo " (".i18n("Grades %1-%2",array($agecategories[$projectcategories_id]['mingrade'],$agecategories[$projectcategories_id]['maxgrade'])).")";
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>".i18n("Division").": </td><td>";
|
||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
|
||||
|
||||
//###### Feature Specific - filtering divisions by category
|
||||
if($config['filterdivisionbycategory']=="yes"){
|
||||
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND year='".$config['FAIRYEAR']."' ORDER BY division");
|
||||
//###
|
||||
}else
|
||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
|
||||
echo "<select name=\"projectdivisions_id\">";
|
||||
echo "<option value=\"\">".i18n("Select a division")."</option>\n";
|
||||
while($r=mysql_fetch_object($q))
|
||||
|
Loading…
Reference in New Issue
Block a user