Moodle  2.2.1
http://www.collinsharper.com
condition_info Class Reference

Public Member Functions

 __construct ($cm, $expectingmissing=CONDITION_MISSING_NOTHING, $loaddata=true)
 get_full_course_module ()
 add_completion_condition ($cmid, $requiredcompletion)
 add_grade_condition ($gradeitemid, $min, $max, $updateinmemory=false)
 wipe_conditions ()
 get_full_information ($modinfo=null)
 is_available (&$information, $grabthelot=false, $userid=0, $modinfo=null)
 show_availability ()

Static Public Member Functions

static fill_availability_conditions (&$cm)
static wipe_session_cache ()
static update_cm_from_form ($cm, $fromform, $wipefirst=true)
static completion_value_used_as_condition ($course, $cm)

Data Fields

 $gotdata

Detailed Description

Definition at line 59 of file conditionlib.php.


Constructor & Destructor Documentation

__construct ( cm,
expectingmissing = CONDITION_MISSING_NOTHING,
loaddata = true 
)

Constructs with course-module details.

object CONDITION_MISSING_NOTHING CONDITION_MISSING_EVERYTHING DEBUG_DEVELOPER CONDITION_MISSING_EXTRATABLE

Parameters:
object$cmMoodle course-module object. May have extra fields ->conditionsgrade, ->conditionscompletion which should come from get_fast_modinfo. Should have ->availablefrom, ->availableuntil, and ->showavailability, ->course; but the only required thing is ->id.
int$expectingmissingUsed to control whether or not a developer debugging message (performance warning) will be displayed if some of the above data is missing and needs to be retrieved; a CONDITION_MISSING_xx constant
bool$loaddataIf you need a 'write-only' object, set this value to false to prevent database access from constructor
Returns:
condition_info Object which can retrieve information about the activity

Definition at line 86 of file conditionlib.php.

Here is the call graph for this function:


Member Function Documentation

add_completion_condition ( cmid,
requiredcompletion 
)

Adds to the database a condition based on completion of another module.

object

Parameters:
int$cmidID of other module
int$requiredcompletionCOMPLETION_xx constant

Definition at line 213 of file conditionlib.php.

add_grade_condition ( gradeitemid,
min,
max,
updateinmemory = false 
)

Adds to the database a condition based on the value of a grade item.

object

Parameters:
int$gradeitemidID of grade item
float$minMinimum grade (>=), up to 5 decimal points, or null if none
float$maxMaximum grade (<), up to 5 decimal points, or null if none
bool$updateinmemoryIf true, updates data in memory; otherwise, memory version may be out of date (this has performance consequences, so don't do it unless it really needs updating)

Definition at line 236 of file conditionlib.php.

static completion_value_used_as_condition ( course,
cm 
) [static]

Used in course/lib.php because we need to disable the completion JS if a completion value affects a conditional activity.

object

Parameters:
object$courseMoodle course object
object$cmMoodle course-module
Returns:
bool True if this is used in a condition, false otherwise

Definition at line 720 of file conditionlib.php.

Here is the call graph for this function:

static fill_availability_conditions ( &$  cm) [static]

Adds the extra availability conditions (if any) into the given course-module object.

object object

Parameters:
object$cmMoodle course-module data object

Definition at line 140 of file conditionlib.php.

Here is the caller graph for this function:

See also:
require_data()
Returns:
object A course-module object with all the information required to determine availability.

Definition at line 201 of file conditionlib.php.

get_full_information ( modinfo = null)

Obtains a string describing all availability restrictions (even if they do not apply any more).

object object

Parameters:
object$modinfoUsually leave as null for default. Specify when calling recursively from inside get_fast_modinfo. The value supplied here must include list of all CMs with 'id' and 'name'
Returns:
string Information string (for admin) about all restrictions on this item

Definition at line 289 of file conditionlib.php.

Here is the call graph for this function:

is_available ( &$  information,
grabthelot = false,
userid = 0,
modinfo = null 
)

Determines whether this particular course-module is currently available according to these criteria.

  • This does not include the 'visible' setting (i.e. this might return true even if visible is false); visible is handled independently.
  • This does not take account of the viewhiddenactivities capability. That should apply later.

object object COMPLETION_COMPLETE COMPLETION_COMPLETE_FAIL COMPLETION_COMPLETE_PASS

Parameters:
string$informationIf the item has availability restrictions, a string that describes the conditions will be stored in this variable; if this variable is set blank, that means don't display anything
bool$grabthelotPerformance hint: if true, caches information required for all course-modules, to make the front page and similar pages work more quickly (works only for current user)
int$useridIf set, specifies a different user ID to check availability for
object$modinfoUsually leave as null for default. Specify when calling recursively from inside get_fast_modinfo. The value supplied here must include list of all CMs with 'id' and 'name'
Returns:
bool True if this item is available to the user, false otherwise

Definition at line 437 of file conditionlib.php.

Here is the call graph for this function:

Returns:
bool True if information about availability should be shown to normal users
Exceptions:
coding_exceptionIf data wasn't loaded

Definition at line 570 of file conditionlib.php.

static update_cm_from_form ( cm,
fromform,
wipefirst = true 
) [static]

Utility function called by modedit.php; updates the course_modules_availability table based on the module form data.

Parameters:
object$cmCourse-module with as much data as necessary, min id
object$fromform
bool$wipefirstDefaults to true

Definition at line 690 of file conditionlib.php.

Erases from the database all conditions for this activity.

object

Definition at line 266 of file conditionlib.php.

static wipe_session_cache ( ) [static]

For testing only. Wipes information cached in user session.

object

Definition at line 676 of file conditionlib.php.

Here is the caller graph for this function:


Field Documentation

$gotdata

Definition at line 63 of file conditionlib.php.


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