Implement fair name/logo as fields in a report instead of special

options.  This way, the logo/fairname can be moved around and
resized.   Ensure those fields exist in each report.  Convert name/logo
preferences in all existing reports, and adjust the yloc/height of
existing fields to make way for the headers if they exist.
This commit is contained in:
dave 2010-06-09 07:43:59 +00:00
parent a46cb110ca
commit 0567451a58
15 changed files with 490 additions and 85 deletions

View File

@ -66,12 +66,6 @@
$report_options['field_box'] = array('desc' => 'Draw a box around each text field on the label', $report_options['field_box'] = array('desc' => 'Draw a box around each text field on the label',
'values' => array('no'=>'No', 'yes'=>'Yes') 'values' => array('no'=>'No', 'yes'=>'Yes')
); );
$report_options['label_fairname'] = array('desc' => 'Print the fair name at the top of each label',
'values' => array('no'=>'No', 'yes'=>'Yes')
);
$report_options['label_logo'] = array('desc' => 'Print the fair logo at the top of each label',
'values' => array('no'=>'No', 'yes'=>'Yes')
);
$report_options['default_font_size'] = array('desc' => 'Default font size to use in the report', $report_options['default_font_size'] = array('desc' => 'Default font size to use in the report',
'values' => array( 'values' => array(
'10'=>'10', '10'=>'10',
@ -525,18 +519,15 @@ foreach($report_stock as $n=>$v) {
break; break;
case 'label': case 'label':
case 'tcpdf_label':
$label_stock = $report_stock[$report['option']['stock']]; $label_stock = $report_stock[$report['option']['stock']];
$show_box = ($report['option']['label_box'] == 'yes') ? true : false; $show_box = ($report['option']['label_box'] == 'yes') ? true : false;
$show_fair = ($report['option']['label_fairname'] == 'yes') ? true : false;
$show_logo = ($report['option']['label_logo'] == 'yes') ? true : false;
$rep=new pdf($report['name'], $label_stock['page_format'], $label_stock['page_orientation']); $rep=new pdf($report['name'], $label_stock['page_format'], $label_stock['page_orientation']);
$rep->setup_for_labels($show_box, $show_fair, $show_logo, $rep->setup_for_labels($show_box, $show_fair, $show_logo,
$label_stock['label_width'], $label_stock['label_height'], $label_stock['label_width'], $label_stock['label_height'],
$label_stock['x_spacing'], $label_stock['y_spacing'], $label_stock['x_spacing'], $label_stock['y_spacing'],
$label_stock['rows'], $label_stock['cols']); $label_stock['rows'], $label_stock['cols']);
$gen_mode = 'tcpdf_label'; $gen_mode = 'label';
break; break;
case 'pdf': case '': case 'pdf': case '':
@ -784,11 +775,6 @@ foreach($report_stock as $n=>$v) {
$data = array(); $data = array();
if($gen_mode == 'label') { if($gen_mode == 'label') {
$show_box = ($report['option']['label_box'] == 'yes') ? true : false;
$show_fair = ($report['option']['label_fairname'] == 'yes') ? true : false;
$show_logo = ($report['option']['label_logo'] == 'yes') ? true : false;
$rep->newLabel($show_box, $show_fair, $show_logo);
} else if($gen_mode == 'tcpdf_label') {
$rep->label_new(); $rep->label_new();
} }
@ -806,21 +792,27 @@ foreach($report_stock as $n=>$v) {
} }
if($gen_mode == 'table') { if($gen_mode == 'table') {
$data[] = $v; $data[] = $v;
} else if($gen_mode == 'tcpdf_label') { } else if($gen_mode == 'label') {
/* Setup additional options */ /* Setup additional options */
$show_box = ($report['option']['field_box'] == 'yes') ? true : false; $show_box = ($report['option']['field_box'] == 'yes') ? true : false;
// echo "<pre>"; print_r($d); // echo "<pre>"; print_r($d);
if($f == 'static_box') { switch($f) {
case 'static_box':
$rep->label_rect($d['x'], $d['y'], $d['w'], $d['h']); $rep->label_rect($d['x'], $d['y'], $d['w'], $d['h']);
} else { break;
if($f == 'static_text') $v = $d['value']; case 'fair_logo':
$rep->label_fair_logo($d['x'], $d['y'], $d['w'], $d['h'], $show_box);
break;
default:
if($f == 'static_text') $v = $d['value'];
$rep->label_text($d['x'], $d['y'], $d['w'], $d['h'], $rep->label_text($d['x'], $d['y'], $d['w'], $d['h'],
$v, $show_box, $d['align'], $d['valign'], $v, $show_box, $d['align'], $d['valign'],
$d['fontname'],$d['fontstyle'],$d['fontsize'], $d['fontname'],$d['fontstyle'],$d['fontsize'],
$d['on_overflow']); $d['on_overflow']);
break;
} }
} }

View File

@ -343,6 +343,25 @@ $report_awards_fields = array(
)", )",
'components' => array('prizes')), 'components' => array('prizes')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
); );

View File

@ -23,6 +23,7 @@
$report_committees_fields = array( $report_committees_fields = array(
'name' => array( 'name' => array(
'start_option_group' => 'Committee Member Name',
'name' => 'Committee Member -- Full Name ', 'name' => 'Committee Member -- Full Name ',
'header' => 'Name', 'header' => 'Name',
'width' => 44.45 /*mm*/, 'width' => 44.45 /*mm*/,
@ -42,6 +43,7 @@ $report_committees_fields = array(
'table' => 'users.firstname' ), 'table' => 'users.firstname' ),
'email' => array( 'email' => array(
'start_option_group' => 'Committee Member Contact Information',
'name' => 'Committee Member -- Email', 'name' => 'Committee Member -- Email',
'header' => 'Email', 'header' => 'Email',
'width' => 50.8 /*mm*/, 'width' => 50.8 /*mm*/,
@ -90,6 +92,7 @@ $report_committees_fields = array(
'table' => 'users.postalcode' ), 'table' => 'users.postalcode' ),
'organization' => array( 'organization' => array(
'start_option_group' => 'Committee Member Misc.',
'name' => 'Committee Member -- Organization', 'name' => 'Committee Member -- Organization',
'header' => 'Organization', 'header' => 'Organization',
'width' => 50.8 /*mm*/, 'width' => 50.8 /*mm*/,
@ -109,11 +112,34 @@ $report_committees_fields = array(
'table' => 'users.cpr', 'table' => 'users.cpr',
'value_map' =>array ('no' => 'no', 'yes' => 'YES')), 'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
'static_text' => array( 'static_text' => array(
'start_option_group' => 'Special Fields',
'name' => 'Static Text (useful for labels)', 'name' => 'Static Text (useful for labels)',
'header' => '', 'header' => '',
'width' => 2.54 /*mm*/, 'width' => 2.54 /*mm*/,
'table' => "CONCAT(' ')"), 'table' => "CONCAT(' ')"),
); );
function report_committees_fromwhere($report, $components) function report_committees_fromwhere($report, $components)

View File

@ -421,10 +421,8 @@ $doCanvasSample = false;
} }
echo "<table>";
$x=0; $x=0;
if($report['option']['type'] == 'label') { if($report['option']['type'] == 'label') {
$fontlist = array('' => 'Default'); $fontlist = array('' => 'Default');
$fl = PDF::getFontList(); $fl = PDF::getFontList();
@ -433,8 +431,7 @@ $doCanvasSample = false;
foreach($report['col'] as $o=>$d) { foreach($report['col'] as $o=>$d) {
$f = $d['field']; $f = $d['field'];
echo "<tr><td align=\"right\">Loc ".($o+1).": </td>"; echo "<b>{$fields[$d['field']]['name']}: </b><br/>";
echo "<td>";
$script=""; $script="";
foreach($locs as $k=>$v) { foreach($locs as $k=>$v) {
echo "$k=<input type=\"text\" size=\"5\" name=\"col[$x][$v]\" value=\"{$d[$v]}\">"; echo "$k=<input type=\"text\" size=\"5\" name=\"col[$x][$v]\" value=\"{$d[$v]}\">";
@ -465,11 +462,10 @@ $doCanvasSample = false;
echo "<script type=\"text/javascript\">createData({$script}'{$d['align']}','{$d['valign']}','{$d['fontname']}','{$d['fontstyle']}','{$d['fontsize']}','{$canvasLabels[$x]}')</script>\n"; echo "<script type=\"text/javascript\">createData({$script}'{$d['align']}','{$d['valign']}','{$d['fontname']}','{$d['fontstyle']}','{$d['fontsize']}','{$canvasLabels[$x]}')</script>\n";
$x++; $x++;
echo '<br/><br/></td></tr>'; echo '<br/><br/>';
} }
for(;$x<$n_columns;$x++) { for(;$x<$n_columns;$x++) {
echo "<tr><td align=\"right\">Loc ".($x+1).": </td>"; echo "<b>New Field ".($x+1).": </b><br/> ";
echo "<td>";
foreach($locs as $k=>$v) { foreach($locs as $k=>$v) {
echo "$k=<input type=\"text\" size=\"5\" name=\"col[$x][$v]\" value=\"0\">"; echo "$k=<input type=\"text\" size=\"5\" name=\"col[$x][$v]\" value=\"0\">";
} }
@ -490,10 +486,9 @@ $doCanvasSample = false;
selector("col[$x][on_overflow]", array('nothing'=>'Nothing (overflow the box)', 'truncate'=>'Truncate','...'=>'Truncate and add ellipses (...)', 'scale'=>'Scale'),'truncate'); selector("col[$x][on_overflow]", array('nothing'=>'Nothing (overflow the box)', 'truncate'=>'Truncate','...'=>'Truncate and add ellipses (...)', 'scale'=>'Scale'),'truncate');
echo "<input type=\"hidden\" name=\"col[$x][value]\" value=\"\">"; echo "<input type=\"hidden\" name=\"col[$x][value]\" value=\"\">";
echo "<br/><br/></td></tr>"; echo "<br/><br/>";
} }
} }
echo "</table>\n";
echo "<h4>Grouping</h4>"; echo "<h4>Grouping</h4>";
for($x=0;$x<2;$x++) { for($x=0;$x<2;$x++) {
echo "Group By".($x + 1).": "; echo "Group By".($x + 1).": ";

View File

@ -22,13 +22,15 @@
$report_fairs_fields = array( $report_fairs_fields = array(
'fair_name' => array( 'fairinfo_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Fair Name', 'name' => 'Fair -- Fair Name',
'header' => 'Name', 'header' => 'Name',
'width' => 38.1 /*mm*/, 'width' => 38.1 /*mm*/,
'table' => 'fairs.name'), 'table' => 'fairs.name'),
'fairstats_year' => array ( 'fairstats_year' => array (
'start_option_group' => 'Fair Statistics',
'name' => 'Fair Stats -- Year', 'name' => 'Fair Stats -- Year',
'header' => 'Year', 'header' => 'Year',
'width' => 25.4 /*mm*/, 'width' => 25.4 /*mm*/,
@ -388,6 +390,25 @@ $report_fairs_fields = array(
'table' => 'fairs_stats.delegate4_size', 'table' => 'fairs_stats.delegate4_size',
'components' => array('fairs_stats')), 'components' => array('fairs_stats')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Local Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
'static_text' => array ( 'static_text' => array (
'name' => 'Static Text (useful for labels)', 'name' => 'Static Text (useful for labels)',

View File

@ -152,6 +152,26 @@ $report_fundraisings_fields = array(
'width' => 2.54 /*mm*/, 'width' => 2.54 /*mm*/,
'table' => "CONCAT(' ')"), 'table' => "CONCAT(' ')"),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
); );
function report_fundraisings_fromwhere($report, $components) function report_fundraisings_fromwhere($report, $components)

View File

@ -259,6 +259,7 @@ function report_judges_time_availability(&$report, $field, $text)
$report_judges_fields = array( $report_judges_fields = array(
'last_name' => array( 'last_name' => array(
'start_option_group' => 'Judge Name Information',
'name' => 'Judge -- Last Name', 'name' => 'Judge -- Last Name',
'header' => 'Last Name', 'header' => 'Last Name',
'width' => 25.4 /*mm*/, 'width' => 25.4 /*mm*/,
@ -285,6 +286,7 @@ $report_judges_fields = array(
'table_sort'=> 'users.lastname' ), 'table_sort'=> 'users.lastname' ),
'email' => array( 'email' => array(
'start_option_group' => 'Judge Contact Information',
'name' => 'Judge -- Email', 'name' => 'Judge -- Email',
'header' => 'Email', 'header' => 'Email',
'width' => 50.8 /*mm*/, 'width' => 50.8 /*mm*/,
@ -333,6 +335,7 @@ $report_judges_fields = array(
'table' => 'users.organization'), 'table' => 'users.organization'),
'languages' => array( 'languages' => array(
'start_option_group' => 'Judge Judging Preferences',
'name' => 'Judge -- Languages', 'name' => 'Judge -- Languages',
'header' => 'Lang', 'header' => 'Lang',
'width' => 19.05 /*mm*/, 'width' => 19.05 /*mm*/,
@ -340,21 +343,13 @@ $report_judges_fields = array(
'exec_function' => 'report_judges_languages', 'exec_function' => 'report_judges_languages',
'components' => array('users_judge')), 'components' => array('users_judge')),
'complete' => array( 'captain' => array(
'name' => 'Judge -- Registration Complete', 'name' => 'Judge Team -- Team Captain? (Is the judge the captain? Yes/No)',
'header' => 'Cmpl', 'header' => 'Cptn',
'width' => 10.16 /*mm*/, 'width' => 12.7 /*mm*/,
'table' => 'users_judge.judge_complete', 'table' => 'judges_teams_link.captain',
'value_map' => array ('no' => 'No', 'yes' => 'Yes'), 'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
'components' => array('users_judge')), 'components' => array('teams')),
'active' => array(
'name' => 'Judge -- Registration Active for this year',
'header' => 'Act',
'width' => 10.16 /*mm*/,
'table' => 'users_judge.judge_active',
'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
'components' => array('users_judge')),
'willing_chair' => array( 'willing_chair' => array(
'name' => 'Judge -- Willing Chair', 'name' => 'Judge -- Willing Chair',
@ -364,7 +359,15 @@ $report_judges_fields = array(
'value_map' => array ('no' => 'No', 'yes' => 'Yes'), 'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
'components' => array('users_judge')), 'components' => array('users_judge')),
'special_award_only' => array(
'name' => 'Judge -- Special Award Only Requested',
'header' => 'SA Only',
'width' => 20.32 /*mm*/,
'table' => 'users_judge.special_award_only',
'components' => array('users_judge')),
'years_school' => array( 'years_school' => array(
'start_option_group' => 'Judge Experience',
'name' => 'Judge -- Years of Experience at School level', 'name' => 'Judge -- Years of Experience at School level',
'header' => 'Sch', 'header' => 'Sch',
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
@ -458,6 +461,7 @@ $report_judges_fields = array(
/* Category preferences */ /* Category preferences */
'cats_at_pref_H' => array( 'cats_at_pref_H' => array(
'start_option_group' => 'Judge Judging Division/Category Preferences',
'name' => 'Judge -- Age Categories Selected as Preference: Highest (Shortform)', 'name' => 'Judge -- Age Categories Selected as Preference: Highest (Shortform)',
'header' => 'Highest', 'header' => 'Highest',
'width' => 20.32 /*mm*/, 'width' => 20.32 /*mm*/,
@ -602,11 +606,22 @@ $report_judges_fields = array(
/* Others */ /* Others */
'special_award_only' => array(
'name' => 'Judge -- Special Award Only Requested', 'complete' => array(
'header' => 'SA Only', 'start_option_group' => 'Judge Miscellaneous',
'width' => 20.32 /*mm*/, 'name' => 'Judge -- Registration Complete',
'table' => 'users_judge.special_award_only', 'header' => 'Cmpl',
'width' => 10.16 /*mm*/,
'table' => 'users_judge.judge_complete',
'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
'components' => array('users_judge')),
'active' => array(
'name' => 'Judge -- Registration Active for this year',
'header' => 'Act',
'width' => 10.16 /*mm*/,
'table' => 'users_judge.judge_active',
'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
'components' => array('users_judge')), 'components' => array('users_judge')),
'year' => array( 'year' => array(
@ -615,15 +630,9 @@ $report_judges_fields = array(
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
'table' => 'users.year'), 'table' => 'users.year'),
'captain' => array(
'name' => 'Judge Team -- Team Captain? (Is the judge the captain? Yes/No)',
'header' => 'Cptn',
'width' => 12.7 /*mm*/,
'table' => 'judges_teams_link.captain',
'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
'components' => array('teams')),
'team' => array( 'team' => array(
'start_option_group' => 'Judge Team Information',
'name' => 'Judge Team -- Name', 'name' => 'Judge Team -- Name',
'header' => 'Team Name', 'header' => 'Team Name',
'width' => 76.2 /*mm*/, 'width' => 76.2 /*mm*/,
@ -671,6 +680,7 @@ $report_judges_fields = array(
'components' => array('teams')), 'components' => array('teams')),
'project_pn' => array( 'project_pn' => array(
'start_option_group' => 'Judge Projects being Judged Information',
'name' => 'Project -- Number', 'name' => 'Project -- Number',
'header' => 'Number', 'header' => 'Number',
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
@ -741,6 +751,7 @@ $report_judges_fields = array(
'table' => '""' ), 'table' => '""' ),
'question_1' => array( 'question_1' => array(
'start_option_group' => 'Judge Custom Questions',
'name' => 'Judge -- Custom Judge Registration Question 1', 'name' => 'Judge -- Custom Judge Registration Question 1',
'header' => 'Q1', 'header' => 'Q1',
'width' => 25.4 /*mm*/, 'width' => 25.4 /*mm*/,
@ -820,7 +831,28 @@ $report_judges_fields = array(
'editor_disabled' => true, 'editor_disabled' => true,
'exec_function' => 'report_judges_custom_question'), 'exec_function' => 'report_judges_custom_question'),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
'static_text' => array( 'static_text' => array(
'start_option_group' => 'Special Fields',
'name' => 'Static Text (useful for labels)', 'name' => 'Static Text (useful for labels)',
'header' => '', 'header' => '',
'width' => 2.54 /*mm*/, 'width' => 2.54 /*mm*/,

View File

@ -63,6 +63,7 @@ function reports_schools_shemail(&$report, $field, $text)
$report_schools_fields = array( $report_schools_fields = array(
'school' => array( 'school' => array(
'start_option_group' => 'School Information',
'name' => 'School -- Name', 'name' => 'School -- Name',
'header' => 'School Name', 'header' => 'School Name',
'width' => 57.15 /*mm*/, 'width' => 57.15 /*mm*/,
@ -175,6 +176,7 @@ $report_schools_fields = array(
'exec_function' => 'reports_schools_shemail'), 'exec_function' => 'reports_schools_shemail'),
'school_accesscode' => array( 'school_accesscode' => array(
'start_option_group' => 'Access Codes',
'name' => 'School -- Access Code', 'name' => 'School -- Access Code',
'header' => 'Access Code', 'header' => 'Access Code',
'width' => 27.94 /*mm*/, 'width' => 27.94 /*mm*/,
@ -187,6 +189,7 @@ $report_schools_fields = array(
'table' => 'schools.registration_password' ), 'table' => 'schools.registration_password' ),
'school_project_limit' => array( 'school_project_limit' => array(
'start_option_group' => 'Project Limits',
'name' => 'School -- Project Limit', 'name' => 'School -- Project Limit',
'header' => 'Limit', 'header' => 'Limit',
'width' => 19.05 /*mm*/, 'width' => 19.05 /*mm*/,
@ -198,6 +201,27 @@ $report_schools_fields = array(
'width' => 25.4 /*mm*/, 'width' => 25.4 /*mm*/,
'table' => 'schools.projectlimitper' ), 'table' => 'schools.projectlimitper' ),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
); );
function report_schools_fromwhere($report, $components) function report_schools_fromwhere($report, $components)

View File

@ -808,6 +808,12 @@ $report_students_fields = array(
'width' => 76.2 /*mm*/, 'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"), 'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
/* Special/Misc/Other */ /* Special/Misc/Other */
'static_text' => array ( 'static_text' => array (
'start_option_group' => 'Special Fields', 'start_option_group' => 'Special Fields',

View File

@ -23,6 +23,7 @@
$report_tours_fields = array( $report_tours_fields = array(
'tour_name' => array( 'tour_name' => array(
'start_option_group' => 'Tour Information',
'name' => 'Tour -- Name', 'name' => 'Tour -- Name',
'header' => 'Tour Name', 'header' => 'Tour Name',
'width' => 76.2 /*mm*/, 'width' => 76.2 /*mm*/,
@ -76,6 +77,27 @@ $report_tours_fields = array(
'width' => 10.16 /*mm*/, 'width' => 10.16 /*mm*/,
'table' => 'tours.id' ), 'table' => 'tours.id' ),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"),
'fair_logo' => array(
'name' => 'Fair -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
); );
function report_tours_fromwhere($report, $components) function report_tours_fromwhere($report, $components)

View File

@ -24,6 +24,7 @@
$report_volunteers_fields = array( $report_volunteers_fields = array(
'last_name' => array( 'last_name' => array(
'start_option_group' => 'Volunteer Name Information',
'name' => 'Volunteer -- Last Name', 'name' => 'Volunteer -- Last Name',
'header' => 'Last Name', 'header' => 'Last Name',
'width' => 25.4 /*mm*/, 'width' => 25.4 /*mm*/,
@ -50,6 +51,7 @@ $report_volunteers_fields = array(
'table_sort'=> 'users.lastname' ), 'table_sort'=> 'users.lastname' ),
'email' => array( 'email' => array(
'start_option_group' => 'Volunteer Contact Information',
'name' => 'Volunteer -- Email', 'name' => 'Volunteer -- Email',
'header' => 'Email', 'header' => 'Email',
'width' => 44.45 /*mm*/, 'width' => 44.45 /*mm*/,
@ -74,6 +76,7 @@ $report_volunteers_fields = array(
'table' => 'users.organization'), 'table' => 'users.organization'),
'firstaid' => array( 'firstaid' => array(
'start_option_group' => 'Volunteer Miscellaneous',
'name' => 'Volunteer -- First Aid Training', 'name' => 'Volunteer -- First Aid Training',
'header' => 'F.Aid', 'header' => 'F.Aid',
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
@ -102,19 +105,28 @@ $report_volunteers_fields = array(
'table' => 'volunteer_positions.name', 'table' => 'volunteer_positions.name',
'components' => array('signup')), 'components' => array('signup')),
/* The label system depends on each report type having fair_name and fair_logo */
'fair_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'fair_year' => array ( 'fair_year' => array (
'name' => 'Fair -- Year', 'name' => 'Fair -- Year',
'header' => 'Year', 'header' => 'Year',
'width' => 12.7 /*mm*/, 'width' => 12.7 /*mm*/,
'table' => "{$config['FAIRYEAR']}"), 'table' => "{$config['FAIRYEAR']}"),
'fair_name' => array ( 'fair_logo' => array(
'name' => 'Fair -- Name', 'name' => 'Fair -- Logo (for Labels only)',
'header' => 'Fair Name', 'header' => '',
'width' => 76.2 /*mm*/, 'width' => 1 /*mm*/,
'table' => "'".mysql_escape_string($config['fairname'])."'"), 'table' => "CONCAT(' ')"),
'static_text' => array ( 'static_text' => array (
'start_option_group' => 'Special Fields',
'name' => 'Static Text (useful for labels)', 'name' => 'Static Text (useful for labels)',
'header' => '', 'header' => '',
'width' => 2.54 /*mm*/, 'width' => 2.54 /*mm*/,

View File

@ -1 +1 @@
174 175

243
db/db.update.175.php Normal file
View File

@ -0,0 +1,243 @@
<?
/* Copy of report_stock as it exists for this update */
$report_stock = array();
$report_stock['fullpage'] = array('name' => 'Letter 8.5 x 11 (3/4" margin)',
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 177.8,
'label_height' => 241.3,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['fullpage_landscape'] = array('name' => 'Letter 8.5 x 11 Landscape (3/4" margin)',
'page_format' => 'LETTER',
'page_orientation' => 'L',
'label_width' => 241.3,
'label_height' => 177.8,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['fullpage_full'] = array('name' => 'Letter 8.5 x 11 (no margin)',
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 215.9,
'label_height' => 279.4,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['fullpage_landscape_full'] = array('name' => 'Letter 8.5 x 11 Landscape (no margin)',
'page_format' => 'LETTER',
'page_orientation' => 'L',
'label_width' => 279.4,
'label_height' => 215.9,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['5161'] = array('name' => 'Avery 5161/5261/5961/8161, G&T 99189 (1"x4")',
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.6,
'label_height' => 25.4,
'x_spacing' => 3.81,
'y_spacing' => 0.00,
'cols' => 2,
'rows' => 10,
);
$report_stock['5162'] = array('name' => 'Avery 5162/5262/5962/8162/8462, G&T 99190 (1 1/3"x4")',
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.35,
'label_height' => 33.6804,
'x_spacing' => 4.7498,
'y_spacing' => 0.00,
'cols' => 2,
'rows' => 7,
);
$report_stock['5163'] = array('name' => 'Avery 5163/5263/5963/8163/8463, G&T 99181 (2"x4")',
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.6,
'label_height' => 50.8,
'x_spacing' => 4.3663,
'y_spacing' => 0.00,
'cols' => 2,
'rows' => 5,
);
$report_stock['5164'] = array('name' => 'Avery 5164/5264/5964/8164, G&T 99763 (4"x3 1/3")',
'page_format' => 'LETTER', /* tcpdf format */
'page_orientation' => 'P', /* tcpdf orientation */
'label_width' => 101.6,
'label_height' => 84.6667,
'x_spacing' => 4.7625,
'y_spacing' => 0,
'cols' => 2,
'rows' => 3,
);
$report_stock['nametag'] = array('name' => 'Cards 4"x3"',
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.6,
'label_height' => 76.2,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 2,
'rows' => 3,
);
$report_stock['letter_4up'] = array('name' => 'Fullpage, 4up',
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.6,
'label_height' => 127.0,
'x_spacing' => 0.25,
'y_spacing' => 0.25,
'cols' => 2,
'rows' => 2,
);
$report_stock['ledger'] = array('name' => 'Ledger/Tabloid 11 x 17',
'page_format' => 'TABLOID',
'page_orientation' => 'P',
'label_width' => 279.4,
'label_height' => 431.8,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['ledger_landscape'] = array('name' => 'Ledger/Tabloid 11 x 17 Landscape',
'page_format' => 'TABLOID',
'page_orientation' => 'L',
'label_width' => 431.8,
'label_height' => 279.4,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
function db_update_175_pre()
{
global $report_stock;
/* Fix the fair_name for report_type = fair */
$q = mysql_query("SELECT id FROM reports WHERE `type`='fair'");
while(($f = mysql_fetch_assoc($q))) {
$id = $f['id'];
mysql_query("UPDATE reports_items SET `field`='fairinfo_name' WHERE `field`='fair_name' AND reports_id='$id'");
}
/* Load all labels */
$q = mysql_query("SELECT reports_id FROM reports_items WHERE `type`='option' AND `field`='type' AND `value`='label'");
while(($r = mysql_fetch_assoc($q))) {
$id = $r['reports_id'];
$qq = mysql_query("SELECT * FROM reports_items WHERE `type`='option' AND `field`='stock' AND reports_id='$id'");
if(mysql_num_rows($qq) != 1) {
$stock = $report_stock['5164'];
} else {
$s = mysql_fetch_assoc($qq);
$stock = $report_stock[$s['value']];
}
/* Get options: label_fairname and label_logo*/
$use_name = false;
$name = '';
$qq = mysql_query("SELECT * FROM reports_items WHERE `type`='option' AND `field`='label_fairname' AND reports_id='$id'");
if(mysql_num_rows($qq) == 1) {
$name = mysql_fetch_assoc($qq);
$use_name = ($name['value'] == 'yes') ? true : false;
}
$use_logo = false;
$logo = '';
$qq = mysql_query("SELECT * FROM reports_items WHERE `type`='option' AND `field`='label_logo' AND reports_id='$id'");
if(mysql_num_rows($qq) == 1) {
$logo = mysql_fetch_assoc($qq);
$use_logo = ($logo['value'] == 'yes') ? true : false;
}
/* Compute logo size if needed */
if($use_logo) {
$logo_w = $stock['label_width'] * 0.2;
$logo_h = $stock['label_height'] * 0.2;
if($logo_w < $logo_h) $logo_h = $logo_w;
else $logo_w = $logo_h;
$logo_x = 1;
$logo_y = 1;
} else {
$logo_x = 0;
$logo_y = 0;
$logo_w = 0;
$logo_h = 0;
}
/* Compute name size if needed */
if($use_name) {
$name_x = $logo_x + $logo_w + 1;
$name_y = 1;
$name_w = $stock['label_width'] - 1 - $logo_x - $logo_w;
$name_h = ($logo_h == 0) ? ($stock['label_height'] * 0.2) : $logo_h;
$cMargin = 1; /* TCPDF's cmargin is 1mm */
$name_fs = ((($name_h / 3) - $cMargin) / 25.4) * 72;
} else {
$name_x=0;
$name_y=0;
$name_w=0;
$name_h=0;
$name_fs=0;
}
if($use_name || $use_logo) {
$toph = ($logo_h == 0) ? $name_h : $logo_h;
/* Scale all other cols */
$qq = mysql_query("SELECT * FROM reports_items WHERE `type`='col' AND reports_id='$id'");
$ord = 0;
while(($col = mysql_fetch_assoc($qq))) {
$scale = 1 - ($toph / $stock['label_height']);
$y = $toph + ($col['y'] * $scale);
$h = $col['h'] * $scale;
$fs = $col['fontsize'] * $scale;
mysql_query("UPDATE reports_items SET `y`='$y', `h`='$h', `fontsize`='$fs'
WHERE id='{$col['id']}'");
if($col['ord'] > $ord) $ord = $col['ord'];
}
/* Update items */
if(is_array($name)) {
$ord++;
mysql_query("UPDATE reports_items SET `type`='col', `field`='fair_name',
x='$name_x', y='$name_y', w='$name_w', h='$name_h',
fontsize='$name_fs', `ord`='$ord',
align='left', valign='middle'
WHERE id='{$name['id']}'");
}
if(is_array($logo)) {
$ord++;
mysql_query("UPDATE reports_items SET `type`='col', `field`='fair_logo',
x='$logo_x', y='$logo_y', w='$logo_w', h='$logo_h',`ord`='$ord'
WHERE id='{$logo['id']}'");
}
}
}
}
?>

2
db/db.update.175.sql Normal file
View File

@ -0,0 +1,2 @@
DELETE FROM `reports_items` WHERE `type`='option' AND `field`='label_fairname';
DELETE FROM `reports_items` WHERE `type`='option' AND `field`='label_logo';

View File

@ -341,25 +341,6 @@ class pdf extends TCPDF {
if($this->label_show_box) if($this->label_show_box)
$this->label_rect(0,0,$this->label_width, $this->label_height); $this->label_rect(0,0,$this->label_width, $this->label_height);
$w = $this->label_width * 0.2;
$h = $this->label_height * 0.2;
if($w < $h) $h = $w;
else $w = $h;
if($this->label_show_logo) {
$img_dir = $_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY'].'/data';
/* Scale image to proportinally fit in w x h */
$this->Image("$img_dir/logo.jpg", $this->lMargin + 1, $this->tMargin + 1,
$w, $h, '', '', '', true,
300, '', false, false, 0, true);
}
if($this->label_show_fair) {
$this->SetXY($this->lMargin + $w + 2, $this->tMargin + 1);
$this->SetFontSize(((($h / 2) - $this->cMargin) / 25.4) * 72);
$this->FitCell($this->label_width - $w - 2, $this->label_height *0.2,
$config['fairname'], 0, 0, 'L', 'M', 'scale');
}
} }
@ -415,6 +396,16 @@ class pdf extends TCPDF {
$this->Rect($this->lMargin + $x, $this->tMargin + $y, $w, $h); $this->Rect($this->lMargin + $x, $this->tMargin + $y, $w, $h);
} }
function label_fair_logo($x, $y, $w, $h, $show_box)
{
global $config;
$img_dir = $_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY'].'/data';
/* Scale image to proportinally fit in w x h */
$this->Image("$img_dir/logo.jpg", $this->lMargin + $x, $this->tMargin + $y,
$w, $h, '', '', '', true,
300, '', false, false, $show_box ? 1 : 0, true);
}
/**************************************************************************** /****************************************************************************
* Table handling */ * Table handling */
function hr() function hr()