* @copyright Deakin University 2007,2008 * @package queXS * @subpackage admin * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * */ /** * Configuration file */ include ("../config.inc.php"); /** * Database file */ include ("../db.inc.php"); /** * XHTML functions */ include ("../functions/functions.xhtml.php"); /** * Determine if an operator has been assigned to a skill (outcome_type) * * @param int $operator_id Operator id * @param int $outcome_type_id Outcome type id (skill) * @return int 1 if assigned to that skill otherwise 0 * */ function vq($operator_id,$outcome_type_id) { global $db; $sql = "SELECT operator_id,outcome_type_id FROM operator_skill WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'"; $vq = $db->Execute($sql); if ($vq) return $vq->RecordCount(); else return 0; } /** * Assign an operator to a skill (outcome_type) * * @param int $operator_id Operator id * @param int $outcome_type_id Outcome type id (skill) * */ function vqi($operator_id,$outcome_type_id) { global $db; $sql = "INSERT INTO operator_skill (operator_id,outcome_type_id) VALUES('$operator_id','$outcome_type_id')"; $db->Execute($sql); } /** * Delete a skill (outcome_type) from an operator * * @param int $operator_id Operator id * @param int $outcome_type_id Outcome type id (skill) * */ function vqd($operator_id,$outcome_type_id) { global $db; $sql = "DELETE FROM operator_skill WHERE operator_id = '$operator_id' and outcome_type_id = '$outcome_type_id'"; $db->Execute($sql); } if (isset($_POST['submit'])) { $db->StartTrans(); $sql = "DELETE FROM operator_skill WHERE 1"; $db->Execute($sql); foreach ($_POST as $g => $v) { $a = explode("_",$g); if ($a[0] == "cb") vqi($a[2],$a[1]); } $db->CompleteTrans(); } $sql = "SELECT outcome_type_id,description FROM outcome_type ORDER by outcome_type_id ASC"; $outcome_types = $db->GetAll($sql); $sql = "SELECT operator_id,firstname as description FROM operator ORDER by operator_id ASC"; $operators = $db->GetAll($sql); xhtml_head(T_("Assign operators to Skills"),false,array("../css/table.css")); ?> "; print ""; foreach($outcome_types as $q) { print ""; } print ""; $ct = 1; foreach($operators as $v) { print ""; print ""; foreach($outcome_types as $q) { $checked = ""; if (vq($v['operator_id'],$q['outcome_type_id'])) $checked="checked=\"checked\""; print ""; } print ""; } print "
" . T_($q['description']) . "
{$v['description']}

"; xhtml_foot(); ?>