本文整理汇总了PHP中JemHelper::isValidTime方法的典型用法代码示例。如果您正苦于以下问题:PHP JemHelper::isValidTime方法的具体用法?PHP JemHelper::isValidTime怎么用?PHP JemHelper::isValidTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JemHelper
的用法示例。
在下文中一共展示了JemHelper::isValidTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatDateTime2Lines
/**
* Formats the input dates and times to be used as a from-to string for
* events. Takes care of unset dates and or times.
* First line is for (short) date, second line for time values.
* Lines can be styled using css classes jem_date-2 and jem_time-2.
*
* @param string $dateStart Start date of event
* @param string $timeStart Start time of event
* @param string $dateEnd End date of event
* @param string $timeEnd End time of event
* @param string $dateFormat Date Format
* @param string $timeFormat Time Format
* @param bool $addSuffix if true add suffix specified in settings
* @return string Formatted date and time string to print
*/
static function formatDateTime2Lines($dateStart, $timeStart, $dateEnd = "", $timeEnd = "", $dateFormat = "", $timeFormat = "", $addSuffix = true)
{
$settings = JemHelper::globalattribs();
$output = "";
$jemconfig = JemHelper::config();
if (empty($dateFormat)) {
// Use format saved in settings if specified or format in language file otherwise
$dateFormat = empty($jemconfig->formatShortDate) ? JText::_('COM_JEM_FORMAT_SHORT_DATE') : $jemconfig->formatShortDate;
}
if (JemHelper::isValidDate($dateStart)) {
$outDate = self::formatdate($dateStart, $dateFormat);
if (JemHelper::isValidDate($dateEnd) && ($dateEnd != $dateStart)) {
$outDate .= ' - ' . self::formatdate($dateEnd, $dateFormat);
}
} else {
$outDate = JText::_('COM_JEM_OPEN_DATE');
}
if ($settings->get('global_show_timedetails','1') && JemHelper::isValidTime($timeStart)) {
$outTime = self::formattime($timeStart, $timeFormat, $addSuffix);
if (JemHelper::isValidTime($timeEnd)) {
$outTime .= ' - ' . self::formattime($timeEnd, $timeFormat, $addSuffix);
}
}
$output = '<span class="jem_date-2">' . $outDate . '</span>';
if (!empty($outTime)) {
$output .= '<br class="jem_break-2"><span class="jem_time-2">' . $outTime . '</span>';
}
return $output;
}
示例2: formatDateTime
/**
* Formats the input dates and times to be used as a from-to string for
* events. Takes care of unset dates and or times.
*
* @param string $dateStart Start date of event
* @param string $timeStart Start time of event
* @param string $dateEnd End date of event
* @param string $timeEnd End time of event
* @param string $format Date Format
* @return string Formatted date and time string to print
*/
static function formatDateTime($dateStart, $timeStart, $dateEnd = "", $timeEnd = "", $format = "")
{
$settings = JemHelper::globalattribs();
$output = "";
if (JemHelper::isValidDate($dateStart)) {
$output .= '<span class="date">' . self::formatdate($dateStart, $format) . '</span>';
if ($settings->get('global_show_timedetails', '1') && JemHelper::isValidTime($timeStart)) {
$output .= ', <span class="time">' . self::formattime($timeStart) . '</span>';
}
// Display end date only when it differs from start date
$displayDateEnd = JemHelper::isValidDate($dateEnd) && $dateEnd != $dateStart;
if ($displayDateEnd) {
$output .= ' - <span class="time">' . self::formatdate($dateEnd, $format) . '</span>';
}
// Display end time only when both times are set
if ($settings->get('global_show_timedetails', '1') && JemHelper::isValidTime($timeStart) && JemHelper::isValidTime($timeEnd)) {
$output .= $displayDateEnd ? ', ' : ' - ';
$output .= '<span class="time">' . self::formattime($timeEnd) . '</span>';
}
} else {
$output .= '<span class="date">' . JText::_('COM_JEM_OPEN_DATE') . '</span>';
if ($settings->get('global_show_timedetails', '1')) {
if (JemHelper::isValidTime($timeStart)) {
$output .= ', <span class="date">' . self::formattime($timeStart) . '</span>';
}
// Display end time only when both times are set
if (JemHelper::isValidTime($timeStart) && JemHelper::isValidTime($timeEnd)) {
$output .= ' - <span class="time">' . self::formattime($timeEnd) . '<span>';
}
}
}
return $output;
}