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
moodle
moodle
Commits
b9be87b3
Commit
b9be87b3
authored
Dec 14, 2009
by
Penny Leach
Browse files
portfolio/glossary NOTABUG improved some phpdocs
parent
ff284987
Changes
1
Hide whitespace changes
Inline
Side-by-side
mod/glossary/locallib.php
View file @
b9be87b3
...
...
@@ -29,7 +29,11 @@ class glossary_full_portfolio_caller extends portfolio_module_caller_base {
private
$glossary
;
private
$exportdata
;
/**
* return array of expected call back arguments
* and whether they are required or not
*
* @return array
*/
public
static
function
expected_callbackargs
()
{
...
...
@@ -37,8 +41,11 @@ class glossary_full_portfolio_caller extends portfolio_module_caller_base {
'id'
=>
true
,
);
}
/**
* @return global
* load up all data required for this export.
*
* @return void
*/
public
function
load_data
()
{
global
$DB
;
...
...
@@ -61,19 +68,27 @@ class glossary_full_portfolio_caller extends portfolio_module_caller_base {
}
/**
* @return string
* how long might we expect this export to take
*
* @return constant one of PORTFOLIO_TIME_XX
*/
public
function
expected_time
()
{
return
portfolio_expected_time_db
(
count
(
$this
->
exportdata
[
'entries'
]));
}
/**
* return the sha1 of this content
*
* @return string
*/
public
function
get_sha1
()
{
return
sha1
(
serialize
(
$this
->
exportdata
));
}
/**
* @return object
* prepare the package ready to be passed off to the portfolio plugin
*
* @return void
*/
public
function
prepare_package
()
{
$entries
=
$this
->
exportdata
[
'entries'
];
...
...
@@ -97,24 +112,35 @@ class glossary_full_portfolio_caller extends portfolio_module_caller_base {
}
// TODO detect format here
$csv
=
glossary_generate_export_csv
(
$entries
,
$aliases
,
$categories
);
return
$this
->
exporter
->
write_new_file
(
$csv
,
clean_filename
(
$this
->
cm
->
name
)
.
'.csv'
,
false
);
$this
->
exporter
->
write_new_file
(
$csv
,
clean_filename
(
$this
->
cm
->
name
)
.
'.csv'
,
false
);
// TODO when csv, what do we do with attachments?!
}
/**
* @return bool
* make sure that the current user is allowed to do this
*
* @return boolean
*/
public
function
check_permissions
()
{
return
has_capability
(
'mod/glossary:export'
,
get_context_instance
(
CONTEXT_MODULE
,
$this
->
cm
->
id
));
}
/**
* return a nice name to be displayed about this export location
*
* @return string
*/
public
static
function
display_name
()
{
return
get_string
(
'modulename'
,
'glossary'
);
}
/**
* what formats this function *generally* supports
*
* @return array
*/
public
static
function
base_supported_formats
()
{
return
array
(
PORTFOLIO_FORMAT_
FILE
);
return
array
(
PORTFOLIO_FORMAT_
SPREADSHEET
,
PORTFOLIO_FORMAT_LEAP2A
);
}
}
...
...
@@ -211,6 +237,6 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base { //
}
public
static
function
base_supported_formats
()
{
return
array
(
PORTFOLIO_FORMAT_RICHHTML
,
PORTFOLIO_FORMAT_PLAINHTML
);
return
array
(
PORTFOLIO_FORMAT_RICHHTML
);
}
}
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