By Guest on Saturday, 18 July 2015
Posted in Pre-Sales
Replies 12
Likes 0
Views 2.1K
Votes 0
Hi,

Is the jEvents slider can display 3 or more events once? I found in your demo only 1 image per slide. I need 3 or more per slide.
If can, is that responsive? Because latest events module uses non-responsive HTML.
The slideshow module is designed to show one event at a time. If you know some PHP you should be able to create an override to output 3 at a time - I could help you with that when I return from my vacation in a week's time.
·
Sunday, 19 July 2015 16:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,
I need to create an output of 4 events at the time. And if an event has no image then the code picks a random image from a folder containing an images bank. Is there an all ready module override?
Thanks in advance
Roland
·
Saturday, 25 March 2017 21:08
·
0 Likes
·
0 Votes
·
0 Comments
·
rbi

There is no code off the shelf to do this - you would need to write a template override to do this. Copy the file modules/mod_jevents_slideshow/tmpl/default/slideshow.php to templates/YOURTEMPLATE/html/mod_jevents_slideshow/default/slideshow.php and make your modifications there

You will need to change the output to include blocks of 4 events and images as a time. Please make sure you upgrade to version 3.4.3 before you start your customisations

Geraint
·
Monday, 27 March 2017 11:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Geraint,

I've coded the stuff including the random image chosen from a bank of images in case event has no image. Actually I had to force the directory name. It could be a feature of interest for your future developments.

But I have lost the animation because I could not make it work. So I deleted the script and the buttons to clean up.
It now shows a static carousel - horizontal - of 4 images next to each other. I would like a horizontal scroll <=> a page scroll = 4 images at a time.

<?php
/**
* JEvents Component for Joomla!
*
* @version $Id: mod_jevents_slideshow.php 3309 2012-03-01 10:07:50Z geraintedwards $
* @package JEvents
* @subpackage Module Slideshow JEvents
* @copyright Copyright (C) 2006-2014 GWE Systems Ltd
* @license GNU/GPLv2, see http://www.gnu.org/licenses/gpl-2.0.html
* @link http://www.jevents.net
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

/**
* HTML View class for the module frontend
*
* @static
*/
/** CaDe **/

include_once(JPATH_SITE . "/modules/mod_jevents_latest/tmpl/default/latest.php");

class OverrideDefaultModSlideshowViewCade extends DefaultModLatestView {

public function displaySlideshowEvents() {
$cfg = JEVConfig::getInstance();
$compname = JEV_COM_COMPONENT;

$dispatcher = JDispatcher::getInstance();
$datenow = JEVHelper::getNow();
$eventcounted = array();

$this->getLatestEventsData();

$content = "";
$hasEventsWithImages = false;

$moduleclass_sfx = htmlspecialchars($this->modparams->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');

// create array with images, to be used in case of no image contained in events
// the folder has to have the same name as the one created by the jevent file pluggin, when specifing width and height sizes
$folder = 'images/cade/jevents/300x150';
$type = 'jpg';
$files = array();
$images = array();
$dir = JPATH_BASE . '/' . $folder;
// Check if directory exists
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && $file != 'CVS' && $file != 'index.html') {
$files[] = $file;
}
}
}
closedir($handle);
$i = 0;
foreach ($files as $img) {
if (!is_dir($dir . '/' . $img)) {
if (preg_match('/' . $type . '/', $img)) {
//$dayEvent->_imageurl1=$img;
$i++;
}
}
}
}

if (isset($this->eventsByRelDay) && count($this->eventsByRelDay)) {
//$this->customFormatStr = '<div class="item active">${imageimg1}<div class="carousel-caption">${title}</div></div>';
// only the first should be active!!
// !!! The customFormatStr comes from the module !!!
//$this->customFormatStr = $this->modparams->get('modlatest_CustFmtStr', '<div class="item ISACTIVE"><a href="${eventDetailLink}" target="_self">${imageimg1}</a><div class="carousel-caption">${title}<span class="jevcstart"><a href="${eventDetailLink}" target="_self">${startDate(%e %b %Y)}</a></span></div></div>');
$this->processFormatString();


JHtml::_('bootstrap.carousel', 'jevlatestcarousel', array('interval' => $this->modparams->get('sldelay', 500), 'pause' => 'hover'));
JHTML::stylesheet("modules/mod_jevents_slideshow/css/mod_jevents_slideshow.css");
JHTML::stylesheet("modules/mod_jevents_slideshow/css/custom.css");
//JFactory::getDocument()->addScript("//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.2/jquery.mobile.min.js");
ob_start();
?>
<div class="jevcarousel hidden-xs hidden-sm row <?php echo $moduleclass_sfx; ?>">
<div id="jevlatestcarousel" class="carousel slide jevlatest jevlatestcarousel" data-ride="carousel">
<?php
$count = 0;

foreach ($this->eventsByRelDay as $relDay => $daysEvents) {
// get all of the events for this day

foreach ($daysEvents as $dayEvent) {
$alreadycounted=false;

if (!isset($dayEvent->_imageurl1) || $dayEvent->_imageurl1 == '') {
// no image in event -> we will associate an image from the image bank
foreach ($eventcounted as $eventtitle){
if ($eventtitle==$dayEvent->_title){
$alreadycounted=true;
}
}
if ($alreadycounted){
continue;
}
// select a random image
$i = count($files);
$random = mt_rand(0, $i - 1);
$dayEvent->_imageurl1= $files[$random];
}
if (!$alreadycounted){
$eventcounted[]=$dayEvent->_title;
}
$hasEventsWithImages = true;
?>

<?php
$count++;
}
}
?>
<div class="carousel-inner">
<?php
$firstfour = true;
$imgcount=0;

foreach ($this->eventsByRelDay as $relDay => $daysEvents) {

reset($daysEvents);

// get all of the events for this day
foreach ($daysEvents as $dayEvent) {
if (!isset($dayEvent->_imageurl1) || $dayEvent->_imageurl1 == "") {
continue;
}
$html = "";
$dayEvent->_title=mb_strimwidth($dayEvent->_title, 0, 80, "...");
switch ($dayEvent->_catid) {
case 10:
$cat = "Category 1";
break;
case 11:
$cat = "Category 2";
break;
case 15:
$cat = "Category 3";
break;
}
// generate output according custom string
foreach ($this->splitCustomFormat as $condtoken) {

if (isset($condtoken['cond'])) {
if ($condtoken['cond'] == 'a' && !$dayEvent->alldayevent())
continue;
else if ($condtoken['cond'] == '!a' && $dayEvent->alldayevent())
continue;
else if ($condtoken['cond'] == 'e' && !($dayEvent->noendtime() || $dayEvent->alldayevent()))
continue;
else if ($condtoken['cond'] == '!e' && ($dayEvent->noendtime() || $dayEvent->alldayevent()))
continue;
else if ($condtoken['cond'] == '!m' && $dayEvent->getUnixStartDate() != $dayEvent->getUnixEndDate())
continue;
else if ($condtoken['cond'] == 'm' && $dayEvent->getUnixStartDate() == $dayEvent->getUnixEndDate())
continue;
}
foreach ($condtoken['data'] as $token) {
// The customFormatStr comes from the module - ISACTIVE is in th string of the module in menu extensions->module...
if (is_string($token) && strpos($token, "ISACTIVE")) {
if ($firstfour) {
$token = str_replace("ISACTIVE", "active", $token);
$imgcount++;
if ($imgcount==4):
$firstfour = false;
$imgcount=0;
endif;
} else {
$token = str_replace("ISACTIVE", "", $token);
}
}

unset($match);
unset($dateParm);
$dateParm = "";
$match = '';
if (is_array($token)) {
$match = $token['keyword'];
$dateParm = isset($token['dateParm']) ? trim($token['dateParm']) : "";
} else if (strpos($token, '${') !== false) {
$match = $token;
} else {
$html .= $token;
continue;
}
$this->processMatch($html, $match, $dayEvent, $dateParm, $relDay);
}
}
echo $html;
}
}
?>
</div>

</div>

</div>

<?php
$content = ob_get_clean();
if (!$hasEventsWithImages) {
$content = "";
}
}
if ($this->modparams->get('modlatest_NoEvents', 0) == 1 && !$hasEventsWithImages) {
$content = JText::_('JEV_SLIDE_LATEST_NO_EVENTS');
}
return $content;
}

}
·
Monday, 27 March 2017 15:06
·
0 Likes
·
0 Votes
·
0 Comments
·
Do you have it running somewhere where I can take a look at the output and run it through a javascript debugger?

If the URL is private please add it to the site details tab below
·
Tuesday, 28 March 2017 08:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for your reply Geraint.

The attached image is a screenshot of what I have with the code I have shared with you. I've only added in the image a drawing of the 2 round circles that allow navigation between the 2 sets (or more) of 4 images.
So what is needed is the script to allow horizontal scroll.
·
Tuesday, 28 March 2017 10:51
·
0 Likes
·
0 Votes
·
0 Comments
·
I need the URL to take a look - not just a screenshot. Is this possible?
·
Wednesday, 29 March 2017 10:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Geraint,

Unfortunatelly it is not possible because it is in an intranet.
I am not sure of what you need.
br
Roland
·
Wednesday, 29 March 2017 21:15
·
0 Likes
·
0 Votes
·
0 Comments
·
I needed to run it through a javascript debugger.

If you can zip up your template override and attach it as a file in your reply I can try it on my server. The version you posted above was changed by the forum software to include emoticons etc. so I can't use that.
·
Thursday, 30 March 2017 13:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,
Here it is. I also join global template. The jevent classes definitions are a bit everywhere... I hope this helps.
br
Roland
·
Thursday, 30 March 2017 16:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Unfortunately your logic is wrong - you can't have 4 slides that are active. You need to consolidate 4 slides into 1 and make the first of these groups active.

This would probably involve
1. not outputting $html,
2. Stripping off the <div class="item "> ... </div> or <div class="item active"> ... </div>
3. combining 4 lots of these
4. wrapping the groups in <div class="item "> ... </div> or <div class="item active"> ... </div>
·
Friday, 31 March 2017 13:41
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Geraint.
It is really great already the time that you have spent. You are probably right but I will continue to take a look at this.
It is not critical, at worst, it can remain like this.
Have a good we
Roland
·
Friday, 31 March 2017 15:30
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post