Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/data/lib.php File Reference

Go to the source code of this file.

Data Structures

class  data_field_base
class  data_preset_importer
class  data_preset_upload_importer
class  data_preset_existing_importer

Namespaces

namespace  mod
 

Local Library of functions for module scorm.


Enumerations

enum  DATA_MAX_ENTRIES
enum  DATA_PERPAGE_SINGLE
enum  DATA_FIRSTNAME
enum  DATA_LASTNAME
enum  DATA_APPROVED
enum  DATA_TIMEADDED
enum  DATA_TIMEMODIFIED
enum  DATA_CAP_EXPORT
enum  DATA_PRESET_COMPONENT
enum  DATA_PRESET_FILEAREA
enum  DATA_PRESET_CONTEXT

Functions

 data_generate_default_template (&$data, $template, $recordid=0, $form=false, $update=true)
 data_replace_field_in_templates ($data, $searchfieldname, $newfieldname)
 data_append_new_field_to_templates ($data, $newfieldname)
 data_get_field_from_name ($name, $data)
 data_get_field_from_id ($fieldid, $data)
 data_get_field_new ($type, $data)
 data_get_field ($field, $data, $cm=null)
 data_isowner ($record)
 data_atmaxentries ($data)
 data_numentries ($data)
 data_add_record ($data, $groupid=0)
 data_tags_check ($dataid, $template)
 data_add_instance ($data)
 data_update_instance ($data)
 data_delete_instance ($id)
 data_user_outline ($course, $user, $mod, $data)
 data_user_complete ($course, $user, $mod, $data)
 data_get_user_grades ($data, $userid=0)
 data_update_grades ($data, $userid=0, $nullifnone=true)
 data_upgrade_grades ()
 data_grade_item_update ($data, $grades=NULL)
 data_grade_item_delete ($data)
 data_get_participants ($dataid)
 data_print_template ($template, $records, $data, $search='', $page=0, $return=false)
 data_rating_permissions ($contextid, $component, $ratingarea)
 data_rating_validate ($params)
 data_print_preference_form ($data, $perpage, $search, $sort='', $order='ASC', $search_array= '', $advanced=0, $mode= '')
 data_print_ratings ($data, $record)
 data_get_view_actions ()
 data_get_post_actions ()
 data_fieldname_exists ($name, $dataid, $fieldid=0)
 data_convert_arrays_to_strings (&$fieldinput)
 data_convert_to_roles ($data, $teacherroles=array(), $studentroles=array(), $cmid=NULL)
 data_preset_name ($shortname, $path)
 data_get_available_presets ($context)
 data_get_available_site_presets ($context, array $presets=array())
 data_delete_site_preset ($name)
 data_print_header ($course, $cm, $data, $currenttab='')
 data_user_can_add_entry ($data, $currentgroup, $groupmode, $context=null)
 is_directory_a_preset ($directory)
 data_preset_path ($course, $userid, $shortname)
 data_reset_course_form_definition (&$mform)
 data_reset_course_form_defaults ($course)
 data_reset_gradebook ($courseid, $type='')
 data_reset_userdata ($data)
 data_get_extra_capabilities ()
 data_supports ($feature)
 data_export_csv ($export, $delimiter_name, $dataname, $count, $return=false)
 data_export_xls ($export, $dataname, $count)
 data_export_ods ($export, $dataname, $count)
 data_get_exportdata ($dataid, $fields, $selectedfields, $currentgroup=0)
 data_get_file_areas ($course, $cm, $context)
 data_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload)
 data_extend_navigation ($navigation, $course, $module, $cm)
 data_extend_settings_navigation (settings_navigation $settings, navigation_node $datanode)
 data_presets_save ($course, $cm, $data, $path)
 data_presets_generate_xml ($course, $cm, $data)
 data_presets_export ($course, $cm, $data, $tostorage=false)
 data_comment_permissions ($comment_param)
 data_comment_validate ($comment_param)
 data_page_type_list ($pagetype, $parentcontext, $currentcontext)

Enumeration Type Documentation

Definition at line 30 of file lib.php.

Definition at line 34 of file lib.php.

Definition at line 28 of file lib.php.

Definition at line 29 of file lib.php.

Definition at line 25 of file lib.php.

Definition at line 26 of file lib.php.

Definition at line 36 of file lib.php.

Definition at line 38 of file lib.php.

Definition at line 37 of file lib.php.

Definition at line 31 of file lib.php.

Definition at line 32 of file lib.php.


Function Documentation

data_add_instance ( data)

Adds an instance of a data

object

Parameters:
object$data
Returns:
$int

Definition at line 836 of file lib.php.

Here is the call graph for this function:

data_add_record ( data,
groupid = 0 
)

function that takes in a dataid and adds a record this is used everytime an add template is submitted

object object

Parameters:
object$data
int$groupid
Returns:
bool

Definition at line 782 of file lib.php.

Here is the call graph for this function:

data_append_new_field_to_templates ( data,
newfieldname 
)

Appends a new field at the end of the form template.

object

Parameters:
object$data
string$newfieldname

Definition at line 611 of file lib.php.

data_atmaxentries ( data)

has a user reached the max number of entries?

Parameters:
object$data
Returns:
bool

Definition at line 749 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_comment_permissions ( comment_param)

Running addtional permission check on plugin, for example, plugins may have switch to turn on/off comments option, this callback will affect UI display, not like pluginname_comment_validate only throw exceptions. Capability check has been done in comment->check_permissions(), we don't need to do it again here.

Parameters:
stdClass$comment_param{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Returns:
array

Definition at line 3264 of file lib.php.

data_comment_validate ( comment_param)

Validate comment parameter before perform other comments actions

Parameters:
stdClass$comment_param{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Returns:
boolean

Definition at line 3291 of file lib.php.

Here is the call graph for this function:

data_convert_arrays_to_strings ( &$  fieldinput)
Parameters:
array$fieldinput

Definition at line 1755 of file lib.php.

data_convert_to_roles ( data,
teacherroles = array(),
studentroles = array(),
cmid = NULL 
)

Converts a database (module instance) to use the Roles System

object object CONTEXT_MODULE CAP_PREVENT CAP_ALLOW

Parameters:
object$dataa data object with the same attributes as a record from the data database table
int$datamodidthe id of the data module, from the modules table
array$teacherrolesarray of roles that have archetype teacher
array$studentrolesarray of roles that have archetype student
array$guestrolesarray of roles that have archetype guest
int$cmidthe course_module id for this data instance
Returns:
boolean data module was converted or not

Definition at line 1787 of file lib.php.

Here is the call graph for this function:

deletes an instance of a data

object

Parameters:
int$id
Returns:
bool

Delete all the associated information

Definition at line 893 of file lib.php.

Here is the call graph for this function:

Deletes a saved preset.

Parameters:
string$name
Returns:
bool

Definition at line 2005 of file lib.php.

Here is the call graph for this function:

data_export_csv ( export,
delimiter_name,
dataname,
count,
return = false 
)

object

Parameters:
array$export
string$delimiter_name
object$database
int$count
bool$return
Returns:
string|void

Definition at line 2700 of file lib.php.

Here is the call graph for this function:

data_export_ods ( export,
dataname,
count 
)

object

Parameters:
array$export
string$dataname
int$count
string

Definition at line 2775 of file lib.php.

Here is the call graph for this function:

data_export_xls ( export,
dataname,
count 
)

object

Parameters:
array$export
string$dataname
int$count
Returns:
string

Definition at line 2740 of file lib.php.

Here is the call graph for this function:

data_extend_navigation ( navigation,
course,
module,
cm 
)

Check the number of entries required against the number of entries already made (doesn't apply to teachers)

Definition at line 2948 of file lib.php.

Here is the call graph for this function:

Adds module specific settings to the settings block

Parameters:
settings_navigation$settingsThe settings navigation object
navigation_node$datanodeThe node to add module settings to

Definition at line 2980 of file lib.php.

Here is the call graph for this function:

data_fieldname_exists ( name,
dataid,
fieldid = 0 
)
Parameters:
string$name
int$dataid
int$fieldid
Returns:
bool

Definition at line 1729 of file lib.php.

data_generate_default_template ( &$  data,
template,
recordid = 0,
form = false,
update = true 
)

Given a template and a dataid, generate a default case template

object

Parameters:
object$data
stringtemplate [addtemplate, singletemplate, listtempalte, rsstemplate]
int$recordid
bool$form
bool$update
Returns:
bool|string

Definition at line 490 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns an array of all the available presets.

Returns:
array

Definition at line 1936 of file lib.php.

Here is the call graph for this function:

data_get_available_site_presets ( context,
array presets = array() 
)

Gets an array of all of the presets that users have saved to the site.

Parameters:
stdClass$contextThe context that we are looking from.
array$presets
Returns:
array An array of presets

Definition at line 1974 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_get_exportdata ( dataid,
fields,
selectedfields,
currentgroup = 0 
)

object

Parameters:
int$dataid
array$fields
array$selectedfields
int$currentgroupgroup ID of the current group. This is used for exporting data while maintaining group divisions.
Returns:
array

Definition at line 2811 of file lib.php.

Returns all other caps used in module

Returns:
array

Definition at line 2667 of file lib.php.

data_get_field ( field,
data,
cm = null 
)

returns a subclass field object given a record of the field, used to invoke plugin methods input: $param $field - record from db

object

Parameters:
object$field
object$data
object$cm
Returns:
object

Definition at line 707 of file lib.php.

Here is the caller graph for this function:

data_get_field_from_id ( fieldid,
data 
)

given a field id this function creates an instance of the particular subfield class

object

Parameters:
int$fieldid
object$data
Returns:
bool|object

Definition at line 666 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_get_field_from_name ( name,
data 
)

given a field name this function creates an instance of the particular subfield class

object

Parameters:
string$name
object$data
Returns:
object|bool

Definition at line 645 of file lib.php.

Here is the call graph for this function:

data_get_field_new ( type,
data 
)

given a field id this function creates an instance of the particular subfield class

object

Parameters:
string$type
object$data
Returns:
object

Definition at line 687 of file lib.php.

data_get_file_areas ( course,
cm,
context 
)

Lists all browsable file areas

Parameters:
object$course
object$cm
object$context
Returns:
array

Definition at line 2862 of file lib.php.

data_get_participants ( dataid)

returns a list of participants of this database

Returns the users with data in one data (users with records in data_records, data_comments and ratings)

Todo:
: deprecated - to be deleted in 2.2
Parameters:
int$dataid
Returns:
array

Definition at line 1157 of file lib.php.

Returns:
array

Definition at line 1719 of file lib.php.

data_get_user_grades ( data,
userid = 0 
)

Return grade for given user or all users.

object

Parameters:
object$data
int$useridoptional user id, 0 means all users
Returns:
array array of grades, false if none

Definition at line 1015 of file lib.php.

Here is the caller graph for this function:

For Participantion Reports

Returns:
array

Definition at line 1712 of file lib.php.

Delete grade item for given data

object

Parameters:
object$dataobject
Returns:
object grade_item

Definition at line 1139 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_grade_item_update ( data,
grades = NULL 
)

Update/create grade item for given data

object

Parameters:
object$dataobject with extra cmidnumber
mixedoptional array/object of grade(s); 'reset' means reset grades in gradebook
Returns:
object grade_item

Definition at line 1105 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_isowner ( record)

Given record object (or id), returns true if the record belongs to the current user

object object

Parameters:
mixed$recordrecord object or id
Returns:
bool

Definition at line 727 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_numentries ( data)

returns the number of entries already made by this user

object object

Parameters:
object$data
Returns:
int

Definition at line 766 of file lib.php.

Here is the caller graph for this function:

data_page_type_list ( pagetype,
parentcontext,
currentcontext 
)

Return a list of page types

Parameters:
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

Definition at line 3358 of file lib.php.

data_pluginfile ( course,
cm,
context,
filearea,
args,
forcedownload 
)

Serves the data attachments. Implements needed access control ;-)

Parameters:
object$course
object$cm
object$context
string$filearea
array$args
bool$forcedownload
Returns:
bool false if file not found, does not return if found - justsend the file

Definition at line 2878 of file lib.php.

Here is the call graph for this function:

data_preset_name ( shortname,
path 
)

Returns the best name to show for a preset

Parameters:
string$shortname
string$path
Returns:
string

Definition at line 1919 of file lib.php.

Here is the caller graph for this function:

data_preset_path ( course,
userid,
shortname 
)

object object

Parameters:
object$course
int$userid
string$shortname
Returns:
string

Definition at line 2453 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_presets_export ( course,
cm,
data,
tostorage = false 
)

Definition at line 3151 of file lib.php.

Here is the call graph for this function:

data_presets_generate_xml ( course,
cm,
data 
)

Generates the XML for the database module provided

moodle_database $DB

Parameters:
stdClass$courseThe course the database module belongs to.
stdClass$cmThe course module record
stdClass$dataThe database record
Returns:
string The XML for the preset

Definition at line 3102 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_presets_save ( course,
cm,
data,
path 
)

Save the database configuration as a preset.

Parameters:
stdClass$courseThe course the database module belongs to.
stdClass$cmThe course module record
stdClass$dataThe database record
string$path
Returns:
bool

Definition at line 3048 of file lib.php.

Here is the call graph for this function:

data_print_header ( course,
cm,
data,
currenttab = '' 
)

Prints the heads for a page

Parameters:
stdClass$course
stdClass$cm
stdClass$data
string$currenttab

Definition at line 2030 of file lib.php.

Here is the call graph for this function:

data_print_preference_form ( data,
perpage,
search,
sort = '',
order = 'ASC',
search_array = '',
advanced = 0,
mode = '' 
)

function that takes in the current data, number of items per page, a search string and prints a preference box in view.php

This preference box prints a searchable advanced search template if a) A template is defined b) The advanced search checkbox is checked.

object object

Parameters:
object$data
int$perpage
string$search
string$sort
string$order
array$search_array
int$advanced
string$mode
Returns:
void

Definition at line 1528 of file lib.php.

Here is the call graph for this function:

data_print_ratings ( data,
record 
)

object object

Parameters:
object$data
object$record
Returns:
void Output echo'd

Definition at line 1700 of file lib.php.

Here is the caller graph for this function:

data_print_template ( template,
records,
data,
search = '',
page = 0,
return = false 
)

takes a list of records, the current data, a search string, and mode to display prints the translated template

object object

Parameters:
string$template
array$records
object$data
string$search
int$page
bool$return
Returns:
mixed

Definition at line 1226 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_rating_permissions ( contextid,
component,
ratingarea 
)

Return rating related permissions

Parameters:
string$contextidthe context id
string$componentthe component to get rating permissions for
string$ratingareathe rating area to get permissions for
Returns:
array an associative array of the user's rating permissions

Definition at line 1389 of file lib.php.

Here is the call graph for this function:

data_rating_validate ( params)

Validates a submitted rating

Parameters:
array$paramssubmitted data context => object the context in which the rated items exists [required] itemid => int the ID of the object being rated scaleid => int the scale from which the user can select a rating. Used for bounds checking. [required] rating => int the submitted rating rateduserid => int the id of the user whose items have been rated. NOT the user who submitted the ratings. 0 to update all. [required] aggregation => int the aggregation method to apply when calculating grades ie RATING_AGGREGATE_AVERAGE [required]
Returns:
boolean true if the rating is valid. Will throw rating_exception if not

Definition at line 1413 of file lib.php.

Here is the call graph for this function:

data_replace_field_in_templates ( data,
searchfieldname,
newfieldname 
)

Search for a field name and replaces it with another one in all the form templates. Set $newfieldname as '' if you want to delete the field from the form.

object

Parameters:
object$data
string$searchfieldname
string$newfieldname
Returns:
bool

Definition at line 569 of file lib.php.

Course reset form defaults.

Returns:
array

Definition at line 2496 of file lib.php.

Implementation of the function for printing the form elements that control whether the course reset functionality affects the data.

Parameters:
$mformform passed by reference

Definition at line 2478 of file lib.php.

data_reset_gradebook ( courseid,
type = '' 
)

Removes all grades from gradebook

object object

Parameters:
int$courseid
string$typeoptional type

Definition at line 2508 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_reset_userdata ( data)

Actual implementation of the reset course functionality, delete all the data responses for course $data->courseid.

object object

Parameters:
object$datathe data submitted from the reset course.
Returns:
array status array

Definition at line 2531 of file lib.php.

Here is the call graph for this function:

data_supports ( feature)
Parameters:
string$featureFEATURE_xx constant for requested feature
Returns:
mixed True if module supports feature, null if doesn't know

Definition at line 2675 of file lib.php.

data_tags_check ( dataid,
template 
)

check the multple existence any tag in a template

check to see if there are 2 or more of the same tag being used.

object

Parameters:
int$dataid,@paramstring $template
Returns:
bool

Definition at line 811 of file lib.php.

data_update_grades ( data,
userid = 0,
nullifnone = true 
)

Update activity grades

object object

Parameters:
object$data
int$useridspecific user only, 0 means all
bool$nullifnone

Definition at line 1045 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_update_instance ( data)

updates an instance of a data

object

Parameters:
object$data
Returns:
bool

Definition at line 859 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Update all grades in gradebook.

object

Definition at line 1071 of file lib.php.

Here is the call graph for this function:

data_user_can_add_entry ( data,
currentgroup,
groupmode,
context = null 
)

Can user add more entries?

Parameters:
object$data
mixed$currentgroup
int$groupmode
stdClass$context
Returns:
bool

Definition at line 2066 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

data_user_complete ( course,
user,
mod,
data 
)

Prints all the records uploaded by this user

object

Parameters:
object$course
object$user
object$mod
object$data

Definition at line 989 of file lib.php.

Here is the call graph for this function:

data_user_outline ( course,
user,
mod,
data 
)

returns a summary of data activity of this user

object

Parameters:
object$course
object$user
object$mod
object$data
Returns:
object|null

Definition at line 939 of file lib.php.

Here is the call graph for this function:

is_directory_a_preset ( directory)
Returns:
bool

Definition at line 2110 of file lib.php.

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations