From 2f78104de51b802d5c9ec0fd9815301a887315c5 Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Thu, 27 Jan 2011 01:28:02 +0000 Subject: [PATCH] Added contactdetails tab (like respondent information) and CONTACT_DETAILS_TAB config directive to display it Added ability to expand/contract the header when not in use with HEADER_EXPANDER config directive and jQuery javascript code --- config.default.php | 10 +++ contactdetails.php | 162 +++++++++++++++++++++++++++++++++++++++++++++ index.php | 25 +++++-- js/headerexpand.js | 21 ++++++ 4 files changed, 212 insertions(+), 6 deletions(-) create mode 100644 contactdetails.php create mode 100644 js/headerexpand.js diff --git a/config.default.php b/config.default.php index 6f33c5cc..181eb2af 100644 --- a/config.default.php +++ b/config.default.php @@ -202,6 +202,16 @@ if (!defined('DEFAULT_TAB')) define('DEFAULT_TAB','casenotes'); */ if (!defined('DEFAULT_TAB_APPOINTMENT')) define('DEFAULT_TAB_APPOINTMENT','casenotes'); +/** + * Show the contact details tab? + */ +if (!defined('CONTACT_DETAILS_TAB')) define('CONTACT_DETAILS_TAB', false); + +/** + * Enable a header expander for the main page to shrink/expand when not in use? + */ +if (!defined('HEADER_EXPANDER')) define('HEADER_EXPANDER', false); + /** * Database configuration for queXS */ diff --git a/contactdetails.php b/contactdetails.php new file mode 100644 index 00000000..b2c748c4 --- /dev/null +++ b/contactdetails.php @@ -0,0 +1,162 @@ +StartTrans(); + +$operator_id = get_operator_id(); +$call_attempt_id = get_call_attempt($operator_id,false); +$case_id = get_case_id($operator_id); + +if (isset($_POST['submit'])) + add_respondent($case_id,$_POST['firstName'],$_POST['lastName'],$_POST['Time_zone_name']); + + +if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0) +{ +?> +
+ +
+
+
+ +" . T_("Case id:") . " $case_id"; + print "
" . T_("Respondent:"); + + if (isset($_GET['respondent_id']) && $_GET['respondent_id'] != 0) + { + $respondent_id = bigintval($_GET['respondent_id']); + + $sql = "UPDATE `call_attempt` + SET respondent_id = '$respondent_id' + WHERE call_attempt_id = '$call_attempt_id'"; + + $db->Execute($sql); + } + + /* List respondents + * + */ + + + $sql = "SELECT r.firstName, r.lastName, r.respondent_id,r.Time_zone_name,CASE WHEN c.respondent_id = r.respondent_id THEN 'selected=\'selected\'' ELSE '' END AS selected + FROM respondent AS r + LEFT JOIN call_attempt AS c ON ( c.call_attempt_id = '$call_attempt_id' ) + WHERE r.case_id = '$case_id'"; + + $rs = $db->GetAll($sql); + + + $timezone = ""; + print "
"; + + print "
$timezone
"; + + + + //display sample details + // use type = 1 to limit to non specific sample variables + $sql = "SELECT s.var,s.val + FROM sample_var as s + JOIN `case` as c on (c.case_id = '$case_id' and c.sample_id = s.sample_id) + WHERE s.type = 1"; + + $rs = $db->GetAll($sql); + + print "
"; + if (!empty($rs)) + { + xhtml_table($rs,array("var","val"),array(T_("Var"),T_("Value"))); + } + print "
"; + +} + +xhtml_foot(); + +$db->CompleteTrans(); +?> diff --git a/index.php b/index.php index d389d859..a5136b85 100644 --- a/index.php +++ b/index.php @@ -110,20 +110,23 @@ if (AUTO_LOGOUT_MINUTES !== false) $body = false; } +if (HEADER_EXPANDER) + $js[] = "js/headerexpand.js"; + xhtml_head(T_("queXS"), $body, array("css/index.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js); print $script; ?> -
+
-
+
-
+
-
+
-
+
-
+
@@ -167,6 +170,14 @@ xhtml_object($data,"main-content");
+ +
"> +

+
+
+ +
"> @@ -220,6 +231,8 @@ xhtml_object($data,"main-content");
+