Skip to content

Commit

Permalink
MDL-57898 core_customfield: strings and other minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Jan 18, 2019
1 parent bbf60b1 commit d1fc4bd
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion backup/moodle2/backup_root_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected function define_settings() {

// 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);
}
}
2 changes: 1 addition & 1 deletion backup/moodle2/restore_root_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ protected function define_settings() {
$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);
}
}
7 changes: 3 additions & 4 deletions course/classes/customfield/course_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
defined('MOODLE_INTERNAL') || die;

use core_customfield\api;
use core_customfield\data_controller;
use core_customfield\field_controller;

/**
Expand All @@ -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;

/**
Expand Down
6 changes: 3 additions & 3 deletions course/classes/search/customfield.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public function get_document_recordset($modifiedfrom = 0, \context $context = nu

$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.*
Expand Down Expand Up @@ -179,6 +179,6 @@ public function get_component_name() {
* @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');
}
}
8 changes: 7 additions & 1 deletion customfield/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@
* @copyright 2018 David Matamoros <[email protected]>
* @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.
Expand Down
Empty file removed customfield/index.html
Empty file.
8 changes: 4 additions & 4 deletions customfield/templates/list.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@
<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}}
Expand Down
2 changes: 1 addition & 1 deletion lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@
$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';
Expand Down Expand Up @@ -1385,4 +1386,3 @@
$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';
2 changes: 1 addition & 1 deletion lang/en/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
$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';
Expand Down
2 changes: 1 addition & 1 deletion lib/adminlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7336,7 +7336,7 @@ public function is_related($query) {
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');
Expand Down
1 change: 1 addition & 0 deletions lib/classes/output/icon_system_fontawesome.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function get_core_icon_map() {
'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',
Expand Down
Binary file added pix/i/customfield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions pix/i/customfield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d1fc4bd

Please sign in to comment.