forked from science-ation/science-ation
Serious SQL Injection Vulnerabilities
This commit is contained in:
parent
e2a8e7a9fd
commit
4018d48cc4
@ -1,96 +0,0 @@
|
|||||||
-- Tables to support projects evaluations plug-in for SFIAB
|
|
||||||
-- Dennis Spanogle Feb 24, 2011
|
|
||||||
|
|
||||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
||||||
/*!40101 SET NAMES utf8 */;
|
|
||||||
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- Database: `sfiab`
|
|
||||||
--
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `eval_config` (
|
|
||||||
`plugin_name` varchar(20) NOT NULL,
|
|
||||||
`plugin_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`folder_name` varchar(20) NOT NULL,
|
|
||||||
`help_link` varchar(50) NOT NULL,
|
|
||||||
`code_version` tinyint(3) unsigned NOT NULL,
|
|
||||||
`author` varchar(50) NOT NULL,
|
|
||||||
`last_update` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
`description` text,
|
|
||||||
`requirements` text,
|
|
||||||
`db_version` tinyint(3) unsigned NOT NULL,
|
|
||||||
UNIQUE KEY `plugin_id` (`plugin_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `eval_config`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `eval_config` (`plugin_name`, `plugin_id`, `folder_name`, `help_link`, `code_version`, `author`, `last_update`, `description`, `requirements`, `db_version`) VALUES
|
|
||||||
('Evaluations', 1, 'evaluations', 'eval_help.html', 100, 'Dennis Spanogle <dennis@spanogle.net>', '2011-02-25 08:35:26', 'Evaluations is a configurable project evaluation add-on (plug-in) for SFIAB. Evaluations provides the flexibility and most functionality to setup SFIAB for scoring and evaluations of projects. The help file will explain the details.', 'Requires: SFIAB 2.3.1 or higher (requires the tables projects, judges_teams_timeslots_link, judges_teams_timeslots_projects_link, users_judge configured as in SFIAB rev 2.3.1. ', 100);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `eval_projects` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`project_id` int(10) unsigned NOT NULL,
|
|
||||||
`team` enum('no','yes') NOT NULL DEFAULT 'no',
|
|
||||||
`scheme_id` smallint(5) unsigned DEFAULT NULL,
|
|
||||||
`eval_score` float(5,2) NOT NULL DEFAULT '0.00',
|
|
||||||
`final_score` float(5,2) NOT NULL DEFAULT '0.00',
|
|
||||||
`eval_score_status` varchar(10) DEFAULT NULL,
|
|
||||||
`overall_status` varchar(10) DEFAULT NULL,
|
|
||||||
`last_change` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `eval_criteria` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`scheme_id` smallint(5) unsigned NOT NULL,
|
|
||||||
`criteria_id` smallint(5) unsigned NOT NULL,
|
|
||||||
`criteria_weight` smallint(6) NOT NULL,
|
|
||||||
`criteria_name` varchar(20) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `eval_levels` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`scheme_id` smallint(5) unsigned NOT NULL,
|
|
||||||
`level_id` smallint(5) unsigned NOT NULL,
|
|
||||||
`level_value` tinyint(3) unsigned NOT NULL,
|
|
||||||
`level_name` varchar(12) DEFAULT NULL,
|
|
||||||
`spec_use` enum('no','yes') NOT NULL DEFAULT 'no',
|
|
||||||
`spec_use_code` varchar(4) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=15 ;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `eval_projects_entries` (
|
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`event_id` int(10) unsigned DEFAULT NULL,
|
|
||||||
`project_id` int(10) unsigned NOT NULL,
|
|
||||||
`judges_teams_id` int(10) unsigned DEFAULT NULL,
|
|
||||||
`judges_timeslots_id` int(10) unsigned DEFAULT NULL,
|
|
||||||
`criteria_id` smallint(5) unsigned DEFAULT NULL,
|
|
||||||
`level_id` smallint(5) unsigned DEFAULT NULL,
|
|
||||||
`judge_user_id` int(10) unsigned DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `eval_schemes` (
|
|
||||||
`scheme_id` smallint(5) unsigned NOT NULL,
|
|
||||||
`scheme_name` varchar(20) DEFAULT NULL,
|
|
||||||
`assignto_project_when` varchar(50) NOT NULL,
|
|
||||||
PRIMARY KEY (`scheme_id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
-- ISEF Evaluation schemes, criteria, levels setup
|
|
||||||
-- Dennis Spangole
|
|
||||||
-- Feb 24, 2011
|
|
||||||
-- Revisions 1.0.0
|
|
||||||
|
|
||||||
INSERT INTO `eval_schemes` (`scheme_id`, `scheme_name`, `assignto_project_when`) VALUES
|
|
||||||
(1, 'ISEF Evaluations', 'team = no'),
|
|
||||||
(2, 'ISEF Teams pre 2011', 'team = yes');
|
|
||||||
|
|
||||||
INSERT INTO `eval_criteria` (`id`, `scheme_id`, `criteria_id`, `criteria_weight`, `criteria_name`) VALUES
|
|
||||||
(1, 1, 1, 30, 'Creative Ability'),
|
|
||||||
(2, 1, 2, 30, 'Scientific Thought'),
|
|
||||||
(3, 1, 3, 15, 'Thoroughness'),
|
|
||||||
(4, 1, 4, 15, 'Skill'),
|
|
||||||
(5, 1, 5, 10, 'Clarity'),
|
|
||||||
(6, 1, 6, 0, 'Teamwork(not used'),
|
|
||||||
(7, 2, 1, 25, 'Creative Ability'),
|
|
||||||
(8, 2, 2, 25, 'Scientific Thought'),
|
|
||||||
(9, 2, 3, 12, 'Thoroughness'),
|
|
||||||
(10, 2, 4, 12, 'Skill'),
|
|
||||||
(11, 2, 5, 10, 'Clarity'),
|
|
||||||
(12, 2, 6, 16, 'Teamwork');
|
|
||||||
|
|
||||||
INSERT INTO `eval_levels` (`id`, `scheme_id`, `level_id`, `level_value`, `level_name`, `spec_use`, `spec_use_code`) VALUES
|
|
||||||
(1, 1, 0, 0, 'No mark', 'yes', 'NoMk'),
|
|
||||||
(2, 1, 1, 1, 'Acceptable', 'no', NULL),
|
|
||||||
(3, 1, 2, 2, 'Good', 'no', NULL),
|
|
||||||
(4, 1, 3, 3, 'Very Good', 'no', NULL),
|
|
||||||
(5, 1, 4, 4, 'Excellent', 'no', NULL),
|
|
||||||
(6, 1, 5, 5, 'Exceptional', 'no', NULL),
|
|
||||||
(7, 1, 7, 7, 'MultipleMark', 'yes', 'MltM'),
|
|
||||||
(8, 2, 0, 0, 'No Mark', 'yes', 'NoMk'),
|
|
||||||
(9, 2, 1, 1, 'Acceptable', 'no', NULL),
|
|
||||||
(10, 2, 2, 2, 'Good', 'no', NULL),
|
|
||||||
(11, 2, 3, 3, 'Very Good', 'no', NULL),
|
|
||||||
(12, 2, 4, 4, 'Excellent', 'no', NULL),
|
|
||||||
(13, 2, 5, 5, 'Exceptional', 'no', NULL),
|
|
||||||
(14, 2, 7, 7, 'MultipleMark', 'yes', 'MltM');
|
|
||||||
|
|
@ -1,109 +0,0 @@
|
|||||||
<?
|
|
||||||
|
|
||||||
if(file_exists("eval.code.version.txt"))
|
|
||||||
{
|
|
||||||
$dbcodeversion_file=file("eval.code.version.txt");
|
|
||||||
$dbcodeversion=trim($dbcodeversion_file[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Could not load current eval.code.version.txt\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
include_once "../sfiab_common.inc.php";
|
|
||||||
//same fix here for mysql 5.1 not truncating the 16 char usernames
|
|
||||||
$DBUSER=substr($DBUSER,0,16);
|
|
||||||
mysql_connect($DBHOST,$DBUSER,$DBPASS);
|
|
||||||
mysql_select_db($DBNAME);
|
|
||||||
$q=mysql_query("SELECT db_version FROM eval_config");
|
|
||||||
$r=mysql_fetch_object($q);
|
|
||||||
$dbdbversion=$r->db_version;
|
|
||||||
if(!$dbdbversion)
|
|
||||||
{
|
|
||||||
echo "Could not get current 'Evaluations' db version. Is the plug-in properly installed?\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($dbcodeversion && $dbdbversion)
|
|
||||||
{
|
|
||||||
//lets see if they match
|
|
||||||
if($dbcodeversion == $dbdbversion)
|
|
||||||
{
|
|
||||||
echo "DB and CODE for 'Evaluations' are all up-to-date. Version: $dbdbversion\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else if($dbcodeversion<$dbdbversion)
|
|
||||||
{
|
|
||||||
echo "ERROR: dbcodeversion<dbdbversion ($dbcodeversion<$dbdbversion). This should not happen!";
|
|
||||||
exit;
|
|
||||||
|
|
||||||
}
|
|
||||||
else if($dbcodeversion>$dbdbversion)
|
|
||||||
{
|
|
||||||
echo "DB update requirements detected<br />";
|
|
||||||
echo "Current 'Evaluations' DB Version: $dbdbversion<br />";
|
|
||||||
echo "Current 'Evaluations' CODE Version: $dbcodeversion<br />";
|
|
||||||
|
|
||||||
echo "Updating database from $dbdbversion to $dbcodeversion<br />";
|
|
||||||
|
|
||||||
for($ver=$dbdbversion+1;$ver<=$dbcodeversion;$ver++)
|
|
||||||
{
|
|
||||||
if(file_exists("db.eval.update.$ver.sql"))
|
|
||||||
{
|
|
||||||
echo "db.eval.update.$ver.sql detected - running...";
|
|
||||||
$exit_code = 0; // assume no errors for now
|
|
||||||
$filename = 'db.eval.update.'.$ver.'.sql';
|
|
||||||
// Temporary variable, used to store current query
|
|
||||||
$templine = '';
|
|
||||||
// Read in entire file
|
|
||||||
$lines = file($filename);
|
|
||||||
// Loop through each line
|
|
||||||
foreach ($lines as $line)
|
|
||||||
{
|
|
||||||
// Skip it if it's a comment
|
|
||||||
if (substr($line, 0, 2) == '--' || $line == '')
|
|
||||||
continue;
|
|
||||||
// Add this line to the current segment
|
|
||||||
$templine .= $line;
|
|
||||||
// If it has a semicolon at the end, it's the end of the query
|
|
||||||
if (substr(trim($line), -1, 1) == ';')
|
|
||||||
{
|
|
||||||
// Perform the query
|
|
||||||
if(!mysql_query($templine)){
|
|
||||||
echo('<br/>Error performing query!<br/>'.$templine.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
|
||||||
$error_count += 1;
|
|
||||||
$exit_code = -1; // do we bail out here or keep going? keep going for now, get all errors
|
|
||||||
}
|
|
||||||
// Reset temp variable to empty
|
|
||||||
$templine = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($exit_code != 0) {
|
|
||||||
/* mysql failed!, what now? */
|
|
||||||
$error_count += 1;
|
|
||||||
echo "<br /><b>ERROR in db_update: Failed to execute query(s) without error!</b><br />";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo " Done!<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Version $ver SQL update file not found - skipping over\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<br />All done - updating Evaluations' new DB version to $dbcodeversion\n";
|
|
||||||
if ($error_count == 0 ){
|
|
||||||
mysql_query("UPDATE eval_config SET db_version='$dbcodeversion'");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "ERROR: dbcodeversion and dbdbversion are not defined\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
@ -1 +0,0 @@
|
|||||||
100
|
|
@ -1,3 +0,0 @@
|
|||||||
"2127", "37", "5", "4", "3", "4", "3", "4", "JAA0557"
|
|
||||||
"2127", "39", "3", "2", "2", "2", "2", "3", "JAA0558"
|
|
||||||
"2127", "38", "4", "3", "3", "3", "3", "4", "JAA0559"
|
|
Binary file not shown.
Binary file not shown.
@ -1,703 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<!--
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<title>SFIAB Evaluations Help</title>
|
|
||||||
<style type="text/css">
|
|
||||||
.style1
|
|
||||||
{
|
|
||||||
font-size: large;
|
|
||||||
}
|
|
||||||
.style2
|
|
||||||
{
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<p align="center"><strong>Welcome to Evaluations Help</strong></p>
|
|
||||||
<p><a href="../index.php" title="Return to Evaluations Main page" target="_self">
|
|
||||||
Return to Evaluations</a></p>
|
|
||||||
<p><a href="#intro" target="_self">Introduction:</a> An overview of
|
|
||||||
Evaluations plug-in for SFIAB</p>
|
|
||||||
<p><a href="#install">Installation</a>: How to Install Evaluations plug-in</p>
|
|
||||||
<p><a href="#process" title="Typical sequence of actions when using Evaluations" target="_self">
|
|
||||||
Process:</a> The typical process used in Evaluations plug-in</p>
|
|
||||||
<p><a href="#setup" title="How to set up your evaluations scheme" target="_self">
|
|
||||||
Setup</a>: How to set up the evaluations schemes for your event.</p>
|
|
||||||
<p><a href="#actions" title="Details about each of the administrative actions for Evaluations" target="_self">
|
|
||||||
Step by Step:</a> Details about the administrative actions (steps) in the
|
|
||||||
Evaluations process.</p>
|
|
||||||
<p><a href="#examples" title="Several examples of Evaluations setup" target="_self">
|
|
||||||
Examples:</a> Examples of setting up Evaluations for different types of
|
|
||||||
project evaluations and scoring.</p>
|
|
||||||
<p><a href="#tables" title="Details about the database tables supporting Evaluations" target="_self">
|
|
||||||
Tables:</a> Details about the database tables used in Evaluations.</p>
|
|
||||||
<p><a href="#apperson">Apperson Scanner:</a> How to setup SFIAB to use
|
|
||||||
the Apperson Education Products Benchmark 3000 Scanner.</p>
|
|
||||||
<p> </p>
|
|
||||||
<p>
|
|
||||||
NOTE: The Evaluations plugin should be 'functional' at this time but not
|
|
||||||
secured. Until security is incorporated, it should not be used on real data.
|
|
||||||
I will need James to help implement security.<br />
|
|
||||||
To Do list: (in order of importance - sort of):</p>
|
|
||||||
<ul>
|
|
||||||
<li>Anyone: Add Security. Dennis suggests the following:<br />
|
|
||||||
- Committe members (the administration staff) have access to
|
|
||||||
all of the Evaluations package.<br />
|
|
||||||
- Judges can access the Evalutaion input form (page
|
|
||||||
eval_webentry.php) but can enter data only if:<br />
|
|
||||||
They log in with their password.<br />
|
|
||||||
They can only enter data for teams to
|
|
||||||
which they are assigned.<br />
|
|
||||||
(optionally perhaps every team would be
|
|
||||||
required to have a team leader and only the team leader can enter data)<br /> This needs some planning and inputs.</li>
|
|
||||||
<li>Dennis: Fix so only projects in table judges_teams_timeslots_projects_link are
|
|
||||||
'Linked' into eval_projects and eval_projects_entries. At this time all projects
|
|
||||||
are linked - we will only want the 'complete' and assigned to a team projects.</li>
|
|
||||||
<li>Dennis: Make sure it will work with more than one judging round. For now it is
|
|
||||||
set up only for one judging round. It is unknow what will happen if there is
|
|
||||||
more than one round. Perhaps an option during linking to select which round.</li>
|
|
||||||
<li>Dennis: Add project number and team numbers to the exported files where
|
|
||||||
usefull. add team_id and project_id to preslug export (for reference)</li>
|
|
||||||
<li>Anyone: Add to TRUNK version. Dennis cannot do due to not being able to get
|
|
||||||
Trunk fully running - needs help.</li>
|
|
||||||
<li>Anyone: Clean up the front end user interface. <ul>
|
|
||||||
<li>Set up for English or French (routines should be in sfiab_common.inc.php - if
|
|
||||||
not, add them there if same as in SFIAB.</li>
|
|
||||||
<li>Make the menus and tables etc all look like SFIAB.</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Anyone: Test with different schemes - perhaps we could set up Evaluations
|
|
||||||
for those current users who
|
|
||||||
are interested in or currently using a scoring method.</li>
|
|
||||||
<li>Anyone: Make it a true 'plug-in'. Download and add to SFIAB versus currently
|
|
||||||
'part of' SFIAB - or not</li>
|
|
||||||
<li>Etc.</li>
|
|
||||||
</ul>
|
|
||||||
<p> </p>
|
|
||||||
<p align="center"><a name="intro" id="intro"></a><b>Introduction</b></p>
|
|
||||||
<p align="left">Evaluations is a plug-in to SFIAB. That means you can add it
|
|
||||||
to your current version of SFIAB with minimal changes to your current SFIAB
|
|
||||||
version. No changes will be made to your current SFIAB data. In other
|
|
||||||
words, no matter where you are in the SFIAB process for your event, you can add
|
|
||||||
and take advantage of Evaluations and not worry about it creating problems.
|
|
||||||
If you decide to not use it in the future you can 'unplug' it without any effect
|
|
||||||
on your current setup or data. <br />
|
|
||||||
</p>
|
|
||||||
<p align="left">There are two changes in the configuration of SFIAB that must be
|
|
||||||
implemented during the installing of Evaluations:<br />
|
|
||||||
SFIAB must be configured for judging as follows:<br />
|
|
||||||
- the table config must have an entry with var = 'score_entry_enable' and
|
|
||||||
val = 'yes' <br />
|
|
||||||
- the table judges_teams_timeslots_projects_link must have a field 'score'
|
|
||||||
Float length 5.2 null=yes<br />
|
|
||||||
Configuring SFIAB in this manner will also enable the necessary links in the
|
|
||||||
admin menu and the judges menu for using Evaluations. This is the SFIAB
|
|
||||||
configuration used my one or more fairs in the past.
|
|
||||||
</p>
|
|
||||||
<p align="left">Evaluations provides a very configurable method of capturing
|
|
||||||
'scores' for your projects. You can configure multiple schemes used for
|
|
||||||
scoring! For each scheme you design the evaluation criteria to use, the
|
|
||||||
weighting for each criteria and the levels (choices) judges can select from for
|
|
||||||
each criteria. With multiple schemes you can design a completely different
|
|
||||||
method of evaluation for each different type of projects (i.e. senior divisions
|
|
||||||
versus junior divisions, team projects, etc.) When your organization
|
|
||||||
changes the way they want you to evaluate projects, just change the Evaluations
|
|
||||||
setup.</p>
|
|
||||||
<p align="left">Evaluations provides several methods of collecting your judge teams
|
|
||||||
(judges) evaluations. Web pages are built for each scheme for entry on the
|
|
||||||
web. CSV files are created for use with scanners or for creating your own
|
|
||||||
forms to be used by the judge teams (judges)</p>
|
|
||||||
<p align="left">And, all the calculations are done for you. Evaluations uses the
|
|
||||||
information in your setup to calculate scores from the entries made by the
|
|
||||||
judges. The code works for all combinations of possible schemes - it all driven
|
|
||||||
by the tables. So, once you can set up your scheme(s) Evaluations can do the
|
|
||||||
math. A unique averaging method is used when you collect more than
|
|
||||||
one evaluation for each project so all the valid data is used, even if one judge
|
|
||||||
team leaves out a mark or makes multiple marks on their evaluations forms (i.e.
|
|
||||||
when using scanners).. </p>
|
|
||||||
<p><br />
|
|
||||||
</p>
|
|
||||||
<p align="center"><strong><a name="process" id="process"></a>Process</strong></p>
|
|
||||||
<p align="left">The process in a nutshell is:</p>
|
|
||||||
<p align="left">1. Install Evaluations plug-in:</p>
|
|
||||||
<p align="left">2. Set up your evaluation schemes, criteria and values:</p>
|
|
||||||
<p align="left">3. After all your projects and judge teams are configured - Link
|
|
||||||
Evaluations to your SFIAB data. </p>
|
|
||||||
<p align="left">4. If required, Export the necessary data for use by external
|
|
||||||
programs or scanners to collect the evaluations:<br />
|
|
||||||
- CSV files are created for download for your use in
|
|
||||||
programming scanners and pre slug of the scanner forms<br />
|
|
||||||
- CSF files can be use to create your own evaluation
|
|
||||||
forms.</p>
|
|
||||||
<p align="left">5. The judge teams (judges) do the evaluations and 'mark' the
|
|
||||||
appropriate level for each of the criteria for the scheme that applies to the
|
|
||||||
project.</p>
|
|
||||||
<ul>
|
|
||||||
<li> Web forms for entries are used for teams who log into the web site. Any
|
|
||||||
committee member can log in, then enter the team number to bring up the
|
|
||||||
projects assigned to that team. </li>
|
|
||||||
<li> The team enters the evaluation for each project assigned.</li>
|
|
||||||
<li> Other methods of collecting evaluations can be implemented using the exported
|
|
||||||
CSV files. </li>
|
|
||||||
</ul>
|
|
||||||
<p align="left">6. The data is collected into a table in Evaluations. </p>
|
|
||||||
<ul>
|
|
||||||
<li>If the judges use a web page the data goes directly into the table. </li>
|
|
||||||
<li>Uploads from a specified CSV file format will also load the table so... no
|
|
||||||
matter what technique you use the data is collected in a standard format for the
|
|
||||||
next steps.</li>
|
|
||||||
</ul>
|
|
||||||
<p align="left">7. The data is processed (a button push). </p>
|
|
||||||
<ul>
|
|
||||||
<li> A score is created for each judge / project assignement with complete
|
|
||||||
'captured' data. </li>
|
|
||||||
<li>An average evaluation score is created for each project that is the average of
|
|
||||||
all the evaluations done for the project.</li>
|
|
||||||
<li>These scores can be used as desired by the fair officials </li>
|
|
||||||
</ul>
|
|
||||||
<p align="left">8. If a caucus of the judge team or the official responsible for a
|
|
||||||
particular division requires some adjustments to the
|
|
||||||
evaluations scores, that is accomplished by the team leaders (chair persons or
|
|
||||||
other officials) -
|
|
||||||
resulting in the final scores for the projects in each division.</p>
|
|
||||||
<p align="left">9. Reports and or CSV files are available for the final results.</p>
|
|
||||||
<p align="left">10. A tool is (TBD) provided to facilitate assigning the winners of
|
|
||||||
some of the category awards (1st, 2nd, 3rd prizes and honorable mentions) where
|
|
||||||
those winners simply rely on the divisional ranking results.</p>
|
|
||||||
<p align="left"> </p>
|
|
||||||
<p align="center"><strong><a name="setup" id="setup"></a>Setup</strong></p>
|
|
||||||
<p align="left">It is imperative you understand how to correctly setup Evaluations
|
|
||||||
for your event. With that in mind we will try our best to explain how the
|
|
||||||
setup works and the various options that are available.</p>
|
|
||||||
<p align="left"><strong>Definitions:</strong></p>
|
|
||||||
<p align="left"><strong>Scheme:</strong> A method of evaluating a set of projects -
|
|
||||||
perhaps differently than other projects. For instance you might have a
|
|
||||||
scheme for team projects and another scheme for non-team projects. Or, you
|
|
||||||
might have different schemes for each division in your event. Each scheme has a
|
|
||||||
specific set of criteria, criteria weights and evaluation levels (choices) used
|
|
||||||
to evaluate a project and then to calculate a score for that project. Each
|
|
||||||
project is assigned a scheme. You can have as many schemes as you like. Each
|
|
||||||
scheme has an id, a name and a selection statement. The selection statement is
|
|
||||||
used to select which scheme is used for each project. The selection
|
|
||||||
statement has three parts. the 'item', the 'condition' and the 'value'.
|
|
||||||
For example
|
|
||||||
'div > 1'. Each part must be separated by one space character. Each project that matches the selection statement of one of the
|
|
||||||
schemes is assigned that scheme. Here are a couple of examples of schemes:</p>
|
|
||||||
<p align="left">scheme id name
|
|
||||||
selection statement
|
|
||||||
result<br />
|
|
||||||
1
|
|
||||||
ISEF scoring
|
|
||||||
team = no
|
|
||||||
projects with one student are assigned scheme id 1<br />
|
|
||||||
2
|
|
||||||
ISEF (Team)
|
|
||||||
team = yes projects with two or
|
|
||||||
more students are assigned scheme id 2</p>
|
|
||||||
<p align="left">scheme id name
|
|
||||||
selection statement
|
|
||||||
result assumes we
|
|
||||||
have 2 categories setup - Junior = 1, Senior =2<br />
|
|
||||||
1
|
|
||||||
Junior Category cat = 1
|
|
||||||
projects with category id = 1 (junior) are assigned scheme id 1. <br />
|
|
||||||
2
|
|
||||||
Senior Category cat > 1
|
|
||||||
projects with category id = 2 or higher are assigned scheme id 2. (could use cat
|
|
||||||
= 2 also)</p>
|
|
||||||
<p align="left"><strong><em>'item':</em></strong> The 'item' part can have and of
|
|
||||||
the following values: (more can be added it your request but it requires a
|
|
||||||
code change.)<br />
|
|
||||||
team: If the project has one student then the value of team is
|
|
||||||
'no'. If the project has more than one student then the value of
|
|
||||||
team is 'yes' <br />
|
|
||||||
cat: This represents the setting of the category_id
|
|
||||||
assigned to the project. You set up categories in SFIAB and each project gets
|
|
||||||
assigned one of those categories. <br />
|
|
||||||
div: This represents the setting of the division_id
|
|
||||||
assigned to the project. You set up divisions in SFIAB and each project
|
|
||||||
gets assigned one of those divisions.<br />
|
|
||||||
grade: This represents the grade of the project's student. For teams,
|
|
||||||
grade is the grade of the team member with the highest grade.<br />
|
|
||||||
cwdiv: This represents the Canada wide science fair division id
|
|
||||||
(cwsfdivisionid field in projects).</p>
|
|
||||||
<p align="left"><em><strong>'condition'</strong></em>: You are allowed to use
|
|
||||||
any one of these symbols as the 'condition' part of the scheme selection
|
|
||||||
criteria:<br />
|
|
||||||
= Equal<br />
|
|
||||||
!= Not Equal<br />
|
|
||||||
< Less Than<br />
|
|
||||||
> Greater Than
|
|
||||||
</p>
|
|
||||||
<p align="left"><strong><em>'value:'</em></strong> The 'value' part represents
|
|
||||||
the value of the Field for each project. For instance team can have a
|
|
||||||
value of 'yes' or 'no'. Cat can have values like 0,1,2... - whatever you used
|
|
||||||
for the Category Ids when you set up Age Categories in SFIAB. cwsfdivisionid has
|
|
||||||
values those in Canada should understand.</p>
|
|
||||||
<p align="left">So, you can setup criteria like 'team = yes' or 'div =
|
|
||||||
1' or 'div < 3' or 'team != no' etc. Except for team (value = 'yes' or
|
|
||||||
'no) it is important to use a value that is set up for that field in SFIAB else
|
|
||||||
the scheme_id will not be set correctly in Evaluations projects data.</p>
|
|
||||||
<p align="left"><strong>Criteria:</strong> Each evaluation scheme will have a set
|
|
||||||
of criteria. These are what the judge team considers when comparing a
|
|
||||||
project with other projects and with a standard. Examples of criteria are:
|
|
||||||
'Scientific Thought', 'Skill', 'Thoroughness', 'Teamwork', 'Research
|
|
||||||
Skill', Etc. You create the criteria for each scheme used for your event.
|
|
||||||
In fact you can have different criteria and a different number of criteria for
|
|
||||||
each scheme For instance, elementary school projects may require only two
|
|
||||||
criteria - 'Scientific Approach' 'Completeness' where as a senior
|
|
||||||
school projects will require criteria of more relevance to the project advancing
|
|
||||||
to the next level.</p>
|
|
||||||
<p align="left"><strong>Levels: </strong> Each evaluation scheme will have a set of
|
|
||||||
levels. Levels are like grades. You determine the number of levels
|
|
||||||
your evaluations will have and the value assigned to each level for each scheme.
|
|
||||||
For instance you might have levels of A, B, C, D, F with values of 4,3,2,1,0 for
|
|
||||||
one scheme and levels of Exceptional, Excellent, Very Good , Good, Acceptable
|
|
||||||
with values of 5,4,3,2,1 for another scheme. The values do not have to be a
|
|
||||||
sequence of integers but that works best. There are also optional 'special use'
|
|
||||||
levels you can create that allow you to do error checking on the judges entries
|
|
||||||
and take the appropriate action if the entry has errors. Special use
|
|
||||||
levels are not used in calculating a score. An example is to assign a 'special
|
|
||||||
use' level of 'No Entry' with a value of 0. Then when a scanner or
|
|
||||||
any other process used to collect entries detects that there is no mark for a
|
|
||||||
criteria it can assign the value 0 to the entry and Evaluations knows to 1.) not
|
|
||||||
use that criteria entry in the calculations and 2.) indicate the error in the
|
|
||||||
status for that entry. The short 4 character level_code is then added to the
|
|
||||||
status for that entry. Setting a 'special use' level "MultipleMarks" with
|
|
||||||
a value of 7 would allow the collection process (i.e. a scanner) to set that
|
|
||||||
value when multiple entries are made for a criteria. Evaluations knows to not
|
|
||||||
use that criteria's entry in the calculations and can indicate the error in the
|
|
||||||
status.</p>
|
|
||||||
<p align="left"><strong>Weighting:</strong> Each criteria will have a weight
|
|
||||||
assigned in such a way that the sum of the weights for all the criteria to be
|
|
||||||
used is = 100. Lets do an example: Say one of your evaluations schemes has
|
|
||||||
4 levels -L1, L2, L3 and L4 with values of 1,2,3,4 and the scheme has 3
|
|
||||||
criteria C1, C2 and C3. with weights of 20,30, 50. Note the weights add up
|
|
||||||
to 100. Define level_value as the entry made by the judge for a given criteria.
|
|
||||||
It will be 1,2,3 or 4 in this example. Also define max_level_val as the
|
|
||||||
maximum level value used in calculating a score (i.e. not a 'special use' level)
|
|
||||||
In this example max_level_val = 4. Given all that, a score in this example is
|
|
||||||
calculated as follows:</p>
|
|
||||||
<p align="left">score = ( C1.level_value * C1.weight + C2.level_value * C2.weight
|
|
||||||
+ C3.level_value * C3.weight) / ( max_level_val) </p>
|
|
||||||
<p align="left">If all level_values are = 4 (the perfect project), then:</p>
|
|
||||||
<p align="left">perfectscore = (4*20 + 4*30 + 4*50) / 4</p>
|
|
||||||
<p align="left">perfectscore = 80 + 120 + 200) /4</p>
|
|
||||||
<p align="left">perfectscore = 400 / 4 = 100 </p>
|
|
||||||
<p align="left">the lowest score for this scheme will be:</p>
|
|
||||||
<p align="left">lowest score = (1*20 + 1* 30 + 1* 50) / 4 = 25</p>
|
|
||||||
<p align="left">Note: You may enter a criteria with a weight of '0'
|
|
||||||
This allows keeping the number of criteria the same for each scheme. This
|
|
||||||
special case is used to provide compatibility with the Exported CSV files used
|
|
||||||
to pre slug the Apperson Education Products Benchmark 3000 scanners. </p>
|
|
||||||
<p align="left">Setup: Now that you understand (hopefully) the definitions we
|
|
||||||
can explain how you set up 'Evaluations'</p>
|
|
||||||
<p align="left">1.) Decide how many schemes you will need. Most events will
|
|
||||||
use only one scheme, some will want two or more. Enter the schemes in the
|
|
||||||
'Create / Edit Schemes' page. </p>
|
|
||||||
<p align="left">2.) For each scheme enter the evaluation criteria to be used for that scheme
|
|
||||||
using the 'Create / Edit Criteria' page.</p>
|
|
||||||
<p align="left">3.) For each scheme enter the evaluatons levels to be used for that scheme
|
|
||||||
in the 'Create / Edit Levels' page.</p>
|
|
||||||
<p align="left">When Evaluations is first installed, schemes, criteria and levels
|
|
||||||
are created for the ISEF evaluations (2010) and to use the Apperson Education
|
|
||||||
Products Benchmark 3000 scanners. You can use these, eliminate the 'teams'
|
|
||||||
scheme or create your own schemes, criteria and levels. </p>
|
|
||||||
<p align="left"> </p>
|
|
||||||
<p align="center"><strong><a name="actions" id="actions"></a>Step By Step Process</strong></p>
|
|
||||||
<p align="center"><a name="install" id="install"></a><strong>Installation</strong></p>
|
|
||||||
<p align="left">To install Evaluations plug-in follow these steps:</p>
|
|
||||||
<ul>
|
|
||||||
<li>If the folder 'plugins' does not exist in your SFIAB website root (along with
|
|
||||||
admin, data, Rmail and other folders) add the folder 'plugins'.</li>
|
|
||||||
<li>Place all the folders and files frome the evaluations package under/in the
|
|
||||||
folder 'plugins'.This will be the main folder 'evaluations' and under that
|
|
||||||
folder many files, and some other folders (like 'db', 'uploads', 'docs'...)</li>
|
|
||||||
<li>Make the evaluations folder 'uploads' writable. How to do that depends on your
|
|
||||||
web server.</li>
|
|
||||||
<li>When you are done you should have this setup of folders
|
|
||||||
<p align="left">'root' (the base folder for sfiab)<br />
|
|
||||||
'admin' the SFIAB admin folder<br />
|
|
||||||
... other SFIAB folders<br />
|
|
||||||
'plugins' ( a folder for all plugins)<br />
|
|
||||||
'evaluations' (the Evaluations
|
|
||||||
plug-in base folder)<br />
|
|
||||||
'db' folder
|
|
||||||
(the Evaluations data base creation and update files and the various default
|
|
||||||
evaluation setup files)<br />
|
|
||||||
&nbs 'docs' folder (files
|
|
||||||
for information or download)<br />
|
|
||||||
'images' folder<br />
|
|
||||||
'uploads' folder (uploaded
|
|
||||||
files are placed here while in use - then deleted - folder must be 'writable'.)<br />
|
|
||||||
files...
|
|
||||||
The various files for Evaluations.<br />
|
|
||||||
.....<br />
|
|
||||||
'Rmail' ... or other SFIAB folders.<br />
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p align="left">There will be no link in SFIAB to get to the main page for
|
|
||||||
evaluations so.. do the following:/>
|
|
||||||
- Log into SFIAB as a super user.<br />
|
|
||||||
- In you web browser go to 'SFIAB/plugins/evaluations/eval_index.php'<br />
|
|
||||||
(Where 'SFIAB' is you main browser root name for your SFIAB
|
|
||||||
installation)<br />
|
|
||||||
- If Evaluations is not installed you will be quided through the steps to
|
|
||||||
install and set up Evaluations.</p></li>
|
|
||||||
</ul>
|
|
||||||
<p>What the installation does:</p>
|
|
||||||
<ul>
|
|
||||||
<li>Adds tables to SFIAB database. Tables eval_config, eval_projects, eval_schemes,
|
|
||||||
eval_criteria, eval_levels, eval_projects_entries.</li>
|
|
||||||
<li>Processes any database updates based on the Evaluations revision and sql
|
|
||||||
changes.</li>
|
|
||||||
<li>Proceeds to the set up where:
|
|
||||||
<ul>
|
|
||||||
<li>The only two changes to existing SFIAB database are made:
|
|
||||||
<ul>
|
|
||||||
<li>An entry is made in the SFIAB table 'config' setting var =
|
|
||||||
'score_entry_enable' with val = 'yes' (if that entry does not already exist).</li>
|
|
||||||
<li>If the SFIAB table 'judges_teams_timeslots_projects_link' does not have the
|
|
||||||
field 'score' then that field is added. Score is entered as Float (5,2)
|
|
||||||
(Floating point 5 digits, 2 after the decimal point. I.E. 100.00 or 44 or
|
|
||||||
66.66).</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>You You may select from one or more pre-configured evaluations schemes or enter your
|
|
||||||
own evaluation scheme, criteria and levels for your event. (TBD) For now,
|
|
||||||
the ISEF schemes, criteria and levels are set up.</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<p style="text-align: center"><b>Using Evaluations</b></p>
|
|
||||||
<p>Link Evaluations to Data base: For Evaluations to function it must be
|
|
||||||
linked to the SFIAB data. This step creates (or updates) all the linkages so
|
|
||||||
that Evaluations has the necessary information from SFIAB (read only) to
|
|
||||||
accomplish the tasks designed into Evaluations.</p>
|
|
||||||
<p align="left">Assign judge teams (or judges) to the projects they are to
|
|
||||||
evaluate. The default here is to use the judge_team_projects assignments of
|
|
||||||
SFIAB so it is important that these assignments are setup in SFIAB and that you run the
|
|
||||||
'Link Evaluations' after they are setup (or if they are changed) to update the Evaluations
|
|
||||||
information. Optionally, you can go through a completely different assignment of
|
|
||||||
judges to projects. This feature is NOT IMPLEMENTED for revision 100 of
|
|
||||||
Evaluations and will be implemented only if enough requests are generated.</p>
|
|
||||||
<p align="left">Create the evaluations documents or files required to enter the
|
|
||||||
evaluations. This step can do several options./>
|
|
||||||
&nbs 1.) A web form 'Evaluations Web Entry' created automatically for
|
|
||||||
each judge teams' assigned projects using the Evaluations and SFIAB setup. The form will have the following:<br />
|
|
||||||
- an entry for the team (or judge)
|
|
||||||
number doing the evaluation. (one of the judge team members must be logged
|
|
||||||
in.)<br />
|
|
||||||
- an entry (selection) of one
|
|
||||||
of the assigned project numbers.<br />
|
|
||||||
- a web form table is presented with bubbles to
|
|
||||||
mark for the project as follows<br />
|
|
||||||
|
|
||||||
criteria criteria criteria
|
|
||||||
....<br />
|
|
||||||
level
|
|
||||||
[ ] [ ]
|
|
||||||
[ ]<br />
|
|
||||||
level
|
|
||||||
[ ] [ ]
|
|
||||||
[ ]<br />
|
|
||||||
level
|
|
||||||
[ ] [ ]
|
|
||||||
[ ] <br />
|
|
||||||
- a button to submit the evaluation
|
|
||||||
entries</p>
|
|
||||||
<p align="left"> 2.) CSV download files to be used by your organization
|
|
||||||
to create your own web pages, or score forms or to pre slug standard forms or to
|
|
||||||
import to scanners. The files should have enough data to accomplish your
|
|
||||||
process. If not, request additional data be added. (coding changes)<br />
|
|
||||||
3.) specific CSV files to be used to:<br />
|
|
||||||
- Load the
|
|
||||||
'student' data into the Apperson Education Products Benchmark 3000 scanner
|
|
||||||
(requires a specific scheme setup).<br />
|
|
||||||
- Pre slug the
|
|
||||||
Apperson Education Products Benchmark 3000 'Science Fair evaluation'
|
|
||||||
forms. </p>
|
|
||||||
<p align="left">Evaluate the projects: During this time the judge teams (or
|
|
||||||
judges) either mark the forms for your event, enter the evaluations on the web
|
|
||||||
page or some other process to capture the required information. For each
|
|
||||||
project, each evaluation the following will be required:<br />
|
|
||||||
- project number (this is automatic in web page and Apperson
|
|
||||||
scanner)<br />
|
|
||||||
- Team or judge number (this is required to verify that that
|
|
||||||
team or judge has been assigned to the project.<br />
|
|
||||||
- a list of criteria_id, level_id pairs representing the
|
|
||||||
evaluation of the project. (automatic with Apperson scanner and web page)<br />
|
|
||||||
- other optional items not yet designed.</p>
|
|
||||||
<p align="left">Enter the evaluations: The data from the evaluations is
|
|
||||||
entered into Evaluations tables. This is done by the web page 'Import
|
|
||||||
Evaluations Data (Apperson Scanner)' or by an upload of a CSV file(s) created by you
|
|
||||||
with the correct specifications. Details TBD.<br />
|
|
||||||
</p>
|
|
||||||
<p align="left">Calculate the scores: This is simply a button push using
|
|
||||||
page "Calculate Scores'. It
|
|
||||||
calculates the individual score for each evaluation and... calculates the
|
|
||||||
project's evaluation scorewhich is an average all of the evaluations for that
|
|
||||||
project. </p>
|
|
||||||
<p align="left">Enter the final scores: After a caucus of the judge team(s) or
|
|
||||||
divisional officials and judges,
|
|
||||||
some adjustment will sometimes be required to the projects scores. This can be
|
|
||||||
accomplished using a Evaluations web page (TBD)<br />
|
|
||||||
</p>
|
|
||||||
<p align="left"> </p>
|
|
||||||
<p align="center"><strong><a name="examples" id="examples"></a>Examplesrong></p>
|
|
||||||
<p align="left">examples: TBD</p>
|
|
||||||
<p align="left"> </p>
|
|
||||||
<p align="center"><strong><a name="tables" id="tables"></a>Tables</strong></p>
|
|
||||||
<p align="left">TablTable descriptions TBD for now see the
|
|
||||||
db.eval.full.100.sql file or browse the tables with phpmyadmin.</p>
|
|
||||||
<p align="left">eval_projects: Caution: contains all projects,
|
|
||||||
even those not assigned. (may change this later - or not)
|
|
||||||
<p align="left">eval_projects-entries. A copy of
|
|
||||||
judges_teams_timeslots_projects_links with additional fields (
|
|
||||||
a record for each project - judge team assignment with the scheme_id, and an
|
|
||||||
entry for the selected value_id during judging.</p>
|
|
||||||
<p align="left"> </p>
|
|
||||||
|
|
||||||
<p align="center"><b><a name="apperson"></a><strong><span class="style1">Setup SFIAB
|
|
||||||
to use Apperson Scanner</span></strong></b></p>
|
|
||||||
<p style="text-align: center">
|
|
||||||
<b>About the Apperson Education Products Benchmark 3000 scanner:</b></p>
|
|
||||||
<p style="text-align: center">
|
|
||||||
<a href="http://www.appersonedu.com/default.aspx" target="_blank">
|
|
||||||
Apperson Education Products</a></p>
|
|
||||||
<p style="text-align: center">
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<img alt="The Apperson Benchmark 3000 scanner"
|
|
||||||
src="images/BenchMark3000.jpg" style="width: 760px; height: 142px" /></p>
|
|
||||||
<p>
|
|
||||||
Apperson Education Products worked with a regional science fair in New Mexico to
|
|
||||||
develop a special 'Science Fair' Option on their Benchmark 3000 scanner.
|
|
||||||
This option is very robust. You download and import your fair's data into the
|
|
||||||
scanners student database so that means only perfect forms will be scanned
|
|
||||||
without rejection. Forms with multiple marks or missing
|
|
||||||
marks are rejected but the good data is captured. Forms with a judge and exhibit combination not in the student database
|
|
||||||
are also rejected. The scores collected from the forms are exported - then uploaded to
|
|
||||||
your fair's Judges Evaluations for processing on the website. If you are
|
|
||||||
interested in using Apperson Benchmark scanner contact Apperson Education
|
|
||||||
Products. Be sure to ask for the 'Science Fair' add-on option. <b>
|
|
||||||
<br />
|
|
||||||
Here are the requirements to use the Apperson Scanners:<br />
|
|
||||||
- You will require a PC running Microsoft Windows and must have a license for
|
|
||||||
MS Word.
|
|
||||||
<br />
|
|
||||||
- You may have no more than 99 projects in a given project Division.<br />
|
|
||||||
- You must setup Evaluations Schemes, Criteria and Levels as described below.</b></p>
|
|
||||||
<p>
|
|
||||||
<a href="http://www.appersonedu.com/scanners/benchmarktestscanner.aspx"
|
|
||||||
target="_blank">
|
|
||||||
Apperson Education Products - Benchmark 3000</a> </p>
|
|
||||||
<p>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<img alt="Apperson Science Fair Score Form"
|
|
||||||
src="images/AppersonScoreForm.jpg" style="width: 750px; height: 575px" /><br />
|
|
||||||
|
|
||||||
<br />
|
|
||||||
Sample of Form A1308 - the 'science fair' score form from Apperson
|
|
||||||
Education Products<br />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p align="center" style="text-align: left">Here is how the process works:</p>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
Data from your fair is used to 'pre-slug' the score forms. A bar code with
|
|
||||||
the project number and judge number (team number) is printed on the form along
|
|
||||||
with other information. The bar code is not shown in the image above - it is
|
|
||||||
printed to the right of the top text box marked 'SAMPLE'. A MS Word document is included in
|
|
||||||
the Evaluations package as well as
|
|
||||||
the file you can export to use with the MS Word document to accomplish this
|
|
||||||
task using a 'Mail Merge' type process. The boxes with the word 'SAMPLE' as well as the box below 'Marking
|
|
||||||
Instruction are available for your text. The supplied MS Word document and
|
|
||||||
the Export file are designed to meet most needs but you can modify the document
|
|
||||||
to meet your fair's needs.</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
Another exported file creates the 'student data' that is loaded into the
|
|
||||||
scanner. That file contains the project numbers and judge number as well as
|
|
||||||
other project and judge identification information. The file is loaded
|
|
||||||
into the scanner program (DataLink) and is used to verify barcodes on the forms
|
|
||||||
with the data in the scanning program.</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
Judges (teams) mark the forms for their assigned projects. The criteria
|
|
||||||
and levels provided are those used by ISEF (as of this publish date).</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
The forms are scanned and data gathered. Forms not matching the student
|
|
||||||
data base are rejected and no data is created. Forms matching the student
|
|
||||||
data base create a data record and are not rejected. Forms with multiple marks
|
|
||||||
in any criteria or missing marks for any criteria are rejected but the data is
|
|
||||||
capatured.
|
|
||||||
<br />
|
|
||||||
- The marks on the forms create numbers corresponding to the 'value_id' as
|
|
||||||
described below. 0 meaning missing mark, 7 meaning multiple marks</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
The captured data records are 'exported' from the scanner <strong> at any
|
|
||||||
time in the scanning process -</strong>creating a text file.</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
The text files are 'imported' to SFIAB Evaluations and the data placed in a
|
|
||||||
database table for processing.</p>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
The 'Calculate Scores' selection in Evaluations processes the data and creates
|
|
||||||
judge (team( scores and a project score based on the imported data.
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<p align="center" style="text-align: left">If you want to use the Apperson Scanner
|
|
||||||
to record evaluations you must setup SFIAB to meet certain conditions - as
|
|
||||||
follows: </p>
|
|
||||||
<p align="center" style="text-align: left">The main requirement is that the scanner
|
|
||||||
(and forms) require project numbers from 1 to 9999 and Judge numbers from 1 to
|
|
||||||
9999<br />
|
|
||||||
To accomplish this the following must be true: If the Category digit(s) are
|
|
||||||
removed from the SFIAB project number the resulting numbers must be unique.<br />
|
|
||||||
<br />
|
|
||||||
Here is one way to accomplish the above requirements:<br />
|
|
||||||
* Set the Configuration variables in SFIAB as follows:<br />
|
|
||||||
-Allows for the setup of different divisions for each category: =
|
|
||||||
Yes (not sure, perhaps No will also work???)<br />
|
|
||||||
-Project Numbering Format = CDN
|
|
||||||
(Category, Division, Number)<br />
|
|
||||||
* Project Age Categories: The Categories' IDs must be an integer from 1 to 9
|
|
||||||
(usually 1 = Junior, 2 = Senior)<br />
|
|
||||||
* Divisions: The Divisions' IDs must be integers from 1 to 99
|
|
||||||
(Usually Junior = 1 to n, Senior = n+1 to ..(99max)<br />
|
|
||||||
* When creating the Divisions, Create a separate Division ID for each
|
|
||||||
Category even if the Division name is the same.<br />
|
|
||||||
( Do not assign more than one category to a Division)<br />
|
|
||||||
Example:<br />
|
|
||||||
Category
|
|
||||||
Division<br />
|
|
||||||
1 - Junior
|
|
||||||
1 - Animal Science (junior)
|
|
||||||
<br />
|
|
||||||
1 - Junior
|
|
||||||
2 - Chemistry (junior)<br />
|
|
||||||
|
|
||||||
etc ...<br />
|
|
||||||
2 - Senior
|
|
||||||
22- Animal Science (senior)<br />
|
|
||||||
2 - Senior
|
|
||||||
23 - Chemistry<br />
|
|
||||||
etc<br />
|
|
||||||
Thus, project Numbers are never more than 5 digits - i.e. CDDNN
|
|
||||||
where NN is the exhibit sub number in the specific Division. And, when the 'C'
|
|
||||||
is removed the remaining number is still a unique number. Project numbers used
|
|
||||||
in the score form barcode and in the 'student' data are then the SFIAB project
|
|
||||||
number stripped of the first digit (the category digit). However...<br />
|
|
||||||
<b>VERY IMPORTANT - This means there can be no more than 99 projects in a given
|
|
||||||
category-division.</b><span class="style2"><br />
|
|
||||||
</span> If that becomes a problem for your fair, a different
|
|
||||||
SFIAB numbering method could be invented.<br />
|
|
||||||
|
|
||||||
<br />
|
|
||||||
Other methods may also work. If you have a suggestion, let us know.on, let us know.<br />
|
|
||||||
<br />
|
|
||||||
Evaluation Schemes You can have 2 - Non-Team and Team (ISEF
|
|
||||||
eliminated special scoring for teams in 2011 so you may want just one evaluation
|
|
||||||
scheme for all projects.)<br />
|
|
||||||
Evaluation Criteria You must have 6 criteria for each scheme with
|
|
||||||
Ids from 1 to 6 as follows *you can use ISEF weighting or your own)<br />
|
|
||||||
id name
|
|
||||||
weight non team weight team<br />
|
|
||||||
1 -Creative Ability
|
|
||||||
30
|
|
||||||
25<br />
|
|
||||||
2 -Scientific Thought
|
|
||||||
30
|
|
||||||
25<br />
|
|
||||||
3 -Thoroughness
|
|
||||||
15
|
|
||||||
12<br />
|
|
||||||
4 -Skill
|
|
||||||
15
|
|
||||||
12<br />
|
|
||||||
5 -Clarity
|
|
||||||
10
|
|
||||||
10<br />
|
|
||||||
6 -Teamwork
|
|
||||||
0
|
|
||||||
16<br />
|
|
||||||
<br />
|
|
||||||
You must have 7 levels for each criteria with Ids from 0 to 7 (6 not used)
|
|
||||||
as follows: (You could own 'level_values' but for ISEF the level-values are the
|
|
||||||
same as the level_id.
|
|
||||||
</p>
|
|
||||||
<p align="center" style="text-align: left">id value name
|
|
||||||
spec_use Spec_use_code<br />
|
|
||||||
0 0 No mark
|
|
||||||
yes NoMk<br />
|
|
||||||
1 1 Acceptable
|
|
||||||
no<br />
|
|
||||||
2 2 Good
|
|
||||||
no<br />
|
|
||||||
3 3 Very Good
|
|
||||||
no<br />
|
|
||||||
4 4 Excellent
|
|
||||||
no<br />
|
|
||||||
5 5 Exceptional
|
|
||||||
no<br />
|
|
||||||
7 7 MultipleMark yes
|
|
||||||
MltM<br />
|
|
||||||
Note: level_id of 6 is not used<br />
|
|
||||||
</p>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
IMPORT data from Apperson Scanner:<br />
|
|
||||||
The file created by the scanner has the following format (the import code is
|
|
||||||
designed to use this format)<br />
|
|
||||||
"Apperson_proj_num","Judgeteam_num","CreativeAbility.level_id","ScientificThouth.level_id","Thoroughness.level_id","Skill.level_id","Clarity.level_id","Teamwork.level_id","seq#"<br />
|
|
||||||
wherwhere level_id are 0,1,2,3,4,5,7 0 = no mark
|
|
||||||
7 = double mark and seq# is a 6 digit sequence identifier created by the
|
|
||||||
scanner.<br />
|
|
||||||
<br />
|
|
||||||
</p>
|
|
||||||
<p align="center" style="text-align: left">
|
|
||||||
<br />
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 40 KiB |
Binary file not shown.
Before Width: | Height: | Size: 76 KiB |
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
@ -1,93 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB Evaluations Calculate Scores</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Calculate Scores</h2><br /><br />";
|
|
||||||
echo "<br />";
|
|
||||||
echo "Click the button to Calculate and enter scores values";
|
|
||||||
echo "<form method=\"post\" action=\"eval_calc_scores.php\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"calc\" />";
|
|
||||||
echo "<br />";
|
|
||||||
echo "<input type=\"submit\" value=\"Calculate Scores\">";
|
|
||||||
echo "</form>";
|
|
||||||
if(!$_POST['action'] == "calc")
|
|
||||||
{
|
|
||||||
echo "</body>";
|
|
||||||
echo "</html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
echo "<br />All Scores calculated and saved!<br />";
|
|
||||||
echo "<br />Development Note: This updates the score field in 'judges_teams_timeslots_projects_link' for every team/project with a 'complete' evaluation entry<br />";
|
|
||||||
echo " and updates the eval_score (current average) and eval_score_status fields in table eval_projects for every project for which an average score can be calculated.<br />";
|
|
||||||
echo "For test purposes (to be removed later) it lists just the project number for each project, then lists the scores details for the last project in the list.<br /><br /> ";
|
|
||||||
// do all projects that qualify for judging (in the judges_teams_timeslots_projects_link table)
|
|
||||||
$q = mysql_query("SELECT DISTINCT projects_id from judges_teams_timeslots_projects_link");
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$ret_array = calc_scores($r->projects_id); // cal_scores is in eval_common.inc.php
|
|
||||||
if($ret_array == 'error') {
|
|
||||||
echo " error";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo " ".$ret_array[project_num];
|
|
||||||
// put scores in 'judges_teams_timeslots_projects_link'
|
|
||||||
for ($i=0;$i < $ret_array[num_teams]; $i++){
|
|
||||||
$team_id = $ret_array[team_scores][$i][team_id];
|
|
||||||
$score = $ret_array[team_scores][$i][team_score];
|
|
||||||
if (is_null($score)) {$score = "NULL";}
|
|
||||||
$up = mysql_query("UPDATE judges_teams_timeslots_projects_link SET score = ".$score.
|
|
||||||
" WHERE judges_teams_id = '".$team_id."' AND projects_id = '".$r->projects_id."' ");
|
|
||||||
}
|
|
||||||
// update eval_judges table
|
|
||||||
$up = mysql_query("UPDATE eval_projects SET eval_score = '".$ret_array[eval_score]."', eval_score_status = '".$ret_array[eval_score_status]."' WHERE project_id = '".$r->projects_id."' ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<br /><br />";
|
|
||||||
// for debug - this just prints out the values in the last project
|
|
||||||
if ($ret_array =="error"){
|
|
||||||
echo $ret_array;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for ($i=0;$i < $ret_array[num_teams]; $i++){
|
|
||||||
echo "team_id=".$ret_array[team_scores][$i][team_id]." team_num= ".$ret_array[team_scores][$i][team_num] ."project_num = ".
|
|
||||||
$ret_array[team_scores][$i][proj_num] ." score =".$ret_array[team_scores][$i][team_score].
|
|
||||||
" status = ".$ret_array[team_scores][$i][team_status] ."<br />";
|
|
||||||
|
|
||||||
}
|
|
||||||
echo "Project number ".$ret_array[project_num].": score= ".$ret_array[eval_score]." status = ".$ret_array[eval_score_status]."<br />";
|
|
||||||
}
|
|
||||||
echo "</body>";
|
|
||||||
echo "</html>";
|
|
||||||
exit;
|
|
||||||
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,459 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
// ********* Check Evaluations installation or Add the appropriate eval_config parameters *********
|
|
||||||
$q=@mysql_query("SELECT * FROM eval_config");
|
|
||||||
if(mysql_error())
|
|
||||||
{
|
|
||||||
echo "<h1>Evaluations Plug-in</h1><br />";
|
|
||||||
echo "Evaluations database tables are not installed. You need to install those now!<br />";
|
|
||||||
echo "<a href=\"eval_install.php\">Proceed to Evaluations Database Installation</a><br />";
|
|
||||||
echo "<br>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
//if we have 0 (<1) then install is not done, which would get caught above,
|
|
||||||
if(mysql_num_rows($q)<1)
|
|
||||||
{
|
|
||||||
echo "<h1>Evaluations Plug-in</h1><br />";
|
|
||||||
echo "Evaluations 'eval_config' file has no data! You need to install the data base Files.<br />";
|
|
||||||
echo "<a href=\"eval_install.php\">Proceed to Evaluations Database Installation</a><br />";
|
|
||||||
echo "<br>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// Get the appropriate values needed
|
|
||||||
$q=mysql_query("SELECT * FROM eval_config");
|
|
||||||
while($r=mysql_fetch_object($q)) // should only be one row
|
|
||||||
{
|
|
||||||
$eval_config['help_link']=$r->help_link;
|
|
||||||
$eval_config['plugin_name']=$r->plugin_name;
|
|
||||||
$eval_config['folder_name']=$r->folder_name;
|
|
||||||
$eval_config['code_version']=$r->code_version;
|
|
||||||
$eval_config['author']=$r->author;
|
|
||||||
$eval_config['db_version']=$r->db_version;
|
|
||||||
$eval_config['description']=$r->description;
|
|
||||||
}
|
|
||||||
// debug
|
|
||||||
// echo "plugin_common done. author = ".$eval_config['author']."<br />";
|
|
||||||
|
|
||||||
// see if up to date in revisions
|
|
||||||
if(file_exists("db/eval.code.version.txt"))
|
|
||||||
{
|
|
||||||
$evaldbcodeversion_file=file("db/eval.code.version.txt");
|
|
||||||
$evaldbcodeversion=trim($evaldbcodeversion_file[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<b>ERROR: Could not load plugins/evaluations/db/eval.code.version.txt</b><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$q=@mysql_query("SELECT db_version FROM eval_config");
|
|
||||||
$r=@mysql_fetch_object($q);
|
|
||||||
$evaldbdbversion=$r->db_version;
|
|
||||||
if($evaldbdbversion)
|
|
||||||
{
|
|
||||||
if($evaldbcodeversion<$evaldbdbversion){
|
|
||||||
echo "ERROR: evaldbcodeversion<evaldbdbversion ($evaldbcodeversion<$evaldbdbversion). This should not happen!";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if($evaldbcodeversion>$evaldbdbversion){
|
|
||||||
echo "<h1>Evaluations Plug-in</h1><br />";
|
|
||||||
echo "Your 'Evaluations' plug-in database needs to be updated. You should run the update script to update the database!<br /><br />";
|
|
||||||
echo "<a href=\"db/db_eval_update.php\">Proceed to Evaluations Database Update!</a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// query returned nothing. This should not happen as we check it above.
|
|
||||||
echo "<b>It appears that you have not fully installed Evaluations plug-in</b><br />";
|
|
||||||
echo "Please click this link and do the installation now.<br /><br />";
|
|
||||||
echo "<a href=\"eval_install.php\">Proceed to installation</a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// check if there are any evaluations entered
|
|
||||||
$q = @mysql_query("SELECT * FROM eval_schemes");
|
|
||||||
if(mysql_error())
|
|
||||||
{
|
|
||||||
echo "ERROR Evaluations table eval_schemes is missing. Something failed in the database table installations for Evaluations!";
|
|
||||||
echo "<br>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mysql_num_rows($q)<1) // no rows so no schemas
|
|
||||||
{
|
|
||||||
echo "<h1>Evaluations Plug-in</h1><br />";
|
|
||||||
echo "There are no schemes set up for Evaluations! You need to add at least one scheme! <br />";
|
|
||||||
echo "<a href=\"eval_setup.php\">Proceed to Evaluations Schemes Setup </a><br />";
|
|
||||||
echo "<br>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// *********************** Eval Functions ********************
|
|
||||||
|
|
||||||
function calc_scores($project_id)
|
|
||||||
/*
|
|
||||||
This caluclates various score values from the evaluations entry in eval_projects_entry table (using the level_id entry, scheme_id etc and the
|
|
||||||
algorithm in the eval_help.htm file. The score that is placed in the SFIAB judges_teams_timeslots_projects_link table (one score for each team/project assignment
|
|
||||||
is the score resulting from a 'complete' evaluation (all criteria have an entry and there are no errors)
|
|
||||||
The score placed in the eval_projects table is created by first averaging each criteria for all team evaluations that have made an entry for the criteria.
|
|
||||||
note that some criteria for some teams may have errors (missing the mark on score form or multiple marks) so those are not included in the criteria average.
|
|
||||||
After all criteria are averaged - if there is a good average for every criteria, then the score is calculated. This allows the process to use every entry by the judges
|
|
||||||
even if one judge team has missed a criteria's mark or the scanner read multiple markes etc. The process assumes that score forms can be entered again after
|
|
||||||
corrections and thus after doing the calc_scores process again the newer entries will be used for a better average.
|
|
||||||
project_id must exist in table: 'judges_teams_timeslots_projects_link'
|
|
||||||
if error returns a string
|
|
||||||
for each team assigned to the project (eval_teams_entries records) calculates team score and status
|
|
||||||
- if error in entries or no entries score = 'null' status = list of errors
|
|
||||||
- if good entries score = result of entries (0 to 100) status = blank
|
|
||||||
- returns an array (see below)
|
|
||||||
for the project, calculates a score using Dennis Spanogle method (see help/documentation for detail - or read code)
|
|
||||||
(average each criteria entries first, then use criteria averages to calculate scores)
|
|
||||||
-This results in a project score even if some level values are missing or bad for one or more team-project entries
|
|
||||||
returns:
|
|
||||||
an array: array(project_num=>$project_num,eval_score=>$score, eval_score_status=>$ttlcode,num_teams=>$num_judges_teams,
|
|
||||||
team_scores=>$list_array);
|
|
||||||
where $list_array is array(team_id=>$arr[$team][0][0],team_num=>$arr[$team][0][5],proj_num=>$arr[$team][0][6],team_score=>$team_score,team_status=>$err.codes);
|
|
||||||
indexed from 0 to number of teams assigned to project - 1
|
|
||||||
An example of using calc_score
|
|
||||||
$ret_array = calc_scores($project_id);
|
|
||||||
for ($i=0;$i < $ret_array[num_teams]; $i++){
|
|
||||||
echo "team_id=".$ret_array[team_scores][$i][team_id]." team_num= ".$ret_array[team_scores][$i][team_num] ."project_num = ".
|
|
||||||
$ret_array[team_scores][$i][proj_num] ." score =".$ret_array[team_scores][$i][team_score] .
|
|
||||||
" status = ".$ret_array[team_scores][$i][team_status] ."<br />";
|
|
||||||
}
|
|
||||||
echo "Project number ".$ret_array[project_num].": score= ".$ret_array[eval_score]." status = ".$ret_array[eval_score_status]."<br />";
|
|
||||||
For actual use see eval_calc_scores.php
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
if(!$project_id){
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
// Get scheme to use
|
|
||||||
$q = mysql_query("SELECT * from eval_projects WHERE project_id = '".$project_id."' ");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "No eval_ projects record for project_id ".$project_id."<br />";
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$r=mysql_fetch_object($q);
|
|
||||||
$scheme_id = $r->scheme_id;
|
|
||||||
}
|
|
||||||
// Get the maximum level value for this scheme (used to calculate average score - see eval_help.htm)
|
|
||||||
$q = mysql_query("SELECT * from eval_levels WHERE scheme_id = '".$scheme_id."'");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "No eval_ levels record for scheme_id ".$scheme_id."<br />";
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$max_level_val = 0;
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
if($r->spec_use == "no") {
|
|
||||||
if($r->level_value > $max_level_val){
|
|
||||||
$max_level_val = $r->level_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// need to build up and array of
|
|
||||||
// array(team_id,array(criteria_weight, level_value)
|
|
||||||
// and count number of teams
|
|
||||||
// and count number of critera
|
|
||||||
// then I can work on the array without having to mess with the databases
|
|
||||||
// IMPORTANT - it is important the way this is sorted for the code to work
|
|
||||||
$q = mysql_query("SELECT eval_projects_entries.*, projects.projectnumber, judges_teams.num
|
|
||||||
FROM eval_projects_entries, projects, judges_teams
|
|
||||||
WHERE eval_projects_entries.project_id = projects.id AND eval_projects_entries.judges_teams_id = judges_teams.id
|
|
||||||
AND project_id = '".$project_id."' ORDER BY judges_teams_id, criteria_id ");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "No records for project_id ".$project_id."<br />";
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$judges_teams_id = -1;
|
|
||||||
$num_judges_teams = 0;
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
// setup for new judges team
|
|
||||||
if ($r->judges_teams_id != $judges_teams_id ){ // set for first or next judge team initial values
|
|
||||||
$judges_teams_id = $r->judges_teams_id;
|
|
||||||
$num_criterias = 0;
|
|
||||||
$judges_teams_num = $r->num;
|
|
||||||
$project_num = $r->projectnumber;
|
|
||||||
$num_judges_teams++;
|
|
||||||
}
|
|
||||||
// get the criteria weight and the level value from the tables
|
|
||||||
$crt = mysql_query("SELECT * from eval_criteria WHERE scheme_id = '".$scheme_id."' AND criteria_id = '".$r->criteria_id."' ");
|
|
||||||
if (!$crt OR mysql_num_rows($crt) == 0){
|
|
||||||
echo "No eval_ criteria record for scheme_id ".$scheme_id."<br />";
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$crtr=mysql_fetch_object($crt);
|
|
||||||
$criteria_weight = $crtr->criteria_weight;
|
|
||||||
}
|
|
||||||
if (is_null($r->level_id)) { // null no entry has been made
|
|
||||||
// SET THE ARRAY level_Value = -1
|
|
||||||
$level_value = -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$lv = mysql_query("SELECT * from eval_levels WHERE scheme_id = '".$scheme_id."' AND level_id = '".$r->level_id."' ");
|
|
||||||
if (!$lv OR mysql_num_rows($lv) == 0){
|
|
||||||
// a non-allowed level_id entry has been made for this so SET the array level_value = -1
|
|
||||||
$level_value = -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$lvr=mysql_fetch_object($lv);
|
|
||||||
$level_value = $lvr->level_value;
|
|
||||||
$spec_use = $lvr->spec_use;
|
|
||||||
$spec_use_code = $lvr->spec_use_code;
|
|
||||||
}
|
|
||||||
} // level_id entry was null (no entry made yet) or not a valid entry
|
|
||||||
if ($level_value == -1){
|
|
||||||
$spec_use_code = "NoEnt"; // this indicate NO entry or Invalid entry (not in eval_levels table)
|
|
||||||
$spec_use = 'yes'; // force calculations to skip and add the code to the status code;
|
|
||||||
}
|
|
||||||
// FILL IN THE ARRAY HERE FOR THIS RECORD...
|
|
||||||
$arr[$num_judges_teams-1][$num_criterias] = array($judges_teams_id,$criteria_weight,$level_value,$spec_use,$spec_use_code, $judges_teams_num,$project_num);
|
|
||||||
$num_criterias++;
|
|
||||||
} // while all in eval_projects_entries
|
|
||||||
} // else have all eval_projects entries
|
|
||||||
// Note: for a given project EVERY team will always have the same number of criteria so use the count from last team
|
|
||||||
// Get a score for each team for judges_teams_timeslots_projects_link table (if possible) Must have all critieria with weight > 0 have entry with spec_use = 'no'
|
|
||||||
for ( $team = 0; $team < $num_judges_teams; $team++) { // ***** Loop thru Judge teams ****************************
|
|
||||||
//echo "Team number ".$arr[$team][0][5]." (id ".$arr[$team][0][0].")<br />";
|
|
||||||
$team_score =0;
|
|
||||||
$err_codes = "";
|
|
||||||
for ($crit = 0; $crit < $num_criterias; $crit++) {
|
|
||||||
$weight = $arr[$team][$crit][1];
|
|
||||||
$level_value =$arr[$team][$crit][2];
|
|
||||||
$spec_use = $arr[$team][$crit][3]; // note this may have been set to 'yes' for null or invalid entries or for special use levels (multiple, missing marks etc)
|
|
||||||
$spec_use_code = $arr[$team][$crit][4];
|
|
||||||
if($spec_use == "no"){ // OK to add into the score result
|
|
||||||
$team_score += $level_value * $weight;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($weight > 0) { // spec_use = 'yes'. If criteria with weight == 0 then it is NOT an error, I.E. ISEF Teamwork for scheme_id 1 .
|
|
||||||
$err_codes .= $spec_use_code." ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($err_codes == "") { // no error codes added so the score is GOOD!
|
|
||||||
$team_score = $team_score / $max_level_val;
|
|
||||||
//echo "Score= ".$team_score."<br />";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$team_score = NULL;
|
|
||||||
//echo "Score= ".$team_score." codes: ".$err_codes."<br />";
|
|
||||||
}
|
|
||||||
$list_array[$team] = array(team_id=>$arr[$team][0][0],team_num=>$arr[$team][0][5],proj_num=>$arr[$team][0][6],team_score=>$team_score,team_status=>$err_codes);
|
|
||||||
} // ****** Loop thr Judge Teams ******************************
|
|
||||||
// This gets the project score based on the average of the sum of the criteria averages (Dennis Spanogle method)
|
|
||||||
$num_bad_crits = 0;
|
|
||||||
$ttlcode = "";
|
|
||||||
for ($cc = 0;$cc<$num_criterias;$cc++) {
|
|
||||||
$judcritttl = 0;
|
|
||||||
$avg_cnt = 0;
|
|
||||||
$err_codes = "";
|
|
||||||
for($jj = 0;$jj<$num_judges_teams;$jj++){ // get average for this criteria all judge teams
|
|
||||||
$weight = $arr[$jj][$cc][1];
|
|
||||||
$level_value =$arr[$jj][$cc][2];
|
|
||||||
$spec_use = $arr[$jj][$cc][3];
|
|
||||||
$spec_use_code = $arr[$jj][$cc][4];
|
|
||||||
// add in the good judge entries for this criteria
|
|
||||||
if($spec_use == "no" && $level_value != -1){ // have a good entry for this criteria
|
|
||||||
$judcritttl += $level_value * $weight;
|
|
||||||
$avg_cnt++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($weight > 0) { // if bad entry in criteria with weight == 0 then it is NOT and error.
|
|
||||||
if ($err_codes == "") {
|
|
||||||
$err_codes = "JT".$arr[$jj][$cc][0]." ".$spec_use_code;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$err_codes .= ", "."JT".$arr[$jj][$cc][0]." ".$spec_use_code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Get the average for this criteria i.e. divide by the number of good criteria entries
|
|
||||||
if ($avg_cnt >0){
|
|
||||||
$crit_avg_wtd = $judcritttl/$avg_cnt;
|
|
||||||
}
|
|
||||||
else{ // This criteria had no entries so the total score can not be calculated unless weight = 0 then don't care
|
|
||||||
$crit_avg_wtd = 0;
|
|
||||||
if ($weight > 0){
|
|
||||||
$num_bad_crits ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$rst[$cc] = array($crit_avg_wtd,$err_codes);
|
|
||||||
}
|
|
||||||
// have array with the average weighted criteria levels - add them all up for the project
|
|
||||||
$ttl= 0;
|
|
||||||
for ($cc = 0;$cc<$num_criterias;$cc++) {
|
|
||||||
$ttl += $rst[$cc][0];
|
|
||||||
if($rst[$cc][1] != ""){
|
|
||||||
if($ttlcode == "") {
|
|
||||||
$ttlcode = $rst[$cc][1];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ttlcode .= ", ".$rst[$cc][1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($num_bad_crits == 0){ // if any criteria had no entries then cannot use the score
|
|
||||||
$score = $ttl/$max_level_val;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$score = 0;
|
|
||||||
}
|
|
||||||
$ret_array = array(project_num=>$project_num,eval_score=>$score, eval_score_status=>$ttlcode,num_teams=>$num_judges_teams, team_scores=>$list_array);
|
|
||||||
return $ret_array;
|
|
||||||
} // end of function calc_scores
|
|
||||||
|
|
||||||
|
|
||||||
// ******************** functions from SFIAB ****
|
|
||||||
function i18n($str,$args=array(),$argsdesc=array(),$forcelang="")
|
|
||||||
{
|
|
||||||
if(!$str)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
if($forcelang)
|
|
||||||
{
|
|
||||||
$savelang=$_SESSION['lang'];
|
|
||||||
$_SESSION['lang']=$forcelang;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_SESSION['lang'])
|
|
||||||
{
|
|
||||||
if($_SESSION['lang']=="en")
|
|
||||||
{
|
|
||||||
for($x=1;$x<=count($args);$x++)
|
|
||||||
{
|
|
||||||
$str=str_replace("%$x",$args[$x-1],$str);
|
|
||||||
}
|
|
||||||
if($forcelang) $_SESSION['lang']=$savelang;
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$q=mysql_query("SELECT * FROM translations WHERE lang='".$_SESSION['lang']."' AND strmd5='".md5($str)."'");
|
|
||||||
if($r=@mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
if($r->val)
|
|
||||||
{
|
|
||||||
$ret=$r->val;
|
|
||||||
|
|
||||||
for($x=1;$x<=count($args);$x++)
|
|
||||||
{
|
|
||||||
$ret=str_replace("%$x",$args[$x-1],$ret);
|
|
||||||
}
|
|
||||||
if($forcelang) $_SESSION['lang']=$savelang;
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for($x=1;$x<=count($args);$x++)
|
|
||||||
{
|
|
||||||
$str=str_replace("%$x",$args[$x-1],$str);
|
|
||||||
}
|
|
||||||
if($forcelang) $_SESSION['lang']=$savelang;
|
|
||||||
return "{{".$str."}}";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(count($argsdesc))
|
|
||||||
{
|
|
||||||
$argsdescstring="";
|
|
||||||
$n=1;
|
|
||||||
foreach($argsdesc AS $ad)
|
|
||||||
{
|
|
||||||
$argsdescstring.="%$n=$ad, ";
|
|
||||||
$n++;
|
|
||||||
}
|
|
||||||
$argsdescstring=substr($argsdescstring,0,-2);
|
|
||||||
$argsdescstring="'".mysql_escape_string($argsdescstring)."'";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$argsdescstring="null";
|
|
||||||
|
|
||||||
mysql_query("INSERT INTO translations (lang,strmd5,str,argsdesc) VALUES ('".$_SESSION['lang']."','".md5($str)."','".mysql_escape_string($str)."',$argsdescstring)");
|
|
||||||
for($x=1;$x<=count($args);$x++)
|
|
||||||
{
|
|
||||||
$str=str_replace("%$x",$args[$x-1],$str);
|
|
||||||
}
|
|
||||||
if($forcelang) $_SESSION['lang']=$savelang;
|
|
||||||
return "{{".$str."}}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//no language set, assume english
|
|
||||||
if($forcelang) $_SESSION['lang']=$savelang;
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function error($str,$type="normal")
|
|
||||||
{
|
|
||||||
if($type=="normal")
|
|
||||||
return "<div class=\"error\">$str</div><br />";
|
|
||||||
else if($type=="inline")
|
|
||||||
return "<span class=\"error\">$str</span><br />";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function notice($str,$type="normal")
|
|
||||||
{
|
|
||||||
if($type=="normal")
|
|
||||||
return "<div class=\"notice\">$str</div><br />";
|
|
||||||
else if($type=="inline")
|
|
||||||
return "<span class=\"notice\">$str</span><br />";
|
|
||||||
}
|
|
||||||
|
|
||||||
function happy($str,$type="normal")
|
|
||||||
{
|
|
||||||
if($type=="normal")
|
|
||||||
return "<div class=\"happy\">$str</div><br />";
|
|
||||||
else if($type=="inline")
|
|
||||||
return "<span class=\"happy\">$str</span><br />";
|
|
||||||
}
|
|
||||||
|
|
||||||
function display_messages()
|
|
||||||
{
|
|
||||||
/* Dump any messages in the queue */
|
|
||||||
if(is_array($_SESSION['messages'])) {
|
|
||||||
foreach($_SESSION['messages'] as $m) echo $m;
|
|
||||||
}
|
|
||||||
$_SESSION['messages'] = array();
|
|
||||||
}
|
|
||||||
function message_push($m)
|
|
||||||
{
|
|
||||||
if(!is_array($_SESSION['messages'])) $_SESSION['messages'] = array();
|
|
||||||
$_SESSION['messages'][] = $m;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
@ -1,181 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB Evaluations Criteria Editor</title>
|
|
||||||
<script language="javascript">
|
|
||||||
function confirmClick(msg)
|
|
||||||
{
|
|
||||||
var okay=confirm(msg);
|
|
||||||
if(okay)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Criteria Editor</h2><br /><br />";
|
|
||||||
if($_POST['action']=="edit")
|
|
||||||
{
|
|
||||||
if($_POST['scheme_id'] && $_POST['criteria_id'] && $_POST['criteria_weight'] && $_POST['criteria_name'] )
|
|
||||||
{
|
|
||||||
//$q=mysql_query("SELECT id FROM eval_criteria WHERE id='".$_POST['id']."' ");
|
|
||||||
//if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id'])
|
|
||||||
//{
|
|
||||||
// echo "Criteria ID ".$_POST['id']." already exists!";
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
$t = mysql_query("UPDATE eval_criteria SET ".
|
|
||||||
"scheme_id='".$_POST['scheme_id']."', ".
|
|
||||||
"criteria_id='".$_POST['criteria_id']."', ".
|
|
||||||
"criteria_weight='".$_POST['criteria_weight']."', ".
|
|
||||||
"criteria_name='".$_POST['criteria_name']."' ".
|
|
||||||
"WHERE id='".$_POST['saveid']."' ");
|
|
||||||
|
|
||||||
|
|
||||||
echo "Criteria Saved!";
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Error: All fields are required!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_POST['action']=="new")
|
|
||||||
{
|
|
||||||
if( $_POST['scheme_id'] && $_POST['criteria_id'] && $_POST['criteria_weight'] && $_POST['criteria_name'] )
|
|
||||||
{
|
|
||||||
// $q=mysql_query("SELECT id FROM eval_criteria WHERE id='".$_POST['id']."' ");
|
|
||||||
// if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id'])
|
|
||||||
// {
|
|
||||||
// echo "Scheme ID ".$_POST['id']." already exists!";
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
mysql_query("INSERT INTO eval_criteria ( scheme_id, criteria_id, criteria_weight, criteria_name) VALUES ( ".
|
|
||||||
"'".$_POST['scheme_id']."', ".
|
|
||||||
"'".$_POST['criteria_id']."', ".
|
|
||||||
"'".$_POST['criteria_weight']."', ".
|
|
||||||
"'".$_POST['criteria_name']."' ) ");
|
|
||||||
echo "Criteria Saved!";
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Error: All fields are required!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_GET['action']=="remove" && $_GET['remove'])
|
|
||||||
{
|
|
||||||
mysql_query("DELETE FROM eval_criteria where id='".$_GET['remove']."' ");
|
|
||||||
echo "Criteria successfully removed";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
|
||||||
|
|
||||||
if(! ($_GET['action']=="edit" || $_GET['action']=="new") )
|
|
||||||
{
|
|
||||||
echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\"> Add New Criteria </a>\n";
|
|
||||||
echo "<table border=\"1\">";
|
|
||||||
echo "<tr>";
|
|
||||||
//echo "<th> rec ID </th>\n";
|
|
||||||
echo "<th> Scheme ID </th>\n";
|
|
||||||
echo "<th> Criteria ID</th>\n";
|
|
||||||
echo "<th> Criteria Weight </th>\n";
|
|
||||||
echo "<th> Criteria Name </th>\n";
|
|
||||||
echo "<th> Actions </th>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_GET['action']=="edit" || $_GET['action']=="new")
|
|
||||||
{
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"".$_GET['action']."\">\n";
|
|
||||||
if($_GET['action']=="edit")
|
|
||||||
{
|
|
||||||
echo "<input type=\"hidden\" name=\"saveid\" value=\"".$_GET['edit']."\">\n";
|
|
||||||
$q=mysql_query("SELECT * FROM eval_criteria WHERE id='".$_GET['edit']."' ");
|
|
||||||
$critr=mysql_fetch_object($q);
|
|
||||||
$buttontext="Save";
|
|
||||||
}
|
|
||||||
else if($_GET['action']=="new")
|
|
||||||
{
|
|
||||||
$buttontext="Add";
|
|
||||||
}
|
|
||||||
echo "<table border=\"1\">";
|
|
||||||
echo "<tr>";
|
|
||||||
//echo "<th> rec ID </th>\n";
|
|
||||||
echo "<th> Scheme ID </th>\n";
|
|
||||||
echo "<th> Criteria ID</th>\n";
|
|
||||||
echo "<th> Criteria Weight </th>\n";
|
|
||||||
echo "<th> Criteria Name </th>\n";
|
|
||||||
echo "<th> Actions </th>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
echo "<tr>";
|
|
||||||
// echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$critr->id\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"3\" name=\"scheme_id\" value=\"$critr->scheme_id\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"3\" name=\"criteria_id\" value=\"$critr->criteria_id\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"6\" name=\"criteria_weight\" value=\"$critr->criteria_weight\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"20\" name=\"criteria_name\" value=\"$critr->criteria_name\" /></td>";
|
|
||||||
echo "</td>";
|
|
||||||
|
|
||||||
|
|
||||||
echo " <td><input type=\"submit\" value=\"".$buttontext."\" /></td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$q=mysql_query("SELECT * FROM eval_criteria ORDER BY scheme_id, criteria_id");
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
echo "<tr>";
|
|
||||||
// echo " <td>$r->id </td>";
|
|
||||||
echo " <td>$r->scheme_id </td>";
|
|
||||||
echo " <td> $r->criteria_id </td>";
|
|
||||||
echo " <td> $r->criteria_weight </td>";
|
|
||||||
echo " <td> $r->criteria_name </td>";
|
|
||||||
echo " <td>";
|
|
||||||
echo "<a title=\"Edit\" href=\"".$_SERVER['PHP_SELF']."?action=edit&edit=$r->id\">Edit</a>";
|
|
||||||
echo " ";
|
|
||||||
echo "<a title=\"Remove\" onClick=\"return confirmClick('Are you sure you want to remove this criteria?');\" href=\"".$_SERVER['PHP_SELF']."?action=remove&remove=$r->id\">Remove</a>";
|
|
||||||
echo " </td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
echo"Scheme ID must exist in Schemes!";
|
|
||||||
echo "</body>";
|
|
||||||
echo "</html>";
|
|
||||||
// send_footer();
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<title>SFIAB Evaluations Export</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Export Data</h2><br /><br />";
|
|
||||||
|
|
||||||
/* Options
|
|
||||||
1. Most information for preslugging scoring forms (one record per project - judgeteam assignment) (includes scheme_id and...
|
|
||||||
2. Eval_criteria Table with scheme_dscheme_name and assignto_project_when equation.
|
|
||||||
3. Eval_levels Table with scheme_id ...
|
|
||||||
4. Eval_projects_entries: One record for every project - judgeteam - criteria with current level_id
|
|
||||||
5. The Apperson format for Students Data import (Requires a special SFIAB Setup to work - details in help)
|
|
||||||
*/
|
|
||||||
|
|
||||||
if($_POST['action'] == "SelectOptions")
|
|
||||||
{
|
|
||||||
$option = $_POST['option'];
|
|
||||||
$Teamnote = $_POST['teamnote'];
|
|
||||||
if($option > 0 AND $option <= 9){
|
|
||||||
echo "<input type=\"button\" value=\"Export File ".$option."\" onclick=\"window.open('eval_export_download.php?option=".$option."&teamnote=".$Teamnote."')\">";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "You entered a non-valid file number. Please enter a correct file number from 1 to 9 in the box and click 'Select a Different File'<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$Teamnote = "Team Project";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<br /><form method=\"post\" action=\"eval_export.php\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"SelectOptions\" />";
|
|
||||||
echo "<b>Available Files to export:</b><br /><br />";
|
|
||||||
echo "1. Apperson scanner scoring forms pre-slug data - csv file. One record per judgeteam - project assignment (includes scheme_id ).<br />";
|
|
||||||
echo "2. Apperson scanner Students Data import -csv file. Requires a special SFIAB Setup to work - details in help.<br />";
|
|
||||||
echo "3. Microsoft Word data merge document for pre-slugging Apperson score forms (use export file #1 as recipients data.) <br />";
|
|
||||||
echo "4. Apperson score form/scanner font - Required for pre-slugging Apperson score forms (Install per your windows system instructions.)<br />";
|
|
||||||
echo "5. Eval_schemes Table - csv file. <br />";
|
|
||||||
echo "6. Eval_criteria Table -csv file. <br />";
|
|
||||||
echo "7. Eval_levels Table - csv file. <br />";
|
|
||||||
echo "8. Eval_projects Table - csv file. <br />";
|
|
||||||
echo "9. Eval_projects_entries Table - csv file: One record per judgeteam - project - criteria with current level_id (entry)<br />";
|
|
||||||
echo "<table>";
|
|
||||||
echo "<tr><td>Enter File Number to export</td><td><input size=\"2\" type=\"text\" name=\"option\" value=\"$option\"> ";
|
|
||||||
echo " <input type=\"submit\" value=\"Select\"> Click the 'Export File #' button above after you click 'Select' here.</td></tr>";
|
|
||||||
echo "<tr><td>For File #1 only: Enter pre-slug note for team projects</td><td><input size=\"20\" type=\"text\" name=\"teamnote\" value=\"$Teamnote\"></td>";
|
|
||||||
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
exit;
|
|
||||||
|
|
||||||
?>
|
|
@ -1,271 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // get evaluations setup
|
|
||||||
// debug test
|
|
||||||
$CSVoption = $_GET['option'];
|
|
||||||
$Teamworknote = $_GET['teamnote'];
|
|
||||||
$filename = "EMPTY FILE Do Not Download Not Implemented.csv";
|
|
||||||
// this section for non-csv files
|
|
||||||
if ($CSVoption == 3 || $CSVoption == 4){
|
|
||||||
if ($CSVoption == 3){
|
|
||||||
// download the ms word preslug doc
|
|
||||||
$file = "docs/SFIAB_EvaluationsPreSlug.doc";
|
|
||||||
}
|
|
||||||
if ($CSVoption == 4){
|
|
||||||
// download the Apperson font
|
|
||||||
$file = "docs/apperson.ttf";
|
|
||||||
}
|
|
||||||
if (file_exists($file)) {
|
|
||||||
header('Content-Description: File Transfer');
|
|
||||||
header('Content-Type: application/octet-stream');
|
|
||||||
header('Content-Disposition: attachment; filename='.basename($file));
|
|
||||||
header('Content-Transfer-Encoding: binary');
|
|
||||||
header('Expires: 0');
|
|
||||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
|
||||||
header('Pragma: public');
|
|
||||||
header('Content-Length: ' . filesize($file));
|
|
||||||
ob_clean();
|
|
||||||
flush();
|
|
||||||
readfile($file);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// 5 Eval_schemes Table - csv file. Has scheme_id, scheme_name and selection statement - csv file.
|
|
||||||
if ($CSVoption == 5){
|
|
||||||
$q = mysql_query("SELECT * from eval_schemes ORDER BY scheme_id");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "Error reading tables or no records. (You must setup Schemes, Criteria and Levels prior to exporting)<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$filename = "SFIAB_Evaluations_Schemes.csv";
|
|
||||||
// here is what I want in the data. may take several queries to get it. Need one record for each record in eval_projects_entries
|
|
||||||
$header = "\"scheme_id\",\"scheme_name\",\"selection\"";
|
|
||||||
// **********************************************write the header out to the buffer ************************************
|
|
||||||
$download = $header."\r\n";
|
|
||||||
$num_records = mysql_num_rows($q);
|
|
||||||
// do the work for the records
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$recordout = "\"".$r->scheme_id."\",\"".$r->scheme_name."\",\"".$r->assignto_project_when."\"";
|
|
||||||
$download = $download.$recordout."\r\n";
|
|
||||||
}
|
|
||||||
// proceed to end of code for the actual export
|
|
||||||
}
|
|
||||||
//6. Eval_criteria Table with scheme_id, scheme_name and selection statement - csv file.
|
|
||||||
if ($CSVoption == 6){
|
|
||||||
$q = mysql_query("SELECT * from eval_criteria ORDER BY scheme_id, criteria_id");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "Error reading tables or no records. (You must setup Schemes, Criteria and Levels prior to exporting)<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$filename = "SFIAB_Evaluations_Criteria.csv";
|
|
||||||
// here is what I want in the data. may take several queries to get it. Need one record for each record in eval_projects_entries
|
|
||||||
$header = "\"scheme_id\",\"criteria_id\",\"criteria_weight\",\"criteria_name\"";
|
|
||||||
// **********************************************write the header out to the buffer ************************************
|
|
||||||
$download = $header."\r\n";
|
|
||||||
$num_records = mysql_num_rows($q);
|
|
||||||
// do the work for the records
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$recordout = "\"".$r->scheme_id."\",\"".$r->criteria_id."\",\"".$r->criteria_weight."\",\"".$r->criteria_name."\"";
|
|
||||||
$download = $download.$recordout."\r\n";
|
|
||||||
}
|
|
||||||
// proceed to end of code for the actual export
|
|
||||||
}
|
|
||||||
//7. Eval_levels Table with scheme_id - csv file.
|
|
||||||
if ($CSVoption == 7){
|
|
||||||
$q = mysql_query("SELECT * from eval_levels ORDER BY scheme_id, level_id");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "Error reading tables or no records. (You must setup Schemes, Criteria and Levels prior to exporting)<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$filename = "SFIAB_Evaluations_Levels.csv";
|
|
||||||
// here is what I want in the data. may take several queries to get it. Need one record for each record in eval_projects_entries
|
|
||||||
$header = "\"scheme_id\",\"level_id\",\"level_value\",\"level_name\",\"spec_use\",\"spec_use_code\"";
|
|
||||||
// **********************************************write the header out to the buffer ************************************
|
|
||||||
$download = $header."\r\n";
|
|
||||||
$num_records = mysql_num_rows($q);
|
|
||||||
// do the work for the records
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$recordout = "\"".$r->scheme_id."\",\"".$r->level_id."\",\"".$r->level_value."\",\"".$r->level_name."\",\"".$r->spec_use."\",\"".$r->spec_use_code."\"";
|
|
||||||
$download = $download.$recordout."\r\n";
|
|
||||||
}
|
|
||||||
// proceed to end of code for the actual export
|
|
||||||
}
|
|
||||||
//8. Eval_levels Table with scheme_id - csv file.
|
|
||||||
if ($CSVoption ==8){
|
|
||||||
$q = mysql_query("SELECT * from eval_projects ORDER BY project_id");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "Error reading tables or no records. (You must Link Evalueations to SFIAB data prior to exporting)<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$filename = "SFIAB_Projects.csv";
|
|
||||||
// here is what I want in the data. may take several queries to get it. Need one record for each record in eval_projects_entries
|
|
||||||
$header = "\"project_id\",\"team\",\"scheme_id\",\"eval_score\",\"final_score\",\"eval_score_status\",\"overall_status\",\"last_change\"";
|
|
||||||
// **********************************************write the header out to the buffer ************************************
|
|
||||||
$download = $header."\r\n";
|
|
||||||
$num_records = mysql_num_rows($q);
|
|
||||||
// do the work for the records
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$recordout = "\"".$r->project_id."\",\"".$r->team."\",\"".$r->scheme_id."\",\"".$r->eval_score."\",\"".$r->final_score."\",\"".$r->eval_score_status."\",\"".$r->overall_status."\",\"".$r->last_change."\"";
|
|
||||||
$download = $download.$recordout."\r\n";
|
|
||||||
}
|
|
||||||
// proceed to end of code for the actual export
|
|
||||||
}
|
|
||||||
|
|
||||||
//9. Eval_projects_entries Table - csv file: One record per judgeteam - project - criteria with current level_id (entry)
|
|
||||||
if ($CSVoption == 9){
|
|
||||||
$q = mysql_query("SELECT * from eval_projects_entries");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "Error reading tables or no records. (You must Link Evalueations to SFIAB data prior to exporting)<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$filename = "SFIAB_Evaluations_ProjectsEntries.csv";
|
|
||||||
// here is what I want in the data. may take several queries to get it. Need one record for each record in eval_projects_entries
|
|
||||||
$header = "\"event_id\",\"project_id\",\"judges_teams_id\",\"judges_timeslots_id\",\"criteria_id\",\"level_id\",\"judge_user_id\"";
|
|
||||||
// **********************************************write the header out to the buffer ************************************
|
|
||||||
$download = $header."\r\n";
|
|
||||||
$num_records = mysql_num_rows($q);
|
|
||||||
// do the work for the records
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$recordout = "\"".$r->event_id."\",\"".$r->project_id."\",\"".$r->judges_teams_id."\",\"".$r->judges_timeslots_id."\",\"".$r->criteria_id."\",\"".$r->level_id."\",\"".$r->judge_user_id."\"";
|
|
||||||
$download = $download.$recordout."\r\n";
|
|
||||||
}
|
|
||||||
// proceed to end of code for the actual export
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($CSVoption == 1 || $CSVoption == 2){
|
|
||||||
// This selects from judges_teams_timeslots_projects_link as top table - gets ONLY projects with assigned teams (I.E. Status = complete when schedule assignements are made
|
|
||||||
// It gets One record for each project - judges team assignment. I.E. one record for each required evaluation (Apperson Score Form)
|
|
||||||
$qstr = "SELECT eval_projects.team AS IsTeam, eval_projects.scheme_id, projects.projectnumber, projects.`language`, projects.floornumber, projects.title, ".
|
|
||||||
"projects.shorttitle, judges_teams.num AS team_num, judges_teams.name AS team_name, projectcategories.category, ".
|
|
||||||
"projectcategories.category_shortform, projectcategories.mingrade, projectcategories.maxgrade, projectdivisions.division, ".
|
|
||||||
"projectdivisions.division_shortform, projectdivisions.cwsfdivisionid, eval_projects.eval_score, eval_projects.final_score, ".
|
|
||||||
"eval_projects.eval_score_status, eval_projects.overall_status, eval_projects.last_change, projects.`year`, judges_timeslots.`date` AS tsdate, ".
|
|
||||||
"judges_timeslots.starttime AS tsstarttime, judges_timeslots.endtime AS tsendtime, judges_timeslots.name AS tsname, ".
|
|
||||||
"judges_timeslots.type AS tstype, judges_teams_timeslots_projects_link.judges_timeslots_id, judges_teams_timeslots_projects_link.projects_id, ".
|
|
||||||
"judges_teams.id, registrations.num, registrations.status, judges_teams_timeslots_projects_link.score ".
|
|
||||||
"FROM judges_teams, judges_teams_timeslots_projects_link, judges_timeslots, projects, eval_projects, projectcategories, projectdivisions, registrations ".
|
|
||||||
"WHERE judges_teams.id = judges_teams_timeslots_projects_link.judges_teams_id AND ".
|
|
||||||
"judges_teams_timeslots_projects_link.judges_timeslots_id = judges_timeslots.id AND ".
|
|
||||||
"judges_teams_timeslots_projects_link.projects_id = eval_projects.project_id AND projects.id = eval_projects.project_id AND ".
|
|
||||||
"projects.projectcategories_id = projectcategories.id AND projects.projectdivisions_id = projectdivisions.id AND ".
|
|
||||||
"projects.registrations_id = registrations.id ".
|
|
||||||
" ORDER BY projects.projectnumber, team_num";
|
|
||||||
$q = mysql_query($qstr);
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "Error reading tables or no records. (Did you Link SFIAB to Evaluations? Did 'score' get added to the judges_teams_timeslots_projects_link table?)<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if ($CSVoption == 1)
|
|
||||||
{
|
|
||||||
// here is what I want in the data. may take several queries to get it. Need one record for each record in eval_projects_entries
|
|
||||||
$header = "\"ProjectNum\",\"AppersonNum\",\"ShortTitle\",\"Title\",\"IsTeamProject\",\"FloorNum\",\"Language\",\"TeamProjectNote\",\"JudgeTeamNum\",\"JudgeTeamName\",\"JudgeTeamTime\",\"JudgeTeamLeader\",\"Category\",\"CatShort\",\"Division\",\"DivShort\",\"Year\",\"AppersonBarCode\",\"scheme_Id\",\"score\"";
|
|
||||||
$filename = "SFIAB_Evauations_ScoreFormPreSlug.csv";
|
|
||||||
}
|
|
||||||
if ($CSVoption == 2 ){
|
|
||||||
// Apperson Scanner Student data.// "Student ID","FirstName","LastName"
|
|
||||||
$header = "\"Student ID\",\"FirstName\",\"LastName\"";
|
|
||||||
$filename = "SFIAB_Evaluations_ScannerStudentData.csv";
|
|
||||||
|
|
||||||
}
|
|
||||||
// **********************************************write the header out to the file ************************************
|
|
||||||
$download = $header."\r\n";
|
|
||||||
$num_records = mysql_num_rows($q);
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
// get some sepecial items from the raw data.
|
|
||||||
// this is for test only at this time. will be used in the Apperson Scanner export and import.
|
|
||||||
// to create the file necessary to preslug the score forms.
|
|
||||||
// Barcode = 1 or 2 for team, 4 digits exn, 4 digits team number, 2 digits checksum?
|
|
||||||
$AppPrjNum = substr($r->projectnumber , 1);
|
|
||||||
if ( strlen($AppPrjNum) < 4 )
|
|
||||||
{
|
|
||||||
$AppPrjNum = sprintf( "%04d",$AppPrjNum); // "0".$AppPrjNum;
|
|
||||||
}
|
|
||||||
$teamtime = $r->tsdate." ".$r->tsstarttime."-".$r->tsendtime;
|
|
||||||
$tcode = "1";
|
|
||||||
$Teamnote = "";
|
|
||||||
if ($r->IsTeam == "yes"){
|
|
||||||
$tcode = "2";
|
|
||||||
// passed $Teamworknote when page opened
|
|
||||||
$Teamnote = $Teamworknote;
|
|
||||||
}
|
|
||||||
$fmtTeamNum = sprintf("%04d", $r->team_num);
|
|
||||||
$StudentID = $tcode.$AppPrjNum.$fmtTeamNum;
|
|
||||||
// calculate the checksum
|
|
||||||
$checksum = (int)substr($StudentID,0,1);
|
|
||||||
$checksum += (int)substr($StudentID,1,1);
|
|
||||||
$checksum +=(int) substr($StudentID,2,1);
|
|
||||||
$checksum += (int)substr($StudentID,3,1);
|
|
||||||
$checksum += (int)substr($StudentID,4,1);
|
|
||||||
$checksum += (int)substr($StudentID,5,1);
|
|
||||||
$checksum += (int)substr($StudentID,6,1);
|
|
||||||
$checksum += (int)substr($StudentID,7,1);
|
|
||||||
$checksum += (int)substr($StudentID,8,1);
|
|
||||||
$checksum = sprintf("%02d",$checksum);
|
|
||||||
$AppBarCode = "<".$tcode.$AppPrjNum.$fmtTeamNum."/".$checksum.">";
|
|
||||||
// Get the Team leader name (to be done)
|
|
||||||
$TeamLeader = "n/a";
|
|
||||||
// ready to create the files
|
|
||||||
if($CSVoption == 1){
|
|
||||||
// $header = "\"ProjectNum\",\"AppersonNum\",\"ShortTitle\",\"Title\",\"IsTeam\",\"FloorNum\",\"Language\",\"TeamNote\",\"TeamNum \",\"TeamName\",\"TeamTime\",\"TeamLeader\",\"Category\",\"CatShort\",\"Division\",\"DivShort\",\"Year\",\"AppersonBarCode\",\"scheme_Id\",\"criteria_id\",\"Level_id\",\"score\"";
|
|
||||||
$title = str_replace("\"","'",$r->title);
|
|
||||||
$recordout = "\"".$r->projectnumber."\",\"".$AppPrjNum."\",\"".$r->shorttitle."\",\"".$title."\",\"".$r->IsTeam."\",\"".$r->floornumber."\",\"".$r->language."\",\"".$Teamnote."\",\"".
|
|
||||||
$r->team_num."\",\"".$r->team_name."\",\"".$teamtime."\",\"".$TeamLeader."\",\"".$r->category."\",\"".$r->category_shortform."\",\"".$r->division."\",\"".$r->division_shortform."\",\"".$r->year."\",\"".
|
|
||||||
$AppBarCode."\",\"".$r->scheme_id."\",\"".$r->score."\"";
|
|
||||||
// ********************************************write the record out to the file************************************************
|
|
||||||
$download = $download.$recordout."\r\n";
|
|
||||||
}
|
|
||||||
if ($CSVoption == 2){ // Apperson Scanner Student data
|
|
||||||
// "TPPPPJJJJ", "PRJ PPPPP 'TEAM' TITLETruncated?","JUN JJJJ JLASTNAME, JFIRSTNAME"
|
|
||||||
$Teamnote = "";
|
|
||||||
if ($r->IsTeam == "yes"){
|
|
||||||
$Teamnote = "(Team Project)";
|
|
||||||
}
|
|
||||||
$Firstname = "Proj ".$r->projectnumber." ".$Teamnote." ".$r->title;
|
|
||||||
if(strlen($Firstname) > 100){
|
|
||||||
$Firstname = substr($Firstname,100); // limit to 100 max in Apperson Datalink
|
|
||||||
}
|
|
||||||
// replace and double quotes in $Firstname with single quotes so CSV import will work.
|
|
||||||
$Firstname = str_replace("\"","'",$Firstname);
|
|
||||||
|
|
||||||
$recordout = "\"".$StudentID."\",\"".$Firstname."\",\"JudgeTeamNum ".$r->team_num."\"";
|
|
||||||
// ********************************************write the record out to the file************************************************
|
|
||||||
$download = $download.$recordout."\r\n";
|
|
||||||
}
|
|
||||||
} // while $r=mysql_fetch_object($q)
|
|
||||||
} // end of if option = 1 or 2
|
|
||||||
// code below works for all csv files.
|
|
||||||
ob_start();
|
|
||||||
header("Content-type: text/x-csv");
|
|
||||||
header("Content-disposition: inline; filename=".$filename);
|
|
||||||
header("Content-length: ".strlen($download));
|
|
||||||
header("Pragma: public");
|
|
||||||
echo $download;
|
|
||||||
//header("Location: index.php");
|
|
||||||
//ob_get_status()
|
|
||||||
exit;
|
|
||||||
|
|
||||||
?>
|
|
@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<title>SFIAB Evaluations Import</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Import Data</h2><br /><br />";
|
|
||||||
echo "This will upload the data from an Apperson Benchmark 3000 scanner and enter the good data into the Evaluations Entries table.<br />";
|
|
||||||
echo "Select a file to upload, then click the 'Upload' button.<br />";
|
|
||||||
echo "The file must conform to the Apperson scanner output format - see Documentation<br />";
|
|
||||||
echo " - Data from records matching an 'Apperson' project number (SFIAB project number without leading digit) and team number will be entered<br />";
|
|
||||||
echo " into the eval_projects_entries table. Be sure to 'Calculate Scores' to update the project scores.<br />";
|
|
||||||
echo "<br />";
|
|
||||||
?>
|
|
||||||
<form action="eval_uploader.php" method="post" enctype="multipart/form-data">
|
|
||||||
<label for="file">Filename:</label>
|
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
|
|
||||||
<input type="file" name="file" id="file" />
|
|
||||||
<br />
|
|
||||||
<input type="submit" name="Upload" value="Upload" />
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
@ -1,184 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
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>
|
|
||||||
|
|
||||||
New functionality:
|
|
||||||
Copyright (C) 2011 At Work Software <dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB plug-in Installation (Evaluations)</title>
|
|
||||||
<link rel="stylesheet" href="sfiab.css" type="text/css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>SFIAB Evaluations Plug-in - Installation</h1>
|
|
||||||
<?php
|
|
||||||
include_once "sfiab_common.inc.php"; // get config from SFIAB etc.
|
|
||||||
echo "Getting 'Evaluations' database version requirements for code... <br /> ";
|
|
||||||
if(file_exists("db/eval.code.version.txt"))
|
|
||||||
{
|
|
||||||
$evaldbcodeversion_file=file("db/eval.code.version.txt");
|
|
||||||
$evaldbcodeversion=trim($evaldbcodeversion_file[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<b>ERROR: Couldnt load plugins/evaluations/db/eval.code.version.txt</b><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
echo "<b>'Evaluations version $evaldbcodeversion</b><br />";
|
|
||||||
echo "Checking for existing 'Evaluations' database... ";
|
|
||||||
$q=@mysql_query("SELECT db_version FROM eval_config");
|
|
||||||
$r=@mysql_fetch_object($q);
|
|
||||||
$evaldbdbversion=$r->db_version;
|
|
||||||
if($evaldbdbversion)
|
|
||||||
{
|
|
||||||
echo "<b>Found version $evaldbdbversion</b><br />";
|
|
||||||
//lets see if they match
|
|
||||||
if($evaldbcodeversion == $evaldbdbversion)
|
|
||||||
echo "Your 'Evaluations' plug-in database is already setup with the required version\n";
|
|
||||||
else if($evaldbcodeversion<$evaldbdbversion)
|
|
||||||
echo "ERROR: evaldbcodeversion<evaldbdbversion ($dbcodeversion<$dbdbversion). This should not happen!";
|
|
||||||
else if($evaldbcodeversion>$evaldbdbversion)
|
|
||||||
echo "Your 'Evaluations' plug-in database needs to be updated. You should run the update script instead of this installer!\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<b>Installing 'Evaluations' plug-in database!</b><br />";
|
|
||||||
}
|
|
||||||
$error_count = 0;
|
|
||||||
echo "Checking for database installer for 'Evaluations' version $evaldbcodeversion... ";
|
|
||||||
if(file_exists("db/db.eval.full.$evaldbcodeversion.sql"))
|
|
||||||
{
|
|
||||||
echo "<b>db/db.eval.full.$evaldbcodeversion.sql found</b><br />";
|
|
||||||
echo "Setting up database tables... ";
|
|
||||||
$exit_code = 0;
|
|
||||||
$filename = 'db/db.eval.full.'.$evaldbcodeversion.'.sql';
|
|
||||||
// Temporary variable, used to store current query
|
|
||||||
$templine = '';
|
|
||||||
// Read in entire file
|
|
||||||
$lines = file($filename);
|
|
||||||
// Loop through each line
|
|
||||||
foreach ($lines as $line)
|
|
||||||
{
|
|
||||||
// Skip it if it's a comment
|
|
||||||
if (substr($line, 0, 2) == '--' || $line == '')
|
|
||||||
continue;
|
|
||||||
// Add this line to the current segment
|
|
||||||
$templine .= $line;
|
|
||||||
// If it has a semicolon at the end, it's the end of the query
|
|
||||||
if (substr(trim($line), -1, 1) == ';')
|
|
||||||
{
|
|
||||||
// Perform the query
|
|
||||||
if(!mysql_query($templine)){
|
|
||||||
echo('<br/>Error performing query!<br/>'.$templine.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
|
||||||
$exit_code = -1; // do we bail out here or keep going? keep going for now, get all errors
|
|
||||||
}
|
|
||||||
// Reset temp variable to empty
|
|
||||||
$templine = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<br/><br />";
|
|
||||||
if($exit_code != 0) {
|
|
||||||
/* mysql failed!, what now? */
|
|
||||||
$error_count += 1;
|
|
||||||
echo "<br /><b>mysql failed to execute query(s) without error!<b><br />";
|
|
||||||
}
|
|
||||||
echo "<b>Done! installed valuations' database version $dbcodeversion</b><br />\n";
|
|
||||||
echo "<br />";
|
|
||||||
echo "<b>Done!</b><br />";
|
|
||||||
// Dennis allert if errors!
|
|
||||||
if ($error_count > 0){
|
|
||||||
echo "<b>THERE WERE ERRORS! The database was not created correctly!</b><br />";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "<b>DATABASE CREATED SUCCESSFULLY!</b><br />";
|
|
||||||
}
|
|
||||||
echo "<a href=\"eval_setup.php\">Proceed to Evaluations setup</a><br />";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<br /><b>Notice: Could not find db/db.eval.full.$evaldbcodeversion.sql</b><br />";
|
|
||||||
echo "Trying to find an older version... <br />";
|
|
||||||
for($x=$evaldbcodeversion;$x>0;$x--)
|
|
||||||
{
|
|
||||||
if(file_exists("db/db.eval.full.$x.sql"))
|
|
||||||
{
|
|
||||||
echo "<b>Found db/db.eval.full.$x.sql!</b><br />";
|
|
||||||
echo "Setting up 'Evaluations' database tables... ";
|
|
||||||
$exit_code = 0;
|
|
||||||
$filename = 'db/db.eval.full.'.$x.'.sql';
|
|
||||||
// Temporary variable, used to store current query
|
|
||||||
$templine = '';
|
|
||||||
// Read in entire file
|
|
||||||
$lines = file($filename);
|
|
||||||
// Loop through each line
|
|
||||||
foreach ($lines as $line)
|
|
||||||
{
|
|
||||||
// Skip it if it's a comment
|
|
||||||
if (substr($line, 0, 2) == '--' || $line == '')
|
|
||||||
continue;
|
|
||||||
// Add this line to the current segment
|
|
||||||
$templine .= $line;
|
|
||||||
// If it has a semicolon at the end, it's the end of the query
|
|
||||||
if (substr(trim($line), -1, 1) == ';')
|
|
||||||
{
|
|
||||||
// Perform the query
|
|
||||||
if(!mysql_query($templine)){
|
|
||||||
echo('<br/>Error performing query!<br/>'.$templine.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
|
||||||
$exit_code = -1; // do we bail out here or keep going? keep going for now, get all errors
|
|
||||||
}
|
|
||||||
// Reset temp variable to empty
|
|
||||||
$templine = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<br/><br />";
|
|
||||||
if($exit_code != 0) {
|
|
||||||
/* mysql failed!, what now? */
|
|
||||||
$error_count += 1;
|
|
||||||
}
|
|
||||||
echo "<b>Installed 'Evaluations' database version $x</b><br />\n";
|
|
||||||
echo "<b>Attempting to update 'Evaluations' from $x to $evaldbcodeversion<br />";
|
|
||||||
echo "<br />Please scroll to the bottom of this page for the link to the next step of the installation process.<br /></b>";
|
|
||||||
chdir ("db");
|
|
||||||
include "db_eval_update.php";
|
|
||||||
chdir ("../");
|
|
||||||
echo "<br />";
|
|
||||||
echo "<b>Done!</b><br />";
|
|
||||||
// Dennis allert if errors! 2011-02-18
|
|
||||||
if ($error_count > 0){
|
|
||||||
echo "<b>THERE WERE ERRORS! The 'Evaluations' database was not created correctly!</b><br />";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "<b>DATABASE CREATED SUCCESSFULLY!</b><br />";
|
|
||||||
}
|
|
||||||
echo "<a href=\"eval_setup.php\">Proceed to Evaluations setup</a><br />";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</body>
|
|
@ -1,191 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB Evaluations Levels Editor</title>
|
|
||||||
<script language="javascript">
|
|
||||||
function confirmClick(msg)
|
|
||||||
{
|
|
||||||
var okay=confirm(msg);
|
|
||||||
if(okay)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Levels Editor</h2><br /><br />";
|
|
||||||
if($_POST['action']=="edit")
|
|
||||||
{
|
|
||||||
if($_POST['scheme_id'] && $_POST['level_id'] && $_POST['level_value'] && $_POST['level_name'] && $_POST['spec_use'] )
|
|
||||||
{
|
|
||||||
//$q=mysql_query("SELECT id FROM eval_criteria WHERE id='".$_POST['id']."' ");
|
|
||||||
//if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id'])
|
|
||||||
//{
|
|
||||||
// echo "Criteria ID ".$_POST['id']." already exists!";
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
$t = mysql_query("UPDATE eval_levels SET ".
|
|
||||||
"scheme_id='".$_POST['scheme_id']."', ".
|
|
||||||
"level_id='".$_POST['level_id']."', ".
|
|
||||||
"level_value='".$_POST['level_value']."', ".
|
|
||||||
"level_name='".$_POST['level_name']."', ".
|
|
||||||
"spec_use='".$_POST['spec_use']."', ".
|
|
||||||
"spec_use_code='".$_POST['spec_use_code']."' ".
|
|
||||||
"WHERE id='".$_POST['saveid']."' ");
|
|
||||||
|
|
||||||
|
|
||||||
echo "Level Saved!";
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Error: All fields are required!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_POST['action']=="new")
|
|
||||||
{
|
|
||||||
if($_POST['scheme_id'] && $_POST['level_id'] && $_POST['level_value'] && $_POST['level_name'] && $_POST['spec_use'] )
|
|
||||||
{
|
|
||||||
// $q=mysql_query("SELECT id FROM eval_criteria WHERE id='".$_POST['id']."' ");
|
|
||||||
// if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id'])
|
|
||||||
// {
|
|
||||||
// echo "Scheme ID ".$_POST['id']." already exists!";
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
mysql_query("INSERT INTO eval_levels ( scheme_id, level_id, level_value, level_name, spec_use, spec_use_code) VALUES ( ".
|
|
||||||
"'".$_POST['scheme_id']."', ".
|
|
||||||
"'".$_POST['level_id']."', ".
|
|
||||||
"'".$_POST['level_value']."', ".
|
|
||||||
"'".$_POST['level_name']."', ".
|
|
||||||
"'".$_POST['spec_use']."', ".
|
|
||||||
"'".$_POST['spec_use_code']."' ) ");
|
|
||||||
echo "Level Saved!";
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Error: All fields are required!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_GET['action']=="remove" && $_GET['remove'])
|
|
||||||
{
|
|
||||||
mysql_query("DELETE FROM eval_levels where id='".$_GET['remove']."' ");
|
|
||||||
echo "Level successfully removed";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
|
||||||
|
|
||||||
if(! ($_GET['action']=="edit" || $_GET['action']=="new") )
|
|
||||||
{
|
|
||||||
echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\"> Add New Level </a>\n";
|
|
||||||
echo "<table border=\"1\">";
|
|
||||||
echo "<tr>";
|
|
||||||
//echo "<th> rec ID </th>\n";
|
|
||||||
echo "<th> Scheme ID </th>\n";
|
|
||||||
echo "<th> Level ID</th>\n";
|
|
||||||
echo "<th> Level Value </th>\n";
|
|
||||||
echo "<th> Level Name </th>\n";
|
|
||||||
echo "<th> Special Use </th>\n";
|
|
||||||
echo "<th> Special Use Code </th>\n";
|
|
||||||
echo "<th> Actions </th>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_GET['action']=="edit" || $_GET['action']=="new")
|
|
||||||
{
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"".$_GET['action']."\">\n";
|
|
||||||
if($_GET['action']=="edit")
|
|
||||||
{
|
|
||||||
echo "<input type=\"hidden\" name=\"saveid\" value=\"".$_GET['edit']."\">\n";
|
|
||||||
$q=mysql_query("SELECT * FROM eval_levels WHERE id='".$_GET['edit']."' ");
|
|
||||||
$lvlr=mysql_fetch_object($q);
|
|
||||||
$buttontext="Save";
|
|
||||||
}
|
|
||||||
else if($_GET['action']=="new")
|
|
||||||
{
|
|
||||||
$buttontext="Add";
|
|
||||||
}
|
|
||||||
echo "<table border=\"1\">";
|
|
||||||
echo "<tr>";
|
|
||||||
//echo "<th> rec ID </th>\n";
|
|
||||||
echo "<th> Scheme ID </th>\n";
|
|
||||||
echo "<th> Level ID</th>\n";
|
|
||||||
echo "<th> Level Value </th>\n";
|
|
||||||
echo "<th> Level Name </th>\n";
|
|
||||||
echo "<th> Special Use </th>\n";
|
|
||||||
echo "<th> Special Use Code </th>\n";
|
|
||||||
echo "<th> Actions </th>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
echo "<tr>";
|
|
||||||
//echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$critr->id\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"3\" name=\"scheme_id\" value=\"$lvlr->scheme_id\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"3\" name=\"level_id\" value=\"$lvlr->level_id\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"3\" name=\"level_value\" value=\"$lvlr->level_value\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"12\" name=\"level_name\" value=\"$lvlr->level_name\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"3\" name=\"spec_use\" value=\"$lvlr->spec_use\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"4\" name=\"spec_use_code\" value=\"$lvlr->spec_use_code\" /></td>";
|
|
||||||
echo "</td>";
|
|
||||||
echo " <td><input type=\"submit\" value=\"".$buttontext."\" /></td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$q=mysql_query("SELECT * FROM eval_levels ORDER BY scheme_id, level_id");
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
echo "<tr>";
|
|
||||||
//echo " <td>$r->id </td>";
|
|
||||||
echo " <td>$r->scheme_id </td>";
|
|
||||||
echo " <td> $r->level_id </td>";
|
|
||||||
echo " <td> $r->level_value </td>";
|
|
||||||
echo " <td> $r->level_name </td>";
|
|
||||||
echo " <td> $r->spec_use </td>";
|
|
||||||
echo " <td> $r->spec_use_code </td>";
|
|
||||||
echo " <td>";
|
|
||||||
echo "<a title=\"Edit\" href=\"".$_SERVER['PHP_SELF']."?action=edit&edit=$r->id\">Edit</a>";
|
|
||||||
echo " ";
|
|
||||||
echo "<a title=\"Remove\" onClick=\"return confirmClick('Are you sure you want to remove this level?');\" href=\"".$_SERVER['PHP_SELF']."?action=remove&remove=$r->id\">Remove</a>";
|
|
||||||
echo " </td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
echo"Scheme ID Must exist in Schemes!";
|
|
||||||
echo "</body>";
|
|
||||||
echo "</html>";
|
|
||||||
exit;
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
@ -1,480 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB Evaluations Link</title>
|
|
||||||
<link rel="stylesheet" href="sfiab.css" type="text/css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Link Evaluations and SFIAB Data</h2><br /><br />";
|
|
||||||
echo "<br /><br />";
|
|
||||||
$errors = 0;
|
|
||||||
echo "Click the button to link SFIAB and Evaluations. (Be patient, may take a while)";
|
|
||||||
echo "<form method=\"post\" action=\"eval_link_sfiab.php\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"link\" />";
|
|
||||||
echo "<br />";
|
|
||||||
echo "<input type=\"submit\" value=\"Link Now\">";
|
|
||||||
echo "</form>";
|
|
||||||
if(!$_POST['action'] == "link")
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
echo "Linking Process complete - status follows:<br /><br />";
|
|
||||||
// get the eval_scheme id and eval_schemes.assignto_project_when fields
|
|
||||||
$q=mysql_query("SELECT * FROM eval_schemes");
|
|
||||||
if (!q){
|
|
||||||
echo "ERROR: Cannot open eval_schemes. You must have schemes set up prior to linking";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// build an array of eval_schemes table
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
$crit = $r->assignto_project_when;
|
|
||||||
$words = explode(' ', $crit); //this should get the parameter, '+' and the value
|
|
||||||
//echo "".$r->scheme_id." ".$words[0]." ".$words[1]." ".$words[2]."<br />";
|
|
||||||
$schmidval = $r->scheme_id;
|
|
||||||
$schemes[] = array($schmidval,$words[0],$words[1],$words[2]);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
For now, the evaluations are done by the teams (judges_teams_id) - one evaluation per divisional round perhaps.
|
|
||||||
the table judges_teams_timeslots_projects_link contains the necessary fields 'Projects_id' and 'judges_teams_id'
|
|
||||||
|
|
||||||
Eventually perhaps Another table - eval_project_assignements will link 'Who does the eval' to the 'Projects_id' to be evaluated.
|
|
||||||
table eval_projects_entries has:
|
|
||||||
Judges_teams_id (this will be always be set to a judges_teams_id whick I will assume for now is always > 0 )
|
|
||||||
Judge_user_id (this will be set to 0 to indicate we use judges_teams. set > 0 if we use individual judges later..) criteria_id (this is which evaluation criteria is being entered (entered by team or upload or ... null => no entry)
|
|
||||||
level_id (this is the score - entered as an Id so we can get the value and calculate a score generically. null =>no entry)
|
|
||||||
(A) Using sfiab projects table and eval_projects table.
|
|
||||||
1.) For each project in SFIAB
|
|
||||||
if project.id in eval_projects then verify entries (judges, team etc) and update
|
|
||||||
if not in eval_projects do link (insert row in eval_projects) and fill in entries (judges, team etc.
|
|
||||||
entries: project_id; team (also scheme_id <-- setup); eval_score; final_score; eval_score_status; overall_status) set scheme_id according to the values in eval_schemes.assignto_project_when fields (something = something)
|
|
||||||
2.) For each project in eval_projects
|
|
||||||
if project_id NOT in SFIAB then remove from eval_projects
|
|
||||||
(B) Using judges_teams_timeslots_projects_link and eval_projects_entries.
|
|
||||||
See if eval_projects_entries has any entries => any criteria_id and or level_id will have non-null entries
|
|
||||||
If NO then: Empty the table and reload it from judges_teams_timeslots_projects_links SFIAB table
|
|
||||||
|
|
||||||
If YES then:
|
|
||||||
1 Remove all records in eval_projects_entries without entries
|
|
||||||
2 See if we can save the ones with entries.
|
|
||||||
For each record with an entry criteria_id or level_id
|
|
||||||
If matching team/project in SFIAB then leave it
|
|
||||||
If not matching team/project in SFIAB then remove it
|
|
||||||
3. For each record in judges_teams_timeslots_projects_links
|
|
||||||
If same project, team in eval then skip (have record and have entry)
|
|
||||||
else add record.
|
|
||||||
|
|
||||||
this for later?? or remove
|
|
||||||
SELECT Exhibitors.Exhibit_ID, Exhibits.EXN, Exhibits.Exhibit_ID AS Expr1, Exhibitors.UserId
|
|
||||||
FROM Exhibitors LEFT OUTER JOIN
|
|
||||||
Exhibits ON Exhibitors.Exhibit_ID = Exhibits.Exhibit_ID
|
|
||||||
*/
|
|
||||||
// projects has projectcategories_id ( ) and projectdivisions_id ( ) and as possible scheme setups valuse
|
|
||||||
// Students has grade as possilbe scheme setup values
|
|
||||||
// ************************ NOTE This gets ALL projects, even those not assigned to a judge team(open versus complete) *******************************
|
|
||||||
$qst = "SELECT students.registrations_id, projects.registrations_id, projects.id, projects.shorttitle, students.grade, ";
|
|
||||||
$qst = $qst."projects.projectcategories_id, projects.projectdivisions_id, projects.cwsfdivisionid ";
|
|
||||||
$qst = $qst." FROM students LEFT OUTER JOIN projects ON students.registrations_id = projects.registrations_id ORDER by projects.id";
|
|
||||||
// note the sort order is important if my code works to discover teams
|
|
||||||
$nscnt = 0;
|
|
||||||
$nprj = 0;
|
|
||||||
$ns = 0;
|
|
||||||
$pid = -1;
|
|
||||||
//echo $qst;
|
|
||||||
$q=mysql_query($qst);
|
|
||||||
if ($q) {
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
$ns += 1; // count students
|
|
||||||
$cwdiv = $r->cwsfdivisionid;
|
|
||||||
$grade = $r->grade;
|
|
||||||
$divid = $r->projectdivisions_id;
|
|
||||||
$cat = $r->projectcategories_id;
|
|
||||||
if ($r->id == $pid){
|
|
||||||
// we already did this project but... it is a team project since # students > 1
|
|
||||||
if ($r->grade > $grade) {
|
|
||||||
$grade = $r->grade; // always select the highest grade in the team (matched help.html)
|
|
||||||
}
|
|
||||||
$team = "yes";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// project.id changed so save the last one
|
|
||||||
// but only if see if we did the save
|
|
||||||
if ($pid == -1){
|
|
||||||
$pid = $r->id; // setup first time
|
|
||||||
//echo "Did First time pid = ".$pid." <br />";
|
|
||||||
$team = "no";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// done with last so save it (note does not save the last one.
|
|
||||||
$nprj += 1; // count projects
|
|
||||||
insert_project($schemes, $pid, $divid, $team, $cat, $grade, $cwdiv);
|
|
||||||
// get ready for the next
|
|
||||||
$pid = $r->id;
|
|
||||||
$team = "no";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$nprj += 1; // count projects
|
|
||||||
insert_project($schemes, $pid, $divid, $team, $cat, $grade, $cwdiv);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo('<br/>Error performing query!<br/>'.$qst.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
|
||||||
echo "<br />Query failed<br />";
|
|
||||||
$errors += 1;
|
|
||||||
}
|
|
||||||
if (errors == 0){
|
|
||||||
echo "SFIAB has ".$ns." Students and ".$nprj." Projects. <br />";
|
|
||||||
echo "<br />Evaluations links to SFIAB have been updated!<br />";
|
|
||||||
echo " This means:<br />";
|
|
||||||
echo " ** Each Project in SFIAB is now included in Evaluations' data.<br />";
|
|
||||||
echo " ** Projects removed from SFIAB since the last link-up were removed from Evaluations' data.<br />";
|
|
||||||
echo " Note: Project evaluations entered (if any) were retained! SFIAB projects 'newly added' will have no evaluation entries.<br />";
|
|
||||||
echo "<br />";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "There were errors! Review the notices and correct the problems!<br />";
|
|
||||||
}
|
|
||||||
// **************** create/ update the eval_projects_entries table *************************
|
|
||||||
|
|
||||||
// now see if any extra records in local table (not in SFIAB) to delete - remember eval_projects contains ALL projects, not just those complete.
|
|
||||||
$loc = mysql_query("SELECT project_id from eval_projects"); // All projects = even those not assigned a judge team
|
|
||||||
while($lr =mysql_fetch_object($loc))
|
|
||||||
{
|
|
||||||
$q=mysql_query("SELECT id FROM projects WHERE id = '".$lr->project_id."' ");
|
|
||||||
$remr = mysql_fetch_object($q)->id;
|
|
||||||
if(mysql_num_rows($q) ==0){ // will probably find 2 for project_id = 0 (due to way $qst is formed above
|
|
||||||
$del = mysql_query("DELETE from eval_projects WHERE project_id = '".$lr->project_id."' " );
|
|
||||||
if (! $del){
|
|
||||||
echo "delete error project_id=".$lr->project_id."<br />";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Deleted project_id ".$lr->project_id." from evaluations data.<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// could have some records left for projects that are not complete if.. was complete, then had an evaluation, then was set as incomplete
|
|
||||||
// I will not worry about this at this time.
|
|
||||||
// *****************************************************************************************************
|
|
||||||
// Now do the work on eval_projects_entries table using SFIAB judges_teams_timeslots_projects_links
|
|
||||||
echo "<br />Updating Projects Evaluations Entries! <br />";
|
|
||||||
$num_entries = 0;
|
|
||||||
$chknum_entries = 0;
|
|
||||||
// First delete all entries without evaluations
|
|
||||||
$q = mysql_query("DELETE FROM eval_projects_entries WHERE level_id IS NULL");
|
|
||||||
if (!q){
|
|
||||||
echo "Error opening table eval_projects_entries ";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$qst = "SELECT * FROM eval_projects_entries WHERE level_id IS NOT NULL";
|
|
||||||
$q=mysql_query($qst);
|
|
||||||
if (!q){
|
|
||||||
echo "Error opening table eval_projects_entries ";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(mysql_num_rows($q) > 0){ // will probably find 2 for project_id = 0 (due to way $qst is formed above
|
|
||||||
// Have records
|
|
||||||
$num_entries = mysql_num_rows($q);
|
|
||||||
echo "Found ".$num_entries ." records with entries<br />";
|
|
||||||
// now see if those left have entries in judges_teams_timeslots_projects_link
|
|
||||||
// if not, then they also can be deleted
|
|
||||||
$q=mysql_query($qst);
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$qeval = mysql_query("SELECT * FROM judges_teams_timeslots_projects_link WHERE projects_id = '$r->project_id' AND judges_teams_id = '$r->judges_teams_id'"); // find matching entry
|
|
||||||
if (mysql_num_rows($qeval) == 0){
|
|
||||||
echo "project_id andjudge_team_id not in SFIAB so removed<br />";
|
|
||||||
$qremove = mysql_query("DELETE FROM eval_projects_entries WHERE project_id = '$r->project_id' AND judges_teams_id = '$r->judges_teams_id'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Good! No recores had entries<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add all records from judges_teams_timeslots_projects_links NOT in eval_projects_entries
|
|
||||||
$q = mysql_query("SELECT * FROM judges_teams_timeslots_projects_link");
|
|
||||||
$count = 0;
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
//$skip = 0;
|
|
||||||
//$qeval = mysql_query($qst); // find all with level_id entries
|
|
||||||
//while($reval=mysql_fetch_object($qeval)) {
|
|
||||||
// if($reval->project_id == $r->projects_id ){
|
|
||||||
// if($reval->judges_teams_id == $r->judges_teams_id) {
|
|
||||||
// $skip = 1; // found this one with at least one level_id entry non-null entries so do not add it
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//if ($skip == 0){
|
|
||||||
// insert a record for each criteria ID that does NOT have a current level_id non null. New entries level_id will be set null
|
|
||||||
// for the project, get the scheme id.
|
|
||||||
$qprj= mysql_query("SELECT * FROM eval_projects WHERE project_id = '".$r->projects_id."' ");
|
|
||||||
if($qprj){
|
|
||||||
// for the scheme id get all the criteria ids
|
|
||||||
while($rprj =mysql_fetch_object($qprj)) {
|
|
||||||
$qcrit= mysql_query("SELECT * FROM eval_criteria WHERE scheme_id = '".$rprj->scheme_id."' ");
|
|
||||||
if($qcrit){
|
|
||||||
while($rcrit =mysql_fetch_object($qcrit)) {
|
|
||||||
// find this record (project, Team, criteria has an entry for level_id)
|
|
||||||
if ($num_entries > 0){ // no sense checking if no evaluations done at start.
|
|
||||||
$qcheck = mysql_query("SELECT * FROM eval_projects_entries WHERE project_id='".$r->projects_id."' AND judges_teams_id = '".$r->judges_teams_id."' AND criteria_id ='".$rcrit->criteria_id."' ");
|
|
||||||
if (mysql_num_rows($qcheck) > 0) {
|
|
||||||
$chknum_entries += 1;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$qadd = mysql_query("INSERT INTO eval_projects_entries (project_id, judges_teams_id, judges_timeslots_id, criteria_id) VALUES ('$r->projects_id', '$r->judges_teams_id', '$r->judges_timeslots_id', ' $rcrit->criteria_id' )");
|
|
||||||
$count += 1;
|
|
||||||
}
|
|
||||||
} // if ($num_entries > 0)
|
|
||||||
else{
|
|
||||||
$qadd = mysql_query("INSERT INTO eval_projects_entries (project_id, judges_teams_id, judges_timeslots_id, criteria_id) VALUES ('$r->projects_id', '$r->judges_teams_id', '$r->judges_timeslots_id', ' $rcrit->criteria_id' )");
|
|
||||||
$count += 1;
|
|
||||||
} // else (if ($num_entries > 0)
|
|
||||||
} // while $rcrit
|
|
||||||
} // if $qcrit
|
|
||||||
} // while $rprj
|
|
||||||
} // if $qprj
|
|
||||||
//}
|
|
||||||
else {
|
|
||||||
//echo "skipped<br />";
|
|
||||||
$skipped +=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($chknum_entries == $num_entries){
|
|
||||||
|
|
||||||
echo "<br />Eval_projects_entries updated! ".$num_entries." evaluation entries were retained. Total evals to do = ".($count + $num_entries)."<br />";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "<br />ERROR num_entries =".$num_entries." not same as check of num_entries = ".$chknum_entries."<br />";
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
|
|
||||||
// ******************************** function to insert or update eval_projects table ****************************
|
|
||||||
|
|
||||||
function insert_project($schemes, $pid, $div, $team, $cat, $grade, $cwdiv )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if this project is in eval_projects then update scheme_id, team (leaves eval_score, etc)
|
|
||||||
if this project is NOT in eval_projects then insert project_id, team, scheme_id
|
|
||||||
if this project is in eval_projects_entries then update judges_teams_id, judges_timeslots_id, judge_user_id
|
|
||||||
(leave entries criteria_id, level_id)
|
|
||||||
if this project is NOT in eval_projects_entries then insert project_id, judges_teams_id, judges_timeslots_id, judge_user_id
|
|
||||||
*/
|
|
||||||
// see if any of the possible selection parameters for this project are matched to a scheme (see help)
|
|
||||||
// The $schemes array and example
|
|
||||||
// id par con val
|
|
||||||
// 0 1 2 3
|
|
||||||
// 1 team = no
|
|
||||||
// 2 team = yes
|
|
||||||
$proj_scheme_id = 9999; //set this as the default in case we find no matches
|
|
||||||
foreach ($schemes as $sch)
|
|
||||||
{
|
|
||||||
$match = 0;
|
|
||||||
// get the parameter
|
|
||||||
$par = $sch[1];
|
|
||||||
//get the condition
|
|
||||||
$con = $sch[2];
|
|
||||||
// get the value
|
|
||||||
$val = $sch[3];
|
|
||||||
// see if this project's values matches the parameter and condition
|
|
||||||
// for the example above this will set proj_scheme_id to 1 for team=no 2 for team=yes
|
|
||||||
if($par == 'team'){ // there is a team condition in schemes
|
|
||||||
if ($con == "="){
|
|
||||||
if ($team == $val){ // is this projects team setting = scheme setting 'yes' or 'no'
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '!='){
|
|
||||||
if ($team != $val){ // is this projects team setting != scheme setting != 'yes' or != 'no'
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '<'){
|
|
||||||
if ($team < $val){ // is this projects team setting < scheme setting of 'yes' or 'no'
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '>') {
|
|
||||||
if ($team > $val){ // is this projects team setting > scheme setting of 'yes' or 'no'
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($par == 'div'){
|
|
||||||
if ($con == "="){
|
|
||||||
if ($div == $val){ // is this projects division setting = the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '!='){
|
|
||||||
if ($div != $val){ // is this projects division setting != the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '<'){
|
|
||||||
if ($div < $val){ // is this projects division setting <t he setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '>') {
|
|
||||||
if ($div > $val){ // is this projects division setting > the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($par == 'cat'){
|
|
||||||
if ($con == "="){
|
|
||||||
if ($cat == $val){ // is this projects category setting = the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '!='){
|
|
||||||
if ($cat != $val){ // is this projects category setting != the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '<'){
|
|
||||||
if ($cat < $val){ // is this projects category setting = the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '>') {
|
|
||||||
if ($cat > $val){ // is this projects category setting = the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($par == 'grade'){
|
|
||||||
if ($con == "="){
|
|
||||||
if ($grade == $val){ // is this projects team grade = the setting in a scheme
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '!='){
|
|
||||||
if ($grade != $val){
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '<'){
|
|
||||||
if ($grade < $val){
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '>') {
|
|
||||||
if ($grade> $val){
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($par == 'cwdiv'){ // check the canada wide div id = scheme setting for cwdiv.
|
|
||||||
if ($con == "="){
|
|
||||||
if ($cwdiv == $val){
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '!='){
|
|
||||||
if ($cwdiv != $val){
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '<'){
|
|
||||||
if ($cwdiv < $val){
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($con == '>') {
|
|
||||||
if ($cwdiv> $val){
|
|
||||||
$proj_scheme_id = $sch[0];
|
|
||||||
escape;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
// echo "Save Scheme= ".$proj_scheme_id." Save pid= ".$pid." Team= ".$team." div= ".$div." cat= ".$cat." grade= ".$grade." cwdiv= ".$cwdiv."<br />";
|
|
||||||
// ready to update or add the eval_projects table entry
|
|
||||||
// See if a record for this project ID
|
|
||||||
$ev = mysql_query("SELECT * FROM eval_projects WHERE project_id = $pid");
|
|
||||||
if (mysql_num_rows($ev) > 0) {
|
|
||||||
|
|
||||||
//echo "found - updating<br />";
|
|
||||||
$ev = mysql_query("UPDATE eval_projects SET team = '$team', scheme_id = '$proj_scheme_id' WHERE project_id = $pid");
|
|
||||||
echo mysql_error();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// echo "not found - adding<br />";
|
|
||||||
$ev = mysql_query("INSERT INTO eval_projects (project_id, team, scheme_id) VALUES ('$pid', '$team', '$proj_scheme_id')");
|
|
||||||
echo mysql_error();
|
|
||||||
}
|
|
||||||
/* keep this code here until I copy it to the score entry routines
|
|
||||||
// DO NOT .. Do the same for table eval_projects_entries
|
|
||||||
// Every entry into this table must be done when we know the values for criteria_id and value-id
|
|
||||||
// because these are the entries from a judge or team or... so then... we enter the judges_team_id and timeslot
|
|
||||||
//or... in an optional method of assigning judges the judge_user_id
|
|
||||||
$ev = mysql_query("SELECT * FROM eval_projects_entries WHERE project_id = $pid");
|
|
||||||
if (mysql_num_rows($ev) > 0) {
|
|
||||||
|
|
||||||
//echo "found - updating<br />";
|
|
||||||
$ev = mysql_query("UPDATE eval_projects_entries SET judges_teams_id = '$judges_teams_id', judges_timeslots_id = '$judges_timeslots_id', judge_user_id = '$judge_user_id' WHERE project_id = $pid");
|
|
||||||
echo mysql_error();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// echo "not found - adding<br />";
|
|
||||||
$ev = mysql_query("INSERT INTO eval_projects_entries (project_id, judges_teams_id, judges_timeslots_id, judge_user_id ) VALUES ('$pid', '$judges_teams_id', '$judges_timeslots_id', '$judge_user_id')");
|
|
||||||
echo mysql_error();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
</body>
|
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* enable or replace this when front end code is added
|
|
||||||
if ($_SESSION['users_type'] =! 'committee'){
|
|
||||||
echo "Not Logged In!<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//echo "Logged In<br />";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
echo "<h1>SFIAB Evaluations Plug-in</h1><br />";
|
|
||||||
echo "<a href=\"../../admin/index.php\">Return to SFIAB Admin </a><br />";
|
|
||||||
//echo "<br />";
|
|
||||||
//echo "<a href=\"index.php\">Evaluations Menu </a><br /><br />";
|
|
||||||
echo "<b>Process:</b><br />";
|
|
||||||
echo " * <a href=\"eval_link_sfiab.php\">Link Evaluations to SFIAB</a> ";
|
|
||||||
echo " * <a href=\"eval_export.php\">Export Evaluations Data (Apperson Scanners data, etc.)</a> ";
|
|
||||||
echo " * <a href=\"eval_webentry.php\">Evaluations Web Entry</a> ";
|
|
||||||
echo " * <a href=\"eval_import.php\">Import Evaluation Data (Apperson Scanners)</a> ";
|
|
||||||
echo " * <a href=\"eval_calc_scores.php\">Calculate Scores</a><br />";
|
|
||||||
echo "<b>Setup and Help:</b><br />";
|
|
||||||
echo " * <a href=\"eval_schemes.php\">Create / Edit Schemes</a> ";
|
|
||||||
echo " * <a href=\"eval_criteria.php\">Create / Edit Criteria</a> ";
|
|
||||||
echo " * <a href=\"eval_levels.php\">Create / Edit Levels</a> ";
|
|
||||||
echo " * <a href=\"docs/eval_help.html\">Documentation</a><br /><br />";
|
|
||||||
|
|
||||||
?>
|
|
@ -1,173 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB Evaluations Schemes Editor</title>
|
|
||||||
<script language="javascript">
|
|
||||||
function confirmClick(msg)
|
|
||||||
{
|
|
||||||
var okay=confirm(msg);
|
|
||||||
if(okay)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Schemes Editor</h2><br /><br />";
|
|
||||||
|
|
||||||
if($_POST['action']=="edit")
|
|
||||||
{
|
|
||||||
if($_POST['id'] && $_POST['name'] && $_POST['equation'] )
|
|
||||||
{
|
|
||||||
$q=mysql_query("SELECT scheme_id FROM eval_schemes WHERE scheme_id='".$_POST['id']."' ");
|
|
||||||
if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id'])
|
|
||||||
{
|
|
||||||
echo "Scheme ID ".$_POST['id']." already exists!";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mysql_query("UPDATE eval_schemes SET ".
|
|
||||||
"scheme_id='".$_POST['id']."', ".
|
|
||||||
"scheme_name='".$_POST['name']."', ".
|
|
||||||
"assignto_project_when='".$_POST['equation']."' ".
|
|
||||||
"WHERE scheme_id='".$_POST['saveid']."' ");
|
|
||||||
|
|
||||||
echo "Scheme Saved!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Error: All fields are required!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_POST['action']=="new")
|
|
||||||
{
|
|
||||||
if($_POST['id'] && $_POST['name'] && $_POST['equation'] )
|
|
||||||
{
|
|
||||||
$q=mysql_query("SELECT scheme_id FROM eval_schemes WHERE scheme_id='".$_POST['id']."' ");
|
|
||||||
if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id'])
|
|
||||||
{
|
|
||||||
echo "Scheme ID ".$_POST['id']." already exists!";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mysql_query("INSERT INTO eval_schemes (scheme_id, scheme_name, assignto_project_when) VALUES ( ".
|
|
||||||
"'".$_POST['id']."', ".
|
|
||||||
"'".$_POST['name']."', ".
|
|
||||||
"'".$_POST['equation']."' ) ");
|
|
||||||
echo "Scheme Saved!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Error: All fields are required!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_GET['action']=="remove" && $_GET['remove'])
|
|
||||||
{
|
|
||||||
mysql_query("DELETE FROM eval_schemes where scheme_id='".$_GET['remove']."' ");
|
|
||||||
echo "Scheme successfully removed";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
|
||||||
|
|
||||||
if(! ($_GET['action']=="edit" || $_GET['action']=="new") )
|
|
||||||
{
|
|
||||||
echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\"> Add New Scheme </a>\n";
|
|
||||||
echo "<table border=\"1\">";
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<th> Scheme ID </th>\n";
|
|
||||||
echo "<th> Scheme Name </th>\n";
|
|
||||||
echo "<th> Selection Statement </th>\n";
|
|
||||||
echo "<th> Actions </th>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_GET['action']=="edit" || $_GET['action']=="new")
|
|
||||||
{
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"".$_GET['action']."\">\n";
|
|
||||||
if($_GET['action']=="edit")
|
|
||||||
{
|
|
||||||
echo "<input type=\"hidden\" name=\"saveid\" value=\"".$_GET['edit']."\">\n";
|
|
||||||
$q=mysql_query("SELECT * FROM eval_schemes WHERE scheme_id='".$_GET['edit']."' ");
|
|
||||||
$schemer=mysql_fetch_object($q);
|
|
||||||
$buttontext="Save";
|
|
||||||
}
|
|
||||||
else if($_GET['action']=="new")
|
|
||||||
{
|
|
||||||
$buttontext="Add";
|
|
||||||
}
|
|
||||||
echo "<table border=\"1\">";
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<th> Scheme ID </th>\n";
|
|
||||||
echo "<th> Scheme Name </th>\n";
|
|
||||||
echo "<th> Selection Statement </th>\n";
|
|
||||||
echo "<th> Actions </th>\n";
|
|
||||||
echo "</tr>";
|
|
||||||
|
|
||||||
|
|
||||||
echo "<tr>";
|
|
||||||
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$schemer->scheme_id\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"20\" name=\"name\" value=\"$schemer->scheme_name\" /></td>";
|
|
||||||
echo " <td><input type=\"text\" size=\"50\" name=\"equation\" value=\"$schemer->assignto_project_when\" /></td>";
|
|
||||||
echo "</td>";
|
|
||||||
|
|
||||||
|
|
||||||
echo " <td><input type=\"submit\" value=\"".$buttontext."\" /></td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$q=mysql_query("SELECT * FROM eval_schemes ORDER BY scheme_id");
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
echo "<tr>";
|
|
||||||
echo " <td>$r->scheme_id </td>";
|
|
||||||
echo " <td> $r->scheme_name </td>";
|
|
||||||
echo " <td> $r->assignto_project_when </td>";
|
|
||||||
echo " <td>";
|
|
||||||
echo "<a title=\"Edit\" href=\"".$_SERVER['PHP_SELF']."?action=edit&edit=$r->scheme_id\">Edit</a>";
|
|
||||||
echo " ";
|
|
||||||
echo "<a title=\"Remove\" onClick=\"return confirmClick('Are you sure you want to remove this scheme?');\" href=\"".$_SERVER['PHP_SELF']."?action=remove&remove=$r->scheme_id\">Remove</a>";
|
|
||||||
echo " </td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
echo"You should assign the 'Scheme ID's in numerical order, starting with 1.";
|
|
||||||
echo "</body>";
|
|
||||||
echo "</html>";
|
|
||||||
// send_footer();
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
@ -1,138 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB Evaluations setup</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
//do not include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
//include "eval_menu_inc.php";
|
|
||||||
|
|
||||||
// Set up SFIAB for the correct configuration
|
|
||||||
// enter var = score_entry_enable; val = yes in config table
|
|
||||||
if($config['score_entry_enable'] != 'yes') {
|
|
||||||
$q= mysql_query("SELECT * FROM config WHERE var = 'score_entry_enable'");
|
|
||||||
if ( mysql_num_rows($q) > 0){
|
|
||||||
if ( mysql_num_rows($q) ==1){
|
|
||||||
$reslt = mysql_query("UPDATE config SET val = 'yes' WHERE var = 'score_entry_enable'");
|
|
||||||
echo mysql_error();
|
|
||||||
$actn = "Updated";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Un-expected condition. table config has more than one entry with val = 'score_entry_enable'<br /> ";
|
|
||||||
echo "Please resolve this ('none' or 'one' record is required to proceed)<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // no entry WHERE var = 'score_entry_enable'");
|
|
||||||
$reslt = mysql_query("INSERT INTO config SET var = 'score_entry_enable', val = 'yes' ");
|
|
||||||
echo mysql_error();
|
|
||||||
$actn = "Added";
|
|
||||||
}
|
|
||||||
echo "<br />Table 'config': ".$actn." var = 'score_entry_enable', val = 'yes'<br />";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Good! SFIAB is already configured with config table entry var = 'score_entry_enable' val = 'yes'<br />";
|
|
||||||
}
|
|
||||||
// See if score is a field in `judges_teams_timeslots_projects_link`
|
|
||||||
//ALTER TABLE `judges_teams_timeslots_projects_link` ADD `score` FLOAT( 5.2 ) NULL ;
|
|
||||||
$q=mysql_query("SELECT score FROM `judges_teams_timeslots_projects_link`");
|
|
||||||
if (!$q) {
|
|
||||||
$reslt = mysql_query("ALTER TABLE `judges_teams_timeslots_projects_link` ADD `score` FLOAT( 5,2 ) NULL");
|
|
||||||
echo mysql_error();
|
|
||||||
echo "Field 'score' added to `judges_teams_timeslots_projects_link` table<br />";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Good! SFIAB table `judges_teams_timeslots_projects_link` already has field 'score' <br />";
|
|
||||||
}
|
|
||||||
// more work needed after this point - if no scheme need to add a scheme editor, criteria editor, and values editor ... perhaps different files.
|
|
||||||
// check if table eval_schemes is setup and if has records....
|
|
||||||
$q=mysql_query("SELECT * FROM eval_schemes");
|
|
||||||
if(!$q){
|
|
||||||
echo "Error: The table eval_Schemes did not get created correctly!";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
echo "<br /><br />Evaluations Setup is Complete! Next, set up Schemes, Criteria and Values for your specific requirements. <br /><br />";
|
|
||||||
if(mysql_num_rows($q)>0) {
|
|
||||||
echo "Schemes already has records!<br />";
|
|
||||||
echo " - To load a different preset Scheme, select one from the list below (TBD?)<br />";
|
|
||||||
echo " - Or, use the appropriate Scheme, Criteria and Values editors in the Evaluations main menu to set up your specific requirements.<br />";
|
|
||||||
echo "<a href=\"index.php\">Return to Evaluations Main Menu</a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "For now, Eval will be loaded with a preset ISEF scoring scheme.<br /> - Several other preset schemes may be added in the future.<br />";
|
|
||||||
echo "<a href=docs\"eval_help.html\">Click here for help</a><br />";
|
|
||||||
// add code and forms etc to select a setup file from those existing in the db folder
|
|
||||||
// files will have the form db.eval.setup.xxxx.sql
|
|
||||||
// for now this is hard coded.
|
|
||||||
|
|
||||||
$setupfile = "ISEF";
|
|
||||||
//
|
|
||||||
if(!file_exists("db/db.eval.setup.$setupfile.sql"))
|
|
||||||
{
|
|
||||||
echo "Wops, the setup file db/db.eval.setup.$setupfile.sql does not exist!";
|
|
||||||
echo "<a href=\"index.php\">Return to Evaluations Main Page</a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// code to load a pre-existing setup file.
|
|
||||||
echo "<b>db/db.eval.full.$evaldbcodeversion.sql found</b><br />";
|
|
||||||
echo "Setting up database tables... ";
|
|
||||||
$exit_code = 0;
|
|
||||||
$filename = 'db/db.eval.setup.'.$setupfile.'.sql';
|
|
||||||
$templine = '';
|
|
||||||
$lines = file($filename);
|
|
||||||
foreach ($lines as $line)
|
|
||||||
{
|
|
||||||
if (substr($line, 0, 2) == '--' || $line == '')
|
|
||||||
continue;
|
|
||||||
$templine .= $line;
|
|
||||||
if (substr(trim($line), -1, 1) == ';')
|
|
||||||
{
|
|
||||||
if(!mysql_query($templine)){
|
|
||||||
echo('<br/>Error performing query!<br/>'.$templine.'<br/> mysqlerror: '.mysql_error().'<br /><br />');
|
|
||||||
$exit_code = -1; // do we bail out here or keep going? keep going for now, get all errors
|
|
||||||
}
|
|
||||||
$templine = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<br/><br />";
|
|
||||||
if($exit_code != 0) {
|
|
||||||
$error_count += 1;
|
|
||||||
echo "<br /><b>mysql failed to execute query(s) without error!<b><br />";
|
|
||||||
}
|
|
||||||
echo "<br />";
|
|
||||||
if ($error_count > 0){
|
|
||||||
echo "<b>THERE WERE ERRORS! The setup was not created correctly!</b><br />";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "<b>SETUP for $setupfile CREATED SUCCESSFULLY!</b><br />";
|
|
||||||
}
|
|
||||||
echo "<a href=\"index.php\">Return to Evaluations Main Menu</a><br />";
|
|
||||||
|
|
||||||
?>
|
|
||||||
</body>
|
|
@ -1,161 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
/* This routine works only to upload data from the Apperson Benchmark Scanners.
|
|
||||||
Requirement:
|
|
||||||
1 must setup SFIAB per evaluations Help documentation which means
|
|
||||||
- all categories Ids are single digit
|
|
||||||
- all division id are 1 or 2 digits (no more than 99 projects in any division
|
|
||||||
- no division is assigned to more than one category.
|
|
||||||
- if remove the first digit from all project numbers the results are all unique numbers (remove the Category digit)
|
|
||||||
- there must be only 1 or 2 schemes
|
|
||||||
- each scheme must have exactly 6 criteria (numbered and named per the help file)
|
|
||||||
- each scheme must have exactly 7 level_id with ids = 0,1,2,3,4,5,7 level id 0 = no mark level id 7 = multiple marks
|
|
||||||
- level values for level ids 1,2,3,4,5 must be = 1,2,3,4,5 respectively
|
|
||||||
- etc. If all that is set up correclty then the Apperson exported file will be properly imported to eval_projects-entries.
|
|
||||||
*/
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // get evaluations setup
|
|
||||||
if (($_FILES["file"]["type"] == "text/plain")
|
|
||||||
&& ($_FILES["file"]["size"] < 100000)) // simple checks to start
|
|
||||||
{
|
|
||||||
if ($_FILES["file"]["error"] > 0)
|
|
||||||
{
|
|
||||||
echo "File Selection / upload Error: Return Code: " . $_FILES["file"]["error"] . "<br />";
|
|
||||||
echo "<br /><br /><a href=\"eval_import.php\"> Return </a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Uploading: " . $_FILES["file"]["name"] . "<br />";
|
|
||||||
//echo "Type: " . $_FILES["file"]["type"] . "<br />";
|
|
||||||
//echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
|
|
||||||
//echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
|
|
||||||
|
|
||||||
if (file_exists("uploads/" . $_FILES["file"]["name"]))
|
|
||||||
{
|
|
||||||
echo $_FILES["file"]["name"] . " already exists - OLD COPY WAS DELETED<br />";
|
|
||||||
unlink("uploads/" . $_FILES["file"]["name"]);
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
{
|
|
||||||
move_uploaded_file($_FILES["file"]["tmp_name"],
|
|
||||||
"uploads/" . $_FILES["file"]["name"]);
|
|
||||||
$filename = "uploads/". $_FILES["file"]["name"];
|
|
||||||
//echo "<br />Stored in: ".$filename."<br />";
|
|
||||||
//open the file
|
|
||||||
$fh = fopen($filename, 'r');
|
|
||||||
//$theData = fread($fh, filesize($filename));
|
|
||||||
while (($data = fgetcsv($fh, 60, ",")) !== FALSE) {
|
|
||||||
$num = count($data);
|
|
||||||
//echo "<p> $num fields in line $row: <br /></p>\n";
|
|
||||||
if ($num != 9){
|
|
||||||
echo "Number of fields in file not equal to 9. Incorrect File - Try Again!";
|
|
||||||
fclose($fh);
|
|
||||||
// delete the file
|
|
||||||
unlink($filename);
|
|
||||||
echo "<br /><br /><a href=\"eval_import.php\"> Return </a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$row++;
|
|
||||||
// get each item in the csv record there are 9 items
|
|
||||||
$Apperson_num = $data[0];
|
|
||||||
$team_num = $data[1];
|
|
||||||
// IMPORTANT This only works if the setup is done following the rules for using the Apperson Scanner.
|
|
||||||
// The project numbers are all unique after removing the first digit (the Category ID)
|
|
||||||
$qstr = "SELECT judges_teams.num, projects.projectnumber, projects.projectcategories_id, ". "eval_projects_entries.criteria_id, eval_projects_entries.level_id, ".
|
|
||||||
"eval_projects_entries.id, SUBSTR(projects.projectnumber, 2) AS apppProj ".
|
|
||||||
"FROM eval_projects_entries, projects, judges_teams ".
|
|
||||||
"WHERE eval_projects_entries.project_id = projects.id AND ".
|
|
||||||
"eval_projects_entries.judges_teams_id = judges_teams.id AND ".
|
|
||||||
"(judges_teams.num = '".$team_num."') AND ".
|
|
||||||
"(SUBSTR(projects.projectnumber, 2) = '".$Apperson_num."') ORDER BY eval_projects_entries.criteria_id";
|
|
||||||
$q = mysql_query($qstr) ;
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
if(!$q){
|
|
||||||
echo "q = FALSE!<br />";
|
|
||||||
}
|
|
||||||
echo "No Matching record for team number ".$team_num." and Apperson Project number ".$Apperson_num."<br />";
|
|
||||||
fclose($fh);
|
|
||||||
// delete the file
|
|
||||||
unlink($filename);
|
|
||||||
echo "<br />Need to keep trying Ask Dennis to fix <br /><a href=\"eval_import.php\"> Return </a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if (mysql_num_rows($q) == 6){ // 6 criteria for each judgeteam-project is required to upload Apperson data
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$project_num = $r->projectnumber;
|
|
||||||
$record_id = $r->id;
|
|
||||||
switch ($r->criteria_id)
|
|
||||||
{
|
|
||||||
case 1: //Creative Ability
|
|
||||||
//echo " update CAS 1= ".$data[2 ];
|
|
||||||
mysql_query("UPDATE eval_projects_entries SET level_id = '".$data[2]."' WHERE id = '".$record_id."'");
|
|
||||||
break;
|
|
||||||
case 2: // Scientific Thought
|
|
||||||
//echo " update STS 2= ".$data[3 ];
|
|
||||||
mysql_query("UPDATE eval_projects_entries SET level_id = '".$data[3]."' WHERE id = '".$record_id."'");
|
|
||||||
break;
|
|
||||||
case 3: // Thouroughness
|
|
||||||
//echo " update THS 3= ".$data[4 ];
|
|
||||||
mysql_query("UPDATE eval_projects_entries SET level_id = '".$data[4]."' WHERE id = '".$record_id."'");
|
|
||||||
break;
|
|
||||||
case 4 : // Skill
|
|
||||||
//echo " update SKS 4= ".$data[5 ];
|
|
||||||
mysql_query("UPDATE eval_projects_entries SET level_id = '".$data[5]."' WHERE id = '".$record_id."'");
|
|
||||||
break;
|
|
||||||
case 5: //Clairity
|
|
||||||
//echo " update CLS 5= ".$data[6 ];
|
|
||||||
mysql_query("UPDATE eval_projects_entries SET level_id = '".$data[6]."' WHERE id = '".$record_id."'");
|
|
||||||
break;
|
|
||||||
case 6: //Teamwork
|
|
||||||
//echo " update TWS 6= ".$data[7 ];
|
|
||||||
mysql_query("UPDATE eval_projects_entries SET level_id = '".$data[7]."' WHERE id = '".$record_id."'");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // while
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Evaluations table eval_projects_entries is Not setup for Apperson Data Import.<br />There are not exactly 6 criteria for judgeteam ".$team_num." project number ".$project_num."<br />";
|
|
||||||
fclose($fh);
|
|
||||||
// delete the file
|
|
||||||
unlink($filename);
|
|
||||||
echo "<br /><br /><a href=\"eval_import.php\"> Return </a><br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose($fh);
|
|
||||||
// delete the file
|
|
||||||
unlink($filename);
|
|
||||||
echo $row." records entered in database<br />";
|
|
||||||
//echo "<br /><br />File deleted<br>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "Invalid file";
|
|
||||||
}
|
|
||||||
echo "<br /><br /><a href=\"eval_import.php\"> Return </a><br />";
|
|
||||||
?>
|
|
@ -1,342 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<title>SFIAB Evaluations Entry</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
echo "<h2>Judges' Project Evaluations</h2><br /><br />";
|
|
||||||
|
|
||||||
/*
|
|
||||||
This is an evaluation form(s) for a team. Here the team can evaluate each project assigned to the team.
|
|
||||||
* First input the team number
|
|
||||||
* Verify one of the team members is signed in and accessing this page (TBD)
|
|
||||||
* Fill in a drop down with project numbers and project titles (TBD for now just a list and manual input)
|
|
||||||
* Select a project number from the drop down box. (TBD)
|
|
||||||
* Create the evaluation form - pre fill with any current evaluation entries.
|
|
||||||
* Enter the evaluation (button)
|
|
||||||
* Select another project
|
|
||||||
* continue untill...
|
|
||||||
* Exit the page
|
|
||||||
*/
|
|
||||||
$newteam = false;
|
|
||||||
if($_POST['enter']=="evals") { // come here if have an evaluation entry for a given team and project
|
|
||||||
// get the values saved in the form.
|
|
||||||
$oktoupdate = true; // RFU
|
|
||||||
$project_id = $_POST['project_id']; // save in form
|
|
||||||
$project_num = $_POST['project_num']; // saved in form
|
|
||||||
$team_num = $_POST['team_num']; // saved in form
|
|
||||||
$judges_team_name = $_POST['team_name'];
|
|
||||||
$judges_teams_id = $_POST['team_id'];
|
|
||||||
if ($oktoupdate){
|
|
||||||
/*
|
|
||||||
* for each possible critera for the project see if it was entered (will not be a POST entry if slection was made for the post)
|
|
||||||
* the posts have names CR_nnn where nnn is the criteria number. The values are the 'selected' level_id (stored in evals_projects_entries)
|
|
||||||
* if a selection, save it in the database if not set a flag not complete.
|
|
||||||
* return to the form
|
|
||||||
*/
|
|
||||||
$q = mysql_query("SELECT * FROM eval_projects WHERE project_id = '".$project_id."' ");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
// what to do here? Should not happen
|
|
||||||
}
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$scheme_id = $r->scheme_id;
|
|
||||||
}
|
|
||||||
$q = mysql_query("SELECT * FROM eval_criteria WHERE scheme_id = '".$scheme_id."' ");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
// what to do here? Should not happen
|
|
||||||
}
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
// skip those that have criteria weight == 0 (compatibility with Apperson Scanner export/import)
|
|
||||||
if ($r->criteria_weight > 0){
|
|
||||||
$criteria_id = $r->criteria_id;
|
|
||||||
$postname= "CR_".$criteria_id;
|
|
||||||
if ($_POST[$postname]){
|
|
||||||
$value_id = $_POST[$postname];
|
|
||||||
// now save this one in the database
|
|
||||||
$status = mysql_query("UPDATE eval_projects_entries SET level_id = '".$value_id."' WHERE judges_teams_id = '".$judges_teams_id."' AND project_id = '".$project_id."' AND criteria_id = '".$criteria_id."' " );
|
|
||||||
// should work but need check if $status == false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($_POST['enter']=="project_team" || $_POST['selection'] == "team_num") {
|
|
||||||
// Changed the project number and or team number
|
|
||||||
$team_num = $_POST['team_num'];
|
|
||||||
if ($_POST['prev_team_num'] != $team_num){
|
|
||||||
$newteam = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($team_num == 0)
|
|
||||||
{
|
|
||||||
echo "<form method=\"post\" action=\"eval_webentry.php\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"selection\" value=\"team_num\" />";
|
|
||||||
echo "<table>";
|
|
||||||
echo "<tr><td>Team Number</td><td><input size=\"5\" type=\"text\" name=\"team_num\" value=\"$team_num\"></td><td><input type=\"submit\" value=\"Enter Team Number\"></td></tr>";
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
echo "</body></html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// have a team number if get here next gets the selected project from the drop down list
|
|
||||||
if($_POST['project']){
|
|
||||||
$project_num = $_POST['project'];
|
|
||||||
}
|
|
||||||
if ($newteam) {
|
|
||||||
$project_num = 0;
|
|
||||||
}
|
|
||||||
//echo "<br /> Have team number data: Number: ".$team_num." Id=",$judges_teams_id." name=".$judges_team_name."<br />";
|
|
||||||
echo "<form id='form1' name='form1' method=\"post\" action=\"eval_webentry.php\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"enter\" value=\"project_team\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"team_id\" value=\"$judges_teams_id\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"team_name\" value=\"$judges_team_name\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"prev_team_num\" value=\"$team_num\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"prev_project_num\" value=\"$project_num\" />";
|
|
||||||
echo "<table>";
|
|
||||||
echo "<tr><td>Team Number</td><td><input size=\"5\" type=\"text\" name=\"team_num\" value=\"$team_num\"></td></tr>";
|
|
||||||
//echo "<tr><td>Project Number</td><td><input size=\"5\" type=\"text\" name=\"project_num\" value=\"$project_num\"></td><td><input type=\"submit\" value=\"Enter Project Number\"></td></tr>";
|
|
||||||
echo "</table>";
|
|
||||||
$qstr_prjs = "SELECT judges_teams_timeslots_projects_link.`year`, judges_teams_timeslots_projects_link.judges_teams_id, judges_teams.num, ".
|
|
||||||
"judges_teams.name, projects.projectnumber, projects.floornumber, projects.title, projects.shorttitle, projects.`language` ".
|
|
||||||
"FROM judges_teams, judges_teams_timeslots_projects_link, projects ".
|
|
||||||
"WHERE judges_teams.id = judges_teams_timeslots_projects_link.judges_teams_id ".
|
|
||||||
"AND judges_teams_timeslots_projects_link.projects_id = projects.id ".
|
|
||||||
"AND judges_teams.num = '$team_num' ";
|
|
||||||
$qprjs=mysql_query($qstr_prjs);
|
|
||||||
if ($qprjs) {
|
|
||||||
$num_projects = mysql_num_rows($qprjs);
|
|
||||||
if ($num_projects > 0 ){
|
|
||||||
$cnt = 0;
|
|
||||||
//echo "<form>";
|
|
||||||
echo "<select name=\"project\"><br />";
|
|
||||||
|
|
||||||
while($rprjs=mysql_fetch_object($qprjs)) {
|
|
||||||
if($cnt == 0 ){
|
|
||||||
$judges_teams_id = $rprjs->judges_teams_id;
|
|
||||||
$judges_team_name = $rprjs->name;
|
|
||||||
$cnt = 1;
|
|
||||||
}
|
|
||||||
// fill in the dropdownbox
|
|
||||||
echo "<option value = \"".$rprjs->projectnumber."\" ";
|
|
||||||
if ($project_num == $rprjs->projectnumber) {
|
|
||||||
echo "selected=\"yes\"";
|
|
||||||
}
|
|
||||||
echo ">".$rprjs->projectnumber.": ".$rprjs->title."</option>";
|
|
||||||
//echo "<br />project number ".$rprjs->projectnumber." ".$rprjs->title."floor number=".$rprjs->floornumber;
|
|
||||||
}
|
|
||||||
echo "</select>";
|
|
||||||
echo " <input type=\"submit\" value=\"Select Project or Change Team\"><br />";
|
|
||||||
echo "</form>";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// no projects assigned or incorrect team number.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($project_num == 0 ) { // if first selection of team number or if changed the team number.
|
|
||||||
echo "</body></html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// have team id and project number
|
|
||||||
$q = mysql_query("SELECT * FROM projects WHERE projectnumber = '".$project_num."' ");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "<br /><b>No such project number! Start over:</b><br />";
|
|
||||||
$project_num = 0;
|
|
||||||
echo "<form method=\"post\" action=\"eval_webentry.php\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"selection\" value=\"team_num\" />";
|
|
||||||
echo "<table>";
|
|
||||||
echo "<tr><td>Team Number</td><td><input size=\"5\" type=\"text\" name=\"team_num\" value=\"$team_num\"></td><td><input type=\"submit\" value=\"Enter Team Number\"></td></tr>";
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
echo "</body></html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$r=mysql_fetch_object($q);
|
|
||||||
$project_id = $r->id;
|
|
||||||
// double check this project is assigned to this team
|
|
||||||
$q = mysql_query("SELECT * FROM judges_teams_timeslots_projects_link WHERE projects_id = '".$project_id."' AND judges_teams_id = '".$judges_teams_id."'");
|
|
||||||
if (!$q OR mysql_num_rows($q) == 0){
|
|
||||||
echo "<br /><b>Project NOT assigned to the selected team! Start over:</b><br />";
|
|
||||||
$project_num = 0;
|
|
||||||
echo "<form method=\"post\" action=\"eval_webentry.php\">";
|
|
||||||
echo "<input type=\"hidden\" name=\"selection\" value=\"team_num\" />";
|
|
||||||
echo "<table>";
|
|
||||||
echo "<tr><td>Team Number</td><td><input size=\"5\" type=\"text\" name=\"team_num\" value=\"$team_num\"></td><td><input type=\"submit\" value=\"Enter Team Number\"></td></tr>";
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
echo "</body></html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
// At this point we have all the data necessary to create the entry form
|
|
||||||
// Get project information for display
|
|
||||||
$qst = "SELECT projects.projectdivisions_id, projectdivisions.division, projectdivisions.division_shortform, projectcategories.category, ".
|
|
||||||
"projectcategories.category_shortform, projects.projectnumber, projects.floornumber, projects.title, projects.shorttitle, ".
|
|
||||||
"projects.`language`, eval_projects.scheme_id, eval_projects.team ".
|
|
||||||
"FROM projects, eval_projects, projectcategories, projectdivisions ".
|
|
||||||
"WHERE projects.id = eval_projects.project_id AND projects.projectcategories_id = projectcategories.id ".
|
|
||||||
"AND projects.projectdivisions_id = projectdivisions.id AND projects.id = '".$project_id."'";
|
|
||||||
$q=mysql_query($qst);
|
|
||||||
if ($q) {
|
|
||||||
while($r=mysql_fetch_object($q)) {
|
|
||||||
$ptitle = $r->title;
|
|
||||||
$pshort_title = $r->shorttitle;
|
|
||||||
$category = $r->category;
|
|
||||||
$division = $r->division;
|
|
||||||
$shortcategory = $r->category_shortform;
|
|
||||||
$division_shortform = $r->division_shortform;
|
|
||||||
$language = $r->language;
|
|
||||||
$scheme_id = $r->scheme_id;
|
|
||||||
$team = $r->team;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<br /><b>Current Evaluation is for:<br />";
|
|
||||||
echo " Team number: ".$team_num."<br />";
|
|
||||||
$IsTeam = "";
|
|
||||||
if ($team == "yes"){ $IsTeam = " (Team Project)";}
|
|
||||||
echo " Project number: ".$project_num ." Title: ".$ptitle.$IsTeam."</b><br />";
|
|
||||||
echo " Project Category: ".$category."<br />";
|
|
||||||
echo " Project Division: ".$division."<br />";
|
|
||||||
echo " Language: ".$language."<br />";
|
|
||||||
// this is for test only at this time. will be used in the Apperson Scanner export and import.
|
|
||||||
// to create the file necessary to preslug the score forms.
|
|
||||||
// Barcode = 1 or 2 for team, 4 digits exn, 4 digits team number, 2 digits checksum?
|
|
||||||
//$tempprnum = substr($project_num , 1);
|
|
||||||
//if ( strlen($tempprnum) < 4 )
|
|
||||||
// {
|
|
||||||
// $tempprnum = "0".$tempprnum;
|
|
||||||
// }
|
|
||||||
//echo "<br /> Scanner Project number: ".$tempprnum;
|
|
||||||
echo "<br />";
|
|
||||||
$errors = 0;
|
|
||||||
$criteria_row = 0;
|
|
||||||
// First find the longest string in criteria and level names so the table will look nice
|
|
||||||
$maxstrlen = 0;
|
|
||||||
$qcr=mysql_query("SELECT * FROM eval_criteria WHERE scheme_id = '$scheme_id' Order by 'criteria_id'");
|
|
||||||
if ($qcr) {
|
|
||||||
while($rcr=mysql_fetch_object($qcr)) {
|
|
||||||
if (strlen($rcr->criteria_name) > $maxstrlen) {
|
|
||||||
$maxstrlen = strlen($rcr->criteria_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$qlv=mysql_query("SELECT * FROM eval_levels WHERE scheme_id = $scheme_id ".
|
|
||||||
"AND spec_use = 'no' ORDER BY level_value DESC");
|
|
||||||
if ($qlv) {
|
|
||||||
while($rlv=mysql_fetch_object($qlv)){
|
|
||||||
if (strlen($rlv->level_name) > $maxstrlen) {
|
|
||||||
$maxstrlen = strlen($rlv->level_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<form id='form2' name='form2' method='post' action='eval_webentry.php' >";
|
|
||||||
// Build the table **************************************************************
|
|
||||||
echo "<table style='width:67%%; font-family: 'Courier New', Courier, monospace;' border='1' align='left'>";
|
|
||||||
// build the top row criteria labels. If a criteria weight == 0 do not put in form (for compatibilbity with Apperson Scanners)
|
|
||||||
$qcr=mysql_query("SELECT * FROM eval_criteria WHERE scheme_id = '$scheme_id' Order by 'criteria_id'");
|
|
||||||
echo "<tr>";
|
|
||||||
if ($qcr) {
|
|
||||||
$total_crits = mysql_num_rows($qcr); // used to check if all criteria have a selection
|
|
||||||
$count_crits = 0;
|
|
||||||
while($rcr=mysql_fetch_object($qcr)) {
|
|
||||||
if ($rcr->criteria_weight > 0){
|
|
||||||
$nam = $rcr->criteria_name;
|
|
||||||
if (strlen($nam) < $maxstrlen){
|
|
||||||
$addn = $maxstrlen - strlen($nam) + 5;
|
|
||||||
for ( $icnt = 1; $icnt <= $addn; $icnt += 1) {
|
|
||||||
$nam = $nam." ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "<td>".$nam."</td>";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$total_crits -= 1; // reduce the number of needed criteria marks for each criteria wiht weight = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</tr>";
|
|
||||||
// Now add the row with the levels to select as a radio button list *********************
|
|
||||||
// ** important to order the same as above query ***
|
|
||||||
$qcr=mysql_query("SELECT * FROM eval_criteria WHERE scheme_id = '$scheme_id' Order by 'criteria_id'");
|
|
||||||
echo "<tr>";
|
|
||||||
if ($qcr) {
|
|
||||||
while($rcr=mysql_fetch_object($qcr)) {
|
|
||||||
// for each, add a colunm with the input list
|
|
||||||
// except.. if the criteria weight is 0 then do not add to the form (Special case for compatibility with Export / Apperson scanners)
|
|
||||||
if ($rcr->criteria_weight > 0){
|
|
||||||
echo "<td>";
|
|
||||||
$qlv=mysql_query("SELECT * FROM eval_levels WHERE scheme_id = $scheme_id ".
|
|
||||||
"AND spec_use = 'no' ORDER BY level_value DESC");
|
|
||||||
if ($qlv) {
|
|
||||||
while($rlv=mysql_fetch_object($qlv)){
|
|
||||||
// see if this level for this criteria is already set in the tables
|
|
||||||
$qset=mysql_query("SELECT * FROM eval_projects_entries WHERE judges_teams_id = '".$judges_teams_id."' AND project_id = '".$project_id."' AND criteria_id ='".$rcr->criteria_id."'");
|
|
||||||
if($qset){
|
|
||||||
while($rset=mysql_fetch_object($qset)){ // should only be one record for this criteria
|
|
||||||
if ($rset->level_id == $rlv->level_id){
|
|
||||||
$rbsel = "checked";
|
|
||||||
$count_crits += 1;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$rbsel = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$nam = $rlv->level_name;
|
|
||||||
echo "<input type='radio' name='CR_".$rcr->criteria_id."' id='CR_".$rcr->criteria_id."_".$rlv->level_id."' value='".$rlv->level_id."' ".$rbsel." /> ".$nam."<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</td>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</tr><tr <td colspan='".$total_crits."' >";
|
|
||||||
echo "<input type=\"hidden\" name=\"team_num\" value=\"$team_num\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"project_num\" value=\"$project_num\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"project_id\" value=\"$project_id\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"team_name\" value=\"$judges_team_name\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"team_id\" value=\"$judges_teams_id\" />";
|
|
||||||
echo "<input type=\"hidden\" name=\"enter\" value=\"evals\" />";
|
|
||||||
if ( $total_crits == $count_crits ){
|
|
||||||
echo "Complete! Enter changes or select another project.";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo "EVALUATION NOT COMPLETE!";
|
|
||||||
}
|
|
||||||
echo "<br /><input type=\"submit\" value=\"Enter Evaluations\" />";
|
|
||||||
echo "</td></tr>";
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
echo "<br />";
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,39 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to the 'Science Fair In A Box' project
|
|
||||||
SFIAB Website: http://www.sfiab.ca
|
|
||||||
|
|
||||||
Copyright (C) 2011 At Work Software (dennis@spanogle.net>
|
|
||||||
Copyright (C) 2011 Dennis Spanogle <dennis@spanogle.net>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
|
|
||||||
<head><title>SFIAB Evaluations Main Page</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
// include "../../common.inc.php"; // does not work from this directory.
|
|
||||||
// Just the functions and checks in SFIAB common.inc.php required for Evaluations plug-in are duplicated here (copied 03/2011 from SFIAB 'common.inc.php'
|
|
||||||
include "sfiab_common.inc.php"; // check SFIAB install and get config etc.
|
|
||||||
include "eval_common.inc.php"; // check Evaluations setup and get eval_config
|
|
||||||
include "eval_menu_inc.php";
|
|
||||||
|
|
||||||
?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,115 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
This file is a plug-in to 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.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
if(substr(getcwd(),-6)=="/db" || substr(getcwd(),-3)=="\\db")
|
|
||||||
$prependdir="../";
|
|
||||||
//else if(substr(getcwd(),-6)=="/super" || substr(getcwd(),-6)=="\\super")
|
|
||||||
// $prependdir="../";
|
|
||||||
//else if(substr(getcwd(),-7)=="/config" || substr(getcwd(),-7)=="\\config")
|
|
||||||
// $prependdir="../";
|
|
||||||
//else if(substr(getcwd(),-3)=="/db" || substr(getcwd(),-3)=="\\db")
|
|
||||||
// $prependdir="../";
|
|
||||||
//else if(substr(getcwd(),-8)=="/scripts" || substr(getcwd(),-8)=="\\scripts")
|
|
||||||
// $prependdir="../";
|
|
||||||
else
|
|
||||||
$prependdir="";
|
|
||||||
//Plug-in: should rely on SFIAB to open the database. uses the same DBHOST,DBUSER,DBPASS
|
|
||||||
// Just to make sure.. and for debug we will need the DBHOST, DBUSER,DBPASS
|
|
||||||
|
|
||||||
if (!$DBUSER)
|
|
||||||
{
|
|
||||||
//echo "Checking SFIAB config <br />";
|
|
||||||
if(file_exists($prependdir."../../data/config.inc.php"))
|
|
||||||
{
|
|
||||||
require_once($prependdir."../../data/config.inc.php");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "SFIAB is not setup. Do that prior to starting plug-ins<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$DBUSER=substr($DBUSER,0,16);
|
|
||||||
if(!mysql_connect($DBHOST,$DBUSER,$DBPASS))
|
|
||||||
{
|
|
||||||
echo "<html><head><title>SFIAB ERROR</title></head><body>";
|
|
||||||
echo "<h1>Science Fair In A Box - ERROR</h1>";
|
|
||||||
echo "Cannot connect to database!";
|
|
||||||
echo "</body></html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if(!mysql_select_db($DBNAME))
|
|
||||||
{
|
|
||||||
echo "<html><head><title>SFIAB ERROR</title></head><body>";
|
|
||||||
echo "<h1>Science Fair In A Box - ERROR</h1>";
|
|
||||||
echo "Cannot select database!";
|
|
||||||
echo "</body></html>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//find out the fair year and any other 'year=0' configuration parameters (things that dont change as the years go on)
|
|
||||||
$q=@mysql_query("SELECT * FROM config WHERE year='0'");
|
|
||||||
|
|
||||||
//we might get an error if installation step 2 is not done (ie, the config table doesnt even exist)
|
|
||||||
if(mysql_error())
|
|
||||||
{
|
|
||||||
echo "SFIAB installation is not complete. Plug-ins require a complete installation!";
|
|
||||||
echo "<br>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
//if we have 0 (<1) then install2 is not done, which would get caught above,
|
|
||||||
//if we have 1 (<2) then insatll3 is not done (no entries for FAIRYEAR and SFIABDIRECTORY)
|
|
||||||
if(mysql_num_rows($q)<2)
|
|
||||||
{
|
|
||||||
echo "SFIAB installation is not complete. Plug-ins require a complete installation!";
|
|
||||||
echo "<br>";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!config)
|
|
||||||
{
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
$config[$r->var]=$r->val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//now pull the rest of the configuration
|
|
||||||
$q=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."'");
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
$config[$r->var]=$r->val;
|
|
||||||
}
|
|
||||||
|
|
||||||
//now pull the dates probably not required in plug-ins keep for now
|
|
||||||
$q=mysql_query("SELECT * FROM dates WHERE year='".$config['FAIRYEAR']."'");
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
$config['dates'][$r->name]=$r->date;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
@ -1 +0,0 @@
|
|||||||
1.0.0
|
|
Loading…
Reference in New Issue
Block a user