diff --git a/backup/moodle2/backup_root_task.class.php b/backup/moodle2/backup_root_task.class.php index 1bc7ce4ded0..03e989da279 100644 --- a/backup/moodle2/backup_root_task.class.php +++ b/backup/moodle2/backup_root_task.class.php @@ -171,7 +171,7 @@ class backup_root_task extends backup_task { // Define custom fields inclusion setting if custom fields are used. $customfields = new backup_customfield_setting('customfield', base_setting::IS_BOOLEAN, true); - $customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfields', 'backup'))); + $customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfield', 'backup'))); $this->add_setting($customfields); } } diff --git a/backup/moodle2/restore_root_task.class.php b/backup/moodle2/restore_root_task.class.php index 6bb4927ff9a..3069a0bd164 100644 --- a/backup/moodle2/restore_root_task.class.php +++ b/backup/moodle2/restore_root_task.class.php @@ -288,7 +288,7 @@ class restore_root_task extends restore_task { $this->add_setting($competencies); $customfields = new restore_customfield_setting('customfields', base_setting::IS_BOOLEAN, $defaultvalue); - $customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfields', 'backup'))); + $customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfield', 'backup'))); $this->add_setting($customfields); } } diff --git a/course/classes/customfield/course_handler.php b/course/classes/customfield/course_handler.php index 329e763aca7..d7badc85bf7 100644 --- a/course/classes/customfield/course_handler.php +++ b/course/classes/customfield/course_handler.php @@ -27,7 +27,6 @@ namespace core_course\customfield; defined('MOODLE_INTERNAL') || die; use core_customfield\api; -use core_customfield\data_controller; use core_customfield\field_controller; /** @@ -49,11 +48,11 @@ class course_handler extends \core_customfield\handler { */ protected $parentcontext; - /** @var int */ + /** @var int Field is displayed in the course listing, visible to everybody */ const VISIBLETOALL = 2; - /** @var int */ + /** @var int Field is displayed in the course listing but only for teachers */ const VISIBLETOTEACHERS = 1; - /** @var int */ + /** @var int Field is not displayed in the course listing */ const NOTVISIBLE = 0; /** diff --git a/course/classes/search/customfield.php b/course/classes/search/customfield.php index 2b6538b69ff..8f5db60b9fc 100644 --- a/course/classes/search/customfield.php +++ b/course/classes/search/customfield.php @@ -64,9 +64,9 @@ class customfield extends \core_search\base { $fields = course_handler::create()->get_fields(); if (!$fields) { - return null; + $fields = array(); } - list($fieldsql, $fieldparam) = $DB->get_in_or_equal(array_keys($fields), SQL_PARAMS_NAMED, 'fld'); + list($fieldsql, $fieldparam) = $DB->get_in_or_equal(array_keys($fields), SQL_PARAMS_NAMED, 'fld', true, true); // Restrict recordset to CONTEXT_COURSE (since we are implementing it to core_course\search). $sql = "SELECT d.* @@ -179,6 +179,6 @@ class customfield extends \core_search\base { * @return \core_search\document_icon */ public function get_doc_icon(\core_search\document $doc) : \core_search\document_icon { - return new \core_search\document_icon('i/course'); + return new \core_search\document_icon('i/customfield'); } } diff --git a/customfield/classes/privacy/provider.php b/customfield/classes/privacy/provider.php index f4077e1f533..cf7d2fe839f 100644 --- a/customfield/classes/privacy/provider.php +++ b/customfield/classes/privacy/provider.php @@ -47,7 +47,13 @@ use Horde\Socket\Client\Exception; * @copyright 2018 David Matamoros * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\subsystem\plugin_provider { +class provider implements + // Customfield store data. + \core_privacy\local\metadata\provider, + + // The customfield subsystem stores data on behalf of other components. + \core_privacy\local\request\subsystem\plugin_provider, + \core_privacy\local\request\shared_userlist_provider { /** * Return the fields which contain personal data. diff --git a/customfield/index.html b/customfield/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/customfield/templates/list.mustache b/customfield/templates/list.mustache index 3265dc79f21..f91aa2d1f20 100644 --- a/customfield/templates/list.mustache +++ b/customfield/templates/list.mustache @@ -94,18 +94,18 @@ {{#str}} customfield, core_customfield {{/str}} - {{#str}} shortname, core_customfield {{/str}} + {{#str}} shortname, core_customfield {{/str}} {{#str}} type, core_customfield {{/str}} - {{#str}} action, core_customfield {{/str}} + {{#str}} action, core_customfield {{/str}} {{#fields}} {{> core/drag_handle}}{{{name}}} - {{{shortname}}} + {{{shortname}}} {{{type}}} - + {{#pix}} t/edit, core, {{#str}} edit, moodle {{/str}} {{/pix}} {{#pix}} diff --git a/lang/en/admin.php b/lang/en/admin.php index c2e304a7486..0595004155e 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -391,6 +391,7 @@ $string['contextlockappliestoadmin_desc'] = 'If disabled, administrators remain $string['cookiehttponly'] = 'Only http cookies'; $string['cookiesecure'] = 'Secure cookies only'; $string['country'] = 'Default country'; +$string['course_customfield'] = 'Course custom fields'; $string['coursecontact'] = 'Course contacts'; $string['coursecontact_desc'] = 'This setting allows you to control who appears on the course description. Users need to have at least one of these roles in a course to be shown on the course description for that course.'; $string['coursecontactduplicates'] = 'Display all course contact roles'; @@ -1385,4 +1386,3 @@ $string['moodleorghubname'] = 'Moodle.net'; $string['hubs'] = 'Hubs'; $string['configloginhttps'] = 'Turning this on will make Moodle use a secure https connection just for the login page (providing a secure login), and then afterwards revert back to the normal http URL for general speed. CAUTION: this setting REQUIRES https to be specifically enabled on the web server - if it is not then YOU COULD LOCK YOURSELF OUT OF YOUR SITE.'; $string['loginhttps'] = 'Use HTTPS for logins'; -$string['course_customfield'] = 'Course custom fields'; diff --git a/lang/en/backup.php b/lang/en/backup.php index d0070a87351..7aa3ae8c22e 100644 --- a/lang/en/backup.php +++ b/lang/en/backup.php @@ -275,7 +275,7 @@ $string['restoringcourse'] = 'Course restoration in progress'; $string['restoringcourseshortname'] = 'restoring'; $string['restorerolemappings'] = 'Restore role mappings'; $string['rootenrolmanual'] = 'Restore as manual enrolments'; -$string['rootsettingcustomfields'] = 'Include custom fields'; +$string['rootsettingcustomfield'] = 'Include custom fields'; $string['rootsettingenrolments'] = 'Include enrolment methods'; $string['rootsettingenrolments_always'] = 'Yes, always'; $string['rootsettingenrolments_never'] = 'No, restore users as manual enrolments'; diff --git a/lib/adminlib.php b/lib/adminlib.php index e5e3b10e467..00940fe4af3 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -7336,7 +7336,7 @@ class admin_setting_managecustomfields extends admin_setting { public function output_html($data, $query='') { global $CFG, $OUTPUT; $return = ''; - $return = $OUTPUT->heading(new lang_string('customfields'), 3, 'main'); + $return = $OUTPUT->heading(new lang_string('customfields', 'core_customfield'), 3, 'main'); $return .= $OUTPUT->box_start('generalbox customfieldsui'); $fields = core_plugin_manager::instance()->get_plugins_of_type('customfield'); diff --git a/lib/classes/output/icon_system_fontawesome.php b/lib/classes/output/icon_system_fontawesome.php index e90efe8d0bf..0ed5355ef48 100644 --- a/lib/classes/output/icon_system_fontawesome.php +++ b/lib/classes/output/icon_system_fontawesome.php @@ -211,6 +211,7 @@ class icon_system_fontawesome extends icon_system_font { 'core:i/categoryevent' => 'fa-cubes', 'core:i/course' => 'fa-graduation-cap', 'core:i/courseevent' => 'fa-university', + 'core:i/customfield' => 'fa-hand-o-right', 'core:i/db' => 'fa-database', 'core:i/delete' => 'fa-trash', 'core:i/down' => 'fa-arrow-down', diff --git a/pix/i/customfield.png b/pix/i/customfield.png new file mode 100644 index 00000000000..88e62ff6743 Binary files /dev/null and b/pix/i/customfield.png differ diff --git a/pix/i/customfield.svg b/pix/i/customfield.svg new file mode 100644 index 00000000000..2cb44745514 --- /dev/null +++ b/pix/i/customfield.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file