coloring events

Hello everybody,

I have the following problem.

In the scheduler I can put only some predefined events, each of them has a specific color.

The event is chosen by using a combo box in the lightbox.

the combobox loads the data from a table called “terapia_combo” whose fields are:
id_terapia
label_terapia
color

the combobox has been defined in the standard way:

{name:“terapia”, options: scheduler.serverList(“terapia”), height:20, map_to:“terapia_id”, type: “select”, focus: true},

In the scheduler table “events” I have the usual fields (id, start_date, end_date, text) and I have added also the fields “terapia_id”, “color” and “textColor” as explained here docs.dhtmlx.com/scheduler/custom … color.html

How I can trigger the update the field events.color with the value terapia_combo.color when creating/updating an event?

Thanks in advance

Hi,
probably the easier way would be to define a css classes for your predefined types. Then you define a css class template and assign an appropriate css class to an event based on the ‘terapia_id’

docs.dhtmlx.com/scheduler/api__s … plate.html

The css template will be called each time event is rendered

docs.dhtmlx.com/scheduler/custom … stoanevent

Thank you for your response,

The fact is that there are a lot of events and I wanted to avoid to put all the list in the calendar.php file.

Moreover There are also some situation where I have to change the color regardless the event.

I explain better:

When I add an event, the event will have the assigned color depending on the id of terapia_id.

Each event has other two properties:
• accepted
• paid

If the event is accepted and paid then it has to become green, whatever is the original event color
if the event is accepted but not paid then the event has to become red, whatever is the original color.

How to accomplish this?

The event_class template is a function that takes the event object as a parameter.
It means that you can inspect the event and return the appropriate css classes, e.g.:[code]scheduler.templates.event_class = function(start,end,ev){
if(ev.accepted && ev.paid)
return “all_ready”;

if(ev.accepted && !ev.paid)
	return "not_paid";

return "color_" + ev.terapia_id;

};[/code]

Many thanks for the example,

I will try it and let you know.

I am using Joomla 2.5 and and Scheduler 3.0 and when I create Custom Fields and choose Use Colors for Events, it does not use the color. I am new to Joomla and this is frustrating on why it won’t color my events. I like the Scheduler plugin other than that. It might also be helpful to have a tab that lists my 3 conference rooms (that are created for the drop down menu) in a grid view to see the availability.

brianruch,
you can try to use event properties for coloring task.
docs.dhtmlx.com/scheduler/custom … ventobject

Sten,

I am completely new to Joomla so I am not sure how to do advanced editing. I am trying to make the component plugin work from the Joomla side in Chrome web browser. Are there files somewhere to edit? I hoped there was a setting inside the web interface that was not set correct that would make it work since I am new to this.

Also, is there a way to make a certain calendar view the default? Ex: Day, Week, Month, etc.