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

Public Member Functions

 load_grade_item ()
 is_editable ()
 is_locked ()
 is_overridden ()
 get_datesubmitted ()
 get_dategraded ()
 set_overridden ($state, $refresh=true)
 is_excluded ()
 set_excluded ($state)
 set_locked ($lockedstate, $cascade=false, $refresh=true)
 check_locktime_all ($items)
 set_locktime ($locktime)
 get_locktime ()
 is_hidden ()
 is_hiddenuntil ()
 get_hidden ()
 set_hidden ($hidden, $cascade=false)
 is_passed ($grade_item=null)
 insert ($source=null)
 update ($source=null)
 notify_changed ($deleted)

Static Public Member Functions

static fetch_users_grades ($grade_item, $userids, $include_missing=true)
static fetch ($params)
static fetch_all ($params)
static standardise_score ($rawgrade, $source_min, $source_max, $target_min, $target_max)
static get_hiding_affected (&$grade_grades, &$grade_items)

Data Fields

 $table = 'grade_grades'
 $required_fields
 $optional_fields = array('feedback'=>null, 'feedbackformat'=>0, 'information'=>null, 'informationformat'=>0)
 $itemid
 $grade_item
 $userid
 $rawgrade
 $rawgrademax = 100
 $rawgrademin = 0
 $rawscaleid
 $usermodified
 $finalgrade
 $hidden = 0
 $locked = 0
 $locktime = 0
 $exported = 0
 $overridden = 0
 $excluded = 0
 $timecreated = null
 $timemodified = null

Detailed Description

Definition at line 30 of file grade_grade.php.


Member Function Documentation

check_locktime_all ( items)

Lock the grade if needed - make sure this is called only when final grades are valid

Parameters:
array$itemsarray of all grade item ids
Returns:
void

Definition at line 387 of file grade_grade.php.

Here is the caller graph for this function:

static fetch ( params) [static]

Finds and returns a grade_grade instance based on params.

Parameters:
array$paramsassociative arrays varname=>value
Returns:
object grade_grade instance or false if none found.

Reimplemented from grade_object.

Definition at line 507 of file grade_grade.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static fetch_all ( params) [static]

Finds and returns all grade_grade instances based on params.

Parameters:
array$paramsassociative arrays varname=>value
Returns:
array array of grade_grade instances or false if none found.

Reimplemented from grade_object.

Definition at line 518 of file grade_grade.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static fetch_users_grades ( grade_item,
userids,
include_missing = true 
) [static]

Returns array of grades for given grade_item+users.

Parameters:
object$grade_item
array$userids
bool$include_missinginclude grades that do not exist yet
Returns:
array userid=>grade_grade array

Definition at line 162 of file grade_grade.php.

Here is the caller graph for this function:

Returns timestamp when last graded, might be null if no grade present.

Returns:
int

Definition at line 277 of file grade_grade.php.

Returns timestamp of submission related to this grade, might be null if not submitted.

Returns:
int

Definition at line 267 of file grade_grade.php.

Check grade hidden status. Uses data from both grade item and grade.

Returns:
int 0 means visible, 1 hidden always, timestamp hidden until

Reimplemented from grade_object.

Definition at line 466 of file grade_grade.php.

Here is the call graph for this function:

static get_hiding_affected ( &$  grade_grades,
&$  grade_items 
) [static]

Return array of grade item ids that are either hidden or indirectly depend on hidden grades, excluded grades are not returned. THIS IS A REALLY BIG HACK! to be replaced by conditional aggregation of hidden grades in 2.0

Parameters:
array$gradesall course grades of one user, & used for better internal caching
array$items$grade_items array of grade items, & used for better internal caching
Returns:
array

Definition at line 561 of file grade_grade.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Set the locktime for this grade.

Returns:
int $locktime timestamp for lock to activate

Definition at line 418 of file grade_grade.php.

Here is the call graph for this function:

insert ( source = null)

Records this object in the Database, sets its id to the returned value, and returns that value. If successful this function also fetches the new object data from database and stores it in object properties.

Parameters:
string$sourcefrom where was the object inserted (mod/forum, manual, etc.)
Returns:
int PK ID if successful, false otherwise

Reimplemented from grade_object.

Definition at line 724 of file grade_grade.php.

Is grading object editable?

Returns:
boolean

Definition at line 224 of file grade_grade.php.

Here is the call graph for this function:

Checks if grade excluded from aggregation functions

Returns:
boolean

Definition at line 318 of file grade_grade.php.

Here is the caller graph for this function:

is_hidden ( )

Check grade hidden status. Uses data from both grade item and grade.

Returns:
boolean true if hidden, false if not

Reimplemented from grade_object.

Definition at line 435 of file grade_grade.php.

Here is the call graph for this function:

Check grade hidden status. Uses data from both grade item and grade.

Returns:
boolean true if hiddenuntil, false if not

Reimplemented from grade_object.

Definition at line 448 of file grade_grade.php.

Here is the call graph for this function:

is_locked ( )

Check grade lock status. Uses both grade item lock and grade lock. Internally any date in locked field (including future ones) means locked, the date is stored for logging purposes only.

Returns:
boolean true if locked, false if not

Definition at line 245 of file grade_grade.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Checks if grade overridden

Returns:
boolean

Definition at line 258 of file grade_grade.php.

Here is the caller graph for this function:

is_passed ( grade_item = null)

Returns true if the grade's value is superior or equal to the grade item's gradepass value, false otherwise.

Parameters:
object$grade_itemAn optional grade_item of which gradepass value we can use, saves having to load the grade_grade's grade_item
Returns:
boolean

Definition at line 701 of file grade_grade.php.

Here is the call graph for this function:

Loads the grade_item object referenced by $this->itemid and saves it as $this->grade_item for easy access.

Returns:
object grade_item.

Definition at line 202 of file grade_grade.php.

Here is the call graph for this function:

Here is the caller graph for this function:

notify_changed ( deleted)

Used to notify the completion system (if necessary) that a user's grade has changed, and clear up a possible score cache.

Parameters:
booldeleted True if grade was actually deleted

Reimplemented from grade_object.

Definition at line 749 of file grade_grade.php.

Here is the call graph for this function:

set_excluded ( state)

Set the excluded status of grade

Parameters:
boolean$staterequested excluded state
Returns:
boolean true is db state changed

Definition at line 327 of file grade_grade.php.

Here is the call graph for this function:

set_hidden ( hidden,
cascade = false 
)

Set the hidden status of grade, 0 mean visible, 1 always hidden, number means date to hide until.

Parameters:
boolean$cascadeignored
int$hiddennew hidden status

Reimplemented from grade_object.

Definition at line 495 of file grade_grade.php.

Here is the call graph for this function:

set_locked ( lockedstate,
cascade = false,
refresh = true 
)

Lock/unlock this grade.

Parameters:
int$locked0, 1 or a timestamp int(10) after which date the item will be locked.
boolean$cascadeignored param
boolean$refreshrefresh grades when unlocking
Returns:
boolean true if successful, false if can not set new lock state for grade

Definition at line 349 of file grade_grade.php.

Here is the call graph for this function:

set_locktime ( locktime)

Set the locktime for this grade.

Parameters:
int$locktimetimestamp for lock to activate
Returns:
void

Definition at line 408 of file grade_grade.php.

Here is the call graph for this function:

set_overridden ( state,
refresh = true 
)

Set the overridden status of grade

Parameters:
boolean$staterequested overridden state
boolean$refreshrefresh grades from external activities if needed
Returns:
boolean true is db state changed

Definition at line 294 of file grade_grade.php.

Here is the call graph for this function:

static standardise_score ( rawgrade,
source_min,
source_max,
target_min,
target_max 
) [static]

Given a float value situated between a source minimum and a source maximum, converts it to the corresponding value situated between a target minimum and a target maximum. Thanks to Darlene for the formula :-)

Parameters:
float$rawgrade
float$source_min
float$source_max
float$target_min
float$target_max
Returns:
float Converted value

Definition at line 535 of file grade_grade.php.

Here is the caller graph for this function:

update ( source = null)

In addition to update() as defined in grade_object rounds the float numbers using php function, the reason is we need to compare the db value with computed number to skip updates if possible.

Parameters:
string$sourcefrom where was the object inserted (mod/forum, manual, etc.)
Returns:
boolean success

Reimplemented from grade_object.

Definition at line 736 of file grade_grade.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

boolean $excluded = 0

Grade excluded from aggregation functions

Definition at line 140 of file grade_grade.php.

boolean $exported = 0

Exported flag

Definition at line 128 of file grade_grade.php.

float $finalgrade

The final value of this grade.

Definition at line 104 of file grade_grade.php.

The grade_item object referenced by $this->itemid.

Definition at line 62 of file grade_grade.php.

float $hidden = 0

0 if visible, 1 always hidden or date not visible until

Reimplemented from grade_object.

Definition at line 110 of file grade_grade.php.

int $itemid

The id of the grade_item this grade belongs to.

Definition at line 56 of file grade_grade.php.

$locked = 0

Definition at line 116 of file grade_grade.php.

float $locktime = 0

0 no automatic locking, date when to lock the grade automatically

Definition at line 122 of file grade_grade.php.

array $optional_fields = array('feedback'=>null, 'feedbackformat'=>0, 'information'=>null, 'informationformat'=>0)

Array of optional fields with default values (these should match db defaults)

Reimplemented from grade_object.

Definition at line 50 of file grade_grade.php.

boolean $overridden = 0

Overridden flag

Definition at line 134 of file grade_grade.php.

float $rawgrade

The grade value of this raw grade, if such was provided by the module.

Definition at line 74 of file grade_grade.php.

float $rawgrademax = 100

The maximum allowable grade when this grade was created.

Definition at line 80 of file grade_grade.php.

float $rawgrademin = 0

The minimum allowable grade when this grade was created.

Definition at line 86 of file grade_grade.php.

int $rawscaleid

id of the scale, if this grade is based on a scale.

Definition at line 92 of file grade_grade.php.

array $required_fields
Initial value:
 array('id', 'itemid', 'userid', 'rawgrade', 'rawgrademax', 'rawgrademin',
                                 'rawscaleid', 'usermodified', 'finalgrade', 'hidden', 'locked',
                                 'locktime', 'exported', 'overridden', 'excluded', 'timecreated', 'timemodified')

Array of required table fields, must start with 'id'.

Reimplemented from grade_object.

Definition at line 42 of file grade_grade.php.

string $table = 'grade_grades'

The DB table.

Reimplemented from grade_object.

Definition at line 36 of file grade_grade.php.

boolean $timecreated = null

TODO: HACK: create a new field datesubmitted - the date of submission if any

Reimplemented from grade_object.

Definition at line 146 of file grade_grade.php.

boolean $timemodified = null

TODO: HACK: create a new field dategraded - the date of grading

Reimplemented from grade_object.

Definition at line 152 of file grade_grade.php.

int $userid

The id of the user this grade belongs to.

Definition at line 68 of file grade_grade.php.

int $usermodified

The userid of the person who last modified this grade.

Definition at line 98 of file grade_grade.php.


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