| 1 | 
           efrain | 
           1 | 
           This files describes API changes in /mod/data - plugins,
  | 
        
        
            | 
            | 
           2 | 
           information provided here is intended especially for developers.
  | 
        
        
            | 
            | 
           3 | 
              | 
        
        
            | 
            | 
           4 | 
           === 4.4.1 ===
  | 
        
        
            | 
            | 
           5 | 
           * The `data_add_record` method accepts a new `$approved` parameter to set the corresponding state of the new record
  | 
        
        
            | 
            | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
           === 4.4 ===
  | 
        
        
            | 
            | 
           8 | 
           * The following behat steps are now deprecated. Use data generators instead:
  | 
        
        
            | 
            | 
           9 | 
             - I add a ":fieldtype" field to ":activityname" database and I fill the form with:
  | 
        
        
            | 
            | 
           10 | 
             - I add an entry to ":activityname" database with:
  | 
        
        
            | 
            | 
           11 | 
           * Use of mustache templates for rendering add/modify fields forms. Elimination of all mod/data/field/*/mod.html files.
  | 
        
        
            | 
            | 
           12 | 
           * A function get_field_params() in data_field_base can be extended by datafield plugins to get their parameters.
  | 
        
        
            | 
            | 
           13 | 
              | 
        
        
            | 
            | 
           14 | 
           === 4.3 ===
  | 
        
        
            | 
            | 
           15 | 
           * Function data_export_xls() has been deprecated and moved to deprecatedlib, because xls support has already been dropped.
  | 
        
        
            | 
            | 
           16 | 
           * Functions data_export_csv(), data_export_ods() and data_get_exportdata() have been deprecated due to a bigger
  | 
        
        
            | 
            | 
           17 | 
             refactoring of the way data is being exported. This is now being done by new exporter classes
  | 
        
        
            | 
            | 
           18 | 
             \mod_data\local\exporter\csv_entries_exporter and \mod_data\local\exporter\ods_entries_exporter (inheriting from
  | 
        
        
            | 
            | 
           19 | 
             exporter base class \mod_data\local\exporter\entries_exporter) as well as \mod_data\local\exporter\utils::data_exportdata().
  | 
        
        
            | 
            | 
           20 | 
           * Function data_import_csv() has been deprecated and moved to deprecatedlib due to a bigger rework of the way data is
  | 
        
        
            | 
            | 
           21 | 
             being imported. This is now being done by new importer class \mod_data\local\importer\csv_importer inheriting from new
  | 
        
        
            | 
            | 
           22 | 
             class \mod_data\local\importer.
  | 
        
        
            | 
            | 
           23 | 
           * Field base class now has two new methods file_export_supported() and export_file_value(). The method
  | 
        
        
            | 
            | 
           24 | 
             file_export_supported() can be overwritten to declare that a field type can/wants to export a file. In this case this
  | 
        
        
            | 
            | 
           25 | 
             field type will have to implement the method export_file_value() returning this file for exporting. Also: This field
  | 
        
        
            | 
            | 
           26 | 
             type will have to export the name of the file by overwriting text_export_supported() to return true and make the
  | 
        
        
            | 
            | 
           27 | 
             method export_text_value() return the name of the file.
  | 
        
        
            | 
            | 
           28 | 
           * The field types file and picture now are able to export the file/picture.
  | 
        
        
            | 
            | 
           29 | 
           * Field base class now has two new methods file_import_supported() and import_file_value(). The method
  | 
        
        
            | 
            | 
           30 | 
             file_import_supported() can be overwritten to declare that a field type is able to import a file. In this case this
  | 
        
        
            | 
            | 
           31 | 
             field type will have to implement the method import_file_value() doing the actual import of the file being passed.
  | 
        
        
            | 
            | 
           32 | 
           * The field types file and picture now are able to import the file/picture.
  | 
        
        
            | 
            | 
           33 | 
              | 
        
        
            | 
            | 
           34 | 
           === 4.2 ===
  | 
        
        
            | 
            | 
           35 | 
           * The field base class now has a method validate(). Overwrite it in the field type to provide validation of field type's
  | 
        
        
            | 
            | 
           36 | 
             parameters in the field add/modify form.
  | 
        
        
            | 
            | 
           37 | 
           * New tags are added to the current mod_data\templates class: ##otherfields##, [[FIELD#name]],
  | 
        
        
            | 
            | 
           38 | 
             and [[FIELD#description]].
  | 
        
        
            | 
            | 
           39 | 
           * The mod_data\template class can provide preprocessor methods to optimize some tags. From now on,
  | 
        
        
            | 
            | 
           40 | 
             when load_template_tags detects a tag, it will call a "preprocess_tag_TAGNAME" method if it exists.
  | 
        
        
            | 
            | 
           41 | 
             This preprocessing can be used, for example, to precalculate some content. Currently, this preprocessor
  | 
        
        
            | 
            | 
           42 | 
             is used to detect which fields needs to be renderer when a ##otherfields## is used.
  | 
        
        
            | 
            | 
           43 | 
              | 
        
        
            | 
            | 
           44 | 
           === 4.1 ===
  | 
        
        
            | 
            | 
           45 | 
           * The method data_view is now deprecated. Use $maganer->set_module_viewed instead.
  | 
        
        
            | 
            | 
           46 | 
           * The data_print_template function is now deprecated and replaced by mod_data\template class.
  | 
        
        
            | 
            | 
           47 | 
           * The data_print_ratings function now has an extra $print to get the ratings output instead of printing it directly.
  | 
        
        
            | 
            | 
           48 | 
           * The following functions have been deprecated because they have been moved to the manager class:
  | 
        
        
            | 
            | 
           49 | 
             - data_get_available_presets
  | 
        
        
            | 
            | 
           50 | 
             - data_get_available_site_presets
  | 
        
        
            | 
            | 
           51 | 
             - data_preset_name
  | 
        
        
            | 
            | 
           52 | 
             - data_presets_export
  | 
        
        
            | 
            | 
           53 | 
             - data_presets_generate_xml
  | 
        
        
            | 
            | 
           54 | 
             - data_presets_save
  | 
        
        
            | 
            | 
           55 | 
             - is_directory_a_preset
  | 
        
        
            | 
            | 
           56 | 
           * mod_data_external::add_entry() function throws an error when trying to add an entry to a database with no field created.
  | 
        
        
            | 
            | 
           57 | 
           * data_user_can_add_entry() function returns false for any user if there is no field created on the database.
  | 
        
        
            | 
            | 
           58 | 
           * From now on, the data_generate_default_template method will always return a string with the template content or an empty
  | 
        
        
            | 
            | 
           59 | 
             string when there is no content available.
  | 
        
        
            | 
            | 
           60 | 
           * The following classes have been deprecated from lib.php because they have been moved to use manager class:
  | 
        
        
            | 
            | 
           61 | 
             - data_preset_importer
  | 
        
        
            | 
            | 
           62 | 
             - data_preset_existing_importer
  | 
        
        
            | 
            | 
           63 | 
             - data_preset_upload_importer
  | 
        
        
            | 
            | 
           64 | 
           * import_setting_mappings() function has been deprecated. Use importing_preset() instead.
  | 
        
        
            | 
            | 
           65 | 
           * $fieldselect single_select type parameter has been deprecated for fields_action_bar class constructor, and a new action_menu
  | 
        
        
            | 
            | 
           66 | 
             type parameter has been added.
  | 
        
        
            | 
            | 
           67 | 
           * The $urlselect, $saveaspresetbutton and $exportpresetbutton parameters in the constructor of the fields_action_bar class
  | 
        
        
            | 
            | 
           68 | 
           have been deprecated too and are not used anymore.
  | 
        
        
            | 
            | 
           69 | 
           * The $saveaspresetbutton and $exportpresetbutton parameters in the constructor of the templates_action_bar class
  | 
        
        
            | 
            | 
           70 | 
           have been deprecated and are not used anymore. Besides, a new parameter, $actionsselect, has been added to the
  | 
        
        
            | 
            | 
           71 | 
           constructor of this class.
  | 
        
        
            | 
            | 
           72 | 
           * A new parameter, $actionsselect, has been added to the presets_action_bar constructor.
  | 
        
        
            | 
            | 
           73 | 
           * A new parameter, $mode, has been added to the view_action_bar constructor.
  | 
        
        
            | 
            | 
           74 | 
           * The $hassaveaspreset and $haveexportpreset parameters in the get_fields_action_bar() action_bar class have been deprecated and
  | 
        
        
            | 
            | 
           75 | 
           are not used anymore.
  | 
        
        
            | 
            | 
           76 | 
              | 
        
        
            | 
            | 
           77 | 
           === 3.7 ===
  | 
        
        
            | 
            | 
           78 | 
           * External functions get_entries, get_entry and search_entries now return an additional field "tags" containing the entry tags.
  | 
        
        
            | 
            | 
           79 | 
              | 
        
        
            | 
            | 
           80 | 
           === 3.4 ===
  | 
        
        
            | 
            | 
           81 | 
           * External function mod_data_external::search_entries() now returns the maxcount field: Total count of records that the user could
  | 
        
        
            | 
            | 
           82 | 
               see in the database (if all the search criterias were removed).
  | 
        
        
            | 
            | 
           83 | 
           * External function get_entry now returns an additional field "ratinginfo" containing the entry rating information.
  | 
        
        
            | 
            | 
           84 | 
              | 
        
        
            | 
            | 
           85 | 
           === 3.3.2 ===
  | 
        
        
            | 
            | 
           86 | 
           * data_refresh_events() Now takes two additional parameters to refine the update to a specific instance. This function
  | 
        
        
            | 
            | 
           87 | 
             now optionally takes the module instance object or ID, and the course module object or ID. Please try to send the full
  | 
        
        
            | 
            | 
           88 | 
             objects instead of the ids to save DB calls.
  | 
        
        
            | 
            | 
           89 | 
              | 
        
        
            | 
            | 
           90 | 
           === 3.3 ===
  | 
        
        
            | 
            | 
           91 | 
              | 
        
        
            | 
            | 
           92 | 
           * External function get_databases_by_courses now return more fields for users with mod/data:viewentry capability enabled:
  | 
        
        
            | 
            | 
           93 | 
               maxentries, rssarticles, singletemplate, listtemplate, listtemplateheader, listtemplatefooter, addtemplate,
  | 
        
        
            | 
            | 
           94 | 
               rsstemplate, rsstitletemplate, csstemplate, jstemplate, asearchtemplate, approval, defaultsort, defaultsortdir, manageapproved.
  | 
        
        
            | 
            | 
           95 | 
           * Data field classes extending data_field_base should implement the get_config_for_external method.
  | 
        
        
            | 
            | 
           96 | 
               This method is used for returning the field settings for external functions.
  | 
        
        
            | 
            | 
           97 | 
               You should check the user capabilities of the current user before returning any field setting value.
  | 
        
        
            | 
            | 
           98 | 
               This is intended to protect field settings like private keys for external systems.
  | 
        
        
            | 
            | 
           99 | 
           * Required entries has been added to the Activity completion setting of mod_form. Entries required for completion
  | 
        
        
            | 
            | 
           100 | 
               (in the entries section) is no longer displayed for new instances and will be deprecated in a future release
  | 
        
        
            | 
            | 
           101 | 
               in favour of the new completion setting.
  | 
        
        
            | 
            | 
           102 | 
              | 
        
        
            | 
            | 
           103 | 
           === 3.2 ===
  | 
        
        
            | 
            | 
           104 | 
              | 
        
        
            | 
            | 
           105 | 
           * New hook - update_content_import - Can be implemented by field subplugins data_field_* class
  | 
        
        
            | 
            | 
           106 | 
               This can be used to pre-process data from a csv file before it is inserted into the database.
  |