Beispiel #1
0
	/**
	 * Retrieval of update-data
	 */
	function getUpdatedata()
	{
		$installedversion	= JemHelper::getParam(1,'version',1,'com_jem');
		$updateFile			= "http://www.joomlaeventmanager.net/updatecheck/update.xml";
		$checkFile			= self::CheckFile($updateFile);
		$updatedata 		= new stdClass();

		if ($checkFile) {
			$xml = simplexml_load_file($updateFile);

			//version to check, not visible in table
			$updatedata->version 			= $xml->version;

			//in table
			$updatedata->versiondetail		= $xml->versiondetail;
			$updatedata->date				= JEMOutput::formatdate($xml->date);
			$updatedata->info 				= $xml->info;
			$updatedata->download 			= $xml->download;
			$updatedata->notes				= $xml->notes;
			$updatedata->changes 			= explode(';', $xml->changes);
			$updatedata->failed 			= 0;
			$updatedata->installedversion	= $installedversion;
			$updatedata->current			= version_compare($installedversion, $updatedata->version);
		} else {
			$updatedata->failed 			= 1;
			$updatedata->installedversion	= $installedversion;
		}

		return $updatedata;
	}
Beispiel #2
0
 /**
  * Prepares the print screen
  *
  * @param $tpl
  *
  *
  */
 protected function _displayprint($tpl = null)
 {
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     $this->items = $this->get('Items');
     $event = $this->get('Event');
     if (JEMHelper::isValidDate($event->dates)) {
         $event->dates = JEMOutput::formatdate($event->dates);
     } else {
         $event->dates = JText::_('COM_JEM_OPEN_DATE');
     }
     // assign data to template
     $this->event = $event;
     parent::display($tpl);
 }
Beispiel #3
0
	/**
	 * Method to format date and time information
	 *
	 * @access protected
	 * @return array(string, string) returns date and time strings as array
	 */
	protected static function _format_date_time($row, $method, $dateFormat = '', $timeFormat = '', $addSuffix = false)
	{
		if (empty($row->dates)) {
			// open date
			$date  = JEMOutput::formatDateTime('', ''); // "Open date"
			$times = $row->times;
			$endtimes = $row->endtimes;
		} else {
			//Get needed timestamps and format
			$yesterday_stamp = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
			$yesterday       = strftime("%Y-%m-%d", $yesterday_stamp);
			$today_stamp     = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
			$today           = date('Y-m-d');
			$tomorrow_stamp  = mktime(0, 0, 0, date("m"), date("d")+1, date("Y"));
			$tomorrow        = strftime("%Y-%m-%d", $tomorrow_stamp);

			$dates_stamp     = $row->dates ? strtotime($row->dates) : null;
			$enddates_stamp  = $row->enddates ? strtotime($row->enddates) : null;

			$times = $row->times; // show starttime by default

			//if datemethod show day difference
			if ($method == 2) {
				//check if today or tomorrow
				if ($row->dates == $today) {
					$date = JText::_('MOD_JEM_TEASER_TODAY');
				} elseif ($row->dates == $tomorrow) {
					$date = JText::_('MOD_JEM_TEASER_TOMORROW');
				} elseif ($row->dates == $yesterday) {
					$date = JText::_('MOD_JEM_TEASER_YESTERDAY');
				}
				//This one isn't very different from the DAYS AGO output but it seems
				//adequate to use a different language string here.
				//
				//the event has an enddate and it's earlier than yesterday
				elseif ($row->enddates && ($enddates_stamp < $yesterday_stamp)) {
					$days = round(($today_stamp - $enddates_stamp) / 86400);
					$date = JText::sprintf('MOD_JEM_TEASER_ENDED_DAYS_AGO', $days);
					// show endtime instead of starttime
					$times = false;
					$endtimes = $row->endtimes;
				}
				//the event has an enddate and it's later than today but the startdate is earlier than today
				//means a currently running event
				elseif ($row->dates && $row->enddates && ($enddates_stamp > $today_stamp) && ($dates_stamp < $today_stamp)) {
					$days = round(($today_stamp - $dates_stamp) / 86400);
					$date = JText::sprintf('MOD_JEM_TEASER_STARTED_DAYS_AGO', $days);
				}
				//the events date is earlier than yesterday
				elseif ($row->dates && ($dates_stamp < $yesterday_stamp)) {
					$days = round(($today_stamp - $dates_stamp) / 86400);
					$date = JText::sprintf('MOD_JEM_TEASER_DAYS_AGO', $days);
				}
				//the events date is later than tomorrow
				elseif ($row->dates && ($dates_stamp > $tomorrow_stamp)) {
					$days = round(($dates_stamp - $today_stamp) / 86400);
					$date = JText::sprintf('MOD_JEM_TEASER_DAYS_AHEAD', $days);
				}
				else {
					$date = JEMOutput::formatDateTime('', ''); // Oops - say "Open date"
				}
			} else { // datemethod show date - not shown beause there is a calendar image
			// TODO: check date+time to be more acurate
				//Upcoming multidayevent (From 16.10.2008 Until 18.08.2008)
				if (($dates_stamp >= $today_stamp) && ($enddates_stamp > $dates_stamp)) {
					$startdate = JEMOutput::formatdate($row->dates, $dateFormat);
					$enddate = JEMOutput::formatdate($row->enddates, $dateFormat);
					$date = JText::sprintf('MOD_JEM_TEASER_FROM_UNTIL', $startdate, $enddate);
					// don't show endtime because calendar is shown
				}
				//current multidayevent (Until 18.08.2008)
				elseif ($row->enddates && ($enddates_stamp >= $today_stamp) && ($dates_stamp < $today_stamp)) {
					$enddate = JEMOutput::formatdate($row->enddates, $dateFormat);
					$date = JText::sprintf('MOD_JEM_TEASER_UNTIL', $enddate);
					// don't show endtime because calendar is shown
				}
				//single day event
				else {
					$startdate = JEMOutput::formatdate($row->dates, $dateFormat);
					$date = JText::sprintf('MOD_JEM_TEASER_ON_DATE', $startdate);
					// additionally show endtime, but on single day events only to prevent user confusion
					if (empty($row->enddates)) {
						$endtimes = $row->endtimes;
					}
				}
			}
		}

		$time  = empty($times)    ? '' : JEMOutput::formattime($times, $timeFormat, $addSuffix);
		$time .= empty($endtimes) ? '' : ('&nbsp;-&nbsp;' . JEMOutput::formattime($row->endtimes, $timeFormat, $addSuffix));

		return array($date, $time);
	}
Beispiel #4
0
 /**
  * Method to format date information
  *
  * @access public
  * @return array(string, string) returns date and time strings as array
  */
 protected static function _format_date_time($row, &$params)
 {
     //Get needed timestamps and format
     $yesterday_stamp = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
     $yesterday = strftime("%Y-%m-%d", $yesterday_stamp);
     $today_stamp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
     $today = date('Y-m-d');
     $tomorrow_stamp = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
     $tomorrow = strftime("%Y-%m-%d", $tomorrow_stamp);
     $dates_stamp = $row->dates ? strtotime($row->dates) : null;
     $enddates_stamp = $row->enddates ? strtotime($row->enddates) : null;
     //if datemethod show day difference
     if ($params->get('datemethod', 1) == 2) {
         //check if today or tomorrow
         if ($row->dates == $today) {
             $date = JText::_('MOD_JEM_WIDE_TODAY');
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
         } elseif ($row->dates == $tomorrow) {
             $date = JText::_('MOD_JEM_WIDE_TOMORROW');
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
         } elseif ($row->dates == $yesterday) {
             $date = JText::_('MOD_JEM_WIDE_YESTERDAY');
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
             //This one isn't very different from the DAYS AGO output but it seems
             //adequate to use a different language string here.
             //
             //the event has an enddate and it's earlier than yesterday
         } elseif ($row->enddates && $enddates_stamp < $yesterday_stamp) {
             $days = round(($today_stamp - $enddates_stamp) / 86400);
             $date = JText::sprintf('MOD_JEM_WIDE_ENDED_DAYS_AGO', $days);
             $time = $row->times ? JEMOutput::formattime($row->endtimes, null, false) : '';
             //the event has an enddate and it's later than today but the startdate is earlier than today
             //means a currently running event
         } elseif ($row->dates && $row->enddates && $enddates_stamp > $today_stamp && $dates_stamp < $today_stamp) {
             $days = round(($today_stamp - $dates_stamp) / 86400);
             $date = JText::sprintf('MOD_JEM_WIDE_STARTED_DAYS_AGO', $days);
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
             //the events date is earlier than yesterday
         } elseif ($row->dates && $dates_stamp < $yesterday_stamp) {
             $days = round(($today_stamp - $dates_stamp) / 86400);
             $date = JText::sprintf('MOD_JEM_WIDE_DAYS_AGO', $days);
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
             //the events date is later than tomorrow
         } elseif ($row->dates && $dates_stamp > $tomorrow_stamp) {
             $days = round(($dates_stamp - $today_stamp) / 86400);
             $date = JText::sprintf('MOD_JEM_WIDE_DAYS_AHEAD', $days);
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
         }
     } else {
         //Upcoming multidayevent (From 16.10.2008 Until 18.08.2008)
         if ($dates_stamp > $today_stamp && $enddates_stamp > $dates_stamp) {
             $startdate = JEMOutput::formatdate($row->dates, $params->get('formatdate', '%d.%m.%Y'));
             $enddate = JEMOutput::formatdate($row->enddates, $params->get('formatdate', '%d.%m.%Y'));
             $date = JText::sprintf('MOD_JEM_WIDE_FROM_UNTIL', $startdate, $enddate);
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
             // endtime always starts with separator, also if there is no starttime
             $time .= $row->endtimes ? ' - ' . JEMOutput::formattime($row->endtimes, null, false) : '';
         } elseif ($row->enddates && $enddates_stamp > $today_stamp && $dates_stamp < $today_stamp) {
             //format date
             $date = JEMOutput::formatdate($row->enddates, $params->get('formatdate', '%d.%m.%Y'));
             $date = JText::sprintf('MOD_JEM_WIDE_UNTIL', $date);
             $time = $row->times ? JEMOutput::formattime($row->endtimes, null, false) : '';
         } else {
             $date = JEMOutput::formatdate($row->dates, $params->get('formatdate', '%d.%m.%Y'));
             $date = JText::sprintf('MOD_JEM_WIDE_ON_DATE', $date);
             $time = $row->times ? JEMOutput::formattime($row->times, null, false) : '';
         }
     }
     return array($date, $time);
 }
 /**
  * Method to format date and time information
  *
  * @access protected
  * @return array(string, string) returns date and time strings as array
  */
 protected static function _format_date_time($row, $method, $dateFormat = '', $timeFormat = '', $addSuffix = false)
 {
     if (empty($row->dates)) {
         // open date
         $date = JEMOutput::formatDateTime('', '');
         // "Open date"
         $times = $row->times;
         $endtimes = $row->endtimes;
     } else {
         //Get needed timestamps and format
         $yesterday_stamp = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
         $yesterday = strftime("%Y-%m-%d", $yesterday_stamp);
         $today_stamp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
         $today = date('Y-m-d');
         $tomorrow_stamp = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
         $tomorrow = strftime("%Y-%m-%d", $tomorrow_stamp);
         $dates_stamp = $row->dates ? strtotime($row->dates) : null;
         $enddates_stamp = $row->enddates ? strtotime($row->enddates) : null;
         $times = $row->times;
         // show starttime by default
         //if datemethod show day difference
         if ($method == 2) {
             //check if today or tomorrow
             if ($row->dates == $today) {
                 $date = JText::_('MOD_JEM_WIDE_TODAY');
             } elseif ($row->dates == $tomorrow) {
                 $date = JText::_('MOD_JEM_WIDE_TOMORROW');
             } elseif ($row->dates == $yesterday) {
                 $date = JText::_('MOD_JEM_WIDE_YESTERDAY');
             } elseif ($row->enddates && $enddates_stamp < $yesterday_stamp) {
                 $days = round(($today_stamp - $enddates_stamp) / 86400);
                 $date = JText::sprintf('MOD_JEM_WIDE_ENDED_DAYS_AGO', $days);
                 // show endtime instead of starttime
                 $times = false;
                 $endtimes = $row->endtimes;
             } elseif ($row->dates && $row->enddates && $enddates_stamp > $today_stamp && $dates_stamp < $today_stamp) {
                 $days = round(($today_stamp - $dates_stamp) / 86400);
                 $date = JText::sprintf('MOD_JEM_WIDE_STARTED_DAYS_AGO', $days);
             } elseif ($row->dates && $dates_stamp < $yesterday_stamp) {
                 $days = round(($today_stamp - $dates_stamp) / 86400);
                 $date = JText::sprintf('MOD_JEM_WIDE_DAYS_AGO', $days);
             } elseif ($row->dates && $dates_stamp > $tomorrow_stamp) {
                 $days = round(($dates_stamp - $today_stamp) / 86400);
                 $date = JText::sprintf('MOD_JEM_WIDE_DAYS_AHEAD', $days);
             } else {
                 $date = JEMOutput::formatDateTime('', '');
                 // Oops - say "Open date"
             }
         } else {
             // datemethod show date
             // TODO: check date+time to be more acurate
             //Upcoming multidayevent (From 16.10.2008 Until 18.08.2008)
             if ($dates_stamp >= $today_stamp && $enddates_stamp > $dates_stamp) {
                 $startdate = JEMOutput::formatdate($row->dates, $dateFormat);
                 $enddate = JEMOutput::formatdate($row->enddates, $dateFormat);
                 $date = JText::sprintf('MOD_JEM_WIDE_FROM_UNTIL', $startdate, $enddate);
                 // additionally show endtime
                 $endtimes = $row->endtimes;
             } elseif ($row->enddates && $enddates_stamp >= $today_stamp && $dates_stamp < $today_stamp) {
                 $enddate = JEMOutput::formatdate($row->enddates, $dateFormat);
                 $date = JText::sprintf('MOD_JEM_WIDE_UNTIL', $enddate);
                 // show endtime instead of starttime
                 $times = false;
                 $endtimes = $row->endtimes;
             } else {
                 $startdate = JEMOutput::formatdate($row->dates, $dateFormat);
                 $date = JText::sprintf('MOD_JEM_WIDE_ON_DATE', $startdate);
                 // additionally show endtime, but on single day events only to prevent user confusion
                 if (empty($row->enddates)) {
                     $endtimes = $row->endtimes;
                 }
             }
         }
     }
     $time = empty($times) ? '' : JEMOutput::formattime($times, $timeFormat, $addSuffix);
     $time .= empty($endtimes) ? '' : '&nbsp;-&nbsp;' . JEMOutput::formattime($row->endtimes, $timeFormat, $addSuffix);
     return array($date, $time);
 }
Beispiel #6
0
 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;
 }