Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Drag-and-drop markers question definition class.

Copyright: 2012 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 509 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes


Class: qtype_ddmarker_question  - X-Ref

Represents a drag-and-drop markers question.

check_file_access($qa, $options, $component, $filearea, $args, $forcedownload)   X-Ref
No description

choice($choice)   X-Ref
Get a choice identifier

param: int $choice stem number
return: string the question-type variable name.

get_expected_data()   X-Ref
No description

is_complete_response(array $response)   X-Ref
No description

is_gradable_response(array $response)   X-Ref
No description

is_same_response(array $prevresponse, array $newresponse)   X-Ref
No description

arrays_same_at_key_integer(array $array1, array $array2, $key)   X-Ref
Tests to see whether two arrays have the same set of coords at a particular key. Coords
can be in any order.

param: array $array1 the first array.
param: array $array2 the second array.
param: string $key an array key.
return: bool whether the two arrays have the same set of coords (or lack of them)

array_intersect_fixed($array1, $array2)   X-Ref
This function is a variation of array_intersect that checks for the existence of duplicate
array values too.

param: array $array1
param: array $array2
author: dml at nm dot ru (taken from comments on php manual)
return: bool whether array1 and array2 contain the same values including duplicate values

get_validation_error(array $response)   X-Ref
No description

get_num_parts_right(array $response)   X-Ref
No description

choose_hits(array $response)   X-Ref
Choose hits to maximize grade where drop targets may have more than one hit and drop targets
can overlap.

param: array $response
return: array chosen hits

total_number_of_items_dragged(array $response)   X-Ref
No description

get_all_hits(array $response)   X-Ref
Get's an array of all hits on drop targets. Needs further processing to find which hits
to select in the general case that drop targets may have more than one hit and drop targets
can overlap.

param: array $response
return: array all hits

get_right_choice_for($place)   X-Ref
No description

grade_response(array $response)   X-Ref
No description

compute_final_grade($responses, $totaltries)   X-Ref
No description

clear_wrong_from_response(array $response)   X-Ref
No description

get_wrong_drags(array $response)   X-Ref
No description

get_drop_zones_without_hit(array $response)   X-Ref
No description

classify_response(array $response)   X-Ref
No description

get_correct_response()   X-Ref
No description

get_right_answer_summary()   X-Ref
No description

summarise_response(array $response)   X-Ref
No description

get_random_guess_score()   X-Ref
No description

Class: qtype_ddmarker_drag_item  - X-Ref

Represents one of the choices (draggable markers).

__construct($label, $no, $infinite, $noofdrags)   X-Ref
Drag item object setup.

param: string $label The label text of the drag item
param: int $no Which number drag item this is
param: bool $infinite True if the item can be used an unlimited number of times
param: int $noofdrags

choice_group()   X-Ref
Returns the group of this item.

return: int

summarise()   X-Ref
Creates summary text of for the drag item.

return: string

Class: qtype_ddmarker_drop_zone  - X-Ref

Represents one of the places (drop zones).

__construct($no, $shape, $coords)   X-Ref
Setup a drop zone object.

param: int $no Which number drop zone this is
param: int $shape Shape of the drop zone
param: array $coords Coordinates of the zone

summarise()   X-Ref
Creates summary text of for the drop zone

return: string

drop_hit($xy)   X-Ref
Indicates if the it coordinates are in this drop zone.

param: array $xy Array of X and Y location
return: bool

correct_coords()   X-Ref
Gets the center point of this zone

return: array X and Y location