Exemplo n.º 1
0
/**
 *
 **/
function getDateformats()
{
    $DATE_FORMATS = CAT_Helper_DateTime::getDateFormats();
    $counter = 0;
    $data = array();
    foreach ($DATE_FORMATS as $format => $title) {
        $data[$counter] = array('NAME' => $title, 'VALUE' => $format != 'system_default' ? $format : '', 'SELECTED' => CAT_DEFAULT_DATE_FORMAT == $format ? true : false);
        $counter++;
    }
    return $data;
}
Exemplo n.º 2
0
 /**
  * check given date format
  *
  * @access public
  * @param  string $df
  * @return boolean
  **/
 public static function checkDateformat($date_format)
 {
     $date_format_key = str_replace(' ', '|', $date_format);
     $date_formats = CAT_Helper_DateTime::getDateFormats();
     return array_key_exists($date_format_key, $date_formats);
 }
Exemplo n.º 3
0
            }
        } else {
            $_SESSION['USE_DEFAULT_TIME_FORMAT'] = true;
            unset($_SESSION['CAT_TIME_FORMAT']);
        }
        if ($_SESSION['CAT_DATE_FORMAT'] != '') {
            if (isset($_SESSION['USE_DEFAULT_DATE_FORMAT'])) {
                unset($_SESSION['USE_DEFAULT_DATE_FORMAT']);
            }
        } else {
            $_SESSION['USE_DEFAULT_DATE_FORMAT'] = true;
            unset($_SESSION['CAT_DATE_FORMAT']);
        }
    }
    if (count($errors) > 0) {
        $message = implode("<br />", $errors);
    } else {
        $message = $user->lang()->translate('Details saved successfully') . "!<br /><br />";
        $show_form = false;
    }
}
unset($submit_ok);
// get available languages, mark currently used
$languages = CAT_Helper_Addons::get_addons(isset($language) && $language !== LANGUAGE ? $language : LANGUAGE, 'language');
global $parser;
$parser->setPath(CAT_PATH . '/templates/' . DEFAULT_TEMPLATE . '/templates/' . CAT_Registry::get('DEFAULT_THEME_VARIANT'));
// if there's a template for this in the current frontend template
$parser->setFallbackPath(dirname(__FILE__) . '/templates/default');
// fallback to default dir
$parser->output('account_preferences_form', array('show_form' => $show_form, 'languages' => $languages, 'timezones' => CAT_Helper_DateTime::getTimezones(), 'current_tz' => CAT_Helper_DateTime::getTimezone(), 'date_formats' => CAT_Helper_DateTime::getDateFormats(), 'current_df' => CAT_Helper_DateTime::getDefaultDateFormatShort(), 'time_formats' => CAT_Helper_DateTime::getTimeFormats(), 'current_tf' => CAT_Helper_DateTime::getDefaultTimeFormat(), 'PREFERENCES_URL' => PREFERENCES_URL, 'USER_ID' => $user->get_user_id(), 'DISPLAY_NAME' => $user->get_display_name(), 'GET_EMAIL' => $user->get_email(), 'RESULT_MESSAGE' => $message, 'AUTH_MIN_LOGIN_LENGTH' => AUTH_MIN_LOGIN_LENGTH));
unset($_SESSION['result_message']);
Exemplo n.º 4
0
$tpl_data['languages'] = $addons->get_addons(LANGUAGE, 'language', false, 'directory');
// ==================================
// ! Insert default timezone values
// ==================================
$counter = 0;
$timezone_table = CAT_Helper_DateTime::getTimezones();
$user_timezone = isset($_SESSION['TIMEZONE_STRING']) ? $_SESSION['TIMEZONE_STRING'] : CAT_Registry::get('DEFAULT_TIMEZONE_STRING');
foreach ($timezone_table as $title) {
    $tpl_data['timezones'][$counter]['NAME'] = $title;
    $tpl_data['timezones'][$counter]['SELECTED'] = $user_timezone == $title ? true : false;
    $counter++;
}
// ===========================
// ! Insert date format list
// ===========================
$DATE_FORMATS = CAT_Helper_DateTime::getDateFormats();
$USE_DEFAULT = $val->fromSession('USE_DEFAULT_DATE_FORMAT');
$userformat = $val->fromSession('CAT_DATE_FORMAT');
$counter = 0;
foreach ($DATE_FORMATS as $format => $title) {
    $format = str_replace('|', ' ', $format);
    // Add's white-spaces (not able to be stored in array key)
    $tpl_data['dateformats'][$counter]['VALUE'] = $format != 'system_default' ? $format : 'system_default';
    $tpl_data['dateformats'][$counter]['NAME'] = $title;
    $tpl_data['dateformats'][$counter]['SELECTED'] = $userformat == $format && !$USE_DEFAULT || 'system_default' == $format && $USE_DEFAULT ? true : false;
    $counter++;
}
// ===========================
// ! Insert time format list
// ===========================
$TIME_FORMATS = CAT_Helper_DateTime::getTimeFormats();