* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013 * @package queXS * @subpackage admin * @link http://www.acspri.org.au/software queXS was writen for ACSPRI * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * */ /** * Configuration file */ include_once(dirname(__FILE__).'/../config.inc.php'); /** * Database */ include_once(dirname(__FILE__).'/../db.inc.php'); /** * XHTML functions */ include_once(dirname(__FILE__).'/../functions/functions.xhtml.php'); if (isset($_POST['submitr'])) { $sample_import_id = intval($_POST['sample_import_id']); $sql = "UPDATE sample_import SET description = " . $db->qstr($_POST['description']) . " WHERE sample_import_id = $sample_import_id"; $db->Execute($sql); $_GET['rename'] = $sample_import_id; } if (isset($_POST['submit'])) { $sample_import_id = intval($_POST['sample_import_id']); unset($_POST['submit']); unset($_POST['sample_import_id']); foreach($_POST as $p) { $sql = "DELETE FROM sample_var WHERE var LIKE " . $db->qstr($p) . " AND sample_id IN (SELECT sample_id FROM sample WHERE import_id = $sample_import_id)"; $db->Execute($sql); } $_GET['edit'] = $sample_import_id; } if (isset($_POST['submitvp'])) { $sample_import_id = intval($_POST['sample_import_id']); unset($_POST['submitvp']); unset($_POST['sample_import_id']); $db->StartTrans(); $sql = "UPDATE sample_import_var_restrict SET `restrict` = 1 WHERE sample_import_id = $sample_import_id"; $db->Execute($sql); foreach($_POST as $p => $val) { $sql = "UPDATE sample_import_var_restrict SET `restrict` = 0 WHERE sample_import_id = $sample_import_id AND `var` LIKE " . $db->qstr($p); $db->Execute($sql); } $db->CompleteTrans(); $_GET['view'] = $sample_import_id; } if (isset($_GET['rename'])) { xhtml_head(T_("Rename"),true,array("../css/table.css")); $sample_import_id = intval($_GET['rename']); $sql = "SELECT description FROM sample_import WHERE sample_import_id = $sample_import_id"; $rs = $db->GetOne($sql); print "

" . T_("Rename") . ": " . $rs. "

"; echo "

" . T_("Go back") . "

"; ?>
"/>
GetOne($sql); $sql = "SELECT si.description, sv.val, sv.var, CONCAT('') as box, sir.restrict IS NULL as existss FROM sample_import as si JOIN `sample` as s ON (s.import_id = si.sample_import_id AND s.sample_id = $sample_id) JOIN sample_var as sv ON (sv.sample_id = s.sample_id) LEFT JOIN sample_import_var_restrict as sir ON (sir.sample_import_id = si.sample_import_id AND sir.var = sv.var) WHERE si.sample_import_id = $sample_import_id"; $rs = $db->GetAll($sql); //if not in restrict table, then insert foreach($rs as $r) { if ($r['existss'] == 1) { $sql = "INSERT INTO sample_import_var_restrict (sample_import_id,var,`restrict`) VALUES ($sample_import_id,'{$r['var']}',0)"; $db->Execute($sql); } } print "

" . T_("Operator viewing permissions") . ": " . $rs[0]['description'] . "

"; echo "

" . T_("Go back") . "

"; print "

" . T_("Select which fields from this sample should be able to be viewed by operators") . "

"; ?>
"/>
') as box FROM sample_import as si, sample_var as sv, sample as s WHERE si.sample_import_id = $sample_import_id AND sv.sample_id = s.sample_id AND s.import_id = si.sample_import_id GROUP BY sv.var"; $rs = $db->GetAll($sql); print "

" . T_("Deidentify") . ": " . $rs[0]['description'] . "

"; echo "

" . T_("Go back") . "

"; print "

" . T_("Select which fields from this sample to deidentify. Deidentified fields will be permanently deleted from the sample.") . "

"; ?>
"/>
Execute($sql); } if (isset($_GET['sampleenable'])) { $id = intval($_GET['sampleenable']); $sql = "UPDATE sample_import SET enabled = 1 WHERE sample_import_id = '$id'"; $db->Execute($sql); } $sql = "SELECT CASE WHEN enabled = 0 THEN CONCAT('" . TQ_("Enable") . "') ELSE CONCAT('" . TQ_("Disable") . "') END as enabledisable, CONCAT('" . TQ_("Deidentify") . "') as did, CONCAT('" . TQ_("Operator viewing permissions") . "') as vp, CONCAT('" . TQ_("Rename") . "') as rname, description FROM sample_import"; $rs = $db->GetAll($sql); xhtml_head(T_("Sample list"),true,array("../css/table.css")); $columns = array("description","enabledisable","did","vp","rname"); $titles = array(T_("Sample"),T_("Enable/Disable"),T_("Deidentify"),T_("Operator viewing permissions"),T_("Rename")); xhtml_table($rs,$columns,$titles); xhtml_foot(); ?>