function date_to_str($indate, $format = '', $show_weekday = true, $short_months = false, $forceTranslate = false)
{
    global $DATE_FORMAT;
    if (strlen($indate) == 0) {
        $indate = date('Ymd');
    }
    // If they have not set a preference yet...
    if ($DATE_FORMAT == '' || $DATE_FORMAT == 'LANGUAGE_DEFINED') {
        $DATE_FORMAT = translate('__month__ __dd__, __yyyy__');
    } else {
        if ($DATE_FORMAT == 'LANGUAGE_DEFINED' && $forceTranslate && $format != '' && translation_exists($format)) {
            $format = translate($format);
        }
    }
    if (empty($format)) {
        $format = $DATE_FORMAT;
    }
    $y = intval($indate / 10000);
    $m = intval($indate / 100) % 100;
    $d = $indate % 100;
    $wday = strftime("%w", mktime(0, 0, 0, $m, $d, $y));
    if ($short_months) {
        $month = month_name($m - 1, 'M');
        $weekday = weekday_name($wday, 'D');
    } else {
        $month = month_name($m - 1);
        $weekday = weekday_name($wday);
    }
    $ret = str_replace('__dd__', $d, $format);
    $ret = str_replace('__j__', intval($d), $ret);
    $ret = str_replace('__mm__', $m, $ret);
    $ret = str_replace('__mon__', $month, $ret);
    $ret = str_replace('__month__', $month, $ret);
    $ret = str_replace('__n__', sprintf("%02d", $m), $ret);
    $ret = str_replace('__yy__', sprintf("%02d", $y % 100), $ret);
    $ret = str_replace('__yyyy__', $y, $ret);
    return $show_weekday ? "{$weekday}, {$ret}" : $ret;
}
Пример #2
0
function ryzom_render_window_begin($title, $homeLink = false)
{
    if ($homeLink === false) {
        $homeLink = '<span style="float:right;margin-right:12px;"><a href="' . RYAPP_URL . '/index.php" class="ryzom-ui-text-button">' . _t('home') . '</a></span>';
    }
    return '
		<div class="ryzom-ui ryzom-ui-header">
			<div class="ryzom-ui-tl"><div class="ryzom-ui-tr">
				<div class="ryzom-ui-t">' . (translation_exists($title) ? _t($title) : $title) . $homeLink . '</div>
			</div>
		</div>
		<div class="ryzom-ui-l"><div class="ryzom-ui-r"><div class="ryzom-ui-m">
			<div class="ryzom-ui-body">
';
}