当前位置: 首页>>代码示例>>PHP>>正文


PHP grade_helper::get_plugins_export方法代码示例

本文整理汇总了PHP中grade_helper::get_plugins_export方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_helper::get_plugins_export方法的具体用法?PHP grade_helper::get_plugins_export怎么用?PHP grade_helper::get_plugins_export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grade_helper的用法示例。


在下文中一共展示了grade_helper::get_plugins_export方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: grade_extend_settings

/**
 * This method adds settings to the settings block for the grade system and its
 * plugins
 *
 * @global moodle_page $PAGE
 */
function grade_extend_settings($plugininfo, $courseid)
{
    global $PAGE;
    $nav = new Navigation();
    $roleid = $nav->get_user_role();
    $gradenode = $PAGE->settingsnav->prepend(get_string('gradeadministration', 'grades'), null, navigation_node::TYPE_CONTAINER);
    $strings = array_shift($plugininfo);
    if ($reports = grade_helper::get_plugins_reports($courseid)) {
        foreach ($reports as $report) {
            if ($roleid == 4) {
                //echo "Report link: ". $report->link."<br>";
                if ($report->id != 'history' && $report->id != 'outcomes' && $report->id != 'user') {
                    $gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', ''));
                }
                // end if
            } else {
                $gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', ''));
            }
            // end else
        }
        // end foreach
    }
    if ($settings = grade_helper::get_info_manage_settings($courseid)) {
        $settingsnode = $gradenode->add($strings['settings'], null, navigation_node::TYPE_CONTAINER);
        foreach ($settings as $setting) {
            $settingsnode->add($setting->string, $setting->link, navigation_node::TYPE_SETTING, null, $setting->id, new pix_icon('i/settings', ''));
        }
    }
    if ($imports = grade_helper::get_plugins_import($courseid)) {
        $importnode = $gradenode->add($strings['import'], null, navigation_node::TYPE_CONTAINER);
        foreach ($imports as $import) {
            $importnode->add($import->string, $import->link, navigation_node::TYPE_SETTING, null, $import->id, new pix_icon('i/import', ''));
        }
    }
    if ($exports = grade_helper::get_plugins_export($courseid)) {
        $exportnode = $gradenode->add($strings['export'], null, navigation_node::TYPE_CONTAINER);
        foreach ($exports as $export) {
            if ($roleid == 4) {
                if ($export->id != 'ods' && $export->id != 'xml') {
                    $exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', ''));
                }
                // end if
            } else {
                $exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', ''));
            }
            // end else
        }
        // end foreach
    }
    if ($letters = grade_helper::get_info_letters($courseid)) {
        $letters = array_shift($letters);
        $gradenode->add($strings['letter'], $letters->link, navigation_node::TYPE_SETTING, null, $letters->id, new pix_icon('i/settings', ''));
    }
    if ($outcomes = grade_helper::get_info_outcomes($courseid)) {
        $outcomes = array_shift($outcomes);
        $gradenode->add($strings['outcome'], $outcomes->link, navigation_node::TYPE_SETTING, null, $outcomes->id, new pix_icon('i/outcomes', ''));
    }
    if ($scales = grade_helper::get_info_scales($courseid)) {
        $gradenode->add($strings['scale'], $scales->link, navigation_node::TYPE_SETTING, null, $scales->id, new pix_icon('i/scales', ''));
    }
    if ($gradenode->contains_active_node()) {
        // If the gradenode is active include the settings base node (gradeadministration) in
        // the navbar, typcially this is ignored.
        $PAGE->navbar->includesettingsbase = true;
        // If we can get the course admin node make sure it is closed by default
        // as in this case the gradenode will be opened
        if ($coursenode = $PAGE->settingsnav->get('courseadmin', navigation_node::TYPE_COURSE)) {
            $coursenode->make_inactive();
            $coursenode->forceopen = false;
        }
        // end if
    }
    $setionsnode = $PAGE->settingsnav->prepend('Navigation', null, navigation_node::TYPE_CONTAINER);
    $pageid = $nav->get_page_id();
    if ($pageid > 0) {
        $link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/page/view.php?id={$pageid}";
        $setionsnode->add('Assignment', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', ''));
    }
    $forumid = $nav->get_forum_id();
    if ($forumid > 0) {
        $link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/forum/view.php?id={$forumid}";
        $setionsnode->add('Discussion board', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', ''));
    }
    $quizid = $nav->get_quiz_id();
    if ($quizid > 0) {
        $link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/quiz/view.php?id={$quizid}";
        $setionsnode->add('Quiz', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', ''));
    }
}
开发者ID:sirromas,项目名称:lms,代码行数:95,代码来源:lib.php

示例2: grade_extend_settings

/**
 * This method adds settings to the settings block for the grade system and its
 * plugins
 *
 * @global moodle_page $PAGE
 */
function grade_extend_settings($plugininfo, $courseid)
{
    global $PAGE;
    $gradenode = $PAGE->settingsnav->prepend(get_string('gradeadministration', 'grades'), null, navigation_node::TYPE_CONTAINER);
    $strings = array_shift($plugininfo);
    if ($reports = grade_helper::get_plugins_reports($courseid)) {
        foreach ($reports as $report) {
            $gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', ''));
        }
    }
    if ($imports = grade_helper::get_plugins_import($courseid)) {
        $importnode = $gradenode->add($strings['import'], null, navigation_node::TYPE_CONTAINER);
        foreach ($imports as $import) {
            $importnode->add($import->string, $import->link, navigation_node::TYPE_SETTING, null, $import->id, new pix_icon('i/import', ''));
        }
    }
    if ($exports = grade_helper::get_plugins_export($courseid)) {
        $exportnode = $gradenode->add($strings['export'], null, navigation_node::TYPE_CONTAINER);
        foreach ($exports as $export) {
            $exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', ''));
        }
    }
    if ($setting = grade_helper::get_info_manage_settings($courseid)) {
        $gradenode->add(get_string('coursegradesettings', 'grades'), $setting->link, navigation_node::TYPE_SETTING, null, $setting->id, new pix_icon('i/settings', ''));
    }
    if ($preferences = grade_helper::get_plugins_report_preferences($courseid)) {
        $preferencesnode = $gradenode->add(get_string('myreportpreferences', 'grades'), null, navigation_node::TYPE_CONTAINER);
        foreach ($preferences as $preference) {
            $preferencesnode->add($preference->string, $preference->link, navigation_node::TYPE_SETTING, null, $preference->id, new pix_icon('i/settings', ''));
        }
    }
    if ($letters = grade_helper::get_info_letters($courseid)) {
        $letters = array_shift($letters);
        $gradenode->add($strings['letter'], $letters->link, navigation_node::TYPE_SETTING, null, $letters->id, new pix_icon('i/settings', ''));
    }
    if ($outcomes = grade_helper::get_info_outcomes($courseid)) {
        $outcomes = array_shift($outcomes);
        $gradenode->add($strings['outcome'], $outcomes->link, navigation_node::TYPE_SETTING, null, $outcomes->id, new pix_icon('i/outcomes', ''));
    }
    if ($scales = grade_helper::get_info_scales($courseid)) {
        $gradenode->add($strings['scale'], $scales->link, navigation_node::TYPE_SETTING, null, $scales->id, new pix_icon('i/scales', ''));
    }
    if ($categories = grade_helper::get_info_edit_structure($courseid)) {
        $categoriesnode = $gradenode->add(get_string('categoriesanditems', 'grades'), null, navigation_node::TYPE_CONTAINER);
        foreach ($categories as $category) {
            $categoriesnode->add($category->string, $category->link, navigation_node::TYPE_SETTING, null, $category->id, new pix_icon('i/report', ''));
        }
    }
    if ($gradenode->contains_active_node()) {
        // If the gradenode is active include the settings base node (gradeadministration) in
        // the navbar, typcially this is ignored.
        $PAGE->navbar->includesettingsbase = true;
        // If we can get the course admin node make sure it is closed by default
        // as in this case the gradenode will be opened
        if ($coursenode = $PAGE->settingsnav->get('courseadmin', navigation_node::TYPE_COURSE)) {
            $coursenode->make_inactive();
            $coursenode->forceopen = false;
        }
    }
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:66,代码来源:lib.php

示例3: print_error

    }
    if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
        print_error('invalidcourseid');
    }
} else {
    if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
        print_error('invalidcourseid');
    }
    $key = new stdClass();
}
$key->courseid = $course->id;
require_login($course);
$context = context_course::instance($course->id);
require_capability('moodle/grade:export', $context);
// Check if the user has at least one grade publishing capability.
$plugins = grade_helper::get_plugins_export($course->id);
if (!isset($plugins['keymanager'])) {
    print_error('nopermissions');
}
// extra security check
if (!empty($key->userid) and $USER->id != $key->userid) {
    print_error('notownerofkey');
}
$returnurl = $CFG->wwwroot . '/grade/export/keymanager.php?id=' . $course->id;
if ($id and $delete) {
    if (!$confirm) {
        $PAGE->set_title(get_string('deleteselectedkey'));
        $PAGE->set_heading($course->fullname);
        echo $OUTPUT->header();
        $optionsyes = array('id' => $id, 'delete' => 1, 'courseid' => $courseid, 'sesskey' => sesskey(), 'confirm' => 1);
        $optionsno = array('id' => $courseid);
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:key.php


注:本文中的grade_helper::get_plugins_export方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。