* @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_("Appointment"),true,array("css/respondent.css"),$js);
//select a respondent from a list or create a new one
print("" . T_("Select a respondent") . "
");
$sr = display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false,true);
if ($sr != false) $_GET['respondent_id'] = $sr;
if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
//ability to create a new one
?>
" . T_("Select phone number:") . "";
if (isset($_GET['contact_phone_id'])) $contact_phone_id = bigintval($_GET['contact_phone_id']);
else $contact_phone_id = -1;
print "";
if(isset($_GET['contact_phone_id']))
{
$contact_phone_id = bigintval($_GET['contact_phone_id']);
if ($contact_phone_id == 0)
{
//ability to add a new one
?>
CompleteTrans();
?>