diff --git a/.bzrignore b/.bzrignore new file mode 100644 index 00000000..7b1ec8ca --- /dev/null +++ b/.bzrignore @@ -0,0 +1 @@ +no vars diff --git a/CHANGELOG b/CHANGELOG index 04513bc2..4bf45a47 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,45 @@ +queXS 1.13.0 - Changes since 1.12.0 + + + +Database updates: + +/* New outcomes */ + +INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(42, '3.13', 'Max call attempts reached', 0, 4, 0, 1, 0, 1, 0, 'UH'); +INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(43, '3.13', 'Max calls reached', 0, 4, 0, 1, 0, 1, 0, 'UH'); + + +/* Add var_id sample var identifier */ +ALTER TABLE `sample_import_var_restrict` DROP PRIMARY KEY, CHANGE var var CHAR(128); +ALTER TABLE `sample_import_var_restrict` ADD `var_id` BIGINT( 20 ) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT AFTER `sample_import_id`; +ALTER TABLE `sample_import_var_restrict` ADD `type` SMALLINT( 10 ) UNSIGNED NOT NULL AFTER `var`; + +ALTER TABLE `sample_var` ADD `var_id` BIGINT( 20 ) UNSIGNED NOT NULL AFTER `sample_id`; + +UPDATE `sample_var` as sv ,`sample`as s, `sample_import_var_restrict` as sivr SET sv.`var_id`=sivr.`var_id` WHERE sv.`var` LIKE sivr.`var` AND sv.`sample_id`=s.`sample_id` AND s.`import_id`=sivr.`sample_import_id`; + +UPDATE `sample_import_var_restrict` , +`sample_var` SET `sample_import_var_restrict`.`type` = `sample_var`.`type` WHERE `sample_import_var_restrict`.`var_id` = `sample_var`.`var_id`; + +ALTER TABLE `qsqr_sample` ADD `exclude_var_id` BIGINT( 20 ) NOT NULL AFTER `questionnaire_sample_quota_row_id`; + +UPDATE `qsqr_sample` as qsqr, `sample_import_var_restrict` as sivr, questionnaire_sample_quota_row as qq SET qsqr.exclude_var_id = sivr.var_id WHERE qq.questionnaire_sample_quota_row_id = qsqr.questionnaire_sample_quota_row_id AND qq.sample_import_id = sivr.sample_import_id and qsqr.exclude_var = sivr.var; + +ALTER TABLE `sample_var` DROP PRIMARY KEY; +ALTER TABLE `sample_var` DROP `var`; +ALTER TABLE `sample_var` DROP `type`; +ALTER TABLE `sample_var` ADD PRIMARY KEY (`sample_id`,`var_id`); + +/* OPTIONAL */ + +/* De-identify sample table completely where attempted previously */ +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; + +/* Delete de-identified sample columns */ +DELETE FROM `sample_import_var_restrict` WHERE `type` =0; + + queXS 1.12.0 - Changes since 1.11.1 New Feature: Complex row quotas (see: https://blueprints.launchpad.net/quexs/+spec/complexquota) - Thank you Marco for sponsoring this feature diff --git a/admin/addshift.php b/admin/addshift.php index 6b1d3060..ffed2451 100644 --- a/admin/addshift.php +++ b/admin/addshift.php @@ -137,14 +137,14 @@ if (isset($_POST['submit'])) } -xhtml_head(T_("Add shifts"),true,array("../css/shifts.css"),array("../js/window.js")); - +xhtml_head(T_("Shift management"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/clockpicker/dist/bootstrap-clockpicker.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/bootstrap/js/bootstrap.min.js","../include/clockpicker/dist/bootstrap-clockpicker.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js")); +//"../css/shifts.css", /** * Display warning if timezone data not installed * */ -$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t"; +$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM','UTC') as t"; $rs = $db->GetRow($sql); if (empty($rs) || !$rs || empty($rs['t'])) @@ -160,37 +160,37 @@ if (empty($rs) || !$rs || empty($rs['t'])) * @todo Use javascript to add shifts if necessarry outside the template */ -print "

" . T_("Add shifts in your Time Zone") . "

"; +print "

" . T_("Add shifts in your Time Zone") . "

"; -print "

" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "

"; +print "

" . T_("Shifts allow you to restrict appointments being made, and interviewers to working on a particlar project at defined times.") . "

"; -print "

" . T_("Select a questionnaire from the list below") . "

"; -display_questionnaire_chooser($questionnaire_id); +print "

" . T_("Select a questionnaire") . ":

"; +display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control"); +print "
"; if ($questionnaire_id != false) { - print "

" . T_("Select year") . ": "; + print "

" . T_("Select year") . ":  "; for ($i = $year - 1; $i < $year + 4; $i++) { if ($i == $year) - print "$i "; + print "$i"; else - print "$i "; + print " $i "; } - print "

"; + print "

"; - print "

" . T_("Select week of year") . ": "; + print "

" . T_("Select week") . ": "; for ($i = 1; $i <= 53; $i++) { if ($i == $woy) - print "$i "; + print "$i"; else - print "$i "; + print " $i "; } - print "

"; - + print "

"; $sql = "SELECT shift_id, dt, dta,start,end FROM ( @@ -232,10 +232,10 @@ if ($questionnaire_id != false) $daysofweek[$key]['description'] = $val['dtd'] . " " . $val['dto']; ?> -
- + +
"; + print " "; $count = 1; foreach($shifts as $shift) { @@ -253,21 +253,26 @@ if ($questionnaire_id != false) } print ""; + print ""; $count++; } ?> -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "" . T_("Use shift?") . "
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "" . T_("Use shift?") . "
"; display_chooser($daysofweek, $prefix . "dow_$shift_id", false, true, false, false, false, array("dt",$shift['dt'])); - print "
+
-

"/>

-

-

-

+ " class="btn btn-primary"/> + + +
"; xhtml_foot(); ?> + diff --git a/admin/assignsample.php b/admin/assignsample.php index 1369f11c..fc3798fe 100644 --- a/admin/assignsample.php +++ b/admin/assignsample.php @@ -55,9 +55,25 @@ include("../functions/functions.display.php"); */ include("../functions/functions.input.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", +"../js/window.js" + ); +$js_foot = array( +"../js/bootstrap-confirmation.js", +"../js/custom.js" + ); global $db; - if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max'])) { //need to add sample to questionnaire @@ -76,13 +92,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET[' VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')"; $db->Execute($sql); - } if (isset($_POST['edit'])) { //need to add sample to questionnaire - $questionnaire_id = bigintval($_POST['questionnaire_id']); $sid = bigintval($_POST['sample_import_id']); $cm = bigintval($_POST['call_max']); @@ -93,8 +107,6 @@ if (isset($_POST['edit'])) $an = 0; if (isset($_POST['allownew'])) $an = 1; - - $sql = "UPDATE questionnaire_sample SET call_max = '$cm', call_attempt_max = '$cam', @@ -105,7 +117,6 @@ if (isset($_POST['edit'])) AND sample_import_id = '$sid'"; $db->Execute($sql); - } @@ -117,7 +128,8 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) if (isset($_GET['edit'])) { - xhtml_head(T_("Assign Sample: Select sample to assign"),true,array("../css/table.css"),array("../js/window.js")); + $subtitle = T_("Edit assignment parameters"); + xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js") $sql = "SELECT si.description as description, qr.description as qdescription, @@ -134,31 +146,42 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) $qs = $db->GetRow($sql); - print "

" . T_("Edit sample details") . "

"; - print "

" . T_("Questionnaire") . ": " . $qs['qdescription'] . "

"; - print "

" . T_("Sample") . ": " . $qs['description'] . "

"; - - print "

" . T_("Go back") . "

"; + //print "

" . T_("Edit sample details") . "

"; + print "

 " . T_("Go back") . "

+

" . T_("Questionnaire") . ": " . $qs['qdescription'] . "

+

" . T_("Sample") . ": " . $qs['description'] . "

+
"; $allownew = $selected =""; if ($qs['random_select'] == 1) $selected = "checked=\"checked\""; if ($qs['allow_new'] == 1) $allownew = "checked=\"checked\""; - ?> -
-
-
-
- />
- />
+ + + +
+

+ +
+

+ +
+

+ +
data-toggle="toggle" data-size="small" data-on="" data-off="" data-width="85"/>
+

+ +
class="col-sm-1" data-toggle="toggle" data-size="small" data-on="" data-off="" data-width="85"/>



- "/>

-
+
+
+ + " . T_("Select a questionnaire from the list below") . ""; -display_questionnaire_chooser($questionnaire_id); - +print " " . T_("Go back") . ""; +print "

" . T_("Select a questionnaire") . ":

"; +display_questionnaire_chooser($questionnaire_id,false, "pull-left", "form-control"); if ($questionnaire_id != false) { - print "

" . T_("Samples selected for this questionnaire") . "

"; + + print "
+

". T_("Samples selected for this questionnaire") .":

"; $sql = "SELECT si.description as description, - CASE WHEN q.call_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_max END as call_max, - CASE WHEN q.call_attempt_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max, - CASE WHEN q.random_select = 0 THEN '" . TQ_("Sequential") . "' ELSE '". TQ_("Random") . "' END as random_select, - CASE WHEN q.answering_machine_messages = 0 THEN '" . TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages, - CASE WHEN q.allow_new = 0 THEN '" . TQ_("No") . "' ELSE '".TQ_("Yes")."' END as allow_new, - CONCAT('" . TQ_("Edit") ."') as edit, - CONCAT('" . TQ_("Click to unassign") ."') as unassign + CASE WHEN q.call_max = 0 THEN '". TQ_("Unlimited") ."' ELSE q.call_max END as call_max, + CASE WHEN q.call_attempt_max = 0 THEN '". TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max, + CASE WHEN q.random_select = 0 THEN '". TQ_("Sequential") ."' ELSE '". TQ_("Random") . "' END as random_select, + CASE WHEN q.answering_machine_messages = 0 THEN '". TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages, + CASE WHEN q.allow_new = 0 THEN '". TQ_("No") ."' ELSE '".TQ_("Yes")."' END as allow_new, + CONCAT('') as edit, + CONCAT('') as unassign FROM questionnaire_sample as q, sample_import as si WHERE q.sample_import_id = si.sample_import_id AND q.questionnaire_id = '$questionnaire_id'"; @@ -200,9 +225,9 @@ if ($questionnaire_id != false) $qs = $db->GetAll($sql); if (!empty($qs)) - xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample") )); + xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample"))); else - print "

" . T_("No samples selected for this questionnaire") . "

"; + print "

". T_("No samples selected for this questionnaire") ."

"; $sql = "SELECT si.sample_import_id,si.description FROM sample_import as si @@ -211,36 +236,47 @@ if ($questionnaire_id != false) AND si.enabled = 1"; $qs = $db->GetAll($sql); + print"
"; if (!empty($qs)) { - - - print "

" . T_("Add a sample to this questionnaire:") . "

"; + print "
"; + print "

" . T_("Add a sample to this questionnaire:") . "

"; ?> -
-


-
-
-
-
-
- - "/>

-
+
+ +


+ + +
+

+ + +
+

+ + +
+

+ + +
" data-off="" data-width="85"/>
+

+ + +
" data-off="" data-width="85"/>



+ + + +
+ +
+ diff --git a/admin/assigntimeslots.php b/admin/assigntimeslots.php new file mode 100644 index 00000000..1e92ec99 --- /dev/null +++ b/admin/assigntimeslots.php @@ -0,0 +1,313 @@ + + * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 + * @package queXS + * @subpackage admin + * @link http://www.acspri.org.au 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("../config.inc.php"); + +/** + * Database file + */ +include ("../db.inc.php"); + +/** + * XHTML functions + */ +include("../functions/functions.xhtml.php"); + +/** + * Display functions + */ +include("../functions/functions.display.php"); + +/** + * Input functions + */ +include("../functions/functions.input.php"); + +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +//"../include/font-awesome/css/font-awesome.css", +"../css/custom.css" + ); +$js_head = array( + ); +$js_foot = array( +"../js/window.js", +//"../js/custom.js" + ); + +global $db; + +//block availability +if (isset($_GET['questionnaire_id']) && isset($_GET['av_availability_group'])) +{ + //need to add availability_group to questionnaire + $questionnaire_id = bigintval($_GET['questionnaire_id']); + $availability_group = bigintval($_GET['av_availability_group']); + + $sql = "INSERT INTO questionnaire_availability(questionnaire_id,availability_group_id) + VALUES('$questionnaire_id','$availability_group')"; + $db->Execute($sql); +} + +if (isset($_GET['questionnaire_id']) && isset($_GET['av_ravailability_group'])) +{ + //need to remove rsid from questionnaire + $questionnaire_id = bigintval($_GET['questionnaire_id']); + $availability_group = bigintval($_GET['av_ravailability_group']); + + $sql = "DELETE FROM questionnaire_availability + WHERE questionnaire_id = '$questionnaire_id' + AND availability_group_id = '$availability_group'"; + $db->Execute($sql); +} + +//block call_attempts +if (isset($_GET['questionnaire_id']) && isset($_GET['ca_availability_group'])) +{ + //need to add availability_group to questionnaire + $questionnaire_id = bigintval($_GET['questionnaire_id']); + $availability_group = bigintval($_GET['ca_availability_group']); + + $sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id) + VALUES('$questionnaire_id','$availability_group')"; + $db->Execute($sql); +} + +if (isset($_GET['questionnaire_id']) && isset($_GET['ca_ravailability_group'])) +{ + //need to remove rsid from questionnaire + $questionnaire_id = bigintval($_GET['questionnaire_id']); + $availability_group = bigintval($_GET['ca_ravailability_group']); + + $sql = "DELETE FROM questionnaire_timeslot + WHERE questionnaire_id = '$questionnaire_id' + AND availability_group_id = '$availability_group'"; + $db->Execute($sql); +} + + +//block call_attempts by sample +if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_availability_group'])) +{ + //need to add availability_group to questionnaire + $questionnaire_id = bigintval($_GET['questionnaire_id']); + $sample_import_id = bigintval($_GET['sample_import_id']); + $availability_group = bigintval($_GET['qs_availability_group']); + + $sql = "INSERT INTO questionnaire_sample_timeslot (questionnaire_id,sample_import_id,availability_group_id) + VALUES('$questionnaire_id','$sample_import_id','$availability_group')"; + $db->Execute($sql); +} + +if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['qs_ravailability_group'])) +{ + //need to remove rsid from questionnaire + $questionnaire_id = bigintval($_GET['questionnaire_id']); + $sample_import_id = bigintval($_GET['sample_import_id']); + $availability_group = bigintval($_GET['qs_ravailability_group']); + + $sql = "DELETE FROM questionnaire_sample_timeslot + WHERE questionnaire_id = '$questionnaire_id' + AND sample_import_id = '$sample_import_id' + AND availability_group_id = '$availability_group'"; + $db->Execute($sql); +} + +$questionnaire_id = false; +if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); +$sample_import_id = false; +if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); + +xhtml_head(T_("Assign Time slots"),true,$css,$js_head);//false,array("../js/window.js") + +print "

" . T_("Select a questionnaire") . ":

"; +display_questionnaire_chooser($questionnaire_id,false, "form-inline", "form-control"); +print "
"; +if ($questionnaire_id != false) +{ + +//page questionnaireavailability.php +print "

" . T_("Time slot groups") . "

"; +print "
" . T_("Assigning an availability group to a questionnaire will allow interviewers to select from those groups to restrict calls to a particular case to the times within the group") ."
"; + + $sql = "SELECT q.availability_group_id,a.description as description, CONCAT('" . T_("Click to unassign") . "') as link + FROM questionnaire_availability as q, availability_group as a + WHERE q.availability_group_id = a.availability_group_id + AND q.questionnaire_id = '$questionnaire_id'"; + + $qs = $db->GetAll($sql); + print "


"; + + if (empty($qs)) + { + print "

" . T_("There are no time slots groups selected for this questionnaire") . "

"; + } + else + { + print "

" . T_("Time slots groups selected for this questionnaire") . "

"; + xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover"); + } + print "
"; + $sql = "SELECT si.availability_group_id,si.description + FROM availability_group as si + LEFT JOIN questionnaire_availability as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id) + WHERE q.questionnaire_id is NULL"; + + $qs = $db->GetAll($sql); + + if (!empty($qs)) + { + print "
"; + //print "

" . T_("Add time slot to this questionnaire:") . "

"; + print "
+ +   +
"; + } + +print "
"; + + + +//page questionnairecatimeslots.php +print "

" . T_("Call attempt time slots") . "

"; +print "
" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."
"; + + $sql = "SELECT q.availability_group_id,a.description as description, CONCAT('" . T_("Click to unassign") . "') as link + + FROM questionnaire_timeslot as q, availability_group as a + WHERE q.availability_group_id = a.availability_group_id + AND q.questionnaire_id = '$questionnaire_id'"; + + $qs = $db->GetAll($sql); + print "
"; + if (empty($qs)) + { + print "

" . T_("There are no call attempt time slots selected for this questionnaire") . "

"; + } + else + { + print "

" . T_("Call attempt time slots selected for this questionnaire") . "

"; + xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover"); + } + print "
"; + + $sql = "SELECT si.availability_group_id,si.description + FROM availability_group as si + LEFT JOIN questionnaire_timeslot as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id) + WHERE q.questionnaire_id is NULL"; + + $qs = $db->GetAll($sql); + + if (!empty($qs)) + { + print "
"; + //print "

" . T_("Add a call attempt time slot to this questionnaire:") . "

"; + print "
+ +   +
"; + } +print "
"; + +//page questionnairetimeslosample.php +print "

" . T_("Call attempt time slots for sample") . "

"; +print "
" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."
"; + + print "

" . T_("Sample") . ": 

"; + + $sample_import_id = false; + if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); + display_sample_chooser($questionnaire_id,$sample_import_id,false, "form-inline", "form-control"); + + if ($sample_import_id !== false) + { + $sql = "SELECT q.availability_group_id,a.description as description, CONCAT('" . T_("Click to unassign") . "') as link + FROM questionnaire_sample_timeslot as q, availability_group as a + WHERE q.availability_group_id = a.availability_group_id + AND q.questionnaire_id = '$questionnaire_id' + AND q.sample_import_id = '$sample_import_id'"; + + $qs = $db->GetAll($sql); + + if (empty($qs)) + { + print "

" . T_("There are no call attempt time slots selected for this questionnaire sample") . "

"; + } + else + { + print "

" . T_("Call attempt time slots selected for this sample") . ":

"; + xhtml_table ($qs,array("availability_group_id","description","link"),false,"table table-hover"); + } + + $sql = "SELECT si.availability_group_id,si.description + FROM availability_group as si + LEFT JOIN questionnaire_sample_timeslot as q ON (q.sample_import_id = '$sample_import_id' AND q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id) + WHERE q.questionnaire_id is NULL"; + + $qs = $db->GetAll($sql); + + if (!empty($qs)) + { + print "
"; + //print "

" . T_("Add a call attempt time slot to this questionnaire sample:") . "

"; + print "
+ + +   +
"; + } + } +print "
"; +} + +xhtml_foot($js_foot); +?> diff --git a/admin/availability.php b/admin/availability.php index 03b120ac..09f23a24 100644 --- a/admin/availability.php +++ b/admin/availability.php @@ -44,6 +44,22 @@ include ("../db.inc.php"); */ include ("../functions/functions.xhtml.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", +"../include/clockpicker/dist/bootstrap-clockpicker.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../js/addrow-v2.js", + ); +$js_foot = array( +"../include/clockpicker/dist/bootstrap-clockpicker.js", +"../js/custom.js" + ); + global $db; $year="2008"; @@ -63,7 +79,6 @@ if (isset($_POST['day'])) $sql = "DELETE FROM availability WHERE availability_group_id = $availability_group"; - $db->Execute($sql); foreach($_POST['day'] as $key => $val) @@ -78,7 +93,6 @@ if (isset($_POST['day'])) $sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id) VALUES ('$val',$start,$end,$availability_group)"; - $db->Execute($sql); } } @@ -86,27 +100,25 @@ if (isset($_POST['day'])) $sql = "UPDATE availability_group SET description = " . $db->qstr($_POST['description']) . " WHERE availability_group_id= $availability_group"; - $db->Execute($sql); - $db->CompleteTrans(); } -xhtml_head(T_("Modify time slots"),true,array("../css/shifts.css"),array("../js/addrow-v2.js")); +xhtml_head(T_("Modify time slots"),true,$css,$js_head);//,true,array("../css/shifts.css"),array("../js/addrow-v2.js") /** * Display warning if timezone data not installed * */ -$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t"; +$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria' $rs = $db->GetRow($sql); if (empty($rs) || !$rs || empty($rs['t'])) - print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; + print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; -print "
" . T_("Go back") . "
"; +print "
" . T_("Go back") . "

"; $sql = "SELECT description @@ -117,9 +129,8 @@ $rs = $db->GetRow($sql); $description = $rs['description']; -print "

" . $rs['description'] . "

"; +print "

" . T_("Time slot") . " : " . $rs['description'] . "

"; -print "

" . T_("Enter the start and end times for each day of the week to restrict calls within") . "

"; /** * Begin displaying currently loaded restriction times */ @@ -138,36 +149,42 @@ $daysofweek = $db->GetAll($sql); translate_array($daysofweek,array("description")); ?> -
- +
+

+
"; + + print "
" . T_("Enter the start and end times for each day of the week to restrict calls within") . "
"; + + print ""; $count = 0; foreach($availabilitys as $availability) { - print ""; + print ""; $count++; } print ""; + print ""; ?> -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
"; + print "
";//class='row_to_clone' display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt'])); - print "
"; display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); - print "
-

-

-

"/>

+ +

+ "/> -
+

-

"/>

+ "/> -
+
+ diff --git a/admin/availabilitygroup.php b/admin/availabilitygroup.php index 2599cbc9..4b7db070 100644 --- a/admin/availabilitygroup.php +++ b/admin/availabilitygroup.php @@ -65,9 +65,19 @@ include("../functions/functions.operator.php"); */ include("../functions/functions.input.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../css/custom.css" + ); +$js_head = array( + ); +$js_foot = array( +"../js/window.js", +"../js/custom.js" + ); global $db; -xhtml_head(T_("Time slots"),true,array("../css/table.css"),array("../js/window.js")); +xhtml_head(T_("Time slots"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") if (isset($_POST['subdel'])) { @@ -103,33 +113,29 @@ else if (isset($_POST['availability_group'])) } //view groups -$sql = "SELECT description, +$sql = "SELECT availability_group_id,description, CONCAT('". TQ_("Modify") . "') as link FROM availability_group"; $rs = $db->GetAll($sql); -print "

" . T_("Time slots")."

"; - -print "

" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "

"; +print "
" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "
"; if (empty($rs)) - print "

" . T_("No time slots") . "

"; -else - xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify"))); + print "
" . T_("No time slots") . "
"; +else{ + print "
"; + xhtml_table($rs,array("availability_group_id","description","link"),array(T_("ID"),T_("Time slot name"),T_("Modify")),"table table-hover"); + print "
"; +} - -//add an availablity group -print "

" . T_("Add time slot") . "

"; +//add a time slot (ex- availablity group) ?> -
-

-

"/> -

-
+
+

+

"/>

+

"/>

+
diff --git a/admin/bulkappointment.php b/admin/bulkappointment.php index 3e525049..567bc8f6 100644 --- a/admin/bulkappointment.php +++ b/admin/bulkappointment.php @@ -125,7 +125,8 @@ function validate_bulk_appointment($tmpfname) if (isset($_POST['tmpfname'])) { - xhtml_head("queXS",true,array("../css/table.css")); + $subtitle = T_("Result"); + xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle); $todo = validate_bulk_appointment($_POST['tmpfname']); if (is_array($todo)) @@ -213,60 +214,76 @@ if (isset($_POST['tmpfname'])) else if (isset($_POST['import_file'])) { //file has been submitted - - xhtml_head("queXS",true,array("../css/table.css")); + $subtitle = T_("Check data to submit"); + xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,false,$subtitle); ?> -
+ " . T_("Please check the case id's, appointment start and end times and notes are correct before accepting below") . "

"; + + if (is_array($todo) && !empty($todo)) { + + print "

" . T_("Please check the case id's, appointment start and end times and notes are correct before accepting below") . "

"; $todoh = array(T_("Case id"), T_("Start time"), T_("End time"), T_("Note")); xhtml_table($todo,array(0,1,2,3),$todoh); ?> -

-

"/>

+ + " class="btn btn-primary"/>
" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."

"; - + print "

" . T_("The file does not contain at least caseid, starttime and endtime columns. Please try again.") ."

"; + + print ""; + + xhtml_foot(); } else { //need to supply file to upload - xhtml_head(T_("Import: Select file to upload"),true,array("../css/table.css")); + $subtitle = T_("Import: Select file to upload"); + xhtml_head(T_("Bulk appointment generator"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/font-awesome/css/font-awesome.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../js/bootstrap-filestyle.min.js"),false,false,false,$subtitle ); + + $ua = $_SERVER['HTTP_USER_AGENT']; + if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv"; + ?> -

-

-

-
- - - - -
caseidstarttimeendtimenote
12012-08-15 11:00:002012-08-15 13:00:00Appointment automatically generated
22012-08-15 12:00:002012-08-15 14:00:00Appointment automatically generated
32012-08-15 13:00:002012-08-15 15:00:00Appointment automatically generated
+ +

Optionally you can include a note column to attach a note to the case in addition to setting an appointment.
Only cases that have temporary (non final) outcomes will have appointments generated, and the outcome of the case will be updated to an appointment outcome."); ?>

+ +

+
+ + + + + +
caseidstarttimeendtimenote
12012-08-15 11:00:002012-08-15 13:00:00Appointment automatically generated
22012-08-15 12:00:002012-08-15 14:00:00Appointment automatically generated
32012-08-15 13:00:002012-08-15 15:00:00Appointment automatically generated
+
+
-

-

-

"/>

+ + +

: 

+ +
+ " type="file" accept=""/>  +
+ +
diff --git a/admin/callhistory.php b/admin/callhistory.php index 108a00ca..2e27bea8 100644 --- a/admin/callhistory.php +++ b/admin/callhistory.php @@ -49,42 +49,70 @@ include ("../functions/functions.xhtml.php"); */ include("../functions/functions.operator.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/bs-data-table/css/jquery.bdt.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js" + ); +$js_foot = array( +"../include/bs-data-table/js/vendor/jquery.sortelements.js", +"../include/bs-data-table/js/jquery.bdt.js", +"../js/custom.js" + ); //List the case call history $operator_id = get_operator_id(); +/* + Modified Call history list to have more information more suitable way with filtering, soring, paging and submenu for Cse history with asterisk records.... + Need to be linked with cdr records from asterisk!! for monitoring (requires addtional field for call_attempt table to request and store asterisk UniqueID as a reference to CDR .wav file list at /var/spool/asterisk/monitor/ ) +*/ if ($operator_id) { - $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as end, o.description as des, (CONCAT(r.firstName,' ',r.lastName)) as firstName, opp.firstName as opname, "; + if (isset($_GET['questionnaire_id'])) $qid = $_GET['questionnaire_id']; + if (isset($_GET['sample_import_id'])) $sid = $_GET['sample_import_id']; + $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".DATE_FORMAT."') as start_date, DATE_FORMAT(CONVERT_TZ(c.start,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as start_time, DATE_FORMAT(CONVERT_TZ(c.end,'UTC',op.Time_zone_name),'".TIME_FORMAT."') as end, o.description as descr, (CONCAT(r.firstName,' ',r.lastName)) as firstName, opp.firstName as opname, + (SELECT GROUP_CONCAT(cn1.note SEPARATOR '
¶ ' ) FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes,"; - if (isset($_GET['csv'])) - $sql .= " c.case_id "; - else - $sql .= " CONCAT('', c.case_id, '') "; + if (isset($_GET['csv'])) $sql .= " c.case_id "; + else $sql .= " CONCAT('', c.case_id, '') "; - $sql .= " as case_id, q.description as qd + $sql .= " as case_id, q.description as qd , contact_phone.phone as cpi, sample_import.description as spl FROM `call` as c - JOIN (operator as op, respondent as r) on (op.operator_id = '$operator_id' and r.respondent_id = c.respondent_id) - JOIN (`case` as ca, questionnaire as q) ON (ca.case_id = c.case_id AND q.questionnaire_id = ca.questionnaire_id) + JOIN (operator as op, respondent as r) on (op.operator_id = '$operator_id' and r.respondent_id = c.respondent_id)"; + if ($qid) $quest = "$qid and q.questionnaire_id= $qid"; else $quest = "q.questionnaire_id"; + if ($sid) $samimpid = "$sid and sample_import.sample_import_id=$sid"; else $samimpid = "sample_import.sample_import_id"; + + $sql .= " + JOIN (`case` as ca, questionnaire as q) ON (ca.case_id = c.case_id AND ca.questionnaire_id = $quest) LEFT JOIN (outcome as o) on (c.outcome_id = o.outcome_id) - LEFT JOIN (operator as opp) on (opp.operator_id = c.operator_id) + LEFT JOIN (operator as opp) on (opp.operator_id = c.operator_id), + contact_phone, sample_import, sample + WHERE c.contact_phone_id = contact_phone.contact_phone_id AND sample.import_id = $samimpid + AND sample.sample_id = ca.sample_id ORDER BY c.start DESC"; if (!isset($_GET['csv'])) $sql .= " LIMIT 500"; - - $rs = $db->Execute($sql); + else $sql .= " LIMIT 5000"; + $rs = $db->Execute($sql); if (empty($rs)) { - xhtml_head(T_("Call History List"),true,array("../css/table.css")); - print "

" . T_("No calls ever made") . "

"; + print "

" . T_("No calls ever made") . "

"; } else { if (isset($_GET['csv'])) - { - $fn = "callhistory.csv"; + { + $qds = str_replace(' ','_',$_GET['dq']); $smpds = str_replace(' ','_',$_GET['ds']); + $fn = "callhistory-" . $qds . $smpds . date("_d-M-Y_H-i") . ".csv"; header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename=$fn"); @@ -92,33 +120,62 @@ if ($operator_id) header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); Header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); // HTTP/1.0 - - echo(T_("Date/Time call start") . "," . T_("Time end") . "," . T_("Case ID") . "," . T_("Questionnaire") . "," . T_("Operator") . "," . T_("Outcome") . "," . T_("Respondent") . "\n"); + + echo(T_("Date") . ",".T_("Start time") . "," . T_("End time") . "," . T_("Case ID") . "," . T_("Questionnaire") . "," . T_("Sample") . "," . T_("Phone number") . "," . T_("Operator") . "," . T_("Outcome") . ",".T_("Case notes")."," . T_("Respondent") . "\n"); while ($r = $rs->FetchRow()) { translate_array($r,array("des")); - echo $r['start'] . "," . $r['end'] . "," . $r['case_id'] . "," . $r['qd'] . "," . $r['opname'] . ",\"" . $r['des'] . "\"," . $r['firstName'] . "\n"; + echo $r['start_date'] . "," .$r['start_time'] . "," . $r['end'] . "," . $r['case_id'] . "," . $r['qd'] . "," . $r['spl'] . "," . $r['cpi'] . "," . $r['opname'] . "," . $r['descr'] . "," . $r['casenotes'] . "," . $r['firstName'] . "\n"; } + exit; - } + } else { + xhtml_head(T_("Call History List"),true,$css,$js_head); + echo "
 " . T_("Go back") . "
"; + $rs = $rs->GetArray(); - translate_array($rs,array("des")); - xhtml_head(T_("Call History List"),true,array("../css/table.css")); - print "

" . T_("Download Call History List") . "

"; - xhtml_table($rs,array("start","end","case_id","qd","opname","des","firstName"),array(T_("Date/Time call start"),T_("Time end"),T_("Case ID"),T_("Questionnaire"),T_("Operator"),T_("Outcome"),T_("Respondent"))); + if (count($rs) ==0) + { + print "

" . T_("NO Call history records for Your query") . "

"; + } + else + { + translate_array($rs,array("des")); + + $datacol = array("start_date", "start_time","end","case_id","qd","spl","cpi","opname","descr","casenotes","firstName"); + $headers = array(T_("Date"), T_("Start time"), T_("End time"),T_("Case ID"),T_("Questionnaire"),T_("Sample"),T_("Phone number"),T_("Operator"),T_("Outcome"),T_("Case notes"),T_("Respondent")); + + if (isset($_GET['questionnaire_id'])){ + $sql = "SELECT description FROM `questionnaire` WHERE `questionnaire_id` = $qid "; + $dq = $db->GetOne($sql); + print "

" . T_("Questionnaire") . " ID: $qid " . $dq . "

"; + unset($datacol[4]); unset($headers[4]); } + + if (isset($_GET['sample_import_id'])){ + $sql = "SELECT description FROM `sample_import` WHERE `sample_import_id` = $sid "; + $ds = $db->GetOne($sql); + print "

" . T_("Sample") . " ID: $sid " . $ds . "

"; + unset($datacol[5]); unset($headers[5]); } + + print "  " . T_("Download Call History List") . " + "; // " . T_("Go to Call History Report") . "  + + xhtml_table($rs,$datacol,$headers,"tclass",false,false,"bs-table"); + + } } } } else { - xhtml_head(T_("Call History List"),true,array("../css/table.css")); - print "

" . T_("No operator") . "

"; + print "
" . T_("No operator") . "
"; } -xhtml_foot(); - - +xhtml_foot($js_foot); ?> + diff --git a/admin/callrestrict.php b/admin/callrestrict.php index d8c49251..6d3d3b4a 100644 --- a/admin/callrestrict.php +++ b/admin/callrestrict.php @@ -44,6 +44,23 @@ include ("../db.inc.php"); */ include ("../functions/functions.xhtml.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", +//"../include/font-awesome/css/font-awesome.css", +"../include/clockpicker/dist/bootstrap-clockpicker.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../js/addrow-v2.js", + ); +$js_foot = array( +"../include/clockpicker/dist/bootstrap-clockpicker.js", +"../js/custom.js" + ); + global $db; $year="2008"; @@ -79,21 +96,21 @@ if (isset($_POST['day'])) $db->CompleteTrans(); } -xhtml_head(T_("Modify call restriction times"),true,array("../css/shifts.css"),array("../js/addrow-v2.js")); +xhtml_head(T_("Set call restriction times"),true,$css,$js_head);//,array("../css/shifts.css"),array("../js/addrow-v2.js") /** * Display warning if timezone data not installed * */ -$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t"; +$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria' $rs = $db->GetRow($sql); if (empty($rs) || !$rs || empty($rs['t'])) - print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; + print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; -print "

" . T_("Enter the start and end times for each day of the week to restrict calls within") . "

"; +print "
" . T_("Enter the start and end times for each day of the week to restrict calls within") . "
"; /** * Begin displaying currently loaded restriction times @@ -112,30 +129,35 @@ $daysofweek = $db->GetAll($sql); translate_array($daysofweek,array("description")); ?> -
- +
+
"; + print ""; $count = 0; foreach($shifts as $shift) { - print ""; + print " + "; $count++; } print ""; + print " + "; ?> -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
"; + print "
";//class='row_to_clone' /* these are not the rows to clone...*/ display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt'])); - print "
"; display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); - print "
-
-

"/>

-
- +

+ "/> + + + diff --git a/admin/casesbyoutcome.php b/admin/casesbyoutcome.php index 09d65fd6..61704e6d 100644 --- a/admin/casesbyoutcome.php +++ b/admin/casesbyoutcome.php @@ -49,7 +49,9 @@ include ("../functions/functions.xhtml.php"); */ include("../functions/functions.operator.php"); -xhtml_head(T_("Cases by outcome"),true,array("../css/table.css")); +xhtml_head(T_("Cases by outcome"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css")); + +print "
 " . T_("Go back") . " 
"; //List the cases by outcome $operator_id = get_operator_id(); @@ -59,27 +61,48 @@ if ($operator_id) //get the outcome and the questionnaire $outcome_id = intval($_GET['outcome_id']); $questionnaire_id = intval($_GET['questionnaire_id']); - - $sql = "SELECT o.description, q.description as qd + $sql = "SELECT o.description, q.description as qd FROM `outcome` as o, questionnaire as q WHERE o.outcome_id = '$outcome_id' AND q.questionnaire_id = '$questionnaire_id'"; $rs = $db->GetRow($sql); - if (!empty($rs)) - { - print "

" . T_("Project") . ": {$rs['qd']}

"; - print "

". T_("Current outcome:") ." " . T_($rs['description']) . "

"; + if (!empty($rs)){ + print "

" . T_("Project") . ": {$rs['qd']}

"; + if($sample_import_id=intval($_GET['sample_import_id'])){ + $sql = "SELECT si.description as sd + FROM `sample_import` as si + WHERE si.sample_import_id = '$sample_import_id' ;"; + $sd = $db->GetRow($sql); + print "

". T_("Sample:") ." " . T_($sd['sd']) . "

"; + $sid = "AND s.import_id= '$sample_import_id'"; + } + else{$sid = " ";}; + + if($oper_id= intval($_GET['oper_id'])){ + $sql = "SELECT CONCAT(op.firstname, op.lastname) as opname + FROM `operator` as op + WHERE op.operator_id = '$oper_id' ;"; + $on = $db->GetRow($sql); + print "

". T_("Operator") ." : " . T_($on['opname']) . "

oper_id = $oper_id "; + $opn = "AND c.current_operator_id= '$oper_id'"; + } + else{$opn = " ";}; + + print "

". T_("Current outcome:") ." " . T_($rs['description']) . "

"; $sql = "SELECT CONCAT('', c.case_id, '') as case_id FROM `case` as c + LEFT JOIN `sample` as s ON ( s.sample_id = c.sample_id ) WHERE c.questionnaire_id = '$questionnaire_id' AND c.current_outcome_id = '$outcome_id' + $sid + $opn LIMIT 500"; $rs = $db->GetAll($sql); - + print "
"; if (empty($rs)) print "

" . T_("No cases with this outcome") . "

"; else @@ -92,8 +115,7 @@ if ($operator_id) } else print "

" . T_("No operator") . "

"; +print "
"; xhtml_foot(); - - ?> diff --git a/admin/casestatus.php b/admin/casestatus.php index 83a199f3..25fbfb70 100644 --- a/admin/casestatus.php +++ b/admin/casestatus.php @@ -1,30 +1,5 @@ - * @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2013 - * @package queXS - * @subpackage admin - * @link http://www.acspri.org.au/ queXS was writen for ACSPRI - * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 - * */ /** @@ -52,6 +27,26 @@ include("../functions/functions.display.php"); */ include("../functions/functions.input.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/bs-data-table/css/jquery.bdt.css", +//"../include/iCheck/skins/square/blue.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js" + ); +$js_foot = array( +"../include/bs-data-table/js/vendor/jquery.sortelements.js", +"../include/bs-data-table/js/jquery.bdt.js", +"../include/iCheck/icheck.min.js", +"../js/window.js", +"../js/custom.js" + ); + /** * Generate the case status report * @@ -63,6 +58,8 @@ include("../functions/functions.input.php"); * @author Adam Zammit * @since 2012-10-02 */ + + function case_status_report($questionnaire_id = false, $sample_id = false, $outcome_id = false) { global $db; @@ -78,38 +75,49 @@ function case_status_report($questionnaire_id = false, $sample_id = false, $outc $o = ""; if ($outcome_id !== false) $o = "AND c.current_outcome_id = $outcome_id"; - - - $sql = "SELECT CONCAT('', c.case_id, '') as case_id, o.description as outcomes, - si.description as samples, - CASE WHEN ca.end IS NULL THEN '" . TQ_("Now") . "' - WHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Now") . "' - ELSE ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60) + si.description as samples, s.Time_zone_name as timezone, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'". TIME_FORMAT ."') as time, (SELECT COUNT(*) FROM `call` WHERE `call`.case_id = c.case_id) as nrcalls, (SELECT COUNT(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) as nrattempts, + CASE WHEN ca.end IS NULL THEN '" . TQ_("Available") . "' + WHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Available") . "' + ELSE CONCAT(ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60),' " . TQ_("minutes") . "') END AS availableinmin, - CASE WHEN oq.operator_id IS NULL THEN CONCAT('". TQ_("Not assigned, select to assign") ." ','') - ELSE CONCAT('". TQ_("Assigned to") . ": ', oq.firstName, ' " . TQ_("Order") . ":', cq.sortorder , ' (". TQ_("Click to unassign") .")') - END AS assignedoperator + CASE WHEN oq.operator_id IS NULL THEN + CONCAT('') + ELSE CONCAT('', oq.firstName,' ',oq.lastName,'') + END AS assignedoperator, + CASE WHEN oq.operator_id IS NULL THEN + CONCAT('') + ELSE CONCAT('   ', cq.sortorder ,' ') + END AS ordr, + CASE WHEN oq.operator_id IS NULL THEN + CONCAT('') + ELSE CONCAT('') + END AS flag FROM `case` as c JOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1) JOIN outcome as o ON (o.outcome_id = c.current_outcome_id AND o.outcome_type_id = 1) JOIN sample as s ON (s.sample_id = c.sample_id $s) - JOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1) - JOIN questionnaire_sample as qs ON (qs.questionnaire_id = q.questionnaire_id AND qs.sample_import_id = s.import_id) + JOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1) + JOIN questionnaire_sample as qs ON (qs.questionnaire_id = $questionnaire_id AND qs.sample_import_id = s.import_id) LEFT JOIN `call` as ca ON (ca.call_id = c.last_call_id) LEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_id) LEFT JOIN case_queue as cq ON (cq.case_id = c.case_id) LEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id) WHERE c.current_operator_id IS NULL $q $o - ORDER BY availableinmin ASC"; + ORDER BY c.case_id ASC"; // print $sql; print ("
"); - xhtml_table($db->GetAll($sql),array('case_id','outcomes','samples','availableinmin','assignedoperator'),array(T_("Case id"),T_("Outcome"),T_("Sample"),T_("Case available in x minutes"),T_("Assigned to operator"))); + $datacol = array('case_id','samples','timezone','time','nrattempts','nrcalls','outcomes','availableinmin','assignedoperator','ordr','flag'); + $headers = array(T_("Case id"),T_("Sample"),T_("Timezone"),T_("Time NOW"),T_("Call attempts"),T_("Calls"),T_("Outcome"),T_("Available in"),T_("Assigned to"),T_("Order"),""); + + if (isset($_GET['sample_import_id'])){ unset($datacol[1]); unset($headers[1]); } + + xhtml_table($db->GetAll($sql),$datacol,$headers,"tclass",false,false,"bs-table"); $sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected FROM operator @@ -117,11 +125,11 @@ function case_status_report($questionnaire_id = false, $sample_id = false, $outc $rs3 = $db->GetAll($sql); - print ""; - display_chooser($rs3, "operator_id", "operator_id",true,false,false); + print "

" . T_("Assign selected cases to") . " " . T_("operator") . " : 

"; + display_chooser($rs3, "operator_id", "operator_id",true,false,false,true,false,true,"pull-left"); - print (""); - print ("
"); + print " "; + print "
"; return true; } @@ -190,14 +198,29 @@ if (isset($_GET['unassign'])) $sortorder++; } - $db->CompleteTrans(); - } -xhtml_head(T_("Case status and assignment"),true,array("../css/table.css"),array("../js/window.js")); - -print "

" . T_("List cases by questionnaire and sample with the ability to assign them to be called next in a queue by a particular operator. If you assign cases to an operator, it will override the normal scheduling process and call them as soon as the operator is available.") . "

"; +xhtml_head(T_("Case status and assignment"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") +echo " " . T_("Go back") . " + "; + ?> + +" . T_("Questionnaire") . ":"; -display_questionnaire_chooser($questionnaire_id); -print ""; -display_sample_chooser($questionnaire_id,$sample_import_id,false); - -if ($questionnaire_id) +print "

" . T_("Questionnaire") . ":

"; +display_questionnaire_chooser($questionnaire_id, false, "pull-left", "form-control"); +if ($questionnaire_id){ + print "

" . T_("Sample") . ":

"; + display_sample_chooser($questionnaire_id,$sample_import_id,false, "pull-left", "form-control"); + print "
+
"; + case_status_report($questionnaire_id,$sample_import_id,$outcome_id); - - -xhtml_foot(); - +} +xhtml_foot($js_foot); ?> + diff --git a/admin/centreinfo.php b/admin/centreinfo.php index 2c014ae9..cd14a844 100644 --- a/admin/centreinfo.php +++ b/admin/centreinfo.php @@ -60,15 +60,13 @@ if (isset($_POST['information'])) set_setting("information",$_POST['information']); } -xhtml_head(T_("Set centre information"),true,false,array("../js/window.js")); - - ?> -

- editor("information",get_setting("information")); ?> - "/>

-
- +
+ + editor("information",get_setting("information")); ?> +
"/> +
+ diff --git a/admin/clientquestionnaire.php b/admin/clientquestionnaire.php index 410876f2..ba20596f 100644 --- a/admin/clientquestionnaire.php +++ b/admin/clientquestionnaire.php @@ -106,8 +106,6 @@ function vqd($client_id,$questionnaire_id) } - - if (isset($_POST['submit'])) { $db->StartTrans(); @@ -132,7 +130,6 @@ if (isset($_POST['submit'])) } - $sql = "SELECT questionnaire_id,description FROM questionnaire WHERE enabled = 1 @@ -140,14 +137,14 @@ $sql = "SELECT questionnaire_id,description $questionnaires = $db->GetAll($sql); -$sql = "SELECT client_id,firstname as description +$sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username FROM client ORDER by client_id ASC"; $clients = $db->GetAll($sql); -xhtml_head(T_("Assign clients to questionnaires"),false,array("../css/table.css")); +xhtml_head(T_("Assign clients to questionnaires"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/iCheck/icheck.min.js")); ?> @@ -206,7 +203,6 @@ function checkQid(q) } - function checkVid(v) { @@ -229,51 +225,50 @@ function checkVid(v) VidOn = 0; } - - + "; - -print "
"; - -print ""; +print ""; foreach($questionnaires as $q) { print ""; } -print ""; +print ""; -$class = 0; foreach($clients as $v) { - print ""; - print ""; + print " + + "; foreach($questionnaires as $q) { $checked = ""; if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"checked\""; - print ""; + print ""; } print ""; } -print "
 " . T_("Username") . "  " . T_("Client") . " {$q['description']}
{$v['description']}
 {$v['username']} {$v['description']}

"; +print ""; xhtml_foot(); ?> - - + diff --git a/admin/clients.php b/admin/clients.php index ef450b1b..c59cb1ef 100644 --- a/admin/clients.php +++ b/admin/clients.php @@ -78,7 +78,7 @@ if (isset($_POST['client'])) $htg->addUserToGroup($_POST['client'],HTGROUP_CLIENT); } - $a = T_("Added: $client"); + $a = T_("Added: $client"); } else $a = T_("Could not add") . " " . $client . ". " . T_("There may already be a client of this name"); @@ -86,7 +86,7 @@ if (isset($_POST['client'])) } -xhtml_head(T_("Add a client")); +xhtml_head(T_("Add a client"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css")); $sql = "SELECT Time_zone_name as value, Time_zone_name as description FROM timezone_template"; @@ -97,27 +97,83 @@ $rs = $db->GetAll($sql); if ($a) { ?> -

+
-

-

-

-
-

- -

+ + + + +
+

+

+ + +
+ + +
+ +
+ + +
   + " class="btn btn-default fa" />   + +
+
-

-

-

"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE"))); ?>

-

" />

+
+ + +
+
+ + +
+
+ " class="btn btn-primary col-sm-offset-3 col-sm-3"/> - diff --git a/admin/databasestrings.php b/admin/databasestrings.php index 18002cc4..68a34cc2 100755 --- a/admin/databasestrings.php +++ b/admin/databasestrings.php @@ -88,5 +88,7 @@ T_("Respondent last name"); T_("Email address"); T_("Self completion email invitation sent"); T_("Self completed online"); +T_("Max call attempts reached"); +T_("Max calls reached"); ?> diff --git a/admin/dataoutput.php b/admin/dataoutput.php index 1d77e81d..5874df97 100644 --- a/admin/dataoutput.php +++ b/admin/dataoutput.php @@ -28,7 +28,6 @@ * */ - /** * Input functions */ @@ -59,16 +58,16 @@ if (isset($_GET['key']) || isset($_GET['sample'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); $sample_import_id = bigintval($_GET['sample_import_id']); - $sql = "SELECT sv.var as value - FROM `sample_var` as sv - WHERE sv.sample_id = (SELECT sample_id FROM sample WHERE import_id = '$sample_import_id' LIMIT 1)"; + $sql = "SELECT sivr.var as value, sivr.var_id as var_id + FROM `sample_import_var_restrict` as sivr + WHERE sivr.sample_import_id = $sample_import_id"; $svars = $db->GetAll($sql); - $fn = "key_all_"; - if (isset($_GET['sample'])) $fn = "sample_all_"; + $fn = "key_"; + if (isset($_GET['sample'])) $fn = "sample_"; - $fn .= $questionnaire_id . "_" . $sample_import_id .".csv"; + $fn .= T_("ALL") . "_Qid=" . $questionnaire_id . "_Sid=" . $sample_import_id .".csv"; header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename=$fn"); @@ -77,21 +76,32 @@ if (isset($_GET['key']) || isset($_GET['sample'])) Header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); // HTTP/1.0 - echo("token,caseid"); + echo("token,".T_("Case ID").""); foreach($svars as $s) { echo("," . $s['value']); } + if (isset($_GET['sample'])) { - echo(",Outcome,AAPOR"); + echo(",".T_("Current Outcome").",".T_("Number of call attempts").",".T_("Number of calls").",".T_("Case notes").",".T_("Total interview time over all calls (mins)").",".T_("Interview time for last call (mins)").",".T_("Last number dialled").",".T_("DATE/TIME Last number dialled").",".T_("Operator username for last call").",".T_("Shift report").", AAPOR"); } - + echo("\n"); $sql = "SELECT c.token,c.case_id "; - if (isset($_GET['sample'])) $sql .= ", o.description, o.aapor_id "; + if (isset($_GET['sample'])) $sql .= ", o.description, + (SELECT COUNT(ca.call_attempt_id) FROM `call_attempt` as ca WHERE ca.case_id = c.case_id ) as callattempts, + (SELECT COUNT(cl.call_id) FROM `call` as cl WHERE cl.case_id = c.case_id ) as calls, + (SELECT GROUP_CONCAT(cn1.note SEPARATOR '|') FROM `case_note` as cn1 WHERE c.case_id = cn1.case_id GROUP BY cn1.case_id)as casenotes, + (SELECT ROUND(SUM( TIMESTAMPDIFF(SECOND , cl2.start,IFNULL(cl2.end,CONVERT_TZ(NOW(),'System','UTC'))))/60,2) FROM `call_attempt` as cl2 WHERE cl2.case_id = c.case_id) as interviewtimec, + (SELECT ROUND(TIMESTAMPDIFF(SECOND , cl3.start,IFNULL(cl3.end,CONVERT_TZ(NOW(),'System','UTC')))/60,2) FROM `call_attempt` as cl3 WHERE cl3.case_id = c.case_id ORDER BY cl3.call_attempt_id DESC LIMIT 1) as interviewtimel, + (SELECT cp1.phone FROM `call` as cl4, `contact_phone` as cp1 WHERE cl4.call_id = c.last_call_id AND cp1.contact_phone_id = cl4.contact_phone_id ) as lastnumber, + (SELECT cl55.start FROM `call` as cl55 WHERE cl55.call_id = c.last_call_id ) as lastcallstart, + (SELECT op1.username FROM `call` as cl5, `operator` as op1 WHERE cl5.call_id = c.last_call_id AND op1.operator_id = cl5.operator_id) as operatoru, + (SELECT GROUP_CONCAT(DISTINCT sr1.report SEPARATOR '|') FROM `call` as cl6, `shift` as sh1, `shift_report` as sr1 WHERE cl6.case_id = c.case_id AND sr1.shift_id = sh1.shift_id AND sh1.questionnaire_id = c.questionnaire_id AND cl6.start >= sh1.start AND cl6.end < sh1.end GROUP BY sr1.shift_id) as shiftr, + o.aapor_id "; $i = 0; foreach ($svars as $s) @@ -105,22 +115,21 @@ if (isset($_GET['key']) || isset($_GET['sample'])) //left join if getting whole sample file if (isset($_GET['sample'])) $sql .= "LEFT "; - $sql .= "JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id' AND c.sample_id = sample.sample_id) "; + $sql .= "JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id' AND c.sample_id = `sample`.sample_id) "; - if (isset($_GET['sample'])) $sql .= " LEFT JOIN `outcome` as o ON (o.outcome_id = c.current_outcome_id) "; + if (isset($_GET['sample'])) $sql .= " LEFT JOIN `outcome` as o ON (o.outcome_id = c.current_outcome_id)"; $i = 0; foreach ($svars as $s) { - $sql .= " LEFT JOIN sample_var AS sv$i ON (sv$i.sample_id = sample.sample_id AND sv$i.var = '{$s['value']}') "; + $sql .= " LEFT JOIN sample_var AS sv$i ON (sv$i.sample_id = `sample`.sample_id AND sv$i.var_id = '{$s['var_id']}') "; $i++; } - $sql .= " WHERE sample.import_id = '$sample_import_id'"; + $sql .= " WHERE `sample`.import_id = '$sample_import_id'"; $list = $db->GetAll($sql); - if (!empty($list)) { foreach($list as $l) @@ -134,32 +143,31 @@ if (isset($_GET['key']) || isset($_GET['sample'])) } if (isset($_GET['sample'])) { - echo "," . str_replace(","," ",$l['description']) . "," . $l['aapor_id']; + echo "," . str_replace(","," ",$l['description']) . "," .$l['callattempts']."," .$l['calls']."," .$l['casenotes'].",".$l['interviewtimec'].",".$l['interviewtimel'].",".$l['lastnumber'].",".$l['lastcallstart'].",".$l['operatoru'].",".$l['shiftr'].",". $l['aapor_id']; } echo "\n"; } } - exit; } -if (isset($_GET['sample_var'])) -{ +if (isset($_GET['sample_var'])){ $questionnaire_id = bigintval($_GET['questionnaire_id']); $sample_import_id = bigintval($_GET['sample_import_id']); - $sample_var = $db->quote($_GET['sample_var']); + $varid = intval($_GET['sample_var']); - $sql = "SELECT c.token,c.case_id, sv.val - FROM sample, `case` as c, sample_var as sv - WHERE c.questionnaire_id = '$questionnaire_id' - AND sample.import_id = '$sample_import_id' - AND c.sample_id = sample.sample_id - AND sv.sample_id = sample.sample_id - AND sv.var = $sample_var"; + $sql = "SELECT c.token, c.case_id, sv.val, sivr.var + FROM `case` as c, `sample_import_var_restrict` as sivr, `sample_var` as sv + WHERE c.questionnaire_id = $questionnaire_id + AND sivr.sample_import_id = $sample_import_id + AND c.sample_id = sv.sample_id + AND sivr.var_id = sv.var_id + AND sivr.var_id = $varid"; $list = $db->GetAll($sql); + $sample_var = $list[0]['var']; - $fn = "key_$questionnaire_id" . "_" . $sample_import_id .".csv"; + $fn = "key-" . $sample_var . "_Qid=$questionnaire_id" . "_Sid=" . $sample_import_id .".csv"; header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename=$fn"); @@ -182,13 +190,12 @@ if (isset($_GET['sample_var'])) } +xhtml_head(T_("Data output"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); -xhtml_head(T_("Data output"),true,false,array("../js/window.js")); - -print "

" . T_("Please select a questionnaire") . "

"; +print "

" . T_("Please select a questionnaire") . ": 

"; $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); -display_questionnaire_chooser($questionnaire_id); +display_questionnaire_chooser($questionnaire_id,false,"form-inline col-sm-3 pull-left", "form-control"); if ($questionnaire_id) { @@ -199,38 +206,37 @@ if ($questionnaire_id) $ls = $db->GetRow($sql); $lsid = $ls['lime_sid']; - print "

". T_("Download data for this questionnaire via Limesurvey") . "

"; + print " ". T_("Download data for this questionnaire via Limesurvey") . "
"; - print "

" . T_("Please select a sample") . "

"; + print "

" . T_("Please select a sample") . ": 

"; $sample_import_id = false; if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); - display_sample_chooser($questionnaire_id,$sample_import_id); + display_sample_chooser($questionnaire_id,$sample_import_id,false,"form-inline col-sm-3 pull-left", "form-control"); if ($sample_import_id) { - print "

" . T_("Download data for this sample via Limesurvey") . "

"; + print " " . T_("Download data for this sample via Limesurvey") . "
"; //get sample vars - $sql = "SELECT sv.var as value, sv.var as description - FROM `sample_var` as sv - WHERE sv.sample_id = (SELECT sample_id FROM sample WHERE import_id = '$sample_import_id' LIMIT 1)"; + $sql = "SELECT sivr.var_id as value, sivr.var as description + FROM `sample_import_var_restrict` as sivr + WHERE sivr.sample_import_id = $sample_import_id"; + $rs = $db->GetAll($sql); //download a key file linking the caseid to the sample - print "

" . T_("Download key file: select sample var") . "

"; + print "

" . T_("Download key file: select sample var") . ": 

"; - display_chooser($db->GetAll($sql),"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id"); + display_chooser($rs,"sample_var","sample_var",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-inline col-sm-3 pull-left"); + + print "
"; + //download complete key file - print "

" . T_("Download complete key file") . "

"; + print "" . T_("Download complete key file") . "

"; //download complete sample file with outcomes - print "

" . T_("Download complete sample file with current outcomes") . "

"; - - + print "" . T_("Download complete sample file with current outcomes") . "
"; } } xhtml_foot(); - - ?> - diff --git a/admin/displayappointments.php b/admin/displayappointments.php index 6f44cb56..2b2d60d4 100644 --- a/admin/displayappointments.php +++ b/admin/displayappointments.php @@ -1,31 +1,5 @@ - * @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 - * */ /** @@ -58,63 +32,31 @@ include ("../functions/functions.input.php"); */ include ("../functions/functions.calendar.php"); -//Create a new blank appointment and then edit it -if (isset($_GET['new']) && isset($_GET['case_id'])) -{ - $case_id = bigintval($_GET['case_id']); - - $db->StartTrans(); - - //First create a call attempt - $operator_id = get_operator_id(); - - if ($operator_id == false) die(); - - //get the first respondent id for this case - $sql = "SELECT respondent_id - FROM respondent - WHERE case_id = '$case_id'"; - - $rs = $db->GetRow($sql); - - $respondent_id = $rs['respondent_id']; - - //get the first contact_phone_id for this case - $sql = "SELECT contact_phone_id - FROM contact_phone - WHERE case_id = '$case_id'"; - - $rs = $db->GetRow($sql); - - $contact_phone_id = $rs['contact_phone_id']; - - $sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end) - VALUES (NULL,$case_id,$operator_id,$respondent_id,CONVERT_TZ(NOW(),'System','UTC'),CONVERT_TZ(NOW(),'System','UTC'))"; - - $db->Execute($sql); - - $call_attempt_id = $db->Insert_ID(); - - - $sql = "INSERT INTO `appointment` - (appointment_id,case_id,contact_phone_id,call_attempt_id,start,end,require_operator_id,respondent_id,completed_call_id) - VALUES (NULL,'$case_id','$contact_phone_id','$call_attempt_id',CONVERT_TZ(NOW() + INTERVAL 1 DAY,'System','UTC'),CONVERT_TZ(NOW() + INTERVAL 1 DAY,'System','UTC'),NULL,$respondent_id,NULL)"; - - $db->Execute($sql); - - - $appointment_id = $db->Insert_ID(); - - $db->CompleteTrans(); - - $_GET['appointment_id'] = $appointment_id; -} - - -//update appointment -if (isset($_GET['start']) && isset($_GET['appointment_id'])) -{ - $appointment_id = bigintval($_GET['appointment_id']); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/jquery-ui/jquery-ui.min.css", +"../include/timepicker/jquery-ui.min.css", +"../include/timepicker/jquery-ui-timepicker-addon.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../include/timepicker/jquery-ui.min.js", +//"../include/jquery-ui/jquery-ui.min.js", +"../include/timepicker/jquery-ui-timepicker-addon.js", +"../include/timepicker/jquery-ui-timepicker-ru.js", + ); +$js_foot = array( +"../js/bootstrap-confirmation.js", +"../js/custom.js" + ); + +//create new or update appointment +if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update'])) +{ $start = $db->qstr($_GET['start']); $end = $db->qstr($_GET['end']); $contact_phone_id = bigintval($_GET['contact_phone_id']); @@ -122,19 +64,46 @@ if (isset($_GET['start']) && isset($_GET['appointment_id'])) $require_operator_id = "NULL"; if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']); - //Edit this appointment in the database - $sql = "UPDATE appointment as a, respondent as r - SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id, - a.require_operator_id = $require_operator_id + if ($_GET['new'] == 'create'){ + $case_id = bigintval($_GET['case_id']); + $operator_id = get_operator_id(); + if ($operator_id == false) die(); + $sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '$respondent_id'"; + $respondent_tz = $db->GetOne($sql); + + // create a call attempt + $sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end) + VALUES (NULL,$case_id,$operator_id,$respondent_id,CONVERT_TZ(NOW(),@@session.time_zone,'UTC'),CONVERT_TZ(NOW(),@@session.time_zone,'UTC'))"; + $db->Execute($sql); + + $call_attempt_id = $db->Insert_ID(); + + $sql = "INSERT INTO `appointment` (appointment_id,case_id,contact_phone_id,call_attempt_id,start,end,require_operator_id,respondent_id,completed_call_id) + VALUES(NULL,$case_id,$contact_phone_id,$call_attempt_id,CONVERT_TZ($start,'$respondent_tz','UTC'),CONVERT_TZ($end,'$respondent_tz','UTC'),$require_operator_id,$respondent_id,NULL)"; + $db->Execute($sql); + + $appointment_id = $db->Insert_ID(); + + $_GET['appointment_id'] = $appointment_id; + $appointment_id = bigintval($_GET['appointment_id']); + + } else { + + $appointment_id = bigintval($_GET['appointment_id']); + + //Edit this appointment in the database + $sql = "UPDATE appointment as a, respondent as r + SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id, a.require_operator_id = $require_operator_id WHERE a.appointment_id = $appointment_id AND r.respondent_id = $respondent_id"; - $db->Execute($sql); + $db->Execute($sql); + } + unset ($_GET['start'],$_GET['end'],$_GET['appointment_id'],$_GET['case_id'],$_GET['new'],$_GET['update']); } - -if (isset($_GET['appointment_id']) && isset($_GET['case_id'])) +if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(($_GET['new'] == 'new') && isset($_GET['case_id']))) { $appointment_id = bigintval($_GET['appointment_id']); $case_id = bigintval($_GET['case_id']); @@ -143,57 +112,94 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id'])) { $sql = "DELETE FROM appointment WHERE appointment_id = '$appointment_id'"; - $db->Execute($sql); - xhtml_head(T_("Now modify case outcome")); + xhtml_head(T_("Now modify case outcome"),true,$css,$js_head); - print "

" . T_("The appointment has been deleted. Now you must modify the case outcome") . "

"; - print "

" . T_("Modify case outcome") . "

"; + print "

" . T_("The appointment has been deleted. Now you must modify the case outcome") . "

+ " . T_("Modify case outcome") . "
"; } else { //Display an edit form - $css = array("../css/timepicker.css","../include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css"); - $js = array("../include/jquery-ui/js/jquery-1.4.2.min.js","../include/jquery-ui/js/jquery-ui-1.8.2.custom.min.js","../include/timepicker/jquery-ui-timepicker-addon.js"); - xhtml_head(T_("Edit appointment"),false,$css,$js); - print ""; - $sql = "SELECT a.contact_phone_id,a.call_attempt_id,CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as start,CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as end,a.respondent_id,a.require_operator_id - FROM appointment as a, respondent as r + if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID " . $appointment_id;} + + xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle); + $lang = DEFAULT_LOCALE; + $sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate, CONVERT_TZ(s.end,'UTC',r.Time_zone_name) as enddate FROM `shift` as s, `case` as c, `respondent` as r WHERE s.questionnaire_id = c.questionnaire_id AND c.case_id = $case_id AND r.case_id = c.case_id ORDER BY s.end DESC LIMIT 1"; + $rs = $db->GetRow($sql); $startdate = $rs['startdate'];$enddate = $rs['enddate']; + + print ""; + + if ($_GET['new'] =='new'){ + $start = $startdate; + $end = $enddate; + $rtz = $_GET['rtz']; + } + if (isset($_GET['appointment_id'])) { + + $sql = "SELECT a.contact_phone_id,a.call_attempt_id, CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as `start`, CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as `end`, a.respondent_id, a.require_operator_id, r.Time_zone_name as rtz + FROM `appointment` as a, respondent as r WHERE a.appointment_id = '$appointment_id' AND a.case_id = '$case_id' AND r.respondent_id = a.respondent_id"; - $rs = $db->GetRow($sql); + $rs = $db->GetRow($sql); - if (!empty($rs)) - { - $respondent_id = $rs['respondent_id']; - $contact_phone_id = $rs['contact_phone_id']; - $require_operator_id = $rs['require_operator_id']; - $start = $rs['start']; - $end = $rs['end']; - - print "

"; - print "
"; - display_chooser($db->GetAll("SELECT respondent_id as value, firstname as description, CASE when respondent_id = '$respondent_id' THEN 'selected=\'selected\'' ELSE '' END as selected - FROM respondent - WHERE case_id = '$case_id'"),"respondent_id","respondent_id",false,false,false,false); + if (!empty($rs)){ + $respondent_id = $rs['respondent_id']; + $contact_phone_id = $rs['contact_phone_id']; + $require_operator_id = $rs['require_operator_id']; + $start = $rs['start']; + $end = $rs['end']; + $rtz = $rs['rtz']; + } + } + print ""; + print ""; + display_chooser($db->GetAll("SELECT respondent_id as value, CONCAT(firstName,' ',lastName) as description, + CASE when respondent_id = '$respondent_id' THEN 'selected=\'selected\'' ELSE '' END as selected + FROM respondent + WHERE case_id = '$case_id'"),"respondent_id","respondent_id",false,false,false,true,false,true,"pull-left"); - print "
"; - display_chooser($db->GetAll("SELECT contact_phone_id as value, - phone as description, - CASE when contact_phone_id = '$contact_phone_id' THEN 'selected=\'selected\'' ELSE '' END as selected + print "

"; + display_chooser($db->GetAll("SELECT contact_phone_id as value, phone as description, + CASE when contact_phone_id = '$contact_phone_id' THEN 'selected=\'selected\'' ELSE '' END as selected FROM contact_phone WHERE case_id = '$case_id'"), - "contact_phone_id","contact_phone_id",false,false,false,false); - - print "
"; - print "
"; - print "
"; - $ops = $db->GetAll(" SELECT o.operator_id as value, + "contact_phone_id","contact_phone_id",false,false,false,true,false,true,"pull-left"); + + print "

". T_("ATTENTION! Keep in mind that you're setting 'Start' & 'End' appoinment times in RESPONDENT LOCAL TIME !!!") . "
"; + date_default_timezone_set($rtz); + print " +

" . $rtz . "

+ "; + + print "

+
"; + print "

+
"; + print "

"; + $ops = $db->GetAll("SELECT o.operator_id as value, CONCAT(o.firstName, ' ', o.lastName) as description, CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected FROM operator as o"); @@ -207,45 +213,67 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id'])) } } array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected)); - display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,false); - print ""; - print "
"; + display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,true,false,true,"pull-left"); + print ""; + + if ($_GET['new'] == 'new') { print "";} - print "

"; - print "

" . T_("Cancel edit") . "

"; - print "

" . T_("Delete this appointment") . "

"; - } + print "


+ "; + + print "
"; + + print ""; + + print ""; } } -else -{ - +else { $operator_id = get_operator_id(); + $subtitle = T_("Appointments"); + xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30); //array("../css/table.css") + print "

" . T_("All appointments (with times displayed in your time zone)") . "

"; - xhtml_head(T_("Display Appointments"),true,array("../css/table.css")); - - print "

" . T_("Appointments") . "

" . T_("All appointments (with times displayed in your time zone)") . "

"; - - $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . TQ_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('', c.case_id, '') as case_id, CONCAT('". TQ_("Delete") . "') as link, CONCAT('". TQ_("Edit") . "') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho - - FROM appointment as a - JOIN (`case` as c, respondent as r, questionnaire as q, operator as o, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and o.operator_id = '$operator_id' and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id) - LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id) - LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id - WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC') - ORDER BY a.start ASC"; + $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end,CONCAT(r.firstName, ' ', r.lastName) as resp, IFNULL(ou.description,'" . TQ_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, + CONCAT('', c.case_id, '') as case_id, + CONCAT('  ') as link, + CONCAT('  ') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho + FROM appointment as a + JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id) + LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id) + LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id + WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10 + ORDER BY a.start ASC"; $rs = $db->GetAll($sql); - - if (!empty($rs)) - { + if (!empty($rs)) { translate_array($rs,array("outcome")); - xhtml_table($rs,array("description","case_id","start","end","makerName","witho","firstName","lastName","outcome","callerName","link","edit"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),T_("Operator Name"),T_("Appointment with"),T_("Respondent Name"),T_("Surname"),T_("Current outcome"),T_("Operator who called"),T_("Delete"),T_("Edit"))); - } - else - print "

" . T_("No appointments in the future") . "

"; + xhtml_table($rs,array("description","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),"  ",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"  "),"tclass",false,false,"bs-table"); + + } else print "

" . T_("No future appointments") . "

"; + + print "

" . T_("Missed appointments (with times displayed in your time zone)") . "

"; + + $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end, CONCAT(r.firstName, ' ', r.lastName) as resp, + CONCAT('', c.case_id, '') as case_id, + CONCAT('  ') as link, + CONCAT('  ') as edit + FROM appointment as a + JOIN (`case` as c, respondent as r, questionnaire as q, `sample` as s, sample_import as si) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and s.sample_id = c.sample_id and s.import_id= si.sample_import_id) + LEFT JOIN (`call` as ca) ON (ca.call_id = a.completed_call_id) + WHERE q.enabled=1 AND si.enabled = 1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id !=10 + GROUP BY c.case_id + ORDER BY a.start ASC"; + + $rs = $db->GetAll($sql); + if (!empty($rs)) { + xhtml_table($rs,array("description","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),"  ",T_("Respondent"),"  "),"tclass",false,false,"bs-table"); + + } else print "

" . T_("No appointments missed") . "

"; } -xhtml_foot(); - +xhtml_foot($js_foot); ?> + diff --git a/admin/extensionstatus.php b/admin/extensionstatus.php index 94c2b621..97a94a7d 100644 --- a/admin/extensionstatus.php +++ b/admin/extensionstatus.php @@ -130,40 +130,96 @@ if (isset($_GET['unassign'])) $db->CompleteTrans(); } -xhtml_head(T_("Display extension status"),true,array("../css/table.css"),array("../js/window.js")); +xhtml_head(T_("Extensions & status"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); +?> + -if (isset($_GET['edit'])) +GetRow($sql); - - print "

" . T_("Go back") . "

"; + $rs = $db->GetRow($sql); + } + + print "" . T_("Go back") . ""; ?> -
-

-

-

-

" />

- -
-

" />

-
-" . T_("Unassign the operator from this extension to be able to delete it") . "

"; +
+

+
+
+ + " maxlength="12" required value="" class="form-control"/> +
+
+ + "/>    + " class="btn btn-default fa" />   + +
+
+ " /> +
+ + + + + + + + " /> + +
" . T_("Unassign the operator from this extension to be able to delete it") . ""; + } + + print "
"; } else { - $sql= "SELECT CONCAT('',o.firstName,'') as firstName, - CONCAT('',e.extension,'') as extension, + $sql= "SELECT CONCAT('',o.firstName,' ', o.lastname,'') as firstName, + CONCAT('',e.extension,'') as extension, IF(c.case_id IS NULL,IF(e.current_operator_id IS NULL,'list' ,CONCAT('". TQ_("Unassign") ."')),'". TQ_("End case to change assignment")."') as assignment, CASE e.status WHEN 0 THEN '" . TQ_("VoIP Offline") . "' ELSE '" . TQ_("VoIP Online") . "' END as status, @@ -197,21 +253,15 @@ else if ($rs[$i]['assignment'] == "list") $rs[$i]['assignment'] = display_chooser($ers,"operator_id_" . $rs[$i]["extension_id"],"operator_id_" . $rs[$i]["extension_id"],true,"extension_id=".$rs[$i]["extension_id"],true,false,false,false); } + print "
"; xhtml_table($rs,array("extension","firstName","assignment","status","case_id","state","calltime"),array(T_("Extension"),T_("Operator"),T_("Assignment"),T_("VoIP Status"),T_("Case ID"),T_("Call state"),T_("Time on call")),"tclass",array("vs" => "1")); + print "
"; } else print "

" . T_("No extensions") . "

"; - print "

" . T_("Add an extension") . "

"; - ?> - -
-

-

-

" />

-
- - " . T_("Add extension") . "
"; + } xhtml_foot(); diff --git a/admin/import.php b/admin/import.php index edd02eec..b247cb0e 100644 --- a/admin/import.php +++ b/admin/import.php @@ -1,32 +1,6 @@ - * @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 - * */ /** @@ -44,11 +18,30 @@ include ("../functions/functions.xhtml.php"); */ include("../functions/functions.import.php"); - +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", + ); +$js_foot = array( +"../js/bootstrap-filestyle.min.js", +"../js/custom.js" + ); + if (isset($_POST['import_form'])) { //form has been submitted - xhtml_head(T_("Import: Validating and uploading")); + $subtitle = T_("Validating and uploading"); + xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle); + echo " " . T_("Go back") . ""; + //verify each GET field is unique (except import_form) $sfields = array(); @@ -64,66 +57,99 @@ if (isset($_POST['import_form'])) { //verified so upload if (import_file($_POST['filename'],$description,$sfields)) { - print "

" . T_("Successfully imported file") . "

"; + print "

" . T_("Successfully imported sample") . " 

$description

"; } else { - print "

" . T_("Error importing file. Please try again") . "

"; + print -"

" . T_("Error importing file. Please try again") . "

"; } } else - print "

" . T_("Error:") . " $error

" . T_("Please go back in your browser and fix the problem") . "

"; + print "

" . T_("Error:") . " $error

" . T_("Please check imported file, go back in your browser and fix the problem") . "

"; //verifiy that exactly one primary phone number is selected //upload to database - xhtml_foot(); + xhtml_foot($js_foot); } else if (isset($_POST['import_file'])) { //file has been submitted + $subtitle = T_("Select columns to import"); + xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle); + echo " " . T_("Go back") . ""; - xhtml_head(T_("Import: Select columns to import")); - ?> -
- "; $tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO"); move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname); display_table(get_first_row($tmpfname)); - - ?> -

-

-

+ + +
+ +
+ +
+
+
-  " . T_("Go back") . ""; + + $ua = $_SERVER['HTTP_USER_AGENT']; + if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv"; + //print "ua=" . $_SERVER['HTTP_USER_AGENT']; ?> -
-

-

-

-

"/>

+ +
+ + + + +
+ + +
+ ..." type="file" accept="" /> +
+
+ + +
+ +
+ " class="form-control"> +
+
+ + +
+ +
+ +
+
+ +
- diff --git a/admin/index.php b/admin/index.php index 48d620d5..1227b014 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,4 +1,6 @@ - + + + + <?php echo T_("Administrative Tools") ;?> + + + + + -/** - * XHTML functions - */ -include ("../functions/functions.xhtml.php"); + + + -xhtml_head(T_("Administrative Tools"),true,array("../css/table.css","../css/admin.css","../css/timepicker.css")); + + -print ""; - -$page = "new.php"; - -if (isset($_GET['page'])) - $page = $_GET['page']; - -print "
"; -xhtml_object($page,"mainobj"); -print "
"; - - -xhtml_foot(); - -?> + + diff --git a/admin/new.php b/admin/new.php index add4bff5..91f79fca 100644 --- a/admin/new.php +++ b/admin/new.php @@ -1,33 +1,5 @@ - * @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 @@ -49,20 +21,29 @@ include ("../functions/functions.xhtml.php"); */ include("../functions/functions.input.php"); -/** - * CKEditor - */ -include("../include/ckeditor/ckeditor.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", + ); +$js_foot = array( +"../js/new.js", +"../js/custom.js" + ); +global $db; -global $db; - -xhtml_head(T_("New: Create new questionnaire"),true,false,array("../js/new.js")); +xhtml_head(T_("Create a new questionnaire"),true,$css,$js_head); if (isset($_POST['import_file'])) { - //file has been submitted - global $db; - + //file has been submitted $ras =0; $rws = 0; $testing = 0; @@ -115,61 +96,189 @@ if (isset($_POST['import_file'])) $db->Execute($sql); } - print "

" . T_("Successfully inserted") . " $name " . T_("as questionnaire") . " $qid, " . T_("linked to") . " $lime_sid

"; - }else - { - print "

" . T_("Error: Failed to insert questionnaire") . "

"; + $cl = info; + $message = T_("Successfully inserted") . " " . T_("with ID") . "  $qid,

" . T_("linked to survey") . "  $lime_sid "; + } + else{ + $cl = danger; + $message = T_("Error: Failed to insert questionnaire"); + } + + +?> + + + + + + + + + + + + -} +
-//create new questionnaire -?> - -

-

-

+

+ +
+ " title="" /> +
+
+ +GetAll($sql); +?> +
+ +
+ + + + +
+
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ " data-off="" data-width="80" /> +
+
+ +
+ +
+ " data-off="" data-width="80"/> +
+
+ +
+ +
+ " data-off="" data-onstyle="danger" data-width="80" /> +
+
+ +
+ +
+ " data-off="" data-width="80"/> +
+
+ +
+ +
+ " data-off="" data-width="80"/> +
+
+ + -if (!empty($surveys)) -{ - print ""; -} -else -{ - print "" . T_("Create an instrument in Limesurvey") .""; -} -?>

-

-

-

-

-

-

-

-

"; + echo ""; + + if (!empty($msg)) echo $msg; $sql = "SELECT extension_id as value, extension as description, CASE WHEN current_operator_id = $operator_id THEN 'selected=\'selected\'' ELSE '' END AS selected @@ -152,38 +193,79 @@ if (isset($_GET['edit'])) OR current_operator_id = $operator_id"; $ers = $db->GetAll($sql); - - ?> -
-
- -
- -
-
-
-
-
-
value="1" />
-
-
value="1" />
-
value="1" />
+ +?> + +
+ +
+
+ +
+ +
"/>
+
  + " class="btn btn-default"/>   + +
+
+ +
+ +
+
+
+ +
+
+
+ +
+
+ + +
+
+
+ +
+
+ + +
+
+
+ +
" data-off="" value="1" />
+
+
+ +
+
+
+ +
+
+
+ +
" data-off="" value="1"/>
+
+
+ +
" data-off="" value="1" />
+
-
"/>
-
-
"/>
+ + + + Execute($sql); } - if (isset($_GET['disable'])) { $operator_id = intval($_GET['disable']); @@ -264,52 +345,62 @@ if (isset($_GET['operator_id'])) if ($display) { - $sql = "SELECT - CONCAT(firstName, ' ', lastName) as name, - e.extension, - CONCAT('" . TQ_("Windows bat file") . "') as winbat, - CONCAT('" . TQ_("*nix script file") . "') as sh, - CASE WHEN enabled = 0 THEN - CONCAT('" . TQ_("Enable") . "') - ELSE - CONCAT('" . TQ_("Disable") . "') - END - as enabledisable, - CASE WHEN voip = 0 THEN - CONCAT('" . TQ_("Enable VoIP") . "') - ELSE - CONCAT('" . TQ_("Disable VoIP") . "') - END as voipenabledisable, - CONCAT('" . TQ_("Edit") . "') as edit, - username - FROM operator - LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)"; - + $sql = "SELECT operator_id, + CONCAT(firstName, ' ', lastName) as name, + CONCAT ('', e.extension ,'') as `extension`, + CONCAT('" . TQ_("Win .bat file") . "') as winbat, + CONCAT('" . TQ_("*nix script file") . "') as sh, + CASE WHEN enabled = 0 THEN + CONCAT('  ') + ELSE + CONCAT('  ') + END as enabledisable, + CASE WHEN voip = 0 THEN + CONCAT('" . TQ_("Enable VoIP") . "') + ELSE + CONCAT('" . TQ_("Disable VoIP") . "') + END as voipenabledisable, + CONCAT('  ') as edit, username + FROM operator + LEFT JOIN `extension` as e ON (e.current_operator_id = operator_id)"; + $rs = $db->GetAll($sql); - xhtml_head(T_("Operator list"),true,array("../css/table.css")); + xhtml_head(T_("Operator list"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/font-awesome/css/font-awesome.css","../css/custom.css")); + + $columns = array("operator_id","name","username","extension","enabledisable","edit"); + $titles = array("ID",T_("Operator"),T_("Username"),T_("Extension")," "," "); - $columns = array("name","username","extension","enabledisable","edit"); - $titles = array(T_("Operator"),T_("Username"),T_("Extension"),T_("Enable/Disable"),T_("Edit")); - if (VOIP_ENABLED) { - print "

" . T_("Download the file for each user and save in the same folder as the voip.exe executable. When the file is executed, it will run the voip.exe program with the correct connection details to connect the operator to the VoIP server") . "

"; - - print "

" . T_("Download Windows VoIP Executable") . "

"; - print "

" . T_("Download Linux VoIP Executable") . "

"; - $columns[] = "voipenabledisable"; $columns[] = "winbat"; $columns[] = "sh"; - $titles[] = T_("Enable/Disable VoIP"); - $titles[] = T_("Windows VoIP"); - $titles[] = T_("*nix VoIP"); + $titles[] = T_("VoIP ON/Off"); + $titles[] = T_("Win file");//Windows VoIP + $titles[] = T_("*nix flle");//*nix VoIP } - + echo "
"; xhtml_table($rs,$columns,$titles); - + echo "
"; + echo "
+ + + + + "; + + if (VOIP_ENABLED) + { + print "
" . T_("Download the file for each user and save in the same folder as the voip.exe executable. When the file is executed, it will run the voip.exe program with the correct connection details to connect the operator to the VoIP server"). "

"; + + print " " . T_("Download Win file") . "
"; + print " " . T_("Download Linux file") . "
"; + + } + print "
"; + xhtml_foot(); } ?> diff --git a/admin/operatorperformance.php b/admin/operatorperformance.php index c87ad105..0b81c3a9 100644 --- a/admin/operatorperformance.php +++ b/admin/operatorperformance.php @@ -63,16 +63,16 @@ include("../functions/functions.input.php"); */ include("../functions/functions.operator.php"); -xhtml_head(T_("Operator Performance"),true,array("../css/table.css"),array("../js/window.js")); +xhtml_head(T_("Operator Performance"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); //$rs = get_stats_total(get_stats()); //print "

" . T_("Overall") . "

"; //xhtml_table($rs,array("firstName","completions","totalcalls","time","callt","CPH","CALLSPH","effectiveness"),array(T_("Operator"),T_("Completions"),T_("Calls"),T_("Total time"),T_("Call time"),T_("Completions p/h"),T_("Calls p/h"),T_("Effectiveness"))); $questionnaire_id = false; -print "

" . T_("Please select a questionnaire") . "

"; +print "

" . T_("Please select a questionnaire") . " 

"; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); -display_questionnaire_chooser($questionnaire_id); +display_questionnaire_chooser($questionnaire_id,false,"form-inline clearfix", "form-control"); if ($questionnaire_id) { @@ -93,9 +93,9 @@ if ($questionnaire_id) $rs = $db->GetAll($sql); - print "

" . T_("Please select a shift") . "

"; + print "

" . T_("Please select a shift") . " 

"; - display_chooser($rs,"shift_id","shift_id",true,"questionnaire_id=$questionnaire_id"); + display_chooser($rs,"shift_id","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group");//,false,true,false,true,"pull-left" if ($shift_id) { @@ -106,8 +106,5 @@ if ($questionnaire_id) } xhtml_foot(); - - - ?> diff --git a/admin/operatorquestionnaire.php b/admin/operatorquestionnaire.php index 36d99cb1..8b80e3ef 100644 --- a/admin/operatorquestionnaire.php +++ b/admin/operatorquestionnaire.php @@ -106,8 +106,6 @@ function vqd($operator_id,$questionnaire_id) } - - if (isset($_POST['submit'])) { $db->StartTrans(); @@ -136,7 +134,6 @@ if (isset($_POST['submit'])) } - $sql = "SELECT questionnaire_id,description FROM questionnaire WHERE enabled = 1 @@ -144,7 +141,7 @@ $sql = "SELECT questionnaire_id,description $questionnaires = $db->GetAll($sql); -$sql = "SELECT operator_id,firstname as description +$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName ) as opname, username FROM operator WHERE enabled = 1 ORDER by operator_id ASC"; @@ -152,7 +149,7 @@ $sql = "SELECT operator_id,firstname as description $operators = $db->GetAll($sql); -xhtml_head(T_("Assign operators to questionnaires"),false,array("../css/table.css")); +xhtml_head(T_("Assign operators to questionnaires"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/iCheck/icheck.min.js")); ?> @@ -210,8 +207,6 @@ function checkQid(q) QidOn = 0; } - - function checkVid(v) { @@ -234,51 +229,51 @@ function checkVid(v) VidOn = 0; } - - + "; - -print "
"; - -print ""; +print ""; foreach($questionnaires as $q) { print ""; } -print ""; +print ""; -$class = 0; foreach($operators as $v) { - print ""; - print ""; + + print " + + "; foreach($questionnaires as $q) { $checked = ""; if (vq($v['operator_id'],$q['questionnaire_id'])) $checked="checked=\"checked\""; - print ""; + print ""; } print ""; } -print "
 " . T_("Username") . "  " . T_("Operator") . " {$q['description']}
{$v['description']}
 {$v['username']} {$v['opname']}

"; +print ""; xhtml_foot(); ?> - - + diff --git a/admin/operators.php b/admin/operators.php index 9e7c1886..8860ab08 100644 --- a/admin/operators.php +++ b/admin/operators.php @@ -49,7 +49,7 @@ global $db; $a = false; -if (isset($_POST['operator'])) +if (isset($_POST['operator']) && isset($_POST['adduser'])) { $operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc()); $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); @@ -68,8 +68,8 @@ if (isset($_POST['operator'])) $laste = $db->GetRow($sql); - $extensionn = "1000"; - $extension = "'IAX2/1000'"; + $extensionn = "2000"; + $extension = "'IAX2/2000'"; //increment if exists if (!empty($laste)) @@ -80,10 +80,10 @@ if (isset($_POST['operator'])) //generate random 8 length password $extensionnp = ""; - $length = 12; + $length = 25; $chars = "abcdefghijklmnopqrstuvwxyz0123456789"; for ($i = 0; $i < $length; $i++) - $extensionnp .= $chars[(rand() % strlen($chars))]; + $extensionnp .= $chars[(mt_rand() % strlen($chars))]; //quote for SQL $extensionp = "'$extensionnp'"; @@ -144,11 +144,12 @@ if (isset($_POST['operator'])) $htg->addUserGroup(HTGROUP_ADMIN); } - $a = T_("Added:") . " " . $operator; + $a = "

" . T_("Added operator :") . " " . $operator . "

"; if (FREEPBX_PATH !== false) $a .= "
" . T_("FreePBX has been reloaded for the new VoIP extension to take effect"); - + + print "
"; if ($temporary) { @@ -165,27 +166,26 @@ if (isset($_POST['operator'])) if ($refusal) $db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id) VALUES ('$oid','3')"); - - - } else { $a = T_("Could not add operator. There may already be an operator of this name:") . " $operator "; } - - } } -xhtml_head(T_("Add an operator")); +xhtml_head(T_("Add an operator"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css"), array("../include/jquery/jquery.min.js", "../include/bootstrap/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js")); -if ($a) -{ -?> -

-"; + //echo "

" . T_("Adding an operator here will give the user the ability to call cases") . "" . T_("Assign Operator to Questionnaire") . "" . T_("tool") . ".

"; + echo "

" . T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here.") . "

"; + echo "

" . T_("The username and extension must be unique for each operator.") . "

"; + echo ""; } $sql = "SELECT Time_zone_name as value, Time_zone_name as description @@ -198,35 +198,119 @@ $sql = "SELECT extension_id as value, extension as description WHERE current_operator_id IS NULL"; $ers = $db->GetAll($sql); - ?> -

-

.

-

-

-
-

+ + + + +
+ +
+
-

- -

-

-

"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE"))); ?>

+
+ +
+
  + " class="btn btn-default fa" />   + +
+
+ +
+ +
+
+
+ +
+
+
-

"; display_chooser($ers,"extension_id","extension_id",true,false,false,false); ?>

+ -

-

:

-

:

-

-

-

-

-

" />

+ +
+ +
" data-off="" checked="checked"/>
+
+
+ +
+
+
+ +
+
+
+ +
" data-off="" />
+
+
+ +
" data-off="" data-offstyle="danger" checked="checked"/>
+
+
+ +
" data-off="" data-onstyle="danger" data-offstyle="primary"/>
+
+
+ +
" data-off="" data-onstyle="danger" data-offstyle="primary"/>
+
+ +
" />
diff --git a/admin/operatorskill.php b/admin/operatorskill.php index 2ce676a2..40ed7bbd 100644 --- a/admin/operatorskill.php +++ b/admin/operatorskill.php @@ -105,8 +105,6 @@ function vqd($operator_id,$outcome_type_id) } - - if (isset($_POST['submit'])) { $db->StartTrans(); @@ -138,7 +136,7 @@ $sql = "SELECT outcome_type_id,description $outcome_types = $db->GetAll($sql); -$sql = "SELECT operator_id,firstname as description +$sql = "SELECT operator_id, CONCAT(firstName,' ', lastName) as description, username FROM operator WHERE enabled = 1 ORDER by operator_id ASC"; @@ -146,9 +144,10 @@ $sql = "SELECT operator_id,firstname as description $operators = $db->GetAll($sql); -xhtml_head(T_("Assign operators to Skills"),false,array("../css/table.css")); +xhtml_head(T_("Assign operators to Skills"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/iCheck/icheck.min.js")); + +print "
" . T_("Set which types of cases will be made available to each operator.
Please note that all operators will be allowed to assign all possible outcomes to a case. This restricts which ones will be assigned to an operator.") . "
"; -print "

" . T_("Set which types of cases will be made available to each operator. Please note that all operators will be allowed to assign all possible outcomes to a case. This restricts which ones will be assigned to an operator.") . "

"; ?> @@ -207,7 +206,6 @@ function checkQid(q) } - function checkVid(v) { @@ -230,51 +228,52 @@ function checkVid(v) VidOn = 0; } - - +"; -print "
"; - -print ""; +print ""; foreach($outcome_types as $q) { - print ""; + print ""; } -print ""; +print ""; -$ct = 1; foreach($operators as $v) { - print ""; - print ""; + print " + + "; foreach($outcome_types as $q) { $checked = ""; if (vq($v['operator_id'],$q['outcome_type_id'])) $checked="checked=\"checked\""; - print ""; + print ""; } print ""; } -print "
 " . T_("Username") . "  " . T_("Operator") . " " . T_($q['description']) . "" . T_($q['description']) . "
{$v['description']}
 {$v['username']} {$v['description']}

"; - +print ""; xhtml_foot(); ?> - - + diff --git a/admin/outcomes.php b/admin/outcomes.php index b857662b..26aa5208 100644 --- a/admin/outcomes.php +++ b/admin/outcomes.php @@ -1,31 +1,5 @@ - * @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 - * */ /** @@ -36,7 +10,7 @@ include_once(dirname(__FILE__).'/../config.inc.php'); /** * Database file */ -include ("../db.inc.php"); +include_once(dirname(__FILE__).'/../db.inc.php'); /** * XHTML functions @@ -73,19 +47,31 @@ $admin_operator_id = get_operator_id(); $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); - -xhtml_head(T_("Questionnaire Outcomes"),true,array("../css/table.css"),array("../js/window.js")); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", + ); +$js_foot = array( +"../js/window.js", +"../js/custom.js" + ); + +xhtml_head(T_("Questionnaire Outcomes"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") -print "

" . T_("Select a questionnaire from the list below") . "

"; - -display_questionnaire_chooser($questionnaire_id); - +print "

" . T_("Select a questionnaire") . "

"; +display_questionnaire_chooser($questionnaire_id, false, "pull-left col-sm-4", "form-control"); +print "
"; if ($questionnaire_id != false) { - print "

" . T_("Outcomes") . "

"; - - print "

" . T_("Sample status") . "

"; + //print "

" . T_("Outcomes") . "

"; + print "
" . T_("Sample status") . "
"; $sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn, count(*) as count @@ -93,34 +79,35 @@ if ($questionnaire_id != false) JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id) GROUP BY (c.sample_id is not null)"; - - xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number"))); - - print "

" . T_("Case availability (cases with temporary or appointment outcomes)") ."

"; + if ($db->GetAll($sql)) xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "table-hover table table-condensed", false, array("count")); + else print "
" . T_("No samples assigned") . ". 
"; + print "
"; + + print "
" . T_("Case availability (cases with temporary or appointment outcomes)") ."
"; $sql = "SELECT count(c.case_id) as available, si.description - FROM `case` as c - LEFT JOIN `call` as a on (a.call_id = c.last_call_id) - JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id) - JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (q.questionnaire_id = $questionnaire_id and c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and qs.questionnaire_id = q.questionnaire_id and ou.outcome_id = c.current_outcome_id) - LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end)) - LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC'))) - LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end)) - LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end) - LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id) - LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id) - LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id) - WHERE c.current_operator_id IS NULL - AND ou.outcome_type_id IN (1,5) - AND (casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end )) - AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC'))) - AND ap.case_id is NULL - AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0) - AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL AND ou.outcome_type_id != 2) - AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL AND ou.outcome_type_id != 2) - AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE case_id = c.case_id) < qs.call_attempt_max)) - AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max)) - AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0 + FROM `case` as c + LEFT JOIN `call` as a on (a.call_id = c.last_call_id) + JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id) + JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (q.questionnaire_id = $questionnaire_id and c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and qs.questionnaire_id = q.questionnaire_id and ou.outcome_id = c.current_outcome_id) + LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end)) + LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC'))) + LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end)) + LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end) + LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id) + LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id) + LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id) + WHERE c.current_operator_id IS NULL + AND ou.outcome_type_id IN (1,5) + AND (casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end )) + AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC'))) + AND ap.case_id is NULL + AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0) + AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL AND ou.outcome_type_id != 2) + AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL AND ou.outcome_type_id != 2) + AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) < qs.call_attempt_max)) + AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE `call`.case_id = c.case_id) < qs.call_max)) + AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE `questionnaire_sample_quota`.questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND `questionnaire_sample_quota`.quota_reached = 1) = 0 group by s.import_id"; @@ -128,19 +115,19 @@ group by s.import_id"; if (empty($rs)) { - print "
" . T_("No cases currently available to call") . "
"; + print "
" . T_("No cases currently available to call") . "
"; } else { xhtml_table($rs,array("description","available"),array(T_("Sample"),T_("Cases currently available to call")),"tclass",false,array("available")); } - + print "
"; + $atime = get_average_time_questionnaire(10,$questionnaire_id); $mins = intval($atime / 60); $secs = $atime % 60; - print "

" . T_("Average time on a completed questionnaire") . ": $mins " . T_("Min") . " $secs " . T_("Secs") . "

"; - + print "
" . T_("Average time on a completed questionnaire") . ": $mins " . T_("Min") . " $secs " . T_("Secs") . "
"; $sql = "SELECT o.calc, count( c.case_id ) FROM `case` AS c, `outcome` AS o @@ -151,16 +138,17 @@ group by s.import_id"; $a = $db->GetAssoc($sql); $a = aapor_clean($a); - - print ""; + print "
" . T_("Outcome") . "" . T_("Rate") . "
"; // table-hover table table-condensed print ""; print ""; print ""; print ""; - print "
" . T_("Outcome") . "" . T_("Rate") . "
" . T_("Response Rate 1") . "" . round(aapor_rr1($a),2) . "
" . T_("Refusal Rate 1") . "" . round(aapor_ref1($a),2) . "
" . T_("Cooperation Rate 1") . "" . round(aapor_coop1($a),2) . "
" . T_("Contact Rate 1") . "" . round(aapor_con1($a),2) . "
"; + print "
"; + $sql = "SELECT count(case_id) FROM `case` WHERE `case`.questionnaire_id = '$questionnaire_id'"; + $cases = $db->GetOne($sql); - $sql = "SELECT CONCAT('', o.description, '') as des, o.outcome_id, count( c.case_id ) as count, ROUND((count(c.case_id) / (SELECT count(case_id) FROM `case` WHERE questionnaire_id = '$questionnaire_id')) * 100,2) as perc + $sql = "SELECT CONCAT('', o.description, '') as des, o.outcome_id, count( c.case_id ) as count, ROUND((count( c.case_id ) / $cases) * 100,2) as perc FROM `case` AS c, `outcome` AS o WHERE c.questionnaire_id = '$questionnaire_id' AND c.current_outcome_id = o.outcome_id @@ -169,46 +157,12 @@ group by s.import_id"; $rs = $db->GetAll($sql); if (!empty($rs)) - { + { print "
"; + //print "

" . T_("Total cases for questionnaire") . " = $cases

"; translate_array($rs,array("des")); - xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc")); - - $operator_id = false; - if (isset($_GET['operator_id'])) $operator_id = bigintval($_GET['operator_id']); - - //display a list of operators - $sql = "SELECT s.operator_id as value,s.firstname as description, CASE WHEN s.operator_id = '$operator_id' THEN 'selected=\'selected\'' ELSE '' END AS selected - FROM operator as s, operator_questionnaire as q - WHERE s.operator_id = q.operator_id - AND q.questionnaire_id = '$questionnaire_id'"; - - $r = $db->GetAll($sql); - - print "

" . T_("Operator") . ": " . "

"; - if(!empty($r)) - display_chooser($r,"operator_id","operator_id",true,"questionnaire_id=$questionnaire_id"); - - if ($operator_id != false) - { - print "

" . T_("Operator call outcomes") . "

"; + xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count")," " . T_("%")),"tclass",false,array("count","perc"));//array("des" => "Complete") + print "
"; - $sql = "SELECT o.description as des, o.outcome_id, count( c.call_id ) as count, ROUND((count(c.call_id) / (SELECT count(call.call_id) FROM `call` JOIN `case` ON (call.case_id = `case`.case_id AND `case`.questionnaire_id = $questionnaire_id ) WHERE call.operator_id = '$operator_id')) * 100,2) as perc - FROM `call` AS c, `case` as ca, `outcome` AS o - WHERE ca.questionnaire_id = '$questionnaire_id' - AND ca.case_id = c.case_id - AND c.operator_id = '$operator_id' - AND c.outcome_id = o.outcome_id - GROUP BY o.outcome_id"; - - $rs = $db->GetAll($sql); - - if (!empty($rs)) - { - translate_array($rs,array("des")); - xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc")); - } - } - $sample_import_id = false; if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); @@ -221,14 +175,13 @@ group by s.import_id"; $r = $db->GetAll($sql); - print "

" . T_("Sample") . ": " . "

"; + print "

" . T_("Sample") . ": " . "

"; if(!empty($r)) - display_chooser($r,"sample_import_id","sample_import_id",true,"questionnaire_id=$questionnaire_id"); - - + display_chooser($r,"sample_import_id","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left col-sm-4"); + else print "

" . T_("No samples assigned") . "

"; if ($sample_import_id != false) { - print "

" . T_("Sample status") . "

"; + print "

" . T_("Sample status") . "

"; $sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn, count(*) as count @@ -238,13 +191,13 @@ group by s.import_id"; WHERE s.import_id = '$sample_import_id' GROUP BY (c.sample_id is not null)"; - xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number"))); + xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "tclass", false, array("count")); + print "
"; + + print "
"; //

" . T_("Outcomes") . "

"; - print "

" . T_("Outcomes") . "

"; - - - $sql = "SELECT o.description as des, o.outcome_id, count( c.case_id ) as count,ROUND(count(c.case_id) / (SELECT count(case_id) FROM `case` JOIN sample ON (`case`.sample_id = sample.sample_id AND sample.import_id = '$sample_import_id') WHERE questionnaire_id = '$questionnaire_id' ) * 100,2) as perc + $sql = "SELECT CONCAT('', o.description, '') as des, o.outcome_id, count( c.case_id ) as count,ROUND(count(c.case_id) / (SELECT count(case_id) FROM `case` JOIN sample ON (`case`.sample_id = sample.sample_id AND sample.import_id = '$sample_import_id') WHERE questionnaire_id = '$questionnaire_id' ) * 100,2) as perc FROM `case` AS c, `outcome` AS o, sample as s WHERE c.questionnaire_id = '$questionnaire_id' @@ -262,18 +215,65 @@ group by s.import_id"; } else print "

" . T_("No outcomes recorded for this sample") . "

"; + + print "
"; } - + $operator_id = false; + if (isset($_GET['operator_id'])) $operator_id = bigintval($_GET['operator_id']); + + //display a list of operators !!!worked for this questionnaire_id !!!! + $sql = "SELECT s.operator_id as value, s.firstname as description, CASE WHEN s.operator_id = '$operator_id' THEN 'selected=\'selected\'' ELSE '' END AS selected + FROM `call` as c , `operator`as s, `case` as ca + WHERE ca.questionnaire_id = '$questionnaire_id' + AND ca.case_id = c.case_id + AND c.operator_id = s.operator_id + GROUP by c.operator_id"; + + $r = $db->GetAll($sql); + + print "

" . T_("Operator") . ": " . "

"; + if(!empty($r)) + display_chooser($r,"operator_id","operator_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left col-sm-4"); + else print "

" . T_("No operators assigned") . ". 

"; + print "" ; + if ($operator_id != false) + { + print "

" . T_("Operator call outcomes") . "

"; + + $sql = "SELECT o.description as des, o.outcome_id, count( c.call_id ) as count, ROUND((count(c.call_id) / (SELECT count(call.call_id) FROM `call` JOIN `case` ON (call.case_id = `case`.case_id AND `case`.questionnaire_id = $questionnaire_id ) WHERE call.operator_id = '$operator_id')) * 100,2) as perc + FROM `call` AS c, `case` as ca, `outcome` AS o + WHERE ca.questionnaire_id = '$questionnaire_id' + AND ca.case_id = c.case_id + AND c.operator_id = '$operator_id' + AND c.outcome_id = o.outcome_id + GROUP BY o.outcome_id"; + + $rs = $db->GetAll($sql); + + if (!empty($rs)) + { + translate_array($rs,array("des")); + xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),T_("%")),"tclass",array("des" => "Complete"),array("count","perc")); + } + print "
"; + } + } else print "

" . T_("No outcomes recorded for this questionnaire") . "

"; //display a list of shifts with completions and a link to either add a report or view reports - print "

" . T_("Shifts") . "

"; + print "
"; + print "

" . T_("Shifts") . ":

"; - $sql = "SELECT s.shift_id, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."'), ' - ', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."')) as description, - CASE WHEN sr.shift_id IS NULL THEN CONCAT('" . TQ_("No shift reports: Add report") . "') ELSE CONCAT('" . TQ_("View shift reports") . "') END AS link, c.completions as completions, CONCAT('" . TQ_("View operator performance") . "') as operform + $sql = "SELECT s.shift_id, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_FORMAT . "')) as sdate,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "'),'-', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as stime, + CASE WHEN sr.shift_id IS NULL THEN + CONCAT('') + ELSE CONCAT('') + END AS link, + c.completions as completions, + CONCAT('') as operform FROM `shift` as s JOIN operator as o on (o.operator_id = '$admin_operator_id') LEFT JOIN shift_report as sr on (sr.shift_id = s.shift_id) @@ -292,15 +292,15 @@ group by s.import_id"; $r = $db->GetAll($sql); if (empty($r)) - print "

" . T_("No shifts defined for this questionnaire") . "

"; - else - xhtml_table($r,array("description","completions","link","operform"),array(T_("Shift"),T_("Completions"),T_("Shift report"),T_("Operator performance")),"tclass"); - - - + print "

" . T_("No shifts defined for this questionnaire") . "

"; + else { + print "
"; + print "
"; + xhtml_table($r,array("sdate","stime","completions","link","operform"),array(T_("Date"),T_("Shift time"),T_("Completions"),T_("Shift report"),T_("Operator performance")),"tclass"); + print "
"; + } } -xhtml_foot(); +xhtml_foot($js_foot); ?> - diff --git a/admin/questionnaireavailability.php b/admin/questionnaireavailability.php deleted file mode 100644 index 47c8e530..00000000 --- a/admin/questionnaireavailability.php +++ /dev/null @@ -1,157 +0,0 @@ - - * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 - * @package queXS - * @subpackage admin - * @link http://www.acspri.org.au 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("../config.inc.php"); - -/** - * Database file - */ -include ("../db.inc.php"); - -/** - * XHTML functions - */ -include("../functions/functions.xhtml.php"); - -/** - * Display functions - */ -include("../functions/functions.display.php"); - -/** - * Input functions - */ -include("../functions/functions.input.php"); - -global $db; - - -if (isset($_GET['questionnaire_id']) && isset($_GET['availability_group'])) -{ - //need to add availability_group to questionnaire - - $questionnaire_id = bigintval($_GET['questionnaire_id']); - $availability_group = bigintval($_GET['availability_group']); - - $sql = "INSERT INTO questionnaire_availability(questionnaire_id,availability_group_id) - VALUES('$questionnaire_id','$availability_group')"; - - $db->Execute($sql); - -} - -if (isset($_GET['questionnaire_id']) && isset($_GET['ravailability_group'])) -{ - //need to remove rsid from questionnaire - - $questionnaire_id = bigintval($_GET['questionnaire_id']); - $availability_group = bigintval($_GET['ravailability_group']); - - $sql = "DELETE FROM questionnaire_availability - WHERE questionnaire_id = '$questionnaire_id' - AND availability_group_id = '$availability_group'"; - - $db->Execute($sql); -} - - -$questionnaire_id = false; -if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); - -xhtml_head(T_("Assign availability group to questionnaire"),true,false,array("../js/window.js")); - -print "

" . T_("Assigning an availability group to a questionnaire will allow interviewers to select from those groups to restrict calls to a particular case to the times within the group") ."

"; - -print "

" . T_("Select a questionnaire from the list below") . "

"; -display_questionnaire_chooser($questionnaire_id); - - -if ($questionnaire_id != false) -{ - - $sql = "SELECT q.availability_group_id,a.description as description - FROM questionnaire_availability as q, availability_group as a - WHERE q.availability_group_id = a.availability_group_id - AND q.questionnaire_id = '$questionnaire_id'"; - - $qs = $db->GetAll($sql); - - if (empty($qs)) - { - print "

" . T_("There are no availability groups selected for this questionnaire") . "

"; - } - else - { - print "

" . T_("Availability groups selected for this questionnaire") . "

"; - foreach($qs as $q) - { - print "

{$q['availability_group_id']} - {$q['description']} (" . T_("Click to unassign") . ")

"; - } - } - - $sql = "SELECT si.availability_group_id,si.description - FROM availability_group as si - LEFT JOIN questionnaire_availability as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id) - WHERE q.questionnaire_id is NULL"; - - $qs = $db->GetAll($sql); - - if (!empty($qs)) - { - - - print "

" . T_("Add an availability group to this questionnaire:") . "

"; - ?> -
-


- - "/>

-
- diff --git a/admin/questionnairecatimeslots.php b/admin/questionnairecatimeslots.php deleted file mode 100644 index 5a563af3..00000000 --- a/admin/questionnairecatimeslots.php +++ /dev/null @@ -1,157 +0,0 @@ - - * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 - * @package queXS - * @subpackage admin - * @link http://www.acspri.org.au 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("../config.inc.php"); - -/** - * Database file - */ -include ("../db.inc.php"); - -/** - * XHTML functions - */ -include("../functions/functions.xhtml.php"); - -/** - * Display functions - */ -include("../functions/functions.display.php"); - -/** - * Input functions - */ -include("../functions/functions.input.php"); - -global $db; - - -if (isset($_GET['questionnaire_id']) && isset($_GET['availability_group'])) -{ - //need to add availability_group to questionnaire - - $questionnaire_id = bigintval($_GET['questionnaire_id']); - $availability_group = bigintval($_GET['availability_group']); - - $sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id) - VALUES('$questionnaire_id','$availability_group')"; - - $db->Execute($sql); - -} - -if (isset($_GET['questionnaire_id']) && isset($_GET['ravailability_group'])) -{ - //need to remove rsid from questionnaire - - $questionnaire_id = bigintval($_GET['questionnaire_id']); - $availability_group = bigintval($_GET['ravailability_group']); - - $sql = "DELETE FROM questionnaire_timeslot - WHERE questionnaire_id = '$questionnaire_id' - AND availability_group_id = '$availability_group'"; - - $db->Execute($sql); -} - - -$questionnaire_id = false; -if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); - -xhtml_head(T_("Assign call attempt time slots to questionnaire"),true,false,array("../js/window.js")); - -print "

" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."

"; - -print "

" . T_("Select a questionnaire from the list below") . "

"; -display_questionnaire_chooser($questionnaire_id); - - -if ($questionnaire_id != false) -{ - - $sql = "SELECT q.availability_group_id,a.description as description - FROM questionnaire_timeslot as q, availability_group as a - WHERE q.availability_group_id = a.availability_group_id - AND q.questionnaire_id = '$questionnaire_id'"; - - $qs = $db->GetAll($sql); - - if (empty($qs)) - { - print "

" . T_("There are no call attempt time slots selected for this questionnaire") . "

"; - } - else - { - print "

" . T_("Call attempt time slots selected for this questionnaire") . "

"; - foreach($qs as $q) - { - print "

{$q['availability_group_id']} - {$q['description']} (" . T_("Click to unassign") . ")

"; - } - } - - $sql = "SELECT si.availability_group_id,si.description - FROM availability_group as si - LEFT JOIN questionnaire_timeslot as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id) - WHERE q.questionnaire_id is NULL"; - - $qs = $db->GetAll($sql); - - if (!empty($qs)) - { - - - print "

" . T_("Add a call attempt time slot to this questionnaire:") . "

"; - ?> -
-


- - "/>

-
- diff --git a/admin/questionnairecatimeslotssample.php b/admin/questionnairecatimeslotssample.php deleted file mode 100644 index 49c151ba..00000000 --- a/admin/questionnairecatimeslotssample.php +++ /dev/null @@ -1,172 +0,0 @@ - - * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 - * @package queXS - * @subpackage admin - * @link http://www.acspri.org.au 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("../config.inc.php"); - -/** - * Database file - */ -include ("../db.inc.php"); - -/** - * XHTML functions - */ -include("../functions/functions.xhtml.php"); - -/** - * Display functions - */ -include("../functions/functions.display.php"); - -/** - * Input functions - */ -include("../functions/functions.input.php"); - -global $db; - - -if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['availability_group'])) -{ - //need to add availability_group to questionnaire - - $questionnaire_id = bigintval($_GET['questionnaire_id']); - $sample_import_id = bigintval($_GET['sample_import_id']); - $availability_group = bigintval($_GET['availability_group']); - - $sql = "INSERT INTO questionnaire_sample_timeslot (questionnaire_id,sample_import_id,availability_group_id) - VALUES('$questionnaire_id','$sample_import_id','$availability_group')"; - - $db->Execute($sql); - -} - -if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['ravailability_group'])) -{ - //need to remove rsid from questionnaire - - $questionnaire_id = bigintval($_GET['questionnaire_id']); - $sample_import_id = bigintval($_GET['sample_import_id']); - $availability_group = bigintval($_GET['ravailability_group']); - - $sql = "DELETE FROM questionnaire_sample_timeslot - WHERE questionnaire_id = '$questionnaire_id' - AND sample_import_id = '$sample_import_id' - AND availability_group_id = '$availability_group'"; - - - $db->Execute($sql); -} - - -$questionnaire_id = false; -if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); - -xhtml_head(T_("Assign call attempt time slots to questionnaire sample"),true,false,array("../js/window.js")); - -print "

" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."

"; - -print "

" . T_("Select a questionnaire from the list below") . "

"; -display_questionnaire_chooser($questionnaire_id); - - -if ($questionnaire_id != false) -{ - print "

" . T_("Select a sample from the list below") . "

"; - - $sample_import_id = false; - if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); - display_sample_chooser($questionnaire_id,$sample_import_id); - - if ($sample_import_id !== false) - { - - $sql = "SELECT q.availability_group_id,a.description as description - FROM questionnaire_sample_timeslot as q, availability_group as a - WHERE q.availability_group_id = a.availability_group_id - AND q.questionnaire_id = '$questionnaire_id' - AND q.sample_import_id = '$sample_import_id'"; - - $qs = $db->GetAll($sql); - - if (empty($qs)) - { - print "

" . T_("There are no call attempt time slots selected for this questionnaire sample") . "

"; - } - else - { - print "

" . T_("Call attempt time slots selected for this questionnaire sample") . "

"; - foreach($qs as $q) - { - print "

{$q['availability_group_id']} - {$q['description']} (" . T_("Click to unassign") . ")

"; - } - } - - $sql = "SELECT si.availability_group_id,si.description - FROM availability_group as si - LEFT JOIN questionnaire_sample_timeslot as q ON (q.sample_import_id = '$sample_import_id' AND q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id) - WHERE q.questionnaire_id is NULL"; - - $qs = $db->GetAll($sql); - - if (!empty($qs)) - { - - - print "

" . T_("Add a call attempt time slot to this questionnaire sample:") . "

"; - ?> -
-


- - - "/>

-
- diff --git a/admin/questionnairelist.php b/admin/questionnairelist.php index 14e8ab7f..3d35487c 100644 --- a/admin/questionnairelist.php +++ b/admin/questionnairelist.php @@ -32,23 +32,38 @@ /** * Configuration file */ -include ("../config.inc.php"); +include("../config.inc.php"); /** * Database file */ -include ("../db.inc.php"); +include("../db.inc.php"); /** * XHTML functions */ -include ("../functions/functions.xhtml.php"); +include("../functions/functions.xhtml.php"); + +/** + * Input functions + */ +include("../functions/functions.display.php"); /** * Input functions */ include("../functions/functions.input.php"); +/** + * CKEditor + */ +include("../functions/functions.limesurvey.php"); + +/** + * Operator functions + */ +include("../functions/functions.operator.php"); + /** * CKEditor */ @@ -56,6 +71,23 @@ include("../include/ckeditor/ckeditor.php"); global $db; +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js" + ); +$js_foot = array( +"../js/new.js", +"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", +"../js/bootstrap-confirmation.js", +"../js/custom.js" + ); if (isset($_POST['questionnaire_id']) && isset($_POST['submit'])) { @@ -208,7 +240,6 @@ if (isset($_POST['questionnaire_id']) && isset($_POST['submit'])) $db->Execute($sql); $db->CompleteTrans(); - } if (isset($_GET['disable'])) @@ -246,7 +277,7 @@ if (isset($_POST['update']) && isset($_GET['modify'])) if (isset($_POST['rws'])) $rws = 1; if (isset($_POST['respsc'])) $respsc = 1; if (isset($_POST['referral'])) $referral = 1; - + $name = $db->qstr(html_entity_decode($_POST['description'],ENT_QUOTES,'UTF-8')); if (isset($_POST['rs_intro'])) { @@ -259,7 +290,6 @@ if (isset($_POST['update']) && isset($_GET['modify'])) $info = $db->qstr(html_entity_decode($_POST['info'],ENT_QUOTES,'UTF-8')); $rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],ENT_QUOTES,'UTF-8')); - $sql = "UPDATE questionnaire SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', self_complete = $respsc, referral = $referral WHERE questionnaire_id = '$questionnaire_id'"; @@ -271,7 +301,6 @@ if (isset($_POST['update']) && isset($_GET['modify'])) $sql = "UPDATE questionnaire SET rs_intro = $rs_intro, rs_project_intro = $rs_project_intro, rs_callback = $rs_callback, rs_answeringmachine = $rs_answeringmachine WHERE questionnaire_id = '$questionnaire_id'"; - $db->Execute($sql); } @@ -284,42 +313,17 @@ if (isset($_POST['update']) && isset($_GET['modify'])) $sql = "UPDATE questionnaire SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl WHERE questionnaire_id = $questionnaire_id"; - $db->Execute($sql); } - } -xhtml_head(T_("Questionnaire list"),true,array("../css/table.css"),array("../js/new.js")); - - if (isset($_GET['modify'])) { $questionnaire_id = intval($_GET['modify']); - $CKEditor = new CKEditor(); - $CKEditor->basePath = "../include/ckeditor/"; - - $ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"), - array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"), - array("Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"), - "/", - array("Bold","Italic","Underline","Strike","-","Subscript","Superscript"), - array("NumberedList","BulletedList","-","Outdent","Indent","Blockquote"), - array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'), - array('BidiLtr', 'BidiRtl'), - array('Link','Unlink','Anchor'), - array('Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'), - "/", - array('Styles','Format','Font','FontSize'), - array('TextColor','BGColor'), - array('About')), - "extraPlugins" => "tokens"); - $sql = "SELECT * FROM questionnaire WHERE questionnaire_id = $questionnaire_id"; - $rs = $db->GetRow($sql); $referral = $testing = $rws = $ras = $rsc = "checked=\"checked\""; @@ -330,7 +334,6 @@ if (isset($_GET['modify'])) if ($rs['lime_mode'] == "question") $qbq = "selected=\"selected\""; if ($rs['lime_mode'] == "group") $gat = "selected=\"selected\""; - if ($rs['restrict_appointments_shifts'] != 1) $ras = ""; if ($rs['restrict_work_shifts'] != 1) $rws = ""; if ($rs['testing'] != 1) $testing = ""; @@ -340,49 +343,168 @@ if (isset($_GET['modify'])) $rsc = ""; $rscd = "style='display:none;'"; } + + xhtml_head(T_("Modify Questionnaire "),true,$css,$js_head, false, false, false, "  " . "$rs[description]" . ""); - echo "

" . $rs['description'] . "

"; - echo "

" . T_("Go back") . "

"; - echo "

" . T_("Edit instrument in Limesurvey") . "

"; - ?> -
-

-

/>

-

/>

-

/>

-

/>

-

onchange="if(this.checked==true) show(this,'limesc'); else hide(this,'limesc');" />

-
> -

:

-

:

-

:

+ $CKEditor = new CKEditor(); + $CKEditor->basePath = "../include/ckeditor/"; + + $ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"), + array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"), + array("Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"), + array('Link','Unlink','Anchor'), + array('Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'), + array('About'), + "/", + array("Bold","Italic","Underline","Strike","-","Subscript","Superscript"), + array("NumberedList","BulletedList","-","Outdent","Indent","Blockquote"), + array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'), + array('BidiLtr', 'BidiRtl'), + array('Styles','Format','Font','FontSize'), + array('TextColor','BGColor')), + "extraPlugins" => "tokens"); +?> +
+ +
+
 " . T_("Edit instrument in Limesurvey") . " "; ?>
+
+ + +
+ +
"/>
+
+
+ +
data-toggle="toggle" data-on="" data-off="" data-width="80"/>
+
+
+
data-toggle="toggle" data-on="" data-off="" data-width="80"/>
+
+
+ +
" data-off="" data-onstyle="danger" data-width="80"/>
+
+
+ +
data-toggle="toggle" data-on="" data-off="" data-width="80"/>
+
+
+ +
onchange="if(this.checked==true) {show(this,'limesc'); $('#url').attr('required','required');} else{ hide(this,'limesc'); $('#url').removeAttr('required');}" data-toggle="toggle" data-on="" data-off="" data-width="80"/>
+
+
> +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
- -

editor("rs_intro",$rs['rs_intro'],$ckeditorConfig);?>

-

editor("rs_project_intro",$rs['rs_project_intro'],$ckeditorConfig);?>

-

editor("rs_callback",$rs['rs_callback'],$ckeditorConfig);?>

-

editor("rs_answeringmachine",$rs['rs_answeringmachine'],$ckeditorConfig);?>

- " . T_("Edit respondent selection instrument in Limesurvey") . "

"; } ?> -

editor("rs_project_end",$rs['rs_project_end'],$ckeditorConfig); ?>

-

editor("info",$rs['info'],$ckeditorConfig); ?>

-

"/>

- - +
+ + +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_intro",$rs['rs_intro'],$ckeditorConfig);?> +
+
+
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_project_intro",$rs['rs_project_intro'],$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_callback",$rs['rs_callback'],$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_answeringmachine",$rs['rs_answeringmachine'],$ckeditorConfig);?> +
+
+ + " . T_("Edit respondent selection instrument in Limesurvey") . "
"; } +?> + +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("rs_project_end",$rs['rs_project_end'],$ckeditorConfig);?> +
+
+ +
+
+ " style="margin-top: -5px;"> +

+
+
+ editor("info",$rs['info'],$ckeditorConfig);?> +
+
+ + + "/> + + +GetRow($sql); - - echo "

" . $rs['description'] . "

"; - echo "

" . T_("Go back") . "

"; + xhtml_head(T_("Delete Questionnaire"),true,$css,$js_head, false, false, false, " " . "$rs[description]" . ""); - print "

" . T_("Any collected data and the limesurvey instrument will NOT be deleted") . "

"; + print "

" . T_("Any collected data and the limesurvey instrument will NOT be deleted") . "

"; print "

" . T_("The questionnaire will be deleted from queXS including call history, cases, case notes, respondent details, appointments and the links between operators, clients and the questionnaire") . "

"; - print "

" . T_("Please confirm you wish to delete the questionnaire") . "

"; + print "

" . T_("Please confirm you wish to delete the questionnaire") . "

"; print "
"; - print "

"; + print "

   " . T_("Go back") . ""; print "

"; print "
"; } else { - $columns = array("description","enabledisable","modify","deletee"); - $titles = array(T_("Questionnaire"),T_("Enable/Disable"),T_("Modify"),T_("Delete")); - - $sql = "SELECT - description, - CASE WHEN enabled = 0 THEN - CONCAT('" . TQ_("Enable") . "') - ELSE - CONCAT('" . TQ_("Disable") . "') - END - as enabledisable, - CONCAT('" . TQ_("Modify"). "') as modify, - CONCAT('" . TQ_("Delete"). "') as deletee + xhtml_head(T_("Questionnaire management"),true,$css,$js_head, false, false, false, "Questionnaire list"); + echo ""; + print "
"; // add timeslots, callattempts, quotas? + + $sql = "SELECT + CONCAT(' ',questionnaire_id,' ') as qid, + CONCAT('

',description,'

') as description, + CASE WHEN enabled = 0 THEN + CONCAT(' " . TQ_("Disabled") . " ') + ELSE + CONCAT(' " . TQ_("Enabled") . " ') + END as status, + CASE WHEN enabled = 0 THEN + CONCAT('  ') + ELSE + CONCAT('  ') + END as enabledisable, + CONCAT('') as modify, + CONCAT('') as inlime, + CASE WHEN enabled = 0 THEN + CONCAT('') + ELSE + CONCAT('') + END as shifts, + CASE WHEN enabled = 0 THEN + CONCAT('') + ELSE + CONCAT('') + END as prefill, + CASE WHEN enabled = 1 THEN + CONCAT('') + ELSE + CONCAT('') + END as deletee, + CASE WHEN enabled = 0 THEN + CONCAT('') + ELSE + CONCAT('') + END as outcomes, + CONCAT('') as calls, + CASE WHEN enabled = 0 THEN + CONCAT('') + ELSE + CONCAT('') + END as dataout, + CASE WHEN enabled = 0 THEN + CONCAT('') + ELSE + CONCAT('') + END as assample, + CASE WHEN enabled = 0 THEN + CONCAT('') + ELSE + CONCAT('') + END as casestatus FROM questionnaire"; - $rs = $db->GetAll($sql); - + + $columns = array("qid","description","status","enabledisable","outcomes","calls","casestatus","shifts","assample","dataout","modify","inlime","prefill","deletee"); + xhtml_table($rs,$columns,false,"table-hover table-condensed "); - xhtml_table($rs,$columns,$titles); +print "
"; } - - -xhtml_foot(); - - +xhtml_foot($js_foot); ?> + diff --git a/admin/questionnaireprefill.php b/admin/questionnaireprefill.php index 48f68870..94dbff31 100644 --- a/admin/questionnaireprefill.php +++ b/admin/questionnaireprefill.php @@ -96,18 +96,19 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_prefill_id']) $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); -xhtml_head(T_("Pre fill questionnaire: Set values for questionnaire to prefill"),true,false,array("../js/window.js")); -print "

" . T_("Select a questionnaire from the list below") . "

"; +xhtml_head(T_("Pre fill questionnaire: Set values for questionnaire to prefill"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); +print "

" . T_("Select a questionnaire") . ": 

"; -$sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected +$sql = "SELECT questionnaire_id as value,description, + CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM questionnaire WHERE enabled = 1"; -display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id"); +display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline form-group"); if ($questionnaire_id != false) { - print "

" . T_("Current pre fills (click to delete)") . "

"; + print "

" . T_("Current pre fills") . "

"; $sql = "SELECT questionnaire_prefill_id,lime_sgqa,value FROM questionnaire_prefill @@ -117,19 +118,18 @@ if ($questionnaire_id != false) if (empty($r)) { - print "

" . T_("Currently no pre fills") . "

"; + print "

" . T_("Currently no pre fills") . "

"; } else { foreach($r as $v) { - print "
{$v['lime_sgqa']}: {$v['value']}
"; - + print "

    " . T_("SGQA code") . ": {$v['lime_sgqa']}

    " . T_("Sample variable") . ": {$v['value']}

    " . T_("Delete") . "
"; } } + print ""; - - print "

" . T_("Select a question to pre fill") . "

"; + print "

" . T_("Select a question to pre fill") . " 

"; $sql = "SELECT lime_sid FROM questionnaire @@ -143,7 +143,7 @@ if ($questionnaire_id != false) if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa']; $sql = "SELECT CONCAT( q.sid, 'X', q.gid, 'X', q.qid) AS value, - CASE WHEN qo.question IS NULL THEN q.question ELSE CONCAT(qo.question,' : ',q.question) END as description, + CONCAT( q.sid, 'X', q.gid, 'X', q.qid, ' -> ' , CASE WHEN qo.question IS NULL THEN q.question ELSE CONCAT(qo.question,' : ',q.question) END) as description, CASE WHEN CONCAT(q.sid, 'X', q.gid, 'X', q.qid) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM `" . LIME_PREFIX . "questions` AS q LEFT JOIN `" . LIME_PREFIX . "questions` as qo ON (qo.qid = q.parent_qid) @@ -154,45 +154,43 @@ if ($questionnaire_id != false) for ($i=0; $i
"; + if ($sgqa != false) { - print "

" . T_("Enter a value to pre fill this question with:") . "

"; - print "

"; + print "

" . T_("Enter a value to pre fill this question with:") . "

"; + print "

"; print T_("Possible uses:"); print "

"; - $sql = "SELECT sv.var as description, CONCAT('{Sample:', sv.var, '}') as value - FROM `sample` AS s, sample_var AS sv, questionnaire_sample as qs + $sql = "SELECT sivr.var as description, CONCAT('{Sample:', sivr.var, '}') as value + FROM `sample_import_var_restrict` as sivr, questionnaire_sample as qs WHERE qs.questionnaire_id = '$questionnaire_id' - AND s.import_id = qs.sample_import_id - AND s.sample_id = sv.sample_id - GROUP BY sv.var"; - - print ""; + AND sivr.sample_import_id = qs.sample_import_id"; ?> -
-

-
- + + + GetAll($sql),"svar","svar",true,false,false,false,false); -?>
- + display_chooser($db->GetAll($sql),"svar","svar",true,false,false,true,false,true,"form-group"); +?> + - "/>

+ "/>
diff --git a/admin/quota.php b/admin/quota.php index 33073da8..fce93b21 100755 --- a/admin/quota.php +++ b/admin/quota.php @@ -106,32 +106,41 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_sample_quota_ $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); -xhtml_head(T_("Quota management"),true,false,array("../js/window.js")); -print "

" . T_("Select a questionnaire from the list below") . "

"; +xhtml_head(T_("Quota management"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); +print "

" . T_("Questionnaire") . ": 

"; $sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM questionnaire WHERE enabled = 1"; -display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id"); - +display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline pull-left "); if ($questionnaire_id != false) { $sample_import_id = false; if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); - print "

" . T_("Select a sample from the list below") . "

"; + $sql = "SELECT s.sample_import_id as value,s.description, CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM sample_import as s, questionnaire_sample as q WHERE q.questionnaire_id = $questionnaire_id AND q.sample_import_id = s.sample_import_id"; + $s = $db->GetAll($sql); + if (!empty($s)){ + + print "

   " . T_("Sample") . ":  

"; + display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left"); + + } else { + print "
" . T_("No samples assigned to this questionnaire.") . "
"; + + } - display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id"); - + print "
"; + if ($sample_import_id != false) { - print "

" . T_("Current quotas (click to delete)") . "

"; + print "

" . T_("Current quotas") . ":

";//(click to delete) $sql = "SELECT questionnaire_sample_quota_id,lime_sgqa,value,completions,quota_reached,lime_sid,comparison FROM questionnaire_sample_quota as qsq, questionnaire as q @@ -143,7 +152,7 @@ if ($questionnaire_id != false) if (empty($r)) { - print "

" . T_("Currently no quotas") . "

"; + print "

" . T_("Currently no quotas") . "

"; } else { @@ -164,7 +173,7 @@ if ($questionnaire_id != false) } - print "

" . T_("Select a question for the quota") . "

"; + print "

" . T_("Select a question for the quota") . "

"; $sql = "SELECT lime_sid FROM questionnaire @@ -177,52 +186,76 @@ if ($questionnaire_id != false) $sgqa = false; if (isset($_GET['sgqa'])) $sgqa = $_GET['sgqa']; - $sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value, CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END, ' -> ' , CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ' : ', lq.question) END) as description, CASE WHEN CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected + $sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value, + CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END, ' -> ' , CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ' : ', lq.question) END) as description, + CASE WHEN CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) = '$sgqa' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM `" . LIME_PREFIX . "questions` AS lq LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid ) JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid) WHERE lq.sid = '$lime_sid' ORDER BY CASE WHEN lq2.question_order IS NULL THEN lq.question_order ELSE lq2.question_order + (lq.question_order / 1000) END ASC"; - - - display_chooser($db->GetAll($sql),"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id"); + + display_chooser($db->GetAll($sql),"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-group"); + + print "
"; if ($sgqa != false) { - print "

" . T_("Enter the details for creating the quota:") . "

"; - print "

" . T_("Pre defined values for this question:") . "

"; + + print "

" . T_("Enter the details for creating the quota:") . "

"; + + ?> +
+ +

+

+ +

+

+ +

+

+ + + + + +

" class="btn btn-primary fa"/>

+
+ "; + + print "

" . T_("Code values for this question") . ":

"; $qid = explode("X", $sgqa); $qid = $qid[2]; - $sql = "SELECT l.code,l.answer as title + $sql = "SELECT CONCAT(' ', l.code , '')as code,l.answer as title FROM `" . LIME_PREFIX . "answers` as l WHERE l.qid = '$qid'"; $rs = $db->GetAll($sql); if (!isset($rs) || empty($rs)) - print "

" . T_("No labels defined for this question") ."

"; + print "

" . T_("No labels defined for this question") ."

"; else xhtml_table($rs,array('code','title'),array(T_("Code value"), T_("Description"))); - - - ?> -
-

-
-
-
- - - - "/>

-
- "; + } } } + xhtml_foot(); - ?> diff --git a/admin/quotareport.php b/admin/quotareport.php index d4318c87..a915574d 100644 --- a/admin/quotareport.php +++ b/admin/quotareport.php @@ -106,19 +106,20 @@ if (isset($_POST['submit'])) $db->CompleteTrans(); } -xhtml_head(T_("Quota report"),true,array("../css/table.css"),array("../js/window.js")); +xhtml_head(T_("Quota report"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/font-awesome/css/font-awesome.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/bootstrap/js/bootstrap.min.js","../include/iCheck/icheck.min.js","../js/window.js")); + +print "

" . T_("Select a questionnaire") . ": 

"; -print "

" . T_("Select a questionnaire from the list below") . "

"; $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); -display_questionnaire_chooser($questionnaire_id); +display_questionnaire_chooser($questionnaire_id,false,"form-inline form-group", "form-control"); if ($questionnaire_id) { - print "

" . T_("Select a sample from the list below") . "

"; + print "

" . T_("Select a sample") . ": 

"; $sample_import_id = false; if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); - display_sample_chooser($questionnaire_id,$sample_import_id); + display_sample_chooser($questionnaire_id,$sample_import_id,false,"form-inline form-group clearfix", "form-control"); if ($sample_import_id) { @@ -142,40 +143,7 @@ if ($questionnaire_id) //Rows to display: Strata Status Quota Sample Sample Used Sample Remaining Completes % Complete - // Firstly, for the entire sample - //We need to calc Sample size, Sample drawn, Sample remain, Completions, %complete - $sql = "SELECT (c.sample_id is not null) as type, count(*) as count - FROM sample as s - JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) - LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id) - WHERE s.import_id = '$sample_import_id' - GROUP BY (c.sample_id is not null)"; - - $rs = $db->GetAll($sql); - - //type == 1 is drawn from sample, type == 0 is remains in sample - $drawn = 0; - $remain = 0; - - foreach ($rs as $r) - { - if ($r['type'] == 1) $drawn = $r['count']; - if ($r['type'] == 0) $remain = $r['count']; - } - - $sql = "SELECT count(*) as count - FROM `case` as c, sample as s - WHERE c.current_outcome_id = 10 - AND s.import_id = '$sample_import_id' - AND s.sample_id = c.sample_id - AND c.questionnaire_id = '$questionnaire_id'"; - - $rs = $db->GetRow($sql); - - $completions = $rs['count']; - - $report[] = array("strata" => T_("Total sample"), "quota" => $drawn + $remain, "sample" => $drawn + $remain, "sampleused" => $drawn, "sampleremain" => $remain, "completions" => $completions, "perc" => ROUND(($completions / ($drawn + $remain)) * 100,2)); //a. (Standard quota) Monitor outcomes of questions in completed questionnaires, and exclude selected sample records when completion limit is reached //b. (Replicate quota) Exclude selected sample records (where no qsqr_question rows) @@ -199,13 +167,12 @@ if ($questionnaire_id) $perc = ($v['completions'] <= 0 ? 0 : ROUND(($completions / ($v['completions'])) * 100,2)); - //We need to calc Sample size, Sample drawn, Sample remain $sql = "SELECT (c.sample_id is not null) as type, count(*) as count FROM sample as s JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) "; - $sql2 = "SELECT exclude_val,exclude_var,comparison + $sql2 = "SELECT exclude_val,exclude_var,exclude_var_id,comparison FROM qsqr_sample WHERE questionnaire_sample_quota_row_id = {$v['questionnaire_sample_quota_row_id']}"; @@ -215,7 +182,7 @@ if ($questionnaire_id) $x = 1; foreach($rev as $ev) { - $sql .= " JOIN sample_var as sv$x ON (sv$x.sample_id = s.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; + $sql .= " JOIN sample_var as sv$x ON (sv$x.sample_id = s.sample_id AND sv$x.var_id = '{$ev['exclude_var_id']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; $x++; } @@ -237,19 +204,19 @@ if ($questionnaire_id) if ($completions < $v['completions']) //if completions less than the quota, allow for closing/opening { if ($v['quota_reached'] == 1) - $status = "" . T_("closed") . ""; + $status = "" . T_("closed") . ""; else - $status = "" . T_("open") . ""; + $status = "" . T_("open") . " "; } else { if ($v['quota_reached'] == 1) - $status = T_("closed"); + $status = "" . T_("closed") . ""; else - $status = T_("open"); + $status = "" . T_("open") . " "; } - $report[] = array("strata" => "" . $v['description'] . "", "status" => $status, "quota" => $v['completions'], "sample" => $drawn + $remain, "sampleused" => $drawn, "sampleremain" => $remain, "completions" => $completions, "perc" => $perc, "priority" => "", "autoprioritise" => ""); + $report[] = array("strata" => "" . $v['description'] . "", "status" => $status, "quota" => $v['completions'], "sample" => $drawn + $remain, "sampleused" => $drawn, "sampleremain" => $remain, "completions" => $completions, "perc" => $perc, "priority" => "", "autoprioritise" => "  "); } //c. (Questionnaire quota) Monitor outcomes of questions in completed questionnaires, and abort interview when completion limit is reached @@ -287,14 +254,60 @@ if ($questionnaire_id) $report[] = array("strata" => "" . $r['name'] . "", "quota" => $r['qlimit'], "completions" => $completions, "perc" => $perc); } + + // At the end - > the entire sample + + //We need to calc Sample size, Sample drawn, Sample remain, Completions, %complete + $sql = "SELECT (c.sample_id is not null) as type, count(*) as count + FROM sample as s + JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) + LEFT JOIN `case` as c ON (c.questionnaire_id = qs.questionnaire_id and c.sample_id = s.sample_id) + WHERE s.import_id = '$sample_import_id' + GROUP BY (c.sample_id is not null)"; + + $rs = $db->GetAll($sql); + + //type == 1 is drawn from sample, type == 0 is remains in sample + $drawn = 0; + $remain = 0; + + foreach ($rs as $r) + { + if ($r['type'] == 1) $drawn = $r['count']; + if ($r['type'] == 0) $remain = $r['count']; + } + + $sql = "SELECT count(*) as count + FROM `case` as c, sample as s + WHERE c.current_outcome_id = 10 + AND s.import_id = '$sample_import_id' + AND s.sample_id = c.sample_id + AND c.questionnaire_id = '$questionnaire_id'"; + + $rs = $db->GetRow($sql); + + $completions = $rs['count']; + + $report[] = array("strata" => T_("Total sample"), "quota" => $drawn + $remain, "sample" => $drawn + $remain, "sampleused" => $drawn, "sampleremain" => $remain, "completions" => $completions, "perc" => ROUND(($completions / ($drawn + $remain)) * 100,2)); + print "
"; - xhtml_table($report,array("strata","status","quota","sample","sampleused","sampleremain","completions","perc","priority","autoprioritise"),array(T_("Strata"),T_("Status"),T_("Quota"),T_("Sample"),T_("Sample Used"),T_("Sample Remaining"),T_("Completions"),T_("% Complete"),T_("Set priority"),T_("Auto prioritise")),"tclass",false,false); - print "

"; + xhtml_table($report,array("strata","status","quota","sample","sampleused","sampleremain","completions","perc","priority","autoprioritise"),array(T_("Strata"),T_("Status"),T_("Quota"),T_("Sample"),T_("Sample Used"),T_("Sample Remaining"),T_("Completions"),T_("% Complete"),T_("Set priority"),T_("Auto prioritise")),"tclass",false,false); + + if (count($report) > 1) + print "
+ "; + + print ""; } } -xhtml_foot(); - - +xhtml_foot(array("../js/custom.js")); ?> + + diff --git a/admin/quotarow.php b/admin/quotarow.php index 4e42eb12..ce222500 100755 --- a/admin/quotarow.php +++ b/admin/quotarow.php @@ -103,7 +103,7 @@ if (isset($_POST['submitexport'])) $q2 = $db->GetAll($sql); - $sql = "SELECT exclude_var as samplerecord,comparison,exclude_val as value + $sql = "SELECT exclude_var_id, exclude_var as samplerecord,comparison,exclude_val as value FROM qsqr_sample WHERE questionnaire_sample_quota_row_id = $tmp"; @@ -177,6 +177,7 @@ if (isset($_GET['delete'])) if (isset($_POST['add_quota'])) +/* if (isset($_GET['questionnaire_id']) && isset($_GET['sgqa']) && isset($_GET['value']) && isset($_GET['completions']) && isset($_GET['sample_import_id']) && isset($_GET['comparison']) && isset($_GET['exclude_var_id']) && isset($_GET['exclude_var']) && isset($_GET['exclude_val'])) */ { //need to add quota $completions = intval($_POST['completions']); @@ -247,12 +248,15 @@ if (isset($_GET['qsqri']) & isset($_GET['edit'])) if (isset($_POST['adds'])) { - $comparison = $db->qstr($_POST['comparisons']); - $exvar = $db->qstr(substr($_POST['sample_var'],12,strpos($_POST['sample_var'],'&')-12)); + $exvar_id = $db->qstr(substr($_POST['sample_var_id'],15,strpos($_POST['sample_var_id'],'&')-15)); + $exvar = $db->qstr($_POST['sample_var']); $exval = $db->qstr($_POST['exclude_val']); + $comparison = $db->qstr($_POST['comparisons']); + $description = $db->qstr($_POST['description']); + //add ssample - $sql = "INSERT INTO qsqr_sample (questionnaire_sample_quota_row_id,exclude_var,exclude_val,comparison) - VALUES ($qsqri,$exvar,$exval,$comparison)"; + $sql = "INSERT INTO qsqr_sample (questionnaire_sample_quota_row_id,exclude_var_id,exclude_var,exclude_val,comparison,description) + VALUES ($qsqri,$exvar_id,$exvar,$exval,$comparison,$description)"; $db->Execute($sql); @@ -262,12 +266,13 @@ if (isset($_GET['qsqri']) & isset($_GET['edit'])) if (isset($_POST['addq'])) { - $comparison = $db->qstr($_POST['comparison']); - $value = $db->qstr($_POST['value']); $sgqa = $db->qstr(substr($_POST['sgqa'],6,strpos($_POST['sgqa'],'&')-6)); + $value = $db->qstr($_POST['value']); + $comparison = $db->qstr($_POST['comparison']); + $description = $db->qstr($_POST['description']); //add ssample - $sql = "INSERT INTO qsqr_question (questionnaire_sample_quota_row_id,lime_sgqa,value,comparison) - VALUES ($qsqri,$sgqa,$value,$comparison)"; + $sql = "INSERT INTO qsqr_question (questionnaire_sample_quota_row_id,lime_sgqa,value,comparison,description) + VALUES ($qsqri,$sgqa,$value,$comparison,$description)"; $db->Execute($sql); @@ -279,28 +284,36 @@ if (isset($_GET['qsqri']) & isset($_GET['edit'])) $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); -xhtml_head(T_("Quota row management"),true,array("../css/table.css"),array("../js/window.js")); -print "

" . T_("Select a questionnaire from the list below") . "

"; +xhtml_head(T_("Quota row management"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../include/font-awesome/css/font-awesome.css","../include/iCheck/skins/square/blue.css","../css/custom.css"),array("../include/jquery/jquery.min.js","../include/bootstrap/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../include/iCheck/icheck.min.js","../js/window.js")); +print "

" . T_("Questionnaire") . ": 

"; $sql = "SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM questionnaire WHERE enabled = 1"; -display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id"); - +display_chooser($db->GetAll($sql),"questionnaire","questionnaire_id", true,false,true,true,false,true,"form-inline pull-left "); if ($questionnaire_id != false) { $sample_import_id = false; if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); - - print "

" . T_("Select a sample from the list below") . "

"; $sql = "SELECT s.sample_import_id as value,s.description, CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM sample_import as s, questionnaire_sample as q WHERE q.questionnaire_id = $questionnaire_id AND q.sample_import_id = s.sample_import_id"; + $s = $db->GetAll($sql); + if (!empty($s)){ + print "

   " . T_("Sample") . ": 

"; - display_chooser($db->GetAll($sql),"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id"); + display_chooser($s,"sample","sample_import_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"pull-left"); + } else { + print "
" . T_("No samples assigned to this questionnaire.") . "
"; + } + + print ""; + + print "
"; + if ($sample_import_id != false) { @@ -314,10 +327,10 @@ if ($questionnaire_id != false) if (count($data) > 2) { //one quota record per row - $completions = intval($data[1]); + $description = $db->quote($data[0]); + $completions = intval($data[1]); $autoprioritise = 0; if ($data[2] != 0) $autoprioritise = 1; - $description = $db->quote($data[0]); $sql = "INSERT INTO questionnaire_sample_quota_row(questionnaire_id, sample_import_id, completions, description, priority, autoprioritise) VALUES ($questionnaire_id, $sample_import_id, $completions, $description, 50, $autoprioritise)"; @@ -346,12 +359,13 @@ if ($questionnaire_id != false) else { //is a sample variable - $comparison = $db->qstr($data[($i*3) + 1]); - $value = $db->qstr($data[($i*3) + 2]); - $var = $db->qstr($data[$i*3]); + $var_id = $db->qstr($data[$i*3]); + $var = $db->qstr($data[($i*3) + 1]); + $comparison = $db->qstr($data[($i*3) + 2]); + $value = $db->qstr($data[($i*3) + 3]); - $sql = "INSERT INTO qsqr_sample (questionnaire_sample_quota_row_id,exclude_var,exclude_val,comparison) - VALUES ($qq,$var,$value,$comparison)"; + $sql = "INSERT INTO qsqr_sample (questionnaire_sample_quota_row_id,exclude_var_id,exclude_var,exclude_val,comparison) + VALUES ($qq,$var_id,$var,$value,$comparison)"; $db->Execute($sql); } @@ -366,42 +380,43 @@ if ($questionnaire_id != false) } } - - if ($qsqri != false) { + print "

 " . T_("To Row quotas") . "

"; print "

" . T_("Quota") . ": $qsqrid

"; - print "

" . T_("Go back") . "

"; - + ?> -
" method="post"> -

-
-
- />
-
+

+ " method="post" class="form-inline table"> +

  

+

  data-toggle="toggle" data-on="" data-off="" data-offstyle="warning"/>

- "/>

+

+
" . TQ_("Delete") . "') as qdelete + CONCAT('  ') as qdelete FROM qsqr_question WHERE questionnaire_sample_quota_row_id = $qsqri"; - - + $rs = $db->GetAll($sql); - + + print "
"; + print "

" . T_("Restrictions based on answered questions") . "

"; + print "
"; + if (empty($rs)) { - print "

" . T_("All completed responses that match the sample criteria below will be counted towards the quota") . "

"; + print "

" . T_("Currently NO Restrictions based on answered questions") . "

" . T_("All completed responses that match the sample criteria below will be counted towards the quota") . "

"; } else { - print "

" . T_("Only completed responses that have answered the following will be counted") . "

"; - xhtml_table($rs,array('lime_sgqa','comparison','value','qdelete'),array(T_("Question"),T_("Comparison"),T_("Value"),T_("Delete"))); + print "

" . T_("Only completed responses that have answered the following will be counted") . "

"; + xhtml_table($rs,array('description','lime_sgqa','comparison','value','qdelete'),array(T_("Description"),T_("SGQ code"),T_("Comparison"),T_("Value"),"  ")); + print "
"; } //add questionnaire references if any (refer to sample only or count completions based on responses to questions) @@ -417,101 +432,136 @@ if ($questionnaire_id != false) $ssgqa = $db->qstr($_GET['sgqa']); //select question - $sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value, CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END, ' -> ' , CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ' : ', lq.question) END) as description, CASE WHEN $ssgqa LIKE CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) THEN 'selected=\'selected\'' ELSE '' END AS selected + $sql = "SELECT CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) as value, CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END, ' -> ' , CASE WHEN lq.parent_qid = 0 THEN lq.question ELSE CONCAT(lq2.question, ' : ', lq.question) END) as description, CASE WHEN $ssgqa LIKE CONCAT( lq.sid, 'X', lq.gid, 'X', CASE WHEN lq.parent_qid = 0 THEN lq.qid ELSE CONCAT(lq.parent_qid, lq.title) END) THEN 'selected=\'selected\'' ELSE '' END AS selected FROM `" . LIME_PREFIX . "questions` AS lq LEFT JOIN `" . LIME_PREFIX . "questions` AS lq2 ON ( lq2.qid = lq.parent_qid ) JOIN `" . LIME_PREFIX . "groups` as g ON (g.gid = lq.gid) WHERE lq.sid = '$lime_sid' - ORDER BY CASE WHEN lq2.question_order IS NULL THEN lq.question_order ELSE lq2.question_order + (lq.question_order / 1000) END ASC "; + ORDER BY CASE WHEN lq2.question_order IS NULL THEN lq.question_order ELSE lq2.question_order + (lq.question_order / 1000) END ASC"; - $rs = $db->GetAll($sql); + $rsgqa = $db->GetAll($sql); - if (!empty($rs)) + if (!empty($rsgqa)) { - print "
"; - print "

" . T_("Add restriction based on answered questions") . "

"; - print ""; - display_chooser($rs,"sgqa","sgqa",false,"edit=edit&qsqri=$qsqri",true,false); + print "
"; + print "

" . T_("Add restriction based on answered questions") . "

"; + print ""; + display_chooser($rsgqa,"sgqa","sgqa",true,"edit=edit&qsqri=$qsqri"); + + if (isset($_GET['sgqa'])){ ?> -

-
- "/> - +
+

+   

+

+

+

" . T_("Code values for this question") . ": 

"; + + $rs = ""; + if (isset($_GET['sgqa'])) + { + $sgqa = $_GET['sgqa']; + $qid = explode("X", $sgqa); + $qid = $qid[2]; + + $sql = "SELECT CONCAT(' ', l.code , '')as code, l.answer as title + FROM `" . LIME_PREFIX . "answers` as l + WHERE l.qid = '$qid'"; + $rsc = $db->GetAll($sql); + } + if (!isset($rsc) || empty($rsc)) + print "

" . T_("No labels defined for this question") ."

"; + else + xhtml_table($rsc,array('code','title'),array(T_("Code value"), T_("Description"))); + } + else { print ""; } + print "
"; } - + print "
"; + //list sample records to exclude - $sql = "SELECT qsqr_sample_id,exclude_var,exclude_val,comparison,description, - CONCAT('" . TQ_("Delete") . "') as sdelete + $sql = "SELECT qsqr_sample_id,exclude_var_id,exclude_var,exclude_val,comparison,description, + CONCAT('  ') as sdelete FROM qsqr_sample WHERE questionnaire_sample_quota_row_id = $qsqri"; $rs = $db->GetAll($sql); - + + print "
"; + print "

" . T_("Restrictions based on sample records") . "

"; + print "
"; if (empty($rs)) { - print "

" . T_("All sample records will be excluded") . "

"; + print "

" . T_("Currently NO Restrictions based on sample records") . "

" . T_("This sample will be limited to number of competions set in quota") . "

" . T_("Caling cases for this sample will be stopped when the quota is reached") . "

"; } else { - print "

" . T_("Completed responses that have the following sample details will be counted towards the quota and excluded when the quota is reached") . "

"; - xhtml_table($rs,array('exclude_var','comparison','exclude_val','sdelete'),array(T_("Sample record"),T_("Comparison"),T_("Value"),T_("Delete"))); + print "

" . T_("Completed responses that have the following sample details will be counted towards the quota and excluded when the quota is reached") . "

"; + xhtml_table($rs,array('description','exclude_var_id','exclude_var','comparison','exclude_val','sdelete'),array(T_("Description"),T_("Sample var ID"),T_("Sample variable"),T_("Comparison"),T_("Value"),"  ")); + print "
"; } - - $ssample_var = "''"; - if (isset($_GET['sample_var'])) - $ssample_var = $db->qstr($_GET['sample_var']); + $ssample_var_id = "''"; + if (isset($_GET['sample_var_id'])) $ssample_var_id = $db->qstr($_GET['sample_var_id']); //add sample references (records from sample to exclude when quota reached) - $sql = "SELECT sv.var as value, sv.var as description, CASE WHEN sv.var LIKE $ssample_var THEN 'selected=\'selected\'' ELSE '' END AS selected - FROM sample_var AS sv, sample AS s - WHERE s.import_id = $sample_import_id + $sql = "SELECT sivr.var_id as value, sivr.var as description, + CASE WHEN sivr.var_id = $ssample_var_id THEN 'selected=\'selected\'' ELSE '' END AS selected + FROM `sample_import_var_restrict` as sivr, `sample_var` AS sv, `sample` AS s + WHERE sivr.sample_import_id = $sample_import_id AND s.sample_id = sv.sample_id - GROUP BY sv.var"; + AND sivr.var_id = sv.var_id + GROUP BY sivr.var_id"; - $rs = $db->GetAll($sql); + $rsvi = $db->GetAll($sql); - if (!empty($rs)) + if (!empty($rsvi)) { - if ($ssample_var == "''") - $ssample_var = "'" . $rs[0]['value']. "'"; + if ($ssample_var_id == "''") + $ssample_var_id = $rsvi[0]['value']; - print "

" . T_("Add restriction based on sample records") . "

"; - print "
"; - print ""; - display_chooser($rs,"sample_var","sample_var",false,"edit=edit&qsqri=$qsqri",true,false); - ?> -

- - GetAll($sql),"exclude_val","exclude_val",false,false,false,false); - flush(); - ?> -
"/> -
+ print "

" . T_("Add restriction based on sample records") . "

"; + print "
"; + print "

: "; + display_chooser($rsvi,"sample_var_id","sample_var_id",true,"edit=edit&qsqri=$qsqri",true,false); + + if (isset($_GET['sample_var_id'])){ + ?> + +  :   + + GetAll($sql); + $sample_var = $val[0]['var']; + display_chooser($val,"exclude_val","exclude_val",false,false,false,false); + flush(); + ?> +  

+

+ +

";} + print "
"; } + print "
"; } else { - - - print "

" . T_("Current row quotas (click to edit)") . "

"; - - - $sql = "SELECT questionnaire_sample_quota_row_id,qsq.description, - CONCAT('', qsq.description, '') as qedit, - CONCAT('') as qselect, + $sql = "SELECT questionnaire_sample_quota_row_id,qsq.description, + CONCAT('  ') as qedit, + CONCAT('
') as qselect, qsq.completions,qsq.quota_reached,qsq.current_completions, CASE WHEN qsq.autoprioritise = 1 THEN '" . TQ_("Yes") . "' ELSE '" . TQ_("No") . "' END AS ap, qsq.priority, CASE WHEN qsq.quota_reached = 1 THEN '" . TQ_("closed") . "' ELSE '" . TQ_("open") . "' END AS status @@ -519,48 +569,58 @@ if ($questionnaire_id != false) WHERE qsq.questionnaire_id = '$questionnaire_id' AND qsq.sample_import_id = '$sample_import_id' AND q.questionnaire_id = '$questionnaire_id'"; - $r = $db->GetAll($sql); - print "
"; if (empty($r)) { - print "

" . T_("Currently no row quotas") . "

"; + print "

" . T_("Currently no row quotas") . "

"; } else { - xhtml_table($r,array('qedit','completions','current_completions','status','priority','ap','qselect'),array(T_("Description"),T_("Quota"),T_("Completions"),T_("Status"),T_("Priority"),T_("Auto prioritise"),T_("Select"))); - print ""; - print ""; - - //select sample - + print ""; + print "

" . T_("Current row quotas") . "

"; + xhtml_table($r,array('description','qedit','completions','current_completions','status','priority','ap','qselect'),array(T_("Description"),"  ",T_("Quota"),T_("Completions"),T_("Status"),T_("Priority"),T_("Auto prioritise"),"  ")); + print "

"; + print "

"; + print "
"; + print "
"; } - print ""; - print "

" . T_("Add row quota") . "

"; - ?> -
" method="post"> -

-
-
-
-
- "/>

-
- " . T_("Import row quota") . ""; + print "

" . T_("Add row quota") . "

"; ?> -
" method="post"> -

-

-

"/>

-
+
" method="post" class="form-inline table"> +

+

+

+

" data-off="" data-offstyle="warning"/>

+

+
+
+

" . T_("Import row quota") . "

"; +$ua = $_SERVER['HTTP_USER_AGENT']; +if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv"; + ?> +
" method="post"> + +

+

..." accept=""/>

+ +
+
+ + diff --git a/admin/samplecallattempts.php b/admin/samplecallattempts.php index 2be2415c..5cf2a794 100644 --- a/admin/samplecallattempts.php +++ b/admin/samplecallattempts.php @@ -80,7 +80,7 @@ function sample_call_attempt_report($questionnaire_id = false, $sample_id = fals if ($qsqri !== false) { - $sql2 = "SELECT exclude_val,exclude_var,comparison + $sql2 = "SELECT exclude_val,exclude_var,exclude_var_id,comparison FROM qsqr_sample WHERE questionnaire_sample_quota_row_id = $qsqri"; @@ -90,7 +90,7 @@ function sample_call_attempt_report($questionnaire_id = false, $sample_id = fals $x = 1; foreach($rev as $ev) { - $qs .= " JOIN sample_var as sv$x ON (sv$x.sample_id = c.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; + $qs .= " JOIN sample_var as sv$x ON (sv$x.sample_id = c.sample_id AND sv$x.var_id = '{$ev['exclude_var_id']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; $x++; } } @@ -117,8 +117,8 @@ function sample_call_attempt_report($questionnaire_id = false, $sample_id = fals translate_array($outcomes,array("description")); - $rep = array("sample","callattempts"); - $rept = array(T_("Number of cases"),T_("Call attempts made")); + $rep = array("callattempts","sample"); + $rept = array(T_("Call attempts made"),T_("Number of cases")); $totals = array("sample"); $outcomesfilled = array(); @@ -176,17 +176,17 @@ function sample_call_attempt_report($questionnaire_id = false, $sample_id = fals } xhtml_table($overall,$rep,$rept,"tclass",false,$totals); - + print "
"; return true; } -xhtml_head(T_("Sample call attempt"),true,array("../css/table.css"),array("../js/window.js")); +xhtml_head(T_("Sample call attempt"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); -print "

" . T_("Please select a questionnaire") . "

"; +print "

" . T_("Please select a questionnaire") . " 

"; $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = intval($_GET['questionnaire_id']); -display_questionnaire_chooser($questionnaire_id,array(-1,T_("Overall"))); +display_questionnaire_chooser($questionnaire_id,array(-1,T_("Overall")),"form-inline clearfix", "form-control"); if ($questionnaire_id || $questionnaire_id == -1) @@ -195,10 +195,10 @@ if ($questionnaire_id || $questionnaire_id == -1) { if ($questionnaire_id != -1) { - print "

" . T_("Please select a sample") . "

"; + print "

" . T_("Please select a sample") . " 

"; $sample_import_id = false; if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); - display_sample_chooser($questionnaire_id,$sample_import_id); + display_sample_chooser($questionnaire_id,$sample_import_id,false,"form-inline clearfix", "form-control"); if ($sample_import_id) { @@ -206,24 +206,24 @@ if ($questionnaire_id || $questionnaire_id == -1) { $questionnaire_sample_quota_row_id = false; if (isset($_GET['questionnaire_sample_quota_row_id'])) $questionnaire_sample_quota_row_id = bigintval($_GET['questionnaire_sample_quota_row_id']); - print "

" . T_("Please select a quota") . "

"; - display_quota_chooser($questionnaire_id,$sample_import_id,$questionnaire_sample_quota_row_id); + print "

" . T_("Please select a quota") . " 

"; + display_quota_chooser($questionnaire_id,$sample_import_id,$questionnaire_sample_quota_row_id,"form-inline clearfix", "form-control"); if ($questionnaire_sample_quota_row_id) { if (!sample_call_attempt_report($questionnaire_id,$sample_import_id,$questionnaire_sample_quota_row_id)) - print "

" . T_("No calls for this quota") . "

"; + print "

" . T_("No calls for this quota") . "

"; } } else - print "

" . T_("No calls for this sample") . "

"; + print "

" . T_("No calls for this sample") . "

"; } } } else - print "

" . T_("No calls for this questionnaire") . "

"; + print "

" . T_("No calls for this questionnaire") . "

"; } -xhtml_foot(); +xhtml_foot("../js/custom.js"); ?> diff --git a/admin/samplelist.php b/admin/samplelist.php index 1e63e2af..3acd3f08 100644 --- a/admin/samplelist.php +++ b/admin/samplelist.php @@ -44,197 +44,400 @@ include_once(dirname(__FILE__).'/../db.inc.php'); */ include_once(dirname(__FILE__).'/../functions/functions.xhtml.php'); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +"../include/bootstrap-toggle/css/bootstrap-toggle.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../include/bootstrap-toggle/js/bootstrap-toggle.min.js", + ); +$js_foot = array( +"../js/bootstrap-confirmation.js", +"../js/custom.js" + ); - -if (isset($_POST['submitr'])) +if (isset($_POST['ren'])) { $sample_import_id = intval($_POST['sample_import_id']); + unset($_POST['ren']); + unset($_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; + $_GET['edit'] = $sample_import_id; } -if (isset($_POST['submit'])) + +if (isset($_POST['ed'])) { $sample_import_id = intval($_POST['sample_import_id']); - unset($_POST['submit']); + unset($_POST['ed']); 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)"; +// print_r($_POST). "
"; //ïîñìîòðèì ÷åãî îòðàâëÿåòñÿ - $db->Execute($sql); + if (isset($_POST['del']) && isset($_POST['type']) ) { + $a = array(); $b = array(); $cert = array(); $a = $_POST['type']; + + //echo "

type before unset->>"; foreach($_POST['type'] as $key => $val) { echo ' | ', $key,' => ',$val,' | '; }; print "

"; + foreach($_POST['del'] as $p) { + unset ($_POST['type'][$p]); + $deleted[] = $p; + } + $b = $_POST['type']; $cert = array_diff_assoc($a, $b); + + foreach($cert as $key => $val ) { + + if ($val == 3 || $val==4 || $val == 5 || $val == 6 || $val == 7){ + echo "
", 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'])){ - $_GET['edit'] = $sample_import_id; -} - -if (isset($_POST['submitvp'])) -{ - $sample_import_id = intval($_POST['sample_import_id']); + //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;} + else { echo "
", T_("Please check that One and One Only Primary Phone number is selected"), "
";} + + if (( ($pcd +$st) <= 2 )&&($pcd == 1 || $st == 1)) {$ch2 = true;} + else { echo "
", T_("Please check selected types for Postcode and/or State"), "
";} +// ! need to add DB tables check for existing timezone data in tables and additional check if prefix_timezone selected + if (( ($fn + $ln) <= 2 )&&($fn == 1 || $ln == 1)) {$ch3 = true;} + else { echo "
", T_("Please check selected types for Firstname and/or Lastname"), "
";} + if ($eml < 2) {$ch4 = true;} + else { echo "
", T_("Too many e-mail fields. Please check selected types for E-mail."), "
"; } + + 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(); - unset($_POST['submitvp']); - unset($_POST['sample_import_id']); + 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"), "
"; + } + unset($_POST['del']); + + $db->CompleteTrans(); - $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); + } + } + else { + echo "
", T_("Smth wrong with selected field types.
Please check again var types selection and/or fields that you supposed to delete."), "
"; + //exit (); } } - - 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") . "

"; - - ?> -
- -
-
"/>
-
- $val) + {// echo '| ',$p,' => ',$val,'+ '; + $v = str_replace(" ", "_", $val); + + $sql = "UPDATE sample_import_var_restrict + SET `var` = '$v' + WHERE sample_import_id = $sample_import_id + AND `var_id` = $p"; + $db->Execute($sql); + } + + unset($_POST['var']); + } + + if (isset($_POST['see'])){ + + $sql = "UPDATE sample_import_var_restrict + SET `restrict` = 1 + WHERE sample_import_id = $sample_import_id"; + $db->Execute($sql); + + foreach($_POST['see'] as $p => $val) + {// echo $p,' => ',$val,' + '; + $sql = "UPDATE sample_import_var_restrict + SET `restrict` = 0 + WHERE sample_import_id = $sample_import_id + AND `var_id` = $val"; + $db->Execute($sql); + } + unset($_POST['see']); + } + + unset($_POST['type']); + + $_GET['edit'] = $sample_import_id; + +} + +if (isset($_GET['delete_sample'])){ + + $sample_import_id = $_GET['delete_sample']; + + // -->check questionnaire_sample - unassign sample if assigned + $sql = "SELECT questionnaire_id FROM `questionnaire_sample` WHERE sample_import_id = $sample_import_id"; + $rs = $db->GetAll($sql); + if (count($rs) != 0){ + echo "
", T_("Sample $sample_import_id is still assigned to questionnaire.
Please unassign sample prior to delete."), "
"; + } + else{ + //get the string list of sample_id's + $sql = "SELECT sample_id FROM `sample` where import_id = $sample_import_id"; + $rs = $db->GetAll($sql); + for($i=0;$i<=count($rs)-1;$i++){ $samimdel[] = $rs[$i]['sample_id'] ;} + $samimdel_s = implode(",",$samimdel); + + $db->StartTrans(); + + //del from questionnaire_sample_exclude_priority + $sql = "DELETE FROM `questionnaire_sample_exclude_priority` WHERE sample_id IN ($samimdel_s)"; + $db->Execute($sql); + + //del from questionnaire_sample_quota + $sql = "DELETE FROM `questionnaire_sample_quota` WHERE sample_import_id = $sample_import_id"; + $db->Execute($sql); + + //del from questionnaire_sample_quota_row + $sql = "DELETE FROM `questionnaire_sample_quota_row` WHERE sample_import_id = $sample_import_id"; + $db->Execute($sql); + + //del from questionnaire_sample_quota_row_exclude + $sql = "DELETE FROM `questionnaire_sample_quota_row_exclude` WHERE sample_id IN ($samimdel_s)"; + $db->Execute($sql); + + //del from questionnaire_sample_timeslot + $sql = "DELETE FROM `questionnaire_sample_timeslot` WHERE sample_import_id = $sample_import_id"; + $db->Execute($sql); + + //delete from sample_var + $sql = "DELETE FROM `sample_var` WHERE sample_id IN ($samimdel_s)"; + $db->Execute($sql); + + //del from sample_import_var_restrict + $sql = "DELETE FROM `sample_import_var_restrict` WHERE sample_import_id = $sample_import_id"; + $db->Execute($sql); + + //del from sample + $sql = "DELETE FROM `sample` WHERE import_id = $sample_import_id"; + $db->Execute($sql); + + //del from sample_import + $sql = "DELETE FROM `sample_import` WHERE sample_import_id = $sample_import_id"; + $db->Execute($sql); + + $db->CompleteTrans(); + + if (mysql_errno() == 0){echo "
", T_("Sample $sample_import_id was deleted."), "
"; } + else {echo "
ERROR ".mysql_errno()." ".mysql_error()."\n
";} + } + + unset($_GET['delete_sample']); + $samimdel_s = ''; } -if (isset($_GET['edit'])) +if (isset($_GET['edit']) ) { - xhtml_head(T_("Deidentify"),true,array("../css/table.css")); + $subtitle=T_("Rename, Set viewing permissions & Manage sample variables") ; + xhtml_head(T_("Sample management"),true,$css,$js_head,false,false,false,$subtitle); + + echo "
 " . T_("Go back") . "
"; + + $sample_import_id = intval($_GET['edit']); + + $sql = "SELECT * FROM sample_import WHERE sample_import_id = $sample_import_id"; + $sd = $db->GetRow($sql); + + if($sd['enabled'] == 1) $dis = disabled; // -> disable edit and delete if sample is enabled - $sample_import_id = intval($_GET['edit']); - - $sql = "SELECT si.description, sv.val, sv.var, - CONCAT('') as box - FROM sample_import as si, sample_var as sv, sample as s + $sql = "SELECT type, description + FROM sample_var_type"; + $rd = $db->GetAll($sql); + + $sql = "SELECT sir.var_id, + CONCAT('') as var, + CONCAT ('') as type, sv.val, + CONCAT('') as see, + CONCAT('') as del, + sir.restrict IS NULL as existss + FROM sample_import as si, sample_var as sv, sample as s, sample_import_var_restrict as sir, sample_var_type as svt WHERE si.sample_import_id = $sample_import_id + AND sir.sample_import_id = si.sample_import_id + AND sir.var_id = sv.var_id AND sv.sample_id = s.sample_id AND s.import_id = si.sample_import_id - GROUP BY sv.var"; - + AND svt.type = sir.type + GROUP BY sir.var_id"; $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.") . "

"; - - ?> -
- -
-
"/>
-
-

" . T_("Sample") . ": " . $sd['description'] . " ID $sample_import_id

"; + print "
 " . T_("Search this sample") . "
"; + print "
"; + if($sd['enabled'] == 0){ - xhtml_foot(); - exit(); +?> +
+
+

+
/>
+
+
+
+
+ +
+ +
+
+
+
+
+ +

" . T_("Select which fields from this sample to deidentify.

Deidentified fields will be permanently deleted from the sample.") . "

"; + } +else +{ + print ""; + + /*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 "
"; + } + } + 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(); +} + if (isset($_GET['sampledisable'])) { $id = intval($_GET['sampledisable']); @@ -242,7 +445,6 @@ if (isset($_GET['sampledisable'])) $sql = "UPDATE sample_import SET enabled = 0 WHERE sample_import_id = '$id'"; - $db->Execute($sql); } @@ -253,32 +455,52 @@ if (isset($_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"; + CONCAT(' ',sample_import_id,' ') as id, + CASE WHEN enabled = 0 THEN + CONCAT('  " . TQ_("Disabled") . " ') + ELSE + CONCAT('  " . TQ_("Enabled") . " ') + END as status, + CASE WHEN enabled = 0 THEN + CONCAT('" . TQ_("Enable") . " ') + ELSE + CONCAT('  " . TQ_("Disable") . " ') + END + as enabledisable, + CASE WHEN enabled = 1 THEN + CONCAT('') + ELSE + CONCAT(' + + ') + END as did, + CASE WHEN enabled = 1 THEN + CONCAT('') + ELSE + CONCAT('') + END as delsample, + CONCAT('') as ssearch, + CONCAT('') as calls, + 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); -$rs = $db->GetAll($sql); +$subtitle=T_("Sample list"); +xhtml_head(T_("Sample management"),true,$css,$js_head,false,false,false,$subtitle); +echo "
+  " . T_("Go back") . " +  " . T_("Import a sample file") . " +
"; +$columns = array("id","description","cnt","status","enabledisable","calls","did","ssearch","delsample"); //"vp","rname", +//$titles = array(T_("ID"),T_("Sample"),T_("Records"), T_("Call History"),T_("Enable/Disable"), T_("Status"), T_("Deidentify"), T_("View"), T_("Rename"), T_("Search"), T_("Delete sample")); +xhtml_table($rs,$columns, false, "table-hover table-condensed "); -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(); +xhtml_foot($js_foot); ?> + diff --git a/admin/samplesearch.php b/admin/samplesearch.php index 4e2fedd0..0946786e 100644 --- a/admin/samplesearch.php +++ b/admin/samplesearch.php @@ -46,14 +46,71 @@ include ("../db.inc.php"); */ include("../functions/functions.xhtml.php"); - /** * Input functions */ include("../functions/functions.input.php"); global $db; +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +/* "../include/bootgrid/jquery.bootgrid.css", */ +"../include/bs-data-table/css/jquery.bdt.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +/* "../include/bootgrid/jquery.bootgrid.min.js", */ + ); +$js_foot = array( +"../include/bs-data-table/js/vendor/jquery.sortelements.js", +"../include/bs-data-table/js/jquery.bdt.js", +"../js/window.js", +"../js/custom.js" + ); + +$sample_import_id = false; +if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); + +$subtitle = T_("Search within this sample"); + +xhtml_head(T_("Search the sample"),true,$css,$js_head); + +?> + + " . T_("Go back") . ""; + +$sql = "SELECT sample_import_id as value,description, CASE WHEN sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected + FROM sample_import"; +$r = $db->GetAll($sql); + +if(!empty($r)) + + print "

" . T_("Select sample ") . " 

"; + display_chooser($r,"sample_import_id","sample_import_id",true,false,true,false); + + print "
"; if (isset($_GET['sample_id'])) { @@ -65,102 +122,84 @@ if (isset($_GET['sample_id'])) $sql = "DELETE FROM sample_var WHERE sample_id = '$sample_id'"; - $db->Execute($sql); $sql = "DELETE FROM sample WHERE sample_id = '$sample_id'"; - $db->Execute($sql); $db->CompleteTrans(); + + print ""; } - -$sample_import_id = false; -if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']); - -xhtml_head(T_("Search sample"),true,array("../css/table.css"),array("../js/window.js")); -print "

" . T_("Select a sample from the list below") . "

"; - -$sql = "SELECT sample_import_id as value,description, CASE WHEN sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected - FROM sample_import"; - -$r = $db->GetAll($sql); - -if(!empty($r)) - display_chooser($r,"sample_import_id","sample_import_id"); +print "
"; if ($sample_import_id != false) { - if (isset($_GET['search'])) - { - $search = $db->qstr($_GET['search']); - - $sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN CONCAT('" . TQ_("No cases yet assigned: Delete this sample record") . "') ELSE CONCAT('" . TQ_("Assigned to questionnaire: ") . "', q.description, '') END as link + $sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN + CONCAT('  ') + ELSE CONCAT('', c.case_id ,'') + END as link FROM sample_var AS sv JOIN (sample as s) ON (s.import_id = '$sample_import_id' and sv.sample_id = s.sample_id) LEFT JOIN (`case` AS c, questionnaire AS q) ON ( c.sample_id = sv.sample_id AND q.questionnaire_id = c.questionnaire_id ) - WHERE sv.val LIKE $search - GROUP BY s.sample_id,c.case_id"; - + GROUP BY s.sample_id, c.case_id"; $r = $db->GetAll($sql); + + if ($r) { - if (empty($r)) - print "

" . T_("No records in this sample match this search criteria") . "

"; - else - { - //add sample information to results - $sql = "SELECT var - FROM sample_var - WHERE sample_id = {$r[0]['sample_id']}"; - - $rs = $db->GetAll($sql); $fnames = array("sample_id"); $fdesc = array(T_("Sample id")); - + + $fnames[] = "link"; + $fdesc[] = T_("Case ID"); + + $sql = "SELECT var,var_id + FROM sample_import_var_restrict + WHERE sample_import_id = $sample_import_id + ORDER by var ASC"; + $rs = $db->GetAll($sql); + foreach($rs as $rsw) { - $fnames[] = $rsw['var']; + $fnames[] = $rsw['var_id']; $fdesc[] = $rsw['var']; } - - $fnames[] = "link"; - $fdesc[] = T_("Link"); - foreach($r as &$rw) { - $sql = "SELECT var,val + $sql = "SELECT var_id,val FROM sample_var WHERE sample_id = {$rw['sample_id']}"; - $rs = $db->GetAll($sql); + foreach($rs as $rsw){ + $rw[$rsw['var_id']] = $rsw['val']; + } + } - foreach($rs as $rsw) - $rw[$rsw['var']] = $rsw['val']; - } - - xhtml_table($r,$fnames,$fdesc); + print "
"; + xhtml_table($r,$fnames,$fdesc,"tclass",false,false,"bs-table"); + print "
"; } - - } - - print "

" . T_("Search within this sample") . "

"; - - print "

" . T_("Use the % character as a wildcard") ."

"; - - ?> -
-

-
- - "/> -

-
-

" . T_("There's no data in this sample.") . "

"; } -xhtml_foot(); - - +xhtml_foot($js_foot); ?> + diff --git a/admin/shiftreport.php b/admin/shiftreport.php index 165a136b..ba0e9822 100644 --- a/admin/shiftreport.php +++ b/admin/shiftreport.php @@ -58,14 +58,14 @@ include("../functions/functions.operator.php"); */ include("../functions/functions.input.php"); -xhtml_head(T_("Shift reports"),true,array("../css/table.css"),array("../js/window.js")); +xhtml_head(T_("Shift reports"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); $operator_id = get_operator_id(); print "

" . T_("Please select a questionnaire") . "

"; $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); -display_questionnaire_chooser($questionnaire_id); +display_questionnaire_chooser($questionnaire_id ,false,"form-inline clearfix", "form-control"); if ($questionnaire_id) { @@ -85,7 +85,7 @@ if ($questionnaire_id) $r = $db->GetAll($sql); if (!empty($r)) - display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id"); + display_chooser($r,"shift","shift_id",true,"questionnaire_id=$questionnaire_id",true,true,false,true,"form-inline form-group"); if ($shift_id) { diff --git a/admin/shifttemplate.php b/admin/shifttemplate.php index 8c7eca1b..58370145 100644 --- a/admin/shifttemplate.php +++ b/admin/shifttemplate.php @@ -44,19 +44,33 @@ include ("../db.inc.php"); */ include ("../functions/functions.xhtml.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", +"../include/clockpicker/dist/bootstrap-clockpicker.min.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js", +"../js/addrow-v2.js", + ); +$js_foot = array( +"../include/clockpicker/dist/bootstrap-clockpicker.js", +"../js/custom.js" + ); + global $db; $year="2008"; $woy="1"; - if (isset($_POST['day'])) { $db->StartTrans(); $sql = "DELETE FROM shift_template WHERE 1"; - $db->Execute($sql); foreach($_POST['day'] as $key => $val) @@ -69,73 +83,77 @@ if (isset($_POST['day'])) $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); $end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc()); - $sql = "INSERT INTO shift_template (day_of_week,start,end) - VALUES ('$val',$start,$end)"; - + $sql = "INSERT INTO shift_template(day_of_week,start,end) + VALUES ($val,$start,$end)"; $db->Execute($sql); } } - $db->CompleteTrans(); } -xhtml_head(T_("Modify shift template"),true,array("../css/shifts.css"),array("../js/addrow-v2.js")); +xhtml_head(T_("Set default shift times"),true,$css,$js_head);//T_("Modify shift template"),array("../css/shifts.css"),array("../js/addrow-v2.js") + +$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria' + +$rs = $db->GetRow($sql); + +if (empty($rs) || !$rs || empty($rs['t'])) + print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; /** * Display warning if timezone data not installed * */ -$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t"; -$rs = $db->GetRow($sql); - -if (empty($rs) || !$rs || empty($rs['t'])) - print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; - - -print "

" . T_("Enter standard shift start and end times for each day of the week in local time") . "

"; +//print "

" . T_("Set default shift times") . "

"; +print "
" . T_("Enter standard shift start and end times for each day of the week in local time") . "
"; /** * Begin displaying currently loaded shifts */ -$sql = "SELECT DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W' ) AS dt,day_of_week,start,end +$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT('$year',' ','$woy',' ',day_of_week -1),'%x %v %w'), '%W') AS dt,day_of_week,start,end FROM shift_template"; $shifts = $db->GetAll($sql); translate_array($shifts,array("dt")); -$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected +$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year,' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected FROM day_of_week"; $daysofweek = $db->GetAll($sql); translate_array($daysofweek,array("description")); ?> -
- +
+
"; + print ""; $count = 0; foreach($shifts as $shift) { - print ""; + print " + + "; $count++; } - print ""; - + print " + "; ?> -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
"; + print "
";// class='row_to_clone' /* these are not the rows to clone...*/ display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt'])); - print "
"; + print "
"; display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); - print "
-
-

"/>

-
+ +

+ "/> + + diff --git a/admin/supervisor.php b/admin/supervisor.php index 8c9fb0b1..2bca6b6a 100644 --- a/admin/supervisor.php +++ b/admin/supervisor.php @@ -1,33 +1,6 @@ - * @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 - * - * */ /** @@ -65,6 +38,24 @@ include("../functions/functions.operator.php"); */ include("../functions/functions.input.php"); +$css = array( +"../include/bootstrap/css/bootstrap.min.css", +"../include/bootstrap/css/bootstrap-theme.min.css", +"../include/font-awesome/css/font-awesome.css", +//"../include/iCheck/skins/square/blue.css", +"../css/custom.css" + ); +$js_head = array( +"../include/jquery/jquery.min.js", +"../include/bootstrap/js/bootstrap.min.js" + ); +$js_foot = array( +"../js/bootstrap-confirmation.js", +"../include/iCheck/icheck.min.js", +"../js/window.js", +"../js/custom.js" + ); + global $db; $operator_id = get_operator_id(); @@ -72,7 +63,7 @@ $operator_id = get_operator_id(); $case_id = false; if (isset($_GET['case_id'])) $case_id = bigintval($_GET['case_id']); -if (isset($_GET['deidentify'])) +if (isset($_GET['deidentify-confirm-btn'])) { //remove all sample vars $db->StartTrans(); @@ -115,8 +106,6 @@ if (isset($_GET['deidentify'])) $db->CompleteTrans(); } - - if (isset($_GET['case_note_id'])) { $case_note_id = bigintval($_GET['case_note_id']); @@ -128,10 +117,19 @@ if (isset($_GET['case_note_id'])) $db->Execute($sql); } -xhtml_head(T_("Supervisor functions"),true,array("../css/table.css"),array("../js/window.js")); +xhtml_head(T_("Assign outcomes to cases"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") -print "

" . T_("Enter a case id or select a case from the list below:") . "

"; +?> +
+
+ +"> + +
+
+ +GetAll($sql); if (!empty($rs)) { - print "
"; - display_chooser($rs,"case","case_id"); - print "
"; + print "
" . T_("or") . ""; + display_chooser($rs,"case","case_id",true,false,true,false); + print "
"; } - ?> -
-

- -"/>

-
- + + + + + + 0) { - $sql = "UPDATE `call` SET outcome_id = '$outcome_id' WHERE call_id = '$call_id'"; @@ -173,23 +209,10 @@ if (isset($_GET['call_id'])) } else { - print "

" . T_("Set an outcome for this call") . "

"; - - ?> -
- GetAll($sql); - translate_array($rs2,array("description")); - display_chooser($rs2, "set_outcome_id", "set_outcome_id",true,false,false); - ?> -

"/>

-
- $(function() { $('#call_outcome_change').modal('show'); }); "; } + + //unset($_GET['call_id']); } if ($case_id != false) { @@ -258,7 +281,7 @@ if ($case_id != false) $db->CompleteTrans(); } - $sql = "SELECT o.description,o.outcome_id, q.description as qd, si.description as sd + $sql = "SELECT o.description,o.outcome_id, q.description as qd, si.description as sd, s.import_id as sid FROM `case` as c, `outcome` as o, questionnaire as q, sample as s, sample_import as si WHERE c.case_id = '$case_id' AND q.questionnaire_id = c.questionnaire_id @@ -270,138 +293,201 @@ if ($case_id != false) if (!empty($rs)) { - print "

" . T_("Project") . ": {$rs['qd']}

"; - print "

" . T_("Sample") . ": {$rs['sd']}

"; - - print "

". T_("Current outcome:") ." " . T_($rs['description']) . "

"; + print "
+

 " . T_("Project") . ": {$rs['qd']} 

+

 " . T_("Sample") . ": {$rs['sd']} 

+

". T_("Current outcome:") ." " . T_($rs['description']) . "

"; $current_outcome_id = $rs['outcome_id']; + $sid = $rs['sid']; + // view sample details + print "

 " . T_("Sample details")."

"; + + $sql = "SELECT sv.sample_id, c.case_id , s.Time_zone_name, + TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'". TIME_FORMAT ."') as time + FROM sample_var AS sv + LEFT JOIN (`case` AS c , sample as s) ON ( c.sample_id = sv.sample_id AND s.sample_id = c.sample_id ) WHERE c.case_id = '$case_id' + GROUP BY sv.sample_id"; + $r = $db->GetAll($sql); + if ($r){ + $fnames = array("sample_id", "Time_zone_name", "time"); + $fdesc = array(T_("Sample id"),T_("Timezone"),T_("Time NOW")); + $varr= array(); + $sql = "SELECT var,var_id + FROM sample_import_var_restrict + WHERE sample_import_id = $sid AND type IN (2,3,6,7) + ORDER by var DESC"; + $rs = $db->GetAll($sql); - print "

" . T_("Appointments")."

"; + foreach($rs as $rsw) + { + $fnames[] = $rsw['var_id']; + $fdesc[] = $rsw['var']; + $varr[] = $rsw['var_id']; //array for valid var_id's + } + $varr= implode(",",$varr); + foreach($r as &$rw) + { + $sql = "SELECT var_id,val + FROM sample_var + WHERE sample_id = {$rw['sample_id']} AND var_id IN ($varr)"; + $rs = $db->GetAll($sql); + foreach($rs as $rsw){ + $rw[$rsw['var_id']] = $rsw['val']; + } + } + + xhtml_table($r,$fnames,$fdesc,"tclass"); + }else{ + print "

" . T_("No sample data for this case") . "

"; + } + print "
"; + + //View appointments + print "

 " . T_("Appointments")."

"; - //View appointments - $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('', c.case_id, '') as case_id, CONCAT('". TQ_("Delete") . "') as link, CONCAT('". TQ_("Edit") . "') as edit + $sql = "SELECT + CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, + CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end, + CONCAT(r.firstName,' ', r.lastName) as resp, + IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, + CONCAT (oo.firstName,' ', oo.lastName) as makerName, + CONCAT (ooo.firstName,' ', ooo.lastName) as callerName, + CONCAT('', c.case_id, '') as case_id, + CONCAT('  ') as link, + CONCAT('  ') as edit FROM appointment as a - JOIN (`case` as c, respondent as r, questionnaire as q, operator as o, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id) + JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id) LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id) WHERE c.case_id = '$case_id' GROUP BY a.appointment_id ORDER BY a.start ASC"; $rs = $db->GetAll($sql); - + if (!empty($rs)) { translate_array($rs,array("outcome")); - xhtml_table($rs,array("description","start","end","makerName","firstName","lastName","outcome","callerName","link","edit"),array(T_("Questionnaire"),T_("Start"),T_("End"),T_("Operator Name"),T_("Respondent Name"),T_("Surname"),T_("Current outcome"),T_("Operator who called"),T_("Delete"),T_("Edit"))); + xhtml_table($rs,array("start","end","edit","makerName","resp","outcome","callerName","link"),array(T_("Start"),T_("End"),"  ",T_("Operator"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"  "),"table-hover table-bordered table-condensed col-sm-10"); } else - print "

" . T_("No appointments for this case") . "

"; + print ""; + +// * disable appointment creation if no sample_id + if ($r[0]['sample_id']){ + $rtz= $r[0]['Time_zone_name']; + print "  " . T_("Create appointment") . ""; } - print "

" . T_("Create appointment for this case") . "

"; + print "
"; //view calls and outcomes - $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,CONVERT_TZ(c.end,'UTC',r.Time_zone_name) as end, op.firstName, op.lastName, o.description as des, CONCAT('". TQ_("Edit") . "') as link, cp.phone as phone + $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,CONVERT_TZ(c.end,'UTC',r.Time_zone_name) as end, CONCAT(op.firstName,' ',op.lastName) as firstName, o.description as des, CONCAT(' ') as link, cp.phone as phone FROM `call` as c JOIN (operator as op, outcome as o, respondent as r, contact_phone as cp) on (c.operator_id = op.operator_id and c.outcome_id = o.outcome_id and r.respondent_id = c.respondent_id and cp.contact_phone_id = c.contact_phone_id) WHERE c.case_id = '$case_id' ORDER BY c.start DESC"; - $rs = $db->GetAll($sql); - print "

" . T_("Call list")."

"; + print "

 " . T_("Call list")."

"; if (empty($rs)) - print "

" . T_("No calls made") . "

"; + print ""; else { translate_array($rs,array("des")); - xhtml_table($rs,array("start","des","phone","link","firstName"),array(T_("Date/Time"),T_("Outcome"),T_("Phone number"),T_("Change outcome"),T_("Operator"))); + xhtml_table($rs,array("start","phone","firstName","des","link"),array(T_("Date/Time"),T_("Phone number"),T_("Operator"),T_("Outcome"),"  ")); } + print "
"; - //view timeslots - $sql = "SELECT count(*) + //view notes + $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, CONCAT(op.firstName,' ',op.lastName) as firstName, c.note as note, CONCAT('') as link + FROM `case_note` as c + JOIN (operator as op) on (c.operator_id = op.operator_id) + WHERE c.case_id = '$case_id' + ORDER BY c.datetime DESC"; + $rs = $db->GetAll($sql); + + print "

 " . T_("Case notes")."

"; + + if (empty($rs)) + print "

" . T_("No notes") . "

"; + else { + xhtml_table($rs,array("time","firstName","note","link"),array(T_("Date/Time"),T_("Operator"),T_("Note"),"  ")); + print "
"; + } + //add a note + ?> +
+ +   + +
+ "; + + //view timeslots + $sql = "SELECT count(*) FROM questionnaire_timeslot as q, `case` as c WHERE c.case_id = $case_id AND c.questionnaire_id = q.questionnaire_id"; - if ($db->GetOne($sql) >= 1) - { - print "

" . T_("Call attempts by timeslot") . "

"; - - $sql = "SELECT ag.description, (SELECT COUNT(*) FROM availability as a, `call_attempt` as ca WHERE ca.case_id = c.case_id AND a.availability_group_id = ag.availability_group_id - AND (a.day_of_week = DAYOFWEEK(CONVERT_TZ(ca.start,'UTC',s.Time_zone_name)) - AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) >= a.start - AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) <= a.end)) as cou + if ($db->GetOne($sql) >= 1) + { + $sql = "SELECT ag.description, (SELECT COUNT(*) FROM availability as a, `call_attempt` as ca + WHERE ca.case_id = c.case_id + AND a.availability_group_id = ag.availability_group_id + AND (a.day_of_week = DAYOFWEEK(CONVERT_TZ(ca.start,'UTC',s.Time_zone_name)) + AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) >= a.start + AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) <= a.end)) as cou FROM availability_group as ag, `case` as c, `questionnaire_timeslot` as qt, sample as s WHERE c.case_id = '$case_id' AND s.sample_id = c.sample_id AND qt.questionnaire_id = c.questionnaire_id AND ag.availability_group_id = qt.availability_group_id"; + if ( array("cou") >=1){ + print "

 " . T_("Call attempts by timeslot") . "

"; + xhtml_table($db->GetAll($sql),array('description','cou'),array(T_("Time slot"),T_("Call attempts")));//,"tclass",false,array("cou") + print "
"; + } + } else { print "" . T_("Time slots NOT defined") . ""; } - xhtml_table($db->GetAll($sql),array('description','cou'),array(T_("Time slot"),T_("Call attempts"))); - - } - - //view notes - $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, op.firstName, op.lastName, c.note as note, CONCAT('". TQ_("Delete") . "') as link - FROM `case_note` as c - JOIN (operator as op) on (c.operator_id = op.operator_id) - WHERE c.case_id = '$case_id' - ORDER BY c.datetime DESC"; - - - $rs = $db->GetAll($sql); - - print "

" . T_("Case notes")."

"; - - if (empty($rs)) - print "

" . T_("No notes") . "

"; - else - xhtml_table($rs,array("time","firstName","note","link"),array(T_("Date/Time"),T_("Operator"),T_("Note"),T_("Delete"))); - - //add a note + print "
"; + + if ($r[0]['sample_id']){ //if sample data exists assign this to an operator for their next case + + print "

 " . T_("Assign this case to operator (will appear as next case for them)") . "

"; ?> -
-

- "/> -

-
+
+ GetAll($sql); + display_chooser($rs3, "operator_id", "operator_id",true,false,false,false); + ?> + + +
"; if ($id) - print "

" . T_("Modify responses for this case") . "

"; + print "

 " . T_("Modify responses for this case") . "

"; else - print "

" . T_("Case not yet started in Limesurvey") . "

"; - - //set an outcome - - print "

" . T_("Set a case outcome") . "

"; - - ?> -
- GetAll($sql); - translate_array($rs2,array("description")); - display_chooser($rs2, "outcome_id", "outcome_id",true,false,false); - - ?> -

"/>

-
- " . T_("Case not yet started in Limesurvey") . "
"; + print "
"; + + if ($r[0]['sample_id']){ // if sample data exists view availability + + print "

 " . T_("Availability groups") . "

"; if (is_using_availability($case_id)) { - //List all availability group items and whether selected or not (all selected by default unless >= 1 availability group is in use for this case $sql = "SELECT qa.availability_group_id,ag.description,ca.availability_group_id as selected_group_id FROM `case` as c @@ -413,9 +499,8 @@ if ($case_id != false) $rs = $db->GetAll($sql); //Display all availability groups as checkboxes - - print "

" . T_("Select groups to limit availability (Selecting none means always available)") . "

"; - print "
"; + print ""; + print "
" . T_("Select groups to limit availability (Selecting none means always available)") . "
"; foreach ($rs as $r) { $checked = ""; @@ -423,60 +508,69 @@ if ($case_id != false) //if ($allselected || $r['availability_group_id'] == $r['selected_group_id']) if ($r['availability_group_id'] == $r['selected_group_id']) $checked = "checked='checked'"; - - print "
-
"; - + print " 
"; } - ?> -

"/>

+ ?>
+ +
- " . T_("Availability groups not defined for this questionnaire") . "

"; + print ""; } + print "
"; } - - //assign this to an operator for their next case - print "

" . T_("Assign this case to operator (will appear as next case for them)") . "

"; + //set an outcome + print "

 " . T_("Set a case outcome") . "

"; ?> -
+ GetAll($sql); - display_chooser($rs3, "operator_id", "operator_id",true,false,false); + $sql = "SELECT outcome_id as value,description, CASE WHEN outcome_id = '$current_outcome_id' THEN 'selected=\'selected\'' ELSE '' END AS selected + FROM outcome"; + $rs2 = $db->GetAll($sql); + translate_array($rs2,array("description")); + display_chooser($rs2, "outcome_id", "outcome_id",true,false,false,false); ?> -

"/>

+

+
" . T_("Deidentify") . ""; - print "

" . T_("Remove all sample details and contact numbers from this case") . "

"; + print "
"; + + if ($r[0]['sample_id']){ // if sample data exists deidentify record + print "

 " . T_("Deidentify") . "

"; + print "
" . T_("Remove all sample details and contact numbers from this case") . "
"; ?>
-

- "/> -

-
- +
+ " . T_("Case does not exist") . ""; + print "

" . T_("Case does not exist") . "

"; } } -xhtml_foot(); - - +xhtml_foot($js_foot);// deidentify data-toggle="modal" type="submit"submitclass ?> + + + + diff --git a/admin/supervisorchat.php b/admin/supervisorchat.php index 7e62f808..eb90efe0 100644 --- a/admin/supervisorchat.php +++ b/admin/supervisorchat.php @@ -58,26 +58,34 @@ if (isset($_POST['update'])) set_setting("chat_enabled",$enable); } -xhtml_head(T_("Supervisor chat"),true,false,array("../js/window.js")); +xhtml_head(T_("Supervisor chat"),true,array("../include/bootstrap/css/bootstrap.min.css","../include/bootstrap-toggle/css/bootstrap-toggle.min.css","../css/custom.css"),array("../include/jquery/jquery.min.js", "../include/bootstrap/js/bootstrap.min.js","../include/bootstrap-toggle/js/bootstrap-toggle.min.js","../js/window.js")); -print "

" . T_("Allow interviewers to chat with the supervisor over XMPP (Jabber). Required is a BOSH enabled XMPP/Jabber server. The operators and the supervisor will need XMPP/Jabber accounts.") . "

"; +print "

" . T_("Allow interviewers to chat with the supervisor over XMPP (Jabber). Required is a BOSH enabled XMPP/Jabber server. The operators and the supervisor will need XMPP/Jabber accounts.") . "

"; $e = get_setting("chat_enabled"); $checked = "checked='checked'"; if (empty($e)) $checked = ""; - - ?> -
-

-

/>
-
-
-
"/>
-

-
- +
+ +
+ + " data-off="" data-width="80" name='enable' val='1' /> +
+
+ + +
+
+ + +
+ + "/> + +
+ + diff --git a/admin/systemsort.php b/admin/systemsort.php index 2542768e..49c6b960 100644 --- a/admin/systemsort.php +++ b/admin/systemsort.php @@ -72,9 +72,9 @@ if ($p) set_setting('systemsort',false); } - xhtml_head(T_("Monitor system wide case sorting"),true,array("../css/table.css"),false,false,false,true); + xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,true); - print "

" . T_("Running process:") . " $p

"; + print "

" . T_("Running process:") . " $p

"; if (is_process_killed($p)) { @@ -91,14 +91,13 @@ if ($p) { xhtml_table($d,array('process_log_id','datetime','data'),array(T_("Log id"), T_("Date"), T_("Log entry"))); } - } else { - xhtml_head(T_("Monitor system wide case sorting"),true,array("../css/table.css")); - print "

" . T_("Monitor system wide case sorting") . "

"; + xhtml_head(T_("Monitor system wide case sorting"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css")); + //print "

" . T_("Monitor system wide case sorting") . "

"; print "

" . T_("Click here to enable and begin system wide case sorting") . "

"; - print "

" . T_("System wide case sorting is periodically (via SYSTEM_SORT_MINUTES configuration directive) sorting cases on a system wide basis instead of finding the most appropriate case each time an operator requests a new case. This may increase performance where there are a large number of cases or complex quotas in place. If you are not experiencing any performance problems, it is not recommended to use this feature.") . "

"; + print "

" . T_("System wide case sorting is periodically (via SYSTEM_SORT_MINUTES configuration directive) sorting cases on a system wide basis instead of finding the most appropriate case each time an operator requests a new case. This may increase performance where there are a large number of cases or complex quotas in place. If you are not experiencing any performance problems, it is not recommended to use this feature.") . "

"; print "

" . T_("Outcome of last process run (if any)") . "

"; $d = process_get_last_data(2); if ($d !== false) diff --git a/admin/systemsortprocess.php b/admin/systemsortprocess.php index b13e7f43..1a9c3bbc 100644 --- a/admin/systemsortprocess.php +++ b/admin/systemsortprocess.php @@ -243,23 +243,26 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id) LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id) LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id) - LEFT JOIN questionnaire_timeslot AS qast ON (qast.questionnaire_id = c.questionnaire_id) - LEFT JOIN questionnaire_sample_timeslot AS qasts ON (qasts.questionnaire_id = c.questionnaire_id AND qasts.sample_import_id = si.sample_import_id) - WHERE c.current_operator_id IS NULL - AND c.questionnaire_id = '$questionnaire_id' + LEFT JOIN questionnaire_timeslot AS qast ON (qast.questionnaire_id = c.questionnaire_id) + LEFT JOIN questionnaire_sample_timeslot AS qasts ON (qasts.questionnaire_id = c.questionnaire_id AND qasts.sample_import_id = si.sample_import_id) + WHERE c.current_operator_id IS NULL + AND c.questionnaire_id = '$questionnaire_id' AND ((apn.appointment_id IS NOT NULL) OR casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end )) - AND ((apn.appointment_id IS NOT NULL) OR qast.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_timeslot WHERE questionnaire_timeslot.questionnaire_id = c.questionnaire_id AND availability_group.availability_group_id = questionnaire_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1))) - AND ((apn.appointment_id IS NOT NULL) OR qasts.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_sample_timeslot WHERE questionnaire_sample_timeslot.questionnaire_id = c.questionnaire_id AND questionnaire_sample_timeslot.sample_import_id = si.sample_import_id AND availability_group.availability_group_id = questionnaire_sample_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1))) + + AND ((apn.appointment_id IS NOT NULL) OR qast.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_timeslot WHERE questionnaire_timeslot.questionnaire_id = c.questionnaire_id AND availability_group.availability_group_id = questionnaire_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1))) + + AND ((apn.appointment_id IS NOT NULL) OR qasts.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_sample_timeslot WHERE questionnaire_sample_timeslot.questionnaire_id = c.questionnaire_id AND questionnaire_sample_timeslot.sample_import_id = si.sample_import_id AND availability_group.availability_group_id = questionnaire_sample_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1))) + AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC'))) AND ap.case_id is NULL AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0) AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL) AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL) - AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE case_id = c.case_id) < qs.call_attempt_max)) - AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max)) + AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE call_attempt.case_id = c.case_id) < qs.call_attempt_max)) + AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE `call`.case_id = c.case_id) < qs.call_max)) AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0 GROUP BY c.case_id - ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, qsep.priority DESC, a.start ASC"; + ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, qsep.priority DESC, CONVERT_TZ(NOW(), 'System' , s.Time_zone_name) DESC , a.start ASC"; $rs = $db->GetAll($sql); diff --git a/admin/timezonetemplate.php b/admin/timezonetemplate.php index 963de5bd..ae0fe2e5 100644 --- a/admin/timezonetemplate.php +++ b/admin/timezonetemplate.php @@ -57,10 +57,10 @@ include("../functions/functions.input.php"); global $db; - if (isset($_POST['dtime_zone'])) { set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']); + } if (isset($_GET['time_zone'])) @@ -89,49 +89,48 @@ if (isset($_GET['tz'])) } -xhtml_head(T_("Add/Remove Timezones"),true,array("../css/shifts.css"),array("../js/window.js")); +xhtml_head(T_("Set Timezones"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js")); //,"../include/bootstrap/css/bootstrap-theme.min.css" $dtz = get_setting("DEFAULT_TIME_ZONE"); $sql = "SELECT name as value, name as description, CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected - FROM mysql.time_zone_name"; + FROM mysql.time_zone_name"; $tzl = $db->GetAll($sql); if (empty($tzl) || !$tzl) { - print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; + print "
" . T_("Your database does not have timezones installed, please see here for details") . " ...
"; } -print "

" . T_("Set default timezone") . ":

"; +print "

" . T_("Default Timezone: ") . " $dtz

";//
?> -

- - "/>

+ +   + "/>
"; -print "

" . T_("Click to remove a Timezone from the default list") . "

"; +print "

" . T_("Timezone list") . "

"; -$sql = "SELECT Time_zone_name - FROM timezone_template"; +$sql = "SELECT Time_zone_name, TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,Time_zone_name),'". TIME_FORMAT ."') as time, CONCAT('

', TIME_FORMAT(TIMEDIFF( CONVERT_TZ(NOW(),'$dtz','$dtz'),CONVERT_TZ(NOW(), Time_zone_name,'$dtz')),' %H : %i'), '

') AS timediff, +CONCAT('" . T_("Remove") . "') as link + FROM timezone_template ORDER BY time ASC"; $qs = $db->GetAll($sql); + xhtml_table($qs, array("Time_zone_name","timediff","time","link"), array(T_("Timezone name"),T_("Time diff to Default Time zone"),T_("Current time"),T_("Remove"))); +print "
"; -foreach($qs as $q) -{ - print "

{$q['Time_zone_name']}

"; -} - -print "

" . T_("Add a Timezone:") . "

"; +print "

" . T_("Add a Timezone:") . " 

"; ?> -

- - "/>

+ +   + "/>
"; + xhtml_foot(); - - ?> diff --git a/admin/voipmonitor.php b/admin/voipmonitor.php index 5bd29192..bb5d7155 100644 --- a/admin/voipmonitor.php +++ b/admin/voipmonitor.php @@ -70,18 +70,18 @@ if ($p) kill_process($p); } - xhtml_head(T_("Monitor VoIP Process"),true,array("../css/table.css"),false,false,false,true); + xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),false,false,false,true); - print "

" . T_("Running process:") . " $p

"; + print "

" . T_("Running process:") . " $p

"; if (is_process_killed($p)) { - print "

" . T_("Kill signal sent: Please wait... (Note: Process will be stalled until there is activity on the VoIP Server)") . "

"; - print "

" . T_("Process is already closed (eg. server was rebooted) - click here to confirm") . "

"; + print "

" . T_("Kill signal sent: Please wait...
(Note: Process will be stalled until there is activity on the VoIP Server)") . "

"; + print "

" . T_("Process is already closed (eg. server was rebooted)") . "" . T_("click here to confirm") . "

"; } else { - print "

" . T_("Kill the running process") . " ". T_("(requires activity on the VoIP Server to take effect)") . "

"; + print "

" . T_("Kill the running process") . " ". T_("(requires activity on the VoIP Server to take effect)") . "

"; } $d = process_get_data($p); @@ -92,10 +92,10 @@ if ($p) } else { - xhtml_head(T_("Monitor VoIP Process"),true,array("../css/table.css")); - print "

" . T_("Monitor VoIP Process") . "

"; - print "

" . T_("Click here to begin monitoring the VoIP Process") . "

"; - print "

" . T_("Outcome of last process run (if any)") . "

"; + xhtml_head(T_("Monitor VoIP Process"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css")); + //print "

" . T_("Monitor VoIP Process") . "

"; + print "

" . T_("Click here to begin monitoring the VoIP Process") . "

"; + print "

" . T_("Outcome of last process run (if any)") . "

"; $d = process_get_last_data(); if ($d !== false) { diff --git a/appointment.php b/appointment.php index dde5f62a..6085ce68 100644 --- a/appointment.php +++ b/appointment.php @@ -115,16 +115,15 @@ if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && iss $js = array("js/window.js"); if (AUTO_LOGOUT_MINUTES !== false) { - $js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; + $js[] = "include/jquery/jquery-1.4.2.min.js"; $js[] = "js/childnap.js"; } -xhtml_head(T_("Appointment"),true,array("css/respondent.css"),$js); +xhtml_head(T_("Create appointment"),false,array("include/bootstrap/css/bootstrap.min.css", "css/respondent.css"),$js);//"include/clockpicker/dist/bootstrap-clockpicker.min.css", //select a respondent from a list or create a new one -print("

" . T_("Select a respondent") . "

"); - +print "

" . T_("Respondent") . ":"; $sr = display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false,true); - +print "

"; if ($sr != false) $_GET['respondent_id'] = $sr; if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0) @@ -141,6 +140,11 @@ if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0) else if(isset($_GET['respondent_id'])) { $respondent_id = bigintval($_GET['respondent_id']); + + $sql = "SELECT TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) as tme, r.Time_zone_name as tzn FROM `respondent` as r WHERE r.respondent_id = $respondent_id"; + $ct = $db->GetRow($sql); + + print "

".T_("Timezone").": ".$ct['tzn']. " ".T_("Current Time").": " . $ct['tme'] . "

"; if (isset($_GET['d']) && isset($_GET['m']) && isset($_GET['y'])) { @@ -156,12 +160,12 @@ else if(isset($_GET['respondent_id'])) { $list = return_contact_phone_list($case_id); - print "

" . T_("Select phone number:") . "

"; + print "
"; if (isset($_GET['contact_phone_id'])) $contact_phone_id = bigintval($_GET['contact_phone_id']); else $contact_phone_id = -1; - print "
"; foreach($list as $l) { $id = $l['contact_phone_id']; @@ -170,27 +174,29 @@ else if(isset($_GET['respondent_id'])) print ""; } - print "
"; + print "
"; if(isset($_GET['contact_phone_id'])) { $contact_phone_id = bigintval($_GET['contact_phone_id']); + + print "
"; if ($contact_phone_id == 0) { //ability to add a new one ?>

-
-

-

"/> + +

+  "/> -

+
-

- " . T_("Accept appointment from ") .convert_time($_GET['start']).T_(" till ").convert_time($_GET['end']).T_(" on ") . "$day/$month/$year? " . T_("on") . " $phonenum

"; ?> -

- + ".T_("Accept appointment from ")."".$_GET['start']."".T_(" till ")."".$_GET['end']."".T_(" on ") . " $day/$month/$year " . T_("on") . " $phonenum ?

"; ?> + @@ -216,10 +220,12 @@ else if(isset($_GET['respondent_id'])) - "/>

+ "/> "; } } diff --git a/appointmentlist.php b/appointmentlist.php index 7fd10c97..88ce8265 100644 --- a/appointmentlist.php +++ b/appointmentlist.php @@ -51,9 +51,9 @@ include("functions/functions.operator.php"); $js = false; if (AUTO_LOGOUT_MINUTES !== false) - $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); + $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Appointment List"),true,array("css/table.css"),$js,false,60); +xhtml_head(T_("Appointment List"),false,array("css/table.css"),$js,false,60); //List the case appointment // display in respondent time so that the operator will be able to diff --git a/availability.php b/availability.php index 71172af2..fd9adb02 100644 --- a/availability.php +++ b/availability.php @@ -51,9 +51,9 @@ include("functions/functions.operator.php"); $js = false; if (AUTO_LOGOUT_MINUTES !== false) - $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); + $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Availability"),true,array("css/table.css"),$js); +xhtml_head(T_("Availability"),false,array("css/table.css"),$js); $operator_id = get_operator_id(); $case_id = get_case_id($operator_id); diff --git a/call.php b/call.php index 8c2fe826..c0dc7905 100644 --- a/call.php +++ b/call.php @@ -255,7 +255,7 @@ if (isset($_GET['newstate'])) $js = "js/window.js"; if (browser_ie()) $js = "js/window_ie6.js"; -xhtml_head(T_("Call"),true,array("css/call.css"),array($js,"include/jquery-ui/js/jquery-1.4.2.min.js")); +xhtml_head(T_("Call"),true,array("css/call.css"),array($js,"include/jquery/jquery-1.4.2.min.js")); $state = is_on_call($operator_id); switch($state) diff --git a/call_interface2.php b/call_interface2.php index a58a4197..95588070 100644 --- a/call_interface2.php +++ b/call_interface2.php @@ -81,13 +81,13 @@ function display_outcomes($contacted,$ca,$case_id) //see if the case is completed if ($completed) { - $sql = "SELECT outcome_id,description + $sql = "SELECT outcome_id,description,contacted FROM outcome WHERE outcome_id = 10"; } else if (limesurvey_is_quota_full($case_id)) { - $sql = "SELECT outcome_id,description + $sql = "SELECT outcome_id,description,contacted FROM outcome WHERE outcome_id = 32"; } @@ -105,27 +105,35 @@ function display_outcomes($contacted,$ca,$case_id) if (!empty($rs)) { //we have an appointment made ... only select appointment ID's - $sql = "SELECT outcome_id,description + $sql = "SELECT outcome_id,description,contacted FROM outcome - WHERE outcome_type_id = '5'"; + WHERE outcome_id = '19'"; //outcome_type_id = '5' } else { if ($contacted === false) { + print ""; + + if (isset ($_GET['contacted'])){ + + $contacted = bigintval($_GET['contacted']); + $sql = "SELECT outcome_id,description,contacted FROM outcome - WHERE outcome_id != 10 - ORDER BY contacted ASC, outcome_id ASC"; //don't show completed if not + WHERE contacted = '$contacted' + AND outcome_id NOT IN(5,10,19,21,40,41,34,35)"; + } } else { $contacted = bigintval($contacted); - $sql = "SELECT outcome_id,description + $sql = "SELECT outcome_id,description,contacted FROM outcome WHERE contacted = '$contacted' - AND outcome_id != 10"; //don't show completed if not + AND outcome_id NOT IN(5,10,19,21,40,41,34,35)"; } } } @@ -136,12 +144,15 @@ function display_outcomes($contacted,$ca,$case_id) { $do = false; if (isset($_GET['defaultoutcome'])) $do = bigintval($_GET['defaultoutcome']); + foreach($rs as $r) { if ($do == $r['outcome_id']) $selected = "checked='checked'"; else $selected = ""; - if (isset($r['contacted']) && $r['contacted'] == 1) $highlight = "style='color:blue;'"; else $highlight = ""; - print "
"; + if (isset($r['contacted']) && $r['contacted'] == 1) $highlight = "text-primary"; else $highlight = "text-default"; + print "
  • "; } + + $_POST['confirm'] = true; } print "
    "; @@ -289,10 +300,10 @@ if (isset($_GET['newstate'])) $db->Execute($sql); } -$js = "js/window_interface2.js"; -if (browser_ie()) $js = "js/window_ie6_interface2.js"; -xhtml_head(T_("Call"),true,array("css/call.css"),array($js,"include/jquery-ui/js/jquery-1.4.2.min.js")); +if (browser_ie()) $js = "js/window_ie6_interface2.js"; else $js = "js/window_interface2.js"; + +xhtml_head(T_("Set outcome"),true,array("include/bootstrap/css/bootstrap.min.css"/* ,"css/call.css" */),array($js,"include/jquery/jquery-1.4.2.min.js")); $state = is_on_call($operator_id); switch($state) @@ -464,10 +475,13 @@ switch($state) case 2: //ringing case 3: //answered case 4: //requires coding - print "
    " . T_("Requires coding") . "
    "; - print "
    "; + // print "
    " . T_("Requires coding") . "
    "; + print "
    "; display_outcomes(false,$call_attempt_id,$case_id); - print "
    "; + print_r($rs); + if ($_POST['confirm']){ + print "
    "; + } break; case 5: //done -- shouldn't come here as should be coded + done default: diff --git a/callhistory.php b/callhistory.php index 1f352107..4adf9546 100644 --- a/callhistory.php +++ b/callhistory.php @@ -51,9 +51,9 @@ include("functions/functions.operator.php"); $js = false; if (AUTO_LOGOUT_MINUTES !== false) - $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); + $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Case History List"),true,array("css/table.css"),$js,false,60); +xhtml_head(T_("Case History List"),false,array("css/table.css"),$js,false,60); //List the case call history // display in respondent time so that the operator will be able to diff --git a/calllist.php b/calllist.php index 418226d9..45c60c31 100644 --- a/calllist.php +++ b/calllist.php @@ -51,9 +51,9 @@ include("functions/functions.operator.php"); $js = false; if (AUTO_LOGOUT_MINUTES !== false) - $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); + $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Call List"),true,array("css/table.css"),$js,false,60); +xhtml_head(T_("Call List"),false,array("css/table.css"),$js,false,60); //List the case call history // display in respondent time so that the operator will be able to diff --git a/casenote.php b/casenote.php index c7f000e2..1bb68fd9 100644 --- a/casenote.php +++ b/casenote.php @@ -51,9 +51,9 @@ include("functions/functions.operator.php"); $js = false; if (AUTO_LOGOUT_MINUTES !== false) - $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); + $js = array("include/jquery/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Case Notes"),true,array("css/table.css","css/casenote.css"),$js, (isset($_GET['add'])) ? "onload=\"document.getElementById('note').focus();\"" : false); +xhtml_head(T_("Case Notes"),false,array("css/table.css","css/casenote.css"),$js, (isset($_GET['add'])) ? "onload=\"document.getElementById('note').focus();\"" : false); //List the case note history // display in the operators time diff --git a/config.default.php b/config.default.php index 61317e0b..85e84afc 100644 --- a/config.default.php +++ b/config.default.php @@ -71,7 +71,7 @@ if (!defined('ALLOW_OPERATOR_EXTENSION_SELECT')) define('ALLOW_OPERATOR_EXTENSIO /** * The Asterisk server address */ -if (!defined('VOIP_SERVER')) define('VOIP_SERVER','asterisk.dcarf'); +if (!defined('VOIP_SERVER')) define('VOIP_SERVER','localhost'); /** * The Asterisk server username for the monitor interface @@ -284,7 +284,7 @@ if (!defined('TEMPORARY_DIRECTORY')) define('TEMPORARY_DIRECTORY', "/tmp"); */ if (!defined('DB_USER')) define('DB_USER', 'quexs'); if (!defined('DB_PASS')) define('DB_PASS', 'quexs'); -if (!defined('DB_HOST')) define('DB_HOST', 'databasedev.dcarf'); +if (!defined('DB_HOST')) define('DB_HOST', 'localhost'); if (!defined('DB_NAME')) define('DB_NAME', 'quexs'); if (!defined('DB_TYPE')) define('DB_TYPE', 'mysqlt'); @@ -302,6 +302,11 @@ if (!defined('LDB_HOST')) define('LDB_HOST', DB_HOST); if (!defined('LDB_NAME')) define('LDB_NAME', DB_NAME); if (!defined('LDB_TYPE')) define('LDB_TYPE', DB_TYPE); + +if (!defined('COMPANY_NAME')) define ('COMPANY_NAME', 'queXS '); +if (!defined('ADMIN_PANEL_NAME')) define ('ADMIN_PANEL_NAME',' Administration Panel'); + + /** * Debugging */ diff --git a/config.inc.local.php.example b/config.inc.local.php.example index bd8ef41b..e77296b6 100644 --- a/config.inc.local.php.example +++ b/config.inc.local.php.example @@ -29,7 +29,6 @@ * */ - /** * * Only some of the configuration directives are here. See the file: config.default.php for them all @@ -46,7 +45,7 @@ define('VOIP_ENABLED',false); /** * The Asterisk server address */ -define('VOIP_SERVER','asterisk.dcarf'); +define('VOIP_SERVER', 'localhost'); /** * Whether to automatically pop up a coding window when the respondent hangs up @@ -63,7 +62,7 @@ define('QUEXS_PATH', '/quexs/'); */ define('DB_USER', 'quexs'); define('DB_PASS', 'quexs'); -define('DB_HOST', 'databasedev.dcarf'); +define('DB_HOST', 'localhost'); define('DB_NAME', 'quexs'); diff --git a/contactdetails.php b/contactdetails.php index 186af2ce..f5254bd8 100644 --- a/contactdetails.php +++ b/contactdetails.php @@ -63,11 +63,11 @@ $js = array("js/window.js"); if (AUTO_LOGOUT_MINUTES !== false) { - $js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; + $js[] = "include/jquery/jquery-1.4.2.min.js"; $js[] = "js/childnap.js"; } -xhtml_head(T_("Contact details"),true,array("css/table.css","css/respondent_interface2.css"),$js); +xhtml_head(T_("Contact details"),false,array("css/table.css","css/respondent_interface2.css"),$js); global $db; @@ -148,12 +148,12 @@ else //display sample details // use sample_import_var_restrict to limit - $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) - JOIN `sample` as sa ON (sa.sample_id = c.sample_id) - LEFT JOIN sample_import_var_restrict as sv ON (sv.var LIKE s.var AND sa.import_id = sv.sample_import_id) - WHERE (sv.restrict IS NULL OR sv.restrict = 0)"; + $sql = "SELECT sivr.var,sv.val + FROM `sample_var` as sv, `sample_import_var_restrict` as sivr, `case` as c + WHERE c.case_id = '$case_id' + AND sv.sample_id = c.sample_id + AND sivr.var_id = sv.var_id + AND (sivr.restrict IS NULL OR sivr.restrict = 0)"; $rs = $db->GetAll($sql); diff --git a/css/custom.css b/css/custom.css new file mode 100644 index 00000000..8dc3463f --- /dev/null +++ b/css/custom.css @@ -0,0 +1,77 @@ + +body { +/* +font-size: 1.5em; +line-height: 1.3em;*/ +/* color: #515a63; or #666 */ +/*padding-top: 0px;*/ +background:#EEEFF2; +padding:0.8em; +} + +/*.panel { + background-color: transparent; } +.panel-default { + border-color: transparent; } +.panel-heading { + padding-bottom: 15px; } +*/ + +a:focus, a:active, a:hover { +outline: 0 none !important; +} +.lime { +color:#C0CA55!important; +font-weight: bold !important; +} + +/* Back to top */ +.totop { + background: none; + bottom: 50px; + position: fixed; + right: 10px; + z-index: 104400; +} +.totop a, .totop a:visited { + color: gray; + display: block; + #height: 50px; + #line-height: 50px; + text-align: center; + min-width: 30px; +} +.totop a:hover { + color: #337ab7; + text-decoration: blink; +} + +.table-hover>tbody>tr:hover{ + background-color:#ddd !important; +} + +.highlight { + background-color: #ccc; +} +.btn-lime{ +background-color:#C0CA55; +border-color: gray; +} +.btn-lime:hover,.btn-lime:focus{ +background-color:#CED95B; +border-color: blue; +} +.fa{ +text-shadow: 1px 2px 1px #ababab; +} +.h1, h1 { +font-weight: 500; +text-shadow: 2px 2px 3px #ababab; +} +.h2, .h3, h2, h3 { +text-shadow: 1px 2px 1px #ababab; +} +.h1, .h2, .h3, h1, h2, h3 { +margin-bottom: 0.4em; +margin-top: 0.25em; +} \ No newline at end of file diff --git a/css/index_interface2.css b/css/index_interface2.css index f1f86be7..d18e1d94 100644 --- a/css/index_interface2.css +++ b/css/index_interface2.css @@ -127,8 +127,8 @@ body { list-style: none; display: inline; float: left; - width: 145px; - height: 36px; + width: 220px; + height: 40px; color:#9f9f9f; text-decoration:none; padding:8px 0px 0px 18px; @@ -139,8 +139,8 @@ body { list-style: none; display: inline; float: left; - width: 145px; - height: 36px; + width: 220px; + height: 40px; text-decoration:none; color:#49b848; } @@ -153,7 +153,7 @@ body { list-style: none; display: inline; float: left; - width: 145px; + width: 220px; height: 36px; text-decoration:none; color:#9f9f9f; @@ -162,7 +162,7 @@ body { } .item_2_half_height a{ float: left; - width: 145px; + width: 220px; height: 1px; text-decoration:none; color:#b8b8ba; @@ -172,7 +172,7 @@ body { list-style: none; display: inline; float: left; - width: 145px; + width: 220px; height: 36px; text-decoration:none; color:#05b0f7; @@ -183,7 +183,7 @@ list-style: none; } .item_2_half_height { float: left; - width: 145px; + width: 220px; height: 1px; display:none; } @@ -192,7 +192,7 @@ list-style: none; } .item_3_half_height { float: left; - width: 145px; + width: 220px; height: 1px; display:none; } @@ -201,7 +201,7 @@ list-style: none; list-style: none; display: inline; float: left; - width: 145px; + width: 220px; height: 36px; text-decoration:none; color:#9f9f9f; @@ -214,7 +214,7 @@ list-style: none; list-style: none; display: inline; float: left; - width: 145px; + width: 220px; height: 36px; text-decoration:none; color:#ff3506; @@ -343,9 +343,9 @@ a:active { .header { position : absolute; - width : 20%; - height : 38%; - top : 40%; + width : 50%; + height : 30%; + top : 30%; right : 0; bottom : auto; left : 0; @@ -354,31 +354,33 @@ a:active { #calllist { position : absolute; width : 50%; - height : 38%; + height : 28%; top : 2%; - left : 50%; - right : 0; + left : 48%; + right : 1%; /*max-height:180px;*/ bottom : auto; } #qstatus { position : absolute; width : 30%; - height : 38%; + height : 30%; top : 2%; - right : 0; - left: 20%; + right : 2%; + left: 17%; bottom : auto; /*max-height:38%;*/ } #casefunctions { position : absolute; - width : 17%; - height : 38%; - top : 2%; + width : 12%; + height : 30%; + top : 0; right : 0; - left: 3%; - font-size:15px; + left: 0; + font-size:18px; + padding:1%; + bottom : auto; } #casefunctions li { @@ -386,11 +388,12 @@ a:active { } #content { position : absolute; - top : 40%; - left : 0; + top : 31%; + left : 0.5%; + right :0.5%; bottom : auto; - width : 100%; - height : 60%; + width : 99%; + height : 69%; } .embeddedobject { width:100%; @@ -398,11 +401,11 @@ a:active { position:absolute; } #main-qstatus { - width:185px; + width:95%; /*max-height:116px;*/ position:absolute; left:3%; - top:2%; + top:1%; height:90%; border: 2px solid #e9e9eb; border-radius: 15px; @@ -431,7 +434,7 @@ margin: 0 auto; position:absolute; top:40%; height:60%; -width:160px; +width:260px; left:40%; list-style:none; } @@ -443,20 +446,21 @@ list-style:none; list-style: none; display: inline; float: left; - width: 145px; - height: 36px; + width: 220px; + height: 40px; color:#9f9f9f; text-decoration:none; padding:8px 0px 0px 18px; border:none; + margin-bottom: 20px; } .wait_li_1 a:hover{ list-style: none; display: inline; float: left; - width: 145px; - height: 36px; + width: 220px; + height: 40px; text-decoration:none; color:#49b848; } @@ -465,8 +469,8 @@ list-style:none; list-style: none; display: inline; float: left; - width: 145px; - height: 36px; + width: 220px; + height: 40px; color:#9f9f9f; text-decoration:none; padding:8px 0px 0px 18px; @@ -477,8 +481,8 @@ list-style:none; list-style: none; display: inline; float: left; - width: 145px; - height: 36px; + width: 220px; + height: 40px; text-decoration:none; color:#ff3506; } diff --git a/css/rs.css b/css/rs.css index 5d686fe2..67dca9d7 100644 --- a/css/rs.css +++ b/css/rs.css @@ -1,6 +1,15 @@ -body {background-color: #eeeeee;} +body {background-color: #eeeff2;} p.rstext { font-weight: bold; font-size: 16pt; font-family: Arial, sans-serif; } +.rs{ + border-radius: 8px; + border: 1px solid #e9e9eb; + font-size: 110%; + z-index: 500; + background: none repeat scroll 0 0 #fff; + font-family: Arial, sans-serif; + box-shadow: 3px 8px 18px; +} \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100644 index 00000000..bee9c681 --- /dev/null +++ b/css/style.css @@ -0,0 +1,354 @@ +/*@import url(http://fonts.googleapis.com/css?family=Roboto:400,600,700&subset=latin,latin-ext);*/ + +body, content { +/**/font-size: 15px; +line-height: 22px; +color: #666; +/*border-top: 0px solid #eee;*/ +background:#474F57; +padding-top: 52px; +/*font-family: Roboto, Open Sans, sans-serif;*/ +-webkit-font-smoothing: antialiased; +height:99.8%; +} + +main +.content { +/* margin-top:51px;*/ +} +.mainbar{ +position: relative; +margin-left: 18%; +margin-right: 0px; +/*padding: 5px;*/ +width: auto; +overflow:hidden; +background:#eee; +z-index: 50; +border:5px solid #ababab; +/*min-height: 600px;*/ +} +.embeddedobject{ +width: 100%; +height: 99%; +overflow:hidden; +} +.mainbar .container{ +max-width:100% !important; +width: 100% !important; + padding-left: 10px; + padding-right: 5px; +} + +.menubutton,.menubutton:focus,.menubutton:active{ +font-size:18px; +border-right:1px solid #333; +;padding-right:11px; +;padding-left:3px; +padding:3px; +margin-top: 3px; +color:#ddd; +line-height:40px; +text-decoration:none; +outline:none; +} +.menubutton:hover{ +color: red; +} + +a:focus{ +outline: 0 none !important; +} +.lime { +color:#C0CA55!important; +font-weight: bold !important; +} + +/* Navbar */ +.navbar *{ +font-weight: normal !important; +text-shadow:none !important; +} +.navbar{ +background-color: #404952; +min-height:20px; +border-bottom: 0px solid #436B91; +-webkit-box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2); +box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2); +} +.navbar .caret{ +border-top-color: #888; +border-bottom-color: #888; +} +.navbar li:hover .caret{ +border-top-color: #eee; +border-bottom-color: #eee; +} +.navbar-brand{ +color:#f1f1f1 !important; +font-size:22px; +margin:0px !important; +font-weight:normal; +padding:15px 20px 10px 15px; +text-shadow:1px 1px 1px rgba(150, 150, 150, 0.2) !important; +} +a.navbar-brand span.bold{ +font-weight: bold !important; +text-shadow:1px 1px 1px rgba(150, 150, 150, 0.2) !important; +} +.navbar-nav > li.user-data > a{ +color:#f3f3f3; +} +.navbar-nav > li > a { + padding-bottom: 10px; + padding-top: 15px; +} +.navbar-nav.pull-right .dropdown > a > i{ +font-size:20px; +line-height:25px; +} +.navbar-toggle{ +background:#f2f2f2; +border:1px solid #ccc; +border-radius:4px; +padding: 5px 5px; +font-size:13px; +} +.navbar-toggle:hover{ +background:#ddd; +} +.navbar li a{ +/*font-size: 13px !important;*/ +color:#777; +} +.navbar .nav > li > a{ +color: #aaa +} +.navbar li a:hover,.navbar li a:active,.navbar li a:focus,.nav .open > a, .nav .open > a:hover, .nav .open > a:focus{ +background:#59646E; +color:#C5CED6; +} +.navbar i{ +margin-right: 4px; +} +.navbar-nav > li > .dropdown-menu{ +} +.navbar .btn{ +color: #666 !important; +} +.navbar .label{ +padding:5px 7px !important; +font-size:11px; +border-radius:10px; +} +.nav > li > a .label{ +padding:3px 5px !important; +font-size:10px; +border-radius:10px; +position:absolute; +left:3px; +top:5px; +} +.navbar .label i{ +margin-right: 0px; +} +.navbar .progress{ +margin-bottom: 0px; +padding: 0px !important; +margin: 0px !important; +} + +/* Sidebar */ +.sidebar{ +width: 18%; +float: left; +display: block; +color: #777; +;position: relative; +} +.sidebar .sidebar-dropdown{ +;display: none; +} +.sidebar .sidebar-dropdown a{ +color: #fff !important; +box-shadow: inset 0px 0px 1px #000; +background-color: #3D3D3D; +padding:6px; +text-transform: uppercase; +text-align: center; +font-size: 11px; +display: block; +border-top: 2px solid #666; +border-bottom: 1px solid #333; +} +.sidebar ul{ +padding: 0px; +margin: 0px; +} +.sidebar ul li{ +list-style-type: none; +} +.sidebar #nav { +display: block; +width:100%; +margin:0 auto; +position: relative; +z-index: 51; +} +.sidebar #nav li i{ +display:inline-block; +margin-right: 10px; +margin-left: 5px; +/*;font-size:17px;*/ +color:#d4d4d4; +width:20px; +line-height: 22px; +text-align: center; +} +.sidebar #nav li span i{ +margin: 0px; +color: #999; +font-size:12px !important; +text-shadow: 0px -1px 1px rgba(0, 0, 0, 0.5); +background: transparent !important; +border: 0px; +} +.sidebar #nav > li > a { +display: block; +padding: 10px 10px; +font-size: 16px; +color: #C5CED6; +text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.6); +text-decoration: none; +border-top: 1px solid #515A63; +border-bottom: 1px solid #424A52; +background-color: #474F57; +} +.sidebar #nav > li:hover > a, .sidebar #nav > li > a.open, .sidebar #nav > li > a.subdrop { +color: #e9e9e9; +border-top: 1px solid #4F5861; +border-bottom: 1px solid #3C434A; +background-color: #3C434A; +box-shadow: none; +color: #fff; +} +.sidebar #nav > li > a:hover i, .sidebar #nav > li > a.open i, .sidebar #nav > li > a.subdrop i{ +color: #fff; +} +.sidebar #nav > li > a:hover span i, .sidebar #nav > li > a.open span i, .sidebar #nav > li > a.subdrop span i{ +color: #fff; +background: transparent !important; +border: 0px; +} + +.sidebar #nav li ul { display: none; background: #efefef; } + +.sidebar #nav li ul li a { +display: block; +background: #2E3338; +padding: 5px 10px; +padding-left: 20px; +text-decoration: none; +color: #bbb; +border-bottom: 1px solid #2E3338; +box-shadow: inset 0px 1px 0px rgba(0, 0, 0, 0.1); +} +.sidebar #nav li ul li a:hover,.sidebar #nav li ul li a.active { +background: #59646E; +color:#ccc; +border-bottom: 1px solid #59646E; +} +.sidebar #nav .has_sub ul i{ +/*;font-size: 14px;*/ +width:16px; +margin-left:0px; +/*margin-right:6px;*/ +} +.sidebar #nav .has_sub .has_sub a.subdrop, .sidebar #nav .has_sub .has_sub a.subdrop i{ +background: #59646E; +color:#fff; +} +.sidebar #nav .has_sub .has_sub ul a{ +padding-left: 40px; +} +.sidebar #nav .has_sub .has_sub .has_sub ul a{ +padding-left: 60px; +} +.sidebar-widget{ +padding:10px 4px; +} + + +.content.enlarged .sidebar{ +width:50px; +} +.content.enlarged .mainbar{ +margin-left:50px; +} +.content.enlarged .sidebar .navbar-form:hover{ +width:300px; +position:relative; +z-index:100; +} +.content.enlarged .sidebar #nav > li{ +white-space: wrap; /* changed from nowrap */ +} +.content.enlarged .sidebar #nav > li > ul{ +display:none; +} +.content.enlarged .sidebar #nav > li:hover > ul{ +position:absolute; +left:50px; +width:280px; +display:block; +} +.content.enlarged .sidebar #nav ul li:hover > a{ +background: #59646E !important; +color:#fff; +} +.content.enlarged .sidebar #nav ul li:hover > a i{ +background: #59646E !important; +color:#fff; +} +.content.enlarged .sidebar #nav ul li:hover > ul{ +position:absolute; +left:280px; +margin-top:-32px; +width:280px; +display:block; +} +.content.enlarged .sidebar #nav > li:hover > ul a{ +background:#2E3338; +padding-left:10px; +border:none; +box-shadow:none; +position:relative; +} + +.content.enlarged .sidebar #nav ul li> a span.pull-right{ +position: absolute; +right:5px; +top:5px; +} +.content.enlarged .sidebar #nav > li > a span{ +display:none; +padding-left:20px; +} +.content.enlarged .sidebar #nav > li:hover > a span.pull-right{ +position: absolute; +right:10px; +top:7px; +} +.content.enlarged .sidebar #nav > li:hover > a{ +width:330px; +position:relative; +} +.content.enlarged .sidebar #nav > li{ +position:relative; +} +.content.enlarged .sidebar #nav > li:hover > a span{ +display:inline; +} +.content.enlarged .sidebar .navbar-form{ +padding: 10px 7px; +} diff --git a/css/tabber_interface2.css b/css/tabber_interface2.css index 5f3cd627..fcb58b4f 100644 --- a/css/tabber_interface2.css +++ b/css/tabber_interface2.css @@ -45,7 +45,7 @@ ul.tabbernav li a border-bottom: none; background: #e9e9eb; text-decoration: none; - font-size: 9px; + font-size: 12px; border-top-left-radius: 5px; -moz-border-radius-topleft: 5px; border-top-right-radius: 5px; diff --git a/css/timepicker.css b/css/timepicker.css deleted file mode 100644 index f842347d..00000000 --- a/css/timepicker.css +++ /dev/null @@ -1,7 +0,0 @@ -/* css for timepicker */ -.ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; } -.ui-timepicker-div dl{ text-align: left; } -.ui-timepicker-div dl dt{ height: 25px; } -.ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; } -.ui-timepicker-div td { font-size: 90%; } - diff --git a/database/quexs.sql b/database/quexs.sql index b04bed29..e36c7798 100644 --- a/database/quexs.sql +++ b/database/quexs.sql @@ -1,13 +1,14 @@ -- phpMyAdmin SQL Dump --- version 2.11.8.1deb5+lenny9 +-- version 3.4.10.1deb1 -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Feb 28, 2013 at 09:35 AM --- Server version: 5.0.51 --- PHP Version: 5.2.6-1+lenny16 +-- Generation Time: Aug 03, 2015 at 12:47 PM +-- Server version: 5.5.44 +-- PHP Version: 5.3.10-1ubuntu3.19 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; @@ -16,7 +17,7 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET NAMES utf8 */; -- --- Database: `quexs_ictest` +-- Database: `quexs` -- -- -------------------------------------------------------- @@ -26,26 +27,21 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- CREATE TABLE `appointment` ( - `appointment_id` bigint(20) NOT NULL auto_increment, + `appointment_id` bigint(20) NOT NULL AUTO_INCREMENT, `case_id` bigint(20) NOT NULL, `contact_phone_id` bigint(20) NOT NULL, `call_attempt_id` bigint(20) NOT NULL, `start` datetime NOT NULL, `end` datetime NOT NULL, - `require_operator_id` bigint(20) default NULL, + `require_operator_id` bigint(20) DEFAULT NULL, `respondent_id` bigint(20) NOT NULL, - `completed_call_id` bigint(20) default NULL, - PRIMARY KEY (`appointment_id`), + `completed_call_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`appointment_id`), KEY `completed_call_id` (`completed_call_id`), KEY `call_attempt_id` (`call_attempt_id`), KEY `case_id` (`case_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `appointment` --- - - -- -------------------------------------------------------- -- @@ -53,12 +49,12 @@ CREATE TABLE `appointment` ( -- CREATE TABLE `availability` ( - `availability_id` bigint(20) NOT NULL auto_increment, + `availability_id` bigint(20) NOT NULL AUTO_INCREMENT, `availability_group_id` bigint(20) NOT NULL, `start` time NOT NULL, `end` time NOT NULL, `day_of_week` tinyint(1) NOT NULL, - PRIMARY KEY (`availability_id`), + PRIMARY KEY (`availability_id`), KEY `availability_group_id` (`availability_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -90,9 +86,9 @@ INSERT INTO `availability` (`availability_id`, `availability_group_id`, `start`, -- CREATE TABLE `availability_group` ( - `availability_group_id` bigint(20) NOT NULL auto_increment, - `description` text collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`availability_group_id`) + `availability_group_id` bigint(20) NOT NULL AUTO_INCREMENT, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`availability_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- @@ -111,17 +107,17 @@ INSERT INTO `availability_group` (`availability_group_id`, `description`) VALUES -- CREATE TABLE `call` ( - `call_id` bigint(20) NOT NULL auto_increment, + `call_id` bigint(20) NOT NULL AUTO_INCREMENT, `operator_id` bigint(20) NOT NULL, `respondent_id` bigint(20) NOT NULL, `case_id` bigint(20) NOT NULL, `contact_phone_id` bigint(20) NOT NULL, `call_attempt_id` bigint(20) NOT NULL, `start` datetime NOT NULL, - `end` datetime default NULL, - `outcome_id` int(11) NOT NULL default '0', - `state` tinyint(1) NOT NULL default '0' COMMENT '0 not called, 1 requesting call, 2 ringing, 3 answered, 4 requires coding, 5 done', - PRIMARY KEY (`call_id`), + `end` datetime DEFAULT NULL, + `outcome_id` int(11) NOT NULL DEFAULT '0', + `state` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 not called, 1 requesting call, 2 ringing, 3 answered, 4 requires coding, 5 done', + PRIMARY KEY (`call_id`), KEY `operator_id` (`operator_id`), KEY `case_id` (`case_id`), KEY `call_attempt_id` (`call_attempt_id`), @@ -129,11 +125,6 @@ CREATE TABLE `call` ( KEY `start` (`start`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `call` --- - - -- -------------------------------------------------------- -- @@ -141,23 +132,18 @@ CREATE TABLE `call` ( -- CREATE TABLE `call_attempt` ( - `call_attempt_id` bigint(20) NOT NULL auto_increment, + `call_attempt_id` bigint(20) NOT NULL AUTO_INCREMENT, `case_id` bigint(20) NOT NULL, `operator_id` bigint(20) NOT NULL, `respondent_id` bigint(20) NOT NULL, `start` datetime NOT NULL, - `end` datetime default NULL, - PRIMARY KEY (`call_attempt_id`), + `end` datetime DEFAULT NULL, + PRIMARY KEY (`call_attempt_id`), KEY `case_id` (`case_id`), KEY `end` (`end`), KEY `respondent_id` (`respondent_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `call_attempt` --- - - -- -------------------------------------------------------- -- @@ -165,20 +151,15 @@ CREATE TABLE `call_attempt` ( -- CREATE TABLE `call_note` ( - `call_note_id` bigint(20) NOT NULL auto_increment, + `call_note_id` bigint(20) NOT NULL AUTO_INCREMENT, `call_id` bigint(20) NOT NULL, `operator_id` bigint(20) NOT NULL, - `note` text collate utf8_unicode_ci NOT NULL, + `note` text COLLATE utf8_unicode_ci NOT NULL, `datetime` datetime NOT NULL, - PRIMARY KEY (`call_note_id`), + PRIMARY KEY (`call_note_id`), KEY `call_id` (`call_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `call_note` --- - - -- -------------------------------------------------------- -- @@ -212,8 +193,8 @@ INSERT INTO `call_restrict` (`day_of_week`, `start`, `end`) VALUES(7, '09:00:00' CREATE TABLE `call_state` ( `call_state_id` tinyint(1) NOT NULL, - `description` varchar(255) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`call_state_id`) + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`call_state_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- @@ -234,16 +215,16 @@ INSERT INTO `call_state` (`call_state_id`, `description`) VALUES(5, 'Done'); -- CREATE TABLE `case` ( - `case_id` bigint(20) NOT NULL auto_increment, + `case_id` bigint(20) NOT NULL AUTO_INCREMENT, `sample_id` bigint(20) NOT NULL, `questionnaire_id` bigint(20) NOT NULL, - `last_call_id` bigint(20) default NULL, - `current_operator_id` bigint(20) default NULL, - `current_call_id` bigint(20) default NULL, - `current_outcome_id` int(11) NOT NULL default '1', - `sortorder` int(11) default NULL, - `token` varchar(36) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`case_id`), + `last_call_id` bigint(20) DEFAULT NULL, + `current_operator_id` bigint(20) DEFAULT NULL, + `current_call_id` bigint(20) DEFAULT NULL, + `current_outcome_id` int(11) NOT NULL DEFAULT '1', + `sortorder` int(11) DEFAULT NULL, + `token` varchar(36) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`case_id`), UNIQUE KEY `onecasepersample` (`sample_id`,`questionnaire_id`), UNIQUE KEY `token` (`token`), UNIQUE KEY `current_operator_id` (`current_operator_id`), @@ -254,11 +235,6 @@ CREATE TABLE `case` ( KEY `last_call_id` (`last_call_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `case` --- - - -- -------------------------------------------------------- -- @@ -268,14 +244,9 @@ CREATE TABLE `case` ( CREATE TABLE `case_availability` ( `case_id` bigint(20) NOT NULL, `availability_group_id` bigint(20) NOT NULL, - PRIMARY KEY (`case_id`,`availability_group_id`) + PRIMARY KEY (`case_id`,`availability_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `case_availability` --- - - -- -------------------------------------------------------- -- @@ -283,29 +254,31 @@ CREATE TABLE `case_availability` ( -- CREATE TABLE `case_note` ( - `case_note_id` bigint(20) NOT NULL auto_increment, + `case_note_id` bigint(20) NOT NULL AUTO_INCREMENT, `case_id` bigint(20) NOT NULL, `operator_id` bigint(20) NOT NULL, - `note` text collate utf8_unicode_ci NOT NULL, + `note` text COLLATE utf8_unicode_ci NOT NULL, `datetime` datetime NOT NULL, - PRIMARY KEY (`case_note_id`), + PRIMARY KEY (`case_note_id`), KEY `case_id` (`case_id`), KEY `operator_id` (`operator_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +-- -------------------------------------------------------- + -- -- Table structure for table `case_queue` -- CREATE TABLE `case_queue` ( - `case_queue_id` bigint(20) NOT NULL auto_increment, + `case_queue_id` bigint(20) NOT NULL AUTO_INCREMENT, `case_id` bigint(20) NOT NULL, `operator_id` bigint(20) NOT NULL, `sortorder` int(11) NOT NULL, - PRIMARY KEY (`case_queue_id`), + PRIMARY KEY (`case_queue_id`), UNIQUE KEY `case_id` (`case_id`), KEY `operator_id` (`operator_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- @@ -314,20 +287,15 @@ CREATE TABLE `case_queue` ( -- CREATE TABLE `client` ( - `client_id` bigint(20) NOT NULL auto_increment, - `username` varchar(255) collate utf8_unicode_ci NOT NULL, - `firstName` varchar(255) collate utf8_unicode_ci NOT NULL, - `lastName` varchar(255) collate utf8_unicode_ci NOT NULL, - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`client_id`), + `client_id` bigint(20) NOT NULL AUTO_INCREMENT, + `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `firstName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `lastName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`client_id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `client` --- - - -- -------------------------------------------------------- -- @@ -337,14 +305,9 @@ CREATE TABLE `client` ( CREATE TABLE `client_questionnaire` ( `client_id` bigint(20) NOT NULL, `questionnaire_id` bigint(20) NOT NULL, - PRIMARY KEY (`client_id`,`questionnaire_id`) + PRIMARY KEY (`client_id`,`questionnaire_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `client_questionnaire` --- - - -- -------------------------------------------------------- -- @@ -352,20 +315,15 @@ CREATE TABLE `client_questionnaire` ( -- CREATE TABLE `contact_phone` ( - `contact_phone_id` bigint(20) NOT NULL auto_increment, + `contact_phone_id` bigint(20) NOT NULL AUTO_INCREMENT, `case_id` bigint(20) NOT NULL, - `priority` tinyint(1) NOT NULL default '1', - `phone` char(30) collate utf8_unicode_ci NOT NULL, - `description` varchar(255) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`contact_phone_id`), + `priority` tinyint(1) NOT NULL DEFAULT '1', + `phone` char(30) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`contact_phone_id`), KEY `case_id` (`case_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `contact_phone` --- - - -- -------------------------------------------------------- -- @@ -374,7 +332,7 @@ CREATE TABLE `contact_phone` ( CREATE TABLE `day_of_week` ( `day_of_week` tinyint(1) NOT NULL, - PRIMARY KEY (`day_of_week`) + PRIMARY KEY (`day_of_week`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- @@ -395,7 +353,7 @@ INSERT INTO `day_of_week` (`day_of_week`) VALUES(7); -- Table structure for table `extension` -- -CREATE TABLE IF NOT EXISTS `extension` ( +CREATE TABLE `extension` ( `extension_id` int(11) NOT NULL AUTO_INCREMENT, `extension` char(10) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -404,7 +362,7 @@ CREATE TABLE IF NOT EXISTS `extension` ( PRIMARY KEY (`extension_id`), UNIQUE KEY `extension` (`extension`), UNIQUE KEY `current_operator_id` (`current_operator_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- @@ -413,22 +371,17 @@ CREATE TABLE IF NOT EXISTS `extension` ( -- CREATE TABLE `lime_answers` ( - `qid` int(11) NOT NULL default '0', - `code` varchar(5) collate utf8_unicode_ci NOT NULL default '', - `answer` text collate utf8_unicode_ci NOT NULL, - `assessment_value` int(11) NOT NULL default '0', + `qid` int(11) NOT NULL DEFAULT '0', + `code` varchar(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `answer` text COLLATE utf8_unicode_ci NOT NULL, + `assessment_value` int(11) NOT NULL DEFAULT '0', `sortorder` int(11) NOT NULL, - `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en', - `scale_id` tinyint(4) NOT NULL default '0', - PRIMARY KEY (`qid`,`code`,`language`,`scale_id`), + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en', + `scale_id` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`qid`,`code`,`language`,`scale_id`), KEY `answers_idx2` (`sortorder`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_answers` --- - - -- -------------------------------------------------------- -- @@ -436,25 +389,20 @@ CREATE TABLE `lime_answers` ( -- CREATE TABLE `lime_assessments` ( - `id` int(11) NOT NULL auto_increment, - `sid` int(11) NOT NULL default '0', - `scope` varchar(5) collate utf8_unicode_ci NOT NULL default '', - `gid` int(11) NOT NULL default '0', - `name` text collate utf8_unicode_ci NOT NULL, - `minimum` varchar(50) collate utf8_unicode_ci NOT NULL default '', - `maximum` varchar(50) collate utf8_unicode_ci NOT NULL default '', - `message` text collate utf8_unicode_ci NOT NULL, - `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en', - PRIMARY KEY (`id`,`language`), + `id` int(11) NOT NULL AUTO_INCREMENT, + `sid` int(11) NOT NULL DEFAULT '0', + `scope` varchar(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `gid` int(11) NOT NULL DEFAULT '0', + `name` text COLLATE utf8_unicode_ci NOT NULL, + `minimum` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `maximum` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `message` text COLLATE utf8_unicode_ci NOT NULL, + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en', + PRIMARY KEY (`id`,`language`), KEY `assessments_idx2` (`sid`), KEY `assessments_idx3` (`gid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_assessments` --- - - -- -------------------------------------------------------- -- @@ -462,23 +410,18 @@ CREATE TABLE `lime_assessments` ( -- CREATE TABLE `lime_conditions` ( - `cid` int(11) NOT NULL auto_increment, - `qid` int(11) NOT NULL default '0', - `scenario` int(11) NOT NULL default '1', - `cqid` int(11) NOT NULL default '0', - `cfieldname` varchar(50) collate utf8_unicode_ci NOT NULL default '', - `method` char(5) collate utf8_unicode_ci NOT NULL default '', - `value` varchar(255) collate utf8_unicode_ci NOT NULL default '', - PRIMARY KEY (`cid`), + `cid` int(11) NOT NULL AUTO_INCREMENT, + `qid` int(11) NOT NULL DEFAULT '0', + `scenario` int(11) NOT NULL DEFAULT '1', + `cqid` int(11) NOT NULL DEFAULT '0', + `cfieldname` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `method` char(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + PRIMARY KEY (`cid`), KEY `conditions_idx2` (`qid`), KEY `conditions_idx3` (`cqid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_conditions` --- - - -- -------------------------------------------------------- -- @@ -486,20 +429,15 @@ CREATE TABLE `lime_conditions` ( -- CREATE TABLE `lime_defaultvalues` ( - `qid` int(11) NOT NULL default '0', - `specialtype` varchar(20) collate utf8_unicode_ci NOT NULL default '', - `scale_id` int(11) NOT NULL default '0', - `sqid` int(11) NOT NULL default '0', - `language` varchar(20) collate utf8_unicode_ci NOT NULL, - `defaultvalue` text collate utf8_unicode_ci, - PRIMARY KEY (`qid`,`scale_id`,`language`,`specialtype`,`sqid`) + `qid` int(11) NOT NULL DEFAULT '0', + `specialtype` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `scale_id` int(11) NOT NULL DEFAULT '0', + `sqid` int(11) NOT NULL DEFAULT '0', + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `defaultvalue` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`qid`,`scale_id`,`language`,`specialtype`,`sqid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_defaultvalues` --- - - -- -------------------------------------------------------- -- @@ -507,24 +445,19 @@ CREATE TABLE `lime_defaultvalues` ( -- CREATE TABLE `lime_expression_errors` ( - `id` int(9) NOT NULL auto_increment, - `errortime` varchar(50) collate utf8_unicode_ci default NULL, - `sid` int(11) default NULL, - `gid` int(11) default NULL, - `qid` int(11) default NULL, - `gseq` int(11) default NULL, - `qseq` int(11) default NULL, - `type` varchar(50) collate utf8_unicode_ci default NULL, - `eqn` text collate utf8_unicode_ci, - `prettyprint` text collate utf8_unicode_ci, - PRIMARY KEY (`id`) + `id` int(9) NOT NULL AUTO_INCREMENT, + `errortime` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `sid` int(11) DEFAULT NULL, + `gid` int(11) DEFAULT NULL, + `qid` int(11) DEFAULT NULL, + `gseq` int(11) DEFAULT NULL, + `qseq` int(11) DEFAULT NULL, + `type` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `eqn` text COLLATE utf8_unicode_ci, + `prettyprint` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_expression_errors` --- - - -- -------------------------------------------------------- -- @@ -532,18 +465,13 @@ CREATE TABLE `lime_expression_errors` ( -- CREATE TABLE `lime_failed_login_attempts` ( - `id` int(11) NOT NULL auto_increment, - `ip` varchar(37) collate utf8_unicode_ci NOT NULL, - `last_attempt` varchar(20) collate utf8_unicode_ci NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `ip` varchar(37) COLLATE utf8_unicode_ci NOT NULL, + `last_attempt` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `number_attempts` int(11) NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_failed_login_attempts` --- - - -- -------------------------------------------------------- -- @@ -551,23 +479,18 @@ CREATE TABLE `lime_failed_login_attempts` ( -- CREATE TABLE `lime_groups` ( - `gid` int(11) NOT NULL auto_increment, - `sid` int(11) NOT NULL default '0', - `group_name` varchar(100) collate utf8_unicode_ci NOT NULL default '', - `group_order` int(11) NOT NULL default '0', - `description` text collate utf8_unicode_ci, - `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en', - `randomization_group` varchar(20) collate utf8_unicode_ci NOT NULL default '', - `grelevance` text collate utf8_unicode_ci, - PRIMARY KEY (`gid`,`language`), + `gid` int(11) NOT NULL AUTO_INCREMENT, + `sid` int(11) NOT NULL DEFAULT '0', + `group_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `group_order` int(11) NOT NULL DEFAULT '0', + `description` text COLLATE utf8_unicode_ci, + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en', + `randomization_group` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `grelevance` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`gid`,`language`), KEY `groups_idx2` (`sid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_groups` --- - - -- -------------------------------------------------------- -- @@ -575,21 +498,16 @@ CREATE TABLE `lime_groups` ( -- CREATE TABLE `lime_labels` ( - `lid` int(11) NOT NULL default '0', - `code` varchar(5) collate utf8_unicode_ci NOT NULL default '', - `title` text collate utf8_unicode_ci, + `lid` int(11) NOT NULL DEFAULT '0', + `code` varchar(5) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `title` text COLLATE utf8_unicode_ci, `sortorder` int(11) NOT NULL, - `assessment_value` int(11) NOT NULL default '0', - `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en', - PRIMARY KEY (`lid`,`sortorder`,`language`), + `assessment_value` int(11) NOT NULL DEFAULT '0', + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en', + PRIMARY KEY (`lid`,`sortorder`,`language`), KEY `ixcode` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_labels` --- - - -- -------------------------------------------------------- -- @@ -597,17 +515,12 @@ CREATE TABLE `lime_labels` ( -- CREATE TABLE `lime_labelsets` ( - `lid` int(11) NOT NULL auto_increment, - `label_name` varchar(100) collate utf8_unicode_ci NOT NULL default '', - `languages` varchar(200) collate utf8_unicode_ci default 'en', - PRIMARY KEY (`lid`) + `lid` int(11) NOT NULL AUTO_INCREMENT, + `label_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `languages` varchar(200) COLLATE utf8_unicode_ci DEFAULT 'en', + PRIMARY KEY (`lid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_labelsets` --- - - -- -------------------------------------------------------- -- @@ -615,21 +528,16 @@ CREATE TABLE `lime_labelsets` ( -- CREATE TABLE `lime_participants` ( - `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, - `firstname` varchar(40) collate utf8_unicode_ci default NULL, - `lastname` varchar(40) collate utf8_unicode_ci default NULL, - `email` varchar(80) collate utf8_unicode_ci default NULL, - `language` varchar(40) collate utf8_unicode_ci default NULL, - `blacklisted` varchar(1) collate utf8_unicode_ci NOT NULL, + `participant_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `firstname` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, + `lastname` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, + `email` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL, + `language` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, + `blacklisted` varchar(1) COLLATE utf8_unicode_ci NOT NULL, `owner_uid` int(20) NOT NULL, - PRIMARY KEY (`participant_id`) + PRIMARY KEY (`participant_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_participants` --- - - -- -------------------------------------------------------- -- @@ -637,17 +545,12 @@ CREATE TABLE `lime_participants` ( -- CREATE TABLE `lime_participant_attribute` ( - `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `participant_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `attribute_id` int(11) NOT NULL, - `value` varchar(50) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`participant_id`,`attribute_id`) + `value` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`participant_id`,`attribute_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_participant_attribute` --- - - -- -------------------------------------------------------- -- @@ -655,17 +558,12 @@ CREATE TABLE `lime_participant_attribute` ( -- CREATE TABLE `lime_participant_attribute_names` ( - `attribute_id` int(11) NOT NULL auto_increment, - `attribute_type` varchar(4) collate utf8_unicode_ci NOT NULL, - `visible` char(5) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`attribute_id`,`attribute_type`) + `attribute_id` int(11) NOT NULL AUTO_INCREMENT, + `attribute_type` varchar(4) COLLATE utf8_unicode_ci NOT NULL, + `visible` char(5) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`attribute_id`,`attribute_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_participant_attribute_names` --- - - -- -------------------------------------------------------- -- @@ -674,16 +572,11 @@ CREATE TABLE `lime_participant_attribute_names` ( CREATE TABLE `lime_participant_attribute_names_lang` ( `attribute_id` int(11) NOT NULL, - `attribute_name` varchar(30) collate utf8_unicode_ci NOT NULL, - `lang` varchar(20) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`attribute_id`,`lang`) + `attribute_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `lang` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`attribute_id`,`lang`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_participant_attribute_names_lang` --- - - -- -------------------------------------------------------- -- @@ -691,17 +584,12 @@ CREATE TABLE `lime_participant_attribute_names_lang` ( -- CREATE TABLE `lime_participant_attribute_values` ( - `value_id` int(11) NOT NULL auto_increment, + `value_id` int(11) NOT NULL AUTO_INCREMENT, `attribute_id` int(11) NOT NULL, - `value` varchar(20) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`value_id`) + `value` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`value_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_participant_attribute_values` --- - - -- -------------------------------------------------------- -- @@ -709,18 +597,13 @@ CREATE TABLE `lime_participant_attribute_values` ( -- CREATE TABLE `lime_participant_shares` ( - `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `participant_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `share_uid` int(11) NOT NULL, `date_added` datetime NOT NULL, - `can_edit` varchar(5) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`participant_id`,`share_uid`) + `can_edit` varchar(5) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`participant_id`,`share_uid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_participant_shares` --- - - -- -------------------------------------------------------- -- @@ -728,34 +611,29 @@ CREATE TABLE `lime_participant_shares` ( -- CREATE TABLE `lime_questions` ( - `qid` int(11) NOT NULL auto_increment, - `parent_qid` int(11) NOT NULL default '0', - `sid` int(11) NOT NULL default '0', - `gid` int(11) NOT NULL default '0', - `type` char(1) collate utf8_unicode_ci NOT NULL default 'T', - `title` varchar(20) collate utf8_unicode_ci NOT NULL default '', - `question` text collate utf8_unicode_ci NOT NULL, - `preg` text collate utf8_unicode_ci, - `help` text collate utf8_unicode_ci, - `other` char(1) collate utf8_unicode_ci NOT NULL default 'N', - `mandatory` char(1) collate utf8_unicode_ci default NULL, + `qid` int(11) NOT NULL AUTO_INCREMENT, + `parent_qid` int(11) NOT NULL DEFAULT '0', + `sid` int(11) NOT NULL DEFAULT '0', + `gid` int(11) NOT NULL DEFAULT '0', + `type` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'T', + `title` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `question` text COLLATE utf8_unicode_ci NOT NULL, + `preg` text COLLATE utf8_unicode_ci, + `help` text COLLATE utf8_unicode_ci, + `other` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'N', + `mandatory` char(1) COLLATE utf8_unicode_ci DEFAULT NULL, `question_order` int(11) NOT NULL, - `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en', - `scale_id` tinyint(4) NOT NULL default '0', - `same_default` tinyint(4) NOT NULL default '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog', - `relevance` text collate utf8_unicode_ci, - PRIMARY KEY (`qid`,`language`), + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en', + `scale_id` tinyint(4) NOT NULL DEFAULT '0', + `same_default` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog', + `relevance` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`qid`,`language`), KEY `questions_idx2` (`sid`), KEY `questions_idx3` (`gid`), KEY `questions_idx4` (`type`), KEY `parent_qid_idx` (`parent_qid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_questions` --- - - -- -------------------------------------------------------- -- @@ -763,21 +641,16 @@ CREATE TABLE `lime_questions` ( -- CREATE TABLE `lime_question_attributes` ( - `qaid` int(11) NOT NULL auto_increment, - `qid` int(11) NOT NULL default '0', - `attribute` varchar(50) collate utf8_unicode_ci default NULL, - `value` text collate utf8_unicode_ci, - `language` varchar(20) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`qaid`), + `qaid` int(11) NOT NULL AUTO_INCREMENT, + `qid` int(11) NOT NULL DEFAULT '0', + `attribute` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `value` text COLLATE utf8_unicode_ci, + `language` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`qaid`), KEY `question_attributes_idx2` (`qid`), KEY `question_attributes_idx3` (`attribute`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_question_attributes` --- - - -- -------------------------------------------------------- -- @@ -785,22 +658,17 @@ CREATE TABLE `lime_question_attributes` ( -- CREATE TABLE `lime_quota` ( - `id` int(11) NOT NULL auto_increment, - `sid` int(11) default NULL, - `name` varchar(255) collate utf8_unicode_ci default NULL, - `qlimit` int(8) default NULL, - `action` int(2) default NULL, - `active` int(1) NOT NULL default '1', - `autoload_url` int(1) NOT NULL default '0', - PRIMARY KEY (`id`), + `id` int(11) NOT NULL AUTO_INCREMENT, + `sid` int(11) DEFAULT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `qlimit` int(8) DEFAULT NULL, + `action` int(2) DEFAULT NULL, + `active` int(1) NOT NULL DEFAULT '1', + `autoload_url` int(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), KEY `quota_idx2` (`sid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_quota` --- - - -- -------------------------------------------------------- -- @@ -808,21 +676,16 @@ CREATE TABLE `lime_quota` ( -- CREATE TABLE `lime_quota_languagesettings` ( - `quotals_id` int(11) NOT NULL auto_increment, - `quotals_quota_id` int(11) NOT NULL default '0', - `quotals_language` varchar(45) collate utf8_unicode_ci NOT NULL default 'en', - `quotals_name` varchar(255) collate utf8_unicode_ci default NULL, - `quotals_message` text collate utf8_unicode_ci NOT NULL, - `quotals_url` varchar(255) collate utf8_unicode_ci default NULL, - `quotals_urldescrip` varchar(255) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`quotals_id`) + `quotals_id` int(11) NOT NULL AUTO_INCREMENT, + `quotals_quota_id` int(11) NOT NULL DEFAULT '0', + `quotals_language` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en', + `quotals_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `quotals_message` text COLLATE utf8_unicode_ci NOT NULL, + `quotals_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `quotals_urldescrip` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`quotals_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_quota_languagesettings` --- - - -- -------------------------------------------------------- -- @@ -830,20 +693,15 @@ CREATE TABLE `lime_quota_languagesettings` ( -- CREATE TABLE `lime_quota_members` ( - `id` int(11) NOT NULL auto_increment, - `sid` int(11) default NULL, - `qid` int(11) default NULL, - `quota_id` int(11) default NULL, - `code` varchar(11) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`id`), + `id` int(11) NOT NULL AUTO_INCREMENT, + `sid` int(11) DEFAULT NULL, + `qid` int(11) DEFAULT NULL, + `quota_id` int(11) DEFAULT NULL, + `code` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), UNIQUE KEY `sid` (`sid`,`qid`,`quota_id`,`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_quota_members` --- - - -- -------------------------------------------------------- -- @@ -851,28 +709,23 @@ CREATE TABLE `lime_quota_members` ( -- CREATE TABLE `lime_saved_control` ( - `scid` int(11) NOT NULL auto_increment, - `sid` int(11) NOT NULL default '0', - `srid` int(11) NOT NULL default '0', + `scid` int(11) NOT NULL AUTO_INCREMENT, + `sid` int(11) NOT NULL DEFAULT '0', + `srid` int(11) NOT NULL DEFAULT '0', `identifier` bigint(20) NOT NULL, - `access_code` text collate utf8_unicode_ci NOT NULL, - `email` varchar(320) collate utf8_unicode_ci default NULL, - `ip` text collate utf8_unicode_ci NOT NULL, - `saved_thisstep` text collate utf8_unicode_ci NOT NULL, - `status` char(1) collate utf8_unicode_ci NOT NULL default '', + `access_code` text COLLATE utf8_unicode_ci NOT NULL, + `email` varchar(320) COLLATE utf8_unicode_ci DEFAULT NULL, + `ip` text COLLATE utf8_unicode_ci NOT NULL, + `saved_thisstep` text COLLATE utf8_unicode_ci NOT NULL, + `status` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `saved_date` datetime NOT NULL, - `refurl` text collate utf8_unicode_ci, - PRIMARY KEY (`scid`), + `refurl` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`scid`), KEY `saved_control_idx2` (`sid`), KEY `identifier` (`identifier`), KEY `srid` (`srid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_saved_control` --- - - -- -------------------------------------------------------- -- @@ -880,22 +733,17 @@ CREATE TABLE `lime_saved_control` ( -- CREATE TABLE `lime_sessions` ( - `sesskey` varchar(64) collate utf8_unicode_ci NOT NULL default '', + `sesskey` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `expiry` datetime NOT NULL, - `expireref` varchar(250) collate utf8_unicode_ci default '', + `expireref` varchar(250) COLLATE utf8_unicode_ci DEFAULT '', `created` datetime NOT NULL, `modified` datetime NOT NULL, - `sessdata` longtext collate utf8_unicode_ci, - PRIMARY KEY (`sesskey`), + `sessdata` longtext COLLATE utf8_unicode_ci, + PRIMARY KEY (`sesskey`), KEY `sess2_expiry` (`expiry`), KEY `sess2_expireref` (`expireref`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_sessions` --- - - -- -------------------------------------------------------- -- @@ -903,9 +751,9 @@ CREATE TABLE `lime_sessions` ( -- CREATE TABLE `lime_settings_global` ( - `stg_name` varchar(50) collate utf8_unicode_ci NOT NULL default '', - `stg_value` varchar(255) collate utf8_unicode_ci NOT NULL default '', - PRIMARY KEY (`stg_name`) + `stg_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `stg_value` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + PRIMARY KEY (`stg_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- @@ -924,69 +772,64 @@ INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('SessionName CREATE TABLE `lime_surveys` ( `sid` int(11) NOT NULL, `owner_id` int(11) NOT NULL, - `admin` varchar(50) collate utf8_unicode_ci default NULL, - `active` char(1) collate utf8_unicode_ci NOT NULL default 'N', - `expires` datetime default NULL, - `startdate` datetime default NULL, - `adminemail` varchar(320) collate utf8_unicode_ci default NULL, - `anonymized` char(1) collate utf8_unicode_ci NOT NULL default 'N', - `faxto` varchar(20) collate utf8_unicode_ci default NULL, - `format` char(1) collate utf8_unicode_ci default NULL, - `savetimings` char(1) collate utf8_unicode_ci default 'N', - `template` varchar(100) collate utf8_unicode_ci default 'default', - `language` varchar(50) collate utf8_unicode_ci default NULL, - `additional_languages` varchar(255) collate utf8_unicode_ci default NULL, - `datestamp` char(1) collate utf8_unicode_ci default 'N', - `usecookie` char(1) collate utf8_unicode_ci default 'N', - `allowregister` char(1) collate utf8_unicode_ci default 'N', - `allowsave` char(1) collate utf8_unicode_ci default 'Y', - `autonumber_start` bigint(11) default '0', - `autoredirect` char(1) collate utf8_unicode_ci default 'N', - `allowprev` char(1) collate utf8_unicode_ci default 'Y', - `printanswers` char(1) collate utf8_unicode_ci default 'N', - `ipaddr` char(1) collate utf8_unicode_ci default 'N', - `refurl` char(1) collate utf8_unicode_ci default 'N', - `datecreated` date default NULL, - `publicstatistics` char(1) collate utf8_unicode_ci default 'N', - `publicgraphs` char(1) collate utf8_unicode_ci default 'N', - `listpublic` char(1) collate utf8_unicode_ci default 'N', - `htmlemail` char(1) collate utf8_unicode_ci default 'N', - `tokenanswerspersistence` char(1) collate utf8_unicode_ci default 'N', - `assessments` char(1) collate utf8_unicode_ci default 'N', - `usecaptcha` char(1) collate utf8_unicode_ci default 'N', - `usetokens` char(1) collate utf8_unicode_ci default 'N', - `bounce_email` varchar(320) collate utf8_unicode_ci default NULL, - `attributedescriptions` text collate utf8_unicode_ci, - `emailresponseto` text collate utf8_unicode_ci, - `emailnotificationto` text collate utf8_unicode_ci, - `tokenlength` tinyint(2) default '15', - `showxquestions` char(1) collate utf8_unicode_ci default 'Y', - `showgroupinfo` char(1) collate utf8_unicode_ci default 'B', - `shownoanswer` char(1) collate utf8_unicode_ci default 'Y', - `showqnumcode` char(1) collate utf8_unicode_ci default 'X', - `bouncetime` bigint(20) default NULL, - `bounceprocessing` varchar(1) collate utf8_unicode_ci default 'N', - `bounceaccounttype` varchar(4) collate utf8_unicode_ci default NULL, - `bounceaccounthost` varchar(200) collate utf8_unicode_ci default NULL, - `bounceaccountpass` varchar(100) collate utf8_unicode_ci default NULL, - `bounceaccountencryption` varchar(3) collate utf8_unicode_ci default NULL, - `bounceaccountuser` varchar(200) collate utf8_unicode_ci default NULL, - `showwelcome` char(1) collate utf8_unicode_ci default 'Y', - `showprogress` char(1) collate utf8_unicode_ci default 'Y', - `allowjumps` char(1) collate utf8_unicode_ci default 'N', - `navigationdelay` tinyint(2) default '0', - `nokeyboard` char(1) collate utf8_unicode_ci default 'N', - `alloweditaftercompletion` char(1) collate utf8_unicode_ci default 'N', - `googleanalyticsstyle` char(1) collate utf8_unicode_ci default NULL, - `googleanalyticsapikey` varchar(25) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`sid`) + `admin` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `active` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'N', + `expires` datetime DEFAULT NULL, + `startdate` datetime DEFAULT NULL, + `adminemail` varchar(320) COLLATE utf8_unicode_ci DEFAULT NULL, + `anonymized` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'N', + `faxto` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `format` char(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `savetimings` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `template` varchar(100) COLLATE utf8_unicode_ci DEFAULT 'default', + `language` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `additional_languages` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `datestamp` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `usecookie` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `allowregister` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `allowsave` char(1) COLLATE utf8_unicode_ci DEFAULT 'Y', + `autonumber_start` bigint(11) DEFAULT '0', + `autoredirect` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `allowprev` char(1) COLLATE utf8_unicode_ci DEFAULT 'Y', + `printanswers` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `ipaddr` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `refurl` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `datecreated` date DEFAULT NULL, + `publicstatistics` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `publicgraphs` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `listpublic` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `htmlemail` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `tokenanswerspersistence` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `assessments` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `usecaptcha` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `usetokens` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `bounce_email` varchar(320) COLLATE utf8_unicode_ci DEFAULT NULL, + `attributedescriptions` text COLLATE utf8_unicode_ci, + `emailresponseto` text COLLATE utf8_unicode_ci, + `emailnotificationto` text COLLATE utf8_unicode_ci, + `tokenlength` tinyint(2) DEFAULT '15', + `showxquestions` char(1) COLLATE utf8_unicode_ci DEFAULT 'Y', + `showgroupinfo` char(1) COLLATE utf8_unicode_ci DEFAULT 'B', + `shownoanswer` char(1) COLLATE utf8_unicode_ci DEFAULT 'Y', + `showqnumcode` char(1) COLLATE utf8_unicode_ci DEFAULT 'X', + `bouncetime` bigint(20) DEFAULT NULL, + `bounceprocessing` varchar(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `bounceaccounttype` varchar(4) COLLATE utf8_unicode_ci DEFAULT NULL, + `bounceaccounthost` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `bounceaccountpass` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `bounceaccountencryption` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `bounceaccountuser` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `showwelcome` char(1) COLLATE utf8_unicode_ci DEFAULT 'Y', + `showprogress` char(1) COLLATE utf8_unicode_ci DEFAULT 'Y', + `allowjumps` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `navigationdelay` tinyint(2) DEFAULT '0', + `nokeyboard` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `alloweditaftercompletion` char(1) COLLATE utf8_unicode_ci DEFAULT 'N', + `googleanalyticsstyle` char(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `googleanalyticsapikey` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`sid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_surveys` --- - - -- -------------------------------------------------------- -- @@ -994,36 +837,31 @@ CREATE TABLE `lime_surveys` ( -- CREATE TABLE `lime_surveys_languagesettings` ( - `surveyls_survey_id` int(11) NOT NULL default '0', - `surveyls_language` varchar(45) collate utf8_unicode_ci NOT NULL default 'en', - `surveyls_title` varchar(200) collate utf8_unicode_ci NOT NULL, - `surveyls_description` text collate utf8_unicode_ci, - `surveyls_welcometext` text collate utf8_unicode_ci, - `surveyls_endtext` text collate utf8_unicode_ci, - `surveyls_url` varchar(255) collate utf8_unicode_ci default NULL, - `surveyls_urldescription` varchar(255) collate utf8_unicode_ci default NULL, - `surveyls_email_invite_subj` varchar(255) collate utf8_unicode_ci default NULL, - `surveyls_email_invite` text collate utf8_unicode_ci, - `surveyls_email_remind_subj` varchar(255) collate utf8_unicode_ci default NULL, - `surveyls_email_remind` text collate utf8_unicode_ci, - `surveyls_email_register_subj` varchar(255) collate utf8_unicode_ci default NULL, - `surveyls_email_register` text collate utf8_unicode_ci, - `surveyls_email_confirm_subj` varchar(255) collate utf8_unicode_ci default NULL, - `surveyls_email_confirm` text collate utf8_unicode_ci, - `surveyls_dateformat` int(10) unsigned NOT NULL default '1', - `email_admin_notification_subj` varchar(255) collate utf8_unicode_ci default NULL, - `email_admin_notification` text collate utf8_unicode_ci, - `email_admin_responses_subj` varchar(255) collate utf8_unicode_ci default NULL, - `email_admin_responses` text collate utf8_unicode_ci, - `surveyls_numberformat` int(11) NOT NULL default '0', - PRIMARY KEY (`surveyls_survey_id`,`surveyls_language`) + `surveyls_survey_id` int(11) NOT NULL DEFAULT '0', + `surveyls_language` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en', + `surveyls_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL, + `surveyls_description` text COLLATE utf8_unicode_ci, + `surveyls_welcometext` text COLLATE utf8_unicode_ci, + `surveyls_endtext` text COLLATE utf8_unicode_ci, + `surveyls_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `surveyls_urldescription` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `surveyls_email_invite_subj` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `surveyls_email_invite` text COLLATE utf8_unicode_ci, + `surveyls_email_remind_subj` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `surveyls_email_remind` text COLLATE utf8_unicode_ci, + `surveyls_email_register_subj` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `surveyls_email_register` text COLLATE utf8_unicode_ci, + `surveyls_email_confirm_subj` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `surveyls_email_confirm` text COLLATE utf8_unicode_ci, + `surveyls_dateformat` int(10) unsigned NOT NULL DEFAULT '1', + `email_admin_notification_subj` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `email_admin_notification` text COLLATE utf8_unicode_ci, + `email_admin_responses_subj` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `email_admin_responses` text COLLATE utf8_unicode_ci, + `surveyls_numberformat` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`surveyls_survey_id`,`surveyls_language`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_surveys_languagesettings` --- - - -- -------------------------------------------------------- -- @@ -1031,18 +869,13 @@ CREATE TABLE `lime_surveys_languagesettings` ( -- CREATE TABLE `lime_survey_links` ( - `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `participant_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `token_id` int(11) NOT NULL, `survey_id` int(11) NOT NULL, `date_created` datetime NOT NULL, - PRIMARY KEY (`participant_id`,`token_id`,`survey_id`) + PRIMARY KEY (`participant_id`,`token_id`,`survey_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_survey_links` --- - - -- -------------------------------------------------------- -- @@ -1052,21 +885,16 @@ CREATE TABLE `lime_survey_links` ( CREATE TABLE `lime_survey_permissions` ( `sid` int(11) NOT NULL, `uid` int(11) NOT NULL, - `permission` varchar(20) collate utf8_unicode_ci NOT NULL, - `create_p` tinyint(1) NOT NULL default '0', - `read_p` tinyint(1) NOT NULL default '0', - `update_p` tinyint(1) NOT NULL default '0', - `delete_p` tinyint(1) NOT NULL default '0', - `import_p` tinyint(1) NOT NULL default '0', - `export_p` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`sid`,`uid`,`permission`) + `permission` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `create_p` tinyint(1) NOT NULL DEFAULT '0', + `read_p` tinyint(1) NOT NULL DEFAULT '0', + `update_p` tinyint(1) NOT NULL DEFAULT '0', + `delete_p` tinyint(1) NOT NULL DEFAULT '0', + `import_p` tinyint(1) NOT NULL DEFAULT '0', + `export_p` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`sid`,`uid`,`permission`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_survey_permissions` --- - - -- -------------------------------------------------------- -- @@ -1074,16 +902,11 @@ CREATE TABLE `lime_survey_permissions` ( -- CREATE TABLE `lime_templates` ( - `folder` varchar(255) collate utf8_unicode_ci NOT NULL, + `folder` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `creator` int(11) NOT NULL, - PRIMARY KEY (`folder`) + PRIMARY KEY (`folder`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_templates` --- - - -- -------------------------------------------------------- -- @@ -1092,16 +915,11 @@ CREATE TABLE `lime_templates` ( CREATE TABLE `lime_templates_rights` ( `uid` int(11) NOT NULL, - `folder` varchar(255) collate utf8_unicode_ci NOT NULL, + `folder` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `use` int(1) NOT NULL, - PRIMARY KEY (`uid`,`folder`) + PRIMARY KEY (`uid`,`folder`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_templates_rights` --- - - -- -------------------------------------------------------- -- @@ -1109,27 +927,27 @@ CREATE TABLE `lime_templates_rights` ( -- CREATE TABLE `lime_users` ( - `uid` int(11) NOT NULL auto_increment, - `users_name` varchar(64) collate utf8_unicode_ci NOT NULL default '', + `uid` int(11) NOT NULL AUTO_INCREMENT, + `users_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `password` blob NOT NULL, - `full_name` varchar(50) collate utf8_unicode_ci NOT NULL, + `full_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `parent_id` int(11) NOT NULL, - `lang` varchar(20) collate utf8_unicode_ci default NULL, - `email` varchar(320) collate utf8_unicode_ci default NULL, - `create_survey` tinyint(1) NOT NULL default '0', - `create_user` tinyint(1) NOT NULL default '0', - `participant_panel` tinyint(1) NOT NULL default '0', - `delete_user` tinyint(1) NOT NULL default '0', - `superadmin` tinyint(1) NOT NULL default '0', - `configurator` tinyint(1) NOT NULL default '0', - `manage_template` tinyint(1) NOT NULL default '0', - `manage_label` tinyint(1) NOT NULL default '0', - `htmleditormode` varchar(7) collate utf8_unicode_ci default 'default', - `templateeditormode` varchar(7) collate utf8_unicode_ci default 'default', - `questionselectormode` varchar(7) collate utf8_unicode_ci default 'default', + `lang` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `email` varchar(320) COLLATE utf8_unicode_ci DEFAULT NULL, + `create_survey` tinyint(1) NOT NULL DEFAULT '0', + `create_user` tinyint(1) NOT NULL DEFAULT '0', + `participant_panel` tinyint(1) NOT NULL DEFAULT '0', + `delete_user` tinyint(1) NOT NULL DEFAULT '0', + `superadmin` tinyint(1) NOT NULL DEFAULT '0', + `configurator` tinyint(1) NOT NULL DEFAULT '0', + `manage_template` tinyint(1) NOT NULL DEFAULT '0', + `manage_label` tinyint(1) NOT NULL DEFAULT '0', + `htmleditormode` varchar(7) COLLATE utf8_unicode_ci DEFAULT 'default', + `templateeditormode` varchar(7) COLLATE utf8_unicode_ci DEFAULT 'default', + `questionselectormode` varchar(7) COLLATE utf8_unicode_ci DEFAULT 'default', `one_time_pw` blob, - `dateformat` int(11) NOT NULL default '1', - PRIMARY KEY (`uid`), + `dateformat` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`uid`), UNIQUE KEY `users_name` (`users_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -1146,19 +964,14 @@ INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_ -- CREATE TABLE `lime_user_groups` ( - `ugid` int(11) NOT NULL auto_increment, - `name` varchar(20) collate utf8_unicode_ci NOT NULL, - `description` text collate utf8_unicode_ci NOT NULL, + `ugid` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `description` text COLLATE utf8_unicode_ci NOT NULL, `owner_id` int(11) NOT NULL, - PRIMARY KEY (`ugid`), + PRIMARY KEY (`ugid`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_user_groups` --- - - -- -------------------------------------------------------- -- @@ -1168,14 +981,9 @@ CREATE TABLE `lime_user_groups` ( CREATE TABLE `lime_user_in_groups` ( `ugid` int(11) NOT NULL, `uid` int(11) NOT NULL, - PRIMARY KEY (`ugid`,`uid`) + PRIMARY KEY (`ugid`,`uid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `lime_user_in_groups` --- - - -- -------------------------------------------------------- -- @@ -1183,26 +991,21 @@ CREATE TABLE `lime_user_in_groups` ( -- CREATE TABLE `operator` ( - `operator_id` bigint(20) NOT NULL auto_increment, - `username` varchar(255) collate utf8_unicode_ci NOT NULL, - `firstName` varchar(255) collate utf8_unicode_ci NOT NULL, - `lastName` varchar(255) collate utf8_unicode_ci NOT NULL, - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - `enabled` tinyint(1) NOT NULL default '1', - `voip` tinyint(1) NOT NULL default '1', - `next_case_id` bigint(20) default NULL, - `chat_enable` tinyint(1) default '0', - `chat_user` varchar(255) collate utf8_unicode_ci default NULL, - `chat_password` varchar(255) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`operator_id`), + `operator_id` bigint(20) NOT NULL AUTO_INCREMENT, + `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `firstName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `lastName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + `enabled` tinyint(1) NOT NULL DEFAULT '1', + `voip` tinyint(1) NOT NULL DEFAULT '1', + `next_case_id` bigint(20) DEFAULT NULL, + `chat_enable` tinyint(1) DEFAULT '0', + `chat_user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `chat_password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`operator_id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `operator` --- - - -- -------------------------------------------------------- -- @@ -1212,14 +1015,9 @@ CREATE TABLE `operator` ( CREATE TABLE `operator_questionnaire` ( `operator_id` bigint(20) NOT NULL, `questionnaire_id` bigint(20) NOT NULL, - PRIMARY KEY (`operator_id`,`questionnaire_id`) + PRIMARY KEY (`operator_id`,`questionnaire_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `operator_questionnaire` --- - - -- -------------------------------------------------------- -- @@ -1229,14 +1027,9 @@ CREATE TABLE `operator_questionnaire` ( CREATE TABLE `operator_skill` ( `operator_id` bigint(20) NOT NULL, `outcome_type_id` int(11) NOT NULL, - PRIMARY KEY (`operator_id`,`outcome_type_id`) + PRIMARY KEY (`operator_id`,`outcome_type_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `operator_skill` --- - - -- -------------------------------------------------------- -- @@ -1244,18 +1037,18 @@ CREATE TABLE `operator_skill` ( -- CREATE TABLE `outcome` ( - `outcome_id` int(11) NOT NULL auto_increment, - `aapor_id` char(6) collate utf8_unicode_ci NOT NULL, - `description` varchar(255) collate utf8_unicode_ci NOT NULL, + `outcome_id` int(11) NOT NULL AUTO_INCREMENT, + `aapor_id` char(6) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `default_delay_minutes` bigint(20) NOT NULL, - `outcome_type_id` int(11) NOT NULL default '1', - `tryanother` tinyint(1) NOT NULL default '1' COMMENT 'Whether to try the next number on the list', - `contacted` tinyint(1) NOT NULL default '1' COMMENT 'Whether a person was contacted', - `tryagain` tinyint(1) NOT NULL default '1' COMMENT 'Whether to try this number ever again', - `eligible` tinyint(1) NOT NULL default '1' COMMENT 'If the respondent is eligible to participate', - `require_note` tinyint(1) NOT NULL default '0' COMMENT 'Whether to require a note to be entered', - `calc` char(2) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`outcome_id`), + `outcome_type_id` int(11) NOT NULL DEFAULT '1', + `tryanother` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Whether to try the next number on the list', + `contacted` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Whether a person was contacted', + `tryagain` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Whether to try this number ever again', + `eligible` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'If the respondent is eligible to participate', + `require_note` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Whether to require a note to be entered', + `calc` char(2) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`outcome_id`), KEY `calc` (`calc`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -1307,8 +1100,8 @@ INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_m CREATE TABLE `outcome_type` ( `outcome_type_id` int(11) NOT NULL, - `description` varchar(255) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`outcome_type_id`) + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`outcome_type_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- @@ -1328,20 +1121,15 @@ INSERT INTO `outcome_type` (`outcome_type_id`, `description`) VALUES(5, 'Appoint -- CREATE TABLE `process` ( - `process_id` bigint(20) NOT NULL auto_increment, - `type` int(11) NOT NULL default '1', + `process_id` bigint(20) NOT NULL AUTO_INCREMENT, + `type` int(11) NOT NULL DEFAULT '1', `start` datetime NOT NULL, - `stop` datetime default NULL, - `kill` tinyint(1) NOT NULL default '0', - `data` longtext collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`process_id`) + `stop` datetime DEFAULT NULL, + `kill` tinyint(1) NOT NULL DEFAULT '0', + `data` longtext COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`process_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `process` --- - - -- -------------------------------------------------------- -- @@ -1349,33 +1137,30 @@ CREATE TABLE `process` ( -- CREATE TABLE `process_log` ( - `process_log_id` bigint(20) NOT NULL auto_increment, + `process_log_id` bigint(20) NOT NULL AUTO_INCREMENT, `process_id` bigint(20) NOT NULL, `datetime` datetime NOT NULL, - `data` text collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`process_log_id`), + `data` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`process_log_id`), KEY `process_id` (`process_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `process_log` --- - +-- -------------------------------------------------------- +-- -- Table structure for table `qsqr_question` -- --- CREATE TABLE `qsqr_question` ( - `qsqr_question_id` bigint(20) NOT NULL AUTO_INCREMENT, - `questionnaire_sample_quota_row_id` bigint(20) NOT NULL, - `lime_sgqa` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `value` varchar(2048) COLLATE utf8_unicode_ci NOT NULL, - `comparison` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `description` text COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`qsqr_question_id`), - KEY `questionnaire_sample_quota_row_id` (`questionnaire_sample_quota_row_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + `qsqr_question_id` bigint(20) NOT NULL AUTO_INCREMENT, + `questionnaire_sample_quota_row_id` bigint(20) NOT NULL, + `lime_sgqa` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(2048) COLLATE utf8_unicode_ci NOT NULL, + `comparison` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`qsqr_question_id`), + KEY `questionnaire_sample_quota_row_id` (`questionnaire_sample_quota_row_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- @@ -1386,6 +1171,7 @@ CREATE TABLE `qsqr_question` ( CREATE TABLE `qsqr_sample` ( `qsqr_sample_id` bigint(20) NOT NULL AUTO_INCREMENT, `questionnaire_sample_quota_row_id` bigint(20) NOT NULL, + `exclude_var_id` bigint(20) NOT NULL, `exclude_var` char(128) COLLATE utf8_unicode_ci NOT NULL, `exclude_val` varchar(256) COLLATE utf8_unicode_ci NOT NULL, `comparison` varchar(15) COLLATE utf8_unicode_ci NOT NULL, @@ -1393,42 +1179,38 @@ CREATE TABLE `qsqr_sample` ( PRIMARY KEY (`qsqr_sample_id`), KEY `questionnaire_sample_quota_row_id` (`questionnaire_sample_quota_row_id`), KEY `exclude_var` (`exclude_var`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +-- -------------------------------------------------------- -- -- Table structure for table `questionnaire` -- CREATE TABLE `questionnaire` ( - `questionnaire_id` bigint(20) NOT NULL auto_increment, - `description` varchar(255) collate utf8_unicode_ci NOT NULL, + `questionnaire_id` bigint(20) NOT NULL AUTO_INCREMENT, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `lime_sid` int(11) NOT NULL, - `restrict_appointments_shifts` tinyint(1) NOT NULL default '1', - `restrict_work_shifts` tinyint(1) NOT NULL default '1', - `testing` tinyint(1) NOT NULL default '0' COMMENT 'Whether this questionnaire is just for testing', - `respondent_selection` tinyint(1) NOT NULL default '1', - `rs_intro` text collate utf8_unicode_ci NOT NULL, - `rs_project_intro` text collate utf8_unicode_ci NOT NULL, - `rs_project_end` text collate utf8_unicode_ci NOT NULL, - `rs_callback` text collate utf8_unicode_ci NOT NULL, - `rs_answeringmachine` text collate utf8_unicode_ci NOT NULL, - `lime_rs_sid` int(11) default NULL, - `info` text collate utf8_unicode_ci, - `self_complete` tinyint(1) NOT NULL default '0', - `referral` TINYINT( 1 ) NOT NULL DEFAULT '0', - `lime_mode` varchar(64) collate utf8_unicode_ci default NULL COMMENT 'Limesurvey mode for respondent self completion', - `lime_template` varchar(128) collate utf8_unicode_ci default NULL COMMENT 'Limesurvey template for respondent self completion', - `lime_endurl` varchar(256) collate utf8_unicode_ci default NULL COMMENT 'Forwarding end URL for respondent self completion', - `enabled` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`questionnaire_id`) + `restrict_appointments_shifts` tinyint(1) NOT NULL DEFAULT '1', + `restrict_work_shifts` tinyint(1) NOT NULL DEFAULT '1', + `testing` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Whether this questionnaire is just for testing', + `respondent_selection` tinyint(1) NOT NULL DEFAULT '1', + `rs_intro` text COLLATE utf8_unicode_ci NOT NULL, + `rs_project_intro` text COLLATE utf8_unicode_ci NOT NULL, + `rs_project_end` text COLLATE utf8_unicode_ci NOT NULL, + `rs_callback` text COLLATE utf8_unicode_ci NOT NULL, + `rs_answeringmachine` text COLLATE utf8_unicode_ci NOT NULL, + `lime_rs_sid` int(11) DEFAULT NULL, + `info` text COLLATE utf8_unicode_ci, + `self_complete` tinyint(1) NOT NULL DEFAULT '0', + `referral` tinyint(1) NOT NULL DEFAULT '0', + `lime_mode` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Limesurvey mode for respondent self completion', + `lime_template` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Limesurvey template for respondent self completion', + `lime_endurl` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Forwarding end URL for respondent self completion', + `enabled` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`questionnaire_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `questionnaire` --- - - -- -------------------------------------------------------- -- @@ -1438,14 +1220,9 @@ CREATE TABLE `questionnaire` ( CREATE TABLE `questionnaire_availability` ( `questionnaire_id` bigint(20) NOT NULL, `availability_group_id` bigint(20) NOT NULL, - PRIMARY KEY (`questionnaire_id`,`availability_group_id`) + PRIMARY KEY (`questionnaire_id`,`availability_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `questionnaire_availability` --- - - -- -------------------------------------------------------- -- @@ -1453,19 +1230,14 @@ CREATE TABLE `questionnaire_availability` ( -- CREATE TABLE `questionnaire_prefill` ( - `questionnaire_prefill_id` bigint(20) NOT NULL auto_increment, + `questionnaire_prefill_id` bigint(20) NOT NULL AUTO_INCREMENT, `questionnaire_id` bigint(20) NOT NULL, - `lime_sgqa` varchar(255) collate utf8_unicode_ci NOT NULL, - `value` varchar(2048) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`questionnaire_prefill_id`), + `lime_sgqa` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(2048) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`questionnaire_prefill_id`), KEY `questionnaire_id` (`questionnaire_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `questionnaire_prefill` --- - - -- -------------------------------------------------------- -- @@ -1475,19 +1247,14 @@ CREATE TABLE `questionnaire_prefill` ( CREATE TABLE `questionnaire_sample` ( `questionnaire_id` bigint(20) NOT NULL, `sample_import_id` bigint(20) NOT NULL, - `call_max` int(11) NOT NULL default '0', - `call_attempt_max` int(11) NOT NULL default '0', - `random_select` tinyint(1) NOT NULL default '0', - `answering_machine_messages` int(11) NOT NULL default '1', - `allow_new` TINYINT( 1 ) NOT NULL DEFAULT '1', - PRIMARY KEY (`questionnaire_id`,`sample_import_id`) + `call_max` int(11) NOT NULL DEFAULT '0', + `call_attempt_max` int(11) NOT NULL DEFAULT '0', + `random_select` tinyint(1) NOT NULL DEFAULT '0', + `answering_machine_messages` int(11) NOT NULL DEFAULT '1', + `allow_new` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`questionnaire_id`,`sample_import_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `questionnaire_sample` --- - - -- -------------------------------------------------------- -- @@ -1497,21 +1264,16 @@ CREATE TABLE `questionnaire_sample` ( CREATE TABLE `questionnaire_sample_exclude_priority` ( `questionnaire_id` bigint(20) NOT NULL, `sample_id` bigint(20) NOT NULL, - `exclude` tinyint(1) NOT NULL default '0', - `priority` tinyint(3) NOT NULL default '50', - `sortorder` int(11) default NULL, - PRIMARY KEY (`questionnaire_id`,`sample_id`), + `exclude` tinyint(1) NOT NULL DEFAULT '0', + `priority` tinyint(3) NOT NULL DEFAULT '50', + `sortorder` int(11) DEFAULT NULL, + PRIMARY KEY (`questionnaire_id`,`sample_id`), KEY `exclude` (`exclude`), KEY `priority` (`priority`), KEY `questionnaire_id` (`questionnaire_id`), KEY `sortorder` (`sortorder`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `questionnaire_sample_exclude_priority` --- - - -- -------------------------------------------------------- -- @@ -1519,22 +1281,17 @@ CREATE TABLE `questionnaire_sample_exclude_priority` ( -- CREATE TABLE `questionnaire_sample_quota` ( - `questionnaire_sample_quota_id` bigint(20) NOT NULL auto_increment, + `questionnaire_sample_quota_id` bigint(20) NOT NULL AUTO_INCREMENT, `questionnaire_id` bigint(20) NOT NULL, `sample_import_id` bigint(20) NOT NULL, - `lime_sgqa` varchar(255) collate utf8_unicode_ci NOT NULL, - `value` varchar(2048) collate utf8_unicode_ci NOT NULL, - `comparison` varchar(15) collate utf8_unicode_ci NOT NULL default 'LIKE', + `lime_sgqa` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(2048) COLLATE utf8_unicode_ci NOT NULL, + `comparison` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'LIKE', `completions` int(11) NOT NULL, - `quota_reached` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`questionnaire_sample_quota_id`) + `quota_reached` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`questionnaire_sample_quota_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `questionnaire_sample_quota` --- - - -- -------------------------------------------------------- -- @@ -1542,25 +1299,20 @@ CREATE TABLE `questionnaire_sample_quota` ( -- CREATE TABLE `questionnaire_sample_quota_row` ( - `questionnaire_sample_quota_row_id` bigint(20) NOT NULL auto_increment, + `questionnaire_sample_quota_row_id` bigint(20) NOT NULL AUTO_INCREMENT, `questionnaire_id` bigint(20) NOT NULL, `sample_import_id` bigint(20) NOT NULL, `completions` int(11) NOT NULL, - `quota_reached` tinyint(1) NOT NULL default '0', - `current_completions` int(11) NOT NULL default '0', - `description` text collate utf8_unicode_ci NOT NULL, - `priority` tinyint(3) NOT NULL default '50' COMMENT 'Priority from 0 - 100', - `autoprioritise` tinyint(1) NOT NULL default '0' COMMENT 'Should this row have it''s priority automatically adjusted to 100 - (completions %)', - PRIMARY KEY (`questionnaire_sample_quota_row_id`), + `quota_reached` tinyint(1) NOT NULL DEFAULT '0', + `current_completions` int(11) NOT NULL DEFAULT '0', + `description` text COLLATE utf8_unicode_ci NOT NULL, + `priority` tinyint(3) NOT NULL DEFAULT '50' COMMENT 'Priority from 0 - 100', + `autoprioritise` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Should this row have it''s priority automatically adjusted to 100 - (completions %)', + PRIMARY KEY (`questionnaire_sample_quota_row_id`), KEY `questionnaire_id` (`questionnaire_id`), KEY `sample_import_id` (`sample_import_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `questionnaire_sample_quota_row` --- - - -- -------------------------------------------------------- -- @@ -1571,31 +1323,35 @@ CREATE TABLE `questionnaire_sample_quota_row_exclude` ( `questionnaire_sample_quota_row_id` bigint(20) NOT NULL, `questionnaire_id` bigint(20) NOT NULL, `sample_id` bigint(20) NOT NULL, - PRIMARY KEY (`questionnaire_sample_quota_row_id`,`questionnaire_id`,`sample_id`), + PRIMARY KEY (`questionnaire_sample_quota_row_id`,`questionnaire_id`,`sample_id`), KEY `questionnaire_id` (`questionnaire_id`), KEY `sample_id` (`sample_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +-- -------------------------------------------------------- + -- --- Dumping data for table `questionnaire_sample_quota_row_exclude` +-- Table structure for table `questionnaire_sample_timeslot` -- CREATE TABLE `questionnaire_sample_timeslot` ( -`questionnaire_id` bigint( 20 ) NOT NULL , -`sample_import_id` bigint( 20 ) NOT NULL , -`availability_group_id` bigint( 20 ) NOT NULL , -PRIMARY KEY ( `questionnaire_id` , `availability_group_id` , `sample_import_id` ) -) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci; + `questionnaire_id` bigint(20) NOT NULL, + `sample_import_id` bigint(20) NOT NULL, + `availability_group_id` bigint(20) NOT NULL, + PRIMARY KEY (`questionnaire_id`,`availability_group_id`,`sample_import_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- - +-- +-- Table structure for table `questionnaire_timeslot` +-- CREATE TABLE `questionnaire_timeslot` ( -`questionnaire_id` bigint( 20 ) NOT NULL , -`availability_group_id` bigint( 20 ) NOT NULL , -PRIMARY KEY ( `questionnaire_id` , `availability_group_id` ) -) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci; + `questionnaire_id` bigint(20) NOT NULL, + `availability_group_id` bigint(20) NOT NULL, + PRIMARY KEY (`questionnaire_id`,`availability_group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- @@ -1604,20 +1360,15 @@ PRIMARY KEY ( `questionnaire_id` , `availability_group_id` ) -- CREATE TABLE `respondent` ( - `respondent_id` bigint(20) NOT NULL auto_increment, + `respondent_id` bigint(20) NOT NULL AUTO_INCREMENT, `case_id` bigint(20) NOT NULL, - `firstName` varchar(255) collate utf8_unicode_ci NOT NULL, - `lastName` varchar(255) collate utf8_unicode_ci NOT NULL, - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`respondent_id`), + `firstName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `lastName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`respondent_id`), KEY `case_id` (`case_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `respondent` --- - - -- -------------------------------------------------------- -- @@ -1625,19 +1376,14 @@ CREATE TABLE `respondent` ( -- CREATE TABLE `respondent_not_available` ( - `respondent_not_available_id` bigint(20) NOT NULL auto_increment, + `respondent_not_available_id` bigint(20) NOT NULL AUTO_INCREMENT, `respondent_id` bigint(20) NOT NULL, `start` datetime NOT NULL, `end` datetime NOT NULL, - PRIMARY KEY (`respondent_not_available_id`), + PRIMARY KEY (`respondent_not_available_id`), KEY `respondent_id` (`respondent_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `respondent_not_available` --- - - -- -------------------------------------------------------- -- @@ -1645,19 +1391,14 @@ CREATE TABLE `respondent_not_available` ( -- CREATE TABLE `sample` ( - `sample_id` bigint(20) NOT NULL auto_increment, + `sample_id` bigint(20) NOT NULL AUTO_INCREMENT, `import_id` bigint(20) NOT NULL, - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - `phone` char(30) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`sample_id`), + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + `phone` char(30) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`sample_id`), KEY `import_id` (`import_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `sample` --- - - -- -------------------------------------------------------- -- @@ -1665,23 +1406,27 @@ CREATE TABLE `sample` ( -- CREATE TABLE `sample_import` ( - `sample_import_id` bigint(20) NOT NULL auto_increment, - `description` varchar(255) collate utf8_unicode_ci NOT NULL, - `call_restrict` tinyint(1) NOT NULL default '1', - `refusal_conversion` tinyint(1) NOT NULL default '1', - `enabled` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`sample_import_id`) + `sample_import_id` bigint(20) NOT NULL AUTO_INCREMENT, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `call_restrict` tinyint(1) NOT NULL DEFAULT '1', + `refusal_conversion` tinyint(1) NOT NULL DEFAULT '1', + `enabled` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`sample_import_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +-- -------------------------------------------------------- + -- -- Table structure for table `sample_import_var_restrict` -- CREATE TABLE `sample_import_var_restrict` ( `sample_import_id` bigint(20) NOT NULL, - `var` char(128) collate utf8_unicode_ci NOT NULL, - `restrict` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`sample_import_id`,`var`) + `var_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `var` char(128) COLLATE utf8_unicode_ci DEFAULT NULL, + `type` smallint(10) unsigned NOT NULL, + `restrict` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`var_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- @@ -1692,15 +1437,10 @@ CREATE TABLE `sample_import_var_restrict` ( CREATE TABLE `sample_postcode_timezone` ( `val` int(4) NOT NULL, - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`val`) + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`val`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `sample_postcode_timezone` --- - - -- -------------------------------------------------------- -- @@ -1708,16 +1448,11 @@ CREATE TABLE `sample_postcode_timezone` ( -- CREATE TABLE `sample_prefix_timezone` ( - `val` char(10) collate utf8_unicode_ci NOT NULL, - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`val`) + `val` char(10) COLLATE utf8_unicode_ci NOT NULL, + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`val`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `sample_prefix_timezone` --- - - -- -------------------------------------------------------- -- @@ -1725,16 +1460,11 @@ CREATE TABLE `sample_prefix_timezone` ( -- CREATE TABLE `sample_state_timezone` ( - `val` varchar(64) collate utf8_unicode_ci NOT NULL, - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`val`) + `val` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`val`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `sample_state_timezone` --- - - -- -------------------------------------------------------- -- @@ -1743,18 +1473,12 @@ CREATE TABLE `sample_state_timezone` ( CREATE TABLE `sample_var` ( `sample_id` bigint(20) NOT NULL, - `var` char(128) collate utf8_unicode_ci NOT NULL, - `val` varchar(256) collate utf8_unicode_ci NOT NULL, - `type` int(11) NOT NULL, - PRIMARY KEY (`sample_id`,`var`), + `var_id` bigint(20) unsigned NOT NULL, + `val` varchar(256) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`sample_id`,`var_id`), KEY `sample_id` (`sample_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `sample_var` --- - - -- -------------------------------------------------------- -- @@ -1762,10 +1486,10 @@ CREATE TABLE `sample_var` ( -- CREATE TABLE `sample_var_type` ( - `type` int(11) NOT NULL auto_increment, - `description` varchar(255) collate utf8_unicode_ci NOT NULL, - `table` varchar(255) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`type`) + `type` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `table` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- @@ -1788,22 +1512,17 @@ INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES(8, 'Email -- CREATE TABLE `sessions2` ( - `sesskey` varchar(64) collate utf8_unicode_ci NOT NULL default '', + `sesskey` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `expiry` datetime NOT NULL, - `expireref` varchar(250) collate utf8_unicode_ci default '', + `expireref` varchar(250) COLLATE utf8_unicode_ci DEFAULT '', `created` datetime NOT NULL, `modified` datetime NOT NULL, - `sessdata` longtext collate utf8_unicode_ci, - PRIMARY KEY (`sesskey`), + `sessdata` longtext COLLATE utf8_unicode_ci, + PRIMARY KEY (`sesskey`), KEY `sess2_expiry` (`expiry`), KEY `sess2_expireref` (`expireref`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `sessions2` --- - - -- -------------------------------------------------------- -- @@ -1811,21 +1530,19 @@ CREATE TABLE `sessions2` ( -- CREATE TABLE `setting` ( - `setting_id` int(11) NOT NULL auto_increment, - `field` varchar(255) collate utf8_unicode_ci NOT NULL, - `value` text collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`setting_id`), + `setting_id` int(11) NOT NULL AUTO_INCREMENT, + `field` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`setting_id`), UNIQUE KEY `field` (`field`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Serialised table of settings'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Serialised table of settings'; -- -- Dumping data for table `setting` -- -INSERT INTO `setting` (`setting_id`, `field`, `value`) VALUES -(1, 'DEFAULT_TIME_ZONE', 's:18:"Australia/Victoria";'), -(2, 'systemsort', 'b:0;'); - +INSERT INTO `setting` (`setting_id`, `field`, `value`) VALUES(1, 'DEFAULT_TIME_ZONE', 's:18:"Australia/Victoria";'); +INSERT INTO `setting` (`setting_id`, `field`, `value`) VALUES(2, 'systemsort', 'b:0;'); -- -------------------------------------------------------- @@ -1834,19 +1551,14 @@ INSERT INTO `setting` (`setting_id`, `field`, `value`) VALUES -- CREATE TABLE `shift` ( - `shift_id` bigint(20) NOT NULL auto_increment, + `shift_id` bigint(20) NOT NULL AUTO_INCREMENT, `questionnaire_id` bigint(20) NOT NULL, `start` datetime NOT NULL, `end` datetime NOT NULL, - PRIMARY KEY (`shift_id`), + PRIMARY KEY (`shift_id`), KEY `questionnaire_id` (`questionnaire_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `shift` --- - - -- -------------------------------------------------------- -- @@ -1854,20 +1566,15 @@ CREATE TABLE `shift` ( -- CREATE TABLE `shift_report` ( - `shift_report_id` bigint(20) NOT NULL auto_increment, + `shift_report_id` bigint(20) NOT NULL AUTO_INCREMENT, `shift_id` bigint(20) NOT NULL, `operator_id` bigint(20) NOT NULL, - `report` text collate utf8_unicode_ci NOT NULL, + `report` text COLLATE utf8_unicode_ci NOT NULL, `datetime` datetime NOT NULL, - PRIMARY KEY (`shift_report_id`), + PRIMARY KEY (`shift_report_id`), KEY `shift_id` (`shift_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `shift_report` --- - - -- -------------------------------------------------------- -- @@ -1900,11 +1607,10 @@ INSERT INTO `shift_template` (`day_of_week`, `start`, `end`) VALUES(7, '13:00:00 -- CREATE TABLE `timezone_template` ( - `Time_zone_name` char(64) collate utf8_unicode_ci NOT NULL, - PRIMARY KEY (`Time_zone_name`) + `Time_zone_name` char(64) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`Time_zone_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `timezone_template` --- - +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/email.php b/email.php index 3c5076ab..a5e9f823 100644 --- a/email.php +++ b/email.php @@ -97,10 +97,11 @@ if (isset($_POST['firstname'])) $fieldsarray["{SID}"]=$fieldsarray["{SURVEYID}"]=$lime_sid; //$fieldsarray["{SURVEYNAME}"]=$thissurvey["surveyls_title"]; - $sql = "SELECT s.var,s.val - FROM `sample_var` as s, `case` as c + $sql = "SELECT sivr.var,sv.val + FROM `sample_var` as sv, `sample_import_var_restrict` as sivr, `case` as c WHERE c.case_id = $case_id - AND s.sample_id = c.sample_id"; + AND sv.sample_id = c.sample_id + AND sivr.var_id = sv.var_id"; $attributes = $db->GetAssoc($sql); @@ -317,11 +318,11 @@ $sc = $db->GetOne($sql); if ($sc == 1) { - $sql = "SELECT sv1.val as firstname, sv2.val as lastname, sv3.val as email + $sql = "SELECT +(SELECT sv.val from sample_var as sv, `sample_import_var_restrict` as sivr WHERE sivr.var_id = sv.var_id AND sv.sample_id = c.sample_id AND sivr.type =6) as firstname, +(SELECT sv.val from sample_var as sv, `sample_import_var_restrict` as sivr WHERE sivr.var_id = sv.var_id AND sv.sample_id = c.sample_id AND sivr.type =7) as lastname, +(SELECT sv.val from sample_var as sv, `sample_import_var_restrict` as sivr WHERE sivr.var_id = sv.var_id AND sv.sample_id = c.sample_id AND sivr.type =8) as email FROM `case` as c - LEFT JOIN sample_var as sv1 on (sv1.sample_id = c.sample_id AND sv1.type = 6) - LEFT JOIN sample_var as sv2 on (sv2.sample_id = c.sample_id AND sv2.type = 7) - LEFT JOIN sample_var as sv3 on (sv3.sample_id = c.sample_id AND sv3.type = 8) WHERE c.case_id = $case_id"; $rs = $db->GetRow($sql); diff --git a/endwork.php b/endwork.php index 15090d86..c3e16290 100644 --- a/endwork.php +++ b/endwork.php @@ -41,7 +41,7 @@ include_once("lang.inc.php"); * XHTML functions */ include_once("functions/functions.xhtml.php"); - +include_once("functions/functions.operator.php"); xhtml_head(T_("End of work")); if (isset($_GET['auto'])) @@ -51,7 +51,7 @@ if (isset($_GET['auto'])) print "

    " . T_("Work has ended. That is it") . "

    "; -include_once("functions/functions.operator.php"); + if (ALLOW_OPERATOR_EXTENSION_SELECT && VOIP_ENABLED) { //unassign extension diff --git a/functions/functions.calendar.php b/functions/functions.calendar.php index 5c3f3de3..cfa942a1 100644 --- a/functions/functions.calendar.php +++ b/functions/functions.calendar.php @@ -2,9 +2,6 @@ /** * Functions relating to appointment times and calendars * - * - * - * * This file is part of queXS * * queXS is free software; you can redistribute it and/or modify @@ -31,7 +28,6 @@ * */ - /** * Configuration file */ @@ -42,7 +38,6 @@ include_once(dirname(__FILE__).'/../config.inc.php'); */ include_once(dirname(__FILE__).'/../db.inc.php'); - /** * Add a phone number to a case (via the contact_phone table) * @@ -131,7 +126,7 @@ function convert_time($time) //Use the TIME_FORMAT string as defined in mysql http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format $from = array("%H","%h","%I","%i","%S","%s","%p"); - $to = array(substr($time,0,2),$h,$h,$m,$s,$s,$p); + $to = array(substr($time,0,2),$h,$h,$m,$m,$s,$s,$p); return str_replace($from,$to,TIME_FORMAT); } @@ -193,32 +188,34 @@ function display_respondent_list($case_id,$respondent_id = false,$first = false) WHERE case_id = '$case_id'"; $rs = $db->GetAll($sql); - - print "
    "; + if (!empty($rs)) { - $rid = $r['respondent_id']; - if ($respondent_id == false && $first == true) + foreach($rs as $r) { - $first = false; - $selected = "selected='selected'"; - $respondent_id = $rid; + $rid = $r['respondent_id']; + if ($respondent_id == false && $first == true) + { + $first = false; + $selected = "selected='selected'"; + $respondent_id = $rid; + } + else $selected = ""; + + if ($rid == $respondent_id) $selected="selected='selected'"; + print ""; } - else - $selected = ""; - if ($rid == $respondent_id) $selected="selected='selected'"; - print ""; } + print "

    "; } - print "
    "; + else { echo " ",$rs[0]['firstName']," ",$rs[0]['lastName'],""; $respondent_id =$rs[0]['respondent_id'];} return $respondent_id; } - - /** * Print an XHTML form for adding or modifying respondent details * @@ -256,13 +253,12 @@ function display_respondent_form($respondent_id = false,$case_id = false) $rs = $db->GetRow($sql); } - $sql = "SELECT Time_zone_name FROM timezone_template"; $rs = $db->Execute($sql); - print "
    + print "
    "; /** @@ -272,7 +268,6 @@ function display_respondent_form($respondent_id = false,$case_id = false) } - /** * Print shift details in XHTML based on the given day * Display start time, and if start time selected display end time also @@ -294,16 +289,14 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti { global $db; - $restricted = is_shift_restricted($questionnaire_id); - if ($restricted) { /** * Select shift start and end times for this day */ - $sql = " SELECT s.shift_id, HOUR(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sh, MINUTE(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( TIME( CONVERT_TZ( s.end, 'UTC', r.Time_zone_name ) ) , TIME( CONVERT_TZ( s.start, 'UTC', r.Time_zone_name ) ) ) ) /300) as intervals, TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) as start, TIME(CONVERT_TZ(s.end,'UTC',r.Time_zone_name)) as end + $sql = "SELECT s.shift_id, HOUR(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sh, MINUTE(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( s.end, s.start)) / 900) as intervals, TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) as start, TIME(CONVERT_TZ(s.end,'UTC',r.Time_zone_name)) as end FROM shift as s, respondent as r, `case` as c WHERE r.respondent_id = '$respondent_id' AND r.case_id = c.case_id @@ -312,27 +305,21 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti AND MONTH(CONVERT_TZ(s.start,'UTC', r.Time_zone_name)) = '$month' AND YEAR(CONVERT_TZ(s.start,'UTC', r.Time_zone_name)) = '$year' ORDER BY s.start ASC"; - } else - $sql = "SELECT 0 as sh, 0 as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ('$year-$month-$day 00:00:00','UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( TIME( CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ) , 'System', r.Time_zone_name ) ) , TIME( CONVERT_TZ( CURDATE(), 'System', r.Time_zone_name ) ) ) ) /300) as intervals, TIME(CONVERT_TZ(CURDATE(),'System',r.Time_zone_name)) as start, TIME(CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ),'System',r.Time_zone_name)) as end + $sql = "SELECT 0 as sh, 0 as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ('$year-$month-$day 08:00:00','UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( TIME( CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ) , 'System', r.Time_zone_name ) ) , TIME( CONVERT_TZ( CURDATE(), 'System', r.Time_zone_name ) ) ) ) /900) as intervals, TIME(CONVERT_TZ(CURDATE(),'System',r.Time_zone_name)) as start, TIME(CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ),'System',r.Time_zone_name)) as end FROM respondent as r WHERE r.respondent_id = '$respondent_id'"; - $rs = $db->GetAll($sql); - - print "
    "; + foreach($rs as $r) { - print "

    " . T_("Shift from:") . " ".convert_time($r['start']).T_(" till ")." ".convert_time($r['end'])."

    "; + print "

    " . T_("Shift from:") . " ".$r['start']." " . T_(" till ")." ".$r['end']."

    "; } - print "
    "; + - - - print "

    "; - print ""; foreach ($rs as $r) { $sh = $r['sh']; @@ -345,12 +332,9 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti //today = 0 if the shift is today otherwise 1 $today = $r['today']; - - /** - * Display only times in the future and within the shift in 5 minute intervals - * - */ - for ($i = 0; $i <= $intervals; $i++) + + // * Display only times in the future and within the shift in 5 minute intervals + for ($i = 0; $i <= $intervals-1; $i++) { $t = str_pad($sh,2,"0",STR_PAD_LEFT).":".str_pad($sm,2,"0",STR_PAD_LEFT).":00"; @@ -359,42 +343,34 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti $selected = ""; if ($t == $time) $selected = "selected=\"selected\""; - print ""; + print ""; } - - - $sm += 5; + $sm += 15; if ($sm >= 60) { $sh++; if ($sh >= 24) $sh -= 24; $sm -= 60; } - } - } - print ""; + print ""; if ($time) { $eh = substr($time,0,2); $em = substr($time,3,2); - print ""; foreach ($rs as $r) { $sh = $r['sh']; $sm = $r['sm']; $intervals = $r['intervals']; - - /** - * Display only times after the start time and within the shift in 5 minute intervals - * - */ - for ($i = 0; $i <= $intervals; $i++) + // * Display only times after the start time and within the shift in 15 minute intervals + for ($i = 0; $i <= $intervals-1; $i++) { $t = str_pad($sh,2,"0",STR_PAD_LEFT).":".str_pad($sm,2,"0",STR_PAD_LEFT).":00"; @@ -403,28 +379,26 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti $selected = ""; if ($t == $timeend) $selected = "selected=\"selected\""; - print ""; + print ""; } - $sm += 5; + $sm += 15; if ($sm >= 60) { $sh++; if ($sh >= 24) $sh -= 24; $sm -= 60; + } - } - } - print ""; + print ""; } print ""; print ""; print ""; print ""; - print "

    "; } /** @@ -485,21 +459,19 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon // Build the days in the month $Month->build(); - ?> - - - - - - - - - - - -"; + print " + + + + + + + + + + "; while ( $Day = $Month->fetch() ) { @@ -512,7 +484,6 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon $today = ""; if ($year == $Day->thisYear() && $month == $Day->thisMonth() && $day == $Day->thisDay()) $today = "today"; - // isFirst() to find start of week if ( $Day->isFirst() ) echo ( "\n" ); @@ -525,7 +496,7 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon //if it is in the past -> unavailable if ($Day->getTimeStamp() < $ttoday->getTimeStamp()) { - echo ( "\n" ); + echo ( "\n" ); } //if there are shift restrictions, restrict else if ($restricted) @@ -540,16 +511,16 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon if (!empty($rs) && $rs->RecordCount() == 0) { - echo ( "\n" ); + echo ( "\n" ); } else { - echo ( "\n" ); + echo ( "\n" ); } } else - echo ( "\n" ); + echo ( "\n" ); } // isLast() to find end of week @@ -559,18 +530,15 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon ?> - +
    - getTimeStamp())); ?> -
    MTWTFSS
    " . T_( date('F Y',$Month->getTimeStamp())) . "
    " . T_("Mon") . "" . T_("Tue") . "" . T_("Wed") . "" . T_("Thu") . "" . T_("Fri") . "" . T_("Sat") . "" . T_("Sun") . "
    ".$Day->thisDay()."".$Day->thisDay()."".$Day->thisDay()."".$Day->thisDay()."".$Day->thisDay()."".$Day->thisDay()."".$Day->thisDay()."".$Day->thisDay()."
    - << + <<  " . date('l j F Y',mktime(0,0,0,$month,$day,$year)) . "";?> - >> + >>
    " . date('l j F Y',mktime(0,0,0,$month,$day,$year)) . ""; } - - -?> +?> \ No newline at end of file diff --git a/functions/functions.client.php b/functions/functions.client.php index d1ec7479..0815f873 100644 --- a/functions/functions.client.php +++ b/functions/functions.client.php @@ -87,3 +87,4 @@ function get_client_questionnaire($client_id) } +?> \ No newline at end of file diff --git a/functions/functions.display.php b/functions/functions.display.php index 7046caa5..51ae666e 100644 --- a/functions/functions.display.php +++ b/functions/functions.display.php @@ -3,8 +3,6 @@ * Functions relating to displaying for XHTML * * - * - * * This file is part of queXS * * queXS is free software; you can redistribute it and/or modify @@ -31,7 +29,6 @@ * */ - /** * Configuration file */ @@ -43,30 +40,23 @@ include_once(dirname(__FILE__).'/../config.inc.php'); include_once(dirname(__FILE__).'/../db.inc.php'); - - - - - - /** * Display a list of questionnaires to choose from in a drop down list * * @param int|bool $questionnaire_id The questionnaire id or false if none selecetd * */ -function display_questionnaire_chooser($questionnaire_id = false, $overall = false) +function display_questionnaire_chooser($questionnaire_id = false, $overall = false, $divclass=false, $selectclass=false) { global $db; - $sql = "SELECT questionnaire_id,description,CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM questionnaire WHERE enabled = 1"; $rs = $db->GetAll($sql); - print "
    "; if (!empty($rs)) { if (is_array($overall)) @@ -92,7 +82,7 @@ function display_questionnaire_chooser($questionnaire_id = false, $overall = fal * @param int $questionnaire_id The questionnaire id * @param int|bool $shift_id The shift id or false if none selected */ -function display_shift_chooser($questionnaire_id, $shift_id = false) +function display_shift_chooser($questionnaire_id, $shift_id = false, $divclass=false, $selectclass=false) { global $db; @@ -103,7 +93,7 @@ function display_shift_chooser($questionnaire_id, $shift_id = false) $rs = $db->GetAll($sql); - print "
    "; if (!empty($rs)) { foreach($rs as $r) @@ -121,13 +111,13 @@ function display_shift_chooser($questionnaire_id, $shift_id = false) * @param int|bool $sample_import_id The sample import id or false if none selected * @param bool $disabled Display disabled samples? (default is true) */ -function display_sample_chooser($questionnaire_id, $sample_import_id = false, $disabled = true) +function display_sample_chooser($questionnaire_id, $sample_import_id = false, $disabled = true, $divclass=false, $selectclass=false) { global $db; - $s = ""; + $s = ""; - if (!$disabled) + if (!$disabled) $s = " AND si.enabled = 1 "; $sql = "SELECT s.sample_import_id,si.description,CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected @@ -137,7 +127,7 @@ function display_sample_chooser($questionnaire_id, $sample_import_id = false, $d $rs = $db->GetAll($sql); - print "
    "; if (!empty($rs)) { foreach($rs as $r) @@ -155,7 +145,7 @@ function display_sample_chooser($questionnaire_id, $sample_import_id = false, $d * @param int $sample_import_id The sample import id * @param int|bool $qsqri The sample import id or false if none selected */ -function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = false) +function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = false, $divclass=false, $selectclass=false) { global $db; @@ -166,7 +156,7 @@ function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = fa $rs = $db->GetAll($sql); - print "
    "; if (!empty($rs)) { foreach($rs as $r) @@ -177,6 +167,4 @@ function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = fa print "
    "; } - - -?> +?> \ No newline at end of file diff --git a/functions/functions.import.php b/functions/functions.import.php index 60514330..0b567a7c 100644 --- a/functions/functions.import.php +++ b/functions/functions.import.php @@ -86,7 +86,7 @@ function verify_fields($fields) { if (array_key_exists($fields["n_$val"], $names)) { - return T_("Duplicate name"); + return T_("Duplicate column name") . ": " . $fields["n_$val"] . ""; } else { @@ -123,14 +123,14 @@ function verify_fields($fields) */ function display_table($data) { - print ""; - print ""; + print "
    " . T_("Import?") . "" . T_("Name") . "" . T_("Type") . "" . T_("Allow operator to see?") . "
    "; + print ""; $row = 1; global $db; $sql = "SELECT description,type - FROM sample_var_type"; + FROM sample_var_type ORDER BY type ASC"; $rs = $db->GetAll($sql); @@ -140,21 +140,24 @@ function display_table($data) $checked = "checked"; if (empty($val)) $val = "samp_$row"; - print ""; - print ""; + print " + + + "; + print ""; print ""; $row++; - } - print "
    " . T_("Selected file column name") . "" . T_("Import ?") . "" . T_("New Sample Variable Name") . "" . T_("Variable Type") . "" . T_("Show to operator?") . "
    $value"; - print "
    $value"; + print "
    "; + print ""; } @@ -209,6 +212,7 @@ function import_file($file, $description, $fields, $firstrow = 2) $selected_type = array(); $selected_name = array(); + $sirv_id = array(); foreach($fields as $key => $val) { @@ -226,10 +230,12 @@ function import_file($file, $description, $fields, $firstrow = 2) } $sql = "INSERT INTO sample_import_var_restrict - (`sample_import_id`,`var`,`restrict`) - VALUES ($id,'" . $fields["n_" . substr($key,2)] . "',$restrict)"; + (`sample_import_id`,`var`,`type`,`restrict`) + VALUES ($id,'" . $fields["n_" . substr($key,2)] . "','" . $fields["t_" . substr($key,2)] . "',$restrict)"; - $db->Execute($sql); + $db->Execute($sql); + + $sirv_id[substr($key,2)] = $db->Insert_ID(); // } } @@ -309,8 +315,8 @@ function import_file($file, $description, $fields, $firstrow = 2) { $dkey = $db->Quote($data[$key - 1]); - $sql = "INSERT INTO sample_var (sample_id,var,val,type) - VALUES ('$sid','$val',{$dkey},'{$selected_type[$key]}')"; + $sql = "INSERT INTO sample_var (sample_id,var_id,var,val,type) + VALUES ('$sid','{$sirv_id[$key]}','$val',{$dkey},'{$selected_type[$key]}')"; $db->Execute($sql); diff --git a/functions/functions.limesurvey.php b/functions/functions.limesurvey.php index 6327c4bb..fee499c5 100644 --- a/functions/functions.limesurvey.php +++ b/functions/functions.limesurvey.php @@ -283,11 +283,11 @@ function validate_email($email){ * @param int $questionnaire_id The questionnaire ID * @param int $sample_import_id The sample import ID * @param string $val The value to compare - * @param string $var The variable to compare + * --- changed @param string $var the variable to compare + * to @param string $var_id - ID for variable to compare * @return bool|int False if failed, otherwise the number of completions - * */ -function limesurvey_quota_replicate_completions($lime_sid,$questionnaire_id,$sample_import_id,$val,$var) +function limesurvey_quota_replicate_completions($lime_sid,$questionnaire_id,$sample_import_id,$val,$var_id) { global $db; @@ -305,7 +305,7 @@ function limesurvey_quota_replicate_completions($lime_sid,$questionnaire_id,$sam FROM " . LIME_PREFIX . "survey_$lime_sid as s JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id') JOIN `sample` as sam ON (c.sample_id = sam.sample_id AND sam.import_id = '$sample_import_id') - JOIN `sample_var` as sv ON (sv.sample_id = sam.sample_id AND sv.var LIKE '$var' AND sv.val LIKE '$val') + JOIN `sample_var` as sv ON (sv.sample_id = sam.sample_id AND sv.var_id = '$var_id' AND sv.val LIKE '$val') WHERE s.submitdate IS NOT NULL AND s.token = c.token"; @@ -355,14 +355,15 @@ function limesurvey_quota_match($lime_sgqa,$lime_sid,$case_id,$value,$comparison * @param int $lime_sid The Limesurvey survey id * @param int $case_id The case id * @param string $val The sample value to compare - * @param string $var The sample variable to compare + * --- changed @param string $var the variable to compare + * to @param string $var_id - ID for variable to compare * @param int $sample_import_id The sample import id we are looking at * * @return bool|int False if failed, otherwise 1 if matched, 0 if doesn't * @author Adam Zammit * @since 2012-04-30 */ -function limesurvey_quota_replicate_match($lime_sid,$case_id,$val,$var,$sample_import_id) +function limesurvey_quota_replicate_match($lime_sid,$case_id,$val,$var_id,$sample_import_id) { global $db; @@ -370,7 +371,7 @@ function limesurvey_quota_replicate_match($lime_sid,$case_id,$val,$var,$sample_i FROM " . LIME_PREFIX . "survey_$lime_sid as s JOIN `case` as c ON (c.case_id = '$case_id') JOIN `sample` as sam ON (c.sample_id = sam.sample_id and sam.import_id = $sample_import_id) - JOIN `sample_var` as sv ON (sv.sample_id = sam.sample_id AND sv.var LIKE '$var' AND sv.val LIKE '$val') + JOIN `sample_var` as sv ON (sv.sample_id = sam.sample_id AND sv.var_id = '$var_id' AND sv.val LIKE '$val') WHERE s.token = c.token"; $rs = $db->GetRow($sql); diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 01bb1c64..c6ea6a1b 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -184,8 +184,9 @@ function get_sample_variable($variable,$case_id) $sql = "SELECT s.val as r FROM sample_var as s - JOIN `case` as c on (c.case_id = '$case_id' and s.sample_id = c.sample_id) - WHERE s.var = '$variable'"; + JOIN `case` as c on (c.case_id = '$case_id' and s.sample_id = c.sample_id), `sample_import_var_restrict` as sivr + WHERE sivr.var = '$variable' + AND s.var_id = sivr.var_id"; $rs = $db->GetRow($sql); @@ -238,7 +239,6 @@ function get_respondent_variable($variable,$respondent_id) $rs = $db->GetRow($sql); - if (empty($rs)) return ""; return $rs['r']; @@ -380,13 +380,15 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing = //$db->Execute("SET @row := 0"); - $sql = "SELECT val as phone - FROM sample_var - WHERE sample_id = '$sample_id' - AND val is NOT NULL - AND val != \"\" - AND (`type` = 2 or `type` = 3) - ORDER BY `type` DESC"; + $sql = "SELECT sv.val as phone + FROM sample_var as sv, sample_import_var_restrict as sivr + WHERE sv.sample_id = '$sample_id' + AND sv.var_id = sivr.var_id + AND sv.val > 0 + AND sv.val is NOT NULL + AND sv.val != \"\" + AND sivr.`type` IN (2,3) + ORDER BY sivr.`type` DESC"; $r5 = $db->GetAll($sql); @@ -396,7 +398,7 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing = foreach ($r5 as $r5v) { $tnum = preg_replace("/[^0-9]/", "",$r5v['phone']); - if (empty($tnum)) $tnum = "312345678"; //handle error condition + if (empty($tnum)) $tnum = "88888888"; //handle error condition $sql = "INSERT INTO contact_phone (case_id,priority,phone,description) VALUES ($case_id,$i,$tnum,'')"; $db->Execute($sql); @@ -406,7 +408,7 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing = else { $sql = "INSERT INTO contact_phone (case_id,priority,phone,description) - VALUES ($case_id,1,312345678,'test only')"; + VALUES ($case_id,1,88888888,'test only')"; $db->Execute($sql); } @@ -417,8 +419,8 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing = $sql = "INSERT INTO respondent (case_id,firstName,lastName,Time_zone_name) SELECT $case_id as case_id, IFNULL(s1.val,'') as firstName, IFNULL(s2.val,'') as lastName, s3.Time_zone_name as Time_zone_name FROM sample as s3 - LEFT JOIN sample_var as s2 on (s2.sample_id = '$sample_id' and s2.type = 7) - LEFT JOIN sample_var as s1 on (s1.sample_id = '$sample_id' and s1.type = 6) + LEFT JOIN (sample_var as s2 , sample_import_var_restrict as sivr2) on (s2.sample_id = '$sample_id' and s2.var_id = sivr2.var_id and sivr2.type = 7) + LEFT JOIN (sample_var as s1 , sample_import_var_restrict as sivr1) on (s1.sample_id = '$sample_id' and s1.var_id = sivr1.var_id and sivr1.type = 6) WHERE s3.sample_id = '$sample_id'"; $db->Execute($sql); @@ -1515,7 +1517,7 @@ function close_row_quota($questionnaire_sample_quota_row_id,$update = true) if (isset($coun['c']) && $coun['c'] == 0) { - $sql2 = "SELECT exclude_val,exclude_var,comparison + $sql2 = "SELECT exclude_val,exclude_var,exclude_var_id,comparison FROM qsqr_sample WHERE questionnaire_sample_quota_row_id = $questionnaire_sample_quota_row_id"; @@ -1530,7 +1532,7 @@ function close_row_quota($questionnaire_sample_quota_row_id,$update = true) $x = 1; foreach($rev as $ev) { - $sql .= " JOIN sample_var as sv$x ON (sv$x.sample_id = s.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; + $sql .= " JOIN sample_var as sv$x ON (sv$x.sample_id = s.sample_id AND sv$x.var_id = '{$ev['exclude_var_id']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; $x++; } @@ -1538,6 +1540,8 @@ function close_row_quota($questionnaire_sample_quota_row_id,$update = true) WHERE s.import_id = qs.sample_import_id"; $db->Execute($sql); + + if ($db->HasFailedTrans()) die ($sql); if ($update) { @@ -1582,8 +1586,8 @@ function copy_row_quota($questionnaire_id,$sample_import_id,$copy_sample_import_ $nqsqr = $db->Insert_ID(); - $sql = "INSERT INTO qsqr_sample (questionnaire_sample_quota_row_id,exclude_var,exclude_val,comparison,description) - SELECT $nqsqr, qs.exclude_var, qs.exclude_val, qs.comparison, qs.description + $sql = "INSERT INTO qsqr_sample (questionnaire_sample_quota_row_id,exclude_var_id,exclude_var,exclude_val,comparison,description) + SELECT $nqsqr, qs.exclude_var_id, qs.exclude_var, qs.exclude_val, qs.comparison, qs.description FROM qsqr_sample as qs, questionnaire_sample_quota_row as q WHERE qs.questionnaire_sample_quota_row_id = q.questionnaire_sample_quota_row_id AND q.questionnaire_id = '$questionnaire_id' @@ -1627,7 +1631,7 @@ function copy_row_quota_with_adjusting($questionnaire_id,$sample_import_id,$copy $db->StartTrans(); // Select quotas from the old sample rows and calculate - $sql = "SELECT questionnaire_sample_quota_row_id,q.questionnaire_id,sample_import_id,lime_sgqa,value,comparison,completions,quota_reached,q.lime_sid,qsq.exclude_var,qsq.exclude_val + $sql = "SELECT questionnaire_sample_quota_row_id,q.questionnaire_id,sample_import_id,lime_sgqa,value,comparison,completions,quota_reached,q.lime_sid,qsq.exclude_var_id,qsq.exclude_var,qsq.exclude_val FROM questionnaire_sample_quota_row as qsq, questionnaire as q WHERE qsq.questionnaire_id = '$questionnaire_id' AND q.questionnaire_id = '$questionnaire_id' @@ -1693,7 +1697,7 @@ function update_single_row_quota($qsqri,$case_id = false) $autoprioritise = $rs['autoprioritise']; //all variables to exclude for this row quota - $sql2 = "SELECT exclude_val,exclude_var,comparison + $sql2 = "SELECT exclude_val,exclude_var,exclude_var_id,comparison FROM qsqr_sample WHERE questionnaire_sample_quota_row_id = $qsqri"; @@ -1728,7 +1732,7 @@ function update_single_row_quota($qsqri,$case_id = false) $x = 1; foreach($rev as $ev) { - $sql2 .= " JOIN sample_var as sv$x ON (sv$x.sample_id = sam.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; + $sql2 .= " JOIN sample_var as sv$x ON (sv$x.sample_id = sam.sample_id AND sv$x.var_id = '{$ev['exclude_var_id']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; $x++; } @@ -1779,7 +1783,7 @@ function update_single_row_quota($qsqri,$case_id = false) $x = 1; foreach($rev as $ev) { - $sql2 .= " JOIN sample_var as sv$x ON (sv$x.sample_id = sam.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; + $sql2 .= " JOIN sample_var as sv$x ON (sv$x.sample_id = sam.sample_id AND sv$x.var_id = '{$ev['exclude_var_id']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}') "; $x++; } @@ -1919,7 +1923,7 @@ function update_quota_priorities($questionnaire_id) $sql = "INSERT INTO questionnaire_sample_exclude_priority (questionnaire_id,sample_id,exclude,priority) SELECT '$questionnaire_id', s.sample_id, 0, 50 - FROM sample AS s, questionnaire_sample as qs + FROM `sample` as s, questionnaire_sample as qs WHERE qs.questionnaire_id = '$questionnaire_id' AND s.import_id = qs.sample_import_id ON DUPLICATE KEY UPDATE exclude = 0, priority = 50"; @@ -1947,41 +1951,37 @@ function update_quota_priorities($questionnaire_id) $qsqri = $r['questionnaire_sample_quota_row_id']; $priority = $r['priority']; - $sql2 = "SELECT exclude_val,exclude_var,comparison + $sql2 = "SELECT exclude_val,exclude_var,exclude_var_id,comparison FROM qsqr_sample WHERE questionnaire_sample_quota_row_id = $qsqri"; - $rev = $db->GetAll($sql2); - + $rev = $db->GetAll($sql2); //find all cases that match this quota, and update it to the new priority - $sql = "UPDATE sample as s, questionnaire_sample_quota_row as qs, questionnaire_sample_exclude_priority as qsep "; + $sql = "UPDATE sample as s, questionnaire_sample_quota_row as qs, questionnaire_sample_exclude_priority as qsep "; - //reduce sample by every item in the qsqr_sample table - $x = 1; - foreach ($rev as $ev) - { - $sql .= ", sample_var as sv$x"; - $x++; - } + //reduce sample by every item in the qsqr_sample table + $x = 1; + foreach ($rev as $ev) + { + $sql .= ", sample_var as sv$x"; + $x++; + } - $sql .= " - SET qsep.priority = '$priority' + $sql .= " SET qsep.priority = '$priority' WHERE s.import_id = qs.sample_import_id AND qs.questionnaire_sample_quota_row_id = '$qsqri' AND qsep.questionnaire_id = qs.questionnaire_id - AND qsep.sample_id = s.sample_id "; - - $x = 1; - foreach ($rev as $ev) - { - $sql .= " AND sv$x.sample_id = s.sample_id AND sv$x.var LIKE '{$ev['exclude_var']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}' "; - $x++; - } - + AND qsep.sample_id = s.sample_id "; + + $x = 1; + foreach ($rev as $ev) + { + $sql .= " AND sv$x.sample_id = s.sample_id AND sv$x.var_id = '{$ev['exclude_var_id']}' AND sv$x.val {$ev['comparison']} '{$ev['exclude_val']}' "; + $x++; + } $db->Execute($sql); - if ($db->HasFailedTrans()) die ($sql); } diff --git a/functions/functions.performance.php b/functions/functions.performance.php index 12bb062a..26d2e55d 100644 --- a/functions/functions.performance.php +++ b/functions/functions.performance.php @@ -223,7 +223,7 @@ function get_stats_total($rs) $callsph = round($calls/($totaltime/3600),4); } - $rs[] = array("effectiveness" => $effectiveness, "completions" => $completions,"time" => sec_to_time($totaltime),"totalcalls" => $calls,"callt" => sec_to_time($calltime),"CPH" => $cph,"CALLSPH" => $callsph); + $rs[] = array("effectiveness" => '' . $effectiveness . '', "completions" => '' .$completions. '',"time" => '' . sec_to_time($totaltime). '',"totalcalls" => '' . $calls. '',"callt" => '' . sec_to_time($calltime). '',"CPH" => '' . $cph. '',"CALLSPH" => '' . $callsph. ''); return $rs; } diff --git a/functions/functions.xhtml.php b/functions/functions.xhtml.php index 88c80d36..f679c69f 100644 --- a/functions/functions.xhtml.php +++ b/functions/functions.xhtml.php @@ -43,14 +43,14 @@ * * @see xhtml_foot() */ -function xhtml_head($title="",$body=true,$css=false,$javascript=false,$bodytext=false,$refresh=false,$clearrefresh=false) +function xhtml_head($title="",$body=true,$css=false,$javascript=false,$bodytext=false,$refresh=false,$clearrefresh=false,$subtitle=false) { print ""; ?> - <?php if (empty($title)) print "queXS"; else print "queXS: $title"; ?> + <?php if (empty($title)) print "CATI"; else print "CATI: $title"; ?> "; @@ -70,6 +70,8 @@ print ""; "; else print ""; + print "

    " . "$title" . "  " . "$subtitle" . "

    "; + /* Let's print header that equals to menu item and page title !!!, move previous headers to "subtitles"*/ } /** @@ -78,9 +80,13 @@ print ""; * @see xhtml_head() */ -function xhtml_foot() -{ +function xhtml_foot($javascript = false){ //added javascript files array to the footer + if ($javascript) + foreach ($javascript as $j) print ""; ?> + + + @@ -97,22 +103,27 @@ function xhtml_foot() * @param bool|array $highlight False if nothing to highlight else an array containing the field to highlight * @param bool|array $total False if nothing to total else an array containing the fields to total * + * AD:> for @value $class = "tclass" added "Bootstrap" table classes + * AD:> added @param string $id - > to transfer table ID if required + * AD:> added @param string $name - > to transfer table name if required */ -function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight=false,$total=false) +function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight=false,$total=false,$id=false,$name=false) { $tot = array(); - print ""; + if ($class == "tclass") $class = "table-hover table-bordered table-condensed tclass"; + print "
    "; if ($head) { - print ""; + print ""; foreach ($head as $e) - print""; - print ""; + print""; + print ""; } + print ""; foreach($content as $row) { if ($highlight && isset($row[key($highlight)]) && $row[key($highlight)] == current($highlight)) - print ""; + print ""; else print ""; @@ -132,15 +143,18 @@ function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight } if ($total) { - print ""; + print ""; foreach ($fields as $e) { - print ""; + print ""; } - print ""; + print ""; + } + else{ + print ""; } print "
    $e
    $e
    "; + print ""; if (in_array($e,$total)) print $tot[$e]; - print "
    "; } @@ -163,13 +177,13 @@ function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight * @param bool $indiv Whether to display in a div or not * @param array|bool $select The element to select manually (element,string) (not using selected=\'selected\' in array) * @param bool $print Default is true, print the chooser otherwise return as a string - * + * */ -function display_chooser($elements, $selectid, $var, $useblank = true, $pass = false, $js = true, $indiv = true, $selected = false, $print = true) +function display_chooser($elements, $selectid, $var, $useblank = true, $pass = false, $js = true, $indiv = true, $selected = false, $print = true, $divclass=false, $selectclass="form-control") { $out = ""; - if ($indiv) $out .= "
    "; - $out .= " +``` + +### Stacked checkboxes +Refer to Bootstrap Form Controls documentation to create stacked checkboxes. Simply add `data-toggle="toggle"` to convert checkboxes into toggles. + +```html +
    + +
    +
    + +
    +``` + +### Inline Checkboxes +Refer to Bootstrap Form Controls documentation to create inline checkboxes. Simply add `data-toggle="toggle"` to a convert checkboxes into toggles. + +```html + + + +``` + +## API + +### Initialize by JavaScript +Initialize toggles with id `toggle-one` with a single line of JavaScript. + +```html + + +``` + +### Options +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-on="Enabled"`. + +```html + + + +``` + +Name|Type|Default|Description| +---|---|---|--- +on|string/html|"On"|Text of the on toggle +off|string/html|"Off"|Text of the off toggle +size|string|"normal"|Size of the toggle. Possible values are `large`, `normal`, `small`, `mini`. +onstyle|string|"primary"|Style of the on toggle. Possible values are `default`, `primary`, `success`, `info`, `warning`, `danger` +offstyle|string|"default"|Style of the off toggle. Possible values are `default`, `primary`, `success`, `info`, `warning`, `danger` +style|string| |Appends the value to the class attribute of the toggle. This can be used to apply custom styles. Refer to Custom Styles for reference. +width|integer|*null*|Sets the width of the toggle. if set to *null*, width will be calculated. +height|integer|*null*|Sets the height of the toggle. if set to *null*, height will be calculated. + +### Methods +Methods can be used to control toggles directly. + +```html + +``` + +Method|Example|Description +---|---|--- +initialize|$('#toggle-demo').bootstrapToggle()|Initializes the toggle plugin with options +destroy|$('#toggle-demo').bootstrapToggle('destroy')|Destroys the toggle +on|$('#toggle-demo').bootstrapToggle('on')|Sets the toggle to 'On' state +off|$('#toggle-demo').bootstrapToggle('off')|Sets the toggle to 'Off' state +toggle|$('#toggle-demo').bootstrapToggle('toggle')|Toggles the state of the toggle +enable|$('#toggle-demo').bootstrapToggle('enable')|Enables the toggle +disable|$('#toggle-demo').bootstrapToggle('disable')|Disables the toggle + +## Events + +### Event Propagation +Note All events are propagated to and from input element to the toggle. + +You should listen to events from the `` directly rather than look for custom events. + +```html + +
    + +``` + +### API vs Input +This also means that using the API or Input to trigger events will work both ways. + +```html + + + + + + +``` + +## Demos + +Visit http://www.bootstraptoggle.com for demos. diff --git a/include/bootstrap-toggle/css/bootstrap-toggle.css b/include/bootstrap-toggle/css/bootstrap-toggle.css new file mode 100644 index 00000000..057d08b3 --- /dev/null +++ b/include/bootstrap-toggle/css/bootstrap-toggle.css @@ -0,0 +1,83 @@ +/*! ======================================================================== + * Bootstrap Toggle: bootstrap-toggle.css v2.2.0 + * http://www.bootstraptoggle.com + * ======================================================================== + * Copyright 2014 Min Hur, The New York Times Company + * Licensed under MIT + * ======================================================================== */ + + +.checkbox label .toggle, +.checkbox-inline .toggle { + margin-left: -20px; + margin-right: 5px; +} + +.toggle { + position: relative; + overflow: hidden; +} +.toggle input[type="checkbox"] { + display: none; +} +.toggle-group { + position: absolute; + width: 200%; + top: 0; + bottom: 0; + left: 0; + transition: left 0.35s; + -webkit-transition: left 0.35s; + -moz-user-select: none; + -webkit-user-select: none; +} +.toggle.off .toggle-group { + left: -100%; +} +.toggle-on { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 50%; + margin: 0; + border: 0; + border-radius: 0; +} +.toggle-off { + position: absolute; + top: 0; + bottom: 0; + left: 50%; + right: 0; + margin: 0; + border: 0; + border-radius: 0; +} +.toggle-handle { + position: relative; + margin: 0 auto; + padding-top: 0px; + padding-bottom: 0px; + height: 100%; + width: 0px; + border-width: 0 1px; +} + +.toggle.btn { min-width: 59px; min-height: 34px; } +.toggle-on.btn { padding-right: 24px; } +.toggle-off.btn { padding-left: 24px; } + +.toggle.btn-lg { min-width: 79px; min-height: 45px; } +.toggle-on.btn-lg { padding-right: 31px; } +.toggle-off.btn-lg { padding-left: 31px; } +.toggle-handle.btn-lg { width: 40px; } + +.toggle.btn-sm { min-width: 50px; min-height: 30px;} +.toggle-on.btn-sm { padding-right: 20px; } +.toggle-off.btn-sm { padding-left: 20px; } + +.toggle.btn-xs { min-width: 35px; min-height: 22px;} +.toggle-on.btn-xs { padding-right: 12px; } +.toggle-off.btn-xs { padding-left: 12px; } + diff --git a/include/bootstrap-toggle/css/bootstrap-toggle.min.css b/include/bootstrap-toggle/css/bootstrap-toggle.min.css new file mode 100644 index 00000000..0d42ed09 --- /dev/null +++ b/include/bootstrap-toggle/css/bootstrap-toggle.min.css @@ -0,0 +1,28 @@ +/*! ======================================================================== + * Bootstrap Toggle: bootstrap-toggle.css v2.2.0 + * http://www.bootstraptoggle.com + * ======================================================================== + * Copyright 2014 Min Hur, The New York Times Company + * Licensed under MIT + * ======================================================================== */ +.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-20px;margin-right:5px} +.toggle{position:relative;overflow:hidden} +.toggle input[type=checkbox]{display:none} +.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;-moz-user-select:none;-webkit-user-select:none} +.toggle.off .toggle-group{left:-100%} +.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0} +.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0} +.toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px} +.toggle.btn{min-width:59px;min-height:34px} +.toggle-on.btn{padding-right:24px} +.toggle-off.btn{padding-left:24px} +.toggle.btn-lg{min-width:79px;min-height:45px} +.toggle-on.btn-lg{padding-right:31px} +.toggle-off.btn-lg{padding-left:31px} +.toggle-handle.btn-lg{width:40px} +.toggle.btn-sm{min-width:50px;min-height:30px} +.toggle-on.btn-sm{padding-right:20px} +.toggle-off.btn-sm{padding-left:20px} +.toggle.btn-xs{min-width:35px;min-height:22px} +.toggle-on.btn-xs{padding-right:12px} +.toggle-off.btn-xs{padding-left:12px} \ No newline at end of file diff --git a/include/bootstrap-toggle/js/bootstrap-toggle.js b/include/bootstrap-toggle/js/bootstrap-toggle.js new file mode 100644 index 00000000..533914ed --- /dev/null +++ b/include/bootstrap-toggle/js/bootstrap-toggle.js @@ -0,0 +1,180 @@ +/*! ======================================================================== + * Bootstrap Toggle: bootstrap-toggle.js v2.2.0 + * http://www.bootstraptoggle.com + * ======================================================================== + * Copyright 2014 Min Hur, The New York Times Company + * Licensed under MIT + * ======================================================================== */ + + + +function ($) { + 'use strict'; + + // TOGGLE PUBLIC CLASS DEFINITION + // ============================== + + var Toggle = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, this.defaults(), options) + this.render() + } + + Toggle.VERSION = '2.2.0' + + Toggle.DEFAULTS = { + on: 'On', + off: 'Off', + onstyle: 'primary', + offstyle: 'default', + size: 'normal', + style: '', + width: null, + height: null + } + + Toggle.prototype.defaults = function() { + return { + on: this.$element.attr('data-on') || Toggle.DEFAULTS.on, + off: this.$element.attr('data-off') || Toggle.DEFAULTS.off, + onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle, + offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle, + size: this.$element.attr('data-size') || Toggle.DEFAULTS.size, + style: this.$element.attr('data-style') || Toggle.DEFAULTS.style, + width: this.$element.attr('data-width') || Toggle.DEFAULTS.width, + height: this.$element.attr('data-height') || Toggle.DEFAULTS.height + } + } + + Toggle.prototype.render = function () { + this._onstyle = 'btn-' + this.options.onstyle + this._offstyle = 'btn-' + this.options.offstyle + var size = this.options.size === 'large' ? 'btn-lg' + : this.options.size === 'small' ? 'btn-sm' + : this.options.size === 'mini' ? 'btn-xs' + : '' + var $toggleOn = $('