|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00029 defined('MOODLE_INTERNAL') || die(); 00030 00035 class portfolio_exception extends moodle_exception {} 00036 00040 class portfolio_export_exception extends portfolio_exception { 00041 00050 public function __construct($exporter, $errorcode, $module=null, $continue=null, $a=null) { 00051 global $CFG; 00052 // This static variable is necessary because sometimes the code below 00053 // which tries to obtain a continue link can cause one of these 00054 // exceptions to be thrown. This would create an infinite loop (until 00055 // PHP hits its stack limit). Using this static lets us make the 00056 // nested constructor finish immediately without attempting to call 00057 // methods that might fail. 00058 static $inconstructor = false; 00059 00060 if (!$inconstructor && !empty($exporter) && 00061 $exporter instanceof portfolio_exporter) { 00062 $inconstructor = true; 00063 try { 00064 if (empty($continue)) { 00065 $caller = $exporter->get('caller'); 00066 if (!empty($caller) && $caller instanceof portfolio_caller_base) { 00067 $continue = $exporter->get('caller')->get_return_url(); 00068 } 00069 } 00070 // this was previously only called if we were in cron, 00071 // but I think if there's always an exception, we should clean up 00072 // rather than force the user to resolve the export later. 00073 $exporter->process_stage_cleanup(); 00074 } catch(Exception $e) { 00075 // Ooops, we had an exception trying to get caller 00076 // information. Ignore it. 00077 } 00078 $inconstructor = false; 00079 } 00080 parent::__construct($errorcode, $module, $continue, $a); 00081 } 00082 } 00083 00088 class portfolio_caller_exception extends portfolio_exception {} 00089 00094 class portfolio_plugin_exception extends portfolio_exception {} 00095 00099 class portfolio_button_exception extends portfolio_exception {} 00100 00104 class portfolio_format_leap2a_exception extends portfolio_exception {}