diff --git a/admin/index.php b/admin/index.php index 42e7e23..fb0afb1 100644 --- a/admin/index.php +++ b/admin/index.php @@ -36,6 +36,9 @@ echo "".i18n("Judging Management")."
"; echo "".i18n("Translations Management")."
"; echo "".i18n("Report Management")."
"; +if($config['volunteer_enable'] == 'yes') { + echo "".i18n("Volunteer Position Management")."
"; +} if($config['tours_enable'] == 'yes') { echo "".i18n("Tour Management")."
"; } diff --git a/admin/reports.inc.php b/admin/reports.inc.php index c528dbb..2a56e9d 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -25,6 +25,7 @@ require_once("reports_judges.inc.php"); /* $report_students_fields */ require_once("reports_awards.inc.php"); /* $report_students_fields */ require_once("reports_committees.inc.php"); /* $report_students_fields */ + require_once("reports_volunteers.inc.php"); /* $report_volunteers_fields */ require_once("reports_schools.inc.php"); require_once('../lpdf.php'); @@ -175,6 +176,7 @@ foreach($stock as $n=>$v) { global $allow_options; global $report_students_fields, $report_judges_fields, $report_awards_fields; global $report_committees_fields, $report_schools_fields; + global $report_volunteers_fields; switch($report['type']) { @@ -183,6 +185,7 @@ foreach($stock as $n=>$v) { case 'award': $allow_fields = array_keys($report_awards_fields); break; case 'committee':$allow_fields = array_keys($report_committees_fields); break; case 'school': $allow_fields = array_keys($report_schools_fields); break; + case 'volunteer': $allow_fields=array_keys($report_volunteers_fields); break; } /* First delete all existing fields */ @@ -222,7 +225,7 @@ foreach($stock as $n=>$v) { { global $allow_options, $report_students_fields, $report_judges_fields; global $report_committees_fields, $report_awards_fields; - global $report_schools_fields; + global $report_schools_fields, $report_volunteers_fields; $report = array(); @@ -249,6 +252,7 @@ foreach($stock as $n=>$v) { case 'award': $allow_fields = array_keys($report_awards_fields); break; case 'committee':$allow_fields = array_keys($report_committees_fields); break; case 'school': $allow_fields = array_keys($report_schools_fields); break; + case 'volunteer':$allow_fields = array_keys($report_volunteer_fields); break; } $q = mysql_query("SELECT * FROM reports_items @@ -376,7 +380,7 @@ foreach($stock as $n=>$v) { function report_gen($report) { global $config, $report_students_fields, $report_judges_fields, $report_awards_fields, $report_schools_fields; - global $stock, $report_committees_fields; + global $stock, $report_committees_fields, $report_volunteers_fields; global $filter_ops; //print_r($report); @@ -386,6 +390,7 @@ foreach($stock as $n=>$v) { case 'award': $fields = $report_awards_fields; break; case 'committee': $fields = $report_committees_fields; break; case 'school': $fields = $report_schools_fields; break; + case 'volunteer': $fields = $report_volunteers_fields; break; } $gen_mode = ''; @@ -524,6 +529,7 @@ foreach($stock as $n=>$v) { case 'award': $q = report_awards_fromwhere($report, $components); break; case 'committee': $q = report_committees_fromwhere($report, $components); break; case 'school': $q = report_schools_fromwhere($report, $components); break; + case 'volunteer': $q = report_volunteers_fromwhere($report, $components); break; } $q = "SELECT $sel $q $filter_query $group_query ORDER BY $order"; diff --git a/admin/reports_editor.php b/admin/reports_editor.php index 402d73d..0c93a42 100644 --- a/admin/reports_editor.php +++ b/admin/reports_editor.php @@ -30,6 +30,7 @@ require_once('reports_awards.inc.php'); require_once('reports_committees.inc.php'); require_once('reports_schools.inc.php'); + require_once('reports_volunteers.inc.php'); require_once('reports.inc.php'); $fields = array(); @@ -250,6 +251,7 @@ function reportChange() case 'award': $fields = $report_awards_fields; break; case 'committee': $fields = $report_committees_fields; break; case 'school': $fields = $report_schools_fields; break; + case 'volunteer': $fields = $report_volunteers_fields; break; } echo "<< ".i18n("Back to Reports")."
"; @@ -290,7 +292,7 @@ function reportChange() echo ""; selector('type', array('student' => 'Student Report', 'judge' => 'Judge Report', 'award' => 'Award Report', 'committee' => 'Committee Member Report', - 'school' => 'School Report' ), + 'school' => 'School Report', 'volunteer' => 'Volunteer Report' ), $report['type']); diff --git a/admin/reports_volunteers.inc.php b/admin/reports_volunteers.inc.php new file mode 100644 index 0000000..427d6cd --- /dev/null +++ b/admin/reports_volunteers.inc.php @@ -0,0 +1,138 @@ + + Copyright (C) 2005 James Grant + + 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. +*/ + +$report_volunteers_fields = array( + + 'last_name' => array( + 'name' => 'Volunteer -- Last Name', + 'header' => 'Last Name', + 'width' => 1.0, + 'table' => 'users.lastname' ), + + 'first_name' => array( + 'name' => 'Volunteer -- First Name', + 'header' => 'First Name', + 'width' => 1.0, + 'table' => 'users.firstname' ), + + 'name' => array( + 'name' => 'Volunteer -- Full Name (last, first)', + 'header' => 'Name', + 'width' => 1.75, + 'table' => "CONCAT(users.lastname, ', ', users.firstname)", + 'table_sort'=> 'users.lastname' ), + + 'namefl' => array( + 'name' => 'Volunteer -- Full Name (first last)', + 'header' => 'Name', + 'width' => 1.75, + 'table' => "CONCAT(users.firstname, ' ', users.lastname)", + 'table_sort'=> 'users.lastname' ), + + 'email' => array( + 'name' => 'Volunteer -- Email', + 'header' => 'Email', + 'width' => 1.75, + 'table' => 'users.email'), + + 'phone' => array( + 'name' => 'Volunteer -- Phone', + 'header' => 'Phone', + 'width' => 1.0, + 'table' => 'users.phonehome'), + + 'cell' => array( + 'name' => 'Volunteer -- Cell', + 'header' => 'Cell', + 'width' => 1.0, + 'table' => 'users.phonecell'), + + 'organization' => array( + 'name' => 'Volunteer -- Phone', + 'header' => 'Organziation', + 'width' => 1.0, + 'table' => 'users.organization'), + + 'position_name' => array ( + 'name' => 'Volunteer Position -- Name', + 'header' => 'Position', + 'width' => 3, + 'table' => 'volunteer_positions.name', + 'components' => array('signup')), + +/* 'language' => array( + 'name' => 'Project -- Language', + 'header' => 'Lang', + 'width' => 1.00, + 'table' => 'projects.language' ), +*/ + 'fair_year' => array ( + 'name' => 'Fair -- Year', + 'header' => 'Year', + 'width' => 0.5, + 'table' => "{$config['FAIRYEAR']}"), + + 'fair_name' => array ( + 'name' => 'Fair -- Name', + 'header' => 'Fair Name', + 'width' => 3, + 'table' => "'{$config['fairname']}'"), + + 'static_text' => array ( + 'name' => 'Static Text (useful for labels)', + 'header' => '', + 'width' => 0.1, + 'table' => "CONCAT(' ')"), + +); + + function report_volunteers_fromwhere($report, $components) + { + global $config, $report_volutneers_fields; + + $fields = $report_volutneers_fields; + $year = $report['year']; + + $signup_join = ''; + $signup_where = ''; + + if(in_array('signup', $components)) { + $signup_join = "LEFT JOIN volunteer_positions_signup + ON (users.id=volunteer_positions_signup.users_id) + LEFT JOIN volunteer_positions + ON (volunteer_positions_signup.volunteer_positions_id=volunteer_positions.id)"; + $signup_where = "AND volunteer_positions_signup.year = '$year'"; + } + + $q = " FROM + users + $signup_join + WHERE + users.complete='yes' + $signup_where + "; + + return $q; +} + +?> diff --git a/admin/volunteer_positions_manager.php b/admin/volunteer_positions_manager.php new file mode 100644 index 0000000..babd31f --- /dev/null +++ b/admin/volunteer_positions_manager.php @@ -0,0 +1,50 @@ + + Copyright (C) 2007 David Grant + + 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. +*/ +?> + "admin/") + ); + + + $editor=new TableEditor("volunteer_positions", + array("name"=>"Name", + "desc"=>"Description", + "meet_place"=>"Location Information", + "start"=>"Start Day/Time", + "end"=>"End Day/Time" + ), null, + array("year" => $config['FAIRYEAR'] ) + ); + + $editor->setPrimaryKey("id"); + $editor->setDefaultSortField("start,name"); + $editor->setRecordType("Volunteer Position"); + $editor->execute(); + + send_footer(); +?>