$string['exporting'] = 'Exporting to portfolio';
$string['exportcomplete'] = 'Portfolio export complete!';
$string['failedtosendpackage'] = 'Failed to send your data to the selected portfolio system!';
-$string['format_html'] = 'HTML';
$string['format_file'] = 'File';
$string['format_mbkp'] = 'Moodle Backup';
$string['hidden'] = 'Hidden';
$string['instancenotsaved'] = 'Failed to save portfolio';
$string['instancenotdelete'] = 'Failed to delete portfolio';
$string['instancesaved'] = 'Portfolio saved successfully';
+$string['invalidformat'] = 'Something is exporting an invalid format, $a';
$string['manageportfolios'] = 'Manage portfolios';
$string['manageyourportfolios'] = 'Manage your portfolios';
$string['noavailableplugins'] = 'Sorry, but there are no available portfolios for you to export to';
// in the portfolio module, called format_{$value}
// **** **** //
-/**
-* html - this is the second most basic fallback
-* after {@link PORTFOLIO_FORMAT_FILE}
-* for export. This should always be supported
-* in remote systems
-*/
-define('PORTFOLIO_FORMAT_HTML', 'html');
/**
* file - the most basic fallback format.
function portfolio_supported_formats() {
return array(
PORTFOLIO_FORMAT_FILE,
- PORTFOLIO_FORMAT_HTML,
- PORTFOLIO_FORMAT_MBKP,
+ /*PORTFOLIO_FORMAT_MBKP, */ // later
+ /*PORTFOLIO_FORMAT_PIOP, */ // also later
);
}
public abstract function check_permissions();
}
+abstract class portfolio_module_caller_base extends portfolio_caller_base {
+
+ protected $cm;
+
+ public function get_navigation() {
+ $extranav = array('name' => $this->cm->name, 'link' => $this->get_return_url());
+ return array($extranav, $this->cm);
+ }
+
+ public function get_return_url() {
+ global $CFG;
+ return $CFG->wwwroot . '/mod/' . $this->cm->modname . '/view.php?id=' . $this->cm->id;
+ }
+}
+
/**
* the base class for portfolio plguins
* all plugins must subclass this.
$callerobj = $this->caller;
}
$formats = array_intersect($this->instance->supported_formats(), $this->caller->supported_formats());
+ $allsupported = portfolio_supported_formats();
+ foreach ($formats as $key => $format) {
+ if (!in_array($format, $allsupported)) {
+ debugging(get_string('invalidformat', 'portfolio', $format));
+ unset($formats[$key]);
+ }
+ }
$expectedtime = $this->instance->expected_time($this->caller->expected_time());
if (count($formats) == 0) {
// something went wrong, we should not have gotten this far.
}
require_once($CFG->libdir . '/portfoliolib.php');
-class assignment_portfolio_caller extends portfolio_caller_base {
+class assignment_portfolio_caller extends portfolio_module_caller_base {
private $assignment;
private $assignmentfile;
public function __construct($callbackargs) {
global $DB, $CFG;
- if (! $cm = get_coursemodule_from_id('assignment', $callbackargs['assignmentid'])) {
+ if (! $this->cm = get_coursemodule_from_id('assignment', $callbackargs['assignmentid'])) {
print_error('invalidcoursemodule');
}
}
public static function supported_formats() {
- // try and cheat
- if (isset($this) && $this->assignment->assignment->assignmenttype == 'online') {
- return array(PORTFOLIO_FORMAT_HTML);
- }
return array(PORTFOLIO_FORMAT_FILE);
}
- public function get_return_url() {
- global $CFG;
- return $CFG->wwwroot . '/mod/assignment/view.php?id=' . $this->assignment->cm->id;
- }
-
- public function get_navigation() {
- $extranav = array('name' => $this->assignment->cm->name, 'link' => $this->get_return_url());
- return array($extranav, $this->assignment->cm);
- }
public function expected_time() {
return PORTFOLIO_TIME_MODERATE; // @TODO check uploaded file size
'userid' => $USER->id,
'assignmentid' => $this->cm->id,
);
- portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php'));
+ portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php');
} else if (!has_capability('mod/assignment:submit', $context)) { //fix for #4604
echo '<div style="text-align:center">'. get_string('guestnosubmit', 'assignment').'</div>';
} else if ($this->isopen()){ //fix for #4206
}
require_once($CFG->libdir . '/portfoliolib.php');
-class forum_portfolio_caller extends portfolio_caller_base {
+class forum_portfolio_caller extends portfolio_module_caller_base {
- private $cm;
private $post;
private $forum;
private $discussion;
}
static function supported_formats() {
- // we always have to support the possibility here that we have attachments
- // and HTML is a subset of FILE anyway.
return array(PORTFOLIO_FORMAT_FILE);
}
return true;
}
- function get_navigation() {
- $extranav = array('name' => $this->cm->name, 'link' => $this->get_return_url());
- return array($extranav, $this->cm);
- }
}
?>
private $folders;
public static function supported_formats() {
- return array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_HTML);
+ return array(PORTFOLIO_FORMAT_FILE);
}
public function prepare_package($tempdir) {
protected $exportconfig;
public static function supported_formats() {
- return array(PORTFOLIO_FORMAT_FILE, PORTFOLIO_FORMAT_HTML);
+ return array(PORTFOLIO_FORMAT_FILE);
// @todo more later, like moodle backup for example
}