$a = new StdClass;
$a->cancel = $CFG->wwwroot . '/portfolio/add.php?cancel=1';
$a->finish = $CFG->wwwroot . '/portfolio/add.php?id=' . $SESSION->portfolioexport;
- print_error('alreadyexporting', 'portfolio', null, $a);
+ throw new portfolio_exception('alreadyexporting', 'portfolio', null, $a);
}
if (empty($callbackfile)) {
$linkoutput .= '">' . $addstr .'</a>';
break;
default:
- debugging('asdfd');
- print_error('invalidaddformat', 'portfolio', '', $format);
+ debugging(get_string('invalidaddformat', 'portfolio', $format));
}
$output = (in_array($format, array(PORTFOLIO_ADD_FULL_FORM, PORTFOLIO_ADD_ICON_FORM)) ? $formoutput : $linkoutput);
if ($return) {
global $DB, $CFG;
if (! $this->cm = get_coursemodule_from_id('assignment', $callbackargs['assignmentid'])) {
- print_error('invalidcoursemodule');
+ throw new portfolio_caller_exception('invalidcoursemodule');
}
if (! $assignment = $DB->get_record("assignment", array("id"=>$this->cm->instance))) {
- print_error('invalidid', 'assignment');
+ throw new portfolio_caller_exception('invalidid', 'assignment');
}
$this->assignmentfile = $CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php';
$assignmentclass = "assignment_$assignment->assignmenttype";
$this->assignment= new $assignmentclass($this->cm->id, $assignment, $this->cm);
if (!$this->assignment->portfolio_exportable()) {
- print_error('notexportable', 'portfolio', $this->get_return_url());
+ throw new portfolio_caller_exception('notexportable', 'portfolio', $this->get_return_url());
}
$this->userid = $callbackargs['userid'];
$this->file = (array_key_exists('file', $callbackargs)) ? $callbackargs['file'] : null;
throw new portfolio_caller_exception('attachmentsnopost', 'forum');
}
if (!$f = $fs->get_file_by_id($this->attachment)) {
- print_error('noattachments', 'forum');
+ throw new portfolio_caller_exception('noattachments', 'forum');
}
$this->postfiles = array($f);
if (in_array($f->get_mimetype(), array('image/gif', 'image/jpeg', 'image/png'))) {
global $CFG;
global $DB;
if (!array_key_exists('id', $callbackargs) || !$this->cm = get_coursemodule_from_instance('resource', $callbackargs['id'])) {
- print_error('invalidid');
+ throw new portfolio_caller_exception('invalidid');
}
$this->cm->type = $DB->get_field('resource', 'type', array('id' => $this->cm->instance));
$resourceclass = 'resource_'. $this->cm->type;