phpScheduleIt
May 25, 2013, 11:30:28 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: Change resource color by date/time  (Read 979 times)
ylnahar
Newbie
*

Karma: 0
Posts: 9


« on: May 10, 2011, 11:29:16 AM »

Hi,

I was wondering how I would be able to change the color of a particular booked resource according to the date/time?

For example: If I had a resource booked from 11.00am  to 12.00pm on a Friday, I would like the system to be able to use the server time and then change the color of that resource to red (active) for the duration of the booking from 11 am to 12pm.

For the purpose we intend to use it for, this would be an invaluable modification as it will show us what is the current active resource. Any help here on this modification would be greatly appreciated!

Thank you.

Yogi
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #1 on: May 16, 2011, 01:53:37 PM »

If you want to do this on the bookings page, try the following:

In lib\Schedule.class.php, find get_reservation_colorstr() function

Add something like:
$currentMinutes = mktime('h') * 60 + mktime('i');
if (
($rs['start_date'] == $current_date &&  $rs['starttime'] >= $currentMinutes) &&
($rs['end_date'] == $current_date &&  $rs['endtime'] <= $currentMinutes)
{
return 'currentReservation';
}

Then add the .currentReservation definition to the css.css file.
Logged
ylnahar
Newbie
*

Karma: 0
Posts: 9


« Reply #2 on: May 17, 2011, 03:19:39 PM »

Would it be possible to do this on the 'My Calendar' page for the day/week view?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #3 on: May 20, 2011, 03:20:36 PM »

Sure, the same general approach would work but for template\mycalendar.template.php
Logged
ylnahar
Newbie
*

Karma: 0
Posts: 9


« Reply #4 on: May 24, 2011, 11:59:18 AM »

Nick,

I tried the code above but the color of the current reservation doesn't change. I added the definition of .currentReservation to the css.css file.

.currentReservation {
background-color: #FF0000;
border: solid 3px ;
}

There isn't any change in the color code on the 'Bookings' page. Is there something I am missing here, cause the code looks ok. Please let me know. Thank you.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #5 on: June 06, 2011, 01:55:44 PM »

Hmm, I'm not sure.  Can you try adding some debugging to the code we added in get_reservation_colorstr()

Something like

echo "Date: $currentDate Minutes: $currentMinutes";
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!