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
 * Related badges information
18
 * Related badges information
19
 *
19
 *
20
 * @package    core
20
 * @package    core_badges
21
 * @subpackage badges
21
 * @subpackage badges
22
 * @copyright  2018 Tung Thai
22
 * @copyright  2018 Tung Thai
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 * @author     Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
24
 * @author     Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
Línea -... Línea 25...
-
 
25
 */
-
 
26
 
25
 */
27
use core_badges\form\related;
26
 
28
 
27
require_once(__DIR__ . '/../config.php');
-
 
Línea 28... Línea 29...
28
require_once($CFG->libdir . '/badgeslib.php');
29
require_once(__DIR__ . '/../config.php');
29
require_once($CFG->dirroot . '/badges/related_form.php');
30
require_once($CFG->libdir . '/badgeslib.php');
30
 
31
 
Línea 38... Línea 39...
38
    throw new \moodle_exception('badgesdisabled', 'badges');
39
    throw new \moodle_exception('badgesdisabled', 'badges');
39
}
40
}
Línea 40... Línea 41...
40
 
41
 
41
$badge = new badge($badgeid);
42
$badge = new badge($badgeid);
-
 
43
$context = $badge->get_context();
42
$context = $badge->get_context();
44
$title = [get_string('relatedbages', 'badges'), $badge->name];
43
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
45
$navurl = new moodle_url('/badges/index.php', ['type' => $badge->type]);
Línea 44... Línea 46...
44
require_capability('moodle/badges:configuredetails', $context);
46
require_capability('moodle/badges:configuredetails', $context);
45
 
47
 
46
if ($badge->type == BADGE_TYPE_COURSE) {
48
if ($badge->type == BADGE_TYPE_COURSE) {
47
    if (empty($CFG->badges_allowcoursebadges)) {
49
    if (empty($CFG->badges_allowcoursebadges)) {
48
        throw new \moodle_exception('coursebadgesdisabled', 'badges');
50
        throw new \moodle_exception('coursebadgesdisabled', 'badges');
49
    }
51
    }
50
    require_login($badge->courseid);
52
    require_login($badge->courseid);
-
 
53
    $course = get_course($badge->courseid);
Línea 51... Línea 54...
51
    $course = get_course($badge->courseid);
54
    $heading = format_string($course->fullname, true, ['context' => $context]);
52
    $heading = format_string($course->fullname, true, ['context' => $context]);
55
    $title[] = $heading;
53
 
56
 
54
    $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
57
    $navurl = new moodle_url('/badges/index.php', ['type' => $badge->type, 'id' => $badge->courseid]);
55
    $PAGE->set_pagelayout('standard');
58
    $PAGE->set_pagelayout('standard');
56
    navigation_node::override_active_url($navurl);
59
    navigation_node::override_active_url($navurl);
57
} else {
60
} else {
58
    $PAGE->set_pagelayout('admin');
61
    $PAGE->set_pagelayout('admin');
Línea 59... Línea 62...
59
    $heading = get_string('administrationsite');
62
    $heading = get_string('administrationsite');
60
    navigation_node::override_active_url($navurl, true);
63
    navigation_node::override_active_url($navurl, true);
61
}
64
}
62
 
65
 
63
$currenturl = new moodle_url('/badges/related.php', array('id' => $badge->id));
66
$currenturl = new moodle_url('/badges/related.php', ['id' => $badge->id]);
64
$PAGE->set_context($context);
67
$PAGE->set_context($context);
65
$PAGE->set_url($currenturl);
68
$PAGE->set_url($currenturl);
66
$PAGE->set_heading($heading);
69
$PAGE->set_heading($heading);
67
$PAGE->set_title($badge->name);
70
$PAGE->set_title(implode(\moodle_page::TITLE_SEPARATOR, $title));
68
$PAGE->navbar->add($badge->name);
71
$PAGE->navbar->add($badge->name);
Línea 69... Línea 72...
69
$output = $PAGE->get_renderer('core', 'badges');
72
$output = $PAGE->get_renderer('core', 'badges');
70
$msg = optional_param('msg', '', PARAM_TEXT);
73
$msg = optional_param('msg', '', PARAM_TEXT);
71
$emsg = optional_param('emsg', '', PARAM_TEXT);
74
$emsg = optional_param('emsg', '', PARAM_TEXT);
72
$url = new moodle_url('/badges/related.php', array('id' => $badge->id, 'action' => 'add'));
75
$url = new moodle_url('/badges/related.php', ['id' => $badge->id, 'action' => 'add']);
Línea 73... Línea 76...
73
 
76