diff --git a/judge.class.php b/judge.class.php index a238f78..31d1759 100644 --- a/judge.class.php +++ b/judge.class.php @@ -21,6 +21,7 @@ $judges_fields = array( 'firstname' => 'First Name', // 'deleted' => 'Deleted', // 'deleteddatetime' => 'Deleted Date/Time', 'expertise_other' => 'Other Expertise/Notes', + 'typepref' => 'Type Request', 'complete' => "Complete"); /* Setup the table editor with the fields we want to display @@ -77,6 +78,16 @@ function tableEditorSetup($editor) $catf["divpref_{$r->id}"] = "Expertise|{$r->division}:"; } + $q = mysql_query("SELECT * FROM award_awards WHERE year='{$config['FAIRYEAR']}' + AND (award_types_id=2 OR award_types_id=5) ORDER BY id"); + while($r=mysql_fetch_object($q)) { +// $divshort[$r->id]=$r->division_shortform; + $sa[$r->id]=$r->name; + /* yes, catf */ + $catf["sa_{$r->id}"] = "Special Award|{$r->name}:"; + } + + /* Most of these should be moved to the base class, as they @@ -134,6 +145,19 @@ function tableEditorSetup($editor) $editor->setFieldInputType("divpref_$did", 'select'); } + foreach($sa as $said=>$special_award) { + $editor->setFieldOptions("sa_$said", array( + array('key' => 'yes', 'val' => 'Would like to judge'), + array('key' => '', 'val' => ''))); + $editor->setFieldInputType("sa_$said", 'select'); + } + + $editor->setFieldOptions('typepref', array( + array('key' => 'speconly', 'val' => 'Special Award Judge Only'), + array('key' => '', 'val' => 'Regular Judge'))); + $editor->SetFieldInputType('typepref', 'select'); + + $editor->createOption('judges_show_what'); } @@ -232,6 +256,16 @@ function tableEditorLoad() } } + $q=mysql_query("SELECT * + FROM judges_specialaward_sel + WHERE judges_id='$id' + AND year='{$config['FAIRYEAR']}'"); + if(mysql_num_rows($q)) { + while($r=mysql_fetch_object($q)) { + $j["sa_{$r->award_awards_id}"] = 'yes'; + } + } + // print_r($j); return $j; @@ -320,6 +354,19 @@ function tableEditorSave($data) } } + $query = "DELETE FROM judges_speciaward_sel WHERE judges_id='{$this->id}'"; + mysql_query($query); + $keys = array_keys($data); + foreach($keys as $k) { + if(ereg("^sa_([0-9]*)$", $k, $regs)) { + if($data[$k] == "''") continue; + $query = "INSERT INTO judges_specialaward_sel + (judges_id,award_awards_id,year) + values ('{$this->id}','{$regs[1]}','{$config['FAIRYEAR']}')"; +// print($query."
\n"); + mysql_query($query); + } + } } function tableEditorDelete()