コード例 #1
0
//get the id of the course that is currently being used
$course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT);
//get the id the comment if one is being edited
$selectedtab = $PARSER->optional_param('selectedtab', NULL, PARAM_RAW);
//get the id the comment if one is being edited
$tabitem = $PARSER->optional_param('tabitem', NULL, PARAM_RAW);
// instantiate the db
$dbc = new ilp_db();
//get the report
$report = $dbc->get_report_by_id($report_id);
//if the report is not found throw an error of if the report has a status of disabled
if (empty($report) || empty($report->status)) {
    print_error('reportnotfouund', 'block_ilp');
}
//get the entry
$entry = $dbc->get_entry_by_id($entry_id);
//if the report is not found throw an error of if the report has a status of disabled
if (empty($entry)) {
    print_error('entrynotfouund', 'block_ilp');
}
if (empty($report->frequency)) {
    //entries can only be deleted from reports that allow multiple entries
    print_error('entrycannotbedeleted', 'block_ilp');
}
//check if the user has the delete record capability
if (empty($access_report_deletereports)) {
    //the user doesnt have the capability to create this type of report entry
    print_error('userdoesnothavedeletecapability', 'block_ilp');
}
// instantiate the db
$dbc = new ilp_db();