- Added an option for the tableeditor to construct a LEFT JOIN when listing a

table
- Add complete and year options to the judge manager, filter by ALL, active and
  inactive for the current year, or active only.
- Add the "complete" status the the judge info page (the judge info popup page
  needs to be integrated with the new judge manager, somehow.. so we can remove
  the judges_judges list page).
This commit is contained in:
dave 2006-10-18 17:05:18 +00:00
parent 29a772ae5e
commit 9f9b612e5d
4 changed files with 27 additions and 9 deletions

View File

@ -54,6 +54,9 @@ $preferencechoices=array(
send_popup_header(i18n("Judge Information - %1 %2",array($judgeinfo->firstname,$judgeinfo->lastname))); send_popup_header(i18n("Judge Information - %1 %2",array($judgeinfo->firstname,$judgeinfo->lastname)));
echo "Complete for {$config['FAIRYEAR']}: ".(($judgeinfo->complete=="yes") ? "Yes" : "No");
echo "<br />";
echo "<h3>".i18n("Personal Info")."</h3>"; echo "<h3>".i18n("Personal Info")."</h3>";
echo "<table class=\"viewtable\">\n"; echo "<table class=\"viewtable\">\n";

View File

@ -77,11 +77,12 @@ function openjudgeinfo(id)
switch($show_what) { switch($show_what) {
case "all": case "all":
$editor->additionalListTableLeftJoin("judges_years", "judges_years.judges_id=judges.id");
$editor->filterList("(judges_years.year={$config['FAIRYEAR']} OR judges_years.year IS NULL)");
break; break;
case "cy_active": case "cy_active":
$editor->additionalListTable("judges_years"); $editor->additionalListTableLeftJoin("judges_years", "judges_years.judges_id=judges.id");
$editor->filterList("judges_years.judges_id=judges.id"); $editor->filterList("(judges_years.year={$config['FAIRYEAR']})");
$editor->filterList("judges_years.year={$config['FAIRYEAR']}");
break; break;
case "cy_complete": case "cy_complete":
$editor->additionalListTable("judges_years"); $editor->additionalListTable("judges_years");

View File

@ -74,8 +74,8 @@ function tableEditorSetup($editor)
$l = array( 'id' => 'ID', $l = array( 'id' => 'ID',
'firstname' => 'First Name', 'firstname' => 'First Name',
'lastname' => 'Last Name', 'lastname' => 'Last Name',
'complete' => 'Complete' 'complete' => 'Complete',
'year' => 'Year',
); );
/* Most of these should be moved to the base class, as they /* Most of these should be moved to the base class, as they
@ -83,12 +83,17 @@ function tableEditorSetup($editor)
$e = array_merge($judges_fields, $e = array_merge($judges_fields,
array( 'language' => 'Language(s)', array( 'language' => 'Language(s)',
)); ));
$e = array_merge($e, $catf); $e = array_merge($e, $catf);
$editor->setTable('judges'); $editor->setTable('judges');
$editor->setListFields($l); $editor->setListFields($l);
$editor->setEditFields($e); $editor->setEditFields($e);
$editor->setFieldOptions('complete', array(
array('key' => 'yes', 'val' => 'Yes'),
array('key' => 'no', 'val' => 'No')));
$editor->setFieldOptions('year', array(
array('key' => 'NULL', 'val' => 'Inactive'),
array('key' => $config['FAIRYEAR'], 'val' => $config['FAIRYEAR'])));
// print_r($e); // print_r($e);
print("<br>\n"); print("<br>\n");

View File

@ -278,7 +278,11 @@ class TableEditor
function additionalListTable($t) function additionalListTable($t)
{ {
$this->additionalListTables[]=$t; $this->additionalListTables[]=",`$t`";
}
function additionalListTableLeftJoin($t,$on)
{
$this->additionalListTables[]=" LEFT JOIN `$t` ON $on ";
} }
function setUploadPath($p) function setUploadPath($p)
@ -883,7 +887,7 @@ class TableEditor
if(count($this->additionalListTables)) { if(count($this->additionalListTables)) {
foreach($this->additionalListTables as $t) { foreach($this->additionalListTables as $t) {
$query .= ",`$t`"; $query .= "$t ";
} }
} }
@ -1110,7 +1114,12 @@ class TableEditor
//now the default action buttons that you cant get rid of :) //now the default action buttons that you cant get rid of :)
echo "<a title=\"Edit this ".$this->recordType."\" href=\"{$_SERVER['PHP_SELF']}?TableEditorAction=edit&amp;edit=".$r->$pk."\"><img src=\"$icon_path/edit.$icon_extension\" border=0></a>"; echo "<a title=\"Edit this ".$this->recordType."\" href=\"{$_SERVER['PHP_SELF']}?TableEditorAction=edit&amp;edit=".$r->$pk."\"><img src=\"$icon_path/edit.$icon_extension\" border=0></a>";
echo "&nbsp;&nbsp;"; echo "&nbsp;&nbsp;";
echo "<a title=\"Delete this ".$this->recordType."\" onclick=\"return confirmClick('".i18n("Are you sure you want to delete this %1?",array($this->recordType))."')\" href=\"{$_SERVER['PHP_SELF']}?TableEditorAction=delete&amp;delete=".$r->$pk."\"><img src=\"$icon_path/button_cancel.$icon_extension\" border=0></a>"; if($this->deleteTitle) {
$title = $this->deleteTitle;
} else {
$title = "Delete this ".$this->recordType;
}
echo "<a title=\"$title\" onclick=\"return confirmClick('".i18n("Are you sure you want to delete this %1?",array($this->recordType))."')\" href=\"{$_SERVER['PHP_SELF']}?TableEditorAction=delete&amp;delete=".$r->$pk."\"><img src=\"$icon_path/button_cancel.$icon_extension\" border=0></a>";
echo "</nobr></td>"; echo "</nobr></td>";
echo "</tr>"; echo "</tr>";
} }