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

new Appointment window popup - simple, clean and nice

day names ready to add to translation .po file
swithch to string instead of selector  if only 1 respondent for case
time selectors switched to 15 min intervals, excluded last value as it will equal possible time limit
This commit is contained in:
Alex
2015-05-20 15:31:27 +03:00
parent 6710ae9415
commit 485b6ded38
2 changed files with 84 additions and 110 deletions

View File

@@ -115,16 +115,15 @@ if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && iss
$js = array("js/window.js"); $js = array("js/window.js");
if (AUTO_LOGOUT_MINUTES !== false) if (AUTO_LOGOUT_MINUTES !== false)
{ {
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js"; $js[] = "include/jquery-ui/js/jquery-1.4.2.min.js";
$js[] = "js/childnap.js"; $js[] = "js/childnap.js";
} }
xhtml_head(T_("Appointment"),true,array("css/respondent.css"),$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 //select a respondent from a list or create a new one
print("<p>" . T_("Select a respondent") . "</p>"); print "<h4>" . T_("Respondent") . ":";
$sr = display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false,true); $sr = display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false,true);
print "</h4>";
if ($sr != false) $_GET['respondent_id'] = $sr; 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)
@@ -141,6 +140,11 @@ if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
else if(isset($_GET['respondent_id'])) else if(isset($_GET['respondent_id']))
{ {
$respondent_id = bigintval($_GET['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";
$ct = $db->GetRow($sql);
print "<p>".T_("Timezone").":&ensp;".$ct['tzn']. "&emsp;".T_("Current Time").":&ensp;<b class=\"fa text-primary\">" . $ct['tme'] . "</b></p>";
if (isset($_GET['d']) && isset($_GET['m']) && isset($_GET['y'])) if (isset($_GET['d']) && isset($_GET['m']) && isset($_GET['y']))
{ {
@@ -156,12 +160,12 @@ else if(isset($_GET['respondent_id']))
{ {
$list = return_contact_phone_list($case_id); $list = return_contact_phone_list($case_id);
print "<p>" . T_("Select phone number:") . "</p>"; print "<div class=\"clearfix form-group\"><label class=\"pull-left\" style=\"padding-top: 5px;\">" . T_("Select phone number:") . "&ensp;</label>";
if (isset($_GET['contact_phone_id'])) $contact_phone_id = bigintval($_GET['contact_phone_id']); if (isset($_GET['contact_phone_id'])) $contact_phone_id = bigintval($_GET['contact_phone_id']);
else $contact_phone_id = -1; else $contact_phone_id = -1;
print "<div><select id='phonenum' name='phonenum' onchange=\"LinkUp('phonenum')\"><option>" . T_("None") . "</option>"; print "<div class=\"pull-left\"><select class=\"form-control\" id='phonenum' name='phonenum' onchange=\"LinkUp('phonenum')\"><option></option>";
foreach($list as $l) foreach($list as $l)
{ {
$id = $l['contact_phone_id']; $id = $l['contact_phone_id'];
@@ -170,27 +174,29 @@ else if(isset($_GET['respondent_id']))
print "<option value='?contact_phone_id=$id&amp;start={$_GET['start']}&amp;end={$_GET['end']}&amp;d=$day&amp;y=$year&amp;m=$month&amp;respondent_id=$respondent_id' $selected>{$l['phone']} - {$l['description']}</option>"; print "<option value='?contact_phone_id=$id&amp;start={$_GET['start']}&amp;end={$_GET['end']}&amp;d=$day&amp;y=$year&amp;m=$month&amp;respondent_id=$respondent_id' $selected>{$l['phone']} - {$l['description']}</option>";
} }
print "<option value='?contact_phone_id=0&amp;start={$_GET['start']}&amp;end={$_GET['end']}&amp;d=$day&amp;y=$year&amp;m=$month&amp;respondent_id=$respondent_id' class='addresp'>" . T_("Add new phone number") . "</option></select></div>"; print "<option value='?contact_phone_id=0&amp;start={$_GET['start']}&amp;end={$_GET['end']}&amp;d=$day&amp;y=$year&amp;m=$month&amp;respondent_id=$respondent_id' class='addresp'>" . T_("Add new phone number") . "</option></select></div></div>";
if(isset($_GET['contact_phone_id'])) if(isset($_GET['contact_phone_id']))
{ {
$contact_phone_id = bigintval($_GET['contact_phone_id']); $contact_phone_id = bigintval($_GET['contact_phone_id']);
print "<div class=\"clearfix form-group\">";
if ($contact_phone_id == 0) if ($contact_phone_id == 0)
{ {
//ability to add a new one //ability to add a new one
?> ?>
<p><?php echo T_("Add new phone number (with area code, eg 0398761234):"); ?></p> <p><?php echo T_("Add new phone number (with area code, eg 0398761234):"); ?></p>
<form id="addPhone" method="get" action=""> <form id="addPhone" method="get" action="" class="form-inline form-group">
<p><input type="text" name="phonenum"/></p> <div class="pull-left"><input type="tel" maxlength="10" size="12" pattern="[0-9]{10}" class="form-control" name="phonenum"/></div>
<p><input type="submit" value="<?php echo T_("Add this phone number"); ?>"/> &emsp;<input type="submit" class="btn btn-info" value="<?php echo T_("Add this phone number"); ?>"/>
<input type="hidden" name="start" value="<?php print $_GET['start']; ?>"/> <input type="hidden" name="start" value="<?php print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<?php print $_GET['end']; ?>"/> <input type="hidden" name="end" value="<?php print $_GET['end']; ?>"/>
<input type="hidden" name="d" value="<?php print $day; ?>"/> <input type="hidden" name="d" value="<?php print $day; ?>"/>
<input type="hidden" name="m" value="<?php print $month; ?>"/> <input type="hidden" name="m" value="<?php print $month; ?>"/>
<input type="hidden" name="y" value="<?php print $year; ?>"/> <input type="hidden" name="y" value="<?php print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<?php print $respondent_id; ?>"/></p> <input type="hidden" name="respondent_id" value="<?php print $respondent_id; ?>"/>
</form> </form>
<?php <?php
} }
@@ -203,11 +209,9 @@ else if(isset($_GET['respondent_id']))
} }
?> ?>
<p><?php echo T_("Appointment:"); ?></p>
<form id="appointment" method="post" action=""> <form id="appointment" method="post" action="">
<?php print "<p>" . T_("Accept appointment from ") .convert_time($_GET['start']).T_(" till ").convert_time($_GET['end']).T_(" on ") . "$day/$month/$year? " . T_("on") . " $phonenum </p>"; ?> <?php print "<div class=\"alert alert-info\">".T_("Accept appointment from ")."<b>".$_GET['start']."</b>".T_(" till ")."<b>".$_GET['end']."</b>".T_(" on ") . "<b> $day/$month/$year </b>" . T_("on") . "<b> $phonenum </b> ?</div>"; ?>
<p> <label for='require_operator_id'><?php echo T_("Appointment with myself only?"); ?>&emsp;</label>
<?php print "<p><label for='require_operator_id'>" . T_("Appointment with myself only?"); ?></label>
<input type="checkbox" id="require_operator_id" name="require_operator_id" value="<?php echo $operator_id;?>"> <input type="checkbox" id="require_operator_id" name="require_operator_id" value="<?php echo $operator_id;?>">
<input type="hidden" name="start" value="<?php print $_GET['start']; ?>"/> <input type="hidden" name="start" value="<?php print $_GET['start']; ?>"/>
<input type="hidden" name="end" value="<?php print $_GET['end']; ?>"/> <input type="hidden" name="end" value="<?php print $_GET['end']; ?>"/>
@@ -216,10 +220,12 @@ else if(isset($_GET['respondent_id']))
<input type="hidden" name="year" value="<?php print $year; ?>"/> <input type="hidden" name="year" value="<?php print $year; ?>"/>
<input type="hidden" name="respondent_id" value="<?php print $respondent_id; ?>"/> <input type="hidden" name="respondent_id" value="<?php print $respondent_id; ?>"/>
<input type="hidden" name="contact_phone_id" value="<?php print $contact_phone_id; ?>"/> <input type="hidden" name="contact_phone_id" value="<?php print $contact_phone_id; ?>"/>
<input type="submit" value="<?php echo TQ_("Schedule Appointment"); ?>"/></p> <input type="submit" class="btn btn-primary pull-right" value="<?php echo T_("Schedule Appointment"); ?>"/>
</form> </form>
<?php <?php
} }
print "</div>";
} }
} }

View File

@@ -2,9 +2,6 @@
/** /**
* Functions relating to appointment times and calendars * Functions relating to appointment times and calendars
* *
*
*
*
* This file is part of queXS * This file is part of queXS
* *
* queXS is free software; you can redistribute it and/or modify * queXS is free software; you can redistribute it and/or modify
@@ -31,7 +28,6 @@
* *
*/ */
/** /**
* Configuration file * Configuration file
*/ */
@@ -42,7 +38,6 @@ include_once(dirname(__FILE__).'/../config.inc.php');
*/ */
include_once(dirname(__FILE__).'/../db.inc.php'); include_once(dirname(__FILE__).'/../db.inc.php');
/** /**
* Add a phone number to a case (via the contact_phone table) * Add a phone number to a case (via the contact_phone table)
* *
@@ -131,7 +126,7 @@ function convert_time($time)
//Use the TIME_FORMAT string as defined in mysql http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format //Use the TIME_FORMAT string as defined in mysql http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format
$from = array("%H","%h","%I","%i","%S","%s","%p"); $from = array("%H","%h","%I","%i","%S","%s","%p");
$to = array(substr($time,0,2),$h,$h,$m,$s,$s,$p); $to = array(substr($time,0,2),$h,$h,$m,$m,$s,$s,$p);
return str_replace($from,$to,TIME_FORMAT); return str_replace($from,$to,TIME_FORMAT);
} }
@@ -193,32 +188,34 @@ function display_respondent_list($case_id,$respondent_id = false,$first = false)
WHERE case_id = '$case_id'"; WHERE case_id = '$case_id'";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
print "<div><select id='respondent_id' name='respondent_id' onchange=\"LinkUp('respondent_id')\"><option>" . T_("None") . "</option>"; if (count($rs) >1 ){
if (!empty($rs)) print "<div><p>" . T_("Select a respondent") . ":
{ <select id='respondent_id' name='respondent_id' onchange=\"LinkUp('respondent_id')\"><option>" . T_("None") . "</option>";
foreach($rs as $r) if (!empty($rs))
{ {
$rid = $r['respondent_id']; foreach($rs as $r)
if ($respondent_id == false && $first == true)
{ {
$first = false; $rid = $r['respondent_id'];
$selected = "selected='selected'"; if ($respondent_id == false && $first == true)
$respondent_id = $rid; {
$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>";
} }
else
$selected = "";
if ($rid == $respondent_id) $selected="selected='selected'";
print "<option value='?respondent_id=$rid' $selected>{$r['firstName']} {$r['lastName']}</option>";
} }
print "<option value='?respondent_id=0' class='addresp'>" . T_("Add respondent") . "</option></select></p></div>";
} }
print "<option value='?respondent_id=0' class='addresp'>" . T_("Add respondent") . "</option></select></div>"; else { echo "&emsp;<b>",$rs[0]['firstName'],"&ensp;",$rs[0]['lastName'],"</b>"; $respondent_id =$rs[0]['respondent_id'];}
return $respondent_id; return $respondent_id;
} }
/** /**
* Print an XHTML form for adding or modifying respondent details * Print an XHTML form for adding or modifying respondent details
* *
@@ -256,13 +253,12 @@ function display_respondent_form($respondent_id = false,$case_id = false)
$rs = $db->GetRow($sql); $rs = $db->GetRow($sql);
} }
$sql = "SELECT Time_zone_name $sql = "SELECT Time_zone_name
FROM timezone_template"; FROM timezone_template";
$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> 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>"; <div><label for='lastName'>" . T_("Last name:") . " </label><input type=\"text\" id='lastName' name=\"lastName\" value=\"$ln\"/></div>";
/** /**
@@ -272,7 +268,6 @@ function display_respondent_form($respondent_id = false,$case_id = false)
} }
/** /**
* Print shift details in XHTML based on the given day * Print shift details in XHTML based on the given day
* Display start time, and if start time selected display end time also * Display start time, and if start time selected display end time also
@@ -294,16 +289,14 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti
{ {
global $db; global $db;
$restricted = is_shift_restricted($questionnaire_id); $restricted = is_shift_restricted($questionnaire_id);
if ($restricted) if ($restricted)
{ {
/** /**
* Select shift start and end times for this day * Select shift start and end times for this day
*/ */
$sql = " SELECT s.shift_id, HOUR(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sh, MINUTE(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( TIME( CONVERT_TZ( s.end, 'UTC', r.Time_zone_name ) ) , TIME( CONVERT_TZ( s.start, 'UTC', r.Time_zone_name ) ) ) ) /300) as intervals, TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) as start, TIME(CONVERT_TZ(s.end,'UTC',r.Time_zone_name)) as end $sql = "SELECT s.shift_id, HOUR(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sh, MINUTE(TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ(s.start,'UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( s.end, s.start)) / 900) as intervals, TIME(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) as start, TIME(CONVERT_TZ(s.end,'UTC',r.Time_zone_name)) as end
FROM shift as s, respondent as r, `case` as c FROM shift as s, respondent as r, `case` as c
WHERE r.respondent_id = '$respondent_id' WHERE r.respondent_id = '$respondent_id'
AND r.case_id = c.case_id AND r.case_id = c.case_id
@@ -312,27 +305,21 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti
AND MONTH(CONVERT_TZ(s.start,'UTC', r.Time_zone_name)) = '$month' AND MONTH(CONVERT_TZ(s.start,'UTC', r.Time_zone_name)) = '$month'
AND YEAR(CONVERT_TZ(s.start,'UTC', r.Time_zone_name)) = '$year' AND YEAR(CONVERT_TZ(s.start,'UTC', r.Time_zone_name)) = '$year'
ORDER BY s.start ASC"; ORDER BY s.start ASC";
} }
else else
$sql = "SELECT 0 as sh, 0 as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ('$year-$month-$day 00:00:00','UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( TIME( CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ) , 'System', r.Time_zone_name ) ) , TIME( CONVERT_TZ( CURDATE(), 'System', r.Time_zone_name ) ) ) ) /300) as intervals, TIME(CONVERT_TZ(CURDATE(),'System',r.Time_zone_name)) as start, TIME(CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ),'System',r.Time_zone_name)) as end $sql = "SELECT 0 as sh, 0 as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ('$year-$month-$day 08:00:00','UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( TIME( CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ) , 'System', r.Time_zone_name ) ) , TIME( CONVERT_TZ( CURDATE(), 'System', r.Time_zone_name ) ) ) ) /900) as intervals, TIME(CONVERT_TZ(CURDATE(),'System',r.Time_zone_name)) as start, TIME(CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ),'System',r.Time_zone_name)) as end
FROM respondent as r FROM respondent as r
WHERE r.respondent_id = '$respondent_id'"; WHERE r.respondent_id = '$respondent_id'";
$rs = $db->GetAll($sql); $rs = $db->GetAll($sql);
print "<div class=\"shifts\">";
foreach($rs as $r) foreach($rs as $r)
{ {
print "<p>" . T_("Shift from:") . " ".convert_time($r['start']).T_(" till ")." ".convert_time($r['end'])."</p>"; print "<p>" . T_("Shift from:") . " <b>".$r['start']."</b>&ensp;" . T_(" till ")." <b>".$r['end']."</b></p>";
} }
print "</div>";
print "<div class=\"form-group clearfix\"><label class=\"control-label pull-left\" style=\"padding-top: 5px;\">" . T_("Start Time") . ": &ensp;</label><div class=\"form-inline pull-left\"><select class=\"form-control\" name=\"start\" id=\"start\" onchange=\"LinkUp('start')\"><option ></option>";
print "<p>";
print "<select name=\"start\" id=\"start\" onchange=\"LinkUp('start')\"><option value=\"?y=$year&amp;m=$month&amp;d=$day&amp;respondent_id=$respondent_id\">" . T_("Start Time") . "</option>";
foreach ($rs as $r) foreach ($rs as $r)
{ {
$sh = $r['sh']; $sh = $r['sh'];
@@ -345,12 +332,9 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti
//today = 0 if the shift is today otherwise 1 //today = 0 if the shift is today otherwise 1
$today = $r['today']; $today = $r['today'];
/** // * Display only times in the future and within the shift in 5 minute intervals
* Display only times in the future and within the shift in 5 minute intervals for ($i = 0; $i <= $intervals-1; $i++)
*
*/
for ($i = 0; $i <= $intervals; $i++)
{ {
$t = str_pad($sh,2,"0",STR_PAD_LEFT).":".str_pad($sm,2,"0",STR_PAD_LEFT).":00"; $t = str_pad($sh,2,"0",STR_PAD_LEFT).":".str_pad($sm,2,"0",STR_PAD_LEFT).":00";
@@ -359,42 +343,34 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti
$selected = ""; $selected = "";
if ($t == $time) $selected = "selected=\"selected\""; if ($t == $time) $selected = "selected=\"selected\"";
print "<option value=\"?y=$year&amp;m=$month&amp;d=$day&amp;respondent_id=$respondent_id&amp;start=$t\" $selected>".convert_time($t)."</option>"; print "<option value=\"?y=$year&amp;m=$month&amp;d=$day&amp;respondent_id=$respondent_id&amp;start=$t\" $selected>".$t."</option>";
} }
$sm += 15;
$sm += 5;
if ($sm >= 60) if ($sm >= 60)
{ {
$sh++; $sh++;
if ($sh >= 24) $sh -= 24; if ($sh >= 24) $sh -= 24;
$sm -= 60; $sm -= 60;
} }
} }
} }
print "</select>"; print "</select></div>";
if ($time) if ($time)
{ {
$eh = substr($time,0,2); $eh = substr($time,0,2);
$em = substr($time,3,2); $em = substr($time,3,2);
print "<select name=\"end\" id=\"end\" onchange=\"LinkUp('end')\"><option value=\"?y=$year&amp;m=$month&amp;d=$day&amp;respondent_id=$respondent_id&amp;start=$time\">" . T_("End Time") . "</option>"; print "<label class=\"control-label pull-left \" style=\"padding-top: 5px; margin-left: 15px;\">" . T_("End Time") . ": &emsp;</label><div class=\"form-inline pull-left\"><select class=\"form-control\" name=\"end\" id=\"end\" onchange=\"LinkUp('end')\"><option></option>";
foreach ($rs as $r) foreach ($rs as $r)
{ {
$sh = $r['sh']; $sh = $r['sh'];
$sm = $r['sm']; $sm = $r['sm'];
$intervals = $r['intervals']; $intervals = $r['intervals'];
// * Display only times after the start time and within the shift in 15 minute intervals
/** for ($i = 0; $i <= $intervals-1; $i++)
* Display only times after the start time and within the shift in 5 minute intervals
*
*/
for ($i = 0; $i <= $intervals; $i++)
{ {
$t = str_pad($sh,2,"0",STR_PAD_LEFT).":".str_pad($sm,2,"0",STR_PAD_LEFT).":00"; $t = str_pad($sh,2,"0",STR_PAD_LEFT).":".str_pad($sm,2,"0",STR_PAD_LEFT).":00";
@@ -403,28 +379,26 @@ function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $ti
$selected = ""; $selected = "";
if ($t == $timeend) $selected = "selected=\"selected\""; if ($t == $timeend) $selected = "selected=\"selected\"";
print "<option value=\"?y=$year&amp;m=$month&amp;d=$day&amp;respondent_id=$respondent_id&amp;start=$time&amp;end=$t\" $selected>".convert_time($t)."</option>"; print "<option value=\"?y=$year&amp;m=$month&amp;d=$day&amp;respondent_id=$respondent_id&amp;start=$time&amp;end=$t\" $selected>".$t."</option>";
} }
$sm += 5; $sm += 15;
if ($sm >= 60) if ($sm >= 60)
{ {
$sh++; $sh++;
if ($sh >= 24) $sh -= 24; if ($sh >= 24) $sh -= 24;
$sm -= 60; $sm -= 60;
} }
} }
} }
print "</select>"; print "</select></div></div>";
} }
print "<input type=\"hidden\" name=\"respondent_id\" value=\"$respondent_id\"/>"; print "<input type=\"hidden\" name=\"respondent_id\" value=\"$respondent_id\"/>";
print "<input type=\"hidden\" name=\"y\" value=\"$year\"/>"; print "<input type=\"hidden\" name=\"y\" value=\"$year\"/>";
print "<input type=\"hidden\" name=\"m\" value=\"$month\"/>"; print "<input type=\"hidden\" name=\"m\" value=\"$month\"/>";
print "<input type=\"hidden\" name=\"d\" value=\"$day\"/>"; print "<input type=\"hidden\" name=\"d\" value=\"$day\"/>";
print "</p>";
} }
/** /**
@@ -485,21 +459,19 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
// Build the days in the month // Build the days in the month
$Month->build(); $Month->build();
?>
<table class="calendar"> print "<table class=\"calendar table-hover table-condensed text-center\">";
<caption> print "<caption class=\"text-center text-primary\"><b>" . T_( date('F Y',$Month->getTimeStamp())) . "</b></caption>
<?php echo ( date('F Y',$Month->getTimeStamp())); ?> <thead style=\"font-weight: bolder;\">
</caption> <tr>
<tr> <td style=\"width: 50px;\">" . T_("Mon") . "</td>
<th>M</th> <td style=\"width: 50px;\">" . T_("Tue") . "</td>
<th>T</th> <td style=\"width: 50px;\">" . T_("Wed") . "</td>
<th>W</th> <td style=\"width: 50px;\">" . T_("Thu") . "</td>
<th>T</th> <td style=\"width: 50px;\">" . T_("Fri") . "</td>
<th>F</th> <td style=\"width: 50px;\">" . T_("Sat") . "</td>
<th>S</th> <td style=\"width: 50px;\">" . T_("Sun") . "</td>
<th>S</th> </tr></thead>";
</tr>
<?php
while ( $Day = $Month->fetch() ) { while ( $Day = $Month->fetch() ) {
@@ -512,7 +484,6 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
$today = ""; $today = "";
if ($year == $Day->thisYear() && $month == $Day->thisMonth() && $day == $Day->thisDay()) $today = "today"; if ($year == $Day->thisYear() && $month == $Day->thisMonth() && $day == $Day->thisDay()) $today = "today";
// isFirst() to find start of week // isFirst() to find start of week
if ( $Day->isFirst() ) if ( $Day->isFirst() )
echo ( "<tr>\n" ); echo ( "<tr>\n" );
@@ -525,7 +496,7 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
//if it is in the past -> unavailable //if it is in the past -> unavailable
if ($Day->getTimeStamp() < $ttoday->getTimeStamp()) if ($Day->getTimeStamp() < $ttoday->getTimeStamp())
{ {
echo ( "<td class=\"notavailable\">".$Day->thisDay()."</td>\n" ); echo ( "<td style=\"color:grey;\" class=\"notavailable\">".$Day->thisDay()."</td>\n" );
} }
//if there are shift restrictions, restrict //if there are shift restrictions, restrict
else if ($restricted) else if ($restricted)
@@ -540,16 +511,16 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
if (!empty($rs) && $rs->RecordCount() == 0) if (!empty($rs) && $rs->RecordCount() == 0)
{ {
echo ( "<td class=\"notavailable $today\">".$Day->thisDay()."</td>\n" ); echo ( "<td style=\"color:grey;\" class=\"notavailable $today\">".$Day->thisDay()."</td>\n" );
} }
else else
{ {
echo ( "<td class=\"$today\"><a href=\"".$link."\">".$Day->thisDay()."</a></td>\n" ); echo ( "<td class=\"$today\"><a class=\"btn-primary btn-block \" href=\"".$link."\"><b>".$Day->thisDay()."</b></a></td>\n" );
} }
} }
else else
echo ( "<td class=\"$today\"><a href=\"".$link."\">".$Day->thisDay()."</a></td>\n" ); echo ( "<td class=\"$today\"><a class=\"btn-primary btn-block \" href=\"".$link."\"><b>".$Day->thisDay()."</b></a></td>\n" );
} }
// isLast() to find end of week // isLast() to find end of week
@@ -559,18 +530,15 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon
?> ?>
<tr> <tr>
<td> <td>
<a href="<?php echo ($prev);?>" class="prevMonth">&lt;&lt; </a> <a href="<?php echo ($prev);?>" class="prevMonth btn btn-default">&lt;&lt; </a>
</td> </td>
<td colspan="5">&nbsp;</td> <td colspan="5"><?php print "<b class=\"text-primary\">" . date('l j F Y',mktime(0,0,0,$month,$day,$year)) . "</b>";?></td>
<td> <td>
<a href="<?php echo ($next);?>" class="nextMonth"> &gt;&gt;</a> <a href="<?php echo ($next);?>" class="nextMonth btn btn-default"> &gt;&gt;</a>
</td> </td>
</tr> </tr>
</table> </table>
<?php <?php
print "<div>" . date('l j F Y',mktime(0,0,0,$month,$day,$year)) . "</div>";
} }
?>
?>