Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
e0fecbb7
Commit
e0fecbb7
authored
Dec 23, 2013
by
Son Nguyen
Committed by
Gerrit Code Review
Dec 23, 2013
Browse files
Merge "Adding the sortorder as plugin config option (bug 1233896)"
parents
eee4f445
8b56c23d
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/file/blocktype/folder/lang/en.utf8/blocktype.folder.php
View file @
e0fecbb7
...
...
@@ -15,3 +15,5 @@ $string['title'] = 'Folder';
$string
[
'description'
]
=
'A single folder from your files area (see Content -> Files)'
;
$string
[
'defaulttitledescription'
]
=
'If you leave this blank, the title of the folder will be used'
;
$string
[
'foldersettings'
]
=
'Folder settings'
;
$string
[
'defaultsortorder'
]
=
'Default sort order of files'
;
htdocs/artefact/file/blocktype/folder/lib.php
View file @
e0fecbb7
...
...
@@ -56,6 +56,43 @@ class PluginBlocktypeFolder extends PluginBlocktype {
return
$result
;
}
public
static
function
has_config
()
{
return
true
;
}
public
static
function
get_config_options
()
{
$elements
=
array
();
$elements
[
'foldersettings'
]
=
array
(
'type'
=>
'fieldset'
,
'legend'
=>
get_string
(
'foldersettings'
,
'blocktype.file/folder'
),
'collapsible'
=>
false
,
'elements'
=>
array
(
'sortorder'
=>
array
(
'type'
=>
'select'
,
'labelhtml'
=>
get_string
(
'defaultsortorder'
,
'blocktype.file/folder'
),
'defaultvalue'
=>
get_config_plugin
(
'blocktype'
,
'folder'
,
'sortorder'
),
'options'
=>
array
(
'asc'
=>
get_string
(
'ascending'
),
'desc'
=>
get_string
(
'descending'
),
)
)
),
);
return
array
(
'elements'
=>
$elements
,
);
}
public
static
function
save_config_options
(
$values
)
{
set_config_plugin
(
'blocktype'
,
'folder'
,
'sortorder'
,
$values
[
'sortorder'
]);
}
public
static
function
postinst
(
$prevversion
)
{
if
(
$prevversion
<
2013120900
)
{
set_config_plugin
(
'blocktype'
,
'folder'
,
'sortorder'
,
'asc'
);
}
}
public
static
function
has_instance_config
()
{
return
true
;
}
...
...
@@ -69,7 +106,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
'sortorder'
=>
array
(
'type'
=>
'select'
,
'labelhtml'
=>
get_string
(
'sortorder'
),
'defaultvalue'
=>
(
isset
(
$configdata
[
'sortorder'
])
&&
$configdata
[
'sortorder'
]
==
'desc'
)
?
'desc'
:
'asc'
,
'defaultvalue'
=>
isset
(
$configdata
[
'sortorder'
])
?
$configdata
[
'sortorder'
]
:
get_config_plugin
(
'blocktype'
,
'folder'
,
'sortorder'
)
,
'options'
=>
array
(
'asc'
=>
get_string
(
'ascending'
),
'desc'
=>
get_string
(
'descending'
)),
),
);
...
...
htdocs/artefact/file/blocktype/folder/version.php
View file @
e0fecbb7
...
...
@@ -12,5 +12,5 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
201
00908
00
;
$config
->
release
=
'1.0.
0
'
;
$config
->
version
=
201
31209
00
;
$config
->
release
=
'1.0.
1
'
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment