Moodle  2.2.1
http://www.collinsharper.com
gradingform_controller Class Reference
Inheritance diagram for gradingform_controller:

Public Member Functions

 __construct (stdClass $context, $component, $area, $areaid)
 get_context ()
 get_component ()
 get_area ()
 get_areaid ()
 is_form_defined ()
 is_form_available ()
 is_shared_template ()
 is_own_form ($userid=null)
 form_unavailable_notification ()
 get_editor_url (moodle_url $returnurl=null)
 extend_settings_navigation (settings_navigation $settingsnav, navigation_node $node=null)
 extend_navigation (global_navigation $navigation, navigation_node $node=null)
 get_definition ($force=false)
 get_definition_copy (gradingform_controller $target)
 update_definition (stdClass $definition, $usermodified=null)
 get_formatted_description ()
 get_current_instance ($raterid, $itemid, $idonly=false)
 get_active_instances ($itemid)
 has_active_instances ()
 create_instance ($raterid, $itemid=null)
 get_or_create_instance ($instanceid, $raterid, $itemid)
 render_preview (moodle_page $page)
 delete_definition ()
 render_grade ($page, $itemid, $gradinginfo, $defaultcontent, $cangrade)
 set_grade_range (array $graderange)
 get_grade_range ()

Static Public Member Functions

static sql_search_from_tables ($gdid)
static sql_search_where ($token)

Data Fields

const DEFINITION_STATUS_NULL = 0
const DEFINITION_STATUS_DRAFT = 10
const DEFINITION_STATUS_READY = 20

Protected Member Functions

 get_instance ($instance)
 load_definition ()
 delete_plugin_definition ()
 get_method_name ()

Protected Attributes

 $context
 $component
 $area
 $areaid
 $definition = false
 $hasactiveinstances = null

Detailed Description

Grading method controller represents a plugin used in a particular area

Definition at line 32 of file lib.php.


Constructor & Destructor Documentation

__construct ( stdClass $  context,
component,
area,
areaid 
)

Do not instantinate this directly, use grading_manager::get_controller()

Parameters:
stdClass$contextthe context of the form
string$componentthe frankenstyle name of the component
string$areathe name of the gradable area
int$areaidthe id of the gradable area record

Definition at line 70 of file lib.php.

Here is the call graph for this function:


Member Function Documentation

create_instance ( raterid,
itemid = null 
)

This function is invoked when user (teacher) starts grading. It creates and returns copy of the current ACTIVE instance if it exists. If this is the first grading attempt, a new instance is created. The status of the returned instance is INCOMPLETE

Parameters:
int$raterid
int$itemid
Returns:
gradingform_instance

Definition at line 453 of file lib.php.

Deletes the form definition and all the associated data

See also:
delete_plugin_definition()
Returns:
void

Definition at line 500 of file lib.php.

delete_plugin_definition ( ) [abstract, protected]

Deletes all plugin data associated with the given form definiton

See also:
delete_definition()

Reimplemented in gradingform_rubric_controller.

extend_navigation ( global_navigation navigation,
navigation_node node = null 
)

Extends the module navigation

This function is called when the context for the page is an activity module with the FEATURE_ADVANCED_GRADING and there is an area with the active grading method set to the given plugin.

Parameters:
global_navigation$navigationglobal_navigation
navigation_node$nodenavigation_node

Reimplemented in gradingform_rubric_controller.

Definition at line 214 of file lib.php.

extend_settings_navigation ( settings_navigation settingsnav,
navigation_node node = null 
)

Extends the module settings navigation

This function is called when the context for the page is an activity module with the FEATURE_ADVANCED_GRADING, the user has the permission moodle/grade:managegradingforms and there is an area with the active grading method set to the given plugin.

Parameters:
settings_navigation$settingsnavsettings_navigation
navigation_node$nodenavigation_node

Reimplemented in gradingform_rubric_controller.

Definition at line 201 of file lib.php.

Returns a message why this form is unavailable. Maybe overriden by plugins to give more details.

See also:
is_form_available()
Returns:
string

Definition at line 167 of file lib.php.

Here is the call graph for this function:

get_active_instances ( itemid)

Returns list of ACTIVE instances for the specified $itemid (intentionally does not return instances with status NEEDUPDATE)

Parameters:
int$itemid
Returns:
array of gradingform_instance objects

Definition at line 392 of file lib.php.

get_area ( )
Returns:
string gradable area name

Definition at line 99 of file lib.php.

Returns:
int gradable area id

Definition at line 106 of file lib.php.

Here is the caller graph for this function:

Returns:
string gradable component name

Definition at line 92 of file lib.php.

Here is the caller graph for this function:

Returns:
stdClass controller context

Definition at line 85 of file lib.php.

Here is the caller graph for this function:

get_current_instance ( raterid,
itemid,
idonly = false 
)

Returns the current instance (either with status ACTIVE or NEEDUPDATE) for this definition for the specified $raterid and $itemid (if multiple raters are allowed, or only for $itemid otherwise).

Parameters:
int$raterid
int$itemid
boolean$idonly
Returns:
mixed if $idonly=true returns id of the found instance, otherwise returns the instance object

Definition at line 361 of file lib.php.

get_definition ( force = false)

Returns the grading form definition structure

Parameters:
boolean$forcewhether to force loading from DB even if it was already loaded
Returns:
stdClass|false definition data or false if the form is not defined yet

Definition at line 224 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the form definition suitable for cloning into another area

Parameters:
gradingform_controller$targetthe controller of the new copy
Returns:
stdClass definition structure to pass to the target's update_definition()

Reimplemented in gradingform_rubric_controller.

Definition at line 237 of file lib.php.

Here is the call graph for this function:

get_editor_url ( moodle_url returnurl = null)

Returns URL of a page where the grading form can be defined and edited.

Parameters:
moodle_url$returnurloptional URL of a page where the user should be sent once they are finished with editing
Returns:
moodle_url

Definition at line 180 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Formats the definition description for display on page

Returns:
string

Reimplemented in gradingform_rubric_controller.

Definition at line 345 of file lib.php.

Here is the call graph for this function:

get_grade_range ( ) [final]

Returns the range of grades used in this area

Returns:
array

Definition at line 611 of file lib.php.

get_instance ( instance) [protected]

Returns the object of type gradingform_XXX_instance (where XXX is the plugin method name)

Parameters:
mixed$instanceid or row from grading_isntances table
Returns:
gradingform_instance

Definition at line 430 of file lib.php.

get_method_name ( ) [protected]
Returns:
string the name of the grading method plugin, eg 'rubric'
See also:
PARAM_PLUGIN

Definition at line 573 of file lib.php.

Here is the caller graph for this function:

get_or_create_instance ( instanceid,
raterid,
itemid 
)

If instanceid is specified and grading instance exists and it is created by this rater for this item, this instance is returned. Otherwise new instance is created for the specified rater and itemid

Parameters:
int$instanceid
int$raterid
int$itemid
Returns:
gradingform_instance

Reimplemented in gradingform_rubric_controller.

Definition at line 474 of file lib.php.

Returns true if there are already people who has been graded on this definition. In this case plugins may restrict changes of the grading definition

Returns:
boolean

Definition at line 411 of file lib.php.

Here is the caller graph for this function:

Is the grading form defined and ready for usage?

Returns:
boolean

Definition at line 127 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Is the form definition record available?

Note that this actually checks whether the process of defining the form ever started and not whether the form definition should be considered as final.

Returns:
boolean

Definition at line 118 of file lib.php.

Here is the caller graph for this function:

is_own_form ( userid = null)

Is the grading form owned by the given user?

The form owner is the user who created this instance of the form.

Parameters:
int$useridthe user id to check, defaults to the current user
Returns:
boolean|null null if the form not defined yet, boolean otherwise

Definition at line 149 of file lib.php.

Here is the call graph for this function:

Is the grading form saved as a shared public template?

Returns:
boolean

Definition at line 136 of file lib.php.

Here is the call graph for this function:

load_definition ( ) [protected]

Loads the form definition if it exists

The default implementation just tries to load the record from the {grading_definitions} table. The plugins are likely to override this with a more complex query that loads all required data at once.

Reimplemented in gradingform_rubric_controller.

Definition at line 555 of file lib.php.

Here is the caller graph for this function:

render_grade ( page,
itemid,
gradinginfo,
defaultcontent,
cangrade 
)

Returns html code to be included in student's feedback.

Parameters:
moodle_page$page
int$itemid
array$gradinginforesult of function grade_get_grades if plugin want to use some of their info
string$defaultcontentdefault string to be returned if no active grading is found or for some reason can not be shown to a user
boolean$cangradewhether current user has capability to grade in this context
Returns:
string

Reimplemented in gradingform_rubric_controller.

Definition at line 591 of file lib.php.

render_preview ( moodle_page page) [abstract]

Returns the HTML code displaying the preview of the grading form

Plugins are forced to override this. Ideally they should delegate the task to their own renderer.

Parameters:
moodle_page$pagethe target page
Returns:
string

Reimplemented in gradingform_rubric_controller.

set_grade_range ( array graderange) [final]

Sets the range of grades used in this area. This is usually either range like 0-100 or the scale where keys start from 1. Typical use: $controller->set_grade_range(make_grades_menu($gradingtype));

Parameters:
array$graderange

Definition at line 602 of file lib.php.

static sql_search_from_tables ( gdid) [static]

Prepare the part of the search query to append to the FROM statement

Parameters:
string$gdidthe alias of grading_definitions.id column used by the caller
Returns:
string

Reimplemented in gradingform_rubric_controller.

Definition at line 524 of file lib.php.

static sql_search_where ( token) [static]

Prepare the parts of the SQL WHERE statement to search for the given token

The returned array cosists of the list of SQL comparions and the list of respective parameters for the comparisons. The returned chunks will be joined with other conditions using the OR operator.

Parameters:
string$tokentoken to search for
Returns:
array

Reimplemented in gradingform_rubric_controller.

Definition at line 538 of file lib.php.

update_definition ( stdClass $  definition,
usermodified = null 
)

Saves the defintion data into the database

The implementation in this base class stores the common data into the record into the {grading_definition} table. The plugins are likely to extend this and save their data into own tables, too.

Parameters:
stdClass$definitiondata containing values for the {grading_definition} table
int | null$usermodifiedoptional userid of the author of the definition, defaults to the current user

Reimplemented in gradingform_rubric_controller.

Definition at line 272 of file lib.php.


Field Documentation

$area [protected]

Definition at line 48 of file lib.php.

$areaid [protected]

Definition at line 51 of file lib.php.

$component [protected]

Definition at line 45 of file lib.php.

$context [protected]

Definition at line 42 of file lib.php.

$definition = false [protected]

Definition at line 54 of file lib.php.

$hasactiveinstances = null [protected]

Definition at line 60 of file lib.php.

the form is currently being edited and is not ready for usage yet

Definition at line 37 of file lib.php.

undefined definition status

Definition at line 35 of file lib.php.

the for was marked as ready for actual usage

Definition at line 39 of file lib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations