Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Attributes | List of all members
data_field_latlong Class Reference
Inheritance diagram for data_field_latlong:
data_field_base

Public Member Functions

 define_default_field ()
 This field just sets up a default field object. More...
 
 define_field ($data)
 Set up the field object according to data in an object. More...
 
object delete_content ($recordid=0)
 Delete all content associated with the field. More...
 
object delete_field ()
 Delete a field completely. More...
 
 display_add_field ($recordid=0, $formdata=null)
 Print the relevant form element in the ADD template for this field. More...
 
 display_browse_field ($recordid, $template)
 Display the content of the field in browse mode. More...
 
object display_edit_field ()
 Print the relevant form element to define the attributes for this field viewable by teachers only. More...
 
 display_search_field ($value='')
 
 export_text_value ($record)
 Per default, return the record's text value only from the "content" field. More...
 
 field_validation ($values)
 Validate values for this field. More...
 
 file_ok ($relativepath)
 
 generate_sql ($tablealias, $value)
 
 get_config_for_external ()
 Return the plugin configs for external functions. More...
 
 get_sort_field ()
 Returns the sortable field for the content. More...
 
 get_sort_sql ($fieldname)
 Returns the SQL needed to refer to the column. More...
 
object image ()
 Prints the respective type icon. More...
 
object insert_field ()
 Insert a new field in the database We assume the field object is already defined as $this->field. More...
 
 name ()
 Returns the name/type of the field. More...
 
 notemptyfield ($value, $name)
 Check if a field from an add form is empty. More...
 
 parse_search_field ($defaults=null)
 
 print_after_form ()
 Just in case a field needs to print something after the whole form. More...
 
 print_before_form ()
 Just in case a field needs to print something before the whole form.
 
 text_export_supported ()
 Per default, it is assumed that fields support text exporting. More...
 
 update_content ($recordid, $value, $name='')
 Update the content of one data field in the data_content table. More...
 
 update_content_import ($recordid, $value, $name='')
 
object update_field ()
 Update a field in the database. More...
 

Static Public Member Functions

static get_content_value ($content)
 Returns the presentable string value for a field content. More...
 
static get_priority ()
 Returns the priority for being indexed by globalsearch. More...
 

Public Attributes

object $cm
 course module or cmifno
 
object $context
 activity context
 
object $data = NULL
 The database object that this field belongs to.
 
object $field = NULL
 The field object itself, if we know it.
 
int $iconheight = 16
 Width of the icon for this fieldtype.
 
int $iconwidth = 16
 Width of the icon for this fieldtype.
 
 $linkoutservices
 
 $type = 'latlong'
 
const HIGH_PRIORITY = 3
 priority value for high priority
 
const LOW_PRIORITY = 2
 priority value for low priority
 
const MAX_PRIORITY = 4
 priority value for maximum priority
 
const MIN_PRIORITY = 1
 priority value for minimum priority
 
const NO_PRIORITY = 0
 priority value for invalid fields regarding indexing
 

Static Protected Attributes

static priority $priority = self::NO_PRIORITY
 for globalsearch indexing
 

Member Function Documentation

◆ define_default_field()

data_field_base::define_default_field ( )
inherited

This field just sets up a default field object.

Return values
bool

◆ define_field()

data_field_base::define_field (   $data)
inherited

Set up the field object according to data in an object.

Now is the time to clean it!

Return values
bool

◆ delete_content()

object data_field_base::delete_content (   $recordid = 0)
inherited

Delete all content associated with the field.

Parameters
int$recordid
Return values
bool

◆ delete_field()

object data_field_base::delete_field ( )
inherited

Delete a field completely.

Return values
bool

◆ display_add_field()

data_field_latlong::display_add_field (   $recordid = 0,
  $formdata = null 
)

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

Parameters
int$recordid
Return values
string

Reimplemented from data_field_base.

◆ display_browse_field()

data_field_latlong::display_browse_field (   $recordid,
  $template 
)

Display the content of the field in browse mode.

Parameters
int$recordid
object$template
Return values
bool|string

Reimplemented from data_field_base.

◆ display_edit_field()

object data_field_base::display_edit_field ( )
inherited

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

@global object

Return values
voidOutput is echo'd

◆ export_text_value()

data_field_latlong::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
Return values
string

Reimplemented from data_field_base.

◆ field_validation()

data_field_latlong::field_validation (   $values)

Validate values for this field.

Both the Latitude and the Longitude fields need to be filled in.

Parameters
array$valuesThe entered values for the lat. and long.
Return values
string|boolError message or false.

◆ file_ok()

data_field_base::file_ok (   $relativepath)
inherited
Parameters
string$relativepath
Return values
boolfalse

Reimplemented in data_field_file, data_field_picture, and data_field_textarea.

◆ get_config_for_external()

data_field_latlong::get_config_for_external ( )

Return the plugin configs for external functions.

Return values
arraythe list of config parameters
Since
Moodle 3.3

Reimplemented from data_field_base.

◆ get_content_value()

static data_field_base::get_content_value (   $content)
staticinherited

Returns the presentable string value for a field content.

The returned string should be plain text.

Parameters
stdClass$content
Return values
string

Reimplemented in data_field_checkbox, data_field_multimenu, and data_field_textarea.

◆ get_priority()

static data_field_base::get_priority ( )
staticinherited

Returns the priority for being indexed by globalsearch.

Return values
int

◆ get_sort_field()

data_field_base::get_sort_field ( )
inherited

Returns the sortable field for the content.

By default, it's just content but for some plugins, it could be content 1 - content4

Return values
string

◆ get_sort_sql()

data_field_latlong::get_sort_sql (   $fieldname)

Returns the SQL needed to refer to the column.

Some fields may need to CAST() etc.

Parameters
string$fieldname
Return values
string::$fieldname

Reimplemented from data_field_base.

◆ image()

object data_field_base::image ( )
inherited

Prints the respective type icon.

Return values
string

◆ insert_field()

object data_field_base::insert_field ( )
inherited

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

Return values
bool

◆ name()

data_field_base::name ( )
inherited

Returns the name/type of the field.

Return values
string

◆ notemptyfield()

data_field_latlong::notemptyfield (   $value,
  $name 
)

Check if a field from an add form is empty.

Parameters
mixed$value
mixed$name
Return values
bool

Reimplemented from data_field_base.

◆ print_after_form()

data_field_base::print_after_form ( )
inherited

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

Reimplemented in data_field_textarea.

◆ text_export_supported()

data_field_base::text_export_supported ( )
inherited

Per default, it is assumed that fields support text exporting.

Override this (return false) on fields not supporting text exporting.

Return values
booltrue

Reimplemented in data_field_file, and data_field_picture.

◆ update_content()

data_field_latlong::update_content (   $recordid,
  $value,
  $name = '' 
)

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

Parameters
int$recordid
mixed$value
string$name
Return values
bool

Reimplemented from data_field_base.

◆ update_field()

object data_field_base::update_field ( )
inherited

Update a field in the database.

Return values
bool

Reimplemented in data_field_picture.

Member Data Documentation

◆ $linkoutservices

data_field_latlong::$linkoutservices
Initial value:
= array(
"Google Maps" => "http://maps.google.com/maps?q=@lat@,+@long@&iwloc=A&hl=en",
"Google Earth" => "@wwwroot@/mod/data/field/latlong/kml.php?d=@dataid@&fieldid=@fieldid@&rid=@recordid@",
"Geabios" => "http://www.geabios.com/html/services/maps/PublicMap.htm?lat=@lat@&lon=@long@&fov=0.3&title=Moodle%20data%20item",
"OpenStreetMap" => "http://www.openstreetmap.org/index.html?lat=@lat@&lon=@long@&zoom=11",
"Multimap" => "http://www.multimap.com/map/browse.cgi?scale=200000&lon=@long@&lat=@lat@&icon=x"
)

The documentation for this class was generated from the following file: