Beispiel #1
0
/**
 * Display the LTI settings in the course settings block
 * For 2.3 and onwards
 *
 * @param  settings_navigation $nav     The settings navigatin object
 * @param  stdclass            $context Course context
 */
function local_ltiprovider_extend_settings_navigation(settings_navigation $nav, $context)
{
    if ($context->contextlevel >= CONTEXT_COURSE and $branch = $nav->get('courseadmin') and has_capability('local/ltiprovider:view', $context)) {
        $ltiurl = new moodle_url('/local/ltiprovider/index.php', array('courseid' => $context->instanceid));
        $branch->add(get_string('pluginname', 'local_ltiprovider'), $ltiurl, $nav::TYPE_CONTAINER, null, 'ltiprovider' . $context->instanceid);
    }
}
/**
 * Hook to insert a link in settings navigation menu block
 *
 * @param settings_navigation $navigation
 * @param course_context      $context
 * @return void
 */
function local_mass_enroll_extends_settings_navigation(settings_navigation $navigation, $context)
{
    global $CFG;
    // If not in a course context, then leave.
    if ($context == null || $context->contextlevel != CONTEXT_COURSE) {
        return;
    }
    // Front page has a 'frontpagesettings' node, other courses will have 'courseadmin' node.
    if (null == ($courseadminnode = $navigation->get('courseadmin'))) {
        // Keeps us off the front page.
        return;
    }
    if (null == ($useradminnode = $courseadminnode->get('users'))) {
        return;
    }
    $config = get_config('local_mass_enroll');
    if ((bool) $config->enablemassenrol) {
        if (has_capability('local/mass_enroll:enrol', $context)) {
            $url = new moodle_url($CFG->wwwroot . '/local/mass_enroll/mass_enroll.php', array('id' => $context->instanceid));
            $useradminnode->add(get_string('mass_enroll', 'local_mass_enroll'), $url, navigation_node::TYPE_SETTING, null, 'massenrols', new pix_icon('i/admin', ''));
        }
    }
    if ((bool) $config->enablemassunenrol) {
        if (has_capability('local/mass_enroll:unenrol', $context)) {
            $url = new moodle_url($CFG->wwwroot . '/local/mass_enroll/mass_unenroll.php', array('id' => $context->instanceid));
            $useradminnode->add(get_string('mass_unenroll', 'local_mass_enroll'), $url, navigation_node::TYPE_SETTING, null, 'massunenrols', new pix_icon('i/admin', ''));
        }
    }
}
/**
 * Hook to insert a link in settings navigation menu block
 *
 * @param settings_navigation $navigation
 * @param course_context      $context
 * @return void
 */
function local_mass_enroll_extends_settings_navigation(settings_navigation $navigation, $context)
{
    global $CFG;
    // If not in a course context, then leave
    if ($context == null || $context->contextlevel != CONTEXT_COURSE) {
        return;
    }
    // When on front page there is 'frontpagesettings' node, other
    // courses will have 'courseadmin' node
    if (null == ($courseadmin_node = $navigation->get('courseadmin'))) {
        // Keeps us off the front page
        return;
    }
    if (null == ($useradmin_node = $courseadmin_node->get('users'))) {
        return;
    }
    // Add our links no need to patch core anymore !!!!
    if (empty($CFG->allow_mass_enroll_feature)) {
        return;
    }
    if (has_capability('local/mass_enroll:enrol', $context)) {
        $url = new moodle_url('/local/mass_enroll/mass_enroll.php', array('id' => $context->instanceid));
        $useradmin_node->add(get_string('mass_enroll', 'local_mass_enroll'), $url, navigation_node::TYPE_SETTING, null, 'massenrols', new pix_icon('i/admin', ''));
    }
    if (has_capability('local/mass_enroll:unenrol', $context)) {
        $url = new moodle_url('/local/mass_enroll/mass_unenroll.php', array('id' => $context->instanceid));
        $useradmin_node->add(get_string('mass_unenroll', 'local_mass_enroll'), $url, navigation_node::TYPE_SETTING, null, 'massunenrols', new pix_icon('i/admin', ''));
    }
}
Beispiel #4
0
/**
 * Display the Moodec settings in the course settings block
 * For 2.3 and onwards
 *
 * @param  settings_navigation $nav     The settings navigation object
 * @param  stdclass            $context Course context
 */
function local_moodec_extends_settings_navigation(settings_navigation $nav, $context)
{
    global $CFG;
    if ($context->contextlevel >= CONTEXT_COURSE and $branch = $nav->get('courseadmin') and has_capability('moodle/course:update', $context)) {
        $url = new moodle_url($CFG->wwwroot . '/local/moodec/settings/product.php', array('id' => $context->instanceid));
        $branch->add(get_string('moodec_product_settings', 'local_moodec'), $url, $nav::TYPE_CONTAINER, null, 'moodec' . $context->instanceid, new pix_icon('i/settings', ''));
    }
}
function local_forum2pdf_extends_settings_navigation(settings_navigation $nav, context $context)
{
    global $PAGE;
    // 教師にのみPDF出力を許可
    if (!has_capability('moodle/course:manageactivities', $context)) {
        return;
    }
    //echo "<pre>"; var_dump($PAGE->cm->instance); echo "</pre>";
    if ($PAGE->context->contextlevel == CONTEXT_MODULE && $PAGE->cm->modname === 'forum') {
        $pdflink = navigation_node::create(get_string('pdflink', 'local_forum2pdf'));
        $pdflink->key = 'forum2pdf';
        $pdflink->action = new moodle_url('/local/forum2pdf/export.php', array('f' => $PAGE->cm->instance));
        $modulesettings = $nav->get('modulesettings');
        $modulesettings->add_node($pdflink);
    }
}
function local_syncgroups_extends_settings_navigation(settings_navigation $nav, context $context = null)
{
    global $PAGE;
    // Only add this settings item on non-site course pages.
    if (!$PAGE->course or $PAGE->course->id == 1) {
        return;
    }
    if ($coursenode = $nav->get('courseadmin')) {
        if ($usersnode = $coursenode->get('users')) {
            $str = get_string('pluginname', 'local_syncgroups');
            $url = new moodle_url('/local/syncgroups/index.php', array('courseid' => $context->instanceid));
            $node = navigation_node::create($str, $url, navigation_node::NODETYPE_LEAF, 'local_syncgroups', 'local_syncgroups');
            if ($PAGE->url->compare($url, URL_MATCH_BASE)) {
                $node->make_active();
            }
            $usersnode->add_node($node, 'override');
        }
    }
}
/**
 * Hook to insert a link in settings navigation menu block
 *
 * @param settings_navigation $navigation
 * @param course_context      $context
 * @return void
 */
function local_userenrols_extend_settings_navigation(settings_navigation $navigation, $context)
{
    // If not in a course context, then leave
    if ($context == null || $context->contextlevel != CONTEXT_COURSE) {
        return;
    }
    // When on front page there is 'frontpagesettings' node, other
    // courses will have 'courseadmin' node
    if (null == ($courseadmin_node = $navigation->get('courseadmin'))) {
        // Keeps us off the front page
        return;
    }
    if (null == ($useradmin_node = $courseadmin_node->get('users'))) {
        return;
    }
    // Add our links
    $useradmin_node->add(get_string('IMPORT_MENU_LONG', local_userenrols_plugin::PLUGIN_NAME), local_userenrols_plugin::get_plugin_url('import', $context->instanceid), navigation_node::TYPE_SETTING, get_string('IMPORT_MENU_SHORT', local_userenrols_plugin::PLUGIN_NAME), null, new pix_icon('i/import', 'import'));
    $useradmin_node->add(get_string('UNENROLL_MENU_LONG', local_userenrols_plugin::PLUGIN_NAME), local_userenrols_plugin::get_plugin_url('unenroll', $context->instanceid), navigation_node::TYPE_SETTING, get_string('UNENROLL_MENU_SHORT', local_userenrols_plugin::PLUGIN_NAME), null, new pix_icon('i/export', 'export'));
    $useradmin_node->add(get_string('ASSIGN_MENU_LONG', local_userenrols_plugin::PLUGIN_NAME), local_userenrols_plugin::get_plugin_url('assign', $context->instanceid), navigation_node::TYPE_SETTING, get_string('ASSIGN_MENU_SHORT', local_userenrols_plugin::PLUGIN_NAME), null, new pix_icon('t/move', 'assign'));
}