Copyright (C) 2011 Dennis Spanogle 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. */ ?> Teams Evaluations Forms 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['selection']=="team_num") { // Get some necessary information: Team_id, All projects (create dropdown list of projects) $team_num = $_POST['team_num']; $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; while($rprjs=mysql_fetch_object($qprjs)) { if($cnt == 0 ){ $judges_teams_id = $rprjs->judges_teams_id; $judges_team_name = $rprjs->name; $cnt = 1; } // create an array / fill in the dropdownbox echo "
project number ".$rprjs->projectnumber." ".$rprjs->title."floor number=".$rprjs->floornumber; } } else{ // no projects assigned or incorrect team number. } } $project_num = ""; echo "
Enter one of the above listed project numbers
"; } if($_POST['selection']=="project_num") { // Create the evaluation form for this project - team combination $project_num = $_POST['project_num']; // just entered or changed $team_num = $_POST['team_num']; // saved in form $judges_team_name = $_POST['team_name']; $judges_teams_id = $_POST['team_id']; } if ($team_num == 0) { echo "
"; echo ""; echo ""; echo ""; echo "
Team Number
"; echo "
"; echo ""; exit; } // have a team number and a list if projects was presented. Get which project to work on. if($project_num == 0){ echo "
Have team number data: Number: ".$team_num." Id=",$judges_teams_id." name=".$judges_team_name."
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Team Number Reload form for new team!
Project Number
"; echo "
"; echo ""; 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 "
No such project number! Start over:
"; $project_num = 0; echo "
"; echo ""; echo ""; echo ""; echo "
Team Number
"; echo "
"; echo ""; 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 "
Project NOT assigned to the selected team! Start over:
"; $project_num = 0; echo "
"; echo ""; echo ""; echo ""; echo "
Team Number
"; echo "
"; echo ""; exit; } echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Team Number Reload form for new team!
Project Number"; echo " (for now, enter -1 to select a different judge team)
"; echo "
"; // Get project information for display //$qst = "SELECT projects.projectdivisions_id AS Expr1, projectdivisions.division, projectcategories.category, projects.title AS ptitle, ". // "projects.shorttitle AS pshorttitle, projectcategories.category_shortform, projectdivisions.division_shortform, projects.language ". // "FROM projects, projectcategories, projectdivisions ". // "WHERE projects.projectcategories_id = projectcategories.id AND projects.projectdivisions_id = projectdivisions.id ". // "AND projects.id = '".$project_id."'"; $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 "
Project Title: ".$ptitle.""; echo "
Project Category: ".$category; $IsTeam = ""; if ($team == "yes"){ $IsTeam = " (Team Project)";} echo "
Project Division: ".$division.$IsTeam; echo "
Language: ".$language; // 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 "
Scanner Project number: ".$tempprnum; echo ""; $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 "
"; // Build the table ************************************************************** echo ""; // 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 ""; 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 ""; } else{ $total_crits -= 1; // reduce the number of needed criteria marks for each criteria wiht weight = 0 } } } echo ""; // 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 ""; 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 ""; } } } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ( $total_crits == $count_crits ){ echo "Complete! Enter changes or select another project."; } else{ echo "EVALUATION NOT COMPLETE!"; } echo "
"; echo ""; echo "
".$nam."
"; $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 " ".$nam."
"; } } echo "
"; echo "
"; echo "
"; ?>