• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

apsolu / local_apsolu / 18874809151

27 Oct 2025 01:22PM UTC coverage: 9.384% (-0.05%) from 9.435%
18874809151

push

github

jboulen
feat(federation): utilise les fonctions de Moodle pour cocher ou décocher tous les éléments d'un tableau

559 of 5957 relevant lines covered (9.38%)

0.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/classes/core/customfields.php
1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16

17
// phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod
18

19
namespace local_apsolu\core;
20

21
/**
22
 * Fonctions pour le module apsolu.
23
 *
24
 * @package    local_apsolu
25
 * @copyright  2018 Université Rennes 2 <dsi-contact@univ-rennes2.fr>
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
class customfields {
29
    /**
30
     * Retourne la liste des champs personnalisés APSOLU indéxés par nom abrégé.
31
     *
32
     * @return array
33
     */
34
    public static function getCustomFields() {
35
        global $DB;
×
36

37
        $fields = [];
×
38

39
        $sql = "SELECT * FROM {user_info_field} WHERE shortname LIKE 'apsolu%'";
×
40
        foreach ($DB->get_records_sql($sql) as $field) {
×
41
            $fields[$field->shortname] = $field;
×
42
        }
43

44
        return $fields;
×
45
    }
46

47
    /**
48
     * Retourne la liste des champs additionnels à exporter.
49
     *
50
     * @return array
51
     */
52
    public static function get_extra_fields_for_export(): array {
53
        $fields = [];
×
54

55
        $exportfields = json_decode(get_config('local_apsolu', 'export_fields'));
×
56
        if (is_array($exportfields) === false) {
×
57
            $exportfields = [];
×
58
        }
59

60
        $customfields = false;
×
61
        foreach ($exportfields as $field) {
×
62
            if (str_starts_with($field, 'extra_') === false) {
×
63
                $fields[$field] = get_string($field);
×
64
                continue;
×
65
            }
66

67
            if ($customfields === false) {
×
68
                $customfields = [];
×
69
                foreach (profile_get_custom_fields() as $customfield) {
×
70
                    $customfields['extra_' . $customfield->shortname] = $customfield;
×
71
                }
72
            }
73

74
            if (isset($customfields[$field]) === false) {
×
75
                continue;
×
76
            }
77

78
            $customfield = $customfields[$field];
×
79
            $fields[$customfield->shortname] = $customfield->name;
×
80
        }
81

82
        return $fields;
×
83
    }
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc