diff --git a/admin/reports.inc.php b/admin/reports.inc.php index a044999..5e82719 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -66,12 +66,6 @@ $report_options['field_box'] = array('desc' => 'Draw a box around each text field on the label', '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', 'values' => array( '10'=>'10', @@ -525,18 +519,15 @@ foreach($report_stock as $n=>$v) { break; case 'label': - case 'tcpdf_label': $label_stock = $report_stock[$report['option']['stock']]; $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->setup_for_labels($show_box, $show_fair, $show_logo, $label_stock['label_width'], $label_stock['label_height'], $label_stock['x_spacing'], $label_stock['y_spacing'], $label_stock['rows'], $label_stock['cols']); - $gen_mode = 'tcpdf_label'; + $gen_mode = 'label'; break; case 'pdf': case '': @@ -784,11 +775,6 @@ foreach($report_stock as $n=>$v) { $data = array(); 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(); } @@ -806,21 +792,27 @@ foreach($report_stock as $n=>$v) { } if($gen_mode == 'table') { $data[] = $v; - } else if($gen_mode == 'tcpdf_label') { + } else if($gen_mode == 'label') { /* Setup additional options */ $show_box = ($report['option']['field_box'] == 'yes') ? true : false; // echo "
"; print_r($d);
 
-				if($f == 'static_box') {
+				switch($f) {
+				case 'static_box':
 					$rep->label_rect($d['x'], $d['y'], $d['w'], $d['h']);
-				} else {
+					break;
+				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'],
 							$v, $show_box, $d['align'], $d['valign'],
 							$d['fontname'],$d['fontstyle'],$d['fontsize'],
 							$d['on_overflow']);
+					break;
 				}
 
 			}
diff --git a/admin/reports_awards.inc.php b/admin/reports_awards.inc.php
index f4f975c..b9c92ae 100644
--- a/admin/reports_awards.inc.php
+++ b/admin/reports_awards.inc.php
@@ -343,6 +343,25 @@ $report_awards_fields = array(
 				)",
 		'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(' ')"),
 
 );
 
diff --git a/admin/reports_committees.inc.php b/admin/reports_committees.inc.php
index 6176678..45055f1 100644
--- a/admin/reports_committees.inc.php
+++ b/admin/reports_committees.inc.php
@@ -23,6 +23,7 @@
 
 $report_committees_fields = array(
 	'name' =>  array(
+		'start_option_group' => 'Committee Member Name',
 		'name' => 'Committee Member -- Full Name ',
 		'header' => 'Name',
 		'width' => 44.45 /*mm*/,
@@ -42,6 +43,7 @@ $report_committees_fields = array(
 		'table' => 'users.firstname' ),
 
 	'email' =>  array(
+		'start_option_group' => 'Committee Member Contact Information',
 		'name' => 'Committee Member -- Email',
 		'header' => 'Email',
 		'width' => 50.8 /*mm*/,
@@ -90,6 +92,7 @@ $report_committees_fields = array(
 		'table' => 'users.postalcode' ),
 
 	'organization' => array(
+		'start_option_group' => 'Committee Member Misc.',
 		'name' => 'Committee Member -- Organization',
 		'header' => 'Organization',
 		'width' => 50.8 /*mm*/,
@@ -108,12 +111,35 @@ $report_committees_fields = array(
 		'width' => 12.7 /*mm*/,
 		'table' => 'users.cpr',
 		'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(
+		'start_option_group' => 'Special Fields',
 		'name' => 'Static Text (useful for labels)',
 		'header' => '',
 		'width' => 2.54 /*mm*/,
 		'table' => "CONCAT(' ')"),
+
 );
 
  function report_committees_fromwhere($report, $components)
diff --git a/admin/reports_editor.php b/admin/reports_editor.php
index f3c8d65..bb3f828 100644
--- a/admin/reports_editor.php
+++ b/admin/reports_editor.php
@@ -421,9 +421,7 @@ $doCanvasSample = false;
  }
 
 
- echo "";
  $x=0;
-
  
  if($report['option']['type'] == 'label') {
  	$fontlist = array('' => 'Default');
@@ -433,8 +431,7 @@ $doCanvasSample = false;
 			  
  	foreach($report['col'] as $o=>$d) {
 		$f = $d['field'];
-		echo "";
-		echo "';
+		echo '

'; } for(;$x<$n_columns;$x++) { - echo ""; - echo ""; + echo "

"; } } - echo "
Loc ".($o+1).": "; + echo "{$fields[$d['field']]['name']}:
"; $script=""; foreach($locs as $k=>$v) { echo "$k="; @@ -465,11 +462,10 @@ $doCanvasSample = false; echo "\n"; $x++; - echo '

Loc ".($x+1).": "; + echo "New Field ".($x+1).":
"; foreach($locs as $k=>$v) { echo "$k="; } @@ -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'); echo ""; - echo "

\n"; echo "

Grouping

"; for($x=0;$x<2;$x++) { echo "Group By".($x + 1).": "; diff --git a/admin/reports_fairs.inc.php b/admin/reports_fairs.inc.php index 757486a..69073c1 100644 --- a/admin/reports_fairs.inc.php +++ b/admin/reports_fairs.inc.php @@ -22,13 +22,15 @@ $report_fairs_fields = array( - 'fair_name' => array( + 'fairinfo_name' => array( + 'start_option_group' => 'Fair Information', 'name' => 'Fair -- Fair Name', 'header' => 'Name', 'width' => 38.1 /*mm*/, 'table' => 'fairs.name'), 'fairstats_year' => array ( + 'start_option_group' => 'Fair Statistics', 'name' => 'Fair Stats -- Year', 'header' => 'Year', 'width' => 25.4 /*mm*/, @@ -388,6 +390,25 @@ $report_fairs_fields = array( 'table' => 'fairs_stats.delegate4_size', '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 ( 'name' => 'Static Text (useful for labels)', diff --git a/admin/reports_fundraising.inc.php b/admin/reports_fundraising.inc.php index 1722311..cca5a18 100644 --- a/admin/reports_fundraising.inc.php +++ b/admin/reports_fundraising.inc.php @@ -152,6 +152,26 @@ $report_fundraisings_fields = array( 'width' => 2.54 /*mm*/, '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) diff --git a/admin/reports_judges.inc.php b/admin/reports_judges.inc.php index d771286..50a9305 100644 --- a/admin/reports_judges.inc.php +++ b/admin/reports_judges.inc.php @@ -259,6 +259,7 @@ function report_judges_time_availability(&$report, $field, $text) $report_judges_fields = array( 'last_name' => array( + 'start_option_group' => 'Judge Name Information', 'name' => 'Judge -- Last Name', 'header' => 'Last Name', 'width' => 25.4 /*mm*/, @@ -285,6 +286,7 @@ $report_judges_fields = array( 'table_sort'=> 'users.lastname' ), 'email' => array( + 'start_option_group' => 'Judge Contact Information', 'name' => 'Judge -- Email', 'header' => 'Email', 'width' => 50.8 /*mm*/, @@ -333,6 +335,7 @@ $report_judges_fields = array( 'table' => 'users.organization'), 'languages' => array( + 'start_option_group' => 'Judge Judging Preferences', 'name' => 'Judge -- Languages', 'header' => 'Lang', 'width' => 19.05 /*mm*/, @@ -340,21 +343,13 @@ $report_judges_fields = array( 'exec_function' => 'report_judges_languages', 'components' => array('users_judge')), - 'complete' => array( - 'name' => 'Judge -- Registration Complete', - 'header' => 'Cmpl', - 'width' => 10.16 /*mm*/, - 'table' => 'users_judge.judge_complete', + '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('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('teams')), 'willing_chair' => array( 'name' => 'Judge -- Willing Chair', @@ -364,7 +359,15 @@ $report_judges_fields = array( 'value_map' => array ('no' => 'No', 'yes' => 'Yes'), '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( + 'start_option_group' => 'Judge Experience', 'name' => 'Judge -- Years of Experience at School level', 'header' => 'Sch', 'width' => 12.7 /*mm*/, @@ -458,6 +461,7 @@ $report_judges_fields = array( /* Category preferences */ 'cats_at_pref_H' => array( + 'start_option_group' => 'Judge Judging Division/Category Preferences', 'name' => 'Judge -- Age Categories Selected as Preference: Highest (Shortform)', 'header' => 'Highest', 'width' => 20.32 /*mm*/, @@ -602,11 +606,22 @@ $report_judges_fields = array( /* Others */ - 'special_award_only' => array( - 'name' => 'Judge -- Special Award Only Requested', - 'header' => 'SA Only', - 'width' => 20.32 /*mm*/, - 'table' => 'users_judge.special_award_only', + + 'complete' => array( + 'start_option_group' => 'Judge Miscellaneous', + 'name' => 'Judge -- Registration Complete', + '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')), 'year' => array( @@ -615,15 +630,9 @@ $report_judges_fields = array( 'width' => 12.7 /*mm*/, '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( + 'start_option_group' => 'Judge Team Information', 'name' => 'Judge Team -- Name', 'header' => 'Team Name', 'width' => 76.2 /*mm*/, @@ -671,6 +680,7 @@ $report_judges_fields = array( 'components' => array('teams')), 'project_pn' => array( + 'start_option_group' => 'Judge Projects being Judged Information', 'name' => 'Project -- Number', 'header' => 'Number', 'width' => 12.7 /*mm*/, @@ -741,6 +751,7 @@ $report_judges_fields = array( 'table' => '""' ), 'question_1' => array( + 'start_option_group' => 'Judge Custom Questions', 'name' => 'Judge -- Custom Judge Registration Question 1', 'header' => 'Q1', 'width' => 25.4 /*mm*/, @@ -820,7 +831,28 @@ $report_judges_fields = array( 'editor_disabled' => true, '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( + 'start_option_group' => 'Special Fields', 'name' => 'Static Text (useful for labels)', 'header' => '', 'width' => 2.54 /*mm*/, diff --git a/admin/reports_schools.inc.php b/admin/reports_schools.inc.php index dc3ad3c..feadf04 100644 --- a/admin/reports_schools.inc.php +++ b/admin/reports_schools.inc.php @@ -63,6 +63,7 @@ function reports_schools_shemail(&$report, $field, $text) $report_schools_fields = array( 'school' => array( + 'start_option_group' => 'School Information', 'name' => 'School -- Name', 'header' => 'School Name', 'width' => 57.15 /*mm*/, @@ -175,6 +176,7 @@ $report_schools_fields = array( 'exec_function' => 'reports_schools_shemail'), 'school_accesscode' => array( + 'start_option_group' => 'Access Codes', 'name' => 'School -- Access Code', 'header' => 'Access Code', 'width' => 27.94 /*mm*/, @@ -187,6 +189,7 @@ $report_schools_fields = array( 'table' => 'schools.registration_password' ), 'school_project_limit' => array( + 'start_option_group' => 'Project Limits', 'name' => 'School -- Project Limit', 'header' => 'Limit', 'width' => 19.05 /*mm*/, @@ -198,6 +201,27 @@ $report_schools_fields = array( 'width' => 25.4 /*mm*/, '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) diff --git a/admin/reports_students.inc.php b/admin/reports_students.inc.php index aef8407..ba3881c 100644 --- a/admin/reports_students.inc.php +++ b/admin/reports_students.inc.php @@ -808,6 +808,12 @@ $report_students_fields = array( 'width' => 76.2 /*mm*/, 'table' => "'".mysql_escape_string($config['fairname'])."'"), + 'fair_logo' => array( + 'name' => 'Fair -- Logo (for Labels only)', + 'header' => '', + 'width' => 1 /*mm*/, + 'table' => "CONCAT(' ')"), + /* Special/Misc/Other */ 'static_text' => array ( 'start_option_group' => 'Special Fields', diff --git a/admin/reports_tours.inc.php b/admin/reports_tours.inc.php index a5a4070..04a14b6 100644 --- a/admin/reports_tours.inc.php +++ b/admin/reports_tours.inc.php @@ -23,6 +23,7 @@ $report_tours_fields = array( 'tour_name' => array( + 'start_option_group' => 'Tour Information', 'name' => 'Tour -- Name', 'header' => 'Tour Name', 'width' => 76.2 /*mm*/, @@ -76,6 +77,27 @@ $report_tours_fields = array( 'width' => 10.16 /*mm*/, '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) diff --git a/admin/reports_volunteers.inc.php b/admin/reports_volunteers.inc.php index 60775c9..63ccbd2 100644 --- a/admin/reports_volunteers.inc.php +++ b/admin/reports_volunteers.inc.php @@ -24,6 +24,7 @@ $report_volunteers_fields = array( 'last_name' => array( + 'start_option_group' => 'Volunteer Name Information', 'name' => 'Volunteer -- Last Name', 'header' => 'Last Name', 'width' => 25.4 /*mm*/, @@ -50,6 +51,7 @@ $report_volunteers_fields = array( 'table_sort'=> 'users.lastname' ), 'email' => array( + 'start_option_group' => 'Volunteer Contact Information', 'name' => 'Volunteer -- Email', 'header' => 'Email', 'width' => 44.45 /*mm*/, @@ -74,6 +76,7 @@ $report_volunteers_fields = array( 'table' => 'users.organization'), 'firstaid' => array( + 'start_option_group' => 'Volunteer Miscellaneous', 'name' => 'Volunteer -- First Aid Training', 'header' => 'F.Aid', 'width' => 12.7 /*mm*/, @@ -102,19 +105,28 @@ $report_volunteers_fields = array( 'table' => 'volunteer_positions.name', 'components' => array('signup')), - 'fair_year' => array ( - 'name' => 'Fair -- Year', - 'header' => 'Year', - 'width' => 12.7 /*mm*/, - 'table' => "{$config['FAIRYEAR']}"), + /* 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_name' => array ( - '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 ( + 'start_option_group' => 'Special Fields', 'name' => 'Static Text (useful for labels)', 'header' => '', 'width' => 2.54 /*mm*/, diff --git a/db/db.code.version.txt b/db/db.code.version.txt index c5356ba..f07e286 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -174 +175 diff --git a/db/db.update.175.php b/db/db.update.175.php new file mode 100644 index 0000000..6edaf33 --- /dev/null +++ b/db/db.update.175.php @@ -0,0 +1,243 @@ + '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']}'"); + } + } + + } +} + +?> diff --git a/db/db.update.175.sql b/db/db.update.175.sql new file mode 100644 index 0000000..effca88 --- /dev/null +++ b/db/db.update.175.sql @@ -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'; diff --git a/tcpdf.inc.php b/tcpdf.inc.php index fadc56f..4e11114 100644 --- a/tcpdf.inc.php +++ b/tcpdf.inc.php @@ -341,25 +341,6 @@ class pdf extends TCPDF { if($this->label_show_box) $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); } + 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 */ function hr()