2007-03-18 07:10:54 +00:00
|
|
|
<?
|
|
|
|
/*
|
|
|
|
This file is part of the 'Science Fair In A Box' project
|
|
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
|
|
|
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
|
|
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation, version 2.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once("reports_students.inc.php"); /* $report_students_fields */
|
2007-03-18 21:48:36 +00:00
|
|
|
require_once("reports_judges.inc.php"); /* $report_students_fields */
|
|
|
|
require_once("reports_awards.inc.php"); /* $report_students_fields */
|
2007-03-20 06:24:18 +00:00
|
|
|
require_once("reports_committees.inc.php"); /* $report_students_fields */
|
2007-11-16 05:32:04 +00:00
|
|
|
require_once("reports_volunteers.inc.php"); /* $report_volunteers_fields */
|
2007-09-13 18:57:56 +00:00
|
|
|
require_once("reports_schools.inc.php");
|
|
|
|
|
2007-03-18 19:59:02 +00:00
|
|
|
require_once('../lpdf.php');
|
|
|
|
require_once('../lcsv.php');
|
2007-03-18 07:10:54 +00:00
|
|
|
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$filter_ops = array( 0 => '=',
|
|
|
|
1 => '<=',
|
|
|
|
2 => '>=',
|
|
|
|
3 => '<',
|
|
|
|
4 => '>',
|
|
|
|
5 => '!=',
|
|
|
|
6 => 'IS',
|
|
|
|
7 => 'IS NOT',
|
|
|
|
8 => 'LIKE',
|
|
|
|
9 => 'NOT LIKE ',
|
|
|
|
);
|
2007-03-18 07:10:54 +00:00
|
|
|
|
|
|
|
$options = array();
|
|
|
|
$options['type'] = array( 'desc' => 'Report Format',
|
2007-03-19 06:51:44 +00:00
|
|
|
'values' => array('pdf'=>'PDF', 'csv'=>'CSV', 'label'=>'Label')
|
2007-03-18 07:10:54 +00:00
|
|
|
);
|
|
|
|
$options['group_new_page'] = array( 'desc' => 'Start each new grouping on a new page',
|
|
|
|
'values' => array('no'=>'No', 'yes'=>'Yes')
|
|
|
|
);
|
|
|
|
$options['allow_multiline'] = array( 'desc' => 'Allow table rows to span multiple lines',
|
|
|
|
'values' => array('no'=>'No', 'yes'=>'Yes')
|
|
|
|
);
|
2007-03-19 06:51:44 +00:00
|
|
|
|
|
|
|
$options['label_box'] = array( 'desc' => 'Draw a box around each label',
|
|
|
|
'values' => array('no'=>'No', 'yes'=>'Yes')
|
|
|
|
);
|
|
|
|
$options['label_fairname'] = array( 'desc' => 'Print the fair name at the top of each label',
|
|
|
|
'values' => array('no'=>'No', 'yes'=>'Yes')
|
|
|
|
);
|
|
|
|
$options['label_logo'] = array( 'desc' => 'Print the fair logo at the top of each label',
|
|
|
|
'values' => array('no'=>'No', 'yes'=>'Yes')
|
|
|
|
);
|
2007-03-18 07:10:54 +00:00
|
|
|
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
2007-03-18 07:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Viceroy Grand Avery rows? w x h" per page
|
|
|
|
& Toy
|
|
|
|
LRP 130 99180 5960 3 2 5/8 x 1 30
|
|
|
|
LRP 120 99189 5961 2 4 x 1 20
|
|
|
|
LRP 114 99179 5959 7 4 x 1 1/2 14
|
|
|
|
LRP 214 99190 5962 7 4 x 1 1/3 14
|
|
|
|
LRP 110 99181 5963 5 4 x 2 10
|
|
|
|
LRP 106 99763 5964 3 4 x 3 1/3 6
|
|
|
|
LRP 100 99764 5965 1 8 1/2 x 11 1
|
|
|
|
LRP 180 99765 5967 4 1 3/4 x 1/2 80 */
|
|
|
|
|
|
|
|
|
|
|
|
/* FIXME: put these in a databse */
|
|
|
|
$stock = array();
|
2007-03-27 05:01:51 +00:00
|
|
|
$stock['fullpage'] = array('name' => 'Letter 8.5 x 11 (3/4" margin)',
|
2007-03-20 06:24:18 +00:00
|
|
|
'page_width' => 8.5,
|
|
|
|
'page_height' => 11,
|
2007-03-26 16:49:15 +00:00
|
|
|
'label_width' => 7,
|
2007-03-20 06:24:18 +00:00
|
|
|
'x_spacing' => 0,
|
|
|
|
'cols' => 1,
|
2007-03-26 16:49:15 +00:00
|
|
|
'label_height' => 9.5,
|
2007-03-20 06:24:18 +00:00
|
|
|
'y_spacing' => 0,
|
|
|
|
'rows' => 1,
|
|
|
|
);
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
2007-03-27 05:01:51 +00:00
|
|
|
$stock['fullpage_landscape'] = array('name' => 'Letter 8.5 x 11 Landscape (3/4" margin)',
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
'page_width' => 11,
|
|
|
|
'page_height' => 8.5,
|
2007-03-26 16:49:15 +00:00
|
|
|
'label_width' => 9.5,
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
'x_spacing' => 0,
|
|
|
|
'cols' => 1,
|
2007-03-26 16:49:15 +00:00
|
|
|
'label_height' => 7,
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
'y_spacing' => 0,
|
|
|
|
'rows' => 1,
|
|
|
|
);
|
2007-03-27 05:01:51 +00:00
|
|
|
|
|
|
|
$stock['fullpage_full'] = array('name' => 'Letter 8.5 x 11 (no margin)',
|
|
|
|
'page_width' => 8.5,
|
|
|
|
'page_height' => 11,
|
|
|
|
'label_width' => 8.5,
|
|
|
|
'x_spacing' => 0,
|
|
|
|
'cols' => 1,
|
|
|
|
'label_height' => 11,
|
|
|
|
'y_spacing' => 0,
|
|
|
|
'rows' => 1,
|
|
|
|
);
|
|
|
|
|
|
|
|
$stock['fullpage_landscape_full'] = array('name' => 'Letter 8.5 x 11 Landscape (no margin)',
|
|
|
|
'page_width' => 11,
|
|
|
|
'page_height' => 8.5,
|
|
|
|
'label_width' => 11,
|
|
|
|
'x_spacing' => 0,
|
|
|
|
'cols' => 1,
|
|
|
|
'label_height' => 8.5,
|
|
|
|
'y_spacing' => 0,
|
|
|
|
'rows' => 1,
|
|
|
|
);
|
2007-03-20 06:24:18 +00:00
|
|
|
|
2007-03-20 18:49:44 +00:00
|
|
|
$stock['5961'] = array('name' => 'Avery 5961, G&T 99189',
|
|
|
|
'page_width' => 8.5,
|
|
|
|
'page_height' => 11,
|
|
|
|
'label_width' => 4,
|
|
|
|
'x_spacing' => 0.08,
|
|
|
|
'cols' => 2,
|
|
|
|
'label_height' => 1,
|
|
|
|
'y_spacing' => 0.08,
|
|
|
|
'rows' => 10,
|
|
|
|
);
|
|
|
|
|
2007-03-18 07:10:54 +00:00
|
|
|
$stock['5964'] = array('name' => 'Avery 5964, G&T 99763',
|
2007-03-19 06:51:44 +00:00
|
|
|
'page_width' => 8.5,
|
2007-03-18 07:10:54 +00:00
|
|
|
'page_height' => 11,
|
|
|
|
'label_width' => 4,
|
|
|
|
'x_spacing' => 3/16,
|
|
|
|
'cols' => 2,
|
|
|
|
'label_height' => 3 + 1/3,
|
|
|
|
'y_spacing' => 0,
|
|
|
|
'rows' => 3,
|
|
|
|
);
|
2007-03-20 06:24:18 +00:00
|
|
|
$stock['nametag'] = array('name' => 'Cards 4"x3"',
|
2007-03-19 06:51:44 +00:00
|
|
|
'page_width' => 8.5,
|
|
|
|
'page_height' => 11,
|
|
|
|
'label_width' => 4,
|
|
|
|
'x_spacing' => 0,
|
|
|
|
'cols' => 2,
|
|
|
|
'label_height' => 3,
|
|
|
|
'y_spacing' => 0,
|
|
|
|
'rows' => 3,
|
|
|
|
);
|
2007-03-18 07:10:54 +00:00
|
|
|
|
2007-03-20 06:24:18 +00:00
|
|
|
$options['stock'] = array('desc' => "Paper Type",
|
|
|
|
'values' => array() );
|
|
|
|
|
2007-03-18 07:10:54 +00:00
|
|
|
|
|
|
|
/* Add more types to the report format */
|
|
|
|
foreach($stock as $n=>$v) {
|
2007-03-19 06:51:44 +00:00
|
|
|
$options['stock']['values'][$n] = $v['name'];
|
2007-03-18 07:10:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$allow_options = array_keys($options);
|
|
|
|
|
|
|
|
|
2007-03-19 06:51:44 +00:00
|
|
|
function report_save_field($report, $type, $loc)
|
2007-03-18 07:10:54 +00:00
|
|
|
{
|
2007-03-18 21:48:36 +00:00
|
|
|
global $allow_options;
|
|
|
|
global $report_students_fields, $report_judges_fields, $report_awards_fields;
|
2007-09-13 18:57:56 +00:00
|
|
|
global $report_committees_fields, $report_schools_fields;
|
2007-11-16 05:32:04 +00:00
|
|
|
global $report_volunteers_fields;
|
2007-03-20 06:24:18 +00:00
|
|
|
|
2007-03-18 07:10:54 +00:00
|
|
|
|
2007-11-21 21:55:31 +00:00
|
|
|
$fieldvar = "report_{$report['type']}s_fields";
|
|
|
|
$allow_fields = array_keys($$fieldvar);
|
2007-03-18 07:10:54 +00:00
|
|
|
|
|
|
|
/* First delete all existing fields */
|
|
|
|
mysql_query("DELETE FROM reports_items
|
|
|
|
WHERE `reports_id`='{$report['id']}'
|
|
|
|
AND `type`='$type'");
|
|
|
|
/* Now add new ones */
|
|
|
|
|
|
|
|
if(count($report[$type]) == 0) return;
|
|
|
|
|
|
|
|
$q = '';
|
|
|
|
$x = 0;
|
|
|
|
foreach($report[$type] as $k=>$v) {
|
|
|
|
if($type == 'option') {
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
/* field, value, x, y, w, h, lines, face, align */
|
|
|
|
$vals = "'$k','$v','0','0','0','0','0','',''";
|
2007-03-18 07:10:54 +00:00
|
|
|
} else {
|
2007-10-05 20:12:19 +00:00
|
|
|
$opts = "{$v['align']} {$v['valign']}";
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$vals = "'{$v['field']}','{$v['value']}',
|
|
|
|
'{$v['x']}','{$v['y']}','{$v['w']}',
|
|
|
|
'{$v['h']}','{$v['lines']}','{$v['face']}',
|
2007-10-05 20:12:19 +00:00
|
|
|
'$opts'";
|
2007-03-18 07:10:54 +00:00
|
|
|
}
|
|
|
|
if($q != '') $q .= ',';
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$q .= "({$report['id']}, '$type','$x',$vals)";
|
2007-03-18 07:10:54 +00:00
|
|
|
$x++;
|
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
mysql_query("INSERT INTO reports_items(`reports_id`,`type`,`ord`,
|
|
|
|
`field`,`value`,`x`, `y`, `w`, `h`,
|
|
|
|
`lines`, `face`, `align`)
|
2007-03-18 07:10:54 +00:00
|
|
|
VALUES $q;");
|
|
|
|
echo mysql_error();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function report_load($report_id)
|
|
|
|
{
|
2007-03-19 06:51:44 +00:00
|
|
|
global $allow_options, $report_students_fields, $report_judges_fields;
|
|
|
|
global $report_committees_fields, $report_awards_fields;
|
2007-11-16 05:32:04 +00:00
|
|
|
global $report_schools_fields, $report_volunteers_fields;
|
2007-03-19 06:51:44 +00:00
|
|
|
|
2007-03-18 07:10:54 +00:00
|
|
|
$report = array();
|
|
|
|
|
|
|
|
$q = mysql_query("SELECT * FROM reports WHERE id='$report_id'");
|
|
|
|
$r = mysql_fetch_assoc($q);
|
|
|
|
$report['name'] = $r['name'];
|
|
|
|
$report['id'] = $r['id'];
|
2007-11-21 21:55:31 +00:00
|
|
|
$report['system_report_id'] = $r['system_report_id'];
|
2007-03-18 07:10:54 +00:00
|
|
|
$report['desc'] = $r['desc'];
|
|
|
|
$report['creator'] = $r['creator'];
|
|
|
|
$report['type'] = $r['type'];
|
|
|
|
|
2007-03-19 16:47:01 +00:00
|
|
|
$report['col'] = array();
|
|
|
|
$report['sort'] = array();
|
|
|
|
$report['group'] = array();
|
|
|
|
$report['distinct'] = array();
|
|
|
|
$report['options'] = array();
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$report['filter'] = array();
|
2007-03-19 16:47:01 +00:00
|
|
|
$report['loc'] = array();
|
|
|
|
|
2007-11-21 21:55:31 +00:00
|
|
|
$fieldvar = "report_{$report['type']}s_fields";
|
|
|
|
$allow_fields = array_keys($$fieldvar);
|
2007-03-18 07:10:54 +00:00
|
|
|
|
2007-03-19 06:51:44 +00:00
|
|
|
$q = mysql_query("SELECT * FROM reports_items
|
|
|
|
WHERE reports_id='{$report['id']}'
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
ORDER BY `ord`");
|
2007-03-19 06:51:44 +00:00
|
|
|
print(mysql_error());
|
|
|
|
|
|
|
|
if(mysql_num_rows($q) == 0) return $ret;
|
|
|
|
|
|
|
|
while($a = mysql_fetch_assoc($q)) {
|
|
|
|
$f = $a['field'];
|
|
|
|
$t = $a['type'];
|
|
|
|
switch($t) {
|
|
|
|
case 'option':
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
/* We dont' care about order, just construct
|
|
|
|
* ['option'][name] = value; */
|
2007-03-19 06:51:44 +00:00
|
|
|
if(!in_array($f, $allow_options)) {
|
|
|
|
print("Type[$type] Field[$f] not allowed.\n");
|
2007-03-20 06:24:18 +00:00
|
|
|
continue;
|
2007-03-19 06:51:44 +00:00
|
|
|
}
|
|
|
|
$report['option'][$f] = $a['value'];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if(!in_array($f, $allow_fields)) {
|
|
|
|
print("Type[$type] Field[$f] not allowed.\n");
|
2007-03-20 06:24:18 +00:00
|
|
|
continue;
|
2007-03-19 06:51:44 +00:00
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
/* Pull out all the data */
|
|
|
|
$val = array();
|
|
|
|
$col_fields = array('field', 'x', 'y', 'w', 'h', 'lines', 'face', 'align', 'value');
|
|
|
|
foreach($col_fields as $lf) $val[$lf] = $a[$lf];
|
|
|
|
|
|
|
|
if($val['lines'] == 0) $val['lines'] = 1;
|
2007-10-05 20:12:19 +00:00
|
|
|
$opts = explode(" ", $val['align']);
|
|
|
|
$align_opts = array ('left', 'right', 'center');
|
|
|
|
$valign_opts = array ('vtop', 'vbottom', 'vcenter');
|
|
|
|
$style_opts = array ('bold');
|
|
|
|
foreach($opts as $o) {
|
|
|
|
if(in_array($o, $align_opts)) $val['align'] = $o;
|
|
|
|
if(in_array($o, $valign_opts)) $val['valign'] = $o;
|
|
|
|
if(in_array($o, $valign_opts)) $val['face'] = $o;
|
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
|
|
|
$report[$t][$a['ord']] = $val;
|
2007-03-19 06:51:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-03-18 07:10:54 +00:00
|
|
|
return $report;
|
|
|
|
}
|
|
|
|
|
|
|
|
function report_save($report)
|
|
|
|
{
|
|
|
|
if($report['id'] == 0) {
|
|
|
|
/* New report */
|
|
|
|
mysql_query("INSERT INTO reports (`id`) VALUES ('')");
|
|
|
|
$report['id'] = mysql_insert_id();
|
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
print("<pre>");
|
|
|
|
print_r($_POST);
|
|
|
|
print_r($report);
|
|
|
|
print("</pre>");
|
|
|
|
*/
|
|
|
|
|
2007-03-18 07:10:54 +00:00
|
|
|
mysql_query("UPDATE reports SET
|
|
|
|
`name`='".mysql_escape_string($report['name'])."',
|
|
|
|
`desc`='".mysql_escape_string($report['desc'])."',
|
|
|
|
`creator`='".mysql_escape_string($report['creator'])."',
|
|
|
|
`type`='".mysql_escape_string($report['type'])."'
|
|
|
|
WHERE `id`={$report['id']}");
|
|
|
|
|
2007-03-19 06:51:44 +00:00
|
|
|
report_save_field($report, 'col', $report['loc']);
|
|
|
|
report_save_field($report, 'group', array());
|
|
|
|
report_save_field($report, 'sort', array());
|
|
|
|
report_save_field($report, 'distinct', array());
|
|
|
|
report_save_field($report, 'option', array());
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
report_save_field($report, 'filter', array());
|
2007-03-18 07:10:54 +00:00
|
|
|
return $report['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
function report_load_all()
|
|
|
|
{
|
|
|
|
$ret = array();
|
|
|
|
$q = mysql_query("SELECT * FROM reports ORDER BY `name`");
|
|
|
|
|
|
|
|
while($r = mysql_fetch_assoc($q)) {
|
|
|
|
$report = array();
|
|
|
|
$report['name'] = $r['name'];
|
|
|
|
$report['id'] = $r['id'];
|
|
|
|
$report['desc'] = $r['desc'];
|
|
|
|
$report['creator'] = $r['creator'];
|
|
|
|
$report['type'] = $r['type'];
|
|
|
|
$ret[] = $report;
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-20 04:04:14 +00:00
|
|
|
function report_gen_by_id($report_id, $year, $format=NULL)
|
2007-03-18 07:10:54 +00:00
|
|
|
{
|
2007-03-18 07:19:00 +00:00
|
|
|
global $options;
|
2007-03-18 07:10:54 +00:00
|
|
|
$report = report_load($report_id);
|
2007-10-20 04:04:14 +00:00
|
|
|
$report['year'] = $year;
|
2007-03-18 07:10:54 +00:00
|
|
|
if($format != NULL) {
|
|
|
|
$keys = array_keys($options['type']['values']);
|
|
|
|
if(in_array($format, $keys)) {
|
|
|
|
$report['option']['type'] = $format;
|
|
|
|
} else {
|
|
|
|
print("type [$format] not permitted\n");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return report_gen($report);
|
|
|
|
}
|
|
|
|
|
|
|
|
function report_delete($report_id)
|
|
|
|
{
|
|
|
|
$r = intval($report_id);
|
|
|
|
mysql_query("DELETE FROM reports WHERE `id`=$r");
|
|
|
|
mysql_query("DELETE FROM reports_items WHERE `reports_id`=$r");
|
|
|
|
}
|
|
|
|
|
2007-03-18 19:59:02 +00:00
|
|
|
function report_gen($report)
|
|
|
|
{
|
2007-09-13 18:57:56 +00:00
|
|
|
global $config, $report_students_fields, $report_judges_fields, $report_awards_fields, $report_schools_fields;
|
2007-11-16 05:32:04 +00:00
|
|
|
global $stock, $report_committees_fields, $report_volunteers_fields;
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
global $filter_ops;
|
2007-03-18 19:59:02 +00:00
|
|
|
|
|
|
|
//print_r($report);
|
2007-11-21 21:55:31 +00:00
|
|
|
$fieldvar = "report_{$report['type']}s_fields";
|
|
|
|
$fields = $$fieldvar;
|
2007-03-18 19:59:02 +00:00
|
|
|
|
|
|
|
$gen_mode = '';
|
|
|
|
$fieldname = array();
|
|
|
|
$thead = array();
|
|
|
|
|
|
|
|
$table['header']=array();
|
|
|
|
$table['widths']=array();
|
|
|
|
$table['dataalign']=array();
|
|
|
|
$table['option']=array();
|
|
|
|
|
|
|
|
if($report['option']['type']=='csv') {
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$rep=new lcsv(i18n($report['name']));
|
2007-03-18 19:59:02 +00:00
|
|
|
$gen_mode = 'table';
|
|
|
|
|
|
|
|
} else if($report['option']['type']=='label') {
|
|
|
|
/* Label */
|
2007-03-19 06:51:44 +00:00
|
|
|
$label_stock = $stock[$report['option']['stock']];
|
2007-03-18 19:59:02 +00:00
|
|
|
$rep=new lpdf( i18n($config['fairname']),
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
i18n($report['name']),
|
2007-03-18 19:59:02 +00:00
|
|
|
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif");
|
2007-03-19 06:51:44 +00:00
|
|
|
$rep->setPageStyle("labels");
|
|
|
|
$rep->newPage($label_stock['page_width'], $label_stock['page_height']);
|
2007-03-18 19:59:02 +00:00
|
|
|
$rep->setFontSize(11);
|
2007-03-19 06:51:44 +00:00
|
|
|
$rep->setLabelDimensions($label_stock['label_width'], $label_stock['label_height'],
|
|
|
|
$label_stock['x_spacing'], $label_stock['y_spacing']);
|
2007-03-18 19:59:02 +00:00
|
|
|
$gen_mode = 'label';
|
|
|
|
} else {
|
|
|
|
$rep=new lpdf( i18n($config['fairname']),
|
|
|
|
i18n($report['name']),
|
|
|
|
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif");
|
|
|
|
$rep->newPage();
|
|
|
|
$rep->setFontSize(11);
|
|
|
|
$gen_mode = 'table';
|
|
|
|
if($report['option']['allow_multiline'] == 'yes')
|
|
|
|
$table['option']['allow_multiline'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$sel = array();
|
|
|
|
$x=0;
|
|
|
|
$group_by = array();
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$components = array();
|
|
|
|
$order = array();
|
|
|
|
|
2007-03-18 19:59:02 +00:00
|
|
|
/* Select columns to display */
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
foreach($report['col'] as $o=>$d) {
|
|
|
|
$f = $d['field'];
|
2007-03-18 19:59:02 +00:00
|
|
|
$table['header'][] = i18n($fields[$f]['header']);
|
|
|
|
$table['widths'][] = $fields[$f]['width'];
|
|
|
|
$table['dataalign'][] = 'left';
|
|
|
|
$sel[] = "{$fields[$f]['table']} AS C$x";
|
|
|
|
$fieldname[$f] = "C$x";
|
|
|
|
if(is_array($fields[$f]['group_by']))
|
|
|
|
$group_by = array_merge($group_by, $fields[$f]['group_by']);
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
|
|
|
if(is_array($fields[$f]['components'])) {
|
|
|
|
$components = array_merge($components,
|
|
|
|
$fields[$f]['components']);
|
|
|
|
}
|
2007-03-18 19:59:02 +00:00
|
|
|
$x++;
|
|
|
|
}
|
|
|
|
/* We also want to select any column groupings, but we won't display them */
|
2007-03-19 16:47:01 +00:00
|
|
|
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
foreach($report['group'] as $o=>$d) {
|
|
|
|
$f = $d['field'];
|
|
|
|
if(!isset($fieldname[$f])) {
|
|
|
|
$sel[] = "{$fields[$f]['table']} AS G$o";
|
|
|
|
$fieldname[$f] = "G$o";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($fields[$f]['table_sort']))
|
2007-03-18 19:59:02 +00:00
|
|
|
$order[] = $fields[$f]['table_sort'];
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
else
|
|
|
|
$order[] = $fieldname[$f];
|
|
|
|
|
|
|
|
if(is_array($fields[$f]['components'])) {
|
|
|
|
$components = array_merge($components,
|
|
|
|
$fields[$f]['components']);
|
2007-03-18 19:59:02 +00:00
|
|
|
}
|
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
|
|
|
foreach($report['sort'] as $o=>$d) {
|
|
|
|
$f = $d['field'];
|
|
|
|
if(!isset($fieldname[$f])) {
|
|
|
|
$sel[] = "{$fields[$f]['table']} AS S$o";
|
|
|
|
$fieldname[$f] = "S$o";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($fields[$f]['table_sort']))
|
2007-03-18 19:59:02 +00:00
|
|
|
$order[] = $fields[$f]['table_sort'];
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
else
|
|
|
|
$order[] = $fieldname[$f];
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($report['distinct'] as $o=>$d) {
|
|
|
|
$f = $d['field'];
|
|
|
|
if(!isset($fieldname[$f])) {
|
|
|
|
$sel[] = "{$fields[$f]['table']} AS D$o";
|
|
|
|
$fieldname[$f] = "D$o";
|
2007-03-18 19:59:02 +00:00
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$group_by[] = $fieldname[$f];
|
2007-03-18 19:59:02 +00:00
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
|
|
|
foreach($report['filter'] as $o=>$d) {
|
|
|
|
$f = $d['field'];
|
|
|
|
if(!isset($fieldname[$f])) {
|
|
|
|
$sel[] = "{$fields[$f]['table']} AS F$o";
|
|
|
|
$fieldname[$f] = "F$o";
|
|
|
|
}
|
|
|
|
$t = $filter_ops[$d['x']];
|
|
|
|
$filter[] = "{$fields[$f]['table']} $t '{$d['value']}'";
|
|
|
|
}
|
|
|
|
$sel = implode(",", $sel);
|
2007-03-18 19:59:02 +00:00
|
|
|
$order = implode(",", $order);
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
2007-03-18 19:59:02 +00:00
|
|
|
|
|
|
|
if(!isset($report['year'])) {
|
|
|
|
$report['year'] = $config['FAIRYEAR'];
|
|
|
|
}
|
|
|
|
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$group_query = "";
|
2007-03-18 21:48:36 +00:00
|
|
|
if(count($group_by)) {
|
2007-03-18 19:59:02 +00:00
|
|
|
$group_query = "GROUP BY ".implode(",", $group_by);
|
2007-03-26 01:54:18 +00:00
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
|
|
|
$filter_query = "";
|
|
|
|
if(count($filter)) {
|
|
|
|
$filter_query = " AND ".implode(" AND ", $filter);
|
2007-03-26 01:54:18 +00:00
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
2007-11-21 21:55:31 +00:00
|
|
|
$func = "report_{$report['type']}s_fromwhere";
|
|
|
|
$q = call_user_func_array($func, array($report, $components));
|
2007-03-18 19:59:02 +00:00
|
|
|
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$q = "SELECT $sel $q $filter_query $group_query ORDER BY $order";
|
2007-03-18 19:59:02 +00:00
|
|
|
|
|
|
|
// print("$q");
|
|
|
|
|
|
|
|
$r = mysql_query($q);
|
|
|
|
echo mysql_error();
|
|
|
|
|
|
|
|
$ncols = count($report['col']);
|
|
|
|
$n_groups = count($report['group']);
|
|
|
|
$last_group_data = array();
|
|
|
|
|
|
|
|
while($i = mysql_fetch_assoc($r)) {
|
|
|
|
|
|
|
|
if($n_groups > 0) {
|
|
|
|
$group_change = false;
|
|
|
|
for($x=0; $x<$n_groups; $x++) {
|
|
|
|
if($last_group_data["G$x"] != $i["G$x"]) {
|
|
|
|
$group_change = true;
|
|
|
|
}
|
|
|
|
$last_group_data["G$x"] = $i["G$x"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if($group_change) {
|
|
|
|
/* Dump the last table */
|
|
|
|
if(count($table['data'])) {
|
|
|
|
// print_r($table);
|
|
|
|
$rep->addTable($table);
|
|
|
|
$rep->nextLine();
|
|
|
|
$table['data'] = array();
|
|
|
|
/* Start a new page AFTER a table is
|
|
|
|
* dumped, so the first page doesn't
|
|
|
|
* end up blank */
|
|
|
|
if($report['option']['group_new_page'] == 'yes') {
|
|
|
|
$rep->newPage();
|
|
|
|
} else {
|
|
|
|
$rep->hr();
|
|
|
|
$rep->vspace(-0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Construct a new header */
|
|
|
|
$h = implode(" -- ", $last_group_data);
|
|
|
|
$rep->heading($h);
|
|
|
|
$rep->nextLine();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = array();
|
2007-03-19 06:51:44 +00:00
|
|
|
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);
|
|
|
|
}
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
foreach($report['col'] as $o=>$d) {
|
|
|
|
$f = $d['field'];
|
|
|
|
if(is_array($fields[$f]['value_map'])) {
|
|
|
|
$v = $fields[$f]['value_map'][$i["C$o"]];
|
2007-03-18 19:59:02 +00:00
|
|
|
} else {
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
$v = $i["C$o"];
|
2007-03-18 19:59:02 +00:00
|
|
|
}
|
|
|
|
if($gen_mode == 'table') {
|
|
|
|
$data[] = $v;
|
|
|
|
} else if($gen_mode == 'label') {
|
2007-03-19 06:51:44 +00:00
|
|
|
$opt = array();
|
|
|
|
if($d['face'] == 'bold') $opt[] = 'bold';
|
|
|
|
$opt[] = $d['align'];
|
2007-10-05 20:12:19 +00:00
|
|
|
$opt[] = $d['valign'];
|
2007-03-19 06:51:44 +00:00
|
|
|
|
2007-03-20 06:24:18 +00:00
|
|
|
/* Special column, override result with static text */
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
if($f == 'static_text') $v = $d['value'];
|
2007-03-20 06:24:18 +00:00
|
|
|
|
- BAM!
- Overhauled the report generator.. It's more versatile now
- Added 'filter' option to the generator, so you can filter any column by (=,
<=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR
combinations, but that should cover what we need for now. Example: We can
filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal
projects.
- Wipe out the report database, and create it again from scratch.
update.48.sql contains an example of how to add additional reports to the
system without knowing the report_ids, because after regions start adding
their own reports, we won't be able to just wipe out the whole report system
to add one.
- We handle more reports now, specifically nametags and table labels, so remove
those files, and update the reports.php file to link the old links to the new
report generator (so people don't get too confused in this transition).
- Beginnings of moving the report generator to proper LEFT JOIN style
constructs instead of just one big massive EQUALS JOIN.
2007-03-26 06:15:41 +00:00
|
|
|
|
|
|
|
$rep->addLabelText2($d['x'], $d['y'], $d['w'],
|
|
|
|
$d['h'], $d['h']/$d['lines'],
|
|
|
|
$v, $opt);
|
2007-03-18 19:59:02 +00:00
|
|
|
}
|
|
|
|
}
|
2007-03-19 06:51:44 +00:00
|
|
|
if(count($data)) $table['data'][] = $data;
|
2007-03-18 19:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(count($table['data'])) {
|
|
|
|
$rep->addTable($table);
|
|
|
|
}
|
|
|
|
$rep->output();
|
|
|
|
}
|
|
|
|
|
2007-03-18 07:10:54 +00:00
|
|
|
?>
|