phpScheduleIt
June 19, 2013, 12:11:54 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: editing vertical time-table  (Read 2498 times)
tiger1022
Newbie
*

Karma: 0
Posts: 6


« on: May 15, 2009, 03:22:25 AM »

After i do some modification, the table look like this...
resource name
time      booking
9:00am
9:10am   
9:20am

but after i make some booking,the member name show on top of the time table..
time

Gerald
Jane
9:00am
9:10am   
9:20am

how can i make it like:
resource name
time      booking
9:00am Gerald
9:10am   Jane
9:20am


tq

shedule.template.php
Code:

<?php
/**
* This file provides the output functions for
*  an interface for reserving resources,
*  viewing other reservations and modifying their own.
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @author David Poole <David.Poole@fccc.edu>
* @author Richard Cantzler <rmcii@users.sourceforge.net>
* @version 06-23-07
* @package Templates
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/

// Get Link object
$link CmnFns::getNewLink();

/**
* Print out week being viewed above schedule tables
* @param array $d array of date information about this schedule
* @param string $title title of schedule
*/
function print_date_span($d$title) {
    
// Print out current week being viewed
    // echo '<h3 align="center">' . $title . '<br/>' . Time::formatDate($d['firstDayTs']) . ' - ' . Time::formatDate($d['lastDayTs']) . '</h3>';
}

/**
* Prints out a jump menu for the schedules
* @param array $links array of schedule links
*/
function print_schedule_list($links$currentid) {
?>


<?php
}

/**
* Print out a key to identify what the colors mean
* @param none
*/
function print_color_key() {
    global 
$conf;
}


/**
* Start table for one day on schedule
* This function starts the table for each day
* on the schedule, printing out it's date
* and the time value cells
* @param string $displayDate date string to print
*/
function start_day_table111($displayDate$hour_header$isCurrentDate) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1"><tr class="tableBorder">
<td><table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="scheduleTimes">
<td width="100%" class="<?php echo $isCurrentDate 'scheduleDateCurrent' 'scheduleDate' ?>"><?php echo $displayDate ?></td>
<?php
    
echo $hour_header ."</tr>";
}



function 
start_day_table($displayDate$hour_header$isCurrentDate) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1"><tr class="tableBorder">
<td><table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr class="scheduleTimes">
<td width="100%" class="<?php echo $isCurrentDate 'scheduleDateCurrent' 'scheduleDate' ?>"><?php echo $displayDate ?></td>
<?php
    
echo $hour_header ."</tr>";
}



/**
* Prints out the navigational calendars
* @param Calendar $prev previous month calendar
* @param Calendar $curr current month calendar
* @param Calendar $next next month calendar
*/
function print_calendars(&$prev, &$curr, &$next) {
// make the date a full header inside a new table ****************************************
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
<td align="center" valign="middle" width="100%">

</tr></table></table>
<?php
}

/**
* Formats and returns the time header of the table (it is the same for every one)
* @param array $th array of time values and their rowspans
* @param int $startDay starting time of day
* @param int $endDay ending time of day
* @param int $timespan time intervals
* @global $conf
*/
function get_hour_header($th$startDay$endDay$timespan) {
    global 
$conf;
    
$header '';

    
// Write out the available times
    // Insert a blank time in top left corner of table ************************************
    
$header .= "</td></tr><tr class='r0'><td colspan=\"$cols\">000</td></tr>";
    foreach (
$th as $time => $cols) {
        
$header .= "<tr class='r0'><td colspan=\"$cols\">$time</td></tr>";
    }

    
// Close row, start next
    
$header .= "</tr>\n<tr class=\"scheduleTimes\">";

    
// Compute total # of cols
    
$totCol intval(($endDay $startDay) / $timespan);
    
$width = (85/$totCol);
    
// Create the fraction hour minute marks
    
for ($x 0$x $totCol$x++)
    {
        
// $header .= "<td width=\"$width%\">&nbsp;</td>";
    
}

    
// turn $header into a master table for each day *********************************************
    
$header "<TABLE width='100%'><TR>";
    return 
$header;
    
}


/**
* Close off table for each day
* This function simply prints out the HTML to close off
* the rows and tables for each day
* @param none
*/
function end_day_table() {
?>

</table></td></tr></table><p>&nbsp;</p></TR>
<?php
}


/**
* Prints out the cell containing all the resource information
* @param int $ts timestamp for the current day
* @param string $id id of this resource
* @param string $name name of this resource
* @param boolean $shown whether this resource can be reserved
* @param boolean $is_blackout whether this is a blackout schedule or not
* @param string $scheduleid id of the current schedule
* @param boolean $pending is reservation pending approval
* @param string $color background color of row
*/
function print_name_cell($ts$id$name$shown$is_blackout$scheduleid$pending false$color '') {
    global 
$link;

    
$color = (empty($color)) ? 'r0' $color;

    
// Start a new row and print out resource name
    // Create a new table for each resource **************************************************
    
echo "<TD><table cellpadding=\"0\" border=\"1\" cellspacing=\"0\" width=\"100%\"><tr class=\"$color\"><td class=\"resourceName\">";

    if (
$is_blackout) {
        
$link->doLink("javascript: reserve('r','$id','$ts','','$scheduleid','1','0','$pending');"$name);
    }
    else {
        
// If the user is allowed to make reservations on this resource
        // then provide a link
        // Else do not

        
if ($shown)
            
$link->doLink("javascript: reserve('r','$id','$ts','','$scheduleid','0','$pending');"$name);
        else
            echo 
'<span class="inact">' $name '</span>';
            
    }
    
// Close cell
    
echo "</td></TD>";
}

/**
* Prints out blank columns
* @param int $cols number of columns to print out
* @param int $start starting time of the first column printed out
* @param int $span time span of the schedule
* @param int $ts timestamp for the reservation start date
* @param string $machid id of the resource on this table row
* @param string $scheduleid id of the current schedule
* @param int $scheduleType type of the current schedule
* @param bool $clickable if this row can be clicked
* @param string $color class of column background
*/
function print_blank_cols($cols$start$span$ts$machid$scheduleid$scheduleType$clickable$class '') {
    
$is_blackout intval($scheduleType == BLACKOUT_ONLY);
   
$offClass $clickable '' 'class="o"';
   
$time=array("7:30 am","7:40 am","7:50 am","8:00 am","8:10 am","8:20 am","8:30 am","8:40 am","8:50 am","9:00 am","9:10 am","9:20 am","9:30 am","9:40 am","10:00 am","10:10 am","10:20 am","10:30 am","10:40 am","10:50 am","11:00 am","11:00 am","11:10 am","11:20 am","11:30 am","11:40 am","11:50 am","12:00 pm","12:10 pm","12:30 pm","12:40 pm","12:50 pm","1:00 pm","1:10 pm","1:20 pm","1:30 pm","1:40 pm","1:50 pm","2:00 pm","2:10 pm","2:10 pm","2:20 pm","2:30 pm","2:40 pm","2:50 pm","3:00 pm","3:10 pm","3:20 pm","3:30 pm","3:40 pm","3:50 pm","4:00 pm","4:10 pm","4:20 pm","4:30 pm","4:40 pm","4:50 pm","5:00 pm","5:10 pm","5:20 pm",);
    
$js '';
    for (
$i 0$i <= $cols$i++) {
        if (
$scheduleType != READ_ONLY && ($clickable || $is_blackout)) {
            
$tstart $start + ($i $span);
            
$tend $tstart $span;
            
$js "onclick=\"reserve('r','$machid','$ts','','$scheduleid',$is_blackout,'','',$tstart,$tend);\"";
        }
        
// added another <tr> for each time to make a vertical table ***************************
        
echo "<tr class=\"$class\"><td width=10>".$time[$i] ."</td><td $offClass $js>&nbsp;</td></tr>";
    }
}

/**
* Prints the closing tr tag
* @param none
*/
function print_closing_tr() {
    echo 
"</tr></table>";
}

/**
* 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'];
    
$chars = ($colspan 1) ? $colspan 0;

    
$read_only intval($read_only);

    if (
$viewable) {
        
$js "onclick=\"reserve('$mod_view','','','$resid','','0','$read_only','$pending');\" ";
        if (
$summary->isVisible()) {
            
$js .= "onmouseover=\"ssum(event,'" preg_replace("/[\n\r]+/"'<br/>'addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hsum();\"";
      }
    }
    else {
        if (
$summary->isVisible()) {
            
$js "onmouseover=\"ssum(event,'" preg_replace("/[\n\r]+/"'<br/>'addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hsum();\"";
      }
    }

    
$summary_text $summary->toScheduleCell();
   
   
$cellSummary '';
   if (
$summary_text != $summary->EMPTY_SUMMARY)
   {
      
$cellSummary "<div class=\"inlineSummary\">$summary_text</div>";
   }
   
   
// create new row for reservations lasting more than one time unit ******************
   
   //echo "<table border=0 width='100%'>";
       
for ($x 0$x $colspan$x++)
    {       
    
    
// print reservation at top of a rowspan-ed table

      
echo "<tr class=\"r1\"><td width='100%' style=\"color:$text;background-color:$color;\" $js>$cellSummary</td></tr>";



    }
    
}

/**
* Writes out the blackout cell
* @param int $colspan column span of the blackout
* @param bool $edit if the user can edit it
* @param string $blackoutid id of this blackout
* @param string $summary blackout summary text
* @param int $showsummary whether to show the summary or not
*/
function write_blackout($colspan$viewable$blackoutid$summary ''$showsummary 0) {
    global 
$conf;
    
$color '#' $conf['ui']['blackout'][0]['color'];
    
$hover '#' $conf['ui']['blackout'][0]['hover'];
    
$text  '#' $conf['ui']['blackout'][0]['text'];
    
$chars $colspan;
    
$js '';

    if (
$viewable) {
        
$js "onclick=\"reserve('m','','','$blackoutid','','1');\" ";
        if (
$showsummary && $summary->isVisible())
      {
            
$js .= "onmouseover=\"ssum(event,'" preg_replace("/[\n\r]+/"'<br/>'addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hsum();\"";
      }
    }
    else {
        if (
$showsummary != && $summary->isVisible())
            
$js "onmouseover=\"ssum(event,'" preg_replace("/[\n\r]+/"'<br/>'addslashes($summary->toScheduleHover())) . "');\" onmouseout=\"hsum();\"";
    }

    
$summary_text $summary->toScheduleCell();

   
$cellSummary '';
   if (
$summary_text != $summary->EMPTY_SUMMARY)
   {
      
$cellSummary "<div class=\"inlineSummary\">$summary_text</div>";
   }

    echo 
"<td colspan=\"$colspan\" style=\"color:$text;background-color:$color;\" $js>$cellSummary</td>";
}

/**
* Writes out a div to be used for reservation summary mouseovers
* @param none
*/
function print_summary_div() {
?>

<div id="summary" class="summary_div" style="width: 150px;"></div>
<?php
}

/**
* Print links to jump to new dates
* This function prints out the HTML links to allow
*  users to navigate back/forward one week.
* It also prints the form for users to jump to
*  any given week.
* @param int $_date timestamp of first day of week on schedule
* @param bool $printAllCols whether or not to print the 5 column jump
*/
function print_jump_links($_date$viewdays$printAllCols) {
    global 
$link;
    global 
$dates;

    if (isset(
$_GET['scheduleid']))
        
$scheduleid $_GET['scheduleid'];
    else
        
$scheduleid '';

    
$scheduleid 'scheduleid=' $scheduleid;        // Make querystring part

    
$date getdate($_date);
    
$m $date['mon'];
    
$d $date['mday'];
    
$y $date['year'];
    
$boxes $dates['jumpbox'];

    
// Write out the previous, today and next links and the form to jump to a date
?>
<table width="100%" border="0" cellspacing="0" cellpadding="5" align="center"><tr>
<td align="center"><h5><?php $link->doLink($_SERVER['PHP_SELF'] . '?date=' date('m-d-Y',mktime(0,0,0,$m$d 7$y)) . "&amp;$scheduleid"translate('Prev Week'), ''''translate('Jump 1 week back')) ?></h5></td>

<td align="center"><h5><?php $link->doLink($_SERVER['PHP_SELF'] . "?$scheduleid"translate('This Week'), ''''translate('Jump to this week')) ?></h5></td>

<td align="center"><h5><?php $link->doLink($_SERVER['PHP_SELF'] . '?date=' date('m-d-Y',mktime(0,0,0,$m$d 7$y)) . "&amp;$scheduleid"translate('Next Week'), '''''Jump 1 week ahead'?></h5></td>
</tr><tr>
<td align="center" colspan="<?php echo ($printAllCols) ? '5' '3';?>">
<div name="jumpWeek" id="jumpWeek">
         <?php
         $boxes 
str_replace('%m''<input type="text" name="jumpMonth" id="jumpMonth" value="' translate('mm') . '" class="textbox" size="3" maxlength="2" onclick="this.value = \'\';" />'$boxes);
         
$boxes str_replace('%d''<input type="text" name="jumpDay" id="jumpDay" value="' translate('dd') . '" class="textbox" size="3" maxlength="2" onclick="this.value = \'\';" />'$boxes);
         
$boxes str_replace('%Y''<input type="text" name="jumpYear" id="jumpYear" value="' translate('yyyy') . '" class="textbox" size="5" maxlength="4" onclick="this.value = \'\';" />'$boxes);
         
//echo $boxes;
         //** <input name="jumpForm" type="button" value="echo translate('Jump To Date')" class="button" onclick="checkDate();"/>
         
?>


</div>
</td>
</tr>
</table>
<h5 align="center"><?php $link->doLink("javascript: window.open('popCalendar.php?$scheduleid','calendar','width=260,height=250,scrollbars=no,location=no,menubar=no,toolbar=no,resizable=yes'); void(0);"translate('View Monthly Calendar'), ''''translate('Open up a navigational calendar'))?></h5>
<?php
}
?>
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5506


WWW
« Reply #1 on: May 18, 2009, 02:01:09 PM »

You'd need to break it down to two columns, one for the time and one for the name.  I'd just create a map of that information and use that.  Something like:

$array['9:00am'] = 'user name';
$array['9:30am'] = 'other user';
Logged
tiger1022
Newbie
*

Karma: 0
Posts: 6


« Reply #2 on: May 22, 2009, 04:34:46 AM »

Can u write out more clearer?  sorry,i cant understand...
Logged
LittleIdle
Newbie
*

Karma: 0
Posts: 1


« Reply #3 on: March 29, 2010, 03:00:15 AM »

Can u write out more clearer?  sorry,i cant understand...

me neither  Huh
Logged

ollif
Newbie
*

Karma: 0
Posts: 3


« Reply #4 on: April 11, 2010, 07:34:43 PM »

since 2 weeks i also try to break it down into two columns. i cant fix the problem.

anyone a step further?
Logged
fighterman
Newbie
*

Karma: 0
Posts: 10


WWW
« Reply #5 on: July 11, 2010, 06:17:40 PM »

Please,make it clear
Logged

movies12
Newbie
*

Karma: 0
Posts: 1


WWW
« Reply #6 on: August 19, 2010, 04:53:40 AM »

You'd need to break it down to two columns, one for the time and one for the name.  I'd just create a map of that information and use that.  Something like:

$array['9:00am'] = 'user name';
$array['9:30am'] = 'other user';

simple but practical
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!