phpScheduleIt
May 18, 2013, 04:48:46 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: phpScheduleIt 2.4.2 has been released!
Home
Help
Login
Register
phpScheduleIt
>
Modifications
>
Request Modification
>
Change resource color by date/time
Pages: [
1
]
« previous
next »
Print
Author
Topic: Change resource color by date/time (Read 972 times)
ylnahar
Newbie
Karma: 0
Posts: 9
Change resource color by date/time
«
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: 5403
Re: Change resource color by date/time
«
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
Re: Change resource color by date/time
«
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: 5403
Re: Change resource color by date/time
«
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
Re: Change resource color by date/time
«
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: 5403
Re: Change resource color by date/time
«
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
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> Announcements
=> Open Discussion
=> Donations
-----------------------------
Help and Support
-----------------------------
=> phpScheduleIt 2.x
=> EspaƱol
=> phpScheduleIt 1.2.x
=> phpScheduleIt 1.1.x
=> New Features and Suggestions
=> Developers
-----------------------------
Bugs
-----------------------------
=> phpScheduleIt 1.2.x
=> phpScheduleIt 1.1.x
-----------------------------
Modifications
-----------------------------
=> Post Modifications
=> Request Modification
-----------------------------
Development
-----------------------------
=> phpScheduleIt 2.0
-----------------------------
Off-Topic
-----------------------------
=> Non-phpScheduleIt Discussion
Loading...