Exemplo n.º 1
0
/**
* Writes out the reservation cell
* @param int $colspan column span of this reservation
* @param string $color_select array identifier for which color to use
* @param string $mod_view indentifying character for javascript reserve function to mod or view reservation
* @param string $resid id of this reservation
* @param Summary $summary summary for this reservation
* @param string $viewable whether the user can click on this reservation and bring up a details box
* @param int $read_only whether this is a read only schedule
* @param boolean $pending is this reservation pending approval
*/
function write_reservation($colspan, $color_select, $mod_view, $resid, $summary = '', $viewable = false, $read_only = false, $pending = 0)
{
    global $conf;
    $js = '';
    $color = '#' . $conf['ui'][$color_select][0]['color'];
    $hover = '#' . $conf['ui'][$color_select][0]['hover'];
    $text = '#' . $conf['ui'][$color_select][0]['text'];
    $image = $conf['ui'][$color_select][0]['image'];
    $chars = $colspan > 1 ? 4 * $colspan : 0;
    $read_only = intval($read_only);
    /*AK: $mod_view work around. This is required to make reservations of other users not clickable*/
    $mod_view_wa = false;
    if ($mod_view == 'm') {
        $mod_view_wa = true;
    }
    /*--------------------------------------------------------------------------------------------*/
    if ($viewable && $mod_view_wa) {
        $js = "onclick=\"reserve('{$mod_view}','','','{$resid}','','0','{$read_only}','{$pending}');\" ";
        if ($summary->isVisible()) {
            $js .= "onmouseover=\"showDescription('timeslotinfo', '{$color_select}'); resOver(this, '{$hover}'); showsummary('summary', event, '" . preg_replace("/[\n\r]+/", '<br/>', addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hideDescription('timeslotinfo'); resOut(this, '{$color}', '{$image}'); hideSummary('summary');\" onmousemove=\"moveSummary('summary', event);\"";
        } else {
            $js .= "onmouseover=\"showDescription('timeslotinfo', '{$color_select}'); resOver(this, '{$hover}');\" onmouseout=\"hideDescription('timeslotinfo'); resOut(this, '{$color}', '{$image}');\"";
        }
    } else {
        if ($summary->isVisible()) {
            $js = "onmouseover=\"showsummary('summary', event, '" . preg_replace("/[\n\r]+/", '<br/>', addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hideSummary('summary');\" onmousemove=\"moveSummary('summary', event);\"";
        } else {
            $js .= "onmouseover=\"showDescription('timeslotinfo', '{$color_select}'); resOver(this, '{$hover}');\" onmouseout=\"hideDescription('timeslotinfo'); resOut(this, '{$color}', '{$image}');\"";
        }
    }
    $summary_text = $summary->toScheduleCell();
    switch ($color_select) {
        case "my_res":
            $boxed_summary_text = "Your current reservation.";
            break;
        case "my_past_res":
            $boxed_summary_text = "Your past reservation.";
            break;
        case "other_past_res":
            $boxed_summary_text = "Past reservation of another person.";
            break;
        case "other_res":
            $boxed_summary_text = "Reservation of another person.";
    }
    echo "<td colspan=\"{$colspan}\" style=\"color: {$text}; background-color: {$color}; background-image: \n\turl({$image}); background-repeat: repeat\" {$js}><div class=\"boxedSummary\"><div class=\"inlineSummary\">{$summary_text}</div></div></td>";
}