mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-15777 - updated most of the portfolio code to use files api.
Not done: - forum (the rest of the module isn't using files api yet) - database mod (touches other parts of the code (ods and excel libs) - portfolio download plugin (needs discussion with petr about userfiles) all of these have been disabled in the meantime.
This commit is contained in:
parent
db79c1b960
commit
d67bfc32a1
13 changed files with 178 additions and 126 deletions
|
@ -2415,7 +2415,7 @@ class glossary_csv_portfolio_caller extends portfolio_module_caller_base {
|
|||
return sha1(serialize($this->exportdata));
|
||||
}
|
||||
|
||||
public function prepare_package($tempdir) {
|
||||
public function prepare_package() {
|
||||
$entries = $this->exportdata['entries'];
|
||||
$aliases = array();
|
||||
$categories = array();
|
||||
|
@ -2436,11 +2436,7 @@ class glossary_csv_portfolio_caller extends portfolio_module_caller_base {
|
|||
}
|
||||
}
|
||||
$csv = glossary_generate_export_csv($entries, $aliases, $categories);
|
||||
// @todo - convert to files api.
|
||||
$status = ($handle = fopen($tempdir . '/' . clean_filename($this->cm->name) . '.csv', 'w'));
|
||||
$status = $status && fwrite($handle, $csv);
|
||||
$status = $status && fclose($handle);
|
||||
return $status;
|
||||
return $this->exporter->write_new_file($csv, clean_filename($this->cm->name) . '.csv');
|
||||
}
|
||||
|
||||
public function check_permissions() {
|
||||
|
@ -2493,17 +2489,14 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
|
|||
return get_string('modname', 'glossary');
|
||||
}
|
||||
|
||||
public function prepare_package($tempdir) {
|
||||
$this->entry->approved = true; // in case we don't have $USER which this function checks
|
||||
public function prepare_package() {
|
||||
// in case we don't have USER this will make the entry be printed
|
||||
$this->entry->approved = true;
|
||||
define('PORTFOLIO_INTERNAL', true);
|
||||
ob_start();
|
||||
glossary_print_entry($this->get('course'), $this->cm, $this->glossary, $this->entry, null, null, false);
|
||||
$content = ob_get_clean();
|
||||
// @todo - convert to files api.
|
||||
$status = ($handle = fopen($tempdir . '/' . clean_filename($this->entry->concept) . '.html', 'w'));
|
||||
$status = $status && fwrite($handle, $content);
|
||||
$status = $status && fclose($handle);
|
||||
return $status;
|
||||
return $this->exporter->write_new_file($content, clean_filename($this->entry->concept) . '.html');
|
||||
}
|
||||
|
||||
public function get_sha1() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue