Ejemplo n.º 1
0
    print "<div class='offline statusbutton'>" . T_("No call") . "</div>";
} else {
    if ($state == 4) {
        print "<div class='tobecoded statusbutton'>" . T_("To be coded") . "</div>";
    } else {
        if ($state == 1) {
            print "<div class='online statusbutton'>" . T_("Requesting") . "</div>";
        } else {
            if ($state == 2) {
                print "<div class='online statusbutton'>" . T_("Ringing") . "</div>";
            } else {
                if ($state == 3) {
                    print "<div class='online statusbutton'>" . T_("Answered") . "</div>";
                }
            }
        }
    }
}
$ca = get_call_attempt($operator_id, false);
if ($ca) {
    print "<div class='text'>" . get_respondent_time(get_respondent_id($ca), TIME_FORMAT) . "</div>";
    if (is_on_appointment($ca)) {
        print "<div class='online statusbutton'>" . T_("APPT") . "</div>";
    }
    if (missed_appointment($ca)) {
        print "<div class='tobecoded statusbutton'>" . T_("MISSED") . "</div>";
    }
} else {
    print "<div class='text'>" . T_("No case") . "</div>";
}
xhtml_foot();
Ejemplo n.º 2
0
/**
 * Print a tabular calendar for selecting dates for appointments
 * Based on code from the PEAR package
 *
 * @link http://pear.php.net/package/Calendar PEAR Calendar
 * @link http://pearcalendar.sourceforge.net/examples/3.php Example this code based on
 *
 * @see make_appointment()
 * @see display_time()
 *
 * @param int $respondent_id The respondent id
 * @param int $questionnaire_id The questionnaire id
 * @param bool|int $day the day of the month if selected else false
 * @param bool|int $month the month of the year if selected else false
 * @param bool|int $year the year (4 digit) if selected else false
 *
 */
function display_calendar($respondent_id, $questionnaire_id, $year = false, $month = false, $day = false)
{
    global $db;
    /**
     * PEAR Caldendar Weekday functions
     */
    include_once 'Calendar/Month/Weekdays.php';
    /**
     * PEAR Caldendar Day functions
     */
    include_once 'Calendar/Day.php';
    /**
     * See if questionnaire has shift restrictions
     */
    $restricted = is_shift_restricted($questionnaire_id);
    $rtime = strtotime(get_respondent_time($respondent_id));
    $y = date('Y', $rtime);
    $m = date('m', $rtime);
    $d = date('d', $rtime);
    if (!$year) {
        $year = $y;
    }
    if (!$month) {
        $month = $m;
    }
    if (!$day) {
        $day = $d;
    }
    $ttoday = new Calendar_Day($y, $m, $d);
    $Month = new Calendar_Month_Weekdays($year, $month);
    // Construct strings for next/previous links
    $PMonth = $Month->prevMonth('object');
    // Get previous month as object
    $prev = '?y=' . $PMonth->thisYear() . '&amp;m=' . $PMonth->thisMonth() . '&amp;d=' . $PMonth->thisDay() . '&amp;respondent_id=' . $respondent_id;
    $NMonth = $Month->nextMonth('object');
    $next = '?y=' . $NMonth->thisYear() . '&amp;m=' . $NMonth->thisMonth() . '&amp;d=' . $NMonth->thisDay() . '&amp;respondent_id=' . $respondent_id;
    // Build the days in the month
    $Month->build();
    print "<table class=\"calendar table-hover table-condensed text-center\">";
    print "<caption class=\"text-center text-primary\"><b>" . T_(date('F Y', $Month->getTimeStamp())) . "</b></caption>\r\n\t\t\t\t<thead style=\"font-weight: bolder;\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td style=\"width: 50px;\">" . T_("Mon") . "</td>\r\n\t\t\t\t\t<td style=\"width: 50px;\">" . T_("Tue") . "</td>\r\n\t\t\t\t\t<td style=\"width: 50px;\">" . T_("Wed") . "</td>\r\n\t\t\t\t\t<td style=\"width: 50px;\">" . T_("Thu") . "</td>\r\n\t\t\t\t\t<td style=\"width: 50px;\">" . T_("Fri") . "</td>\r\n\t\t\t\t\t<td style=\"width: 50px;\">" . T_("Sat") . "</td>\r\n\t\t\t\t\t<td style=\"width: 50px;\">" . T_("Sun") . "</td>\r\n\t\t\t\t</tr></thead>";
    while ($Day = $Month->fetch()) {
        // Build a link string for each day
        $link = '?y=' . $Day->thisYear() . '&amp;m=' . $Day->thisMonth() . '&amp;d=' . $Day->thisDay() . '&amp;respondent_id=' . $respondent_id;
        $today = "";
        if ($year == $Day->thisYear() && $month == $Day->thisMonth() && $day == $Day->thisDay()) {
            $today = "today";
        }
        // isFirst() to find start of week
        if ($Day->isFirst()) {
            echo "<tr>\n";
        }
        if ($Day->isSelected()) {
            echo "<td class=\"selected {$today}\">" . $Day->thisDay() . "</td>\n";
        } else {
            if ($Day->isEmpty()) {
                echo "<td>&nbsp;</td>\n";
            } else {
                //if it is in the past -> unavailable
                if ($Day->getTimeStamp() < $ttoday->getTimeStamp()) {
                    echo "<td style=\"color:grey;\" class=\"notavailable\">" . $Day->thisDay() . "</td>\n";
                } else {
                    if ($restricted) {
                        $rs = $db->Execute("    SELECT s.shift_id\r\n\t\t\t\t\t\tFROM shift as s\r\n\t\t\t\t\t\tLEFT JOIN respondent as r on (r.respondent_id = '{$respondent_id}')\r\n\t\t\t\t\t\tWHERE s.questionnaire_id = '{$questionnaire_id}'\r\n\t\t\t\t\t\tAND DAY(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) = '{$Day->thisDay()}'\r\n\t\t\t\t\t\tAND MONTH(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) = '{$Day->thisMonth()}'\r\n\t\t\t\t\t\tAND YEAR(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) = '{$Day->thisYear()}'");
                        if (!empty($rs) && $rs->RecordCount() == 0) {
                            echo "<td style=\"color:grey;\" class=\"notavailable {$today}\">" . $Day->thisDay() . "</td>\n";
                        } else {
                            echo "<td class=\"{$today}\"><a class=\"btn-primary btn-block \" href=\"" . $link . "\"><b>" . $Day->thisDay() . "</b></a></td>\n";
                        }
                    } else {
                        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
        if ($Day->isLast()) {
            echo "</tr>\n";
        }
    }
    ?>
	<tr>
	<td>
	<a href="<?php 
    echo $prev;
    ?>
" class="prevMonth btn btn-default">&lt;&lt; </a>
	</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>
	<a href="<?php 
    echo $next;
    ?>
" class="nextMonth btn btn-default"> &gt;&gt;</a>
	</td>
	</tr>
	</table>
	<?php 
}