views:

54

answers:

1

Hell all,

I am creating a event module. In that as usual after creating the event we need to display the event title in the popup when clicking the date in the calendar. its working. but if i have multiple events in the same day its just showing the first event.

Template Engine i used here is SMARTY. And i used {literal} to differentiate smarty and JS.

Here is the code:

function getDateInfo(date, wantsClassName) 
{ 

{/literal}{foreach from=$view_event item=event}{literal} // USED {literal} to differentiate SMARTY and Java Script. 

        var as_number = Calendar.dateToInt(date); 

if (as_number >=  {/literal}{$view_event.sdate}{literal} && as_number <=  {/literal}{$view_event.edate}{literal})

            return {

                klass   : "highlight2",
                tooltip: "<div style='text-align: center'>From:{/literal}{$view_event.started_on|date_format:'%d-%m-%Y'}{literal} -- To:{/literal}{$view_event.end_on|date_format:'%d-%m-%Y'}{literal}<br>Event:{/literal}{$view_event.event_name}{literal}</div>" 

            };

    {/literal}{/foreach}{literal}

    return DATE_INFO[as_number];
};

How can i accomplish this critical ISSUE.

Thanks in advance...

A: 

Interesting. I think maybe your function is taking in the wrong arguments. Each of your 'event' objects (you should consider a different name for that, to avoid conflict) should have some kind of unique id associated with them. So, when clicking on an 'event', you wouldn't be getting the date info, but rather the 'event' info.

function getEventInfo(evObj){
    // get your info by evObj.id, or something similar
}
Steve -Cutter- Blades
When clicking the date in the event calendar i get the corresponding date so that i can able to get the events related to that date by using mysql. So i think there is no need for one more function. this is in my point of view. But suggestions are always welcome.
Fero
I hear what you're saying. But, this view you are trying to load, is it the view of the 'Date' or one of the 'event' itself? From you're original posting, it sounded as if you were only getting display of the first event for a specific date.
Steve -Cutter- Blades