Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 12... Línea 12...
12
// GNU General Public License for more details.
12
// GNU General Public License for more details.
13
//
13
//
14
// You should have received a copy of the GNU General Public License
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/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea -...
16
 
-
 
17
/**
-
 
18
 * Form class for mybackpack.php
-
 
19
 *
-
 
20
 * @package    core
-
 
21
 * @subpackage badges
-
 
22
 * @copyright  2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
-
 
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
24
 * @author     Yuliya Bozhko <yuliya.bozhko@totaralms.com>
-
 
25
 */
-
 
26
 
16
 
Línea 27... Línea 17...
27
namespace core_badges\form;
17
namespace core_badges\form;
Línea 28... Línea 18...
28
 
18
 
Línea 35... Línea 25...
35
use moodleform;
25
use moodleform;
Línea 36... Línea 26...
36
 
26
 
37
/**
27
/**
38
 * Form to select backpack collections.
28
 * Form to select backpack collections.
-
 
29
 *
39
 *
30
 * @package    core_badges
40
 * @copyright  2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
31
 * @copyright  2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
-
 
32
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
41
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 * @author     Yuliya Bozhko <yuliya.bozhko@totaralms.com>
42
 */
34
 */
Línea 43... Línea 35...
43
class collections extends moodleform {
35
class collections extends moodleform {
44
 
36
 
Línea 77... Línea 69...
77
        $hasgroups = false;
69
        $hasgroups = false;
78
        if (!empty($groups)) {
70
        if (!empty($groups)) {
79
            foreach ($groups as $group) {
71
            foreach ($groups as $group) {
80
                $count = 0;
72
                $count = 0;
81
                // Handle attributes based on backpack's supported version.
73
                // Handle attributes based on backpack's supported version.
82
                if ($sitebackpack->apiversion == OPEN_BADGES_V2) {
-
 
83
                    // OpenBadges v2 data attributes.
-
 
84
                    if (empty($group->published)) {
74
                if (empty($group->published)) {
85
                        // Only public collections.
75
                    // Only public collections.
86
                        continue;
76
                    continue;
87
                    }
-
 
88
 
-
 
89
                    // Get the number of badges associated with this collection from the assertions array returned.
-
 
90
                    $count = count($group->assertions);
-
 
91
                } else {
-
 
92
                    // OpenBadges v1 data attributes.
-
 
93
                    $group->entityId = $group->groupId;
-
 
94
 
-
 
95
                    // Get the number of badges associated with this collection. In that case, the number is returned directly.
-
 
96
                    $count = $group->badges;
-
 
97
                }
77
                }
-
 
78
                // Get the number of badges associated with this collection from the assertions array returned.
-
 
79
                $count = count($group->assertions);
Línea 98... Línea 80...
98
 
80
 
99
                if (!$hasgroups) {
81
                if (!$hasgroups) {
100
                    $mform->addElement('static', 'selectgroup', '', get_string('selectgroup_start', 'badges'));
82
                    $mform->addElement('static', 'selectgroup', '', get_string('selectgroup_start', 'badges'));
101
                }
83
                }