By Guest on Friday, 01 September 2017
Replies 9
Likes 5
Views 1.3K
Votes 0
Hi,

I know this may sound weird, but believe me, I have a perfect reason to ask: is there a way to make in the calendar module cells belonging to preceding and following months' active? I mean - if there were events in those 'jevoutofmonth' days, to make them clickable and have tooltips, like every day with events in current month?

I use Ruthin layout and I know this would probably require tweaking 'calendar.php', but I have to idea what to change.

Cheers,

Olek
1. Easy Option - change the override to NOT output a number for days out of the month. Combine this with the setting in the module to show the following month during the last week of the previou month

2. Continuing your current approach

Its best not to touch dataModel.php

In the template override add


$nextdata = $this->datamodel->getCalendarData($cal_year,$cal_month+1,1,false, false);


if you let me know which JEvents theme you are using then I can see if I can rattle off the mods for you
·
Wednesday, 06 September 2017 11:11
·
5 Likes
·
0 Votes
·
0 Comments
·
Hello Olek,

It is possible but would require a template override. geraint have you done this before that you have a code snippet ready?

Many thanks
Tony
·
Friday, 01 September 2017 16:12
·
5 Likes
·
0 Votes
·
0 Comments
·
That would be beyond AWESOME!
·
Friday, 01 September 2017 17:26
·
5 Likes
·
0 Votes
·
0 Comments
·
If you are using the 'flat' theme then copy the file modules/mod_jevents_cal/tmpl/flat/calendar.php to templates/YOURTEMPLATE/html/mod_jevents_cal/flat/calendar.php

Then find the code

case "prior" :
case "following" :
$content .= "<td class='flatcal_othermonth'/>\n";
break;
at line c. 190 (line number will vary based on the theme you use as will the $content line

and replace it with

case "prior" :
case "following" :
$dayOfWeek = JevDate::strftime("%w", $currentDay ["cellDate"]);
$class = ($currentDay ["today"]) ? "flatcal_todaycell" : "flatcal_daycell";
$linkclass = "flatcal_daylink";
if ($dayOfWeek == 0 && !$currentDay ["today"])
{
$class = "flatcal_sundaycell";
$linkclass = "flatcal_sundaylink";
}
$link = $this->htmlLinkCloaking($currentDay["link"], $currentDay['d'], array('class' => $linkclass, 'title' => JText::_('JEV_CLICK_TOSWITCH_DAY')));
$content .= "<td class='flatcal_othermonth'> $link</td>\n";
break;

The code you need to use will vary by theme too but hopefully that is enough to get you started
·
Monday, 04 September 2017 11:13
·
5 Likes
·
0 Votes
·
0 Comments
·
Thank you, right now the 'outofmonth' cells are indeed active and clickable. I've got Ruthin layout, but was able to tune the original code a bit, basing on your Flat layout solution.

However these 'outofmonth' cells have two killing flaws now:
1) the module's mechanism can't tell if in those 'outofmonth' days were/will be events. It's just a static link that I can't style depending on existing (or lack) of events
b) don't use tooltips.

Please please, help me with these.
·
Monday, 04 September 2017 16:57
·
5 Likes
·
0 Votes
·
0 Comments
·
That is more problematic since the code to fetch the data (getCalendarData in the file components/com_jevents/libraries/datamodel.php ) only checks for events in the 'active month'

In your calendar.php file you'll see code like this

$data = $this->datamodel->getCalendarData($cal_year,$cal_month,1,false, false);

you could fetch the previous and following month data too and then check these data arrays for the presence of events

A bit fiddly but it should work
·
Tuesday, 05 September 2017 09:54
·
5 Likes
·
0 Votes
·
0 Comments
·
I battled for over 5 hours, experimented with changing million things in both datamodel.php and module's calendar.php, I climbed the peak my pathetic PHP skills and all I achieved was zilch. Sometimes the displayed month was different, sometimes the displayed date format was different (read: messed), but never got even close to checking other months' days in current month view.

Please, could you give me a less vague hint? Which file should I modify? Datamodel (hope not!) or calendar.php or both? Should I try to modify the definition of the $data variable (which you've mentioned), or add another ones for next and previous month? Believe me, I'm fighting so hard to solve this puzzle and not to bother you, but I've just hit the wall.

I owe you a little background to this situation, so you'll know why this is so important: thanks to Tony's solution I was able to show only current week of current month. This is the main element of the home page - seven boxes with current week's days. When user hovers each box (day with events) - the tooltip occurs. Everything's great until a month ends in the middle of the week - then days belonging to preceding/following month are 'dead' and suggest there won't be any events. See? A disaster :-(
·
Tuesday, 05 September 2017 15:51
·
5 Likes
·
0 Votes
·
0 Comments
·
My goodness, that would be awesome! I use Ruthin layout.
·
Wednesday, 06 September 2017 12:03
·
5 Likes
·
0 Votes
·
0 Comments
·
Holy cow! I'VE MADE IT!!!!! Thanks to your brilliant idea (easy option), I managed to accomplish my goal.

Here's how:

1) I configured the module to show previous and following months during the first/last 7 days of the current month.
2) Yep, I blocked the output of days outside the month (it was so obvious, yet I haven't come up with it myself).
3) I changed the display model from <table> to divs.
4) Thanks to Tony's solution (once again - thank you, Tony!) I had the row containg current week classed differently than other weeks. I moved the 'currentWeek' class from the whole row to each day indivually.
5) I removed the tags surrounding each month, so I got this one big pile of boxes with days.
6) I marked only 'currentWeek' class for being displayed.

Mission accomplished!

Thank you Geraint for your angel-like patience. This is the best, the most competent support I've ever seen.

Cheers,

Olek
·
Wednesday, 06 September 2017 14:56
·
5 Likes
·
0 Votes
·
0 Comments
·
View Full Post