本文整理汇总了PHP中JemHelper::getTimeZoneName方法的典型用法代码示例。如果您正苦于以下问题:PHP JemHelper::getTimeZoneName方法的具体用法?PHP JemHelper::getTimeZoneName怎么用?PHP JemHelper::getTimeZoneName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JemHelper
的用法示例。
在下文中一共展示了JemHelper::getTimeZoneName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Creates the output for the Eventslist view
*/
function display($tpl = null)
{
$settings = JemHelper::config();
$settings2 = JemHelper::globalattribs();
$timezone_name = JemHelper::getTimeZoneName();
if ($settings2->get('global_show_ical_icon', '0') == 1) {
// Get data from the model
$model = $this->getModel();
$model->setLimit($settings->ical_max_items);
$model->setLimitstart(0);
$rows = $model->getItems();
// initiate new CALENDAR
$vcal = JemHelper::getCalendarTool();
$vcal->setConfig("filename", "events.ics");
foreach ($rows as $row) {
JemHelper::icalAddEvent($vcal, $row, $rows);
}
// generate and redirect output to user browser
$vcal->returnCalendar();
} else {
return;
}
}
示例2: icalAddEvent
static function icalAddEvent(&$calendartool, $event, $rows)
{
require_once JPATH_SITE . '/components/com_jem/classes/iCalcreator.class.php';
$jemsettings = JemHelper::config();
$settings = JemHelper::globalattribs();
$config = JFactory::getConfig();
$sitename = $config->get('sitename');
# retrieve TimezoneName
# if we have a timezone for the venue then that info will be used for the output
if ($event->timezone) {
# venue - timeZone
$timezone_name = $event->timezone;
} else {
# global - TimeZone
$timezone_name = JemHelper::getTimeZoneName();
}
// get categories names
$categories = array();
foreach ($event->categories as $c) {
$categories[] = $c->catname;
}
// no start date...
$validdate = JemHelper::isValidDate($event->dates);
if (!$event->dates || !$validdate) {
return false;
}
// make end date same as start date if not set
if (!$event->enddates) {
$event->enddates = $event->dates;
}
// start
if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $event->dates, $start_date)) {
JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_STARTDATE_FORMAT'));
}
$date = array('year' => (int) $start_date[1], 'month' => (int) $start_date[2], 'day' => (int) $start_date[3]);
// all day event if start time is not set
if (!$event->times) {
$dateparam = array('VALUE' => 'DATE');
// for ical all day events, dtend must be send to the next day
$event->enddates = strftime('%Y-%m-%d', strtotime($event->enddates . ' +1 day'));
if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $event->enddates, $end_date)) {
JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_ENDDATE_FORMAT'));
}
$date_end = array('year' => $end_date[1], 'month' => $end_date[2], 'day' => $end_date[3]);
$dateendparam = array('VALUE' => 'DATE');
} else {
if (!preg_match('/([0-9]{2}):([0-9]{2}):([0-9]{2})/', $event->times, $start_time)) {
JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_STARTTIME_FORMAT'));
}
$date['hour'] = $start_time[1];
$date['min'] = $start_time[2];
$date['sec'] = $start_time[3];
$dateparam = array('VALUE' => 'DATE-TIME');
if ($settings->get('ical_tz', 0) == 1) {
$dateparam['TZID'] = $timezone_name;
}
if (!$event->endtimes || $event->endtimes == '00:00:00') {
$event->endtimes = $event->times;
}
// if same day but end time < start time, change end date to +1 day
if ($event->enddates == $event->dates && strtotime($event->dates . ' ' . $event->endtimes) < strtotime($event->dates . ' ' . $event->times)) {
$event->enddates = strftime('%Y-%m-%d', strtotime($event->enddates . ' +1 day'));
}
if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $event->enddates, $end_date)) {
JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_ENDDATE_FORMAT'));
}
$date_end = array('year' => $end_date[1], 'month' => $end_date[2], 'day' => $end_date[3]);
if (!preg_match('/([0-9]{2}):([0-9]{2}):([0-9]{2})/', $event->endtimes, $end_time)) {
JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_STARTTIME_FORMAT'));
}
$date_end['hour'] = $end_time[1];
$date_end['min'] = $end_time[2];
$date_end['sec'] = $end_time[3];
$dateendparam = array('VALUE' => 'DATE-TIME');
if ($settings->get('ical_tz') == 1) {
$dateendparam['TZID'] = $timezone_name;
}
}
// item description text
$description = $event->title . '\\n';
$description .= JText::_('COM_JEM_CATEGORY') . ': ' . implode(', ', $categories) . '\\n';
$link = JURI::root() . JemHelperRoute::getEventRoute($event->slug);
$link = JRoute::_($link);
$description .= JText::_('COM_JEM_ICS_LINK') . ': ' . $link . '\\n';
// location
$location = array($event->venue);
if (isset($event->street) && !empty($event->street)) {
$location[] = $event->street;
}
if (isset($event->postalCode) && !empty($event->postalCode) && isset($event->city) && !empty($event->city)) {
$location[] = $event->postalCode . ' ' . $event->city;
} else {
if (isset($event->postalCode) && !empty($event->postalCode)) {
$location[] = $event->postalCode;
}
if (isset($event->city) && !empty($event->city)) {
$location[] = $event->city;
}
}
if (isset($event->countryname) && !empty($event->countryname)) {
//.........这里部分代码省略.........