phpScheduleIt
May 19, 2013, 08:10:45 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: Color choices per reservation?  (Read 4108 times)
nbowman
Newbie
*

Karma: 0
Posts: 4


« on: September 18, 2007, 09:03:21 AM »

Ok, this is probably not currently supported, but is there a way to make different reservations for the same user show up in different colors? I use this lovely software in an educational institution to show the location of classes each term. No one else is allowed to post to this schedule aside from me, but it would be nice to be able to have the different types of classes show up under different colors if possible. Unfortunately I know next to nothing about PHP so I imagine this is far more difficult than it sounds, but any suggestions are appreciated!
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #1 on: September 18, 2007, 09:35:47 AM »

This is actually pretty similar to a feature I have on my list.  The plan was to make this configurable at the reservation level.  You would want it at the resource level?
Logged
nbowman
Newbie
*

Karma: 0
Posts: 4


« Reply #2 on: September 18, 2007, 11:26:03 AM »

Actually reservation level would probably work just fine Smiley
Logged
nbowman
Newbie
*

Karma: 0
Posts: 4


« Reply #3 on: September 28, 2007, 12:29:19 PM »

Question: As a temporary hold over - is there a way for me to "hack" the code where it assigns the color to the reservation (as the table is drawn) to have it scan the reservation description for a certain phrase? Essentially if the word NUR shows at the start of the line to force one color, ERI forcing another and the like?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #4 on: October 01, 2007, 09:42:28 AM »

You can do that or you can just use the resource's ID to determine it.  You may just want to create a hash with the lookup value (prefix or ID) as the key and have the color be the value.  You would add this to templates/schedule.template.php

Something like:

$colors['blablakey'] = '#000000';

Then just use that when each resource name is being printed.
Logged
nbowman
Newbie
*

Karma: 0
Posts: 4


« Reply #5 on: October 01, 2007, 10:14:57 AM »

Ok... so, assuming I know nothing about PHP (which is mostly accurate) I think what I've found might work is this:

In schedule.class.php there's a get_reservation_colorstr function, that to me looks like what decides what colors to use. The color choices are pulled from config.php, so if I added a new If before pending to do something like:

if (substr($rs['summary'],0,3) == "NUR") {
$color_select = "nursing";
}

assuming I defined the color "nursing" in the config.php and I use the right string search function... that should work, right?

edit: Corrected my code with substr instead of instr

edit once more: corrected my = to == and it works Smiley Thank goodness I still know how to reverse engineer Smiley
Logged
mauricev
Newbie
*

Karma: 0
Posts: 17


« Reply #6 on: March 13, 2008, 06:25:32 PM »

I think I want something slightly different (or do I?), the ability to assign a color to a particular resource. So then in the monthly view, the text of each booked resource appears in its own color.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #7 on: March 14, 2008, 12:15:38 PM »

That can be done pretty easily.  Nice idea.
Logged
mauricev
Newbie
*

Karma: 0
Posts: 17


« Reply #8 on: March 14, 2008, 01:10:49 PM »

Any pointers (if we wanted to roll our own)? For example, I would imagine that since our resources are fixed, we can just hardcode the colors, so all that really has to change is code somewhere inside the print functions, like print_day_reservations, print_month_reservations, print_reservations and anything similar, but I'm not clear how it extracts the data for the resource associated with a particular reservation.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5403


WWW
« Reply #9 on: March 17, 2008, 10:15:26 AM »

If you wanted to hard code it, you can do that in templates/mycalendar.template.php in the print_month_reservations() function.  While looping the reservations, you can just do a lookup on the reservations "name" field and change the text's color.
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!