", T_("Attention!! It's not recommended to delete string '$key'. Please BE Careful and check again strings to delete."), "
";
+ }
+ /* else { echo "
", T_("You can delete string '$key'. "), "
"; } */
+ }
+ //echo "
del ->>"; foreach($_POST['del'] as $key => $val) { echo ' | ', $key,' => ',$val,' | '; }; print "
";
}
+
+ if (isset($_POST['type'])){
+
+ //check that we have correct var types and quantity
+ $prph = 0; $pcd = 0; $st = 0; $fn = 0; $eml =0;
+ foreach($_POST['type'] as $key => $val) {
+ if ($val == 3) $prph++;
+ else if ($val == 5) $pcd++;
+ else if ($val == 4) $st++;
+ else if ($val == 6) $fn++;
+ else if ($val == 7) $ln++;
+ else if ($val == 8) $eml++;
+ }
+ /* if($prph == 1) {$ch1 = true;}
+
+
+
+
+
+
+
+
+
+
+ if ($ch1 && $ch2 && $ch3 && $ch4) */$typecheck = true; //echo $ch1,$ch2,$ch3,$ch4, "typecheck=",$typecheck, "" ;
+
+ if ($typecheck){
+
+ foreach($_POST['type'] as $p => $val)
+ {
+ $sql = "UPDATE sample_import_var_restrict
+ SET `type` = $val
+ WHERE `var_id` = $p";
+ $db->Execute($sql);
+ }
+
+ if (isset($_POST['del'])) {
+ $db->StartTrans();
+
+ foreach($_POST["del"] as $p) {
+ $sql = "DELETE FROM `sample_import_var_restrict`
+ WHERE var_id = $p";
+ $db->Execute($sql);
+ echo "
", T_(" String $p DELETED"), "
";
+
+ $sql = "DELETE FROM `sample_var`
+ WHERE var_id = $p
+ AND sample_id IN (SELECT sample_id FROM `sample` WHERE import_id = $sample_import_id)";
+ $db->Execute($sql);
+ echo "
", T_(" Sample_Var data for variable $p DELETED from this sample"), "
" . T_("Select which fields from this sample to deidentify. Deidentified fields will be permanently deleted from the sample.") . "
";
+
?>
-
-
" . T_("Select which fields from this sample to deidentify.
Deidentified fields will be permanently deleted from the sample.") . "";
}
else
{
- print "
" . T_("There's no data in this sample. Probably was deidentified earlier.") . "
";
+ print "
" . T_("There's no data in this sample. Probably was deidentified earlier.") . "
";
+
+ /*check `Time_zone_name` and `phone` values for deidentified records*/
+ $sql = "SELECT `sample`.sample_id FROM `sample`
+ LEFT JOIN `sample_var` ON (`sample`.sample_id = `sample_var`.sample_id)
+ WHERE `sample_var`.sample_id IS NULL
+ AND `sample`.import_id = $sample_import_id
+ AND (`sample`.Time_zone_name !='' || `sample`.phone !='')";
+ $rs = $db->GetAll($sql);
+
+ if (!empty($rs)) {
+ $num = count($rs);
+ print "
" . T_("There're still $num records for `Time_zone_name` and `phone` values for deidentified records") . "
";
+
+ print "
";
+ }
+
}
- xhtml_foot();
+
+ unset ($rs);
+
+ /*check if there's sample_var data not matching sample_import_var_restrict.var_id */
+ $sql = "SELECT `sv`.var_id, `sv`.var, `sv`.type FROM `sample_var` as sv
+ LEFT JOIN `sample_import_var_restrict` as sivr ON (`sivr`.var_id = `sv`.var_id)
+ WHERE `sivr`.var_id IS NULL
+ AND `sv`.sample_id IN (SELECT sample_id FROM `sample` WHERE import_id = $sample_import_id)
+ GROUP BY `sv`.var_id";
+
+ $rs = $db->GetAll($sql);
+ if (!empty($rs)) {
+ $count = count($rs);
+ //print_r($rs);
+ print "
" . T_("Fix this sample ") . "
";
+ print "
" . $count . " var id's not match
";
+
+/* print ""; */
+ print "
";
+
+ /* if (isset($_POST['restore___'])){
+ $sql = "INSERT INTO sample_import_var_restrict
+ (`sample_import_id`,`var_id`,`var`,`type`,`restrict`)
+ VALUES ($sample_import_id,' ',' ',' ',1)";
+
+ $db->Execute($sql);
+ unset($_POST['restore___']);
+ }
+ if (isset($_POST['delvarf___'])){
+ $sql = "";
+
+ $db->Execute($sql);
+ unset($_POST['delvarf___']);
+ } */
+
+ unset($rs);
+ }
+
+ if (isset($_POST['dtzph'])){
+
+ /*delete `Time_zone_name` and `phone` values for deidentified records*/
+ $db->StartTrans();
+
+ $sql = "UPDATE `sample`
+ LEFT JOIN `sample_var` ON (`sample`.sample_id = `sample_var`.sample_id)
+ SET `Time_zone_name`='',`phone`=''
+ WHERE `sample_var`.sample_id IS NULL
+ AND `sample`.import_id = $sample_import_id";
+ $db->Execute($sql);
+
+ unset($_POST['dtzph']);
+
+ $db->CompleteTrans();
+ }
+
+ xhtml_foot($js_foot);
exit();
}
@@ -281,17 +472,22 @@ $sql = "SELECT
END
as enabledisable,
CASE WHEN enabled = 1 THEN
- CONCAT('')
+ CONCAT('')
ELSE
- CONCAT('')
+ CONCAT(' + + ')
END as did,
- CONCAT('') as vp,
- CONCAT('') as rname,
+ CASE WHEN enabled = 1 THEN
+ CONCAT('')
+ ELSE
+ CONCAT('')
+ END as delsample,
CONCAT('') as ssearch,
CONCAT('') as calls,
- CONCAT('
',description,'
') as description
- FROM sample_import";
-$rs = $db->GetAll($sql);
+ CONCAT('
',description,'
') as description,
+ CONCAT('
',(SELECT COUNT( DISTINCT`sample_var`.sample_id) FROM `sample_var`, `sample` WHERE `sample`.sample_id = `sample_var`.sample_id AND `sample`.import_id = sample_import_id ),'
') as cnt
+ FROM sample_import ORDER BY sample_import_id DESC";
+
+ $rs = $db->GetAll($sql);
$subtitle=T_("Sample list");
xhtml_head(T_("Sample management"),true,$css,$js_head,false,false,false,$subtitle);
@@ -299,12 +495,12 @@ echo "