mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
fixed lp:1505656; reworked function display_respondent_list
This commit is contained in:
@@ -69,6 +69,8 @@ $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"));
|
||||||
@@ -127,24 +129,23 @@ xhtml_head(T_("Create appointment"),false,array("include/bootstrap/css/bootstrap
|
|||||||
|
|
||||||
//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);
|
||||||
@@ -244,7 +245,7 @@ else if(isset($_GET['respondent_id']))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<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>";
|
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();
|
||||||
|
|
||||||
|
|||||||
@@ -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 " <b>",$rs[0]['firstName']," ",$rs[0]['lastName'],"</b>"; $respondent_id =$rs[0]['respondent_id'];}
|
else { echo " <b>",$rs[0]['firstName']," ",$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>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user