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

Public Member Functions

 __construct ($field=0, $data=0, $cm=0)
 define_default_field ()
 define_field ($data)
 insert_field ()
 update_field ()
 delete_field ()
 display_add_field ($recordid=0)
 display_edit_field ()
 display_browse_field ($recordid, $template)
 update_content ($recordid, $value, $name='')
 delete_content ($recordid=0)
 notemptyfield ($value, $name)
 print_before_form ()
 print_after_form ()
 get_sort_field ()
 get_sort_sql ($fieldname)
 name ()
 image ()
 text_export_supported ()
 export_text_value ($record)
 file_ok ($relativepath)

Data Fields

 $type = 'unknown'
 $data = NULL
 $field = NULL
 $iconwidth = 16
 $iconheight = 16
 $cm
 $context

Detailed Description

Definition at line 49 of file lib.php.


Constructor & Destructor Documentation

__construct ( field = 0,
data = 0,
cm = 0 
)

Constructor function

object CONTEXT_MODULE

Parameters:
int$field
int$data
int$cm

Definition at line 75 of file lib.php.

Here is the call graph for this function:


Member Function Documentation

This field just sets up a default field object

Returns:
bool

Definition at line 126 of file lib.php.

Here is the caller graph for this function:

define_field ( data)

Set up the field object according to data in an object. Now is the time to clean it!

Returns:
bool

Definition at line 149 of file lib.php.

delete_content ( recordid = 0)

Delete all content associated with the field

object

Parameters:
int$recordid
Returns:
bool

Definition at line 355 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Delete a field completely

object

Returns:
bool

Definition at line 214 of file lib.php.

Here is the call graph for this function:

display_add_field ( recordid = 0)

Print the relevant form element in the ADD template for this field

object

Parameters:
int$recordid
Returns:
string

Reimplemented in data_field_latlong, data_field_date, data_field_textarea, data_field_picture, data_field_checkbox, data_field_menu, data_field_multimenu, data_field_radiobutton, data_field_file, and data_field_url.

Definition at line 231 of file lib.php.

Here is the call graph for this function:

display_browse_field ( recordid,
template 
)

Display the content of the field in browse mode

object

Parameters:
int$recordid
object$template
Returns:
bool|string

Reimplemented in data_field_multimenu, data_field_checkbox, data_field_picture, data_field_file, data_field_date, data_field_latlong, data_field_url, and data_field_number.

Definition at line 303 of file lib.php.

Here is the call graph for this function:

Print the relevant form element to define the attributes for this field viewable by teachers only.

object object

Returns:
void Output is echo'd

Definition at line 260 of file lib.php.

Here is the call graph for this function:

export_text_value ( record)

Per default, return the record's text value only from the "content" field. Override this in fields class if necesarry.

Parameters:
string$record
Returns:
string

Reimplemented in data_field_latlong, and data_field_url.

Definition at line 463 of file lib.php.

Here is the call graph for this function:

file_ok ( relativepath)
Parameters:
string$relativepath
Returns:
bool false

Reimplemented in data_field_picture, and data_field_file.

Definition at line 473 of file lib.php.

Returns the sortable field for the content. By default, it's just content but for some plugins, it could be content 1 - content4

Returns:
string

Definition at line 406 of file lib.php.

get_sort_sql ( fieldname)

Returns the SQL needed to refer to the column. Some fields may need to CAST() etc.

Parameters:
string$fieldname
Returns:
string $fieldname

Reimplemented in data_field_latlong, data_field_date, and data_field_number.

Definition at line 416 of file lib.php.

image ( )

Prints the respective type icon

object

Returns:
string

Definition at line 435 of file lib.php.

Here is the call graph for this function:

Insert a new field in the database We assume the field object is already defined as $this->field

object

Returns:
bool

Definition at line 182 of file lib.php.

name ( )

Returns the name/type of the field

Returns:
string

Definition at line 425 of file lib.php.

Here is the caller graph for this function:

notemptyfield ( value,
name 
)

Check if a field from an add form is empty

Parameters:
mixed$value
mixed$name
Returns:
bool

Reimplemented in data_field_url.

Definition at line 383 of file lib.php.

Just in case a field needs to print something after the whole form

Reimplemented in data_field_textarea.

Definition at line 396 of file lib.php.

Just in case a field needs to print something before the whole form

Definition at line 390 of file lib.php.

Per default, it is assumed that fields support text exporting. Override this (return false) on fields not supporting text exporting.

Returns:
bool true

Reimplemented in data_field_picture, and data_field_file.

Definition at line 452 of file lib.php.

Here is the caller graph for this function:

update_content ( recordid,
value,
name = '' 
)

Update the content of one data field in the data_content table object

Parameters:
int$recordid
mixed$value
string$name
Returns:
bool

Reimplemented in data_field_picture, data_field_multimenu, data_field_latlong, data_field_file, data_field_checkbox, data_field_url, data_field_textarea, data_field_date, and data_field_number.

Definition at line 332 of file lib.php.

Here is the call graph for this function:

Update a field in the database

object

Returns:
bool

Reimplemented in data_field_picture.

Definition at line 201 of file lib.php.


Field Documentation

$cm

Definition at line 62 of file lib.php.

Definition at line 64 of file lib.php.

$data = NULL

Definition at line 54 of file lib.php.

$field = NULL

Definition at line 56 of file lib.php.

$iconheight = 16

Definition at line 60 of file lib.php.

$iconwidth = 16

Definition at line 58 of file lib.php.


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