Exemplo n.º 1
0
function ortime__format($unixtime, $options = '', $language = '')
{
    // possible options: hide_time hide_second hide_date hide_year
    global $lang;
    $op = array('hide_second' => true);
    $opa = explode(",", $options);
    foreach ($opa as $o) {
        $to = explode(":", trim($o));
        if (isset($to[1]) && trim($to[1]) == "false") {
            unset($op[$to[0]]);
        } else {
            $op[$to[0]] = true;
        }
    }
    $arr = ortime__sesstime_to_array(ortime__unixtime_to_sesstime($unixtime));
    $p = ortime__array_mil_time_to_array_ampm_time($arr);
    $arr['h12'] = $p['h'];
    $arr['a'] = $p['a'];
    if (!$language) {
        if (isset($lang['lang']) && $lang['lang']) {
            $language = $lang['lang'];
        } else {
            global $expadmindata, $settings;
            if (isset($expadmindata['language']) && $expadmindata['language']) {
                $language = $expadmindata['language'];
            } else {
                $language = $settings['public_standard_language'];
            }
        }
    }
    if (isset($op['hide_year'])) {
        $fd = 'date_no_year';
    } else {
        $fd = 'date';
    }
    if (isset($op['hide_second'])) {
        $ft = 'time_no_sec';
    } else {
        $ft = 'time';
    }
    if (isset($lang['lang']) && $language == $lang['lang']) {
        $dformat = $lang['format_datetime_' . $fd];
        $tformat = $lang['format_datetime_' . $ft];
    } else {
        $dformat = load_language_symbol('format_datetime_' . $fd, $language);
        $tformat = load_language_symbol('format_datetime_' . $ft, $language);
    }
    $f = "";
    if (!isset($op['hide_date'])) {
        $f .= $dformat;
    }
    if (!isset($op['hide_date']) && !isset($op['hide_time'])) {
        $f .= " ";
    }
    if (!isset($op['hide_time'])) {
        $f .= $tformat;
    }
    $arr['w'] = ortime__get_weekday($unixtime, $language);
    $datestring = str_replace(array('%Y', '%m', '%d', '%H', '%h', '%i', '%s', '%a', '%w'), array($arr['y'], $arr['m'], $arr['d'], $arr['h'], $arr['h12'], $arr['i'], $arr['s'], $arr['a'], $arr['w']), $f);
    $datestring = str_replace(" ", " ", $datestring);
    return $datestring;
}
Exemplo n.º 2
0
function session__build_name($pack, $language = "")
{
    global $lang, $settings;
    if (!$language) {
        if (isset($lang['lang'])) {
            $thislang = $lang['lang'];
        } else {
            $thislang = $settings['public_standard_language'];
        }
    } else {
        $thislang = $language;
    }
    $start_time = $pack['session_start'];
    $end_time = ortime__add_hourmin_to_sesstime($start_time, $pack['session_duration_hour'], $pack['session_duration_minute']);
    $session_time_string = ortime__format(ortime__sesstime_to_unixtime($start_time), 'hide_second:true', $thislang) . '-' . ortime__format(ortime__sesstime_to_unixtime($end_time), 'hide_date:true,hide_second:true', $thislang);
    if (or_setting('include_weekday_in_session_name')) {
        $session_time_string = ortime__get_weekday(ortime__sesstime_to_unixtime($start_time), $thislang) . ", " . $session_time_string;
    }
    return $session_time_string;
}