Source for file exerciselink.class.php
Documentation is available at exerciselink.class.php
* Defines a gradebook ExerciseLink object.
* @package dokeos.gradebook
// FUNCTIONS IMPLEMENTING ABSTRACTLINK
* Generate an array of exercises that a teacher hasn't created a link for.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
die('Error in get_not_created_links() : course code not set');
. ' (SELECT ref_id FROM '. $tbl_grade_links
$cats[] = array ($data['id'], $data['title']);
* Generate an array of all exercises available.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
die('Error in get_not_created_links() : course code not set');
$cats[] = array ($data['id'], $data['title']);
* Has anyone done this exercise yet ?
$sql = 'SELECT count(exe_id) AS number FROM '. $tbl_stats
return ($number[0] != 0);
* Get the score of this exercise. Only the first attempts are taken into account.
* @param $stud_id student id (default: all students who have results - then the average is returned)
* @return array (score, max) if student is given
* array (sum of scores, number of scores) otherwise
* or null if no scores available
$sql = 'SELECT * FROM '. $tbl_stats
$sql .= ' AND exe_user_id = '. $stud_id;
// order by id, that way the student's first attempt is accessed first
$sql .= ' ORDER BY exe_id';
return array ($data['exe_result'], $data['exe_weighting']);
// all students -> get average
$students= array(); // user list, needed to make sure we only
// take first attempts into account
if ($data['exe_weighting'] != 0)
$students[$data['exe_user_id']] = $data['exe_result'];
$sum += ($data['exe_result'] / $data['exe_weighting']);
return array ($sum , $rescount);
* Get URL where to go to if the user clicks on the link.
* First we go to exercise_jump.php and then to the result page.
* Check this php file for more info.
* Get name to display: same as exercise title
* Get description to display: same as exercise description
return $data['description'];
* Check if this still links to an exercise
return ($number[0] != 0);
* Lazy load function to get the database table of the exercise
$database_name = $course_info['db_name'];
* Lazy load function to get the database contents of this exercise
|