Commit 6c16d644 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Pull calendar date formats on view access screen from langconfig

parent d32e3097
......@@ -30,6 +30,7 @@ $string['parentlanguage'] = '';
$string['strftimedate'] = '%%e %%B %%Y';
$string['strftimedateshort'] = '%%d %%B';
$string['strftimedatetime'] = '%%d %%B %%Y, %%l:%%M %%p';
$string['strftimedatetimeshort'] = '%%Y/%%m/%%d %%H:%%M';
$string['strftimedaydate'] = '%%A, %%d %%B %%Y';
$string['strftimedaydatetime'] = '%%A, %%d %%B %%Y, %%l:%%M %%p';
$string['strftimedayshort'] = '%%A, %%d %%B';
......
......@@ -288,7 +288,7 @@ function get_raw_string($identifier, $section='mahara') {
*/
function get_string_location($identifier, $section, $variables, $replacefunc='format_langstring', $lang='') {
$langconfigstrs = array('parentlanguage', 'strftimedate', 'strftimedateshort', 'strftimedatetime',
$langconfigstrs = array('parentlanguage', 'strftimedate', 'strftimedateshort', 'strftimedatetime', 'strftimedatetimeshort',
'strftimedaydate', 'strftimedaydatetime', 'strftimedayshort', 'strftimedaytime',
'strftimemonthyear', 'strftimerecent', 'strftimerecentfull', 'strftimetime',
'strfdaymonthyearshort', 'thislanguage');
......
......@@ -280,7 +280,7 @@ class View {
db_commit();
}
public function get_access() {
public function get_access($timeformat=null) {
$data = get_records_sql_array("
SELECT accesstype AS type, NULL AS id, NULL AS role, NULL AS grouptype, startdate, stopdate
......@@ -300,6 +300,14 @@ class View {
if ($item['role']) {
$item['roledisplay'] = get_string($item['role'], 'grouptype.'.$item['grouptype']);
}
if ($timeformat) {
if ($item['startdate']) {
$item['startdate'] = strftime($timeformat, strtotime($item['startdate']));
}
if ($item['stopdate']) {
$item['stopdate'] = strftime($timeformat, strtotime($item['stopdate']));
}
}
}
}
else {
......
......@@ -162,8 +162,8 @@ function setupCalendar(item, type) {
return;
}
Calendar.setup({
"ifFormat" :"%Y\/%m\/%d %H:%M",
"daFormat" :"%Y\/%m\/%d %H:%M",
"ifFormat" :"{{str tag=strftimedatetimeshort}}",
"daFormat" :"{{str tag=strftimedatetimeshort}}",
"inputField": type + 'date_' + count,
"button" : type + 'date_' + count + '_btn',
//"dateStatusFunc" : dateStatusFunc,
......
......@@ -136,7 +136,7 @@ if ($institution) {
$form['elements']['accesslist'] = array(
'type' => 'viewacl',
'defaultvalue' => isset($view) ? $view->get_access() : null
'defaultvalue' => isset($view) ? $view->get_access(get_string('strftimedatetimeshort')) : null
);
$form['elements']['overrides'] = array(
......@@ -153,7 +153,7 @@ $form['elements']['overrides'] = array(
'defaultvalue' => isset($view) ? strtotime($view->get('startdate')) : null,
'caloptions' => array(
'showsTime' => true,
'ifFormat' => '%Y/%m/%d %H:%M'
'ifFormat' => get_string('strftimedatetimeshort'),
),
'help' => true,
),
......@@ -163,7 +163,7 @@ $form['elements']['overrides'] = array(
'defaultvalue' => isset($view) ? strtotime($view->get('stopdate')) : null,
'caloptions' => array(
'showsTime' => true,
'ifFormat' => '%Y/%m/%d %H:%M'
'ifFormat' => get_string('strftimedatetimeshort'),
),
'help' => true,
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment