コード例 #1
0
            ?>
					<td headers="jem_state">
						<?php 
            echo !empty($row->state) ? $this->escape($row->state) : '-';
            ?>
					</td>
				<?php 
        }
        ?>

				<?php 
        if ($this->jemsettings->showcat == 1) {
            ?>
					<td headers="jem_category">
						<?php 
            echo JemOutput::getCategoryList($row->categories, $this->jemsettings->catlinklist)[0];
            ?>
					</td>
				<?php 
        }
        ?>

				<?php 
        if ($this->jemsettings->showatte == 1) {
            ?>
					<td headers="jem_attendees">
						<?php 
            echo !empty($row->regCount) ? $this->escape($row->regCount) : '-';
            ?>
					</td>
				<?php 
コード例 #2
0
					</td>
				<?php endif; ?>

				<?php if ($this->jemsettings->showcity == 1) : ?>
					<td headers="jem_city" align="left" valign="top">
						<?php echo !empty($row->city) ? $this->escape($row->city) : '-'; ?>
					</td>
				<?php endif; ?>

				<?php if ($this->jemsettings->showstate == 1) : ?>
					<td headers="jem_state" align="left" valign="top">
						<?php echo !empty($row->state) ? $this->escape($row->state) : '-'; ?>
					</td>
				<?php endif; ?>

				<?php if ($this->jemsettings->showcat == 1) : ?>
					<td headers="jem_category" align="left" valign="top">
						<?php echo implode(", ", JemOutput::getCategoryList($row->categories, $this->jemsettings->catlinklist)); ?>
					</td>
				<?php endif; ?>

				<?php if ($this->jemsettings->showatte == 1) : ?>
					<td headers="jem_attendees" align="left" valign="top">
						<?php echo !empty($row->regCount) ? $this->escape($row->regCount) : '-'; ?>
					</td>
				<?php endif; ?>
				</tr>
			<?php endforeach; ?>
		<?php endif; ?>
	</tbody>
</table>
コード例 #3
0
ファイル: helper.php プロジェクト: JKoelman/JEM-3
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 public static function getList(&$params)
 {
     mb_internal_encoding('UTF-8');
     // Retrieve Eventslist model for the data
     $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true));
     // Set params for the model
     // has to go before the getItems function
     $model->setState('params', $params);
     $model->setState('filter.access', true);
     // filter published
     //  0: unpublished
     //  1: published
     //  2: archived
     // -2: trashed
     $type = $params->get('type');
     $offset_hourss = $params->get('offset_hours', 0);
     // all upcoming or unfinished events
     if ($type == 0 || $type == 1) {
         $offset_minutes = $offset_hourss * 60;
         $model->setState('filter.published', 1);
         $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC'));
         $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) ";
         $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") ";
     } elseif ($type == 2) {
         $model->setState('filter.published', 2);
         $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC'));
         $cal_from = "";
     } elseif ($type == 3) {
         $offset_days = (int) round($offset_hourss / 24);
         $model->setState('filter.published', 1);
         $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC'));
         $cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= {$offset_days}) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= {$offset_days}))";
     }
     $model->setState('filter.calendar_from', $cal_from);
     $model->setState('filter.groupby', 'a.id');
     // clean parameter data
     $catids = $params->get('catid');
     $venids = $params->get('venid');
     $eventids = $params->get('eventid');
     // filter category's
     if ($catids) {
         $model->setState('filter.category_id', $catids);
         $model->setState('filter.category_id.include', true);
     }
     // filter venue's
     if ($venids) {
         $model->setState('filter.venue_id', $venids);
         $model->setState('filter.venue_id.include', true);
     }
     // filter event id's
     if ($eventids) {
         $model->setState('filter.event_id', $eventids);
         $model->setState('filter.event_id.include', true);
     }
     // count
     $count = $params->get('count', '2');
     $model->setState('list.limit', $count);
     if ($params->get('use_modal', 0)) {
         JHtml::_('behavior.modal', 'a.flyermodal');
     }
     // Retrieve the available Events
     $events = $model->getItems();
     if (!$events) {
         return array();
     }
     // define list-array
     // in here we collect the row information
     $lists = array();
     $i = 0;
     $FixItemID = $params->get('FixItemID', '');
     $eventimg = $params->get('eventimg', 1);
     $venueimg = $params->get('venueimg', 1);
     /**
      * DEFINE FOREACH
      */
     foreach ($events as $row) {
         // create thumbnails if needed and receive imagedata
         if ($row->datimage) {
             $dimage = JEMImage::flyercreator($row->datimage, 'event');
         } else {
             $dimage = null;
         }
         if ($row->locimage) {
             $limage = JEMImage::flyercreator($row->locimage, 'venue');
         } else {
             $limage = null;
         }
         // cut titel
         $length = mb_strlen($row->title);
         $maxlength = $params->get('cuttitle', '18');
         if ($length > $maxlength && $maxlength > 0) {
             $row->title = mb_substr($row->title, 0, $maxlength);
             $row->title = $row->title . '...';
         }
         $lists[$i] = new stdClass();
         $lists[$i]->title = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
         $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8');
         $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
         list($lists[$i]->date, $lists[$i]->time) = modJEMwideHelper::_format_date_time($row, $params);
         if ($FixItemID) {
             $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_('index.php?option=com_jem&view=event&id=' . $row->slug . '&Itemid=' . $FixItemID) : '';
             $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_('index.php?option=com_jem&view=venue&id=' . $row->venueslug . '&Itemid=' . $FixItemID) : '';
         } else {
             $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : '';
             $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : '';
         }
         $lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1), false, $FixItemID));
         // images
         if ($eventimg) {
             if ($dimage == null) {
                 $lists[$i]->eventimage = '';
                 $lists[$i]->eventimageorig = '';
             } else {
                 $lists[$i]->eventimage = JURI::base(true) . '/' . $dimage['thumb'];
                 $lists[$i]->eventimageorig = JURI::base(true) . '/' . $dimage['original'];
             }
         } else {
             $lists[$i]->eventimage = '';
             $lists[$i]->eventimageorig = '';
         }
         if ($venueimg) {
             if ($limage == null) {
                 $lists[$i]->venueimage = '';
                 $lists[$i]->venueimageorig = '';
             } else {
                 $lists[$i]->venueimage = JURI::base(true) . '/' . $limage['thumb'];
                 $lists[$i]->venueimageorig = JURI::base(true) . '/' . $limage['original'];
             }
         } else {
             $lists[$i]->venueimage = '';
             $lists[$i]->venueimageorig = '';
         }
         $lists[$i]->eventdescription = strip_tags($row->fulltext);
         $lists[$i]->venuedescription = strip_tags($row->locdescription);
         $i++;
     }
     return $lists;
 }
コード例 #4
0
ファイル: helper.php プロジェクト: BillVGN/PortalPRP
	/**
	 * Method to get the events
	 *
	 * @access public
	 * @return array
	 */
	public static function getList(&$params)
	{
		mb_internal_encoding('UTF-8');

		$db     = JFactory::getDBO();
		$user   = JemFactory::getUser();
		$levels = $user->getAuthorisedViewLevels();

		# Retrieve Eventslist model for the data
		$model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true));

		# Set params for the model
		# has to go before the getItems function
		$model->setState('params', $params);

		# filter published
		#  0: unpublished
		#  1: published
		#  2: archived
		# -2: trashed

		# type:
		#  0: upcoming (not started) - dates,times > now+offset
		#  1: unfinished (not ended) - enddates,endtimes > now+offset
		#  2: archived               - no limit, but from now back to the past
		#  3: running (today)        - enddates,endtimes > today+offset AND dates,times < tomorrow+offset
		#  4: featured               - ? (same as upcoming yet)
		$type = (int)$params->get('type');
		$offset_hours = (int)$params->get('offset_hours', 0);
		$max_title_length = (int)$params->get('cuttitle', '25');

		# clean parameter data
		$catids = JemHelper::getValidIds($params->get('catid'));
		$venids = JemHelper::getValidIds($params->get('venid'));
		$eventids = JemHelper::getValidIds($params->get('eventid'));
		$stateloc      = $params->get('stateloc');
		$stateloc_mode = $params->get('stateloc_mode', 0);

		# Open date support
		$opendates = empty($eventids) ? 0 : 1; // allow open dates if limited to specific events
		$model->setState('filter.opendates', $opendates);

		# all upcoming or unfinished events
		if (($type == 0) || ($type == 1)) {
			$offset_minutes = $offset_hours * 60;

			$model->setState('filter.published',1);
			$model->setState('filter.orderby',array('a.dates ASC','a.times ASC'));

			$cal_from = "(a.dates IS NULL OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > $offset_minutes) ";
			$cal_from .= ($type == 1) ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > $offset_minutes)) " : ") ";
		}

		# archived events only
		elseif ($type == 2) {
			$model->setState('filter.published',2);
			$model->setState('filter.orderby',array('a.dates DESC','a.times DESC'));
			$cal_from = "";
		}

		# currently running events only (today + offset is inbetween start and end date of event)
		elseif ($type == 3) {
			$offset_days = (int)round($offset_hours / 24);

			$model->setState('filter.published',1);
			$model->setState('filter.orderby',array('a.dates ASC','a.times ASC'));

			$cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= $offset_days) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= $offset_days))";
		}

		# featured
		elseif ($type == 4) {
			$offset_minutes = $offset_hours * 60;

			$model->setState('filter.featured',1);
			$model->setState('filter.orderby',array('a.dates ASC','a.times ASC'));

			$cal_from  = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > $offset_minutes) ";
			$cal_from .= " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > $offset_minutes)) ";
		}

		$model->setState('filter.calendar_from',$cal_from);
		$model->setState('filter.groupby','a.id');

		# filter category's
		if ($catids) {
			$model->setState('filter.category_id', $catids);
			$model->setState('filter.category_id.include', true);
		}

		# filter venue's
		if ($venids) {
			$model->setState('filter.venue_id', $venids);
			$model->setState('filter.venue_id.include', true);
		}

		# filter event id's
		if ($eventids) {
			$model->setState('filter.event_id', $eventids);
			$model->setState('filter.event_id.include', true);
		}

		# filter venue's state/province
		if ($stateloc) {
			$model->setState('filter.venue_state', $stateloc);
			$model->setState('filter.venue_state.mode', $stateloc_mode); // 0: exact, 1: partial
		}

		# count
		$count = $params->get('count', '2');
		$model->setState('list.limit', $count);

		if ($params->get('use_modal', 0)) {
			JHtml::_('behavior.modal', 'a.flyermodal');
		}

		# date/time
		$dateFormat = $params->get('formatdate', '');
		$timeFormat = $params->get('formattime', '');
		$addSuffix  = empty($timeFormat); // if we use component's default time format we can also add corresponding suffix

		# Retrieve the available Events
		$events = $model->getItems();

		$color = $params->get('color');
		$fallback_color = $params->get('fallbackcolor', '#EEEEEE');

		# Loop through the result rows and prepare data
		$lists = array();
		$i     = 0;

		foreach ($events as $row)
		{
			# create thumbnails if needed and receive imagedata
			$dimage = $row->datimage ? JEMImage::flyercreator($row->datimage, 'event') : null;
			$limage = $row->locimage ? JEMImage::flyercreator($row->locimage, 'venue') : null;

			#################
			## DEFINE LIST ##
			#################

			$lists[$i] = new stdClass();

			# check view access
			if (in_array($row->access, $levels)) {
				# We know that user has the privilege to view the event
				$lists[$i]->link = JRoute::_(JEMHelperRoute::getEventRoute($row->slug));
				$lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE');
			} else {
				$lists[$i]->link = JRoute::_('index.php?option=com_users&view=login');
				$lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE_REGISTER');
			}

			# cut titel
			$fulltitle = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
			if (mb_strlen($fulltitle) > $max_title_length) {
				$title = mb_substr($fulltitle, 0, $max_title_length) . '...';
			} else {
				$title = $fulltitle;
			}

			$lists[$i]->title       = $title;
			$lists[$i]->fulltitle   = $fulltitle;
			$lists[$i]->venue       = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8');
			$lists[$i]->catname     = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1)));
			$lists[$i]->state       = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
			$lists[$i]->city        = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8');
			$lists[$i]->eventlink   = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : '';
			$lists[$i]->venuelink   = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : '';

			# time/date
			static $formats  = array('year' => 'Y', 'month' => 'F', 'day' => 'j', 'weekday' => 'l');
			static $defaults = array('year' => '&nbsp;', 'month' => '', 'day' => '?', 'weekday' => '');

			$lists[$i]->day         = modJEMteaserHelper::_format_day($row, $params);
			$tmpdate                = empty($row->dates) ? $defaults : self::_format_date_fields($row->dates, $formats);
			$lists[$i]->dayname     = $tmpdate['weekday']; // keep them for backward compatibility
			$lists[$i]->daynum      = $tmpdate['day'];
			$lists[$i]->month       = $tmpdate['month'];
			$lists[$i]->year        = $tmpdate['year'];
			$lists[$i]->startdate   = $tmpdate;
			$lists[$i]->enddate     = empty($row->enddates) ? $defaults : self::_format_date_fields($row->enddates, $formats);
			list($lists[$i]->date,
			     $lists[$i]->time)  = self::_format_date_time($row, $params->get('datemethod', 1), $dateFormat, $timeFormat, $addSuffix);
			$lists[$i]->dateinfo    = JEMOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateFormat, $timeFormat, $addSuffix);

			if ($dimage == null) {
				$lists[$i]->eventimage     = JUri::base(true).'/media/system/images/blank.png';
				$lists[$i]->eventimageorig = JUri::base(true).'/media/system/images/blank.png';
			} else {
				$lists[$i]->eventimage     = JUri::base(true).'/'.$dimage['thumb'];
				$lists[$i]->eventimageorig = JUri::base(true).'/'.$dimage['original'];
			}

			if ($limage == null) {
				$lists[$i]->venueimage     = JUri::base(true).'/media/system/images/blank.png';
				$lists[$i]->venueimageorig = JUri::base(true).'/media/system/images/blank.png';
			} else {
				$lists[$i]->venueimage     = JUri::base(true).'/'.$limage['thumb'];
				$lists[$i]->venueimageorig = JUri::base(true).'/'.$limage['original'];
			}

			$length = $params->get('descriptionlength');
			$length2 = 1;
			$etc = '...';
			$etc2 = JText::_('MOD_JEM_TEASER_NO_DESCRIPTION');

			//append <br /> tags on line breaking tags so they can be stripped below
			$description = preg_replace("'<(hr[^/>]*?/|/(div|h[1-6]|li|p|tr))>'si", "$0<br />", $row->introtext);

			//strip html tags but leave <br /> tags
			$description = strip_tags($description, "<br>");

			//switch <br /> tags to space character
			if ($params->get('br') == 0) {
				$description = str_replace('<br />',' ', $description);
			}
			//
			if (strlen($description) > $length) {
				$length -= strlen($etc);
				$description = preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $length+1));
				$lists[$i]->eventdescription = substr($description, 0, $length).$etc;
			} elseif (strlen($description) < $length2) {
				$length -= strlen($etc2);
				$description = preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $length+1));
				$lists[$i]->eventdescription = substr($description, 0, $length).$etc2;
			} else {
				$lists[$i]->eventdescription = $description;
			}

			$lists[$i]->readmore = strlen(trim($row->fulltext));

			$lists[$i]->colorclass = $color;
			if (($color == 'category') && !empty($row->categories)) {
				$colors = array();
				foreach ($row->categories as $category) {
					if (!empty($category->color)) {
						$colors[$category->color] = $category->color;
					}
				}
				$lists[$i]->color = (count($colors) == 1) ? array_pop($colors) : $fallback_color;
			}

			$i++;
		} // foreach ($events as $row)

		return $lists;
	}
コード例 #5
0
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 public static function getList(&$params)
 {
     mb_internal_encoding('UTF-8');
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $levels = $user->getAuthorisedViewLevels();
     # Retrieve Eventslist model for the data
     $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true));
     # Set params for the model
     # has to go before the getItems function
     $model->setState('params', $params);
     # filter published
     #  0: unpublished
     #  1: published
     #  2: archived
     # -2: trashed
     $type = (int) $params->get('type');
     $offset_hours = (int) $params->get('offset_hours', 0);
     $max_title_length = (int) $params->get('cuttitle', '25');
     # clean parameter data
     $catids = JemHelper::getValidIds($params->get('catid'));
     $venids = JemHelper::getValidIds($params->get('venid'));
     # all upcoming or unfinished events
     if ($type == 0 || $type == 1) {
         $offset_minutes = $offset_hours * 60;
         $model->setState('filter.published', 1);
         $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC'));
         $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'23:59:59'))) > {$offset_minutes}) ";
         $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") ";
     } elseif ($type == 2) {
         $model->setState('filter.published', 2);
         $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC'));
         $cal_from = "";
     } elseif ($type == 3) {
         $offset_days = (int) round($offset_hours / 24);
         $model->setState('filter.published', 1);
         $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC'));
         $cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= {$offset_days}) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= {$offset_days}))";
     }
     $model->setState('filter.calendar_from', $cal_from);
     $model->setState('filter.groupby', 'a.id');
     # filter category's
     if ($catids) {
         $model->setState('filter.category_id', $catids);
         $model->setState('filter.category_id.include', true);
     }
     # filter venue's
     if ($venids) {
         $model->setState('filter.venue_id', $venids);
         $model->setState('filter.venue_id.include', true);
     }
     # count
     $count = $params->get('count', '2');
     $model->setState('list.limit', $count);
     if ($params->get('use_modal', 0)) {
         JHtml::_('behavior.modal', 'a.flyermodal');
     }
     # date/time
     $dateFormat = $params->get('formatdate', '');
     $timeFormat = $params->get('formattime', '');
     $addSuffix = empty($timeFormat);
     // if we use component's default time format we can also add corresponding suffix
     # Retrieve the available Events
     $events = $model->getItems();
     # Loop through the result rows and prepare data
     $lists = array();
     $i = 0;
     foreach ($events as $row) {
         # create thumbnails if needed and receive imagedata
         $dimage = $row->datimage ? JEMImage::flyercreator($row->datimage, 'event') : null;
         $limage = $row->locimage ? JEMImage::flyercreator($row->locimage, 'venue') : null;
         #################
         ## DEFINE LIST ##
         #################
         $lists[$i] = new stdClass();
         # cut titel
         $fulltitle = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
         if (mb_strlen($fulltitle) > $max_title_length) {
             $title = mb_substr($fulltitle, 0, $max_title_length) . '...';
         } else {
             $title = $fulltitle;
         }
         ## Also trim venue name to same as title
         $fullvenuename = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8');
         if (mb_strlen($fullvenuename) > $max_title_length) {
             $venue = mb_substr($fullvenuename, 0, $max_title_length) . '...';
         } else {
             $venue = $fullvenuename;
         }
         $lists[$i]->title = $title;
         $lists[$i]->fulltitle = $fulltitle;
         $lists[$i]->venue = $venue;
         $lists[$i]->fullvenue = $fullvenuename;
         $lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1)));
         $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
         $lists[$i]->city = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8');
         $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : '';
         $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : '';
         # time/date
         list($lists[$i]->date, $lists[$i]->time) = self::_format_date_time($row, $params->get('datemethod', 1), $dateFormat, $timeFormat, $addSuffix);
         $lists[$i]->dateinfo = JEMOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateFormat, $timeFormat, $addSuffix);
         if ($dimage == null) {
             $lists[$i]->eventimage = JUri::base(true) . '/media/system/images/blank.png';
             $lists[$i]->eventimageorig = JUri::base(true) . '/media/system/images/blank.png';
         } else {
             $lists[$i]->eventimage = JUri::base(true) . '/' . $dimage['thumb'];
             $lists[$i]->eventimageorig = JUri::base(true) . '/' . $dimage['original'];
         }
         if ($limage == null) {
             $lists[$i]->venueimage = JUri::base(true) . '/media/system/images/blank.png';
             $lists[$i]->venueimageorig = JUri::base(true) . '/media/system/images/blank.png';
         } else {
             $lists[$i]->venueimage = JUri::base(true) . '/' . $limage['thumb'];
             $lists[$i]->venueimageorig = JUri::base(true) . '/' . $limage['original'];
         }
         $lists[$i]->eventdescription = strip_tags($row->fulltext);
         $lists[$i]->venuedescription = strip_tags($row->locdescription);
         $i++;
     }
     // foreach ($events as $row)
     return $lists;
 }
コード例 #6
0
ファイル: helper.php プロジェクト: JKoelman/JEM-3
 /**
  * Method to get the events
  *
  * @access public
  * @return array
  */
 public static function getList(&$params)
 {
     mb_internal_encoding('UTF-8');
     // Retrieve Eventslist model for the data
     $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true));
     // Set params for the model
     // has to go before the getItems function
     $model->setState('params', $params);
     $model->setState('filter.access', true);
     // filter published
     //  0: unpublished
     //  1: published
     //  2: archived
     // -2: trashed
     $type = $params->get('type');
     $offset_hourss = $params->get('offset_hours', 0);
     // all upcoming events
     if ($type == 0 || $type == 1) {
         $offset_minutes = $offset_hourss * 60;
         $model->setState('filter.published', 1);
         $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC'));
         $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) ";
         $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") ";
     } elseif ($type == 2) {
         $model->setState('filter.published', 2);
         $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC'));
         $cal_from = "";
     } elseif ($type == 3) {
         $offset_days = (int) round($offset_hourss / 24);
         $model->setState('filter.published', 1);
         $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC'));
         $cal_from = " ((DATEDIFF(a.dates, CURDATE()) <= {$offset_days}) AND (DATEDIFF(IFNULL(a.enddates,a.dates), CURDATE()) >= {$offset_days}))";
     } elseif ($type == 4) {
         $offset_minutes = $offset_hourss * 60;
         $model->setState('filter.featured', 1);
         $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC'));
         $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) ";
         $cal_from .= " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) ";
     }
     $model->setState('filter.calendar_from', $cal_from);
     $model->setState('filter.groupby', 'a.id');
     // clean parameter data
     $catids = $params->get('catid');
     $venids = $params->get('venid');
     $eventids = $params->get('eventid');
     // filter category's
     if ($catids) {
         $model->setState('filter.category_id', $catids);
         $model->setState('filter.category_id.include', true);
     }
     // filter venue's
     if ($venids) {
         $model->setState('filter.venue_id', $venids);
         $model->setState('filter.venue_id.include', true);
     }
     // filter event id's
     if ($eventids) {
         $model->setState('filter.event_id', $eventids);
         $model->setState('filter.event_id.include', true);
     }
     // count
     $count = $params->get('count', '2');
     if ($params->get('use_modal', 0)) {
         JHtml::_('behavior.modal', 'a.flyermodal');
     }
     $model->setState('list.limit', $count);
     // Retrieve the available Events
     $events = $model->getItems();
     if (!$events) {
         return array();
     }
     // Loop through the result rows and prepare data
     $i = 0;
     $lists = array();
     $FixItemID = $params->get('FixItemID', '');
     $eventimg = $params->get('eventimg', 1);
     $venueimg = $params->get('venueimg', 1);
     foreach ($events as $row) {
         // create thumbnails if needed and receive imagedata
         if ($row->datimage) {
             $dimage = JEMImage::flyercreator($row->datimage, 'event');
         } else {
             $dimage = null;
         }
         if ($row->locimage) {
             $limage = JEMImage::flyercreator($row->locimage, 'venue');
         } else {
             $limage = null;
         }
         // cut titel
         $length = mb_strlen($row->title);
         $maxlength = $params->get('cuttitle', '18');
         if ($length > $maxlength && $maxlength > 0) {
             $row->title = mb_substr($row->title, 0, $maxlength);
             $row->title = $row->title . '...';
         }
         /**
          * DEFINE LIST
          **/
         $settings = JEMHelper::globalattribs();
         $access = !$settings->get('show_noauth', '0');
         $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
         $lists[$i] = new stdClass();
         $lists[$i]->title = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
         $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8');
         $lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
         $lists[$i]->city = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8');
         // time/date
         $lists[$i]->date = modJEMteaserHelper::_format_date($row, $params);
         $lists[$i]->day = modJEMteaserHelper::_format_day($row, $params);
         $lists[$i]->dayname = modJEMteaserHelper::_format_dayname($row);
         $lists[$i]->daynum = modJEMteaserHelper::_format_daynum($row);
         $lists[$i]->month = modJEMteaserHelper::_format_month($row);
         $lists[$i]->year = modJEMteaserHelper::_format_year($row);
         $lists[$i]->time = $row->times ? modJEMteaserHelper::_format_time($row->dates, $row->times, $params) : '';
         if ($access || in_array($row->access, $authorised)) {
             // We know that user has the privilege to view the event
             if ($FixItemID) {
                 $lists[$i]->link = JRoute::_('index.php?option=com_jem&view=event&id=' . $row->slug . '&Itemid=' . $FixItemID);
             } else {
                 $lists[$i]->link = JRoute::_(JEMHelperRoute::getEventRoute($row->slug));
             }
             $lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE');
         } else {
             $lists[$i]->link = JRoute::_('index.php?option=com_users&view=login');
             $lists[$i]->linkText = JText::_('MOD_JEM_TEASER_READMORE_REGISTER');
         }
         if ($FixItemID) {
             $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_('index.php?option=com_jem&view=event&id=' . $row->slug . '&Itemid=' . $FixItemID) : '';
             $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_('index.php?option=com_jem&view=venue&id=' . $row->venueslug . '&Itemid=' . $FixItemID) : '';
         } else {
             $lists[$i]->eventlink = $params->get('linkevent', 1) ? JRoute::_(JEMHelperRoute::getEventRoute($row->slug)) : '';
             $lists[$i]->venuelink = $params->get('linkvenue', 1) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : '';
         }
         $lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1), false, $FixItemID));
         // images
         if ($eventimg) {
             if ($dimage == null) {
                 $lists[$i]->eventimage = '';
                 $lists[$i]->eventimageorig = '';
             } else {
                 $lists[$i]->eventimage = JURI::base(true) . '/' . $dimage['thumb'];
                 $lists[$i]->eventimageorig = JURI::base(true) . '/' . $dimage['original'];
             }
         } else {
             $lists[$i]->eventimage = '';
             $lists[$i]->eventimageorig = '';
         }
         if ($venueimg) {
             if ($limage == null) {
                 $lists[$i]->venueimage = '';
                 $lists[$i]->venueimageorig = '';
             } else {
                 $lists[$i]->venueimage = JURI::base(true) . '/' . $limage['thumb'];
                 $lists[$i]->venueimageorig = JURI::base(true) . '/' . $limage['original'];
             }
         } else {
             $lists[$i]->venueimage = '';
             $lists[$i]->venueimageorig = '';
         }
         $length = $params->get('descriptionlength');
         $length2 = 1;
         $etc = '...';
         $etc2 = JText::_('MOD_JEM_TEASER_NO_DESCRIPTION');
         //strip html tags but leave <br /> tags
         $description = strip_tags($row->introtext, "<br>");
         //switch <br /> tags to space character
         if ($params->get('br') == 0) {
             $description = str_replace('<br />', ' ', $description);
         }
         //
         if (strlen($description) > $length) {
             $length -= strlen($etc);
             $description = preg_replace('/\\s+?(\\S+)?$/', '', substr($description, 0, $length + 1));
             $lists[$i]->eventdescription = substr($description, 0, $length) . $etc;
         } else {
             if (strlen($description) < $length2) {
                 $length -= strlen($etc2);
                 $description = preg_replace('/\\s+?(\\S+)?$/', '', substr($description, 0, $length + 1));
                 $lists[$i]->eventdescription = substr($description, 0, $length) . $etc2;
             } else {
                 $lists[$i]->eventdescription = $description;
             }
         }
         $lists[$i]->readmore = strlen(trim($row->fulltext));
         $i++;
     }
     return $lists;
 }
コード例 #7
0
ファイル: default.php プロジェクト: BillVGN/PortalPRP
					//Prepare time
					if (!$row->times) {
						$displaytime = '-';
					} else {
						$time = strftime( $this->jemsettings->formattime, strtotime( $row->times ));
						$displaytime = $time.' '.$this->jemsettings->timename;
					}
					echo $displaytime;
				?>
			</td>
			<td><?php echo $row->venue ? $this->escape($row->venue) : '-'; ?></td>
			<td><?php echo $row->city ? $this->escape($row->city) : '-'; ?></td>
			<td>
			<?php
			# we're referring to the helper due to the multi-cat feature
			echo implode(", ",JemOutput::getCategoryList($row->categories, false));
			?>
			</td>
			<td class="center">
				<?php echo JHtml::_('jgrid.published', $row->published, $i,'',false); ?>
			</td>
		</tr>
			<?php endforeach; ?>
	</tbody>

</table>

<p class="copyright">
	<?php echo JemAdmin::footer( ); ?>
</p>
コード例 #8
0
ファイル: modal.php プロジェクト: JKoelman/JEM-3
    echo $this->escape($lang);
    ?>
',null);">
						<?php 
    echo $this->escape($item->title);
    ?>
</a>
				</td>
				<td class="center">
					<?php 
    echo $this->escape($item->access_level);
    ?>
				</td>
				<td class="center">
					<?php 
    echo implode(", ", JemOutput::getCategoryList($item->categories, $this->jemsettings->catlinklist, true));
    ?>
				</td>
				<td class="center nowrap">
					<?php 
    echo $displaydate;
    ?>
				</td>
				<td class="center">
					<?php 
    echo (int) $item->id;
    ?>
				</td>
			</tr>
			<?php 
}
コード例 #9
0
ファイル: listevents.php プロジェクト: JKoelman/JEM-3
 protected function _display($rows, $parameters, $listevents_id)
 {
     if (!$rows) {
         return $parameters["eventsmsgnone"];
     }
     $html_list = '<div class="listevents" id="listevents-' . $listevents_id . '">';
     $html_list .= '<ul>';
     $n_event = 0;
     foreach ($rows as $event) {
         require_once JPATH_BASE . "/components/com_jem/helpers/route.php";
         $linkdetails = JRoute::_(JEMHelperRoute::getEventRoute($event->slug));
         $linkdate = JRoute::_(JEMHelperRoute::getRoute(str_replace('-', '', $event->dates), 'day'));
         $linkvenue = JRoute::_(JEMHelperRoute::getVenueRoute($event->venueslug));
         $jemsettings = JemHelper::config();
         if ($parameters["eventstype"] == 'regprev' || $parameters["eventstype"] == 'regnext') {
             require_once JPATH_BASE . "/components/com_jem/models/eventlist.php";
             $eventsmodel = new EventListModelEventList();
             $query = 'SELECT COUNT(uid) as attendees from #__eventlist_register WHERE event = ' . $event->eventid;
             $eventsmodel->_db->setQuery($query);
             $_event = $eventsmodel->_db->loadObject();
             $attendees = $_event->attendees;
             if ($attendees == 0) {
                 continue;
             }
         }
         $html_list .= '<li id="listevent' . ($n_event + 1) . '">';
         if ($parameters["eventstitle"] != 'off') {
             $html_list .= '<span id="eventtitle">';
             $html_list .= $parameters["eventstitle"] == 'link' ? '<a href="' . $linkdetails . '">' : '';
             $html_list .= $event->title;
             $html_list .= $parameters["eventstitle"] == 'link' ? '</a>' : '';
             $html_list .= '</span>';
         }
         if ($parameters["eventsdate"] != 'off' && $event->dates) {
             # display startdate
             require_once JPATH_BASE . "/components/com_jem/helpers/helper.php";
             require_once JPATH_BASE . "/components/com_jem/classes/output.class.php";
             $html_list .= ' : ' . '<span id="eventdate">';
             $html_list .= $parameters["eventsdate"] == 'link' ? '<a href="' . $linkdate . '">' : '';
             $html_list .= JEMOutput::formatdate($event->dates);
             $html_list .= $parameters["eventsdate"] == 'link' ? '</a>' : '';
             $html_list .= '</span>';
         }
         if ($parameters["eventstime"] != 'off' && $event->times) {
             # display starttime
             require_once JPATH_BASE . "/components/com_jem/helpers/helper.php";
             require_once JPATH_BASE . "/components/com_jem/classes/output.class.php";
             $html_list .= ' ' . '<span id="eventtime">';
             $html_list .= JEMOutput::formattime($event->times);
             $html_list .= '</span>';
         }
         if ($parameters["eventsvenue"] != 'off' && $event->venue) {
             $html_list .= ' : ' . '<span id="eventvenue">';
             $html_list .= $parameters["eventsvenue"] == 'link' ? '<a href="' . $linkvenue . '">' : '';
             $html_list .= $event->venue;
             $html_list .= $parameters["eventsvenue"] == 'link' ? '</a>' : '';
             $html_list .= '</span>';
         }
         if ($parameters["eventscategory"] != 'off' && $event->categories) {
             if ($parameters["eventscategory"] == 'link') {
                 $catlink = 1;
             } else {
                 $catlink = false;
             }
             $html_list .= " ";
             $html_list .= implode(", ", JemOutput::getCategoryList($event->categories, $catlink));
         }
         $html_list .= '</li>';
         $n_event++;
         if ($parameters["eventsmax"] && $n_event >= $parameters["eventsmax"]) {
             break;
         }
     }
     if ($n_event == 0) {
         $html_list .= $parameters["eventsmsgnone"];
     }
     $html_list .= '</ul>';
     $html_list .= '</div>';
     return $html_list;
 }