buttman
  buttman
Gold Member
  Friday, 01 September 2017
  9 Replies
  1.2K Visits
0
Votes
Undo
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
7 years ago
·
#192883
Accepted Answer
0
Votes
Undo
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

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

7 years ago
·
#192700
0
Votes
Undo
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

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

7 years ago
·
#192714
0
Votes
Undo
That would be beyond AWESOME!
7 years ago
·
#192755
0
Votes
Undo
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

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

7 years ago
·
#192781
0
Votes
Undo
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.
7 years ago
·
#192825
0
Votes
Undo
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

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

7 years ago
·
#192849
0
Votes
Undo
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 :-(
7 years ago
·
#192883
Accepted Answer
0
Votes
Undo
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

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!

7 years ago
·
#192885
0
Votes
Undo
My goodness, that would be awesome! I use Ruthin layout.
7 years ago
·
#192905
0
Votes
Undo
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
  • Page :
  • 1
There are no replies made for this post yet.

Members Area

Show your support

Unlike many Joomla calendars we do not charge to download JEvents - please show your support for this project by becoming a member of the JEvents Club Club members get access to early releases, exclusive member support forums, and Silver and Gold members can use many exciting JEvents addons

Your membership will ensure that JEvents continues to be the best events calendar for Joomla.