Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 15... Línea 15...
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...
16
 
16
 
17
/**
17
/**
18
 * Serve Issuer JSON for related badge or default Issuer if no badge is defined.
18
 * Serve Issuer JSON for related badge or default Issuer if no badge is defined.
19
 *
19
 *
20
 * @package    core
-
 
21
 * @subpackage badges
20
 * @package    core_badges
22
 * @copyright  2020 Sara Arjona <sara@moodle.com>
21
 * @copyright  2020 Sara Arjona <sara@moodle.com>
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
23
 */
25
define('AJAX_SCRIPT', true);
24
define('AJAX_SCRIPT', true);
Línea 26... Línea 25...
26
define('NO_MOODLE_COOKIES', true); // No need for a session here.
25
define('NO_MOODLE_COOKIES', true); // No need for a session here.
27
 
26
 
Línea 28... Línea -...
28
require_once(__DIR__ . '/../config.php');
-
 
29
require_once($CFG->libdir . '/badgeslib.php');
27
require_once(__DIR__ . '/../config.php');
30
 
-
 
31
 
-
 
Línea 32... Línea 28...
32
$id = optional_param('id', null, PARAM_INT);
28
require_once($CFG->libdir . '/badgeslib.php');
33
// OB specification version. If it's not defined, the site will be used as default.
29
 
34
$obversion = optional_param('obversion', badges_open_badges_backpack_api(), PARAM_INT);
30
$id = optional_param('id', null, PARAM_INT);
35
 
31
 
36
if (empty($id)) {
32
if (empty($id)) {
37
    // Get the default issuer for this site.
33
    // Get the default issuer for this site.
38
    $json = badges_get_default_issuer();
34
    $json = badges_get_default_issuer();
39
} else {
35
} else {
40
    // Get the issuer for this badge.
36
    // Get the issuer for this badge.
41
    $badge = new badge($id);
37
    $badge = new badge($id);
42
    if ($badge->status != BADGE_STATUS_INACTIVE) {
38
    if ($badge->status != BADGE_STATUS_INACTIVE) {
43
        $json = $badge->get_badge_issuer($obversion);
39
        $json = $badge->get_badge_issuer();
44
    } else {
40
    } else {