forked from science-ation/science-ation
Select Project Type field added to the project editor.
A flag in the configuration variables under Particpant Registration must be set to enable this. Project types are Experiment, Innovation, and Study Comment text box has been added to the project editor. This is only seen by fair administrators and not by the student. Information related to project safety can be flagged here. If text is present in this box, a flag appears in the Registration Management list. Project summaries longer than one page now print out properly. Blank pages are still sometimes printed after long sumaries. Choose Email Recipients query has been modified so that the most recent email address for judges is now used. Reports Editor has been changed so that cheques can be written for individual students as well as one cheque per project. New report data (split) has been added to make this work.
This commit is contained in:
parent
224520e33a
commit
f1cd9bcb5b
@ -1,7 +1,10 @@
|
||||
<?
|
||||
// This file was modified Jan of 2014 by Richard Sin
|
||||
// A glitch that grabs old emails has been resolved.
|
||||
|
||||
$mailqueries=array(
|
||||
"committee_all"=>array("name"=>"Committee members (all)","query"=>
|
||||
"SELECT firstname, lastname, organization, email FROM users WHERE types LIKE '%committee%' AND deleted='no' GROUP BY uid"),
|
||||
"SELECT u.firstname, u.lastname, u.organization, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%committee%' AND u.deleted='no' GROUP BY `u`.`id` ASC"),
|
||||
|
||||
/* The WHERE clause evaluates which rows to add to the GROUP
|
||||
BY, the HAVING clase evaluates which grouped rows show up. We
|
||||
@ -11,8 +14,7 @@
|
||||
end up picking up a user active in, say 2007 and 2008, but
|
||||
deleted in 2009. */
|
||||
"judges_all"=>array("name"=>"Judges from all years (except deleted judges)","query"=>
|
||||
"SELECT firstname, lastname, email, deleted, MAX(year)
|
||||
FROM users WHERE types LIKE '%judge%' GROUP BY uid HAVING deleted='no' ORDER BY email"),
|
||||
"SELECT u.firstname, u.lastname, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid ) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%judge%' AND u.deleted='no' ORDER BY `u`.`email` ASC"),
|
||||
|
||||
"judges_active_lastyear"=>array("name"=>"Judges (all) active from last year", "query"=>
|
||||
"SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='".($config['FAIRYEAR']-1)."' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"),
|
||||
@ -181,15 +183,16 @@
|
||||
"SELECT schools.sciencehead_uid AS uid, schools.school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools
|
||||
JOIN users ON schools.sciencehead_uid=users.uid AND users.id=(SELECT id FROM users WHERE users.uid=schools.sciencehead_uid ORDER BY `year` DESC LIMIT 1)
|
||||
WHERE schools.year='".$config['FAIRYEAR']."' AND users.email!=''"),
|
||||
|
||||
"school_thisyear"=>array("name"=>"School this year","query"=>
|
||||
"SELECT board, schoolemail FROM `schools` WHERE `year` ='".$config['FAIRYEAR']."' GROUP BY schoolemail"),
|
||||
"school_teachers_thisyear"=>array("name"=>"Teachers (as entered by students) this year","query"=>
|
||||
"SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".$config['FAIRYEAR']."' AND teacheremail!=''"),
|
||||
"SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '".$config['FAIRYEAR']."' GROUP BY teacheremail"),
|
||||
|
||||
"school_teachers_lastyear"=>array("name"=>"Teachers (as entered by students) last year","query"=>
|
||||
"SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".($config['FAIRYEAR']-1)."' AND teacheremail!=''"),
|
||||
"SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '".($config['FAIRYEAR']-1)."' GROUP BY teacheremail"),
|
||||
|
||||
"school_teachers_allyears"=>array("name"=>"Teachers (as entered by students) all years","query"=>
|
||||
"SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE teacheremail!=''"),
|
||||
"SELECT teachername AS firstname, teacheremail AS email FROM students GROUP BY teacheremail"),
|
||||
/* Volunteers */
|
||||
"volunteers_active_complete_thisyear"=>array("name"=>"Volunteers active for this year and complete", "query"=>
|
||||
"SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='yes' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND types LIKE '%volunteer%' ORDER BY email"),
|
||||
|
@ -25,6 +25,7 @@
|
||||
require_once("../common.inc.php");
|
||||
require_once("../user.inc.php");
|
||||
include "communication.inc.php";
|
||||
|
||||
user_auth_required('committee', 'admin');
|
||||
|
||||
function launchQueue() {
|
||||
|
@ -20,6 +20,11 @@
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// This file was modified Jan of 2014 by Richard Sin
|
||||
// Project type has been added and can be toggled by configuration.
|
||||
// Feedback box also has been added for flagging purposes
|
||||
|
||||
?>
|
||||
<?
|
||||
require_once('../common.inc.php');
|
||||
@ -106,6 +111,20 @@ function project_save()
|
||||
else
|
||||
$summarycountok=1;
|
||||
|
||||
//check if it is flagged then update it
|
||||
|
||||
if(empty($_POST['feedback'])) {
|
||||
mysql_query("UPDATE projects SET ".
|
||||
"flagged='0'".
|
||||
"WHERE id='".intval($_POST['id'])."'");
|
||||
} else {
|
||||
mysql_query("UPDATE projects SET ".
|
||||
"flagged='1'".
|
||||
"WHERE id='".intval($_POST['id'])."'");
|
||||
}
|
||||
echo mysql_error();
|
||||
happy_("Flagging process successfully updated");
|
||||
|
||||
if($config['participant_project_title_charmax'] && strlen(stripslashes($_POST['title']))>$config['participant_project_title_charmax']) { //0 for no limit, eg 255 database field limit
|
||||
$title=substr(stripslashes($_POST['title']),0,$config['participant_project_title_charmax']);
|
||||
error_("Project title truncated to %1 characters",array($config['participant_project_title_charmax']));
|
||||
@ -115,12 +134,14 @@ function project_save()
|
||||
mysql_query("UPDATE projects SET ".
|
||||
"title='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",$title))."', ".
|
||||
"projectdivisions_id='".intval($_POST['projectdivisions_id'])."', ".
|
||||
"projecttype='".mysql_escape_string(stripslashes($_POST['projecttype']))."', ".
|
||||
"language='".mysql_escape_string(stripslashes($_POST['language']))."', ".
|
||||
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
|
||||
"req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ".
|
||||
"req_special='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['req_special'])))."', ".
|
||||
"summary='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['summary'])))."', ".
|
||||
"summarycountok='$summarycountok',".
|
||||
"feedback='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['feedback'])))."', ".
|
||||
"projectsort='".mysql_escape_string(stripslashes($_POST['projectsort']))."'".
|
||||
"WHERE id='".intval($_POST['id'])."'");
|
||||
echo mysql_error();
|
||||
@ -145,7 +166,6 @@ function project_save()
|
||||
function project_load()
|
||||
{
|
||||
global $registrations_id, $config;
|
||||
|
||||
//now lets find out their MAX grade, so we can pre-set the Age Category
|
||||
$q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'");
|
||||
$gradeinfo=mysql_fetch_object($q);
|
||||
@ -226,8 +246,32 @@ function countwords()
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td><?=i18n("Project Sort")?>: </td>
|
||||
<td><input type="text" name="projectsort" size="10" value="<?=$projectinfo->projectsort?>" /></td>
|
||||
</tr><tr>
|
||||
<td><input type="text" name="projectsort" size="10" value="<?=$projectinfo->projectsort?>" /></td></tr>
|
||||
|
||||
<?
|
||||
if($config['project_type'] == 'yes'){
|
||||
$q=mysql_query("SELECT * FROM projecttypes ORDER BY type");
|
||||
echo "<tr><td>".i18n("Select Project Type").": </td><td>";
|
||||
echo "<select name=\"projecttype\">\n";
|
||||
echo "<option value=\"\">".i18n("Select a project type")."</option>\n";
|
||||
//FIXME: need to fix the loading glitch
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->type == $projectinfo->projecttype)
|
||||
{
|
||||
$sel="selected=\"selected\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sel="";
|
||||
}
|
||||
echo "<option $sel value=\"$r->type\">".htmlspecialchars(i18n($r->type))."</option>\n";
|
||||
|
||||
}
|
||||
echo "</select>".REQUIREDFIELD."</td></tr>";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?=i18n("Age Category")?>: </td>
|
||||
<td><?=i18n($agecategories[$projectcategories_id]['category'])?> (<?=i18n("Grades %1-%2",array($agecategories[$projectcategories_id]['mingrade'],$agecategories[$projectcategories_id]['maxgrade']))?>)</td>
|
||||
</tr><tr>
|
||||
@ -340,6 +384,8 @@ function countwords()
|
||||
echo i18n("%1 words maximum",array($config['participant_project_summary_wordmax']));
|
||||
echo "</div>";
|
||||
|
||||
echo"<tr><td>".i18n("Feedback").": </td><td><textarea cols=\"60\" rows=\"4\" id=\"feedback\" name=\"feedback\">".htmlspecialchars($projectinfo->feedback)."</textarea><br />";
|
||||
|
||||
?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
@ -20,6 +20,10 @@
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// This file was modified Jan of 2014 by Richard Sin
|
||||
// Flagging has been added to monitor projects with concern.
|
||||
|
||||
?>
|
||||
<?
|
||||
require_once('../common.inc.php');
|
||||
@ -361,6 +365,7 @@ echo "<th>".i18n("Age Category")."</th>";
|
||||
echo "<th>".i18n("Division")."</th>";
|
||||
echo "<th>".i18n("School(s)")."</th>";
|
||||
echo "<th>".i18n("Student(s)")."</th>";
|
||||
echo "<th>".i18n("Flagged")."</th>";
|
||||
echo "<th>".i18n("Action")."</th>";
|
||||
echo "</tr></thead>";
|
||||
|
||||
@ -376,7 +381,7 @@ echo "<br/><br/>The statistics have moved here: <a href=\"registration_stats.php
|
||||
|
||||
send_footer();
|
||||
|
||||
/* Now some helper fucntions we call more than once */
|
||||
/* Now some helper functions we call more than once */
|
||||
function list_query($year, $wherestatus, $reg_id)
|
||||
{
|
||||
global $auth_type;
|
||||
@ -397,7 +402,9 @@ function list_query($year, $wherestatus, $reg_id)
|
||||
projects.title,
|
||||
projects.projectnumber,
|
||||
projects.projectcategories_id,
|
||||
projects.projectdivisions_id
|
||||
projects.projectdivisions_id,
|
||||
projects.feedback,
|
||||
projects.flagged
|
||||
FROM
|
||||
registrations
|
||||
left outer join projects on projects.registrations_id=registrations.id
|
||||
@ -466,6 +473,19 @@ function print_row($r)
|
||||
|
||||
echo "<td $scl>$schools</td>";
|
||||
echo "<td $scl>$students</td>";
|
||||
|
||||
echo "<td align=\"center\" >";
|
||||
if($r->flagged == false) {
|
||||
echo "<a title=\"".i18n("Not flagged")."\" href=\"#\" onClick=\"popup_editor('{$r->reg_id}','project');\" >";
|
||||
echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/ok.".$config['icon_extension']."\" border=0>";
|
||||
echo "</a>";
|
||||
}
|
||||
else {
|
||||
echo "<a title=\"".i18n("Flagged")."\" href=\"#\" onClick=\"popup_editor('{$r->reg_id}','project');\" >";
|
||||
echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/flagged.".$config['icon_extension']."\" border=0>";
|
||||
echo "</a>";
|
||||
}
|
||||
|
||||
echo "<td align=\"center\" >";
|
||||
if($year==$config['FAIRYEAR']) {
|
||||
echo "<a title=\"".i18n("Delete this registration")."\" href=\"#\" onClick=\"delete_registration({$r->reg_id});return false\" >";
|
||||
|
@ -21,6 +21,9 @@
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// This file was modified Jan of 2014 by Richard Sin
|
||||
// A glitch that prints out both english and french columns has been modified.
|
||||
|
||||
require_once("reports_students.inc.php"); /* $report_students_fields */
|
||||
require_once("reports_judges.inc.php"); /* $report_students_fields */
|
||||
require_once("reports_awards.inc.php"); /* $report_students_fields */
|
||||
@ -549,13 +552,19 @@ foreach($report_stock as $n=>$v) {
|
||||
|
||||
function report_gen($report)
|
||||
{
|
||||
foreach($report['col'] as $v)
|
||||
|
||||
global $config, $report_students_fields, $report_judges_fields, $report_awards_fields, $report_schools_fields;
|
||||
global $report_stock, $report_committees_fields, $report_volunteers_fields;
|
||||
global $report_tours_fields, $report_fairs_fields;
|
||||
global $report_fundraisings_fields;
|
||||
global $filter_ops;
|
||||
|
||||
//print_r($report);
|
||||
//foreach($report as $k=>$v){
|
||||
//print_r($k.' ~ >');
|
||||
//print_r($v);
|
||||
//print_r('<br> <br>');
|
||||
//}
|
||||
$fieldvar = "report_{$report['type']}s_fields";
|
||||
$fields = $$fieldvar;
|
||||
|
||||
@ -643,6 +652,17 @@ foreach($report_stock as $n=>$v) {
|
||||
|
||||
$total_width = 0;
|
||||
$scale_width = 0;
|
||||
$temp=array();
|
||||
$count=0;
|
||||
foreach($report['col'] as $o=>$d) {
|
||||
if($config['default_language']!='fr'){
|
||||
if(strpos($d['field'],'fr_')!='fr_'){
|
||||
$temp[$count]=$d;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$report['col']=$temp;
|
||||
/* Add up the column widths, and figure out which
|
||||
* ones are scalable, just in case */
|
||||
foreach($report['col'] as $o=>$d) {
|
||||
@ -654,12 +674,18 @@ foreach($report_stock as $n=>$v) {
|
||||
|
||||
/* Determine the scale factor (use the label width so
|
||||
* we can enforce margins) */
|
||||
|
||||
if($report['option']['fit_columns'] == 'yes') { // && $total_width > $label_stock['label_width']) {
|
||||
$static_width = $total_width - $scale_width;
|
||||
if($scale_width)
|
||||
if($scale_width){
|
||||
if ($label_stock['label_width'] - $static_width > 0) {
|
||||
$scale_factor = ($label_stock['label_width'] - $static_width) / $scale_width;
|
||||
else
|
||||
} else {
|
||||
$scale_factor = $label_stock['label_width']/$total_width;
|
||||
}
|
||||
} else {
|
||||
$scale_factor = 1.0;
|
||||
}
|
||||
} else {
|
||||
$scale_factor = 1.0;
|
||||
}
|
||||
@ -703,6 +729,7 @@ foreach($report_stock as $n=>$v) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* If no sort order is specified, make the first field the order */
|
||||
if(count($report['sort']) == 0)
|
||||
$report['sort'] = array(0 => array('field' => $report['col'][0]['field']));
|
||||
@ -771,6 +798,7 @@ foreach($report_stock as $n=>$v) {
|
||||
// print_r($report['filter']);
|
||||
// echo "$q";
|
||||
|
||||
|
||||
if($r == false) {
|
||||
echo "The report database query has failed. This is
|
||||
unfortunate but not your fault. Please send the following to
|
||||
@ -790,7 +818,6 @@ foreach($report_stock as $n=>$v) {
|
||||
$last_group_data = array();
|
||||
|
||||
// echo "<pre>";print_r($rep);
|
||||
|
||||
while($i = mysql_fetch_assoc($r)) {
|
||||
|
||||
if($n_groups > 0) {
|
||||
@ -812,9 +839,10 @@ foreach($report_stock as $n=>$v) {
|
||||
|
||||
if($group_change) {
|
||||
/* Dump the last table */
|
||||
|
||||
if(count($table['data'])) {
|
||||
// print_r($table);
|
||||
$rep->addTable($table);
|
||||
$rep->addTable($table); //table is the content
|
||||
$rep->nextLine();
|
||||
$table['data'] = array();
|
||||
$table['total'] = 0;
|
||||
@ -847,18 +875,17 @@ foreach($report_stock as $n=>$v) {
|
||||
$rep->label_new();
|
||||
}
|
||||
|
||||
foreach($report['col'] as $o=>$d) {
|
||||
foreach($report['col'] as $o=>$d) { //fill in one page
|
||||
$f = $d['field'];
|
||||
|
||||
if(is_array($fields[$f]['value_map'])) {
|
||||
$v = $fields[$f]['value_map'][$i["C$o"]];
|
||||
} else if(is_callable($fields[$f]['exec_function'])) {
|
||||
$v = call_user_func_array($fields[$f]['exec_function'], array($report, $f, $i["C$o"]));
|
||||
// } else if(isset($fields[$f]['exec_code'])) {
|
||||
// Somethign like this, how do we pass $i["C$o"] in?
|
||||
// $v = exec($fields[$f]['exec_code']);
|
||||
} else {
|
||||
$v = $i["C$o"];
|
||||
}
|
||||
|
||||
if($gen_mode == 'table') {
|
||||
$data[] = $v;
|
||||
} else if($gen_mode == 'label') {
|
||||
@ -869,7 +896,7 @@ foreach($report_stock as $n=>$v) {
|
||||
if($report['option']['field_box'] == 'yes')
|
||||
$opt[] = 'field_box';
|
||||
|
||||
|
||||
//the page content is filled
|
||||
/* Special column, draw a box */
|
||||
if($f == 'static_box') {
|
||||
$rep->addLabelBox($d['x'], $d['y'], $d['w'],
|
||||
@ -955,6 +982,7 @@ foreach($report_stock as $n=>$v) {
|
||||
*/
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
if($fields[$f]['total'] == true)
|
||||
$table['total'] += $v;
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
|
||||
require("../common.inc.php");
|
||||
require_once("../user.inc.php");
|
||||
user_auth_required('committee', 'admin');
|
||||
@ -38,6 +39,7 @@
|
||||
require_once('reports.inc.php');
|
||||
require_once('../tcpdf.inc.php');
|
||||
|
||||
|
||||
$fields = array();
|
||||
$locs = array('X' => 'x', 'Y' => 'y', 'W' => 'w', 'H' => 'h', 'Lines' => 'lines');
|
||||
|
||||
@ -53,6 +55,10 @@
|
||||
if($in_optgroup) echo '</optgroup>';
|
||||
echo '<optgroup label="'.i18n($f['start_option_group']).'">';
|
||||
}
|
||||
if($f['name']=='Project -- Type'){ //filter out if the configuration setting does not allow for the project type
|
||||
global $config;
|
||||
if($config['project_type']=='no') continue;
|
||||
}
|
||||
$sel = ($selected == $k) ? 'selected=\"selected\"': '' ;
|
||||
echo "<option value=\"$k\" $sel >{$f['name']}</option>";
|
||||
}
|
||||
@ -64,7 +70,7 @@
|
||||
{
|
||||
echo "<select name=\"$name\" $onchange >";
|
||||
foreach($a as $v=>$val) {
|
||||
$sel = ($selected == $v) ? 'selected=\"selected\"' : '';
|
||||
$sel = ($selected == $v) ? 'selected=selected' : '';
|
||||
echo "<option value=\"$v\" $sel>$val</option>";
|
||||
}
|
||||
echo '</select>';
|
||||
|
@ -21,6 +21,10 @@
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// This file was modified Jan of 2014 by Richard Sin
|
||||
// Project Type has been added to the list.
|
||||
// Cheque Splitting algorithm is added.
|
||||
|
||||
function report_students_i18n_fr($report, $field, $text)
|
||||
{
|
||||
return i18n($text, array(), array(), 'fr');
|
||||
@ -164,7 +168,7 @@ $report_students_fields = array(
|
||||
'pn' => array(
|
||||
'name' => 'Project Number',
|
||||
'header' => '#',
|
||||
'width' => 0.6,
|
||||
'width' => 0.7,
|
||||
'table' => 'projects.projectnumber',
|
||||
'table_sort' => 'projects.projectsort, projects.projectnumber'),
|
||||
|
||||
@ -238,6 +242,13 @@ $report_students_fields = array(
|
||||
'table' => "GROUP_CONCAT(students.firstname, ' ', students.lastname ORDER BY students.lastname SEPARATOR ', ')",
|
||||
'group_by' => array('students.registrations_id')),
|
||||
|
||||
'allnames_split' => array(
|
||||
'name' => "Student -- All Student Names (REQUIRES MYSQL 5.0) (Split) ",
|
||||
'header' => 'Student(s)',
|
||||
'width' => 3.0,
|
||||
'scalable' => true,
|
||||
'table' => "CONCAT(students.firstname, ' ', students.lastname)",),
|
||||
|
||||
'pronunciation' => array(
|
||||
'name' => 'Student -- Name Pronunciation',
|
||||
'header' => 'Pronunciation',
|
||||
@ -377,9 +388,15 @@ $report_students_fields = array(
|
||||
'division' => array(
|
||||
'name' => 'Project -- Division',
|
||||
'header' => 'Division',
|
||||
'width' => 3.0,
|
||||
'width' => 1.0,
|
||||
'table' => 'projectdivisions.division' ),
|
||||
|
||||
'projecttype' => array(
|
||||
'name' => 'Project -- Type',
|
||||
'header' => 'Type',
|
||||
'width' => 1.0,
|
||||
'table' => 'projects.projecttype' ),
|
||||
|
||||
'div' => array(
|
||||
'name' => 'Project -- Division Short Form' ,
|
||||
'header' => 'Div',
|
||||
@ -601,7 +618,7 @@ $report_students_fields = array(
|
||||
'school_city' => array(
|
||||
'name' => 'School -- City',
|
||||
'header' => 'City',
|
||||
'width' => 1.5,
|
||||
'width' => 1.0,
|
||||
'table' => 'schools.city' ),
|
||||
|
||||
'school_province' => array(
|
||||
@ -703,6 +720,13 @@ $report_students_fields = array(
|
||||
'table' => 'award_prizes.cash',
|
||||
'components' => array('awards')),
|
||||
|
||||
'award_prize_cash_split' => array(
|
||||
'name' => 'Award -- Prize Cash Amount (Split)',
|
||||
'header' => 'Cash',
|
||||
'width' => 0.5,
|
||||
'table' => 'award_prizes.cash/a.count',
|
||||
'components' => array('awards')),
|
||||
|
||||
'award_prize_cash_cheque' => array(
|
||||
'name' => 'Award -- Prize Cash Amount for Cheques',
|
||||
'header' => 'Cash',
|
||||
@ -711,6 +735,14 @@ $report_students_fields = array(
|
||||
'components' => array('awards'),
|
||||
'exec_function' => 'report_student_cash_cheque'),
|
||||
|
||||
'award_prize_cash_cheque_split' => array(
|
||||
'name' => 'Award -- Prize Cash Amount for Cheques (Split)',
|
||||
'header' => 'Cash',
|
||||
'width' => 0.5,
|
||||
'table' => 'award_prizes.cash/a.count',
|
||||
'components' => array('awards'),
|
||||
'exec_function' => 'report_student_cash_cheque'),
|
||||
|
||||
'award_prize_cash_words' => array(
|
||||
'name' => 'Award -- Prize Cash Amount In Words',
|
||||
'header' => 'Cash',
|
||||
@ -719,6 +751,14 @@ $report_students_fields = array(
|
||||
'components' => array('awards'),
|
||||
'exec_function' => 'report_student_cash_words'),
|
||||
|
||||
'award_prize_cash_words_split' => array(
|
||||
'name' => 'Award -- Prize Cash Amount In Words (Split)',
|
||||
'header' => 'Cash',
|
||||
'width' => 0.5,
|
||||
'table' => 'award_prizes.cash/a.count',
|
||||
'components' => array('awards'),
|
||||
'exec_function' => 'report_student_cash_words'),
|
||||
|
||||
'award_prize_scholarship' => array(
|
||||
'name' => 'Award -- Prize Scholarship Amount',
|
||||
'header' => 'Scholarship',
|
||||
@ -1072,7 +1112,11 @@ $report_students_fields = array_merge($report_students_fields,$regfeeitems);
|
||||
$awards_join = "LEFT JOIN winners ON winners.projects_id = projects.id
|
||||
LEFT JOIN award_prizes ON award_prizes.id = winners.awards_prizes_id
|
||||
LEFT JOIN award_awards ON award_awards.id = award_prizes.award_awards_id
|
||||
LEFT JOIN award_types ON award_types.id=award_awards.award_types_id";
|
||||
LEFT JOIN award_types ON award_types.id=award_awards.award_types_id
|
||||
LEFT JOIN (SELECT registrations_id AS id, COUNT( * ) AS count
|
||||
FROM students
|
||||
GROUP BY registrations_id) a
|
||||
ON a.id=students.registrations_id";
|
||||
$awards_where = " AND winners.year='$year'
|
||||
AND award_awards.year='$year'
|
||||
AND award_prizes.year='$year'
|
||||
|
@ -1 +1 @@
|
||||
175
|
||||
176
|
||||
|
32
db/db.update.176.sql
Normal file
32
db/db.update.176.sql
Normal file
@ -0,0 +1,32 @@
|
||||
/* This file was modified Jan of 2014 by Richard Sin */
|
||||
/* below are the updated tables, alterations, and inserts*/
|
||||
|
||||
CREATE TABLE `projecttypes`
|
||||
(id int(10),
|
||||
type varchar(64) COLLATE latin1_swedish_ci);
|
||||
|
||||
INSERT INTO `projecttypes` (`id`,`type`) VALUES
|
||||
(1,'Experiment'),
|
||||
(2,'Innovation'),
|
||||
(3,'Study');
|
||||
|
||||
INSERT INTO `config` (`var`,`val`,`category`, `type`, `type_values`, `ord`, `description`, `year`) VALUES
|
||||
('project_type','no','Participant Registration', 'yesno','','3100','Allows the ability to categorize projects into Experiments, Studies, or Innovations.','-1');
|
||||
|
||||
ALTER TABLE `projects` ADD
|
||||
(projecttype varchar(64) COLLATE latin1_swedish_ci,
|
||||
feedback text COLLATE latin1_swedish_ci,
|
||||
flagged tinyint(1));
|
||||
|
||||
UPDATE `reports_items` SET `field`= 'allnames'
|
||||
WHERE `id` = 9099;
|
||||
|
||||
INSERT INTO `translations` (lang, strmd5, str, val, argsdesc) VALUES
|
||||
('fr','245fe794333c2b0d5c513129b346b93f','Project Type','',''),
|
||||
('fr','22413e12cc28e98272e112ec778b8807','Select a project','',''),
|
||||
('fr','05aeba473f4906b85c7627ba045e890a','Experiment','',''),
|
||||
('fr','0a3dac2314e66e15240f019afcbd6b0f','Study','',''),
|
||||
('fr','32f28a2c732e178e43a0ceeffa08ab08','Innovation','',''),
|
||||
('fr','bea4c2c8eb82d05891ddd71584881b56','Feedback','',''),
|
||||
('fr','72d68acd07c783e657e2d2a9c50f16df','Flagged','',''),
|
||||
('fr','d47429e01c5a1c8768a0e293fe9b9ce5','Not flagged','','');
|
BIN
images/16/flagged.png
Normal file
BIN
images/16/flagged.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 890 B |
59
lpdf.php
59
lpdf.php
@ -20,6 +20,10 @@
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// This file was modified Jan of 2014 by Richard Sin
|
||||
// It properly formats pdf files and prevents overflows.
|
||||
|
||||
?>
|
||||
<?
|
||||
class lpdf
|
||||
@ -664,18 +668,20 @@ class lpdf
|
||||
//if we get a table passed in that doesnt look like a table (not an array) then just return doing nothing
|
||||
if(!is_array($table)) return;
|
||||
|
||||
if(is_array($table['header'])) {
|
||||
if(is_array($table['header']))
|
||||
{
|
||||
$table_cols=count($table['header']);
|
||||
} else {
|
||||
$table_cols=count($table['data']);
|
||||
}
|
||||
$line_height=round(round($this->defaultFontSize)/64,2);
|
||||
|
||||
$line_height=round(round($this->defaultFontSize)/64,2);
|
||||
$table_width=array_sum($table['widths']);
|
||||
$table_padding=0.03;
|
||||
|
||||
$allow_multiline = false;
|
||||
if(is_array($table['option'])) {
|
||||
|
||||
if(is_array($table['option']))
|
||||
{
|
||||
$allow_multiline = ($table['option']['allow_multiline'] == true) ? true : false;
|
||||
}
|
||||
|
||||
@ -691,10 +697,12 @@ class lpdf
|
||||
//now do the data in the table
|
||||
if($table['data'])
|
||||
{
|
||||
|
||||
pdf_setfont($this->pdf,$this->normalfont,$this->defaultFontSize);
|
||||
foreach($table['data'] AS $dataline)
|
||||
{
|
||||
// $this->yloc-=$line_height;
|
||||
do
|
||||
{
|
||||
$xpos=$xpos_of_table;
|
||||
|
||||
/* Fit first */
|
||||
@ -707,14 +715,12 @@ class lpdf
|
||||
$try=0;
|
||||
$h = $col_height;
|
||||
$last_notfit = 0;
|
||||
|
||||
while(1) {
|
||||
// echo "h=$h, width=$width, text=[$textstr]\n";
|
||||
while(1)
|
||||
{
|
||||
$notfit=pdf_show_boxed($this->pdf,$textstr,
|
||||
$this->loc($xpos+$table_padding),$this->loc($this->yloc-($h)*$line_height),
|
||||
$this->loc($width-2*$table_padding),$this->loc($line_height*$h),
|
||||
$table['dataalign'][$c],'blind');
|
||||
// echo " nofit=$notfit\n";
|
||||
|
||||
/* It fits, break and do it for real */
|
||||
if($notfit == 0) break;
|
||||
@ -722,10 +728,12 @@ class lpdf
|
||||
/* If we're not allowed to use multiple lines, we're done. */
|
||||
if($allow_multiline == false) break;
|
||||
|
||||
if($last_notfit == $notfit) {
|
||||
if($last_notfit == $notfit)
|
||||
{
|
||||
/* Height was increased, but it didn't help the fit at all
|
||||
* Try again up to 5 times. */
|
||||
if($try == 5) {
|
||||
if($try == 5)
|
||||
{
|
||||
/* Text in is the same as text out for 5 line increments,
|
||||
* we're probably in an infinite loop. So, instead
|
||||
* of trying to just add vspace, fudge the hspace and
|
||||
@ -740,12 +748,19 @@ class lpdf
|
||||
/* We found a line height that helped the fit */
|
||||
$try=0;
|
||||
}
|
||||
$last_notfit = $notfit;
|
||||
|
||||
$last_notfit = $notfit;
|
||||
if($this->yloc - ($line_height * $h) < 0.75)
|
||||
{
|
||||
$h--;
|
||||
break;
|
||||
} else {
|
||||
/* Increase the height and try again */
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
$col_width[$c] = $width;
|
||||
|
||||
if($h > $col_height) $col_height = $h;
|
||||
}
|
||||
|
||||
@ -753,12 +768,12 @@ class lpdf
|
||||
* page, start a new page, and then blindly
|
||||
* dump this entry on it (but try to squeeze on
|
||||
* as much as possible) */
|
||||
if($this->yloc - ($line_height * $col_height) < 0.75)
|
||||
{
|
||||
$this->addTableEnd($table, $xpos_of_table, $top_of_table);
|
||||
$this->newPage($this->page_width,$this->page_height);
|
||||
$top_of_table = $this->addTableStart($table, $xpos_of_table, $table_width);
|
||||
}
|
||||
//if($this->yloc - ($line_height * $col_height) < 0.75)
|
||||
//{
|
||||
// $this->addTableEnd($table, $xpos_of_table, $top_of_table);
|
||||
// $this->newPage($this->page_width,$this->page_height);
|
||||
// $top_of_table = $this->addTableStart($table, $xpos_of_table, $table_width);
|
||||
//}
|
||||
|
||||
/* Do it for real */
|
||||
for($c=0;$c<$table_cols;$c++)
|
||||
@ -775,10 +790,11 @@ class lpdf
|
||||
//put a little "..." at the end of the field
|
||||
if($notfit)
|
||||
{
|
||||
$dataline[$c]=substr($textstr,-$notfit);
|
||||
pdf_setfont($this->pdf,$this->normalfont,8);
|
||||
pdf_show_boxed($this->pdf,"...",
|
||||
$this->loc($xpos+$width-0.10),$this->loc($this->yloc-$line_height-0.05),
|
||||
$this->loc(0.10),$this->loc($line_height),
|
||||
if($allow_multiline)pdf_show_boxed($this->pdf,"(continued..)",
|
||||
$this->loc($xpos+$width-0.55),$this->loc($this->yloc-$h-0.15),
|
||||
$this->loc(0.6),$this->loc($line_height),
|
||||
$table['dataalign'][$c],null);
|
||||
pdf_setfont($this->pdf,$this->normalfont,$this->defaultFontSize);
|
||||
}
|
||||
@ -798,6 +814,7 @@ class lpdf
|
||||
$this->newPage($this->page_width,$this->page_height);
|
||||
$top_of_table = $this->addTableStart($table, $xpos_of_table, $table_width);
|
||||
}
|
||||
}while($notfit>0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,10 @@
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
// This file was modified Jan of 2014 by Richard Sin
|
||||
// Added project type.
|
||||
|
||||
?>
|
||||
<?
|
||||
require("common.inc.php");
|
||||
@ -113,7 +117,8 @@ echo mysql_error();
|
||||
mysql_query("UPDATE projects SET ".
|
||||
"title='".mysql_escape_string($title)."', ".
|
||||
"shorttitle='".mysql_escape_string($shorttitle)."', ".
|
||||
"projectdivisions_id='".$_POST['projectdivisions_id']."', ".
|
||||
"projectdivisions_id='".intval($_POST['projectdivisions_id'])."', ".
|
||||
"projecttype='".mysql_escape_string(stripslashes($_POST['projecttype']))."', ".
|
||||
"language='".mysql_escape_string(stripslashes($_POST['language']))."', ".
|
||||
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
|
||||
"req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ".
|
||||
@ -230,7 +235,7 @@ function countwords()
|
||||
if($config['filterdivisionbycategory']=="yes"){
|
||||
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY division");
|
||||
echo mysql_error();
|
||||
//###
|
||||
|
||||
}else
|
||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
|
||||
echo "<select name=\"projectdivisions_id\">";
|
||||
@ -260,6 +265,28 @@ function countwords()
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
if($config['project_type'] == 'yes'){
|
||||
$q=mysql_query("SELECT * FROM projecttypes ORDER BY type");
|
||||
echo "<tr><td>".i18n("Project Type").": </td><td>";
|
||||
echo "<select name=\"projecttype\">\n";
|
||||
echo "<option value=\"\">".i18n("Select a project")."</option>\n";
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->type == $projectinfo->projecttype)
|
||||
{
|
||||
$sel="selected=\"selected\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sel="";
|
||||
}
|
||||
echo "<option $sel value=\"$r->type\">".htmlspecialchars(i18n($r->type))."</option>\n";
|
||||
|
||||
}
|
||||
echo "</select>".REQUIREDFIELD."</td></tr>";
|
||||
}
|
||||
|
||||
echo "<tr><td>".i18n("Language").": </td><td>";
|
||||
echo "<select name=\"language\">\n";
|
||||
|
||||
|
@ -24,9 +24,12 @@
|
||||
?>
|
||||
<?
|
||||
|
||||
$user_what = array('student'=>'Participant', 'judge' => 'Judge',
|
||||
'committee'=>'Committee Member','volunteer' => 'Volunteer',
|
||||
'fair'=>'Science Fair','sponsor' => 'Sponsor Contact',
|
||||
$user_what = array('student'=>'Participant',
|
||||
'judge' => 'Judge',
|
||||
'committee'=>'Committee Member',
|
||||
'volunteer' => 'Volunteer',
|
||||
'fair'=>'Science Fair',
|
||||
'sponsor' => 'Sponsor Contact',
|
||||
'principal' => 'Principal',
|
||||
'teacher' => 'Teacher',
|
||||
'parent' => 'Parent',
|
||||
|
Loading…
x
Reference in New Issue
Block a user