Ejemplo n.º 1
0
    $params['perpage'] = $perpage;
}
if ($page > 0) {
    $params['page'] = $page;
}
admin_externalpage_setup('managetags', '', $params, '', array('pagelayout' => 'report'));
if (empty($CFG->usetags)) {
    print_error('tagsaredisabled', 'tag');
}
$tagobject = null;
if ($tagid) {
    $tagobject = core_tag_tag::get($tagid, '*', MUST_EXIST);
    $tagcollid = $tagobject->tagcollid;
}
$tagcoll = core_tag_collection::get_by_id($tagcollid);
$tagarea = core_tag_area::get_by_id($tagareaid);
$manageurl = new moodle_url('/tag/manage.php');
if ($tagcoll) {
    // We are inside a tag collection - add it to the page url and the breadcrumb.
    $PAGE->set_url(new moodle_url($PAGE->url, array('tc' => $tagcoll->id)));
    $PAGE->navbar->add(core_tag_collection::display_name($tagcoll), new moodle_url($manageurl, array('tc' => $tagcoll->id)));
}
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
switch ($action) {
    case 'colladd':
    case 'colledit':
        if ($action === 'colladd' || $action === 'colledit' && $tagcoll && empty($tagcoll->component)) {
            $form = new core_tag_collection_form($manageurl, $tagcoll);
            if ($form->is_cancelled()) {
                redirect($manageurl);
            } else {