Skip to content

Commit

Permalink
portfolio/glossary NOTABUG improved some phpdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Penny Leach committed Dec 14, 2009
1 parent ff28498 commit b9be87b
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions mod/glossary/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ 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() {
return array(
'id' => true,
);
}

/**
* @return global
* load up all data required for this export.
*
* @return void
*/
public function load_data() {
global $DB;
Expand All @@ -61,19 +68,27 @@ public function load_data() {
}

/**
* @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'];
Expand All @@ -97,24 +112,35 @@ public function prepare_package() {
}
// 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);
}
}

Expand Down Expand Up @@ -211,6 +237,6 @@ public function get_sha1() {
}

public static function base_supported_formats() {
return array(PORTFOLIO_FORMAT_RICHHTML, PORTFOLIO_FORMAT_PLAINHTML);
return array(PORTFOLIO_FORMAT_RICHHTML);
}
}

0 comments on commit b9be87b

Please sign in to comment.