2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

update to 499

This commit is contained in:
Alex
2015-11-21 02:39:35 +03:00
150 changed files with 35232 additions and 27009 deletions

View File

@@ -1,6 +1,5 @@
queXS 1.14.0 - Changes since 1.13.1 queXS 1.14.0 - Changes since 1.13.1
Changes for session authentication: Changes for session authentication:
queXS now uses the Limesurvey session based authentication system to authenticate all users. queXS now uses the Limesurvey session based authentication system to authenticate all users.
@@ -29,29 +28,47 @@ These queries will:
2. Make all other users regular users, and assign them the password "password" 2. Make all other users regular users, and assign them the password "password"
3. Make all clients regular clients, and assign them the password "password" 3. Make all clients regular clients, and assign them the password "password"
Once you have run these - please go to the operator management page and update passwords for all users. Once you have run these - please go to the operator management page and update passwords for all users AND reassign any extensions.
/* Make the first user the admin user - with default password of: password */ /* Make the first user the admin user - with default password of: password */
INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`) INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`)
SELECT username, '0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438', firstName, 0, 'auto', 1 SELECT username, 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, firstName, 0, 'auto', 1
FROM operator FROM operator
WHERE operator_id = 1; WHERE operator_id = 1;
/* Make all other users operators - with default password of: password */ /* Make all other users operators - with default password of: password */
INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`) INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`)
SELECT username, '0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438', firstName, 1, 'auto', 0 SELECT username, 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, firstName, 1, 'auto', 0
FROM operator FROM operator
WHERE operator_id != 1; WHERE operator_id != 1;
/* Make all clients - with default password of: password */ /* Make all clients - with default password of: password */
INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`) INSERT INTO `lime_users` (`users_name`, `password`, `full_name`, `parent_id`, `lang`, `superadmin`)
SELECT username, '0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438', firstName, 1, 'auto', 0 SELECT username, 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, firstName, 1, 'auto', 0
FROM client FROM client
WHERE 1; WHERE 1;
/* Remove redundant table */ /* Remove redundant table */
DROP TABLE `sessions2`; DROP TABLE `sessions2`;
/* Add sort order feature to questionnaire sample table */
ALTER TABLE `questionnaire_sample` ADD `sort_order` INT( 11 ) NOT NULL DEFAULT '0';
UPDATE `questionnaire_sample` SET sort_order = sample_import_id;
/* Add default outcomes feature */
/* -- add `default` and `permanent` parameters for outcomes -- */
ALTER TABLE `outcome` ADD `default` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Used as default for questionnaire outcomes' AFTER `calc`, ADD `permanent` TINYINT(1) UNSIGNED NOT NULL COMMENT 'Permanent outcome, used for all questionnaires, not possible to de-select' AFTER `default`;
/* -- define and set mandatory(constant) outcome_id's --*/
UPDATE `outcome` SET `permanent` = '1' WHERE `outcome`.`outcome_id` IN (1,2,3,7,9,10,14,17,18,19) ;
/* -- add `outcomes` parameter , define default list of outcome_ID's to be enabled for new questionnaries --*/
ALTER TABLE `questionnaire` ADD `outcomes` VARCHAR(256) NULL DEFAULT '1,2,3,7,9,10,14,17,18,19' COMMENT 'Comma-separated string of outcomes defined for the questionnaire' AFTER `enabled`;
/* -- enable all outcomes for existing questionnaires -- */
UPDATE `questionnaire` SET `outcomes` = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,40,41,42,43,44,45' ;
queXS 1.13.1 - Changes since 1.13.0 queXS 1.13.1 - Changes since 1.13.0

View File

@@ -1,19 +0,0 @@
required DB updates:
/* -- add `default` and `const` parameters for outcomes -- */
ALTER TABLE `outcome` ADD `deflt` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Used as default for questionnaire outcomes' AFTER `calc`, ADD `const` TINYINT(1) UNSIGNED NOT NULL COMMENT 'Permanent outcome, used for all questionnaires, not possible to de-select' AFTER `deflt`;
/* -- define and set mandatory(constant) outcome_id's --*/
UPDATE `outcome` SET `const` = '1' WHERE `outcome`.`outcome_id` IN (1,2,3,7,9,10,14,17,18,19) ;
/* -- add `outcomes` parameter , define default list of outcome_ID's to be enabled for new questionnaries --*/
ALTER TABLE `questionnaire` ADD `outcomes` VARCHAR(256) NULL DEFAULT '1,2,3,7,9,10,14,17,18,19' COMMENT 'coma-separated string of outcomes defined for the questionnaire' AFTER `enabled`;
/* -- enable all outcomes for existing questionnaires -- */
UPDATE `questionnaire` SET `outcomes` = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,40,41,42,43,44,45' ;

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -93,8 +93,14 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['
$an = 0; $an = 0;
if (isset($_GET['allownew'])) $an = 1; 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) $sql = "SELECT MAX(sort_order) + 1
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')"; FROM questionnaire_sample
WHERE questionnaire_id = '$questionnaire_id'";
$so = $db->GetOne($sql);
$sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages,allow_new,sort_order)
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an', '$so')";
$db->Execute($sql); $db->Execute($sql);
@@ -176,7 +182,6 @@ if (isset($_POST['edit']))
} }
if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
{ {
$questionnaire_id = bigintval($_GET['questionnaire_id']); $questionnaire_id = bigintval($_GET['questionnaire_id']);
@@ -239,7 +244,69 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
die(); die();
} }
else if (isset($_GET['sort']))
{
if ($_GET['sort'] == "up")
{
//find previous in sort order and do a swap
$sql = "SELECT sample_import_id,sort_order
FROM questionnaire_sample
WHERE questionnaire_id = $questionnaire_id
AND sort_order < (SELECT sort_order FROM questionnaire_sample WHERE questionnaire_id = $questionnaire_id AND sample_import_id = $sid)
ORDER BY sort_order DESC LIMIT 1";
$rs = $db->GetRow($sql);
$ssid = $rs['sample_import_id'];
$sso = $rs['sort_order'];
$sql = "UPDATE questionnaire_sample
SET sort_order = $sso
WHERE sample_import_id = $sid
AND questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "UPDATE questionnaire_sample
SET sort_order = ($sso + 1)
WHERE sample_import_id = $ssid
AND questionnaire_id = $questionnaire_id";
$db->Execute($sql);
}
else
{
//find next in sort order and do a swap
$sql = "SELECT sample_import_id,sort_order
FROM questionnaire_sample
WHERE questionnaire_id = $questionnaire_id
AND sort_order > (SELECT sort_order FROM questionnaire_sample WHERE questionnaire_id = $questionnaire_id AND sample_import_id = $sid)
ORDER BY sort_order ASC LIMIT 1";
$rs = $db->GetRow($sql);
$ssid = $rs['sample_import_id'];
$sso = $rs['sort_order'];
$sql = "UPDATE questionnaire_sample
SET sort_order = $sso
WHERE sample_import_id = $sid
AND questionnaire_id = $questionnaire_id";
$db->Execute($sql);
$sql = "UPDATE questionnaire_sample
SET sort_order = ($sso - 1)
WHERE sample_import_id = $ssid
AND questionnaire_id = $questionnaire_id";
$db->Execute($sql);
unset($_GET['sort']);
}
}
else else
{ {
//need to remove rsid from questionnaire //need to remove rsid from questionnaire
@@ -266,7 +333,7 @@ if ($questionnaire_id != false)
print "<div class='clearfix '></div><div class='panel-body'> print "<div class='clearfix '></div><div class='panel-body'>
<h3 class='text-primary'>". T_("Samples selected for this questionnaire") .":</h3>"; <h3 class='text-primary'>". T_("Samples selected for this questionnaire") .":</h3>";
$sql = "SELECT si.description as description, $sql = "SELECT q.sort_order as sort_order, si.description as description,si.sample_import_id,
CASE WHEN q.call_max = 0 THEN '". TQ_("Unlimited") ."' ELSE q.call_max END as call_max, 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.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.random_select = 0 THEN '". TQ_("Sequential") ."' ELSE '". TQ_("Random") . "' END as random_select,
@@ -276,12 +343,39 @@ if ($questionnaire_id != false)
CONCAT('<a href=\'\' data-toggle=\'confirmation\' data-placement=\'top\' data-href=\"?questionnaire_id=$questionnaire_id&amp;rsid=', si.sample_import_id ,'\" class=\'btn center-block\'><i class=\'fa fa-chain-broken fa-lg\' data-toggle=\'tooltip\' title=\'". TQ_("Click to unassign") ."\'></i></a>') as unassign CONCAT('<a href=\'\' data-toggle=\'confirmation\' data-placement=\'top\' data-href=\"?questionnaire_id=$questionnaire_id&amp;rsid=', si.sample_import_id ,'\" class=\'btn center-block\'><i class=\'fa fa-chain-broken fa-lg\' data-toggle=\'tooltip\' title=\'". TQ_("Click to unassign") ."\'></i></a>') as unassign
FROM questionnaire_sample as q, sample_import as si FROM questionnaire_sample as q, sample_import as si
WHERE q.sample_import_id = si.sample_import_id WHERE q.sample_import_id = si.sample_import_id
AND q.questionnaire_id = '$questionnaire_id'"; AND q.questionnaire_id = '$questionnaire_id'
ORDER BY q.sort_order ASC";
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
if (!empty($qs)) 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"))); {
$co = count($qs);
if ($co > 1)
{
for($i = 0; $i < $co; $i++)
{
$down = "<a href='?questionnaire_id=$questionnaire_id&amp;sort=down&amp;rsid={$qs[$i]['sample_import_id']}' data-toggle=\"tooltip\" title=\"". T_("Pull step Down") ."\"><i class=\"fa fa-arrow-down fa-lg\"></i></a>";
$up = "<a href='?questionnaire_id=$questionnaire_id&amp;sort=up&amp;rsid={$qs[$i]['sample_import_id']}' data-toggle=\"tooltip\" title=\"". T_("Push step Up") ."\"><i class=\"fa fa-arrow-up fa-lg\"></i></a>";
if ($i == 0) //down only
{
$qs[$i]['sort_order'] = "<div style=\"min-width:70px;\">&ensp;<span class=\"badge\">" . $qs[$i]['sort_order'] . "</span>&ensp;&emsp;" . $down . "</div>";
}
else if ($i == ($co - 1)) //up only
{
$qs[$i]['sort_order'] = "&ensp;<span class=\"badge\">" . $qs[$i]['sort_order'] . "</span>&ensp;" . $up;
}
else
{
$qs[$i]['sort_order'] = "<div style=\"min-width:70px;\">&ensp;<span class=\"badge\">" . $qs[$i]['sort_order'] . "</span>&ensp;" . $up . $down . "</div>";
}
}
}
else
$qs[0]['sort_order'] = "&emsp;<i class=\"fa fa-minus fa-lg\"></i>&emsp;";
xhtml_table($qs,array("sort_order","description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sort order"),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 else
print "<div class='alert text-danger'><h4>". T_("No samples selected for this questionnaire") ."</h4></div>"; print "<div class='alert text-danger'><h4>". T_("No samples selected for this questionnaire") ."</h4></div>";

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -48,6 +48,8 @@ $sql = "SELECT stg_value
session_name($db->GetOne($sql)); session_name($db->GetOne($sql));
session_set_cookie_params(0,QUEXS_PATH);
session_start(); session_start();
//check if the session exists or loginID not set //check if the session exists or loginID not set

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -47,7 +47,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* Operator functions * Operator functions

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -133,7 +133,7 @@ if ($operator_id)
while ($r = $rs->FetchRow()) while ($r = $rs->FetchRow())
{ {
translate_array($r,array("des")); translate_array($r,array("descr"));
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"; 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";
} }
@@ -151,7 +151,7 @@ if ($operator_id)
} }
else else
{ {
translate_array($rs,array("des")); translate_array($rs,array("descr"));
$datacol = array("start_date", "start_time","end","case_id","qd","spl","cpi","opname","descr","casenotes","firstName"); $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")); $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"));

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -75,7 +75,8 @@ if ($operator_id)
if (!empty($rs)){ if (!empty($rs)){
print "<h2 class=' '>" . T_("Project") . ":&emsp;<span class='text-primary'>{$rs['qd']}</span></h2>"; print "<h2 class=' '>" . T_("Project") . ":&emsp;<span class='text-primary'>{$rs['qd']}</span></h2>";
if($sample_import_id=intval($_GET['sample_import_id'])){ if( isset($_GET['sample_import_id'])){
$sample_import_id=intval($_GET['sample_import_id']);
$sql = "SELECT si.description as sd $sql = "SELECT si.description as sd
FROM `sample_import` as si FROM `sample_import` as si
WHERE si.sample_import_id = '$sample_import_id' ;"; WHERE si.sample_import_id = '$sample_import_id' ;";
@@ -85,7 +86,8 @@ if ($operator_id)
} }
else{$sid = " ";}; else{$sid = " ";};
if($oper_id= intval($_GET['oper_id'])){ if( isset($_GET['oper_id'])){
$oper_id= intval($_GET['oper_id']);
$sql = "SELECT CONCAT(op.firstname, op.lastname) as opname $sql = "SELECT CONCAT(op.firstname, op.lastname) as opname
FROM `operator` as op FROM `operator` as op
WHERE op.operator_id = '$oper_id' ;"; WHERE op.operator_id = '$oper_id' ;";

View File

@@ -15,7 +15,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -110,19 +110,24 @@ function case_status_report($questionnaire_id = false, $sample_id = false, $outc
LEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_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 case_queue as cq ON (cq.case_id = c.case_id)
LEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id) LEFT JOIN operator as oq ON (cq.operator_id = oq.operator_id)
LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
WHERE c.current_operator_id IS NULL $q $o WHERE c.current_operator_id IS NULL $q $o
AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
ORDER BY c.case_id ASC"; ORDER BY c.case_id ASC";
// print $sql;
print ("<form method=\"post\" action=\"?questionnaire_id=$questionnaire_id&sample_import_id=$sample_id\">"); print ("<form method=\"post\" action=\"?questionnaire_id=$questionnaire_id&sample_import_id=$sample_id\">");
$rs2 = $db->GetAll($sql);
translate_array($rs2,array("outcomes"));
$datacol = array('case_id','samples','timezone','time','nrattempts','nrcalls','outcomes','availableinmin','assignedoperator','ordr','flag'); $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"),"<i class='fa fa-check-square-o fa-lg'></i>"); $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"),"<i class='fa fa-check-square-o fa-lg'></i>");
if (isset($_GET['sample_import_id'])){ unset($datacol[1]); unset($headers[1]); } if (isset($_GET['sample_import_id'])){ unset($datacol[1]); unset($headers[1]); }
xhtml_table($db->GetAll($sql),$datacol,$headers,"tclass",false,false,"bs-table"); xhtml_table($rs2,$datacol,$headers,"tclass",false,false,"bs-table");
$sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected $sql = "SELECT operator_id as value,CONCAT(firstName,' ', lastName) as description, '' selected
FROM operator FROM operator
@@ -206,7 +211,7 @@ if (isset($_GET['unassign']))
$db->CompleteTrans(); $db->CompleteTrans();
} }
xhtml_head(T_("Case status and assignment"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") xhtml_head(T_("Case status and assignment"),true,$css,$js_head);
echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i>&emsp;" . T_("Go back") . "</a> echo "<a href='' onclick='history.back();return false;' class='btn btn-default pull-left' ><i class='fa fa-chevron-left text-primary'></i>&emsp;" . T_("Go back") . "</a>
<i class='fa fa-question-circle fa-3x text-primary pull-right btn' data-toggle='modal' data-target='.inform'></i>"; <i class='fa fa-question-circle fa-3x text-primary pull-right btn' data-toggle='modal' data-target='.inform'></i>";
?> ?>
@@ -237,7 +242,7 @@ print "<div class='form-group '><h3 class=' col-sm-2 text-right'>" . T_("Questio
display_questionnaire_chooser($questionnaire_id, false, "pull-left", "form-control"); display_questionnaire_chooser($questionnaire_id, false, "pull-left", "form-control");
if ($questionnaire_id){ if ($questionnaire_id){
print "<h3 class=' col-sm-2 text-right'>" . T_("Sample") . ":</h3>"; print "<h3 class=' col-sm-2 text-right'>" . T_("Sample") . ":</h3>";
display_sample_chooser($questionnaire_id,$sample_import_id,false, "pull-left", "form-control"); display_sample_chooser($questionnaire_id,$sample_import_id,false, "pull-left", "form-control", true);
print "</div> print "</div>
<div class='clearfix'></div>"; <div class='clearfix'></div>";

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,13 +42,15 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
*/ */
include ("../functions/functions.xhtml.php"); include ("../functions/functions.xhtml.php");
$msg = "";
/** /**
* Return if an client has already been assigned to this questionnaire * Return if an client has already been assigned to this questionnaire
* *
@@ -78,78 +80,125 @@ function vq($client_id,$questionnaire_id)
* *
* @param int $client_id Client id * @param int $client_id Client id
* @param int $questionnaire_id Questionnaire id * @param int $questionnaire_id Questionnaire id
* @param int $lime_sid Lime survey ID
* @param int $uid Lime user ID
* *
*/ */
function vqi($client_id,$questionnaire_id) function vqi($client_id,$questionnaire_id,$lime_sid,$uid)
{ {
global $db; global $db;
$db->StartTrans();
$sql = "INSERT INTO $sql = "INSERT INTO
client_questionnaire (client_id,questionnaire_id) client_questionnaire (client_id,questionnaire_id)
VALUES('$client_id','$questionnaire_id')"; VALUES('$client_id','$questionnaire_id')";
$db->Execute($sql); $db->Execute($sql);
}
/* Add client questionnaire permissions to view Lime results + statistics and quotas, //preserve superadmin permissions */
if ($uid != 1 && empty($db->GetAll("SELECT * FROM " . LIME_PREFIX . "survey_permissions WHERE `sid` = '$lime_sid' AND `uid` = '$uid'")))
/** {
* Unassign an client from a questionnaire $sql = "INSERT INTO " . LIME_PREFIX . "survey_permissions (`sid`,`uid`,`permission`,`create_p`,`read_p`,`update_p`,`delete_p`,`import_p`,`export_p`)
* VALUES ($lime_sid,$uid,'survey',0,1,0,0,0,0),($lime_sid,$uid,'statistics',0,1,0,0,0,0),($lime_sid,$uid,'quotas',0,1,0,0,0,0)";
* @param int $client_id Client id $db->Execute($sql);
* @param int $questionnaire_id Questionnaire id }
*
*/ $db->CompleteTrans();
function vqd($client_id,$questionnaire_id)
{
global $db;
$sql = "DELETE FROM
client_questionnaire
WHERE client_id = '$client_id' and questionnaire_id = '$questionnaire_id'";
$db->Execute($sql);
} }
if (isset($_POST['submit'])) if (isset($_POST['submit']))
{ {
$db->StartTrans(); $db->StartTrans();
$sql = "DELETE /* Unassign a client from a questionnaire , remove survey_permissions*/
FROM client_questionnaire $sql = "DELETE FROM client_questionnaire
WHERE questionnaire_id IN ( WHERE questionnaire_id IN ( SELECT questionnaire_id FROM questionnaire WHERE enabled = 1)";
SELECT questionnaire_id
FROM questionnaire
WHERE enabled = 1)";
$db->Execute($sql); $db->Execute($sql);
/*Currently disabled -> need to decide how to manage permissions set earlier*/
/* $questionnaires = $db->GetAll("SELECT lime_sid FROM questionnaire WHERE enabled = 1");
$clients = $db->GetAll("SELECT uid FROM client, " . LIME_PREFIX . "users WHERE `users_name` = `username`");
foreach($questionnaires as $q){
foreach($clients as $v){
$sql = "DELETE FROM " . LIME_PREFIX . "survey_permissions WHERE `uid` = {$v['uid']} AND `sid`={$q['lime_sid']} AND `uid` != 1";
$db->Execute($sql);
}
} */
/* - end - */
foreach ($_POST as $g => $v) foreach ($_POST as $g => $v)
{ {
$a = explode("_",$g); $a = explode("_",$g);
if ($a[0] == "cb") if ($a[0] == "cb")
vqi($a[2],$a[1]); vqi($a[2],$a[1],$a[3],$a[4]);
} }
$db->CompleteTrans(); $db->CompleteTrans();
} }
/* delete client from quexs and lime tables*/ //requires data-toggle-confirmation to finalize
if (isset($_POST['delete']) && isset($_POST['uid']))
{
$client_id = intval($_POST['delete']);
$uid = intval($_POST['uid']);
$uname = $_POST['uname'];
global $db;
$db->StartTrans();
if ($uid !=1){ //double protect superadmin from being deleted
$sql = "DELETE FROM " . LIME_PREFIX . "templates_rights WHERE `uid` = '$uid' AND `uid` != 1";
$db->Execute($sql);
$sql = "DELETE FROM " . LIME_PREFIX . "survey_permissions WHERE `uid` = '$uid' AND `uid` != 1";
$db->Execute($sql);
$sql = "DELETE FROM " . LIME_PREFIX . "user_in_groups WHERE `uid` = '$uid' AND `uid` != 1";
$db->Execute($sql);
$sql = "DELETE FROM " . LIME_PREFIX . "users WHERE `uid` = '$uid' AND `uid` != 1";
$db->Execute($sql);
}
$sql = "SELECT questionnaire_id,description $sql = "DELETE FROM `client_questionnaire` WHERE `client_id` = '$client_id' ";
$db->Execute($sql);
$sql = "DELETE FROM `client` WHERE `client_id` = '$client_id'";
$db->Execute($sql);
$db->CompleteTrans();
if ($db->CompleteTrans()) $msg = "<p class='alert alert-info'>". T_("Client with username $uname deleted") . "</p>";
else $msg = "<p class='alert alert-warning'>". T_("ERROR deleting client with username $uname") . "</p>";
unset($_POST['delete'], $_POST['uid'], $_POST['uname'], $client_id, $username, $uid);
}
$sql = "SELECT questionnaire_id,description, lime_sid
FROM questionnaire FROM questionnaire
WHERE enabled = 1 WHERE enabled = 1
ORDER by questionnaire_id ASC"; ORDER by questionnaire_id ASC";
$questionnaires = $db->GetAll($sql); $questionnaires = $db->GetAll($sql);
$sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username $sql = "SELECT client_id, CONCAT(firstName,' ', lastName ) as description, username, uid
FROM client FROM client, " . LIME_PREFIX . "users
WHERE `users_name` = `username`
ORDER by client_id ASC"; ORDER by client_id ASC";
$clients = $db->GetAll($sql); $clients = $db->GetAll($sql);
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")); xhtml_head(T_("Clients and questionnaires"),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/iCheck/icheck.min.js"));
if (!empty($msg)) print $msg;
?> ?>
@@ -243,7 +292,9 @@ print "<form action=\"\" method=\"post\" class=''><table class='table-bordered t
print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Client") . "&emsp;</th>"; print "<tr><th>&emsp;" . T_("Username") . "&emsp;</th><th>&emsp;" . T_("Client") . "&emsp;</th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
print "<th><a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a></th>"; print "<th><a href=\"".LIME_URL."admin/admin.php?sid={$q['lime_sid']}&amp;action=surveysecurity\" title=\"". T_("NOTICE! Please, check your user righs to edit client permissions or contact your superviser.") ."\"class=\"btn btn-default btn-sm btn-lime\" >" . T_("Questionnaire permissions") . "</a>
</br>&emsp;<a href=\"javascript:checkQid({$q['questionnaire_id']})\">{$q['description']}</a>
</th>";
} }
print "</tr></thead>"; print "</tr></thead>";
@@ -251,20 +302,24 @@ print "</tr></thead>";
foreach($clients as $v) foreach($clients as $v)
{ {
print "<tr class=''> print "<tr class=''>
<th>&emsp;{$v['username']}&emsp;</th> <th>&emsp;{$v['username']}&emsp;<div class=\"pull-right\">
<a href=\"?delete={$v['client_id']}&amp;uid={$v['uid']}&amp;uname={$v['username']}\" ><i class='fa fa-fw fa-trash-o fa-lg text-danger' data-toggle='tooltip' title=\"" . T_("Delete") . " {$v['username']} ?\"></i></a>&emsp;
<a href=\"clients.php?edit={$v['client_id']}\" ><i class='fa fa-fw fa-edit fa-lg' data-toggle='tooltip' title=\"" . T_("Edit") . " {$v['username']}\"></i></a>&ensp;</div></th>
<th>&emsp;<a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a>&emsp;</th>"; <th>&emsp;<a href=\"javascript:checkVid({$v['client_id']})\">{$v['description']}</a>&emsp;</th>";
foreach($questionnaires as $q) foreach($questionnaires as $q)
{ {
$checked = "";
if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"checked\""; if (vq($v['client_id'],$q['questionnaire_id'])) $checked="checked=\"checked\""; else $checked = "";
print "<td class='text-center'><input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" id=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" $checked></input></td>"; print "<td class='text-center'>&emsp;
<input type=\"checkbox\" name=\"cb_{$q['questionnaire_id']}_{$v['client_id']}_{$q['lime_sid']}_{$v['uid']}\" id=\"cb_{$q['questionnaire_id']}_{$v['client_id']}\" $checked/>&emsp;</td>";
} }
print "</tr>"; print "</tr>";
} }
print "</table><input type=\"submit\" class='btn btn-default fa' name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></form>"; print "</table><input type=\"submit\" class='btn btn-primary' name=\"submit\" value=\"" . T_("Assign clients to questionnaires") . "\"/></form>";
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@@ -45,7 +45,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -57,7 +57,9 @@ global $db;
$a = false; $a = false;
if (isset($_POST['client'])) $client =""; $firstname="";$lastname="";$email=""; $time_zone_name="";
if (isset($_POST['client']) && !empty($_POST['client']))
{ {
$client = $db->qstr($_POST['client'],get_magic_quotes_gpc()); $client = $db->qstr($_POST['client'],get_magic_quotes_gpc());
$firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc());
@@ -65,46 +67,104 @@ if (isset($_POST['client']))
$lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc()); $lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc());
$time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc()); $time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc());
if (!empty($_POST['client'])) /* check if there'a record with this username*/
{ $sql = "SELECT `username`,`client_id` from client WHERE `username` LIKE $client";
$sql = "INSERT INTO client $rs = $db->GetAll($sql);
(`client_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`)
VALUES (NULL , $client, $firstname , $lastname, $time_zone_name);";
if ($db->Execute($sql)) if (isset($_GET['edit']) && $_GET['edit'] >0 ) {
{
include_once("../include/limesurvey/admin/classes/core/sha256.php"); $clid = intval($_GET['edit']);
$uid = intval($_POST['uid']);
//Insert into lime_users }
$sql = "INSERT INTO " . LIME_PREFIX . "users (`users_name`,`password`,`full_name`,`parent_id`,`superadmin`,`email`,`lang`)
VALUES ($client, '" . SHA256::hashing($_POST['password']) . "',$firstname,1,0,$email,'auto')";
$db->Execute($sql);
$a = T_("Added: $client"); if (empty($rs) || count($rs)==1 && $rs[0]['client_id'] == $clid){
// update client
if (isset($_GET['edit']) && $_GET['edit'] >0 ) {
$sql = "UPDATE `client` SET `username`= $client,`firstName` = $firstname,`lastName` = $lastname,`Time_zone_name` = $time_zone_name
WHERE `client_id` = $clid ";
if ($db->Execute($sql))
{
$sql = "UPDATE " . LIME_PREFIX . "users SET `users_name` = $client, `full_name` = $firstname, `email` = $email";
/* rewrite 'password' only if not blank in edit mode */
if (isset($_GET['edit']) && $_GET['edit'] >0 && isset($_POST['password']) && !empty($_POST['password'])) {
include_once("../include/limesurvey/admin/classes/core/sha256.php");
$sql .=",`password` = '" . SHA256::hashing($_POST['password']) . "'";
}
$sql .= "WHERE `uid` = $uid";
if ($db->Execute($sql)) $a = T_("Updated") . ": " . $client; else $a = T_("Update error");
}
else
$a = T_("Could not update") . " " . $client;
} }
else else { //save as a new client
$a = T_("Could not add") . " " . $client . ". " . T_("There may already be a client of this name");
$sql = "INSERT INTO client (`client_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`)
VALUES (NULL , $client, $firstname , $lastname, $time_zone_name);";
if ($db->Execute($sql)) {
include_once("../include/limesurvey/admin/classes/core/sha256.php");
//Insert into lime_users
$sql = "INSERT INTO " . LIME_PREFIX . "users (`users_name`,`password`,`full_name`,`parent_id`,`superadmin`,`email`,`lang`)
VALUES ($client, '" . SHA256::hashing($_POST['password']) . "', $firstname ,1,0,$email,'auto')";
if ($db->Execute($sql)) $a = T_("Added") . ": " . $client; else $a = T_("Error adding client");
}
else
$a = T_("Could not add") . " " . $client;
}
}
else $a = T_("Username") . " " . $client . ". " . T_("is already in use");
}
$header = T_("Add a client");
$sbut = T_("Add new client");
$req = "required";
if (isset($_GET['edit']) && $_GET['edit'] >0 ) {
$header = T_("Edit client data");
$clid = intval($_GET['edit']);
$sql = "SELECT client.*, u.email, u.uid from client, " . LIME_PREFIX . "users as u WHERE client_id=$clid and u.users_name=username";
$cdata = $db->GetRow($sql);
if (!$cdata) {
unset($_GET['edit']);
die(T_("NO such client"));
}
else{
$uid = $cdata['uid'];
$client = $cdata['username'];
$firstname= $cdata['firstName'];
$lastname= $cdata['lastName'];
$email= $cdata['email'];
$time_zone_name = $cdata['Time_zone_name'];
$sbut = T_("Update client data");
$req = "";
} }
} }
xhtml_head($header,true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"));
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 $sql = "SELECT Time_zone_name as value, Time_zone_name as description
FROM timezone_template"; FROM timezone_template";
$tzs = $db->GetAll($sql);
$rs = $db->GetAll($sql); if ($a) { ?>
if ($a)
{
?>
<div class='alert alert-info'><?php echo $a; ?></div> <div class='alert alert-info'><?php echo $a; ?></div>
<?php <?php } ?>
}
?>
<script type="text/javascript"> <script type="text/javascript">
//Password generator //Password generator
@@ -145,38 +205,52 @@ function generate() {
<div class="well"> <div class="well">
<p><?php echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> <a href="clientquestionnaire.php"><?php echo T_("Assign client to Questionnaire"); ?></a> <?php echo T_("tool."); ?></p> <p><?php echo T_("Adding a client here will allow them to access project information in the client subdirectory.");
if (isset($_GET['edit']) && $_GET['edit'] >0 ){
echo "&emsp;" . T_("You can assign a client to a particular project with"). "&emsp;"; ?> <a href="clientquestionnaire.php" class="btn btn-default"><?php echo T_("Assign client to Questionnaire") . "</a>";
} ?>
</p>
</div>
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal" name="addclient" > <form enctype="multipart/form-data" action="" method="post" class="form-horizontal" name="addclient" >
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Enter the username of a client to add:"); ?></label> <label class="control-label col-lg-3"><?php echo T_("Username"); ?>:</label>
<input name="client" type="text" class="form-control pull-left" required size="40" /> <input name="client" type="text" class="form-control" required size="40" value="<?php echo $client;?>"/>
</div> </div>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Enter the password of a client to add:"); ?></label> <label class="control-label col-lg-3"><?php echo T_("Password"); ?>:</label>
<input name="password" type="text" class="form-control pull-left" size="40" required /> <input name="password" type="text" class="form-control pull-left" size="40" <?php echo $req;?> placeholder="<?php if (isset($_GET['edit']) && $_GET['edit'] >0 ) echo T_("Leave this blank to keep current password");?>"/>
<div class="form-inline">&emsp;&emsp; <div class="form-inline">&emsp;&emsp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?>
</div> </div>
</div> </div>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Enter the first name of a client to add:"); ?></label> <label class="control-label col-lg-3"><?php echo T_("First name"); ?> :</label>
<input name="firstname" type="text" class="form-control pull-left" size="40" /> <input name="firstname" type="text" class="form-control" size="40" value="<?php echo $firstname;?>"/>
</div> </div>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Enter the surname of a client to add:"); ?></label> <label class="control-label col-lg-3"><?php echo T_("Surname"); ?>:</label>
<input name="lastname" type="text" class="form-control pull-left" size="40"/> <input name="lastname" type="text" class="form-control" size="40"value="<?php echo $lastname;?>"/>
</div> </div>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="col-sm-3 control-label"><?php echo T_("Email") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Email"); ?>:</label>
<input name="email" type="text" class="form-control pull-left"/> <input name="email" type="text" class="form-control" size="40" value="<?php echo $email;?>"/>
</div> </div>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a></label>"; <label class="control-label col-lg-3"><a href='timezonetemplate.php'><?php echo T_("Timezone"); echo ":</a></label><div size=\"40\">";
display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"pull-left"); ?> if (isset($_GET['edit']) && $_GET['edit'] >0) $dtz = $time_zone_name; else $dtz = get_setting("DEFAULT_TIME_ZONE");
display_chooser($tzs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value", $dtz),true,"pull-left"); ?> </div>
</div>
<?php if (isset($_GET['edit']) && $_GET['edit'] >0 ) { ?>
<input name="uid" type="hidden" value="<?php echo $uid;?>"/>
<?php } ?>
<div class="form-group">
<a href="clientquestionnaire.php" style="" class="btn btn-default col-lg-1 col-lg-offset-1"><?php echo T_("Cancel"); ?></a>
<input type="submit" value="<?php echo $sbut; ?>" style="width:336px;" class="btn btn-primary col-lg-offset-1"/>
</div> </div>
<input type="submit" value="<?php echo T_("Add a client"); ?>" class="btn btn-primary col-sm-offset-3 col-sm-3"/>
</form> </form>
<?php <?php

View File

@@ -47,7 +47,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -1,4 +1,5 @@
<?php /** <?php
/**
* Display appointments * Display appointments
*/ */
@@ -15,7 +16,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -58,19 +59,27 @@ $js_foot = array(
"../js/bootstrap-confirmation.js", "../js/bootstrap-confirmation.js",
"../js/custom.js" "../js/custom.js"
); );
//create new or update appointment //create new or update appointment
if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update'])) if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update']))
{ {
$start = $db->qstr($_GET['start']); $start = $db->qstr($_GET['start']);
$end = $db->qstr($_GET['end']); $end = $db->qstr($_GET['end']);
$contact_phone_id = bigintval($_GET['contact_phone_id']); $case_id = bigintval($_GET['case_id']);
$respondent_id = bigintval($_GET['respondent_id']); $respondent_id = bigintval($_GET['respondent_id']);
$require_operator_id = "NULL"; $require_operator_id = "NULL";
if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']); if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']);
if ($_GET['new'] == 'create'){ //* add new number to db
$case_id = bigintval($_GET['case_id']); if ( isset($_GET['addphonenumber']) && !empty($_GET['addphonenumber'])){
add_contact_phone($case_id,$_GET['addphonenumber']);
$contact_phone_id = $db->Insert_ID();
}
else {
$contact_phone_id = bigintval($_GET['contact_phone_id']);
}
if (isset($_GET['new']) && $_GET['new'] == 'create'){
$operator_id = get_operator_id(); $operator_id = get_operator_id();
if ($operator_id == false) die(); if ($operator_id == false) die();
$sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '$respondent_id'"; $sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '$respondent_id'";
@@ -104,14 +113,15 @@ if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update']))
$db->Execute($sql); $db->Execute($sql);
} }
unset ($_GET['start'],$_GET['end'],$_GET['appointment_id'],$_GET['case_id'],$_GET['new'],$_GET['update']); unset ($_GET['start'],$_GET['end'],$_GET['new'],$_GET['update'],$_GET['appointment_id'],$_GET['case_id'],$_GET['addphonenumber']); //
} }
if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET['new']) && isset($_GET['case_id']))) if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET['new']) && isset($_GET['case_id'])))
{ {
$appointment_id = bigintval($_GET['appointment_id']); if (isset($_GET['appointment_id'])) $appointment_id = bigintval($_GET['appointment_id']); else $appointment_id = "";
$case_id = bigintval($_GET['case_id']); if (isset($_GET['case_id'])) $case_id = bigintval($_GET['case_id']);
$require_operator_id = "NULL";
if (isset($_GET['delete'])) if (isset($_GET['delete']))
{ {
@@ -121,27 +131,61 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
xhtml_head(T_("Now modify case outcome"),true,$css,$js_head); xhtml_head(T_("Now modify case outcome"),true,$css,$js_head);
print "<div class='col-sm-6'><p class='well'>" . T_("The appointment has been deleted. Now you must modify the case outcome") . "</p> print "<div class='col-lg-6'><p class='well'>" . T_("The appointment has been deleted. Now you must modify the case outcome") . "</p>
<a href='supervisor.php?case_id=$case_id' class='btn btn-default'>" . T_("Modify case outcome") . "</a></div>"; <a href='supervisor.php?case_id=$case_id' class='btn btn-default'>" . T_("Modify case outcome") . "</a></div>";
} }
else else
{ {
//Display an edit form $lang = DEFAULT_LOCALE ;
$sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate,
CONVERT_TZ(DATE_ADD(NOW(), INTERVAL 10 YEAR),'SYSTEM',r.Time_zone_name) as enddate,
r.respondent_id, ca.contact_phone_id
FROM `case` as c, `respondent` as r, `call` as ca
WHERE c.case_id = '$case_id'
AND r.case_id = c.case_id
AND c.last_call_id = ca.call_id";
$rs = $db->GetRow($sql);
if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID&ensp;" . $appointment_id;} $startdate = $rs['startdate'];
$enddate = $rs['enddate'];
$respondent_id = $rs['respondent_id'];
if (!isset($contact_phone_id)) $contact_phone_id = $rs['contact_phone_id'];
if (isset($_GET['new']) && $_GET['new'] == 'new'){
$title = T_("Create NEW appointment");
$subtitle ="";
$start = $startdate;
$end = $enddate;
$rtz = $_GET['rtz'];
}
if (isset($_GET['appointment_id'])) {
$title = T_("Edit appointment");
$subtitle = "ID&ensp;" . $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);
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'];
}
else die(T_("ERROR in DB records, Check tables 'appointment' and 'respondent' and Time zone settings"));
}
//Display an edit form
xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle); 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(DATE_ADD(NOW(), INTERVAL 10 YEAR),'SYSTEM',r.Time_zone_name) as enddate
FROM `case` as c, `respondent` as r
WHERE c.case_id = '$case_id' AND r.case_id = c.case_id";
$rs = $db->GetRow($sql);
$startdate = $rs['startdate'];
$enddate = $rs['enddate'];
print "<script type='text/javascript'> print "<script type='text/javascript'>
$(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end'); $(document).ready(function() { var startDateTextBox = $('#start'); var endDateTextBox = $('#end');
$.timepicker.datetimeRange( $.timepicker.datetimeRange(
@@ -157,60 +201,55 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
stepMinute: 5, stepMinute: 5,
hourGrid: 2, hourGrid: 2,
minuteGrid: 10, minuteGrid: 10,
minDate: '$startdate', minDate: '$startdate',
maxDate: '$enddate' maxDate: '$enddate'
});});</script>"; });});</script>";
if ($_GET['new'] =='new'){ print "<form action='?' method='get' class='form-horizontal form-group'>";
$start = $startdate; print "<label class='pull-left text-right control-label col-lg-2' for='respondent_id'>" . T_("Respondent") . "</label>";
$end = $enddate;
$rtz = $_GET['rtz']; 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
if (isset($_GET['appointment_id'])) { FROM respondent
WHERE case_id = '$case_id'"),"respondent_id","respondent_id",false,false,false,true,false,true,"pull-left");
$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 print "<br/><br/><label for='contact_phone_id' class='pull-left text-right control-label col-lg-2'>" . T_("Contact phone") . "</label>";
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);
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 "<form action='?' method='get' class='form-horizontal'>";
print "<label class='pull-left text-right control-label col-sm-2' for='respondent_id'>" . T_("Respondent") . "</label>";
display_chooser($db->GetAll("SELECT respondent_id as value, CONCAT(firstName,' ',lastName) as description, $sql = "SELECT contact_phone_id as value, phone as description,
CASE when respondent_id = '$respondent_id' THEN 'selected=\'selected\'' ELSE '' END as selected CASE when contact_phone_id = '$contact_phone_id' THEN 'selected=\'selected\'' ELSE '' END as selected
FROM respondent FROM contact_phone
WHERE case_id = '$case_id'"),"respondent_id","respondent_id",false,false,false,true,false,true,"pull-left"); WHERE case_id = '$case_id'";
$rs = $db->GetAll($sql);
//* added option to add new number
print "<div class=\"pull-left\"><select class=\"form-control\" id='contact_phone_id' name='contact_phone_id'
onchange=\"if($(this).val()=='add'){ $('#addPhone').show(); } else{ $('#addPhone').hide(); } \">";
foreach($rs as $l)
{
print "<option value='{$l['value']}' {$l['selected']} >{$l['description']}</option>";
}
print "<option value='add'>" . T_("Add new phone number") . "</option></select></div>";
print "<br/><br/><label for='contact_phone_id' class='pull-left text-right control-label col-sm-2'>" . T_("Contact phone") . "</label>"; print "<div class='col-lg-4' id='addPhone' style='display:none'>
display_chooser($db->GetAll("SELECT contact_phone_id as value, phone as description, <div class='col-lg-6' id=''>
CASE when contact_phone_id = '$contact_phone_id' THEN 'selected=\'selected\'' ELSE '' END as selected <input type=\"tel\" maxlength=\"10\" pattern=\"[0-9]{10}\" class='form-control col-lg-2 ' name='addphonenumber' />
FROM contact_phone </div>
WHERE case_id = '$case_id'"), </div>";
"contact_phone_id","contact_phone_id",false,false,false,true,false,true,"pull-left"); //*end option
print "<div class='clearfix'></div></br><div class='alert alert-info col-sm-6 '>". T_("ATTENTION! Keep in mind that you're setting 'Start' & 'End' appoinment times in RESPONDENT LOCAL TIME !!!") . "</div><div class='clearfix'></div>"; print "<div class='clearfix'></div></br><div class='alert alert-info col-lg-6 '>". T_("ATTENTION! Keep in mind that you're setting 'Start' & 'End' appoinment times in RESPONDENT LOCAL TIME !!!") . "</div><div class='clearfix'></div>";
date_default_timezone_set($rtz); date_default_timezone_set($rtz);
print "<label class='text-right col-sm-2 control-label'>" . T_("Respondent TimeZone") . ":</label>
<h4 class='col-sm-2 text-danger text-uppercase fa-lg'>" . $rtz . "</h4> print "<label class='text-right col-lg-2 control-label'>" . T_("Respondent TimeZone") . ":</label>
<h4 class='col-lg-2 text-danger text-uppercase fa-lg'>" . $rtz . "</h4>
<label class=''>" . T_("Respondent Time") . ":&emsp;<b class='fa fa-2x '>" . date("H:i:s") . "</b></label>"; <label class=''>" . T_("Respondent Time") . ":&emsp;<b class='fa fa-2x '>" . date("H:i:s") . "</b></label>";
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='start'>" . T_("Start time") . "</label> print "<br/><br/><label class='pull-left text-right control-label col-lg-2' for='start'>" . T_("Start time") . "</label>
<div class='pull-left'><input class='form-control' type='text' value='$start' id='start' name='start'/></div>"; <div class='pull-left'><input class='form-control' type='text' value='$start' id='start' name='start'/></div>";
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='end'>" . T_("End time") . "</label> print "<br/><br/><label class='pull-left text-right control-label col-lg-2' for='end'>" . T_("End time") . "</label>
<div class='pull-left'><input class='form-control' type='text' value='$end' id='end' name='end'/></div>"; <div class='pull-left'><input class='form-control' type='text' value='$end' id='end' name='end'/></div>";
print "<br/><br/><label class='pull-left text-right control-label col-sm-2' for='require_operator_id'>" . T_("Appointment with") . "</label>"; print "<br/><br/><label class='pull-left text-right control-label col-lg-2' for='require_operator_id'>" . T_("Appointment with") . "</label>";
$ops = $db->GetAll("SELECT o.operator_id as value, $ops = $db->GetAll("SELECT o.operator_id as value,
CONCAT(o.firstName, ' ', o.lastName) as description, CONCAT(o.firstName, ' ', o.lastName) as description,
CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected
@@ -225,17 +264,25 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
} }
} }
array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected)); array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected));
display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,true,false,true,"pull-left");
print "<input type='hidden' value='$appointment_id' id='appointment_id' name='appointment_id'/><input type='hidden' value='update' id='update' name='update'/>";
if ($_GET['new'] == 'new') { print "<input type='hidden' value='create' id='new' name='new'/><input type='hidden' value='$case_id' id='case_id' name='case_id'/>";} display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,true,false,true,"pull-left");
print " <input type='hidden' value='$appointment_id' id='appointment_id' name='appointment_id'/>
<input type='hidden' value='update' id='update' name='update'/>
<input type='hidden' value='$case_id' id='case_id' name='case_id'/>";
if (isset($_GET['new']) && $_GET['new'] == 'new') {
print "<input type='hidden' value='create' id='new' name='new'/>";
}
print "<div class='clearfix'></div><br/><br/> print "<div class='clearfix'></div><br/><br/>
<div class='col-sm-2'><a href='' onclick='history.back();return false;' class='btn btn-default pull-left'><i class='fa fa-ban fa-lg'></i>&emsp;" . T_("Cancel edit") . "</a></div>"; <div class='col-lg-2'><a href='?' class='btn btn-default pull-left'><i class='fa fa-ban fa-lg'></i>&emsp;" . T_("Cancel edit") . "</a></div>";
print "<div class='col-sm-2'><button type='submit' class='btn btn-primary btn-block'><i class='fa fa-floppy-o fa-lg'></i>&emsp;" . T_("Save changes") . "</button></div>"; print "<div class='col-lg-2'>
<button type='submit' class='btn btn-primary btn-block'><i class='fa fa-floppy-o fa-lg'></i>&emsp;" . T_("Save changes") . "</button>
</div>";
print "<div class='col-sm-2'><a href='' class='btn btn-default pull-right' toggle='confirmation' data-placement='left' data-href='?delete=delete&amp;appointment_id=$appointment_id&amp;case_id=$case_id' ><i class='fa fa-trash fa-lg text-danger'></i>&emsp;" . T_("Delete this appointment") . "</a></div>"; print "<div class='col-lg-2'><a href='' class='btn btn-default pull-right' toggle='confirmation' data-placement='left' data-href='?delete=delete&amp;appointment_id=$appointment_id&amp;case_id=$case_id' ><i class='fa fa-trash fa-lg text-danger'></i>&emsp;" . T_("Delete this appointment") . "</a></div>";
print "</form>"; print "</form>";
} }
@@ -243,45 +290,53 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
else { else {
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$subtitle = T_("Appointments"); $subtitle = T_("Appointments");
xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30); //array("../css/table.css") xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30);
print "<h3>" . T_("All appointments (with times displayed in your time zone)") . "</h3>"; print "<h3>" . T_("All appointments (with times displayed in your time zone)") . "</h3>";
$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, $sql = "SELECT q.description, si.description as smpl, 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('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id, CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link, CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link,
CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho
FROM appointment as a 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) JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc, `sample` as s, sample_import as si) on (c.sample_id = s.sample_id and 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 and si.sample_import_id = s.import_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 (`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 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 LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
WHERE q.enabled=1 AND si.enabled=1 AND a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1)
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
ORDER BY a.start ASC"; ORDER BY a.start ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!empty($rs)) { if (!empty($rs)) {
translate_array($rs,array("outcome")); translate_array($rs,array("outcome"));
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"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table"); xhtml_table($rs,array("description","smpl","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Sample"),T_("Case ID"),T_("Start"),T_("End"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table");
} else print "<h4 class='well text-info'>" . T_("No future appointments") . "</h4>"; } else print "<h4 class='well text-info'>" . T_("No future appointments") . "</h4>";
print "<h3 style='color:red'>" . T_("Missed appointments (with times displayed in your time zone)") . "</h3>"; print "<h3 style='color:red'>" . T_("Missed appointments (with times displayed in your time zone)") . "</h3>";
$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, $sql = "SELECT q.description, si.description as smpl, 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('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id, CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link, CONCAT('&emsp;<a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '&amp;delete=delete\' ></i></a>&emsp;') as link,
CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit CONCAT('&emsp;<a href=\'?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a>&emsp;') as edit
FROM appointment as a 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) 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) 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 LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_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
AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
GROUP BY c.case_id GROUP BY c.case_id
ORDER BY a.start ASC"; ORDER BY a.start ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (!empty($rs)) { 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"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Respondent"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table"); xhtml_table($rs,array("description","smpl","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Sample"),T_("Case ID"),T_("Start"),T_("End"),"&emsp;<i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i>&emsp;",T_("Respondent"),"&emsp;<i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i>&emsp;"),"tclass",false,false,"bs-table");
} else print "<h4 class='well text-info'>" . T_("No appointments missed") . "</h4>"; } else print "<h4 class='well text-info'>" . T_("No missed appointments") . "</h4>";
} }
xhtml_foot($js_foot); xhtml_foot($js_foot);

View File

@@ -41,7 +41,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -185,41 +185,43 @@ if (isset($_GET['edit']) || isset($_GET['addext']))
WHERE extension_id = " . intval($_GET['edit']); WHERE extension_id = " . intval($_GET['edit']);
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
} else $rs = array(); }
print "<a href='?' class='btn btn-default pull-left'>" . T_("Go back") . "</a>";
?> ?>
<div class="panel-body "> <div class="panel-body ">
<h3 class="col-sm-offset-3"><?php if (isset($_GET['edit']))echo T_("Edit extension"); else echo T_("Add an extension");?></h3> <h3 class="col-lg-offset-3"><?php if (isset($_GET['edit']))echo T_("Edit extension"); else echo T_("Add an extension");?></h3>
<form enctype="multipart/form-data" action="?" method="post" name="editext" class="form-horizontal"> <form enctype="multipart/form-data" action="?" method="post" name="editext" class="form-horizontal">
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Extension name: ");?></label> <label class="control-label col-lg-3"><?php echo T_("Extension name: ");?></label>
<input name="extension" type="text" placeholder="<?php echo T_("such as SIP/1000");?>" maxlength="12" required value="<?php echo $rs['extension'];?>" class="form-control"/> <input name="extension" type="text" placeholder="<?php echo T_("such as SIP/1000");?>" maxlength="12" required value="<?php if (isset($_GET['edit']))echo $rs['extension'];?>" class="form-control"/>
</div> </div>
<div class="form-group form-inline"> <div class="form-group form-inline">
<label class="control-label col-sm-3"><?php echo T_("Extension password: ");?></label> <label class="control-label col-lg-3"><?php echo T_("Extension password: ");?></label>
<input name="password" type="text" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" style="width:20em;" maxlength="50" value="<?php echo $rs['password'];?>" class="form-control pull-left" placeholder="<?php echo T_("Enter New Password");?>"/>&emsp;&emsp;<?php echo T_(" or ");?>&ensp; <input name="password" type="text" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" style="width:20em;" maxlength="50" value="<?php if (isset($_GET['edit'])) echo $rs['password'];?>" class="form-control pull-left" placeholder="<?php echo T_("Enter New Password");?>"/>&emsp;&emsp;<?php echo T_(" or ");?>&ensp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("New password");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("New password");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters long");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters long");?>
</div> </div>
<div class=" col-sm-offset-3 "> <div class="form-group form-inline">
<input type="submit" class="btn btn-primary " value="<?php if (isset($_GET['edit'])) echo T_("Save changes"); else echo T_("Add extension"); ?>" /> <div class='col-lg-3'>
</div> <a href='?' class='btn btn-default'><?php echo T_("Cancel") ;?></a>
</div>
<input type="submit" class="btn btn-primary pull-left" value="<?php if (isset($_GET['edit'])) echo T_("Save changes"); else echo T_("Add extension"); ?>" />
<?php if (isset($_GET['edit'])){?> <?php if (isset($_GET['edit'])){?>
<input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/> <input name="extensionid" type="hidden" value="<?php echo intval($_GET['edit']);?>"/>
<?php if (empty($rs['current_operator_id'])) { ?> <?php if (empty($rs['current_operator_id'])) { ?>
<input type="submit" name="delete" class="btn btn-danger " data-toggle="confirmation" value="<?php echo T_("Delete extension"); ?>" /> <input type="submit" name="delete" class="btn btn-danger col-lg-offset-2 pull-left" data-toggle="confirmation" value="<?php echo T_("Delete extension"); ?>" />
<?php } else <?php } else
print "</br></br><b class='well text-danger'>" . T_("Unassign the operator from this extension to be able to delete it") . "</b>"; print "</br></br><b class='well text-danger'>" . T_("Unassign the operator from this extension to be able to delete it") . "</b>";
} }
print "</form></div>"; print "</div></form></div>";
} }
else else
{ {
@@ -241,8 +243,10 @@ else
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
print "<div class='panel-body'>";
if ($msg != "") if ($msg != "")
print "<p>$msg</p>"; print "<p class='alert alert-warning'>$msg</p></br>";
if (!empty($rs)) if (!empty($rs))
{ {
@@ -258,14 +262,15 @@ else
if ($rs[$i]['assignment'] == "list") 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); $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 "<div class='panel-body'>";
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")); 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 "</div>"; print "</br>";
} }
else else
print "<p>" . T_("No extensions") . "</p>"; print "<p class='alert alert-warning'>" . T_("No extensions") . "</p>";
print "<div class='col-sm-3'><a href='?addext=addext' class='btn btn-default '>" . T_("Add extension") . "</a></div>"; print "<a href='?addext=addext' class='btn btn-primary '>" . T_("Add extension") . "</a>
</div>";
} }

View File

@@ -11,7 +11,7 @@ include ("../config.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -41,7 +41,7 @@ include ("../config.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/* /*
* XHTML file * XHTML file
@@ -84,12 +84,22 @@ include ("../functions/functions.operator.php");
</div > </div >
<ul class="nav navbar-nav pull-right"> <ul class="nav navbar-nav pull-right">
<li class="dropdown pull-right user-data"> <li class=" ">
<a href="../index.php" class=" " target="_blanc" style="padding-top: 20px; ">
<i class="fa fa-sign-in fa-lg fa-fw "></i><?php print T_("Operator panel");?>
</a>
</li>
<li class=" ">
<a href="../client/index.php" class=" " target="_blanc" style="padding-top: 20px; ">
<i class="fa fa-user-secret fa-lg fa-fw "></i><?php print T_("Client panel");?>
</a>
</li>
<li class="dropdown pull-right user-data">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style=" min-width: 160px;"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" style=" min-width: 160px;">
<i class="fa fa-user fa fa-fw "></i><?php print T_("Logged as:") . "&ensp;" . $username ;?> <i class="fa fa-user fa-fw "></i><?php print T_("Logged as:") . "&ensp;" . $username ;?>
</a> </a>
<!--- User menu // not connected to pages so not working yet // could be hidden --> <!--- User menu // not connected to pages so not working yet // could be hidden -->
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li><a href="?g=5&amp;page=operatorlist.php?edit=<?php print get_operator_id(); ?>"><i class="fa fa-cogs fa-fw "></i>&ensp;<?php print T_("Settings"); ?></a></li> <li><a href="?g=5&amp;page=operatorlist.php?edit=<?php print get_operator_id(); ?>"><i class="fa fa-cogs fa-fw "></i>&ensp;<?php print T_("Settings"); ?></a></li>
<!--- <li><a href="../screenloc.php"><i class="fa fa-lock fa-fw "></i>&ensp;<?php print T_("Lock Screen"); ?></a></li> --> <!--- <li><a href="../screenloc.php"><i class="fa fa-lock fa-fw "></i>&ensp;<?php print T_("Lock Screen"); ?></a></li> -->
<li><a href="../include/limesurvey/admin/admin.php?action=logout"><i class="fa fa-sign-out fa-fw "></i>&ensp;<?php print T_("Logout"); ?> </a></li> <li><a href="../include/limesurvey/admin/admin.php?action=logout"><i class="fa fa-sign-out fa-fw "></i>&ensp;<?php print T_("Logout"); ?> </a></li>
@@ -164,7 +174,7 @@ include ("../functions/functions.operator.php");
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-user-secret fa-fw"></i><span><?php print T_("Clients") ;?></span></a> <li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-user-secret fa-fw"></i><span><?php print T_("Clients") ;?></span></a>
<ul style="<?php if ($g == 7) echo "display:block";?>"> <ul style="<?php if ($g == 7) echo "display:block";?>">
<li><a href="?g=7&amp;page=clients.php"><i class="fa fa-lg fa-user-plus fa-fw"></i><?php print T_("Add clients to the system") ;?></a></li> <li><a href="?g=7&amp;page=clients.php"><i class="fa fa-lg fa-user-plus fa-fw"></i><?php print T_("Add clients to the system") ;?></a></li>
<li><a href="?g=7&amp;page=clientquestionnaire.php"><i class="fa fa-link fa-fw"></i><?php print T_("Assign clients to questionnaires") ;?></a></li> <li><a href="?g=7&amp;page=clientquestionnaire.php"><i class="fa fa-link fa-fw"></i><?php print T_("Manage clients") ;?></a></li>
</ul> </ul>
</li> </li>
<li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-briefcase"></i><span><?php print T_("Supervisor functions") ;?></span></a> <li class="has_sub"><a href="" class=""><i class="fa fa-lg fa-briefcase"></i><span><?php print T_("Supervisor functions") ;?></span></a>

View File

@@ -14,7 +14,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -84,7 +84,7 @@ if (isset($_POST['import_file']))
//** get default coma-separated outcomes list and use it for new questionnaire as initial set //** get default coma-separated outcomes list and use it for new questionnaire as initial set
$sql = "SELECT o.outcome_id $sql = "SELECT o.outcome_id
FROM `outcome` as o FROM `outcome` as o
WHERE o.deflt = 1;"; WHERE o.default = 1;";
$def = $db->GetAll($sql); $def = $db->GetAll($sql);
for ($i=0; $i < count($def); $i++){ for ($i=0; $i < count($def); $i++){

View File

@@ -42,7 +42,7 @@ include_once(dirname(__FILE__).'/../db.inc.php');
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -195,7 +195,7 @@ function generate() {
} }
</script> </script>
<div class="form-group clearfix"><div class="col-sm-3"><a href='?' class="btn btn-default"><?php echo T_("Go back") ;?></a></div><div class="col-sm-6"> <div class="form-group clearfix"><div class="col-lg-3"><a href='?' class="btn btn-default"><?php echo T_("Go back") ;?></a></div><div class="col-lg-6">
<?php <?php
print "<h3>" . T_("Operator") . ": " . $rs['username'] . "</h3>"; print "<h3>" . T_("Operator") . ": " . $rs['username'] . "</h3>";
echo "</div></div>"; echo "</div></div>";
@@ -213,78 +213,92 @@ function generate() {
?> ?>
<form action="?" method="post" class="form-horizontal panel-body" name="operform"> <form action="?" method="post" class="form-horizontal panel-body" name="operform">
<div class="form-group"> <div class="form-group">
<label for="username" class="col-sm-3 control-label"><?php echo T_("Username") . ": "; ?></label> <label for="username" class="col-lg-3 control-label"><?php echo T_("Username") . ": "; ?></label>
<div class="col-sm-3"><input type='text' name='username' class="form-control" value="<?php echo $rs['username'];?>"/></div> <div class="col-lg-3"><input type='text' name='username' class="form-control" value="<?php echo $rs['username'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password" class="col-sm-3 control-label"><?php echo T_("Password") . ": "; ?></label> <label for="password" class="col-lg-3 control-label"><?php echo T_("Password") . ": "; ?></label>
<div class="col-sm-3"><input type='text' name='password' class="form-control" placeholder="<?php echo T_("leave blank to keep existing password");?>"/></div> <div class="col-lg-3"><input type='text' name='password' class="form-control" placeholder="<?php echo T_("leave blank to keep existing password");?>"/></div>
<div class="col-sm-6 form-inline">&emsp; <div class="col-lg-6 form-inline">&emsp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default"/>&emsp;<?php echo T_("Password with");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default"/>&emsp;<?php echo T_("Password with");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="firstName" class="col-sm-3 control-label"><?php echo T_("First name") . ": "; ?></label> <label for="firstName" class="col-lg-3 control-label"><?php echo T_("First name") . ": "; ?></label>
<div class="col-sm-3"><input type='text' name='firstName' class="form-control" value="<?php echo $rs['firstName'];?>"/></div> <div class="col-lg-3"><input type='text' name='firstName' class="form-control" value="<?php echo $rs['firstName'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="lastName" class="col-sm-3 control-label"><?php echo T_("Last name") . ": "; ?></label> <label for="lastName" class="col-lg-3 control-label"><?php echo T_("Last name") . ": "; ?></label>
<div class="col-sm-3"><input type='text' name='lastName' class="form-control" value="<?php echo $rs['lastName'];?>"/></div> <div class="col-lg-3"><input type='text' name='lastName' class="form-control" value="<?php echo $rs['lastName'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email" class="col-sm-3 control-label"><?php echo T_("Email") . ": "; ?></label> <label for="email" class="col-lg-3 control-label"><?php echo T_("Email") . ": "; ?></label>
<div class="col-sm-3"><input type='text' name='email' class="form-control" value="<?php echo $rs['email'];?>"/></div> <div class="col-lg-3"><input type='text' name='email' class="form-control" value="<?php echo $rs['email'];?>"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="timezone" class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label> <label for="timezone" class="col-lg-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
<div class="col-sm-3"><?php display_chooser($tz,"timezone","timezone",false,false,false,true,array("value",$rs['Time_zone_name']),true,"form-inline"); ?></div> <div class="col-lg-3"><?php display_chooser($tz,"timezone","timezone",false,false,false,true,array("value",$rs['Time_zone_name']),true,"form-inline"); ?></div>
<div class="col-sm-6 form-inline"> <div class="col-lg-6 form-inline">
<?php echo T_("Edit") . "&emsp;";?> <?php echo T_("Edit") . "&emsp;";?>
<a href='timezonetemplate.php' class="btn btn-default"><?php echo T_("TimeZones list");?></a> <a href='timezonetemplate.php' class="btn btn-default"><?php echo T_("TimeZones list");?></a>
</div> </div>
</div> </div>
<div class="form-group">
<label for="extension_id" class="col-sm-3 control-label"><?php echo T_("Extension") . ": "; ?></label> <?php if (FREEPBX_PATH != false) { ?>
<div class="col-sm-3"><?php echo display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline"); ?> </div> <div class="form-group">
<div class="col-sm-6 form-inline"> <label for="voip" class="col-lg-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label>
<?php echo T_("Edit") . "&emsp;";?> <div class="col-lg-3"><input name="voip" type="checkbox" onchange="if(this.checked==true){show(this,'usesvoip');} else{ hide(this,'usesvoip');}" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['voip'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
<a href='extensionstatus.php' class="btn btn-default"><?php echo T_("Extensions");?></a> </div>
<div id="usesvoip" style="display:none" >
<div class="form-group">
<label class="col-lg-3 control-label"><?php echo T_("Extension") . ": ";?></label>
<?php if (!empty($ers) ){ ?>
<div class="col-lg-3"><?php display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline");?></div>
<div class="col-lg-6 form-inline"> <?php echo T_("Edit") . "&emsp;"; }
else{ ?> <div class="col-lg-6 form-inline"> <?php echo T_("Add") . "&emsp;"; }?>
<a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a>
</div>
</div> </div>
</div> </div>
<?php } ?>
<div class="form-group"> <div class="form-group">
<label for="voip" class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
<div class="col-sm-3"><input type="checkbox" name="voip" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['voip'] == 1) echo "checked=\"checked\"";?> value="1" /></div> <div class="col-lg-3"><input name="chat_enable" type="checkbox" onchange="if(this.checked==true){show(this,'jabdata');} else{ hide(this,'jabdata');}" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['chat_enable'] == 1) echo "checked=\"checked\"";?> value="1"/></div>
</div> </div>
<div class="form-group">
<label for="chat_user" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": "; ?></label> <div id="jabdata" style="display:none" >
<div class="col-sm-3"><input type='text' name='chat_user' class="form-control" value="<?php echo $rs['chat_user'];?>"/></div> <div class="form-group">
<label class="col-lg-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": ";?></label>
<div class="col-lg-3"><input name="chat_user" type="text" class="form-control" value="<?php echo $rs['chat_user'];?>"/></div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": ";?></label>
<div class="col-lg-3"><input name="chat_password" type="text" class="form-control" value="<?php echo $rs['chat_password'];?>"/></div>
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="chat_password" class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": "; ?></label> <label for="admin" class="col-lg-3 control-label"><?php echo T_("Is the operator a system administrator?");?></label>
<div class="col-sm-3"><input type='text' name='chat_password' class="form-control" value="<?php echo $rs['chat_password'];?>"/></div> <div class="col-lg-3"><input name="admin" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-offstyle="primary" data-onstyle="danger" <?php if ($rs['superadmin'] || ($rs['parent_id'] == 0)) echo " checked=\"checked\" "; if ($rs['parent_id'] == 0) echo " disabled=\"disabled\" "; ?> value="1"/></div>
</div>
<div class="form-group">
<label for="admin" class="col-sm-3 control-label"><?php echo T_("Is the operator a system administrator?");?></label>
<div class="col-sm-3"><input name="admin" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-offstyle="primary" data-onstyle="danger" <?php if ($rs['superadmin'] || ($rs['parent_id'] == 0)) echo " checked=\"checked\" "; if ($rs['parent_id'] == 0) echo " disabled=\"disabled\" "; ?> value="1"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="chat_enable" class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label> <label for="enabled" class="col-lg-3 control-label"><?php echo T_("Enabled") . "? ";?></label>
<div class="col-sm-3"><input type="checkbox" name="chat_enable" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['chat_enable'] == 1) echo "checked=\"checked\"";?> value="1"/></div> <div class="col-lg-3"><input type="checkbox" name="enabled" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['enabled'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
</div>
<div class="form-group">
<label for="enabled" class="col-sm-3 control-label"><?php echo T_("Enabled") . "? ";?></label>
<div class="col-sm-3"><input type="checkbox" name="enabled" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" <?php if ($rs['enabled'] == 1) echo "checked=\"checked\"";?> value="1" /></div>
</div> </div>
<div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></div> <div><input type='hidden' name='operator_id' value='<?php echo $operator_id;?>'/></div>
<div><input type='hidden' name='existing_username' value="<?php echo $rs['username'];?>"/></div> <div><input type='hidden' name='existing_username' value="<?php echo $rs['username'];?>"/></div>
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="submit" class="btn btn-primary btn-block" value="<?php echo T_("Update operator");?>"/></div></div> <div class="form-group"><div class="col-lg-3 col-lg-offset-3"><input type="submit" name="submit" class="btn btn-primary btn-block" value="<?php echo T_("Update operator");?>"/></div></div>
</form> </form>
<?php <?php
xhtml_foot(); xhtml_foot(array("../js/new.js"));
exit(); exit();
} }
@@ -402,11 +416,11 @@ if ($display)
$titles[] = T_("Win file");//Windows VoIP $titles[] = T_("Win file");//Windows VoIP
$titles[] = T_("*nix flle");//*nix VoIP $titles[] = T_("*nix flle");//*nix VoIP
} }
echo "<div class='col-sm-9'><div class='panel-body'>"; echo "<div class='col-lg-9'><div class='panel-body'>";
xhtml_table($rs,$columns,$titles); xhtml_table($rs,$columns,$titles);
echo "</div></div>"; echo "</div></div>";
echo "<div class='form-group col-sm-3'> echo "<div class='form-group col-lg-3'>
<div class='panel-body'><a href='operators.php?add=add' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-plus'></i>&emsp;" . T_("Add an operator") . "</a></div> <div class='panel-body'><a href='operators.php?add=add' class='btn btn-default btn-block'><i class='fa fa-lg fa-user-plus'></i>&emsp;" . T_("Add an operator") . "</a></div>
<div class='panel-body'><a href='extensionstatus.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-whatsapp'></i>&emsp;" . T_("Extensions") . "</a></div> <div class='panel-body'><a href='extensionstatus.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-whatsapp'></i>&emsp;" . T_("Extensions") . "</a></div>
<div class='panel-body'><a href='operatorquestionnaire.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-link'></i> " . T_("Assign to questionnaire") . "</a></div> <div class='panel-body'><a href='operatorquestionnaire.php' class='btn btn-default btn-block'><i class='fa fa-lg fa-link'></i> " . T_("Assign to questionnaire") . "</a></div>

View File

@@ -41,7 +41,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -96,15 +96,11 @@ if (isset($_POST['operator']) && isset($_POST['adduser']))
$extensionp = "'$extensionnp'"; $extensionp = "'$extensionnp'";
} }
$supervisor = 0;
$temporary = 0;
$admin = 0; $admin = 0;
$refusal = 0;
$voip = 0; $voip = 0;
$chat = 0; $chat = 0;
if (isset($_POST['supervisor']) && $_POST['supervisor'] == "on") $supervisor = 1;
if (isset($_POST['refusal']) && $_POST['refusal'] == "on") $refusal = 1;
if (isset($_POST['temporary']) && $_POST['temporary'] == "on") $temporary = 1;
if (isset($_POST['admin']) && $_POST['admin'] == "on") $admin = 1; if (isset($_POST['admin']) && $_POST['admin'] == "on") $admin = 1;
if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1; if (isset($_POST['voip']) && $_POST['voip'] == "on") $voip = 1;
if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1; if (isset($_POST['chat_enable']) && $_POST['chat_enable'] == "on") $chat = 1;
@@ -149,26 +145,18 @@ if (isset($_POST['operator']) && isset($_POST['adduser']))
$a = "<div class='alert alert-info'><h3>" . T_("Added operator :") . " " . $operator . "</h3>"; $a = "<div class='alert alert-info'><h3>" . T_("Added operator :") . " " . $operator . "</h3>";
if (FREEPBX_PATH !== false) if (FREEPBX_PATH !== false)
$a .= "<br/><a href='/voip/admin/'>" . T_("FreePBX needs to be reloaded for the new VoIP extension to take effect") . "</a>"; $a .= "<br/><a href='/voip/admin/'>" . T_("FreePBX needs to be reloaded for the new VoIP extension to take effect") . "</a>";
print "</div>"; $a .= "</div>";
// set default skills = 1 and 5 for all new operators
if ($temporary)
{
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id) $db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','1')"); VALUES ('$oid','1')");
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id) $db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','5')"); //and appointment VALUES ('$oid','5')"); //and appointment
}
if ($supervisor)
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','2')");
if ($refusal)
$db->Execute(" INSERT INTO operator_skill (operator_id,outcome_type_id)
VALUES ('$oid','3')");
} }
else else
{ {
@@ -242,84 +230,87 @@ function generate() {
<form enctype="multipart/form-data" action="" method="post" class="form-horizontal panel-body" name="operform"> <form enctype="multipart/form-data" action="" method="post" class="form-horizontal panel-body" name="operform">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Username") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Username") . ": ";?></label>
<div class="col-sm-3"><input name="operator" type="text" class="form-control" required /></div> <div class="col-lg-3"><input name="operator" type="text" class="form-control" required /></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Password") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Password") . ": ";?></label>
<div class="col-sm-3"><input name="password" id="password" type="text" class="form-control" required /></div> <div class="col-lg-3"><input name="password" id="password" type="text" class="form-control" required /></div>
<div class="col-sm-6 form-inline">&emsp; <div class="col-lg-6 form-inline">&emsp;
<input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp; <input type="button" onclick="generate();" value="<?php echo T_("Generate");?>" class="btn btn-default fa" />&emsp;<?php echo T_("Password with");?>&ensp;
<input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?> <input type="number" name="number" value="25" min="8" max="50" style="width:5em;" class="form-control" />&ensp;<?php echo T_("characters");?>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("First name") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("First name") . ": ";?></label>
<div class="col-sm-3"><input name="firstname" type="text" class="form-control" required/></div> <div class="col-lg-3"><input name="firstname" type="text" class="form-control" required/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Last name") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Last name") . ": ";?></label>
<div class="col-sm-3"><input name="lastname" type="text" class="form-control"/></div> <div class="col-lg-3"><input name="lastname" type="text" class="form-control"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Email") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Email") . ": ";?></label>
<div class="col-sm-3"><input name="email" type="text" class="form-control"/></div> <div class="col-lg-3"><input name="email" type="text" class="form-control"/></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Timezone") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Timezone") . ": ";?></label>
<div class="col-sm-3"><?php display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,true,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"form-inline");?></div> <div class="col-lg-3"><?php display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,true,array("value",get_setting("DEFAULT_TIME_ZONE")),true,"form-inline");?></div>
<div class="col-sm-6 form-inline"> <div class="col-lg-6 form-inline">
<?php echo T_("Edit") . "&emsp;";?> <?php echo T_("Edit") . "&emsp;";?>
<a href='timezonetemplate.php' class="btn btn-default fa"><?php echo T_("TimeZones list");?></a> <a href='timezonetemplate.php' class="btn btn-default fa"><?php echo T_("TimeZones list");?></a>
</div> </div>
</div> </div>
<?php if (FREEPBX_PATH == false) { ?> <?php if (VOIP_ENABLED != false) { ?>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Extension") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label>
<div class="col-sm-3"><?php display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline");?></div> <div class="col-lg-3"><input name="voip" type="checkbox" onchange="if(this.checked==true){show(this,'usesvoip');} else{ hide(this,'usesvoip');}" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" /></div><!-- checked="checked" -->
<div class="col-sm-6 form-inline"> </div>
<div id="usesvoip" style="display:none" >
<div class="form-group">
<label class="col-lg-3 control-label"><?php echo T_("Extension") . ": ";?></label>
<div class="col-lg-3"><?php display_chooser($ers,"extension_id","extension_id",true,false,false,true,false,true,"form-inline");?></div>
<div class="col-lg-6 form-inline">
<?php echo T_("Edit") . "&emsp;";?> <?php echo T_("Edit") . "&emsp;";?>
<a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a> <a href='extensionstatus.php' class="btn btn-default fa"><?php echo T_("Extensions");?></a>
</div> </div>
</div> </div>
</div>
<?php } ?> <?php } ?>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Uses VoIP") . "? ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
<div class="col-sm-3"><input name="voip" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" checked="checked"/></div> <div class="col-lg-3"><input name="chat_enable" type="checkbox" onchange="if(this.checked==true){show(this,'jabdata');} else{ hide(this,'jabdata');}" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" /></div>
</div> </div>
<div id="jabdata" style="display:none" >
<div class="form-group">
<label class="col-lg-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": ";?></label>
<div class="col-lg-3"><input name="chat_user" type="text" class="form-control"/></div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": ";?></label>
<div class="col-lg-3"><input name="chat_password" type="text" class="form-control"/></div>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat user") . ": ";?></label> <label class="col-lg-3 control-label"><?php echo T_("Is the operator a system administrator?");?></label>
<div class="col-sm-3"><input name="chat_user" type="text" class="form-control"/></div> <div class="col-lg-3"><input name="admin" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger"/></div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Jabber/XMPP chat password") . ": ";?></label> <br/>
<div class="col-sm-3"><input name="chat_password" type="text" class="form-control"/></div> <div class="form-group form-inline">
<div class='col-lg-3'>
<a href='operatorlist.php' class='btn btn-default col-lg-6'><?php echo T_("Cancel") ;?></a>
</div>
<div class="col-lg-3">
<input type="submit" name="adduser" class="btn btn-primary btn-block" value="<?php echo T_("Add an operator"); ?>" />
</div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Uses chat") . "? ";?></label>
<div class="col-sm-3"><input name="chat_enable" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" /></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a system administrator?");?></label>
<div class="col-sm-3"><input name="admin" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-offstyle="primary" data-onstyle="danger"/></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a normal interviewer?");?></label>
<div class="col-sm-3"><input name="temporary" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-offstyle="danger" checked="checked"/></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a supervisor?");?></label>
<div class="col-sm-3"><input name="supervisor" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"><?php echo T_("Is the operator a refusal converter?");?></label>
<div class="col-sm-3"><input name="refusal" type="checkbox" data-toggle="toggle" data-on="<?php echo T_("Yes"); ?>" data-off="<?php echo T_("No"); ?>" data-onstyle="danger" data-offstyle="primary"/></div>
</div>
<div class="form-group"><div class="col-sm-3 col-sm-offset-3"><input type="submit" name="adduser" class="btn btn-primary btn-block" value="<?php echo T_("Add an operator"); ?>" /></div></div>
</form> </form>
<?php <?php
xhtml_foot(); xhtml_foot(array("../js/new.js"));
?> ?>

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -1,4 +1,5 @@
<?php /** <?php
/**
* Display outcomes by questionnaire * Display outcomes by questionnaire
*/ */
@@ -15,7 +16,7 @@ include_once(dirname(__FILE__).'/../db.inc.php');
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -67,7 +68,7 @@ $js_foot = array(
"../js/custom.js" "../js/custom.js"
); );
xhtml_head(T_("Questionnaire Outcomes"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") xhtml_head(T_("Questionnaire Outcomes"),true,$css,$js_head);
print "<h3 class='col-sm-4 pull-left text-right'>" . T_("Select a questionnaire") . "</h3>"; print "<h3 class='col-sm-4 pull-left text-right'>" . T_("Select a questionnaire") . "</h3>";
@@ -84,7 +85,7 @@ if ($questionnaire_id != false)
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) 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) 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)"; GROUP BY (c.sample_id is not null)";
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")); if ($db->GetAll($sql)) xhtml_table($db->GetAll($sql),array("drawn","count"),array(T_("Status"),T_("Number")), "tclass", false, array("count"));
else print "<div class='alert text-danger'>" . T_("No samples assigned") . ".&emsp;</div>"; else print "<div class='alert text-danger'>" . T_("No samples assigned") . ".&emsp;</div>";
print "</div>"; print "</div>";
@@ -143,7 +144,7 @@ group by s.import_id";
$a = $db->GetAssoc($sql); $a = $db->GetAssoc($sql);
$a = aapor_clean($a); $a = aapor_clean($a);
print "<table class='col-sm-10'><thead><tr><th class='col-sm-8'>" . T_("Outcome") . "</th><th>" . T_("Rate") . "</th></tr></thead>"; // table-hover table table-condensed print "<table class='col-sm-10'><thead><tr><th class='col-sm-8'>" . T_("Outcome") . "</th><th>" . T_("Rate") . "</th></tr></thead>";
print "<tr><td>" . T_("Response Rate 1") . "</td><td>" . round(aapor_rr1($a),2) . "</td></tr>"; print "<tr><td>" . T_("Response Rate 1") . "</td><td>" . round(aapor_rr1($a),2) . "</td></tr>";
print "<tr><td>" . T_("Refusal Rate 1") . "</td><td>" . round(aapor_ref1($a),2) . "</td></tr>"; print "<tr><td>" . T_("Refusal Rate 1") . "</td><td>" . round(aapor_ref1($a),2) . "</td></tr>";
print "<tr><td>" . T_("Cooperation Rate 1") . "</td><td>" . round(aapor_coop1($a),2) . "</td></tr>"; print "<tr><td>" . T_("Cooperation Rate 1") . "</td><td>" . round(aapor_coop1($a),2) . "</td></tr>";
@@ -153,7 +154,7 @@ group by s.import_id";
$sql = "SELECT count(case_id) FROM `case` WHERE `case`.questionnaire_id = '$questionnaire_id'"; $sql = "SELECT count(case_id) FROM `case` WHERE `case`.questionnaire_id = '$questionnaire_id'";
$cases = $db->GetOne($sql); $cases = $db->GetOne($sql);
$sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&amp;outcome_id=', o.outcome_id, '\'>', o.description, '</a>') as des, o.outcome_id, count( c.case_id ) as count, ROUND((count( c.case_id ) / $cases) * 100,2) as perc $sql = "SELECT CONCAT('&emsp;<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&amp;outcome_id=', o.outcome_id, '\'><b>', '=>' ,'</b></a>&emsp;')as link, 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 FROM `case` AS c, `outcome` AS o
WHERE c.questionnaire_id = '$questionnaire_id' WHERE c.questionnaire_id = '$questionnaire_id'
AND c.current_outcome_id = o.outcome_id AND c.current_outcome_id = o.outcome_id
@@ -165,7 +166,7 @@ group by s.import_id";
{ print "<div class='col-sm-8'><div class='panel panel-body'>"; { print "<div class='col-sm-8'><div class='panel panel-body'>";
//print "<h4>" . T_("Total cases for questionnaire") . " = <b>$cases</b></h4>"; //print "<h4>" . T_("Total cases for questionnaire") . " = <b>$cases</b></h4>";
translate_array($rs,array("des")); translate_array($rs,array("des"));
xhtml_table($rs,array("des","count","perc"),array(T_("Outcome"),T_("Count"),"&emsp;" . T_("%")),"tclass",false,array("count","perc"));//array("des" => "Complete") xhtml_table($rs,array("outcome_id","des","link","count","perc"),array(T_("ID"),T_("Outcome"),"",T_("Count"),"&emsp;" . T_("%")),"tclass",false,array("count","perc"));//array("des" => "Complete")
print "</div></div>"; print "</div></div>";
$sample_import_id = false; $sample_import_id = false;
@@ -202,7 +203,7 @@ group by s.import_id";
print "<div class='col-sm-8'><div class='panel panel-body'>"; //<p>" . T_("Outcomes") . "</p>"; print "<div class='col-sm-8'><div class='panel panel-body'>"; //<p>" . T_("Outcomes") . "</p>";
$sql = "SELECT CONCAT('<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id&amp;outcome_id=', o.outcome_id, '\'>', o.description, '</a>') 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('&emsp;<a href=\'casesbyoutcome.php?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id&amp;outcome_id=', o.outcome_id, '\'><b>', '=>' ,'</b></a>&emsp;')as link, 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 FROM `case` AS c, `outcome` AS o, sample as s
WHERE c.questionnaire_id = '$questionnaire_id' WHERE c.questionnaire_id = '$questionnaire_id'
@@ -216,7 +217,7 @@ group by s.import_id";
if (!empty($rs)) if (!empty($rs))
{ {
translate_array($rs,array("des")); 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")); xhtml_table($rs,array("outcome_id","des","link","count","perc"),array(T_("ID"),T_("Outcome"),"",T_("Count"),"&emsp;" . T_("%")),"tclass",array("des" => "Complete"),array("count","perc"));
} }
else else
print "<p>" . T_("No outcomes recorded for this sample") . "</p>"; print "<p>" . T_("No outcomes recorded for this sample") . "</p>";

View File

@@ -39,11 +39,6 @@ include (dirname(__FILE__) . "/../config.inc.php");
*/ */
include (dirname(__FILE__) . "/../db.inc.php"); include (dirname(__FILE__) . "/../db.inc.php");
/**
* Authentication file
*/
include ("auth-admin.php");
/** /**
* Process * Process
*/ */

View File

@@ -42,7 +42,7 @@ include("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -563,7 +563,7 @@ else
CASE WHEN enabled = 0 THEN CASE WHEN enabled = 0 THEN
CONCAT('<i class=\'btn fa fa-calendar fa-2x\' style=\'color:lightgrey;\'></i>') CONCAT('<i class=\'btn fa fa-calendar fa-2x\' style=\'color:lightgrey;\'></i>')
ELSE ELSE
CONCAT('<a href=\'addshift.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Shifts") . "&ensp;\n" . TQ_("questionnaire") . "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-calendar fa-2x\'></i></a>') CONCAT('<a href=\'addshift.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Shifts") . " " . TQ_("questionnaire") . "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-calendar fa-2x\'></i></a>')
END as shifts, END as shifts,
CASE WHEN enabled = 0 THEN CASE WHEN enabled = 0 THEN
CONCAT('<i class=\'btn fa fa-square-o fa-2x\' style=\'color:lightgrey;\'></i>') CONCAT('<i class=\'btn fa fa-square-o fa-2x\' style=\'color:lightgrey;\'></i>')
@@ -580,18 +580,22 @@ else
ELSE ELSE
CONCAT('<a href=\'outcomes.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Outcomes for questionnaire"). "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-bar-chart fa-2x\'></i></a>') CONCAT('<a href=\'outcomes.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Outcomes for questionnaire"). "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-bar-chart fa-2x\'></i></a>')
END as outcomes, END as outcomes,
CONCAT('<a href=\'callhistory.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Call history"). "&ensp;\n" . TQ_("questionnaire"). "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-phone fa-2x\'></i></a>') as calls, CONCAT('<a href=\'callhistory.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Call history"). " " . TQ_("questionnaire"). " ',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-phone fa-2x\'></i></a>') as calls,
CONCAT('<a href=\'set_outcomes.php?qid=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Set outcomes"). "&ensp;\n" . TQ_("questionnaire"). "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-list-ol fa-2x\'></i></a>') as setoutcomes,
CASE WHEN enabled = 0 THEN CASE WHEN enabled = 0 THEN
CONCAT('<i class=\'btn fa fa-download fa-2x\' style=\'color:lightgrey;\'></i>') CONCAT('<i class=\'btn fa fa-download fa-2x\' style=\'color:lightgrey;\'></i>')
ELSE ELSE
CONCAT('<a href=\'dataoutput.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Data output"). "&ensp;\n" . TQ_("questionnaire"). "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-download fa-2x\'></i></a>') CONCAT('<a href=\'dataoutput.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Data output"). " " . TQ_("questionnaire"). "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-download fa-2x\'></i></a>')
END as dataout, END as dataout,
CASE WHEN enabled = 0 THEN CASE WHEN enabled = 0 THEN
CONCAT('<i class=\'btn fa fa-book fa-2x\' style=\'color:lightgrey;\'></i>') CONCAT('<i class=\'btn fa fa-book fa-2x\' style=\'color:lightgrey;\'></i>')
ELSE ELSE
CONCAT('<a href=\'assignsample.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Assigned samples"). "\' data-toggle=\'tooltip\'><i class=\'fa fa-book fa-2x\'></i></a>') CONCAT('<a href=\'assignsample.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . TQ_("Assigned samples"). "\' data-toggle=\'tooltip\'><i class=\'fa fa-book fa-2x\'></i></a>')
END as assample, END as assample,
CASE WHEN enabled = 0 THEN
CONCAT('<i class=\'btn fa fa-filter fa-2x\' style=\'color:lightgrey;\'></i>')
ELSE
CONCAT('<a href=\'quotareport.php?questionnaire_id=',questionnaire_id,'\' class=\'btn\' title=\'" . T_("Quota report"). " " . TQ_("questionnaire"). "&ensp;',questionnaire_id,'\' data-toggle=\'tooltip\'><i class=\'fa fa-filter fa-2x\'></i></a>')
END as quotareport,
CASE WHEN enabled = 0 THEN CASE WHEN enabled = 0 THEN
CONCAT('<i class=\'btn fa fa-question-circle fa-2x\' style=\'color:lightgrey;\'></i>') CONCAT('<i class=\'btn fa fa-question-circle fa-2x\' style=\'color:lightgrey;\'></i>')
ELSE ELSE
@@ -600,7 +604,7 @@ else
FROM questionnaire"; FROM questionnaire";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
$columns = array("qid","description","status","enabledisable","outcomes","calls","casestatus","shifts","assample","dataout","modify","setoutcomes","inlime","prefill","deletee"); $columns = array("qid","description","status","enabledisable","outcomes","calls","casestatus","shifts","assample","quotareport","dataout","modify","inlime","prefill","deletee");
xhtml_table($rs,$columns,false,"table-hover table-condensed "); xhtml_table($rs,$columns,false,"table-hover table-condensed ");
print "</div>"; print "</div>";

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -101,7 +101,9 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['questionnaire_prefill_id'])
$questionnaire_id = false; $questionnaire_id = false;
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']); if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
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")); $subtitle = T_("Set values for questionnaire to prefill");
xhtml_head(T_("Prefill questionnaire:"),true,array("../include/bootstrap/css/bootstrap.min.css","../css/custom.css"),array("../js/window.js"), false, false, false, $subtitle);
print "<h3 class='form-inline pull-left'>" . T_("Select a questionnaire") . ":&emsp;</h3>"; print "<h3 class='form-inline pull-left'>" . T_("Select a questionnaire") . ":&emsp;</h3>";
$sql = "SELECT questionnaire_id as value,description, $sql = "SELECT questionnaire_id as value,description,
@@ -182,14 +184,16 @@ if ($questionnaire_id != false)
AND sivr.sample_import_id = qs.sample_import_id"; AND sivr.sample_import_id = qs.sample_import_id";
?> ?>
<form action="" method="get" class="form-inline form-group"> <form action="" method="get" class="form-inline form-group">
<label for="value"><?php echo T_("The value to pre fill"); ?>:&emsp;</label><input type="text" name="value" id="value" size="50" class="form-control"/> <p><label for="value"><?php echo T_("The value to pre fill"); ?>:&emsp;</label><input type="text" name="value" id="value" size="50" class="form-control"/></p>
<label for="svar">&emsp;<?php echo T_("or: Select pre fill from sample list"); ?>&emsp;</label> <p><label for="svar"><?php echo T_("or: Select pre fill from sample list"); ?>&emsp;</label>
<?php //display a list of possible sample variables for this questionnaire <?php //display a list of possible sample variables for this questionnaire
display_chooser($db->GetAll($sql),"svar","svar",true,false,false,true,false,true,"form-group"); display_chooser($db->GetAll($sql),"svar","svar",true,false,false,false,false,true,"form-group");
?> ?>
</p>
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/> <input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
<input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/> <input type="hidden" name="sgqa" value="<?php print($sgqa); ?>"/>
<input type="submit" name="add_prefill" class="btn btn-primary fa" value="<?php print(T_("Add pre fill")); ?>"/> </br>
<p><input type="submit" name="add_prefill" class="btn btn-primary fa" value="<?php print(T_("Add pre fill")); ?>"/></p>
</form> </form>
<?php <?php
} }

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -129,7 +129,8 @@ if ($questionnaire_id != false)
$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 $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 FROM sample_import as s, questionnaire_sample as q
WHERE q.questionnaire_id = $questionnaire_id WHERE q.questionnaire_id = $questionnaire_id
AND q.sample_import_id = s.sample_import_id"; AND q.sample_import_id = s.sample_import_id
AND s.enabled = 1";
$s = $db->GetAll($sql); $s = $db->GetAll($sql);
if (!empty($s)){ if (!empty($s)){

View File

@@ -44,7 +44,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -238,25 +238,36 @@ if ($questionnaire_id)
{ {
//limesurvey quotas for this question //limesurvey quotas for this question
$quotas = (get_limesurvey_quota_info($r['id'])); $quotas = (get_limesurvey_quota_info($r['id']));
$sqlq = array(); $cob = array();
foreach ($quotas as $q) foreach ($quotas as $qr)
$sqlq[] = "s." . $q['fieldname'] . " = '" . $q['value'] . "'"; {
$sqlq = array();
foreach($qr as $qid => $q)
{
$sqlq[] = "s." . $q['fieldname'] . " = '" . $q['value'] . "'";
}
$cob[] = "( " . implode(' OR ', $sqlq) . " )";
}
if (!empty($cob))
{
$sql = "SELECT COUNT(id) as count $sql = "SELECT COUNT(id) as count
FROM ".LIME_PREFIX."survey_{$r['sid']} as s FROM ".LIME_PREFIX."survey_{$r['sid']} as s
JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id') 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` as sam ON (c.sample_id = sam.sample_id AND sam.import_id = '$sample_import_id')
WHERE ".implode(' AND ',$sqlq)." "." WHERE ".implode(' AND ',$cob)." "."
AND submitdate IS NOT NULL AND submitdate IS NOT NULL
AND s.token = c.token"; AND s.token = c.token";
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
$completions = $rs['count']; $completions = $rs['count'];
$perc = ROUND(($completions / $r['qlimit']) * 100,2); $perc = ROUND(($completions / $r['qlimit']) * 100,2);
$report[] = array("strata" => "<a href='" . LIME_URL . "/admin/admin.php?action=quotas&sid={$r['sid']}&quota_id={$r['id']}&subaction=quota_editquota'>" . $r['name'] . "</a>", "quota" => $r['qlimit'], "completions" => $completions, "perc" => $perc); $report[] = array("strata" => "<a href='" . LIME_URL . "/admin/admin.php?action=quotas&sid={$r['sid']}&quota_id={$r['id']}&subaction=quota_editquota'>" . $r['name'] . "</a>", "quota" => $r['qlimit'], "completions" => $completions, "perc" => $perc);
}
} }
@@ -284,7 +295,7 @@ if ($questionnaire_id)
$sql = "SELECT count(*) as count $sql = "SELECT count(*) as count
FROM `case` as c, sample as s FROM `case` as c, sample as s
WHERE c.current_outcome_id = 10 WHERE c.current_outcome_id IN (10,40)
AND s.import_id = '$sample_import_id' AND s.import_id = '$sample_import_id'
AND s.sample_id = c.sample_id AND s.sample_id = c.sample_id
AND c.questionnaire_id = '$questionnaire_id'"; AND c.questionnaire_id = '$questionnaire_id'";

View File

@@ -44,7 +44,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -305,7 +305,8 @@ if ($questionnaire_id != false)
$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 $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 FROM sample_import as s, questionnaire_sample as q
WHERE q.questionnaire_id = $questionnaire_id WHERE q.questionnaire_id = $questionnaire_id
AND q.sample_import_id = s.sample_import_id"; AND q.sample_import_id = s.sample_import_id
AND s.enabled = 1";
$s = $db->GetAll($sql); $s = $db->GetAll($sql);
if (!empty($s)){ if (!empty($s)){
print "<h3 class='form-inline pull-left'>&emsp;&emsp;&emsp;" . T_("Sample") . ":&emsp;</h3>"; print "<h3 class='form-inline pull-left'>&emsp;&emsp;&emsp;" . T_("Sample") . ":&emsp;</h3>";
@@ -317,9 +318,6 @@ if ($questionnaire_id != false)
print "<div class='col-sm-2 pull-right'><a href='quotareport.php?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' class='btn btn-info btn-block'><i class='fa fa-filter fa-lg'></i>&emsp;" . T_("To quota report") . "</a></div>"; print "<div class='col-sm-2 pull-right'><a href='quotareport.php?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' class='btn btn-info btn-block'><i class='fa fa-filter fa-lg'></i>&emsp;" . T_("To quota report") . "</a></div>";
print "<div class='clearfix'></div>";
if ($sample_import_id != false) if ($sample_import_id != false)
{ {
if (isset($_POST['import_quota'])) if (isset($_POST['import_quota']))
@@ -387,8 +385,9 @@ if ($questionnaire_id != false)
if ($qsqri != false) if ($qsqri != false)
{ {
print "<h2 class='col-sm-2'><a href='?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' class='btn btn-default'><i class='fa fa-arrow-up fa-lg text-primary'></i>&emsp;" . T_("To Row quotas") . "</a></h2>"; print "<div class='col-lg-3 pull-right'><a href='?questionnaire_id=$questionnaire_id&amp;sample_import_id=$sample_import_id' class='btn btn-default'><i class='fa fa-arrow-up fa-lg text-primary'></i>&emsp;" . T_("To Row quotas") . "</a></div>";
print "<h2>" . T_("Quota") . ": $qsqrid</h2>"; print "<div class='clearfix form-group'></div>";
print "<h2 class='col-lg-offset-4'>" . T_("Quota") . ": $qsqrid</h2>";
?> ?>
<div class='panel-body' > <div class='panel-body' >

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -121,8 +121,6 @@ function sample_call_attempt_report($questionnaire_id = false, $sample_id = fals
$outcomes = $db->GetAssoc($sql); $outcomes = $db->GetAssoc($sql);
translate_array($outcomes,array("description"));
$rep = array("callattempts","sample"); $rep = array("callattempts","sample");
$rept = array(T_("Call attempts made"),T_("Number of cases")); $rept = array(T_("Call attempts made"),T_("Number of cases"));
$totals = array("sample"); $totals = array("sample");
@@ -132,7 +130,7 @@ function sample_call_attempt_report($questionnaire_id = false, $sample_id = fals
foreach($outcomes as $key => $val) foreach($outcomes as $key => $val)
{ {
$rep[] = $key; $rep[] = $key;
$rept[] = $val; $rept[] = T_($val);
$outcomesfilled[$key] = 0; $outcomesfilled[$key] = 0;
} }

View File

@@ -42,7 +42,7 @@ include_once(dirname(__FILE__).'/../db.inc.php');
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -298,16 +298,14 @@ if (isset($_GET['edit']) )
$sql = "SELECT type, description $sql = "SELECT type, description
FROM sample_var_type"; FROM sample_var_type";
$rd = $db->GetAll($sql); $rd = $db->GetAll($sql);
$selected = "selected=\"selected\"";
$sql = "SELECT sir.var_id, $sql = "SELECT sir.var_id,
CONCAT('<input type=\"text\" onInput=\"$(this).attr(\'name\',\'var[',sir.var_id,']\');\" value=\"' ,sir.var, '\" required class=\"form-control\" style=\"min-width: 300px;\" $dis />') as var, CONCAT('<input type=\"text\" onInput=\"$(this).attr(\'name\',\'var[',sir.var_id,']\');\" value=\"' ,sir.var, '\" required class=\"form-control\" style=\"min-width: 300px;\" $dis />') as var,
CONCAT ('<select name=\"type[',sir.var_id,']\" class=\"form-control\" $dis > CONCAT ('<select name=\"type[',sir.var_id,']\" class=\"form-control\" $dis >";
<option value=\"' ,svt.type, '\" $selected>' ,svt.description, '</option>";
foreach($rd as $r) foreach($rd as $r)
{ {
$sql .= "<option value=\"{$r['type']}\">" . T_($r['description']) . "</option>"; $sql .= "<option value=\"{$r['type']}\"', CASE WHEN ( svt.type = {$r['type']}) THEN 'selected=\"selected\"' ELSE '' END , ' >" . T_($r['description']) . "</option>";
} }
$sql .= "</select>') as type, sv.val, $sql .= "</select>') as type, sv.val,
CONCAT('<input type=\'checkbox\' ', CASE WHEN (sir.restrict IS NULL || sir.restrict = 0) THEN 'checked=\"checked\"' ELSE '' END ,' name=\"see[]\" value=\'',sir.var_id,'\' data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\"/>') as see, CONCAT('<input type=\'checkbox\' ', CASE WHEN (sir.restrict IS NULL || sir.restrict = 0) THEN 'checked=\"checked\"' ELSE '' END ,' name=\"see[]\" value=\'',sir.var_id,'\' data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\"/>') as see,
CONCAT('<input type=\'checkbox\' name=\"del[',sir.var_id,']\" value=\'',sir.var_id,'\' $dis data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\" data-onstyle=\'danger \'/>') as del, CONCAT('<input type=\'checkbox\' name=\"del[',sir.var_id,']\" value=\'',sir.var_id,'\' $dis data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\" data-onstyle=\'danger \'/>') as del,

View File

@@ -44,7 +44,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -51,8 +51,8 @@ global $db;
if (isset($_POST['default']) && isset($_POST['save'])){ if (isset($_POST['default']) && isset($_POST['save'])){
$sql = "UPDATE `outcome` as o $sql = "UPDATE `outcome` as o
SET `deflt` = 0 SET `default` = 0
WHERE o.const != 1"; WHERE o.permanent != 1";
$db->Execute($sql); $db->Execute($sql);
if(!empty($_POST['select']) ){ if(!empty($_POST['select']) ){
@@ -63,8 +63,8 @@ if (isset($_POST['default']) && isset($_POST['save'])){
$sel=implode($sel,","); $sel=implode($sel,",");
$sql = "UPDATE `outcome` as o $sql = "UPDATE `outcome` as o
SET `deflt` = 1 SET `default` = 1
WHERE o.const != 1 WHERE o.permanent != 1
AND o.outcome_id IN ($sel)"; AND o.outcome_id IN ($sel)";
$db->Execute($sql); $db->Execute($sql);
@@ -86,11 +86,11 @@ if (isset($_POST['default']) && isset($_POST['save'])){
if (isset($_POST['qid']) && isset($_POST['save'])){ if (isset($_POST['qid']) && isset($_POST['save'])){
//get id's for 'constant' outcomes //get id's for 'permanent' outcomes
$sql = "SELECT o.outcome_id $sql = "SELECT o.outcome_id
FROM `outcome` as o FROM `outcome` as o
WHERE o.const = 1 WHERE o.permanent = 1
AND o.deflt = 1;"; AND o.default = 1;";
$def = $db->GetAll($sql); $def = $db->GetAll($sql);
for ($i=0; $i < count($def); $i++){ for ($i=0; $i < count($def); $i++){
@@ -156,7 +156,7 @@ if (isset($_GET['qid'])) {
$sql = "SELECT o.outcome_id $sql = "SELECT o.outcome_id
FROM `outcome` as o FROM `outcome` as o
WHERE o.deflt = 1;"; WHERE o.default = 1;";
$def = $db->GetAll($sql); $def = $db->GetAll($sql);
for ($i=0; $i < count($def); $i++){ for ($i=0; $i < count($def); $i++){
@@ -179,7 +179,7 @@ if (isset($_GET['qid'])) {
CASE WHEN ((o.outcome_id = 40 AND $sc = 1) OR (o.outcome_id = 41 AND $ref = 1)) THEN 'checked=\"checked\" data-onstyle=\"success\"' ELSE '' END ,'', CASE WHEN ((o.outcome_id = 40 AND $sc = 1) OR (o.outcome_id = 41 AND $ref = 1)) THEN 'checked=\"checked\" data-onstyle=\"success\"' ELSE '' END ,'',
CASE WHEN ((o.outcome_id = 40 AND $sc != 1) OR (o.outcome_id = 41 AND $ref != 1)) THEN 'disabled=\"disabled\"' ELSE '' END ,'', CASE WHEN ((o.outcome_id = 40 AND $sc != 1) OR (o.outcome_id = 41 AND $ref != 1)) THEN 'disabled=\"disabled\"' ELSE '' END ,'',
CASE WHEN o.outcome_id NOT IN (40,41) AND o.outcome_id IN ($qoutc) THEN 'checked=\"checked\"' ELSE '' END ,'', CASE WHEN o.outcome_id NOT IN (40,41) AND o.outcome_id IN ($qoutc) THEN 'checked=\"checked\"' ELSE '' END ,'',
CASE WHEN o.outcome_id NOT IN (40,41) AND o.const = 1 THEN 'disabled=\"disabled\" data-onstyle=\"success\"' ELSE '' END ,' CASE WHEN o.outcome_id NOT IN (40,41) AND o.permanent = 1 THEN 'disabled=\"disabled\" data-onstyle=\"success\"' ELSE '' END ,'
name=\"select[]\" value=\'',o.outcome_id,'\' data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\"/>') as `select` name=\"select[]\" value=\'',o.outcome_id,'\' data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\"/>') as `select`
from `outcome` as o, `outcome_type` as ot from `outcome` as o, `outcome_type` as ot
WHERE o.outcome_type_id = ot.outcome_type_id WHERE o.outcome_type_id = ot.outcome_type_id
@@ -204,7 +204,7 @@ if (isset($_GET['default'])) {
CONCAT('<h4>&ensp;<span class=\"label label-', CASE WHEN o.contacted = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as contacted, CONCAT('<h4>&ensp;<span class=\"label label-', CASE WHEN o.contacted = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as contacted,
CONCAT('<h4>&ensp;<span class=\"label label-', CASE WHEN o.eligible = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as eligible, CONCAT('<h4>&ensp;<span class=\"label label-', CASE WHEN o.eligible = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as eligible,
CONCAT('<h4>&ensp;<span class=\"label label-', CASE WHEN o.require_note = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as require_note, CONCAT('<h4>&ensp;<span class=\"label label-', CASE WHEN o.require_note = 1 THEN 'primary\">" . T_("Yes") . "' ELSE 'default\">" . T_("No") . "' END , '</span></h4>') as require_note,
CONCAT('<input type=\'checkbox\' ', CASE WHEN o.deflt = 1 THEN 'checked=\"checked\"' ELSE '' END ,' ', CASE WHEN o.const = 1 THEN 'disabled=\"disabled\" data-onstyle=\"success\"' ELSE '' END ,' name=\"select[]\" value=\'',o.outcome_id,'\' data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\" />') as `select` CONCAT('<input type=\'checkbox\' ', CASE WHEN o.default = 1 THEN 'checked=\"checked\"' ELSE '' END ,' ', CASE WHEN o.permanent = 1 THEN 'disabled=\"disabled\" data-onstyle=\"success\"' ELSE '' END ,' name=\"select[]\" value=\'',o.outcome_id,'\' data-toggle=\"toggle\" data-size=\"small\" data-style=\"center-block\" data-on=" . TQ_("Yes") . " data-off=" . TQ_("No") . " data-width=\"70\" />') as `select`
from `outcome` as o, `outcome_type` as ot from `outcome` as o, `outcome_type` as ot
WHERE o.outcome_type_id = ot.outcome_type_id WHERE o.outcome_type_id = ot.outcome_type_id
ORDER BY `o`.`outcome_id` ASC"; ORDER BY `o`.`outcome_id` ASC";
@@ -271,4 +271,4 @@ if (isset($rs) && !empty($rs)){
xhtml_foot($js_foot); xhtml_foot($js_foot);
?> ?>

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -16,7 +16,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions
@@ -122,7 +122,7 @@ if (isset($_GET['case_note_id']))
$db->Execute($sql); $db->Execute($sql);
} }
xhtml_head(T_("Assign outcomes to cases"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") xhtml_head(T_("Assign outcomes to cases"),true,$css,$js_head);
?> ?>
@@ -137,13 +137,18 @@ xhtml_head(T_("Assign outcomes to cases"),true,$css,$js_head);//array("../css/ta
<?php <?php
$sql = "SELECT c.case_id as value, c.case_id as description, CASE WHEN c.case_id = '$case_id' THEN 'selected=\'selected\'' ELSE '' END AS selected $sql = "SELECT c.case_id as value, c.case_id as description, CASE WHEN c.case_id = '$case_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM `case` AS c, `outcome` AS o, `questionnaire` AS q, `sample` AS s, `sample_import` AS si FROM `case` AS c, `outcome` AS o, `questionnaire` AS q, `sample` AS s, `sample_import` AS si
LEFT JOIN (questionnaire_sample_quota as qsq) on (si.sample_import_id = qsq.sample_import_id)
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (si.sample_import_id = qsqr.sample_import_id)
WHERE c.current_outcome_id = o.outcome_id WHERE c.current_outcome_id = o.outcome_id
AND q.questionnaire_id = c.questionnaire_id AND q.questionnaire_id = c.questionnaire_id
AND s.sample_id = c.sample_id AND s.sample_id = c.sample_id
AND s.import_id = si.sample_import_id AND s.import_id = si.sample_import_id
AND q.enabled = 1 AND q.enabled = 1
AND si.enabled =1 AND si.enabled =1
AND o.outcome_type_id =2"; AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
AND o.outcome_type_id =2
ORDER BY c.case_id ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* Process * Process

View File

@@ -39,11 +39,6 @@ include (dirname(__FILE__) . "/../config.inc.php");
*/ */
include (dirname(__FILE__) . "/../db.inc.php"); include (dirname(__FILE__) . "/../db.inc.php");
/**
* Authentication file
*/
include ("auth-admin.php");
/** /**
* Process * Process
*/ */
@@ -267,7 +262,7 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin
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 ((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 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 GROUP BY c.case_id
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"; 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, qs.sort_order ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
@@ -308,7 +303,7 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL) AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0 AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
GROUP BY s.sample_id,qs.questionnaire_id GROUP BY s.sample_id,qs.questionnaire_id
ORDER BY qsep.priority DESC, rand() * qs.random_select, s.sample_id"; ORDER BY qsep.priority DESC, rand() * qs.random_select, qs.sort_order ASC";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);

View File

@@ -43,7 +43,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("../db.inc.php");
/** /**
* Authentication file * Authentication file
*/ */
include ("auth-admin.php"); require ("auth-admin.php");
/** /**
* Process * Process

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
* XHTML functions * XHTML functions
@@ -69,10 +69,12 @@ $db->StartTrans();
$operator_id = get_operator_id(); $operator_id = get_operator_id();
$questionnaire_id = get_questionnaire_id($operator_id); $questionnaire_id = get_questionnaire_id($operator_id);
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);
$call_attempt_id = get_call_attempt($operator_id, false);
if (isset($_GET['respondent_id']))$respondent_id = bigintval($_GET['respondent_id']); else $respondent_id = get_respondent_id($call_attempt_id);
if (!$case_id){ if (!$case_id){
xhtml_head(T_("Appointment error")); xhtml_head(T_("Appointment error"));
print("<div>" . T_("You have not been assigned a case therefore cannot create an appointment") . "</div>"); print("<div class='alert alert-danger'>" . T_("You have not been assigned a case therefore cannot create an appointment") . "</div>");
xhtml_foot(); xhtml_foot();
$db->CompleteTrans(); $db->CompleteTrans();
exit(); exit();
@@ -123,28 +125,27 @@ if (AUTO_LOGOUT_MINUTES !== false)
$js[] = "include/jquery/jquery-1.4.2.min.js"; $js[] = "include/jquery/jquery-1.4.2.min.js";
$js[] = "js/childnap.js"; $js[] = "js/childnap.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", xhtml_head(T_("Create appointment"),false,array("include/bootstrap/css/bootstrap.min.css"),$js);
//select a respondent from a list or create a new one //select a respondent from a list or create a new one
print "<h4>" . T_("Respondent") . ":"; print "<h4>" . T_("Respondent") . ":";
$sr = display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false,true); if (isset($_GET['respondent_id'])) $respondent_id = bigintval($_GET['respondent_id']);
display_respondent_list($case_id,isset($respondent_id)?$respondent_id:false,true);
print "</h4>"; print "</h4>";
if ($sr != false) $_GET['respondent_id'] = $sr;
if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0) if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{ {
//ability to create a new one //ability to create a new one
?> ?>
<p><?php echo T_("Create new respondent:"); ?></p> <h4><?php echo T_("Create new respondent:"); ?></h4>
<form id="addRespondent" method="post" action=""> <form id="addRespondent" method="post" action="">
<?php display_respondent_form(); ?> <?php display_respondent_form(); ?>
<p><input type="submit" value="<?php echo T_("Add this respondent"); ?>"/></p> <p><input type="submit" class="btn btn-primary" value="<?php echo T_("Add this respondent"); ?>"/></p>
</form> </form>
<?php <?php
} }
else if(isset($_GET['respondent_id'])) else if($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"; $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); $ct = $db->GetRow($sql);
@@ -160,6 +161,8 @@ else if(isset($_GET['respondent_id']))
display_calendar($respondent_id,$questionnaire_id,$year,$month,$day); display_calendar($respondent_id,$questionnaire_id,$year,$month,$day);
display_time($questionnaire_id,$respondent_id,$day,$month,$year,isset($_GET['start'])?$_GET['start']:false,isset($_GET['end'])?$_GET['end']:false); display_time($questionnaire_id,$respondent_id,$day,$month,$year,isset($_GET['start'])?$_GET['start']:false,isset($_GET['end'])?$_GET['end']:false);
print "</div>";
if (isset($_GET['end']) && isset($_GET['start'])) if (isset($_GET['end']) && isset($_GET['start']))
{ {
@@ -242,7 +245,7 @@ else if(isset($_GET['respondent_id']))
} }
} }
print "<br/><div class='col-md-12'><a class='btn btn-warning pull-left' href='?'>".T_("Clear")."</a><a class='btn btn-default pull-right' href='javascript:parent.closePopup();'>".T_("Cancel")."</a></div><div class='clearfix'></div>";
xhtml_foot(); xhtml_foot();

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -48,6 +48,7 @@ $sql = "SELECT stg_value
session_name($db->GetOne($sql)); session_name($db->GetOne($sql));
session_set_cookie_params(0,QUEXS_PATH);
session_start(); session_start();
//check if the session exists or loginID not set //check if the session exists or loginID not set

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
@@ -108,7 +108,7 @@ function display_outcomes($contacted,$ca,$case_id)
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
$outcomes = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q LEFT JOIN `case` as c ON (c.questionnaire_id =q.questionnaire_id) WHERE c.case_id = $case_id"); $outcomes = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q JOIN `case` as c ON (c.questionnaire_id =q.questionnaire_id) WHERE c.case_id = $case_id");
if (!empty($rs)) if (!empty($rs))
{ {

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
* XHTML functions * XHTML functions
@@ -107,7 +107,7 @@ function display_outcomes($contacted,$ca,$case_id)
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
$outcomes = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q LEFT JOIN `case` as c ON (c.questionnaire_id =q.questionnaire_id) WHERE c.case_id = $case_id"); $outcomes = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q JOIN `case` as c ON (c.questionnaire_id =q.questionnaire_id) WHERE c.case_id = $case_id");
if (!empty($rs)) if (!empty($rs))
{ {
@@ -119,21 +119,19 @@ function display_outcomes($contacted,$ca,$case_id)
} }
else else
{ {
print "<div class=\"form-group\" ><a href=\"?contacted=1\" class=\"btn btn-info\" style=\"margin-left: 15px; margin-right: 30px; min-width: 200px;\">".T_("CONTACTED")."</a>"; if ($contacted === false)
print "<a href=\"?contacted=0\" class=\"btn btn-default\" style=\"margin-left: 30px; margin-right: 15px; min-width: 200px;\">".T_("NOT CONTACTED")."</a></div>"; {
print "<div class=\"form-group\" ><a href=\"?contacted=1\" class=\"btn btn-info\" style=\"margin-left: 15px; margin-right: 30px; min-width: 150px;\">".T_("CONTACTED")."</a>";
if (isset ($_GET['contacted'])) $contacted = bigintval($_GET['contacted']); print "<a href=\"?contacted=0\" class=\"btn btn-default\" style=\"margin-left: 30px; margin-right: 15px; min-width: 150px;\">".T_("NOT CONTACTED")."</a></div>";
else if ($contacted) $contacted = bigintval($contacted);
if (isset ($_GET['contacted'])) $contacted = bigintval($_GET['contacted']);
if ($contacted || $contacted === 0 ){
$sql = "SELECT outcome_id,description,contacted
FROM outcome
WHERE contacted = '$contacted'
AND outcome_type_id != '5'
AND outcome_id IN ($outcomes)
AND outcome_id NOT IN(10,42,43,44,45)"; //don't show completed if not, hide max calls as the supposed to be automatic or admin
} }
else $contacted = bigintval($contacted);
$sql = "SELECT outcome_id,description,contacted
FROM outcome
WHERE contacted = '$contacted'
AND outcome_id NOT IN(5,10,19,21,40,41,42,43,44,45)";
} }
} }
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
@@ -147,8 +145,8 @@ function display_outcomes($contacted,$ca,$case_id)
foreach($rs as $r) foreach($rs as $r)
{ {
if ($do == $r['outcome_id']) $selected = "checked='checked'"; else $selected = ""; if ($do == $r['outcome_id']) $selected = "checked='checked'"; else $selected = "";
if (isset($r['contacted']) && $r['contacted'] == 1) $highlight = "text-primary"; else $highlight = "text-default"; if (isset($r['contacted']) && $r['contacted'] == 1) $highlight = ""; else $highlight = "style='color:black;'";
print "<p><label class='$highlight'><input type='radio' class='radio' name='outcome' id='outcome-{$r['outcome_id']}' value='{$r['outcome_id']}' $selected style='float:left'/>&emsp;" . T_($r['description']) . "</label></p>"; print "<a><label $highlight class='btn-link'><input type='radio' class='radio' name='outcome' id='outcome-{$r['outcome_id']}' value='{$r['outcome_id']}' $selected style='float:left'/>&emsp;" . T_($r['description']) . "</label></a><br/>";
} }
$_POST['confirm'] = true; $_POST['confirm'] = true;
@@ -300,7 +298,7 @@ if (isset($_GET['newstate']))
if (browser_ie()) $js = "js/window_ie6_interface2.js"; else $js = "js/window_interface2.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.min.js")); xhtml_head(T_("Set outcome"),true,array("include/bootstrap/css/bootstrap.min.css"),array($js,"include/jquery/jquery-1.4.2.min.js"));
$state = is_on_call($operator_id); $state = is_on_call($operator_id);
switch($state) switch($state)
@@ -319,8 +317,8 @@ switch($state)
{ {
//end the case //end the case
if (!isset($_GET['end'])) print "<div>" . T_("End work") . "</div>"; if (!isset($_GET['end'])) print "<div>" . T_("End work") . "</div>";
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>"; print "<p><a href='javascript:openParent(\"endcase=endcase\")' class='btn btn-primary'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p>"; print "<p><a href='javascript:openParent(\"endwork=endwork\")' class='btn btn-info'>" . T_("End work") . "</a></p>";
} }
else else
{ {
@@ -346,9 +344,11 @@ switch($state)
print "<div>" . T_("Press the call button to dial the number for this appointment:") . "</div>"; print "<div>" . T_("Press the call button to dial the number for this appointment:") . "</div>";
print "<form action='?' method='post'><div>"; print "<form action='?' method='post'>
print "<p>" . T_("Number to call:") . " {$r['phone']} - {$r['description']}</p>"; <div><p>" . T_("Number to call:") . " {$r['phone']} - {$r['description']}</p></div>
print "</div><div><input type='hidden' id='contact_phone' name='contact_phone' value='{$r['contact_phone_id']}'/><input type='submit' value=\"" . T_("Call") . "\" name='submit' id='submit'/></div></form>"; <input type='hidden' id='contact_phone' name='contact_phone' value='{$r['contact_phone_id']}'/>
<div><input type='submit' value=\"" . T_("Call") . "\" name='submit' id='submit' class='btn btn-primary'/></div>
</form>";
} }
else else
print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>"; print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>";
@@ -419,7 +419,7 @@ switch($state)
{ {
print "<option value='{$r['contact_phone_id']}'>{$r['phone']} - {$r['description']}</option>"; print "<option value='{$r['contact_phone_id']}'>{$r['phone']} - {$r['description']}</option>";
} }
print "</select></div><div><input type='submit' value=\"" . T_("Call") . "\" name='submit' id='submit'/></div></form>"; print "</select></div><div><input type='submit' value=\"" . T_("Call") . "\" name='submit' id='submit' class='btn btn-primary'/></div></form>";
} }
else else
print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>"; print "<div>" . T_("Your VoIP extension is not enabled. Please close this window and enable VoIP by clicking once on the red button that says 'VoIP Off'") . "</div>";
@@ -435,13 +435,13 @@ switch($state)
//give focus on load //give focus on load
print '<script type="text/javascript">$(document).ready(function(){$("#note").focus();});</script>'; print '<script type="text/javascript">$(document).ready(function(){$("#note").focus();});</script>';
//put these lower on the screen so they don't get "automatically" clicked //put these lower on the screen so they don't get "automatically" clicked
print "<p><a href='javascript:openParentNote(\"endcase=endcase\")'>" . T_("End case") . "</a></p>"; print "<p><a href='javascript:openParentNote(\"endcase=endcase\")' class='btn btn-primary'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParentNote(\"endwork=endwork\")'>" . T_("End work") . "</a></p>"; print "<p><a href='javascript:openParentNote(\"endwork=endwork\")' class='btn btn-info'>" . T_("End work") . "</a></p>";
} }
else else
{ {
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>"; print "<p><a href='javascript:openParent(\"endcase=endcase\")' class='btn btn-primary'>" . T_("End case") . "</a></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p"; print "<p><a href='javascript:openParent(\"endwork=endwork\")' class='btn btn-info'>" . T_("End work") . "</a></p";
} }
} }
} }
@@ -454,16 +454,16 @@ switch($state)
if ($rn) // a note is required to be entered if ($rn) // a note is required to be entered
{ {
print "<div><label for='note'>" . T_("Enter a reason for this outcome before completing this case:") . "</label><input type='text' id='note' name='note' size='48'/><br/><br/><br/><br/></div>"; print "<div><label for='note' class='control-label'>" . T_("Enter a reason for this outcome before completing this case:") . "</label><textarea type='text' id='note' name='note' class='form-control' rows='3'></textarea><br/></div>";
print '<script type="text/javascript">$(document).ready(function(){$("#note").focus();});</script>'; print '<script type="text/javascript">$(document).ready(function(){$("#note").focus();});</script>';
print "<p><a href='javascript:openParentNote(\"endcase=endcase\")'>" . T_("End case") . "</a></p>"; print "<p><a href='javascript:openParentNote(\"endcase=endcase\")' class='btn btn-primary'>" . T_("End case") . "</a></p></p>";
print "<p><a href='javascript:openParentNote(\"endwork=endwork\")'>" . T_("End work") . "</a></p>"; print "<p><a href='javascript:openParentNote(\"endwork=endwork\")' class='btn btn-info'>" . T_("End work") . "</a></p>";
} }
else else
{ {
if (!isset($_GET['end'])) print "<div>" . T_("The last call completed this call attempt") . "</div>"; if (!isset($_GET['end'])) print "<div class='alert alert-info'>" . T_("The last call completed this call attempt") . "</div>";
print "<p><a href='javascript:openParent(\"endcase=endcase\")'>" . T_("End case") . "</a></p>"; print "<p><a href='javascript:openParent(\"endcase=endcase\")' class='btn btn-primary'>" . T_("End case") . "</a></p></p>";
print "<p><a href='javascript:openParent(\"endwork=endwork\")'>" . T_("End work") . "</a></p>"; print "<p><a href='javascript:openParent(\"endwork=endwork\")' class='btn btn-info'>" . T_("End work") . "</a></p>";
} }
} }
} }
@@ -481,7 +481,7 @@ switch($state)
break; break;
case 5: //done -- shouldn't come here as should be coded + done case 5: //done -- shouldn't come here as should be coded + done
default: default:
print "<div class='status'>" . T_("Error: Close window") . "</div>"; print "<div class='alert alert-danger'>" . T_("Error: Close window") . "</div>";
break; break;
} }

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**

View File

@@ -48,6 +48,8 @@ $sql = "SELECT stg_value
session_name($db->GetOne($sql)); session_name($db->GetOne($sql));
session_set_cookie_params(0,QUEXS_PATH);
session_start(); session_start();
//check if the session exists or loginID not set //check if the session exists or loginID not set

View File

@@ -1,13 +0,0 @@
tr.odd {
background-color: #eeeeee;
}
.tclass th {
text-align:left;
border: 1px solid #aaa;
}
.tclass td {
border: 1px solid #aaa;
}
.highlight {
background-color: #cccccc;
}

View File

@@ -41,7 +41,7 @@ include_once(dirname(__FILE__).'/../db.inc.php');
/** /**
* Authentication * Authentication
*/ */
include ("auth-client.php"); require ("auth-client.php");
/** /**
@@ -62,11 +62,11 @@ include ("../functions/functions.client.php");
$client_id = get_client_id(); $client_id = get_client_id();
xhtml_head(T_("Questionnaire Outcomes"),true,array("css/table.css")); xhtml_head(T_("Questionnaire Outcomes"),true,array("../include/bootstrap/css/bootstrap.min.css", "../css/custom.css"));
if ($client_id) if ($client_id)
{ {
$sql = "SELECT q.questionnaire_id,q.description $sql = "SELECT q.questionnaire_id,q.description,q.lime_sid
FROM questionnaire as q, client_questionnaire as cq FROM questionnaire as q, client_questionnaire as cq
WHERE cq.questionnaire_id = q.questionnaire_id WHERE cq.questionnaire_id = q.questionnaire_id
AND q.enabled = 1 AND q.enabled = 1
@@ -75,14 +75,17 @@ if ($client_id)
$qs = $db->GetAll($sql); $qs = $db->GetAll($sql);
if (empty($qs)) if (empty($qs))
print "<p>" . T_("There are no questionnaires assigned to you") . "</p>"; print "<p class='alert alert-info'>" . T_("There are no questionnaires assigned to you") . "</p>";
else else
{ {
print "<div class='col-lg-2'>";
foreach($qs as $q) foreach($qs as $q)
{ {
print "<h2>{$q['description']}</h2>"; print "<div class=' '><h2>{$q['description']}</h2>";
$questionnaire_id = $q['questionnaire_id']; $questionnaire_id = $q['questionnaire_id'];
$qsid=$q['lime_sid'];
$sql = "SELECT o.calc, count( c.case_id ) $sql = "SELECT o.calc, count( c.case_id )
FROM `case` AS c, `outcome` AS o FROM `case` AS c, `outcome` AS o
@@ -91,15 +94,15 @@ if ($client_id)
GROUP BY o.calc"; GROUP BY o.calc";
$a = $db->GetAssoc($sql); $a = $db->GetAssoc($sql);
$a = aapor_clean($a); $a = aapor_clean($a);
print "<table class='table-hover table-condensed tclass'><thead class=\"highlight\"><tr><th>" . T_("Outcome") . "</th><th>" . T_("Rate") . "</th></tr></thead>";
print "<table><tr><th>" . T_("Outcome") . "</th><th>" . T_("Rate") . "</th></tr>";
print "<tr><td>" . T_("Response Rate 1") . "</td><td>" . round(aapor_rr1($a),2) . "</td></tr>"; print "<tr><td>" . T_("Response Rate 1") . "</td><td>" . round(aapor_rr1($a),2) . "</td></tr>";
print "<tr><td>" . T_("Refusal Rate 1") . "</td><td>" . round(aapor_ref1($a),2) . "</td></tr>"; print "<tr><td>" . T_("Refusal Rate 1") . "</td><td>" . round(aapor_ref1($a),2) . "</td></tr>";
print "<tr><td>" . T_("Cooperation Rate 1") . "</td><td>" . round(aapor_coop1($a),2) . "</td></tr>"; print "<tr><td>" . T_("Cooperation Rate 1") . "</td><td>" . round(aapor_coop1($a),2) . "</td></tr>";
print "<tr><td>" . T_("Contact Rate 1") . "</td><td>" . round(aapor_con1($a),2) . "</td></tr>"; print "<tr><td>" . T_("Contact Rate 1") . "</td><td>" . round(aapor_con1($a),2) . "</td></tr>";
print "</table>"; print "</table></br>";
$sql = "SELECT o.description as des, o.outcome_id, count( c.case_id ) as count $sql = "SELECT o.description as des, o.outcome_id, count( c.case_id ) as count
@@ -115,20 +118,25 @@ if ($client_id)
translate_array($rs,array("des")); translate_array($rs,array("des"));
xhtml_table($rs,array("des","count"),array(T_("Outcome"),T_("Count")),"tclass",array("des" => "Complete")); xhtml_table($rs,array("des","count"),array(T_("Outcome"),T_("Count")),"tclass",array("des" => "Complete"));
} }
else else print "<p class='alert alert-info'>" . T_("No outcomes recorded for this questionnaire") . "</p>";
print "<p>" . T_("No outcomes recorded for this questionnaire") . "</p>";
print "</br><a href=\"?qsid=$qsid\" class=\"btn btn-default btn-block btn-lime\">" . T_("View summary results") . "</a></div>";
} }
if (isset($_GET['qsid'])) $qsid = intval($_GET['qsid']);
$page = LIME_URL . "admin/admin.php?action=browse&amp;sid=$qsid";
?>
</div>
<div class="col-lg-10" id=" " style="height:820px;">
<?php xhtml_object($page,' ',"full"); ?>
</div>
<?php
} }
} }
else else
print "<p>" . T_("You are not a valid client") . "</p>"; print "<p class='alert alert-danger'>" . T_("You are not a valid client") . "</p>";
xhtml_foot(); xhtml_foot();

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
@@ -65,7 +65,9 @@ include("functions/functions.operator.php");
*/ */
include("functions/functions.input.php"); include("functions/functions.input.php");
$js = array("js/window.js"); if (isset($_GET['interface2'])) { if (browser_ie()) $jsw = "js/window_ie6_interface2.js"; else $jsw = "js/window_interface2.js"; }
else { if (browser_ie()) $jsw = "js/window_ie6.js"; else $jsw = "js/window.js"; }
$js = array($jsw);
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {

View File

@@ -74,4 +74,8 @@ text-shadow: 1px 2px 1px #ababab;
.h1, .h2, .h3, h1, h2, h3 { .h1, .h2, .h3, h1, h2, h3 {
margin-bottom: 0.4em; margin-bottom: 0.4em;
margin-top: 0.25em; margin-top: 0.25em;
}
.full {
width:100%;
height:100%;
} }

View File

@@ -1,9 +1,3 @@
/** RESET **/
* {
margin: 0;
padding: 0;
}
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0; margin: 0;
@@ -16,6 +10,11 @@ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pr
vertical-align: baseline; vertical-align: baseline;
} }
body {
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
.clear { .clear {
clear:both; clear:both;
font-size:0; font-size:0;
@@ -23,303 +22,12 @@ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pr
overflow:hidden; overflow:hidden;
} }
body {
margin: 0px;
padding: 0;
background: #FFFFFF;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
#wrapper_e {
}
.full_height_wrapper{
margin: 0px;
padding: 0;
text-align: justify;
height:285px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
min-width:1024px;
}
.half_height_wrapper{
margin: 0px;
padding: 0;
text-align: justify;
height:94px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
min-width:1024px;
}
#top_page {
}
#top_page_in_e {
}
.full_height_top_page{
height: 207px;
}
.half_height_top_page{
height: 56px;
}
.full_height{
margin: 0px;
padding: 0;
background: #FFF;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
height: 271px;
padding-top:14px;
}
.half_height{
margin: 0px;
padding: 0;
background: #FFF;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
height: 80px;
padding-top:14px;
}
#header_line {
margin: 16px 0px 0px 12px;
padding: 0;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
height: 24px;
}
#menu_left_e {
}
.menu_full_height {
padding: 0;
height: 137px;
width:145px;
display:block;
float:left;
padding:9px 22px 0px 44px;
padding-left:44px;
padding-top:9px;
list-style:none;
}
.menu_half_height {
padding: 0;
height: 47px;
list-style:none;
width:145px;
display:block;
float:left;
padding:9px 22px 0px 44px;
padding-left:44px;
padding-top:9px;
}
#menu_left li {
list-style: none;
}
#item_1 a{
background: url(images/btn_field.jpg) no-repeat left top;
list-style: none;
display: inline;
float: left;
width: 220px;
height: 40px;
color:#9f9f9f;
text-decoration:none;
padding:8px 0px 0px 18px;
border:none;
}
#item_1 a:hover{
list-style: none;
display: inline;
float: left;
width: 220px;
height: 40px;
text-decoration:none;
color:#49b848;
}
#item_2_e a{
}
.item_2_full_height a{
background: url(images/btn_field.jpg) no-repeat left top;
list-style: none;
display: inline;
float: left;
width: 220px;
height: 36px;
text-decoration:none;
color:#9f9f9f;
padding:8px 0px 0px 18px;
border:none;
}
.item_2_half_height a{
float: left;
width: 220px;
height: 1px;
text-decoration:none;
color:#b8b8ba;
display:none;
}
.item_2_full_height a:hover{
list-style: none;
display: inline;
float: left;
width: 220px;
height: 36px;
text-decoration:none;
color:#05b0f7;
background: url(images/btn_field.jpg) no-repeat left top;
}
#item_2_e a:hover{
}
.item_2_half_height {
float: left;
width: 220px;
height: 1px;
display:none;
}
#item_3_e a{
}
.item_3_half_height {
float: left;
width: 220px;
height: 1px;
display:none;
}
.item_3_full_height a{
background: url(images/btn_field.jpg) no-repeat left top;
list-style: none;
display: inline;
float: left;
width: 220px;
height: 36px;
text-decoration:none;
color:#9f9f9f;
padding:8px 0px 0px 18px;
border:none;
}
.item_3_half_height a{
}
.item_3_full_height a:hover{
list-style: none;
display: inline;
float: left;
width: 220px;
height: 36px;
text-decoration:none;
color:#ff3506;
}
#item_3_e a:hover{
}
#info_e {
}
.info_full_height{
margin: 0px;
padding: 0;
background: #CCC;
border: 1px solid #e9e9eb;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
display:block;
float:left;
height: 137px;
width:214px;
padding-right:115px;
}
.info_half_height{
margin: 0px;
padding: 0;
background: #CCC;
border: 1px solid #e9e9eb;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
display:block;
float:left;
height: 56px;
width:214px;
padding-right:115px;
}
a:active {
/* border: 4px inset;*/
}
#arrow_up_e {
}
.arrow_up_full_height {
margin: 0 auto;
padding: 0;
background: #EEE;
background: url(images/arrow_up.png) no-repeat left top;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
height: 20px;
width:20px;
position:absolute;
left:480px;
top:270px;
}
.arrow_up_half_height {
display:none;
}
#arrow_down_e {
}
.arrow_down_full_height {
display:none;
}
.arrow_down_half_height {
margin: 0 auto;
padding: 0;
background: #EEE;
background: url(images/arrow_down.jpg) no-repeat left top;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
height: 20px;
width:20px;
left:480px;
top:80px;
position:absolute;
}
#bottom_page {
margin: 0px;
padding: 0;
background: #CCC;
text-align: justify;
font-family: Tahoma, Arial, Helvetica, sans-serif;
height: 100%;
}
.headerexpand { .headerexpand {
position: absolute; position: absolute;
height: 20px; left: 41%;
bottom: 0px;
right: 20%;
}
#headerexpandimage {
height: 15px;
} }
.box { .box {
margin: 18px; margin: 18px;
} }
@@ -329,160 +37,19 @@ a:active {
.offline { .offline {
background: #FF0000; background: #FF0000;
} }
a {
/*padding: 3px 0.5em;
margin-left: 3px;
border: 1px solid #778;
background: #DDE;
text-decoration: none;
color: black;*/
}
a:active {
/* border: 4px inset;*/
}
.header {
position : absolute;
width : 50%;
height : 30%;
top : 30%;
right : 0;
bottom : auto;
left : 0;
/*max-height:136px;*/
}
#calllist {
position : absolute;
width : 50%;
height : 28%;
top : 2%;
left : 48%;
right : 1%;
/*max-height:180px;*/
bottom : auto;
}
#qstatus {
position : absolute;
width : 30%;
height : 30%;
top : 2%;
right : 2%;
left: 17%;
bottom : auto;
/*max-height:38%;*/
}
#casefunctions {
position : absolute;
width : 12%;
height : 30%;
top : 0;
right : 0;
left: 0;
font-size:18px;
padding:1%;
bottom : auto;
}
#casefunctions li {
list-style:none;
}
#content {
position : absolute;
top : 31%;
left : 0.5%;
right :0.5%;
bottom : auto;
width : 99%;
height : 69%;
}
.embeddedobject { .embeddedobject {
width:100%; width:100%;
height:100%; height:100%;
position:absolute; position:absolute;
} }
#main-qstatus { #main-qstatus {
width:95%;
/*max-height:116px;*/
position:absolute;
left:3%;
top:1%;
height:90%;
border: 2px solid #e9e9eb; border: 2px solid #e9e9eb;
border-radius: 15px; border-radius: 15px;
-moz-border-radius: 15px; -moz-border-radius: 15px;
}
#main-casenotes{
height:85%;
}
#main-contactdetails{
/*height:85%;*/
}
#main-calllist{
/*height:85%;*/
}
#main-appointmentlist{
height:85%;
}
#main-projectinfo{
height:85%;
}
.wait_wrapper{
margin: 0 auto;
position:absolute;
top:40%;
height:60%;
width:260px;
left:40%;
list-style:none;
} }
.wait_li_1 a{
background: url(images/btn_field.jpg) no-repeat left top;
list-style: none;
display: inline;
float: left;
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: 220px;
height: 40px;
text-decoration:none;
color:#49b848;
}
.wait_li_2 a{
background: url(images/btn_field.jpg) no-repeat left top;
list-style: none;
display: inline;
float: left;
width: 220px;
height: 40px;
color:#9f9f9f;
text-decoration:none;
padding:8px 0px 0px 18px;
border:none;
}
.wait_li_2 a:hover{
list-style: none;
display: inline;
float: left;
width: 220px;
height: 40px;
text-decoration:none;
color:#ff3506;
}

View File

@@ -84,7 +84,7 @@ ul.tabbernav li.tabberactive a:hover
Add style only after the tabber interface is set up (.tabberlive) Add style only after the tabber interface is set up (.tabberlive)
--------------------------------------------------*/ --------------------------------------------------*/
.tabberlive .tabbertab { .tabberlive .tabbertab {
position:absolute; /*position:absolute;*/
border: 2px solid #e9e9eb; border: 2px solid #e9e9eb;
border-bottom-left-radius: 15px; border-bottom-left-radius: 15px;
-moz-border-radius-bottomleft: 15px; -moz-border-radius-bottomleft: 15px;

View File

@@ -1055,6 +1055,8 @@ CREATE TABLE `outcome` (
`eligible` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'If the respondent is eligible to participate', `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', `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, `calc` char(2) COLLATE utf8_unicode_ci NOT NULL,
`default` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Used as default for questionnaire outcomes',
`permanent` TINYINT(1) UNSIGNED NOT NULL COMMENT 'Permanent outcome, used for all questionnaires, not possible to de-select',
PRIMARY KEY (`outcome_id`), PRIMARY KEY (`outcome_id`),
KEY `calc` (`calc`) KEY `calc` (`calc`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -1063,45 +1065,45 @@ CREATE TABLE `outcome` (
-- Dumping data for table `outcome` -- Dumping data for table `outcome`
-- --
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(1, '3.11', 'Not attempted or worked', 0, 1, 1, 0, 1, 0, 0, 'UH'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (1,'3.11','Not attempted or worked',0,1,1,0,1,0,0,'UH',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(2, '3.13', 'No answer', 180, 1, 1, 0, 1, 1, 0, 'UH'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (2,'3.13','No answer',180,1,1,0,1,1,0,'UH',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(3, '3.16', 'Technical phone problems', 180, 1, 1, 0, 1, 0, 0, 'UH'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (3,'3.16','Technical phone problems',180,1,1,0,1,0,0,'UH',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(4, '2.34', 'Other, Referred to Supervisor (Eligible)', 0, 2, 0, 1, 1, 1, 1, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (4,'2.34','Other, Referred to Supervisor (Eligible)',0,2,0,1,1,1,1,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(5, '3.91', 'Other, Referred to Supervisor (Unknown eligibility)', 0, 2, 0, 0, 1, 0, 1, 'UO'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (5,'3.91','Other, Referred to Supervisor (Unknown eligibility)',0,2,0,0,1,0,1,'UO',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(6, '2.111a', 'Soft Refusal, Other', 10080, 3, 0, 1, 1, 1, 1, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (6,'2.111a','Soft Refusal, Other',10080,3,0,1,1,1,1,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(7, '2.111b', 'Hard Refusal, Other', 10080, 3, 0, 1, 1, 1, 1, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (7,'2.111b','Hard Refusal, Other',10080,3,0,1,1,1,1,'R',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(8, '2.112a', 'Soft Refusal, Respondent', 10080, 3, 0, 1, 1, 1, 1, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (8,'2.112a','Soft Refusal, Respondent',10080,3,0,1,1,1,1,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(9, '2.112b', 'Hard Refusal, Respondent', 10080, 3, 0, 1, 1, 1, 1, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (9,'2.112b','Hard Refusal, Respondent',10080,3,0,1,1,1,1,'R',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(10, '1.1', 'Complete', 0, 4, 0, 1, 1, 1, 0, 'I'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (10,'1.1','Complete',0,4,0,1,1,1,0,'I',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(11, '2.112', 'Known respondent refusal', 0, 4, 0, 1, 1, 1, 0, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (11,'2.112','Known respondent refusal',0,4,0,1,1,1,0,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(12, '2.111', 'Household-level refusal', 0, 4, 0, 1, 1, 1, 0, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (12,'2.111','Household-level refusal',0,4,0,1,1,1,0,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(13, '2.112c', 'Broken appointment (Implicit refusal)', 10080, 3, 1, 0, 1, 1, 0, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (13,'2.112c','Broken appointment (Implicit refusal)',10080,3,1,0,1,1,0,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(14, '4.32', 'Disconnected number', 0, 4, 1, 0, 0, 0, 0, ''); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (14,'4.32','Disconnected number',0,4,1,0,0,0,0,'',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(15, '4.20', 'Fax/data line', 0, 4, 1, 1, 0, 0, 0, ''); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (15,'4.20','Fax/data line',0,4,1,1,0,0,0,'',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(16, '4.51', 'Business, government office, other organization', 0, 4, 1, 1, 0, 0, 0, ''); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (16,'4.51','Business, government office, other organization',0,4,1,1,0,0,0,'',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(17, '4.70', 'No eligible respondent', 0, 4, 1, 1, 0, 0, 0, ''); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (17,'4.70','No eligible respondent',0,4,1,1,0,0,0,'',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(18, '2.35a', 'Accidental hang up or temporary phone problem', 0, 1, 1, 1, 1, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (18,'2.35a','Accidental hang up or temporary phone problem',0,1,1,1,1,1,0,'O',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(19, '2.12a', 'Definite Appointment - Respondent', 0, 5, 0, 1, 1, 1, 0, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (19,'2.12a','Definite Appointment - Respondent',0,5,0,1,1,1,0,'R',1,1);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(20, '2.12b', 'Definite Appointment - Other', 0, 5, 0, 1, 1, 1, 0, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (20,'2.12b','Definite Appointment - Other',0,5,0,1,1,1,0,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(21, '2.13a', 'Unspecified Appointment - Respondent', 0, 5, 0, 1, 1, 1, 0, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (21,'2.13a','Unspecified Appointment - Respondent',0,5,0,1,1,1,0,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(22, '2.13b', 'Unspecified Appointment - Other', 0, 5, 0, 1, 1, 1, 0, 'R'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (22,'2.13b','Unspecified Appointment - Other',0,5,0,1,1,1,0,'R',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(23, '2.221', 'Household answering machine - Message left', 180, 1, 1, 1, 1, 1, 0, 'NC'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (23,'2.221','Household answering machine - Message left',180,1,1,1,1,1,0,'NC',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(24, '2.222', 'Household answering machine - No message left', 180, 1, 1, 1, 1, 1, 0, 'NC'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (24,'2.222','Household answering machine - No message left',180,1,1,1,1,1,0,'NC',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(25, '2.31', 'Respondent Dead', 0, 4, 0, 1, 0, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (25,'2.31','Respondent Dead',0,4,0,1,0,1,0,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(26, '2.32', 'Physically or mentally unable/incompetent', 0, 4, 0, 1, 0, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (26,'2.32','Physically or mentally unable/incompetent',0,4,0,1,0,1,0,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(27, '2.331', 'Household level language problem', 0, 4, 1, 1, 0, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (27,'2.331','Household level language problem',0,4,1,1,0,1,0,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(28, '2.332', 'Respondent language problem', 0, 4, 0, 1, 0, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (28,'2.332','Respondent language problem',0,4,0,1,0,1,0,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(29, '3.14', 'Answering machine - Not a household', 0, 4, 1, 1, 0, 0, 0, 'UH'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (29,'3.14','Answering machine - Not a household',0,4,1,1,0,0,0,'UH',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(30, '4.10', 'Out of sample', 0, 4, 0, 1, 0, 0, 0, ''); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (30,'4.10','Out of sample',0,4,0,1,0,0,0,'',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(31, '2.20', 'Non contact', 180, 1, 1, 1, 1, 1, 0, 'NC'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (31,'2.20','Non contact',180,1,1,1,1,1,0,'NC',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(32, '4.80', 'Quota filled', 0, 4, 0, 1, 0, 0, 0, ''); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (32,'4.80','Quota filled',0,4,0,1,0,0,0,'',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(33, '2.36', 'Miscellaneous - Unavailable for a week', 10080, 1, 0, 1, 1, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (33,'2.36','Miscellaneous - Unavailable for a week',10080,1,0,1,1,1,0,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(40, '1.1', 'Self completed online', 0, 4, 0, 1, 1, 1, 0, 'I'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (40,'1.1','Self completed online',0,4,0,1,1,1,0,'I',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(41, '2.36', 'Self completion email invitation sent', 10080, 1, 0, 1, 1, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (41,'2.36','Self completion email invitation sent',10080,1,0,1,1,1,0,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(42, '3.90', 'Max call attempts reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (42,'3.90','Max call attempts reached (Unknown eligibility)',0,1,0,1,1,0,0,'UH',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(43, '3.90', 'Max calls reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (43,'3.90','Max calls reached (Unknown eligibility)',0,1,0,1,1,0,0,'UH',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(44, '2.30', 'Max call attempts reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (44,'2.30','Max call attempts reached (Eligible)',0,1,0,1,1,1,0,'O',1,0);
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(45, '2.30', 'Max calls reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O'); INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`, `default`, `permanent`) VALUES (45,'2.30','Max calls reached (Eligible)',0,1,0,1,1,1,0,'O',1,0);
-- -------------------------------------------------------- -- --------------------------------------------------------
@@ -1219,6 +1221,7 @@ CREATE TABLE `questionnaire` (
`lime_template` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Limesurvey template 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', `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', `enabled` tinyint(1) NOT NULL DEFAULT '1',
`outcomes` varchar(256) COLLATE utf8_unicode_ci NULL DEFAULT '1,2,3,7,9,10,14,17,18,19' COMMENT 'Comma-separated string of outcomes defined for the questionnaire',
PRIMARY KEY (`questionnaire_id`) PRIMARY KEY (`questionnaire_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -1263,6 +1266,7 @@ CREATE TABLE `questionnaire_sample` (
`random_select` tinyint(1) NOT NULL DEFAULT '0', `random_select` tinyint(1) NOT NULL DEFAULT '0',
`answering_machine_messages` int(11) NOT NULL DEFAULT '1', `answering_machine_messages` int(11) NOT NULL DEFAULT '1',
`allow_new` tinyint(1) NOT NULL DEFAULT '1', `allow_new` tinyint(1) NOT NULL DEFAULT '1',
`sort_order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`questionnaire_id`,`sample_import_id`) PRIMARY KEY (`questionnaire_id`,`sample_import_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@@ -42,7 +42,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
@@ -72,7 +72,7 @@ $operator_id = get_operator_id();
$msg = ""; $msg = "";
if (isset($_POST['firstname'])) if (isset($_POST['email']) && ((isset($_POST['firstname']) && !empty($_POST['firstname'])) || (isset($_POST['lastname']) && !empty($_POST['lastname']))))
{ {
//validate email address //validate email address
if (validate_email($_POST['email'])) if (validate_email($_POST['email']))
@@ -278,21 +278,23 @@ if (isset($_POST['firstname']))
} }
//disable recording //disable recording
$newtext = T_("Start REC"); $newtext = T_("Start REC");
$js = "js/window.js";
if (browser_ie()) $js = "js/window_ie6.js"; if (isset($_GET['interface2'])) { if (browser_ie()) $js = "js/window_ie6_interface2.js"; else $js = "js/window_interface2.js";}
else { if (browser_ie()) $js = "js/window_ie6.js"; else $js = "js/window.js"; }
if (isset($_GET['interface2'])) if (isset($_GET['interface2']))
{ {
xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='openParent(\"endcase=endcase\");'"); xhtml_head(T_("Invitation Email"),true,array("css/call.css"),array($js),"onload='openParent(\"endcase=endcase\");'");
} }
else else
{ {
xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\"); openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id) . "\"); parent.closePopup();'"); xhtml_head(T_("Invitation Email"),true,array("css/call.css"),array($js),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\"); openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id) . "\"); parent.closePopup();'");
} }
} }
else if (isset($_POST['submit'])) else if (isset($_POST['submit']))
{ {
xhtml_head(T_("Email"),true,array("css/call.css"),false,"onload='parent.closePopup();'"); xhtml_head(T_("Invitation Email"),true,array("css/call.css"),false,"onload='parent.closePopup();'");
} }
xhtml_foot(); xhtml_foot();
die(); die();
@@ -310,10 +312,10 @@ if (isset($_POST['firstname']))
$case_id = get_case_id($operator_id); $case_id = get_case_id($operator_id);
$js = "js/window.js"; if (isset($_GET['interface2'])) { if (browser_ie()) $js = "js/window_ie6_interface2.js"; else $js = "js/window_interface2.js"; }
if (browser_ie()) $js = "js/window_ie6.js"; else { if (browser_ie()) $js = "js/window_ie6.js"; else $js = "js/window.js"; }
xhtml_head(T_("Email"),true,array("css/call.css"),array($js)); xhtml_head(T_("Invitation Email"),true,array("include/bootstrap/css/bootstrap.min.css"),array($js));
$sql = "SELECT q.self_complete $sql = "SELECT q.self_complete
FROM questionnaire as q, `case` as c FROM questionnaire as q, `case` as c
@@ -333,22 +335,30 @@ if ($sc == 1)
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
print "<div class='status'>" . T_("Email respondent for self completion") . "</div>"; print "<h4>" . T_("Email respondent for self completion") . "</h4>";
if (!empty($msg)) print "<p>$msg</p>"; if (!empty($msg)) print "<p class='alert alert-warning'>$msg</p>";
print "<form action='?"; print "<form action='?";
if (isset($_GET['interface2'])) if (isset($_GET['interface2']))
{ {
print "interface2=true"; print "interface2=true";
} }
print "' method='post'>"; print "' method='post' class='form-horizontal col-md-12'>";
print "<div><label for='firstname'>" . T_("First name") . "</label><input type='text' value='{$rs['firstname']}' name='firstname' id='firstname'/></div>";
print "<div><label for='lastname'>" . T_("Last name") . "</label><input type='text' value='{$rs['lastname']}' name='lastname' id='lastname'/></div>"; print "<div class='form-group '><label for='firstname' class='control-label'>" . T_("First name") . "</label>
print "<div><label for='email'>" . T_("Email") . "</label><input type='text' value='{$rs['email']}' name='email' id='email'/></div>"; <input type='text' value='{$rs['firstname']}' name='firstname' id='firstname' class='form-control'/>
if (!isset($_GET['interface2'])) </div>";
{ print "<div class='form-group '><label for='lastname' class='control-label'>" . T_("Last name") . "</label>
print "<div><input type='submit' value=\"" . T_("Send invitation") . "\" name='submit' id='submit'/></div>"; <input type='text' value='{$rs['lastname']}' name='lastname' id='lastname' class='form-control'/>
</div>";
print "<div class='form-group '><label for='email' class='control-label'>" . T_("Email") . "</label>
<input type='email' value='{$rs['email']}' name='email' id='email' class='form-control' required />
</div>";
if (!isset($_GET['interface2'])) {
print "<div class='form-group '><input type='submit' class='btn btn-primary' value=\"" . T_("Send invitation") . "\" name='submit' id='submit'/></div>";
} }
print "<div><input type='submit' value=\"" . T_("Send invitation and Hang up") . "\" name='submith' id='submith'/></div></form>"; print "<div class='form-group '><input type='submit' class='btn btn-primary' value=\"" . T_("Send invitation and Hang up") . "\" name='submith' id='submith'/>
<div class='col-md-6 pull-right'><a class='btn btn-default pull-right' href='javascript:parent.closePopup();'>".T_("Cancel")."</a></div><div class='clearfix'></div>
</div></form>";
} }
else else
{ {

View File

@@ -39,7 +39,7 @@ include_once("lang.inc.php");
/** /**
* Authentication * Authentication
*/ */
include_once("auth-interviewer.php"); require ("auth-interviewer.php");

View File

@@ -190,26 +190,20 @@ function display_respondent_list($case_id,$respondent_id = false,$first = false)
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
if (count($rs) >1 ){ if (count($rs) >1 ){
print "<div><p>" . T_("Select a respondent") . ": print "<div><p><b>" . T_("Select a respondent") . "</b>:
<select id='respondent_id' name='respondent_id' onchange=\"LinkUp('respondent_id')\"><option>" . T_("None") . "</option>"; <select id='respondent_id' name='respondent_id' onchange=\"LinkUp('respondent_id')\">";//<option>" . T_("None") . "</option>
if (!empty($rs)) if (!empty($rs))
{ {
foreach($rs as $r) foreach($rs as $r)
{ {
$rid = $r['respondent_id']; if ($respondent_id == $r['respondent_id']) $selected="selected='selected'"; else $selected = "";
if ($respondent_id == false && $first == true) print "<option value='?respondent_id={$r['respondent_id']}' $selected>{$r['firstName']} {$r['lastName']}</option>";
{
$first = false;
$selected = "selected='selected'";
$respondent_id = $rid;
}
else $selected = "";
if ($rid == $respondent_id) $selected="selected='selected'";
print "<option value='?respondent_id=$rid' $selected>{$r['firstName']} {$r['lastName']}</option>";
} }
if($respondent_id ==0) print "<option value='?respondent_id=0' selected='selected' class='addresp'>" . T_("Add respondent") . "</option>";
} }
print "<option value='?respondent_id=0' class='addresp'>" . T_("Add respondent") . "</option></select></p></div>"; if($respondent_id !=0) print "<option value='?respondent_id=0' class='addresp'>" . T_("Add respondent") . "</option>";
print "</select></p></div>";
} }
else { echo "&emsp;<b>",$rs[0]['firstName'],"&ensp;",$rs[0]['lastName'],"</b>"; $respondent_id =$rs[0]['respondent_id'];} else { echo "&emsp;<b>",$rs[0]['firstName'],"&ensp;",$rs[0]['lastName'],"</b>"; $respondent_id =$rs[0]['respondent_id'];}
@@ -258,13 +252,14 @@ function display_respondent_form($respondent_id = false,$case_id = false)
$rs = $db->Execute($sql); $rs = $db->Execute($sql);
print "<div><label for='firstName'>" . T_("First name:") . "</label><input type=\"text\" id='firstName' name=\"firstName\" value=\"$fn\"/></div>
<div><label for='lastName'>" . T_("Last name:") . " </label><input type=\"text\" id='lastName' name=\"lastName\" value=\"$ln\"/></div>"; print "<p><label for='firstName'>" . T_("First name:") . "</label><input type=\"text\" class=\"form-control\" id='firstName' name=\"firstName\" value=\"$fn\"/></p>
<p><label for='lastName'>" . T_("Last name:") . " </label><input type=\"text\" class=\"form-control\" id='lastName' name=\"lastName\" value=\"$ln\"/></p>";
/** /**
* Display the current respondent zone in a drop down box with other zones from timezone_template * Display the current respondent zone in a drop down box with other zones from timezone_template
*/ */
print "<div><label>" . T_("Time Zone:") . " ".$rs->GetMenu('Time_zone_name',$rzone,false)."</label></div>"; print "<p><label>" . T_("Time Zone:") . "</label> ". $rs->GetMenu('Time_zone_name',$rzone,false,false,0,'class="form-control"'). "</p>";
} }

View File

@@ -111,19 +111,24 @@ function display_shift_chooser($questionnaire_id, $shift_id = false, $divclass=f
* @param int|bool $sample_import_id The sample import id or false if none selected * @param int|bool $sample_import_id The sample import id or false if none selected
* @param bool $disabled Display disabled samples? (default is true) * @param bool $disabled Display disabled samples? (default is true)
*/ */
function display_sample_chooser($questionnaire_id, $sample_import_id = false, $disabled = true, $divclass=false, $selectclass=false) function display_sample_chooser($questionnaire_id, $sample_import_id = false, $disabled = true, $divclass=false, $selectclass=false, $quota_reached=false)
{ {
global $db; global $db;
$s = ""; if (!$disabled) $s = " AND si.enabled = 1 "; else $s = "";
if (!$disabled) if ($quota_reached){
$s = " AND si.enabled = 1 "; $qr = " LEFT JOIN (questionnaire_sample_quota as qsq) on (si.sample_import_id = qsq.sample_import_id)
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (si.sample_import_id = qsqr.sample_import_id)";
$qrq = " AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)";
}
else { $qr = ""; $qrq = ""; }
$sql = "SELECT s.sample_import_id,si.description,CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected $sql = "SELECT s.sample_import_id,si.description,CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM questionnaire_sample as s, sample_import as si FROM questionnaire_sample as s, sample_import as si $qr
WHERE s.questionnaire_id = '$questionnaire_id' WHERE s.questionnaire_id = '$questionnaire_id'
AND s.sample_import_id = si.sample_import_id $s"; AND s.sample_import_id = si.sample_import_id $s $qrq";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);

View File

@@ -441,57 +441,74 @@ function get_limesurvey_quota_info($lime_quota_id)
$ret = array(); $ret = array();
$sql = "SELECT q.*,s.language $sql = "SELECT q.qid
FROM ".LIME_PREFIX."quota_members as q, ".LIME_PREFIX."surveys as s FROM ".LIME_PREFIX."quota_members as q, ".LIME_PREFIX."surveys as s
WHERE q.quota_id='$lime_quota_id' WHERE q.quota_id='$lime_quota_id'
AND s.sid = q.sid"; AND s.sid = q.sid
GROUP BY q.qid";
$rs = $db->GetAll($sql); $rsq = $db->GetAll($sql);
foreach($rs as $quota_entry) foreach ($rsq as $q)
{ {
$lime_qid = $quota_entry['qid']; $qid = $q['qid'];
$surveyid = $quota_entry['sid'];
$language = $quota_entry['language'];
$sql = "SELECT type, title,gid $sql = "SELECT q.*,s.language
FROM ".LIME_PREFIX."questions FROM ".LIME_PREFIX."quota_members as q, ".LIME_PREFIX."surveys as s
WHERE qid='$lime_qid' WHERE q.quota_id='$lime_quota_id'
AND language='$language'"; AND s.sid = q.sid
AND q.qid = $qid";
$qtype = $db->GetRow($sql);
$fieldnames = "0"; $rs = $db->GetAll($sql);
if ($qtype['type'] == "I" || $qtype['type'] == "G" || $qtype['type'] == "Y")
{
$fieldnames= ($surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid']);
$value = $quota_entry['code'];
}
if($qtype['type'] == "L" || $qtype['type'] == "O" || $qtype['type'] =="!")
{
$fieldnames=( $surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid']);
$value = $quota_entry['code'];
}
if($qtype['type'] == "M") $r2 = array();
{
$fieldnames=( $surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid'].$quota_entry['code']);
$value = "Y";
}
if($qtype['type'] == "A" || $qtype['type'] == "B")
{
$temp = explode('-',$quota_entry['code']);
$fieldnames=( $surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid'].$temp[0]);
$value = $temp[1];
}
$ret[] = array('code' => $quota_entry['code'], 'value' => $value, 'qid' => $quota_entry['qid'], 'fieldname' => $fieldnames); foreach($rs as $quota_entry)
{
$lime_qid = $quota_entry['qid'];
$surveyid = $quota_entry['sid'];
$language = $quota_entry['language'];
$sql = "SELECT type, title,gid
FROM ".LIME_PREFIX."questions
WHERE qid='$lime_qid'
AND language='$language'";
$qtype = $db->GetRow($sql);
$fieldnames = "0";
if ($qtype['type'] == "I" || $qtype['type'] == "G" || $qtype['type'] == "Y")
{
$fieldnames= ($surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid']);
$value = $quota_entry['code'];
}
if($qtype['type'] == "L" || $qtype['type'] == "O" || $qtype['type'] =="!")
{
$fieldnames=( $surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid']);
$value = $quota_entry['code'];
}
if($qtype['type'] == "M")
{
$fieldnames=( $surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid'].$quota_entry['code']);
$value = "Y";
}
if($qtype['type'] == "A" || $qtype['type'] == "B")
{
$temp = explode('-',$quota_entry['code']);
$fieldnames=( $surveyid.'X'.$qtype['gid'].'X'.$quota_entry['qid'].$temp[0]);
$value = $temp[1];
}
$r2[] = array('code' => $quota_entry['code'], 'value' => $value, 'qid' => $quota_entry['qid'], 'fieldname' => $fieldnames);
}
$ret[$qid] = $r2;
} }
return $ret; return $ret;
} }

View File

@@ -708,7 +708,7 @@ function get_case_id($operator_id, $create = false)
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_max = 0) OR ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max))
AND ((apn.require_operator_id IS NULL) OR (apn.require_operator_id = '$operator_id')) AND ((apn.require_operator_id IS NULL) OR (apn.require_operator_id = '$operator_id'))
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 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
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 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, qs.sort_order ASC
LIMIT 1"; LIMIT 1";
//apn.appointment_id contains the id of an appointment if we are calling on an appointment //apn.appointment_id contains the id of an appointment if we are calling on an appointment
@@ -762,7 +762,7 @@ function get_case_id($operator_id, $create = false)
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL) 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 !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0 AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
ORDER BY qsep.priority DESC, CONVERT_TZ(NOW(), 'System' , s.Time_zone_name) DESC, rand() * qs.random_select, s.sample_id ORDER BY qsep.priority DESC, CONVERT_TZ(NOW(), 'System' , s.Time_zone_name) DESC, rand() * qs.random_select, qs.sort_order ASC
LIMIT 1"; LIMIT 1";
} }

View File

@@ -135,14 +135,15 @@ function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight
foreach ($fields as $e) foreach ($fields as $e)
{ {
print "<td>"; print "<td>";
if (isset($row[$e])) print $row[$e]; if (isset($row[$e])) {
print "</td>"; if ($total && in_array($e,$total)) {
if ($total && in_array($e,$total)) if (!isset($tot[$e])) $tot[$e] = 0;
{ $tot[$e] += $row[$e];
if (!isset($tot[$e])) print "<span class=\"pull-right\">" . $row[$e] . "</span>";
$tot[$e] = 0; }
$tot[$e] += $row[$e]; else print $row[$e];
} }
print "</td>";
} }
print "</tr>"; print "</tr>";
} }
@@ -151,7 +152,7 @@ function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight
print "</tbody><tfoot><tr>"; print "</tbody><tfoot><tr>";
foreach ($fields as $e) foreach ($fields as $e)
{ {
print "<td><b>"; print "<td><b class=\"pull-right\">";
if (in_array($e,$total)) if (in_array($e,$total))
print $tot[$e]; print $tot[$e];
print "</b></td>"; print "</b></td>";

View File

@@ -155,9 +155,9 @@ if(!isset($_SESSION['loginID']) && $action != "forgotpass" && ($action != "logou
$loginsummary = ' $loginsummary = '
<form class="form-signin" name="forgotpassword" id="forgotpassword" method="post" action="'.$homeurl.'/admin.php" > <form class="form-signin" name="forgotpassword" id="forgotpassword" method="post" action="'.$homeurl.'/admin.php" >
<h2>'.$clang->gT('You have to enter user name and email.').'</h2><p><br /> <br /> <h2>'.$clang->gT('You have to enter user name and email.').'</h2><br/>
<label for="user">'.$clang->gT('Username').'</label><input name="user" id="user" class="form-control" placeholder="User name" required autofocus type="text" size="60" maxlength="60" value="" /> <p><label for="user">'.$clang->gT('Username').'</label><input name="user" id="user" class="form-control" placeholder="'.$clang->gT('Username').'" required autofocus type="text" size="60" maxlength="60" value="" /></p>
<label for="email">'.$clang->gT('Email').'</label><input name="email" id="email" class="form-control" placeholder="Email" required type="text" size="60" maxlength="60" value="" /></p> <p><label for="email">'.$clang->gT('Email').'</label><input name="email" id="email" class="form-control" placeholder="'.$clang->gT('Email').'" required type="text" size="60" maxlength="60" value="" /></p>
<input type="hidden" name="action" value="forgotpass" /> <input type="hidden" name="action" value="forgotpass" />
<p><button class="action btn btn-lg btn-primary btn-block" type="submit">'.$clang->gT('Check Data').'</button></p> <p><button class="action btn btn-lg btn-primary btn-block" type="submit">'.$clang->gT('Check Data').'</button></p>
<p><a href="'.$scriptname.'">'.$clang->gT('Main Admin Screen').'</a></p> <p><a href="'.$scriptname.'">'.$clang->gT('Main Admin Screen').'</a></p>
@@ -208,18 +208,18 @@ if(!isset($_SESSION['loginID']) && $action != "forgotpass" && ($action != "logou
{ {
if (!isset($logoutsummary)) if (!isset($logoutsummary))
{ {
$loginsummary = "<form name='loginform' id='loginform' class='form-signin' method='post' action='$homeurl/admin.php' ><h2>".$clang->gT("You have to login first.")."</h2><p><br /> <br />"; $loginsummary = "<form name='loginform' id='loginform' class='form-signin' method='post' action='$homeurl/admin.php' ><h2>".$clang->gT("You have to login first.")."</h2><br />";
} }
else else
{ {
$loginsummary = "<form name='loginform' id='loginform' class='form-signin' method='post' action='$homeurl/admin.php' ><br /><strong>".$logoutsummary."</strong><br /> <br />"; $loginsummary = "<form name='loginform' id='loginform' class='form-signin' method='post' action='$homeurl/admin.php' ><br /><strong>".$logoutsummary."</strong><br /><br />";
} }
$loginsummary .= "<label for='user'>".$clang->gT("Username")."</label> $loginsummary .= "<p><label for='user'>".$clang->gT("Username")."</label>
<input class='form-control' placeholder='User name' required autofocus name='user' id='user' type='text' size='40' maxlength='40' value='' /> <input class='form-control' placeholder='".$clang->gT("Username")."' required autofocus name='user' id='user' type='text' size='40' maxlength='40' value='' /></p>
<label for='password'>".$clang->gT("Password")."</label> <p><label for='password'>".$clang->gT("Password")."</label>
<input name='password' id='password' class='form-control' placeholder='Password' required type='password' size='40' maxlength='40' /> <input name='password' id='password' class='form-control' placeholder='".$clang->gT("Password")."' required type='password' size='40' maxlength='40' /></p>
<label for='loginlang'>".$clang->gT("Language")."</label> <p><label for='loginlang'>".$clang->gT("Language")."</label>
<select id='loginlang' class='form-control' name='loginlang'>\n"; <select id='loginlang' class='form-control' name='loginlang'>\n";
$loginsummary .='<option value="default" selected="selected">'.$clang->gT('Default').'</option>'; $loginsummary .='<option value="default" selected="selected">'.$clang->gT('Default').'</option>';
$lan=array(); $lan=array();
@@ -233,10 +233,10 @@ if(!isset($_SESSION['loginID']) && $action != "forgotpass" && ($action != "logou
//The following conditional statements select the browser language in the language drop down box and echoes the other options. //The following conditional statements select the browser language in the language drop down box and echoes the other options.
$loginsummary .= "\t\t\t\t<option value='$langkey'>".$languagekind['nativedescription']." - ".$languagekind['description']."</option>\n"; $loginsummary .= "\t\t\t\t<option value='$langkey'>".$languagekind['nativedescription']." - ".$languagekind['description']."</option>\n";
} }
$loginsummary .= "\t\t\t</select>\n $loginsummary .= "\t\t\t</select></p>\n
<p><input type='hidden' name='action' value='login' /> <input type='hidden' name='action' value='login' />
<input type='hidden' name='refererargs' value='".$refererargs."' /> <input type='hidden' name='refererargs' value='".$refererargs."' />
<button class='action btn btn-lg btn-primary btn-block' type='submit'>".$clang->gT("Login")."</button>"; <p><button class='action btn btn-lg btn-primary btn-block' type='submit'>".$clang->gT("Login")."</button></p>";
} }
else{ else{
$loginsummary .= "<p>".sprintf($clang->gT("You have exceeded you maximum login attempts. Please wait %d minutes before trying again"),($timeOutTime/60))."<br /></p>"; $loginsummary .= "<p>".sprintf($clang->gT("You have exceeded you maximum login attempts. Please wait %d minutes before trying again"),($timeOutTime/60))."<br /></p>";
@@ -244,9 +244,9 @@ if(!isset($_SESSION['loginID']) && $action != "forgotpass" && ($action != "logou
if ($display_user_password_in_email === true) if ($display_user_password_in_email === true)
{ {
$loginsummary .= "<p><a href='$scriptname?action=forgotpassword'>".$clang->gT("Forgot Your Password?")."</a><br />&nbsp;\n"; $loginsummary .= "<a href='$scriptname?action=forgotpassword'>".$clang->gT("Forgot Your Password?")."</a><br />&nbsp;\n";
} }
$loginsummary .= " </form><br /><p>"; $loginsummary .= " </form><br />";
$loginsummary .= " <script type='text/javascript'>\n"; $loginsummary .= " <script type='text/javascript'>\n";
$loginsummary .= " document.getElementById('user').focus();\n"; $loginsummary .= " document.getElementById('user').focus();\n";
$loginsummary .= " </script>\n"; $loginsummary .= " </script>\n";

View File

@@ -31,7 +31,7 @@ p {
background: #121a28; background: #121a28;
margin: 0; margin: 0;
padding: 5px; padding: 5px;
margin-bottom:400px; margin-bottom:20px;
clear:left; clear:left;
} }

View File

@@ -139,7 +139,7 @@ if (!isset($_SESSION['loginID']))
if ($result) if ($result)
{ {
// wrong or unknown username // wrong or unknown username
$loginsummary .= "<p>".$clang->gT("Incorrect username and/or password!")."<br />"; $loginsummary .= "<p>".$clang->gT("Incorrect username and/or password!")."</p><br />";
if ($intNthAttempt+1>=$maxLoginAttempt) if ($intNthAttempt+1>=$maxLoginAttempt)
$loginsummary .= sprintf($clang->gT("You have exceeded you maximum login attempts. Please wait %d minutes before trying again"),($timeOutTime/60))."<br />"; $loginsummary .= sprintf($clang->gT("You have exceeded you maximum login attempts. Please wait %d minutes before trying again"),($timeOutTime/60))."<br />";
$loginsummary .= "<br /><a href='$scriptname'>".$clang->gT("Continue")."</a><br />&nbsp;\n"; $loginsummary .= "<br /><a href='$scriptname'>".$clang->gT("Continue")."</a><br />&nbsp;\n";

View File

@@ -38,7 +38,7 @@ include ("config.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
/** /**
* XHTML functions * XHTML functions

View File

@@ -48,7 +48,7 @@ include("functions/functions.operator.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
@@ -200,7 +200,7 @@ else if (HEADER_EXPANDER_MANUAL)
} }
xhtml_head(T_("Case"), $body, array("include/bootstrap/css/bootstrap.min.css","css/index_interface2.css","css/tabber_interface2.css","include/jquery-ui/jquery-ui.min.css") , $js); xhtml_head(T_("Case"), $body, array("include/bootstrap/css/bootstrap.min.css","include/bootstrap/css/bootstrap-theme.min.css","include/font-awesome/css/font-awesome.css","css/index_interface2.css","css/tabber_interface2.css","include/jquery-ui/jquery-ui.min.css"),$js,false,false, false,false,false);
print $script; print $script;
$case_id = get_case_id($operator_id,true); $case_id = get_case_id($operator_id,true);
@@ -217,212 +217,215 @@ $ref = $scr['referral'];
$availability = is_using_availability($case_id); $availability = is_using_availability($case_id);
?> ?>
<div id="casefunctions" class="col-sm-2"> <div class="container-fluid ">
<ul id="casefunctions" class="header "> <div class="row ">
<li id="item_1"><a href="javascript:poptastic('call_interface2.php');"><?php echo T_("Outcome"); ?> <img src="css/images/play.jpg" /></a></li>
<li id="item_2_e" class="item_2_full_height"><a href="javascript:poptastic('appointment.php');"><?php echo T_("Appointment"); ?><img src="css/images/plius.jpg" /></a></li>
<?php if ($sc == 1) { ?>
<li id='item_4_e' class="item_2_full_height"><a href="javascript:poptastic('email.php?interface2=true');"><?php echo T_("Email"); ?> <img src="css/images/plius.jpg" /></a></li>
<?php } ?>
<?php if ($ref == 1) { ?>
<li id='item_5_e' class="item_2_full_height"><a href="javascript:poptastic('referral.php?interface2=true');"><?php echo T_("Referral"); ?> <img src="css/images/plius.jpg" /></a></li>
<?php } ?>
<li id="item_3_e" class="item_3_full_height"><a href="?endwork=endwork"><?php echo T_("End work"); ?> <img src="css/images/end.jpg" /></a></li>
</ul>
</div>
<div id="qstatus" class="header col-sm-4"> <div id="casefunctions" class="col-sm-2 panel-body">
<?php xhtml_object("status_interface2.php","main-qstatus");?>
<?php if (HEADER_EXPANDER_MANUAL){ ?> <div class='headerexpand'><img id='headerexpandimage' src='./images/arrow-up-2.jpg' alt='<?php echo T_('Arrow for expanding or contracting'); ?>'/></div> <?php } ?> <a href="javascript:poptastic('call_interface2.php');" class="btn btn-default btn-block" style="border-radius:15px; color:blue"><strong><?php echo T_("Outcome"); ?> <i class="fa fa-lg fa-check-square-o fa-fw"></i></strong></a></br>
</div> <a href="javascript:poptastic('appointment.php');" class="btn btn-default btn-block " style="border-radius:15px; color:green"><strong><?php echo T_("Appointment"); ?> <i class="fa fa-lg fa-clock-o fa-fw"></i></strong></a></br>
<?php if ($sc == 1) { ?>
<a href="javascript:poptastic('email.php?interface2=true');" class="btn btn-default btn-block" style="border-radius:15px; color:blue"><strong><?php echo T_("Invitation Email"); ?> <i class="fa fa-lg fa-envelope-o fa-fw"></i></strong></a></br>
<?php } ?>
<?php if ($ref == 1) { ?>
<a href="javascript:poptastic('referral.php?interface2=true');" class="btn btn-default btn-block" style="border-radius:15px; color:blue"><strong><?php echo T_("Referral"); ?> <i class="fa fa-lg fa-link fa-fw"></i></strong></a></br>
<?php } ?>
<a href="?endwork=endwork"; class="btn btn-default btn-block" style="border-radius:15px; color:red"><strong><?php echo T_("End work"); ?> <i class="fa fa-lg fa-ban fa-fw"></i></strong></a>
</div>
<div id="qstatus" class="col-sm-3 panel-body">
<?php xhtml_object("status_interface2.php","main-qstatus", "col-sm-12" );?>
</div>
<?php if (HEADER_EXPANDER_MANUAL){ ?><div class="headerexpand"><i id='headerexpandimage' class="fa fa-lg fa-toggle-down fa-fw" title='<?php echo T_('Arrow for expanding or contracting'); ?>'></i></div> <?php } ?>
<div id="calllist" class="col-sm-7">
<div class="tabber" id="tab-main">
<?php
if (isset($appointment)) {} else {$appointment = "";}
if (TAB_CASENOTES) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'casenotes' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'casenotes' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Notes"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?php xhtml_object("casenote.php","main-casenotes","col-sm-12");?></div>
</div>
<?php }?>
<?php if ($availability) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'availability' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'availability' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Availability"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?php xhtml_object("availability.php","main-availability","col-sm-12");?></div>
</div>
<?php }?>
<?php if (TAB_CONTACTDETAILS) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'contactdetails' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'contactdetails' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Contact details"); ?></h2>
<div id="div-contactdetails" class="tabberdiv"><?php xhtml_object("contactdetails.php","main-contactdetails","col-sm-12");?></div>
</div>
<?php }?>
<?php if (TAB_CALLLIST) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'calllist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'calllist' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Call history"); ?></h2>
<div id="div-calllist" class="tabberdiv"><?php xhtml_object("calllist.php","main-calllist","col-sm-12");?></div>
</div>
<?php }?>
<?php if (TAB_SHIFTS) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'shifts' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'shifts' && $appointment))
print "tabbertabdefault"; ?>" id="tab-shifts">
<h2><?php echo T_("Shifts"); ?></h2>
<div id="div-shifts" class="tabberdiv"><?php xhtml_object("shifts.php","main-shifts","col-sm-12");?></div>
</div>
<?php }?>
<?php if (TAB_APPOINTMENTLIST) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'appointmentlist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'appointmentlist' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Appointments"); ?></h2>
<div id="div-appointmentlist" class="tabberdiv"><?php xhtml_object("appointmentlist.php","main-appointmentlist","col-sm-12");?></div>
</div>
<?php }?>
<?php if (TAB_PERFORMANCE) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'performance' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'performance' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Performance"); ?></h2>
<div id="div-performance" class="tabberdiv"><?php xhtml_object("performance.php","main-performance","col-sm-12");?></div>
</div>
<?php }?>
<?php if (TAB_CALLHISTORY) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'callhistory' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'callhistory' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Work history"); ?></h2>
<div id="div-callhistory" class="tabberdiv"><?php xhtml_object("callhistory.php","main-callhistory","col-sm-12");?></div>
</div>
<?php }?>
<?php if (TAB_PROJECTINFO) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'projectinfo' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'projectinfo' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Project information"); ?></h2>
<div id="div-projectinfo" class="tabberdiv"><?php xhtml_object("project_info.php","main-projectinfo","col-sm-12");?></div>
</div>
<?php }?>
<div id="calllist" class="header col-sm-6"> <?php if (TAB_INFO) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'info' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'info' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Info"); ?></h2>
<div id="div-info" class="tabberdiv"><?php xhtml_object("info.php","main-info","col-sm-12");?></div>
</div>
<?php }?>
</div>
</div>
</div>
<div class="tabber" id="tab-main">
<?php if (TAB_CASENOTES) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'casenotes' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'casenotes' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Notes"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?php xhtml_object("casenote.php","main-casenotes");?></div>
</div>
<?php }?>
<?php if ($availability) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'availability' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'availability' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Availability"); ?></h2>
<div id="div-casenotes" class="tabberdiv"><?php xhtml_object("availability.php","main-casenotes");?></div>
</div>
<?php }?>
<?php if (TAB_CONTACTDETAILS) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'contactdetails' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'contactdetails' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Contact details"); ?></h2>
<div id="div-contactdetails" class="tabberdiv"><?php xhtml_object("contactdetails.php","main-contactdetails");?></div>
</div>
<?php }?>
<?php if (TAB_CALLLIST) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'calllist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'calllist' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Call history"); ?></h2>
<div id="div-calllist" class="tabberdiv"><?php xhtml_object("calllist.php","main-calllist");?></div>
</div>
<?php }?>
<?php if (TAB_SHIFTS) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'shifts' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'shifts' && $appointment))
print "tabbertabdefault"; ?>" id="tab-shifts">
<h2><?php echo T_("Shifts"); ?></h2>
<div id="div-shifts" class="tabberdiv"><?php xhtml_object("shifts.php","main-shifts");?></div>
</div>
<?php }?>
<?php if (TAB_APPOINTMENTLIST) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'appointmentlist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'appointmentlist' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Appointments"); ?></h2>
<div id="div-appointmentlist" class="tabberdiv"><?php xhtml_object("appointmentlist.php","main-appointmentlist");?></div>
</div>
<?php }?>
<?php if (TAB_PERFORMANCE) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'performance' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'performance' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Performance"); ?></h2>
<div id="div-performance" class="tabberdiv"><?php xhtml_object("performance.php","main-performance");?></div>
</div>
<?php }?>
<?php if (TAB_CALLHISTORY) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'callhistory' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'callhistory' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Work history"); ?></h2>
<div id="div-callhistory" class="tabberdiv"><?php xhtml_object("callhistory.php","main-callhistory");?></div>
</div>
<?php }?>
<?php if (TAB_PROJECTINFO) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'projectinfo' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'projectinfo' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Project information"); ?></h2>
<div id="div-projectinfo" class="tabberdiv"><?php xhtml_object("project_info.php","main-projectinfo");?></div>
</div>
<?php }?>
<?php if (TAB_INFO) { ?>
<div class="tabbertab <?php if ((DEFAULT_TAB == 'info' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'info' && $appointment))
print "tabbertabdefault"; ?>">
<h2><?php echo T_("Info"); ?></h2>
<div id="div-info" class="tabberdiv"><?php xhtml_object("info.php","main-info");?></div>
</div>
<?php }?>
</div>
</div>
<div id="content" class="content ">
<?php
$ca = get_call_attempt($operator_id,true);
$call_id = get_call($operator_id);
$appointment = false;
if ($ca)
{
$appointment = is_on_appointment($ca);
$respondent_id = get_respondent_id($ca);
}
if (!$call_id)
{
if ($appointment)
{
//create a call on the appointment number
$sql = "SELECT cp.*, a.respondent_id
FROM contact_phone as cp, appointment as a
WHERE cp.case_id = '$case_id'
AND a.appointment_id = '$appointment'
AND a.contact_phone_id = cp.contact_phone_id";
}
else
{
//create a call on the first available number by priority
$sql = "SELECT c. *
FROM contact_phone AS c
LEFT JOIN (
SELECT contact_phone.contact_phone_id
FROM contact_phone
LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )
LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )
WHERE contact_phone.case_id = '$case_id'
AND outcome.tryagain =0
) AS l ON l.contact_phone_id = c.contact_phone_id
LEFT JOIN
(
SELECT contact_phone_id
FROM `call`
WHERE call_attempt_id = '$ca'
AND outcome_id NOT IN (15,18)
) as ca on ca.contact_phone_id = c.contact_phone_id
WHERE c.case_id = '$case_id'
AND l.contact_phone_id IS NULL
AND ca.contact_phone_id IS NULL
order by c.priority ASC";
}
$rs = $db->GetRow($sql);
if (!empty($rs))
{
$contact_phone_id = $rs['contact_phone_id'];
if (!isset($rs['respondent_id']))
{
$sql = "SELECT respondent_id
FROM respondent
WHERE case_id = $case_id";
$respondent_id = $db->GetOne($sql);
}
else
{
$respondent_id = $rs['respondent_id'];
}
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true);
}
}
<div class="row">
if (!is_respondent_selection($operator_id)) <?php
$data = get_limesurvey_url($operator_id);
else
$data = get_respondentselection_url($operator_id,true,true); //use second interface
xhtml_object($data,"main-content"); $ca = get_call_attempt($operator_id,true);
$call_id = get_call($operator_id);
$appointment = false;
if ($ca)
{
$appointment = is_on_appointment($ca);
$respondent_id = get_respondent_id($ca);
}
?> if (!$call_id)
{
if ($appointment)
{
//create a call on the appointment number
$sql = "SELECT cp.*, a.respondent_id
FROM contact_phone as cp, appointment as a
WHERE cp.case_id = '$case_id'
AND a.appointment_id = '$appointment'
AND a.contact_phone_id = cp.contact_phone_id";
}
else
{
//create a call on the first available number by priority
$sql = "SELECT c. *
FROM contact_phone AS c
LEFT JOIN (
SELECT contact_phone.contact_phone_id
FROM contact_phone
LEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )
LEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )
WHERE contact_phone.case_id = '$case_id'
AND outcome.tryagain =0
) AS l ON l.contact_phone_id = c.contact_phone_id
LEFT JOIN
(
SELECT contact_phone_id
FROM `call`
WHERE call_attempt_id = '$ca'
AND outcome_id NOT IN (15,18)
) as ca on ca.contact_phone_id = c.contact_phone_id
WHERE c.case_id = '$case_id'
AND l.contact_phone_id IS NULL
AND ca.contact_phone_id IS NULL
order by c.priority ASC";
}
$rs = $db->GetRow($sql);
if (!empty($rs))
{
$contact_phone_id = $rs['contact_phone_id'];
if (!isset($rs['respondent_id']))
{
$sql = "SELECT respondent_id
FROM respondent
WHERE case_id = $case_id";
$respondent_id = $db->GetOne($sql);
}
else
{
$respondent_id = $rs['respondent_id'];
}
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true);
}
}
if (!is_respondent_selection($operator_id))
$data = get_limesurvey_url($operator_id);
else
$data = get_respondentselection_url($operator_id,true,true); //use second interface
xhtml_object($data,"main-content", "embeddedobject content");
?>
</div>
</div> </div>
<?php <?php
xhtml_foot(); xhtml_foot();
//if ($db->HasFailedTrans()){ print "<p>FAILED AT END of index</p>"; exit();} //if ($db->HasFailedTrans()){ print "<p>FAILED AT END of index</p>"; exit();}
$db->CompleteTrans(); $db->CompleteTrans();

View File

@@ -52,7 +52,7 @@ include ("db.inc.php");
/** /**
* Authentication * Authentication
*/ */
include ("auth-interviewer.php"); require ("auth-interviewer.php");
$js = false; $js = false;

View File

@@ -1,20 +1,17 @@
function headerexpand() function headerexpand()
{ {
$(".header").css("height","38%"); $(".headerexpand").css("top","35%");
$(".content").css("height","60%"); $(".content").css("height","63%");
$(".content").css("top","40%"); $(".content").css("top","37%");
$(".box:not(.important)").css("display",""); $(".box:not(.important)").css("display","");
// $(".item_2_half_height").removeClass("item_2_half_height").addClass("item_2_full_height");
$(".item_3_half_height").removeClass("item_3_half_height").addClass("item_3_full_height");
} }
function headercontract() function headercontract()
{ {
$(".header").css("height","13%"); $(".headerexpand").css("top","18%");
$(".content").css("height","85%"); $(".content").css("height","80%");
$(".content").css("top","15%"); $(".content").css("top","20%");
$(".box:not(.important)").css("display","none"); $(".box:not(.important)").css("display","none");
// $(".item_2_full_height").removeClass("item_2_full_height").addClass("item_2_half_height");
$(".item_3_full_height").removeClass("item_3_full_height").addClass("item_3_half_height");
} }

View File

@@ -6,20 +6,20 @@ $(document).ready(function(){
function headerforcecontract() function headerforcecontract()
{ {
$("#headerexpandimage").attr('src',"./images/arrow-down-2.jpg"); $("#headerexpandimage").attr('class',"fa fa-lg fa-fw fa-toggle-down ");
headercontract(); headercontract();
} }
function headertogglemanual() function headertogglemanual()
{ {
if ($("#headerexpandimage").attr('src') == './images/arrow-up-2.jpg') if ($("#headerexpandimage").attr('class') == 'fa fa-lg fa-fw fa-toggle-up')
{ {
$("#headerexpandimage").attr('src',"./images/arrow-down-2.jpg"); $("#headerexpandimage").attr('class',"fa fa-lg fa-fw fa-toggle-down");
headercontract(); headercontract();
} }
else else
{ {
$("#headerexpandimage").attr('src',"./images/arrow-up-2.jpg"); $("#headerexpandimage").attr('class',"fa fa-lg fa-fw fa-toggle-up");
headerexpand(); headerexpand();
} }

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
locale/hr/LC_MESSAGES/hr.mo Normal file

Binary file not shown.

4152
locale/hr/LC_MESSAGES/hr.po Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More