forked from science-ation/science-ation
105 lines
2.1 KiB
PHP
105 lines
2.1 KiB
PHP
<?
|
|
|
|
|
|
class person {
|
|
var $id;
|
|
|
|
function person($person_id) {
|
|
$this->id = $person_id;
|
|
}
|
|
|
|
};
|
|
|
|
|
|
class judge extends person {
|
|
|
|
/* Static members for the table editor */
|
|
function editor_setup($editor)
|
|
{
|
|
/* Setup the table editor with the fields we want to display
|
|
* when displaying a list of judges, and also the type of each
|
|
* field where required */
|
|
$l = array( 'id' => 'ID',
|
|
'firstname' => 'First Name',
|
|
'lastname' => 'Last Name'
|
|
);
|
|
|
|
/* Most of these should be moved to the base class, as they
|
|
* will be the same for all person groups */
|
|
$e = array( 'firstname' => 'First Name',
|
|
'lastname' => 'Last Name',
|
|
'email' => 'Email Address',
|
|
'address' =>"Address 1",
|
|
'address2' =>"Address 2",
|
|
'city' => 'City',
|
|
'province' => 'Province',
|
|
'postalcode' => 'Postal Code',
|
|
'phonework' => 'Phone (Work)',
|
|
'phonecell' => 'Phone (Cell)',
|
|
'organization' => 'Organization',
|
|
'language' => 'Language(s)',
|
|
'complete' => "Complete" );
|
|
|
|
$editor->setTable('judges');
|
|
$editor->setListFields($l);
|
|
$editor->setEditFields($e);
|
|
|
|
/* Build an array of langauges that we support */
|
|
$langs = array();
|
|
$q=mysql_query("SELECT * FROM languages WHERE active='Y'");
|
|
while($r=mysql_fetch_object($q)) {
|
|
$langs[$r->lang] = $r->langname;
|
|
}
|
|
|
|
$editor->setFieldOptions('language', $langs);
|
|
$editor->setFieldInputType('language', 'multicheck');
|
|
}
|
|
|
|
/* Functions for $this */
|
|
|
|
|
|
function judge($judge_id)
|
|
{
|
|
person::person($judge_id);
|
|
|
|
}
|
|
|
|
function load()
|
|
{
|
|
$id = $this->id;
|
|
|
|
print("Loading Judge ID $id\n");
|
|
|
|
$q=mysql_query("SELECT judges.*
|
|
FROM judges
|
|
WHERE judges.id='$id'");
|
|
echo mysql_error();
|
|
|
|
|
|
/* We assume that the field names in the array we want to return
|
|
* are the same as those in the database, so we'll turn the entire
|
|
* query into a single associative array */
|
|
$j = mysql_fetch_assoc($q);
|
|
|
|
/* Now turn on the ones this judge has selected */
|
|
$q=mysql_query("SELECT languages_lang
|
|
FROM judges_languages
|
|
WHERE judges_id='$id'");
|
|
while($r=mysql_fetch_object($q)) {
|
|
$j['language'][$r->languages_lang] = 1;
|
|
}
|
|
|
|
print_r($j);
|
|
|
|
return $j;
|
|
}
|
|
|
|
function save()
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
?>
|