Colour code tasks in calendar

Hi,
how can I colour code the tasks in the calendar based on the status.

I want tasks with the status of planned to be green but to be yellow when the task is a different status.
I imagine it would be somewhere within the CalendarActivity.php file but not sure.

Any ideas?
Thanks.

Hi ajgisme,

I have not worked on this file but i have idea on that bcoz i applied the same thing in other module.

You have to change the code in CalendarActivity.php only bcoz, get_activities () is calling from this page only in Calender.php

so basically u need to change like this ,
ex:

if($date_db	< $today && $meeting_fields['STATUS']=='Planned') {
			$meeting_fields['DATE_START']= "<font class='overdueTask'>".$meeting_fields['DATE_START']."</font>";
		}

Like wise u need to check and have to pass the data,

I hope it will make some sense to u…

:cheer:

Hi,
Thanks.
I’ve tried this but it isn’t working:

foreach($focus_tasks_list as $task) {
$act = new CalendarActivity($task);

				if($task_fields['STATUS']=='1') {
		$task_fields['name']= "<font class='overdueTask'>".$task_fields['name']."</font>";
	}

Are u sure, that this piece of code is at right place to reflect where the changes you need…

Try with something others things . debug this whether anything is reflecting there or not…

Hi,

I have read about this before and there was a post that sugarcrm put up/

http://developer.sugarcrm.com/2012/07/31/colorizing-the-calendar/

They do state that it is not upgrade safe.

Might also be worth noting that there example is for the Meetings module but the Tasks would be very similar and would only need to reference the Task module rather than the Meetings.

Thanks.
I’ve tried that and all makes sense except I get the error below:

 undefined is not an object (evaluating 'CAL.activity_colors[item.status]['body']')

So it doesn’t seem to work?

Wahay!
So I realised what is was: some of the task records didn’t have a status set because they were created with logic hooks before I added statuses to it.

Once I gave each task a status it worked perfectly!
Thanks!