diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index 0e5396bb208..f9d44fe9eb6 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -206,7 +206,7 @@ function portfolio_add_button($callbackclass, $callbackargs, $callbackfile=null, $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)) { @@ -292,8 +292,7 @@ function portfolio_add_button($callbackclass, $callbackargs, $callbackfile=null, $linkoutput .= '">' . $addstr .''; 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) { diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index c8f6326dc11..787dcf005b1 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -3153,11 +3153,11 @@ class assignment_portfolio_caller extends portfolio_module_caller_base { 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'; @@ -3165,7 +3165,7 @@ class assignment_portfolio_caller extends portfolio_module_caller_base { $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; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 45fadf3bbc7..1aef9a74473 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -7206,7 +7206,7 @@ class forum_portfolio_caller extends portfolio_module_caller_base { 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'))) { diff --git a/mod/resource/lib.php b/mod/resource/lib.php index 1d9964b3906..16d0c57104f 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -715,7 +715,7 @@ class resource_portfolio_caller extends portfolio_module_caller_base { 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;