* @copyright Deakin University 2007,2008 * @package queXS * @subpackage admin * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * * */ /** * Configuration file */ include("../config.inc.php"); /** * Database file */ include ("../db.inc.php"); /** * XHTML functions */ include("../functions/functions.xhtml.php"); /** * Display functions */ include("../functions/functions.display.php"); /** * Input functions */ include("../functions/functions.input.php"); $css = array( "../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/font-awesome-4.3.0/css/font-awesome.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css", "../css/custom.css" ); $js_head = array( "../js/jquery-2.1.3.min.js", "../include/bootstrap-3.3.2/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 $questionnaire_id = bigintval($_GET['questionnaire_id']); $sid = bigintval($_GET['sample']); $cm = bigintval($_GET['call_max']); $cam = bigintval($_GET['call_attempt_max']); $am = bigintval($_GET['answering_machine_messages']); $selecttype = 0; if (isset($_GET['selecttype'])) $selecttype = 1; $an = 0; if (isset($_GET['allownew'])) $an = 1; $sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages,allow_new) 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']); $cam = bigintval($_POST['call_attempt_max']); $am = bigintval($_POST['answering_machine_messages']); $selecttype = 0; if (isset($_POST['selecttype'])) $selecttype = 1; $an = 0; if (isset($_POST['allownew'])) $an = 1; $sql = "UPDATE questionnaire_sample SET call_max = '$cm', call_attempt_max = '$cam', random_select = '$selecttype', answering_machine_messages = '$am', allow_new = '$an' WHERE questionnaire_id = '$questionnaire_id' AND sample_import_id = '$sid'"; $db->Execute($sql); } if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) { $questionnaire_id = bigintval($_GET['questionnaire_id']); $sid = bigintval($_GET['rsid']); if (isset($_GET['edit'])) { $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, q.call_max, q.call_attempt_max, q.random_select, q.answering_machine_messages, q.allow_new FROM questionnaire_sample as q, sample_import as si, questionnaire as qr WHERE q.sample_import_id = si.sample_import_id AND q.questionnaire_id = '$questionnaire_id' AND si.sample_import_id = '$sid' AND qr.questionnaire_id = q.questionnaire_id"; $qs = $db->GetRow($sql); //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"/>



Execute($sql); } } $questionnaire_id = false; if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); $subtitle = T_("List & Add Sample"); xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js") 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") .":

"; $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('') 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'"; $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"))); else print "

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

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

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

"; ?>








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


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