MDL-57898 core_customfield: strings and other minor fixes
authorMarina Glancy <marina@moodle.com>
Wed, 16 Jan 2019 12:38:52 +0000 (13:38 +0100)
committerMarina Glancy <marina@moodle.com>
Fri, 18 Jan 2019 13:28:24 +0000 (14:28 +0100)
13 files changed:
backup/moodle2/backup_root_task.class.php
backup/moodle2/restore_root_task.class.php
course/classes/customfield/course_handler.php
course/classes/search/customfield.php
customfield/classes/privacy/provider.php
customfield/index.html [deleted file]
customfield/templates/list.mustache
lang/en/admin.php
lang/en/backup.php
lib/adminlib.php
lib/classes/output/icon_system_fontawesome.php
pix/i/customfield.png [new file with mode: 0644]
pix/i/customfield.svg [new file with mode: 0644]

index 1bc7ce4..03e989d 100644 (file)
@@ -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);
     }
 }
index 6bb4927..3069a0b 100644 (file)
@@ -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);
     }
 }
index 329e763..d7badc8 100644 (file)
@@ -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;
 
     /**
index 2b6538b..8f5db60 100644 (file)
@@ -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');
     }
 }
index f4077e1..cf7d2fe 100644 (file)
@@ -47,7 +47,13 @@ use Horde\Socket\Client\Exception;
  * @copyright 2018 David Matamoros <davidmc@moodle.com>
  * @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 (file)
index e69de29..0000000
index 3265dc7..f91aa2d 100644 (file)
                 <thead>
                 <tr>
                     <th scope="col" class="col-5">{{#str}} customfield, core_customfield {{/str}}</th>
-                    <th scope="col" class="col-2">{{#str}} shortname, core_customfield {{/str}}</th>
+                    <th scope="col" class="col-3">{{#str}} shortname, core_customfield {{/str}}</th>
                     <th scope="col" class="col-2">{{#str}} type, core_customfield {{/str}}</th>
-                    <th scope="col" class="text-right">{{#str}} action, core_customfield {{/str}}</th>
+                    <th scope="col" class="col-2 text-right">{{#str}} action, core_customfield {{/str}}</th>
                 </tr>
                 </thead>
                 <tbody>
                 {{#fields}}
                     <tr data-field-name="{{name}}" data-field-id="{{id}}"  class="field">
                         <td class="col-5"><span class="movefield">{{> core/drag_handle}}</span>{{{name}}}</td>
-                        <td class="col-2">{{{shortname}}}</td>
+                        <td class="col-3">{{{shortname}}}</td>
                         <td class="col-2">{{{type}}}</td>
-                        <td class="col-5 text-right ">
+                        <td class="col-2 text-right">
                             <a href="{{editfieldurl}}" data-role="editfield">{{#pix}}
                                 t/edit, core, {{#str}} edit, moodle {{/str}} {{/pix}}</a>
                             <a href="#" data-id="{{id}}" data-role="deletefield">{{#pix}}
index c2e304a..0595004 100644 (file)
@@ -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';
index d0070a8..7aa3ae8 100644 (file)
@@ -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';
index e5e3b10..00940fe 100644 (file)
@@ -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');
index e90efe8..0ed5355 100644 (file)
@@ -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 (file)
index 0000000..88e62ff
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 (file)
index 0000000..2cb4474
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M256 1344q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm1408-576q0-51-39-89.5t-89-38.5h-576q0-20 15-48.5t33-55 33-68 15-84.5q0-67-44.5-97.5t-115.5-30.5q-24 0-90 139-24 44-37 65-40 64-112 145-71 81-101 106-69 57-140 57h-32v640h32q72 0 167 32t193.5 64 179.5 32q189 0 189-167 0-26-5-56 30-16 47.5-52.5t17.5-73.5-18-69q53-50 53-119 0-25-10-55.5t-25-47.5h331q52 0 90-38t38-90zm128-1q0 105-75.5 181t-180.5 76h-169q-4 62-37 119 3 21 3 43 0 101-60 178 1 139-85 219.5t-227 80.5q-133 0-322-69-164-59-223-59h-288q-53 0-90.5-37.5t-37.5-90.5v-640q0-53 37.5-90.5t90.5-37.5h288q10 0 21.5-4.5t23.5-14 22.5-18 24-22.5 20.5-21.5 19-21.5 14-17q65-74 100-129 13-21 33-62t37-72 40.5-63 55-49.5 69.5-17.5q125 0 206.5 67t81.5 189q0 68-22 128h374q104 0 180 76t76 179z" fill="#999"/></svg>
\ No newline at end of file