Пример #1
0
/**
 * Given an ID of an instance of this module,
 * this function will permanently delete the instance
 * and any data that depends on it.
 *
 * @param int $id Id of the module instance
 * @return boolean Success/Failure
 **/
function mapleta_delete_instance($id) {

	
	if(!$mapleta= mapleta_get_record("mapleta", "id", "$id")) {
		return false;
	}

	$result= true;

	# Delete any dependent records here #

	if(!mapleta_delete_records("mapleta", "id", "$mapleta->id")) {
		$result= false;
	} 
	
	mapleta_grade_item_delete($mapleta);

	return $result;
}
Пример #2
0
		    			"<span id='mapleta-config'>" .
		    			"<font color='red'>" .
		    			"The course mapping cannot be deleted<br>" .
		    			"because there are Maple T.A. assignments still referenced from this course. <br>" .
		    			"Please remove all Maple T.A. assignment references and try again. <br>" .
		    			"</font>" .
		    			"</span>" .
		    			"</center>";
		    }

			
			echo "</form>";
		} else { // Not admin or teacher
			print_error('not_authorized_for_action', 'mapleta', $errorURL);
		}
	} else if($action == "dodelete") {
		if(mapleta_is_administrator($id) || mapleta_is_teacher($id)) {
			if (mapleta_delete_records("mapleta_course_map", "id", $course_mapping->id)) {
				echo "<br/><center><strong>Mapping for course $course->fullname has been deleted.</strong></center><br/>";
			} else {
				print_error('error_deleting_mapping', 'mapleta', $errorURL);
			}
		} else { // Not admin or teacher
			print_error('not_authorized_for_action', 'mapleta', $errorURL);
		}
	} else {
		echo "<br/><center><strong>Course $course->fullname has been mapped to Maple TA class '".$course_mapping->classname."'.</strong></center><br/>";
	}

?>