By Guest on Thursday, 14 June 2018
Replies 3
Likes 0
Views 1K
Votes 0
Hi,
In a 'Menu item type' = 'List by day' I would like to display events that span multiple days (ie repeat events) last in the list.

To do this I figured I'd insert an IF statement in a custom override for the 'list by day' view. I've got the override file set up and working ok in /templates/templatename/html/com_jevents/extplus/day/listevents_body.php but how do I test for repeat events. I notice that according to https://www.jevents.net/docs/jevents/item/latest-events-customisation there is a "$row->is_repeat()" data field. However, if I include this in my override it errors. I obviously can't call that data field from this location. What do I do?

My listevents_body.php includes the following. Lines 38-41 are where I am trying to play.


<?php
defined('_JEXEC') or die('Restricted access');

$cfg = JEVConfig::getInstance();

$this->data = $data = $this->datamodel->getDayData($this->year, $this->month, $this->day);
$this->Redirectdetail();

$cfg = JEVConfig::getInstance();
$Itemid = JEVHelper::getItemid();
$hasevents = false;

echo '<fieldset><legend class="ev_fieldset">' . JText::_('JEV_EVENTSFORTHE') . '</legend><br />' . "\n";
echo '<table align="center" width="90%" cellspacing="0" cellpadding="5" class="ev_table">' . "\n";
?>
<tr valign="top">
<td colspan="2" align="center" class="cal_td_daysnames">
<!-- <div class="cal_daysnames"> -->
<?php echo JEventsHTML::getDateFormat($this->year, $this->month, $this->day, 0); ?>
<!-- </div> -->
</td>
</tr>
<?php

//DLL show events with a start and finish date first...
for ($h = 0; $h < 24; $h++)
{
if (count($data['hours'][$h]['events']) > 0)
{
$hasevents = true;
$start_time = JEVHelper::getTime($data['hours'][$h]['hour_start']);
$hasevents = true;

echo '<tr><td class="ev_td_left">' . $start_time . '</td>' . "\n";
echo '<td class="ev_td_right"><ul class="ev_ul">' . "\n";
foreach ($data['hours'][$h]['events'] as $row)
{
// //dll trying to test if it is a repeat event or not...
// if ($row->is_repeat()) {
// echo "IS-REPEAT";
// }
$listyle = 'style="border-color:' . $row->bgcolor() . ';"';
echo "<li class='ev_td_li' $listyle>\n";
$this->loadedFromTemplate('icalevent.list_row', $row, 0);
echo "</li>\n";
}
echo "</ul></td></tr>\n";
}
}

// Timeless Events DLL-Last
if (count($data['hours']['timeless']['events']) > 0)
{
$start_time = JText::_('TIMELESS');
$hasevents = true;

echo '<tr><td class="ev_td_left">' . $start_time . '</td>' . "\n";
echo '<td class="ev_td_right"><ul class="ev_ul">' . "\n";
foreach ($data['hours']['timeless']['events'] as $row)
{
$listyle = 'style="border-color:' . $row->bgcolor() . ';"';
echo "<li class='ev_td_li' $listyle>\n";

$this->loadedFromTemplate('icalevent.list_row', $row, 0);
echo "</li>\n";
}
echo "</ul></td></tr>\n";
}


if (!$hasevents)
{
echo '<tr><td class="ev_td_right" colspan="3"><ul class="ev_ul" >' . "\n";
echo "<li class='ev_td_li ev_td_li_noevents' >\n";
echo JText::_('JEV_NO_EVENTS');
echo "</li>\n";
echo "</ul></td></tr>\n";
}
echo '</table><br />' . "\n";
echo '</fieldset><br /><br />' . "\n";
// $this->showNavTableText(10, 10, $num_events, $offset, '');


Thanks heaps for any help in advance!

PS I'm using JEvents v3.4.46 Stable
Hello,

Can you try adding a config option? Go to:

components/com_jevents/views/day/tmpl/listevents.xml

And add:

<field name="com_showrepeats" type="list" class="btn-group" default="-1" menu="hide" label="JEV_VIEW_REPEAT_YEAR_LIST" description="" difficulty="2">
<option value="-1">USE_GLOBAL</option>
<option value="0">JEV_NO</option>
<option value="1">JEV_YES</option>
</field>

before:
<field name="@spacer" type="jevinfo" default='ADVANCED_SETTINGS' label="" description="" />

Then configure the menu item to 'YES' on show all repeats.

This should work as you expect and limit it to the day view menu item. If it works fine, let me know and I'll try and get it in the next release.

Many thanks
Tony
·
Thursday, 14 June 2018 09:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the options change, YES it appears to have the desired effect
·
Friday, 22 June 2018 02:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok great, I've made a PR for this to be in V3.4.48.

Many thanks
Tony
·
Wednesday, 27 June 2018 16:46
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post