* @copyright Deakin University 2007,2008
* @package queXS
* @subpackage user
* @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Calendar functions
*/
include("functions/functions.calendar.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
/**
* Input functions
*/
include("functions/functions.input.php");
$db->StartTrans();
$operator_id = get_operator_id();
$questionnaire_id = get_questionnaire_id($operator_id);
$case_id = get_case_id($operator_id);
if (!$case_id){
xhtml_head(T_("Appointment error"));
print("
" . T_("You have not been assigned a case therefore cannot create an appointment") . "
");
xhtml_foot();
$db->CompleteTrans();
exit();
}
if(isset($_POST['firstName']) && isset($_POST['lastName']) && isset($_POST['Time_zone_name']))
{
//add a new respondent
add_respondent($case_id,$_POST['firstName'],$_POST['lastName'],$_POST['Time_zone_name']);
}
if(isset($_GET['phonenum']))
{
//add a new phone number
add_contact_phone($case_id,$_GET['phonenum']);
}
if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && isset($_POST['month']) && isset($_POST['year']) && isset($_POST['respondent_id']) && isset($_POST['contact_phone_id']))
{
//make appointment
$day = bigintval($_POST['day']);
$month = bigintval($_POST['month']);
$year = bigintval($_POST['year']);
$respondent_id = bigintval($_POST['respondent_id']);
$contact_phone_id = bigintval($_POST['contact_phone_id']);
$start = $_POST['start'];
$end = $_POST['end'];
$call_attempt_id = get_call_attempt($operator_id,false);
$require_operator_id = false;
if (isset($_POST['require_operator_id'])) $require_operator_id = bigintval($_POST['require_operator_id']);
make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$day,$month,$year,$start,$end,$require_operator_id);
$db->CompleteTrans();
xhtml_head(T_("Appointment made"),true,false,false,"onload='parent.closePopup();'");
xhtml_foot();
exit();
}
$js = array("js/window.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js";
$js[] = "js/childnap.js";
}
xhtml_head(T_("Create appointment"),false,array("include/bootstrap-3.3.2/css/bootstrap.min.css", "css/respondent.css"),$js);//"include/clockpicker/dist/bootstrap-clockpicker.min.css",
//select a respondent from a list or create a new one
print "" . T_("Respondent") . ":";
$sr = display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false,true);
print " ";
if ($sr != false) $_GET['respondent_id'] = $sr;
if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
//ability to create a new one
?>
GetRow($sql);
print "".T_("Timezone").": ".$ct['tzn']. " ".T_("Current Time").": " . $ct['tme'] . "
";
if (isset($_GET['d']) && isset($_GET['m']) && isset($_GET['y']))
{
$day = bigintval($_GET['d']);
$month = bigintval($_GET['m']);
$year = bigintval($_GET['y']);
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);
if (isset($_GET['end']) && isset($_GET['start']))
{
$list = return_contact_phone_list($case_id);
print "" . T_("Select phone number:") . " ";
if (isset($_GET['contact_phone_id'])) $contact_phone_id = bigintval($_GET['contact_phone_id']);
else $contact_phone_id = -1;
print "
";
foreach($list as $l)
{
$id = $l['contact_phone_id'];
$selected = "";
if ($id == $contact_phone_id) $selected="selected='selected'";
print "{$l['phone']} - {$l['description']} ";
}
print "" . T_("Add new phone number") . "
";
if(isset($_GET['contact_phone_id']))
{
$contact_phone_id = bigintval($_GET['contact_phone_id']);
print "";
if ($contact_phone_id == 0)
{
//ability to add a new one
?>
"; ?>
"/>
";
}
}
}
else
{
display_calendar($respondent_id,$questionnaire_id);
}
}
xhtml_foot();
$db->CompleteTrans();
?>