コード例 #1
0
/**
 * Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
 * (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
 * in favour of the usual print_header(), print_header_simple(), print_heading() etc.
 * !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
 * the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
 *
 * @param int $courseid
 * @param string $active_type The type of the current page (report, settings, import, export, scales, outcomes, letters)
 * @param string $active_plugin The plugin of the current page (grader, fullview etc...)
 * @param string $heading The heading of the page. Tries to guess if none is given
 * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
 * @param string $bodytags Additional attributes that will be added to the <body> tag
 * @param string $buttons Additional buttons to display on the page
 *
 * @return string HTML code or nothing if $return == false
 */
function print_grade_page_head_local($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $bodytags = '', $buttons = false, $extracss = array())
{
    global $CFG, $COURSE;
    $strgrades = get_string('grades');
    $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
    // Determine the string of the active plugin
    $stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
    $stractive_type = $plugin_info['strings'][$active_type];
    $navlinks = array();
    $first_link = '';
    if ($active_type == 'settings' && $active_plugin != 'coursesettings') {
        $first_link = $plugin_info['report'][$active_plugin]['link'];
    } elseif ($active_type != 'report') {
        $first_link = $CFG->wwwroot . '/grade/index.php?id=' . $COURSE->id;
    }
    if ($active_type == 'preferences') {
        $CFG->stylesheets[] = $CFG->wwwroot . '/grade/report/styles.css';
    }
    foreach ($extracss as $css_url) {
        $CFG->stylesheets[] = $css_url;
    }
    $navlinks[] = array('name' => $strgrades, 'link' => $first_link, 'type' => 'misc');
    $active_type_link = '';
    if (!empty($plugin_info[$active_type]['link']) && $plugin_info[$active_type]['link'] != qualified_me()) {
        $active_type_link = $plugin_info[$active_type]['link'];
    }
    if (!empty($plugin_info[$active_type]['parent']['link'])) {
        $active_type_link = $plugin_info[$active_type]['parent']['link'];
        $navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
    }
    if (empty($plugin_info[$active_type]['id'])) {
        $navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
    }
    $navlinks[] = array('name' => $stractive_plugin, 'link' => null, 'type' => 'misc');
    $navigation = build_navigation($navlinks);
    $title = ': ' . $stractive_plugin;
    if (empty($plugin_info[$active_type]['id']) || !empty($plugin_info[$active_type]['parent'])) {
        $title = ': ' . $stractive_type . ': ' . $stractive_plugin;
    }
    $returnval = print_header_simple($strgrades . ': ' . $stractive_type, $title, $navigation, '', $bodytags, true, $buttons, navmenu($COURSE), false, '', $return);
    // Guess heading if not given explicitly
    if (!$heading) {
        $heading = $stractive_plugin;
    }
    if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
        $returnval .= print_grade_plugin_selector($plugin_info, $return);
    }
    $returnval .= print_heading($heading);
    if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
        $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
    }
    if ($return) {
        return $returnval;
    }
}
コード例 #2
0
ファイル: lib.php プロジェクト: EmmanuelYupit/educursos
/**
 * Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
 * (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
 * in favour of the usual print_header(), print_header_simple(), print_heading() etc.
 * !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
 * the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
 *
 * @param int     $courseid Course id
 * @param string  $active_type The type of the current page (report, settings,
 *                             import, export, scales, outcomes, letters)
 * @param string  $active_plugin The plugin of the current page (grader, fullview etc...)
 * @param string  $heading The heading of the page. Tries to guess if none is given
 * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
 * @param string  $bodytags Additional attributes that will be added to the <body> tag
 * @param string  $buttons Additional buttons to display on the page
 * @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
 *
 * @return string HTML code or nothing if $return == false
 */
function print_grade_page_head($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $buttons = false, $shownavigation = true)
{
    global $CFG, $OUTPUT, $PAGE;
    $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
    // Determine the string of the active plugin
    $stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
    $stractive_type = $plugin_info['strings'][$active_type];
    if (empty($plugin_info[$active_type]->id) || !empty($plugin_info[$active_type]->parent)) {
        $title = $PAGE->course->fullname . ': ' . $stractive_type . ': ' . $stractive_plugin;
    } else {
        $title = $PAGE->course->fullname . ': ' . $stractive_plugin;
    }
    if ($active_type == 'report') {
        $PAGE->set_pagelayout('report');
    } else {
        $PAGE->set_pagelayout('admin');
    }
    $PAGE->set_title(get_string('grades') . ': ' . $stractive_type);
    $PAGE->set_heading($title);
    if ($buttons instanceof single_button) {
        $buttons = $OUTPUT->render($buttons);
    }
    $PAGE->set_button($buttons);
    grade_extend_settings($plugin_info, $courseid);
    $returnval = $OUTPUT->header();
    if (!$return) {
        echo $returnval;
    }
    // Guess heading if not given explicitly
    if (!$heading) {
        $heading = $stractive_plugin;
    }
    if ($shownavigation) {
        if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
            $returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return);
        }
        if ($return) {
            $returnval .= $OUTPUT->heading($heading);
        } else {
            echo $OUTPUT->heading($heading);
        }
        if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
            $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
        }
    }
    if ($return) {
        return $returnval;
    }
}
コード例 #3
0
ファイル: index.php プロジェクト: r007/PMoodle
    $warnings = $report->process_data($data);
} else {
    $warnings = array();
}
// Override perpage if set in URL
if ($perpageurl) {
    $report->user_prefs['studentsperpage'] = $perpageurl;
}
// final grades MUST be loaded after the processing
$report->load_users();
$numusers = $report->get_numusers();
$report->load_final_grades();
/// Print header
print_header_simple($strgrades . ': ' . $reportname, ': ' . $strgrades, $navigation, '', '', true, $buttons, navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($courseid, 'report', 'grader');
// Add tabs
$currenttab = 'graderreport';
require 'tabs.php';
echo $report->group_selector;
echo '<div class="clearer"></div>';
echo $report->get_toggles_html();
//show warnings if any
foreach ($warnings as $warning) {
    notify($warning);
}
$studentsperpage = $report->get_pref('studentsperpage');
// Don't use paging if studentsperpage is empty or 0 at course AND site levels
if (!empty($studentsperpage)) {
    print_paging_bar($numusers, $report->page, $studentsperpage, $report->pbarurl);
}
コード例 #4
0
/**
 * Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
 * (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
 * in favour of the usual print_header(), print_header_simple(), print_heading() etc.
 * !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
 * the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
 *
 * @param int     $courseid Course id
 * @param string  $active_type The type of the current page (report, settings,
 *                             import, export, scales, outcomes, letters)
 * @param string  $active_plugin The plugin of the current page (grader, fullview etc...)
 * @param string  $heading The heading of the page. Tries to guess if none is given
 * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
 * @param string  $bodytags Additional attributes that will be added to the <body> tag
 * @param string  $buttons Additional buttons to display on the page
 * @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
 * @param string  $headerhelpidentifier The help string identifier if required.
 * @param string  $headerhelpcomponent The component for the help string.
 *
 * @return string HTML code or nothing if $return == false
 */
function print_grade_page_head($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $buttons = false, $shownavigation = true, $headerhelpidentifier = null, $headerhelpcomponent = null)
{
    global $CFG, $OUTPUT, $PAGE;
    if ($active_type === 'preferences') {
        // In Moodle 2.8 report preferences were moved under 'settings'. Allow backward compatibility for 3rd party grade reports.
        $active_type = 'settings';
    }
    $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
    // Determine the string of the active plugin
    $stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
    $stractive_type = $plugin_info['strings'][$active_type];
    if (empty($plugin_info[$active_type]->id) || !empty($plugin_info[$active_type]->parent)) {
        $title = $PAGE->course->fullname . ': ' . $stractive_type . ': ' . $stractive_plugin;
    } else {
        $title = $PAGE->course->fullname . ': ' . $stractive_plugin;
    }
    if ($active_type == 'report') {
        $PAGE->set_pagelayout('report');
    } else {
        $PAGE->set_pagelayout('admin');
    }
    $PAGE->set_title(get_string('grades') . ': ' . $stractive_type);
    $PAGE->set_heading($title);
    if ($buttons instanceof single_button) {
        $buttons = $OUTPUT->render($buttons);
    }
    $PAGE->set_button($buttons);
    if ($courseid != SITEID) {
        grade_extend_settings($plugin_info, $courseid);
    }
    $returnval = $OUTPUT->header();
    if (!$return) {
        echo $returnval;
    }
    // Guess heading if not given explicitly
    if (!$heading) {
        $heading = $stractive_plugin;
    }
    if ($shownavigation) {
        if ($courseid != SITEID && ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN)) {
            $returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return);
        }
        $output = '';
        // Add a help dialogue box if provided.
        if (isset($headerhelpidentifier)) {
            $output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
        } else {
            $output = $OUTPUT->heading($heading);
        }
        if ($return) {
            $returnval .= $output;
        } else {
            echo $output;
        }
        if ($courseid != SITEID && ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS)) {
            $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
        }
    }
    $returnval .= print_natural_aggregation_upgrade_notice($courseid, context_course::instance($courseid), $PAGE->url, $return);
    if ($return) {
        return $returnval;
    }
}
コード例 #5
0
ファイル: lib.php プロジェクト: EsdrasCaleb/moodle
/**
 * Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
 * (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
 * in favour of the usual print_header(), print_header_simple(), print_heading() etc.
 * !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
 * the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
 *
 * @param int     $courseid Course id
 * @param string  $active_type The type of the current page (report, settings,
 *                             import, export, scales, outcomes, letters)
 * @param string  $active_plugin The plugin of the current page (grader, fullview etc...)
 * @param string  $heading The heading of the page. Tries to guess if none is given
 * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
 * @param string  $bodytags Additional attributes that will be added to the <body> tag
 * @param string  $buttons Additional buttons to display on the page
 * @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
 * @param string  $headerhelpidentifier The help string identifier if required.
 * @param string  $headerhelpcomponent The component for the help string.
 * @param stdClass $user The user object for use with the user context header.
 *
 * @return string HTML code or nothing if $return == false
 */
function print_grade_page_head($courseid, $active_type, $active_plugin=null,
                               $heading = false, $return=false,
                               $buttons=false, $shownavigation=true, $headerhelpidentifier = null, $headerhelpcomponent = null,
                               $user = null) {
    global $CFG, $OUTPUT, $PAGE;

    // Put a warning on all gradebook pages if the course has modules currently scheduled for background deletion.
    require_once($CFG->dirroot . '/course/lib.php');
    if (course_modules_pending_deletion($courseid)) {
        \core\notification::add(get_string('gradesmoduledeletionpendingwarning', 'grades'),
            \core\output\notification::NOTIFY_WARNING);
    }

    if ($active_type === 'preferences') {
        // In Moodle 2.8 report preferences were moved under 'settings'. Allow backward compatibility for 3rd party grade reports.
        $active_type = 'settings';
    }

    $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);

    // Determine the string of the active plugin
    $stractive_plugin = ($active_plugin) ? $plugin_info['strings']['active_plugin_str'] : $heading;
    $stractive_type = $plugin_info['strings'][$active_type];

    if (empty($plugin_info[$active_type]->id) || !empty($plugin_info[$active_type]->parent)) {
        $title = $PAGE->course->fullname.': ' . $stractive_type . ': ' . $stractive_plugin;
    } else {
        $title = $PAGE->course->fullname.': ' . $stractive_plugin;
    }

    if ($active_type == 'report') {
        $PAGE->set_pagelayout('report');
    } else {
        $PAGE->set_pagelayout('admin');
    }
    $PAGE->set_title(get_string('grades') . ': ' . $stractive_type);
    $PAGE->set_heading($title);
    if ($buttons instanceof single_button) {
        $buttons = $OUTPUT->render($buttons);
    }
    $PAGE->set_button($buttons);
    if ($courseid != SITEID) {
        grade_extend_settings($plugin_info, $courseid);
    }

    // Set the current report as active in the breadcrumbs.
    if ($active_plugin !== null && $reportnav = $PAGE->settingsnav->find($active_plugin, navigation_node::TYPE_SETTING)) {
        $reportnav->make_active();
    }

    $returnval = $OUTPUT->header();

    if (!$return) {
        echo $returnval;
    }

    // Guess heading if not given explicitly
    if (!$heading) {
        $heading = $stractive_plugin;
    }

    if ($shownavigation) {
        $navselector = null;
        if ($courseid != SITEID &&
                ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN)) {
            // It's absolutely essential that this grade plugin selector is shown after the user header. Just ask Fred.
            $navselector = print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, true);
            if ($return) {
                $returnval .= $navselector;
            } else if (!isset($user)) {
                echo $navselector;
            }
        }

        $output = '';
        // Add a help dialogue box if provided.
        if (isset($headerhelpidentifier)) {
            $output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
        } else {
            if (isset($user)) {
                $output = $OUTPUT->context_header(
                        array(
                            'heading' => html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id,
                                'course' => $courseid)), fullname($user)),
                            'user' => $user,
                            'usercontext' => context_user::instance($user->id)
                        ), 2
                    ) . $navselector;
            } else {
                $output = $OUTPUT->heading($heading);
            }
        }

        if ($return) {
            $returnval .= $output;
        } else {
            echo $output;
        }

        if ($courseid != SITEID &&
                ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS)) {
            $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
        }
    }

    $returnval .= print_natural_aggregation_upgrade_notice($courseid,
                                                           context_course::instance($courseid),
                                                           $PAGE->url,
                                                           $return);

    if ($return) {
        return $returnval;
    }
}
コード例 #6
0
ファイル: index.php プロジェクト: BackupTheBerlios/samouk-svn
}
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'overview', 'courseid' => $course->id, 'userid' => $userid));
/// last selected report session tracking
if (!isset($USER->grade_last_report)) {
    $USER->grade_last_report = array();
}
$USER->grade_last_report[$course->id] = 'overview';
/// Build navigation
$strgrades = get_string('grades');
$reportname = get_string('modulename', 'gradereport_overview');
$navigation = grade_build_nav(__FILE__, $reportname, $course->id);
/// Print header
print_header_simple($strgrades . ': ' . $reportname, ': ' . $strgrades, $navigation, '', '', true, '', navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($course->id, 'report', 'overview');
if ($access) {
    //first make sure we have proper final grades - this must be done before constructing of the grade tree
    grade_regrade_final_grades($course->id);
    // Create a report instance
    $report = new grade_report_overview($userid, $gpr, $context);
    $gradetotal = 0;
    $gradesum = 0;
    // print the page
    print_heading(get_string('modulename', 'gradereport_overview') . ' - ' . fullname($report->user));
    if ($report->fill_table()) {
        echo $report->print_table(true);
    }
} else {
    // no access to grades!
    echo "Can not view grades.";
コード例 #7
0
require_once $CFG->dirroot . '/grade/export/lib.php';
require_once 'grade_export_txt.php';
$id = required_param('id', PARAM_INT);
// course id
if (!($course = get_record('course', 'id', $id))) {
    print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/txt:view', $context);
$strgrades = get_string('grades', 'grades');
$actionstr = get_string('modulename', 'gradeexport_txt');
$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
print_header($course->shortname . ': ' . get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'export', 'txt');
if (!empty($CFG->gradepublishing)) {
    $CFG->gradepublishing = has_capability('gradeexport/txt:publish', $context);
}
$mform = new grade_export_form(null, array('includeseparator' => true, 'publishing' => true));
// process post information
if ($data = $mform->get_data()) {
    $export = new grade_export_txt($course, groups_get_course_group($course), '', false, false, $data->display, $data->decimals);
    // print the grades on screen for feedback
    $export->process_form($data);
    $export->print_continue();
    $export->display_preview();
    print_footer($course);
    exit;
}
groups_print_course_menu($course, 'index.php?id=' . $id);
コード例 #8
0
            }
        }
        if (!$outcome->can_delete()) {
            break;
        }
        //TODO: add confirmation
        $outcome->delete();
        break;
}
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$caneditsystemscales = has_capability('moodle/course:managescales', $systemcontext);
if ($courseid) {
    /// Print header
    print_header_simple($strgrades . ': ' . $pagename, ': ' . $strgrades, $navigation, '', '', true, '', user_login_string($course) . '<hr style="width:95%">' . navmenu($course));
    /// Print the plugin selector at the top
    print_grade_plugin_selector($courseid, 'edit', 'outcome');
    $caneditcoursescales = has_capability('moodle/course:managescales', $context);
    $currenttab = 'outcomes';
    require 'tabs.php';
} else {
    admin_externalpage_print_header();
    $caneditcoursescales = $caneditsystemscales;
}
if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) {
    print_heading($strcustomoutcomes);
    $data = array();
    foreach ($outcomes as $outcome) {
        $line = array();
        $line[] = $outcome->get_name();
        $line[] = $outcome->get_shortname();
        $scale = $outcome->load_scale();
コード例 #9
0
ファイル: index.php プロジェクト: BackupTheBerlios/samouk-svn
            $object->set_parent($parent->id);
            $object->move_after_sortorder($sortorder);
            redirect($returnurl);
        }
        break;
    case 'moveselect':
        if ($eid and confirm_sesskey()) {
            $moving = $eid;
        }
        break;
    default:
        break;
}
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcategoriesedit, $navigation, '', '', true, '', navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($courseid, 'edit', 'tree');
print_heading(get_string('categoriesedit', 'grades'));
print_box_start('gradetreebox generalbox');
echo '<ul id="grade_tree">';
print_grade_tree($gtree, $gtree->top_element, $moving, $gpr, $switch);
echo '</ul>';
print_box_end();
echo '<div class="buttons">';
if ($moving) {
    print_single_button('index.php', array('id' => $course->id), get_string('cancel'), 'get');
} else {
    print_single_button('category.php', array('courseid' => $course->id), get_string('addcategory', 'grades'), 'get');
    print_single_button('item.php', array('courseid' => $course->id), get_string('additem', 'grades'), 'get');
    if (!empty($CFG->enableoutcomes)) {
        print_single_button('outcomeitem.php', array('courseid' => $course->id), get_string('addoutcomeitem', 'grades'), 'get');
    }
コード例 #10
0
ファイル: index.php プロジェクト: r007/PMoodle
require_once $CFG->dirroot . '/grade/lib.php';
$courseid = required_param('id', PARAM_INT);
// course id
if (!($course = get_record('course', 'id', $courseid))) {
    print_error('nocourseid');
}
require_login($course->id);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('gradereport/outcomes:view', $context);
// Build navigation
$strgrades = get_string('grades');
$stroutcomes = get_string('outcomes', 'grades');
$navigation = grade_build_nav(__FILE__, $stroutcomes, $course->id);
/// Print header
print_header_simple($strgrades . ':' . $stroutcomes, ':' . $strgrades, $navigation, '', '', true);
print_grade_plugin_selector($courseid, 'report', 'outcomes');
//first make sure we have proper final grades
grade_regrade_final_grades($courseid);
// Grab all outcomes used in course
$report_info = array();
$outcomes = grade_outcome::fetch_all_available($courseid);
// Get grade_items that use each outcome
foreach ($outcomes as $outcomeid => $outcome) {
    $report_info[$outcomeid]['items'] = get_records_select('grade_items', "outcomeid = {$outcomeid} AND courseid = {$courseid}");
    $report_info[$outcomeid]['outcome'] = $outcome;
    // Get average grades for each item
    if (is_array($report_info[$outcomeid]['items'])) {
        foreach ($report_info[$outcomeid]['items'] as $itemid => $item) {
            $sql = "SELECT itemid, AVG(finalgrade) AS avg, COUNT(finalgrade) AS count\n                      FROM {$CFG->prefix}grade_grades\n                     WHERE itemid = {$itemid}\n                  GROUP BY itemid";
            $info = get_records_sql($sql);
            if (!$info) {
コード例 #11
0
//                                                                       //
///////////////////////////////////////////////////////////////////////////
require_once '../../config.php';
require_once $CFG->dirroot . '/grade/lib.php';
$id = required_param('id', PARAM_INT);
// course id
if (!($course = get_record('course', 'id', $id))) {
    print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
require_capability('moodle/grade:import', $context);
$strgrades = get_string('grades', 'grades');
$navigation = grade_build_nav(__FILE__, null, array('courseid' => $course->id));
print_header($course->shortname . ': ' . get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, '', '');
$stredit = get_string('edit');
$strdelete = get_string('delete');
$data = array();
if ($keys = get_records_select('user_private_key', "script='grade/import' AND instance={$course->id} AND userid={$USER->id}")) {
    foreach ($keys as $key) {
        $line = array();
        $line[0] = format_string($key->value);
        $line[1] = $key->iprestriction;
        $line[2] = empty($key->validuntil) ? get_string('always') : userdate($key->validuntil);
        $buttons = "<a title=\"{$stredit}\" href=\"key.php?id={$key->id}\"><img" . " src=\"{$CFG->pixpath}/t/edit.gif\" class=\"iconsmall\" alt=\"{$stredit}\" /></a> ";
        $buttons .= "<a title=\"{$strdelete}\" href=\"key.php?id={$key->id}&amp;delete=1\"><img" . " src=\"{$CFG->pixpath}/t/delete.gif\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a> ";
        $line[3] = $buttons;
        $data[] = $line;
    }
}
コード例 #12
0
    @apache_child_terminate();
}
$text = download_file_content($url);
if ($text === false) {
    error('Can not read file');
}
$error = '';
$importcode = import_xml_grades($text, $course, $error);
if ($importcode !== false) {
    /// comit the code if we are up this far
    if (defined('USER_KEY_LOGIN')) {
        if (grade_import_commit($id, $importcode, $feedback, false)) {
            echo 'ok';
            die;
        } else {
            error('Grade import error');
            //TODO: localize
        }
    } else {
        $strgrades = get_string('grades', 'grades');
        $actionstr = get_string('xml', 'grades');
        $navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
        print_header($course->shortname . ': ' . get_string('grades'), $course->fullname, $navigation);
        print_grade_plugin_selector($id, 'import', 'xml');
        grade_import_commit($id, $importcode, $feedback, true);
        print_footer();
        die;
    }
} else {
    error($error);
}
コード例 #13
0
ファイル: index.php プロジェクト: BackupTheBerlios/samouk-svn
if (!($course = get_record('course', 'id', $courseid))) {
    print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:manageletters', $context)) {
    error('Missing permission to view letter grades');
}
$gpr = new grade_plugin_return(array('type' => 'edit', 'plugin' => 'letter', 'courseid' => $courseid));
$strgrades = get_string('grades');
$pagename = get_string('letters', 'grades');
$navigation = grade_build_nav(__FILE__, $pagename, $courseid);
/// Print header
print_header_simple($strgrades . ': ' . $pagename, ': ' . $strgrades, $navigation, '', '', true, '', navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($courseid, 'edit', 'letter');
$currenttab = 'lettersview';
require 'tabs.php';
$letters = grade_get_letters($context);
$data = array();
$max = 100;
foreach ($letters as $boundary => $letter) {
    $line = array();
    $line[] = format_float($max, 2) . ' %';
    $line[] = format_float($boundary, 2) . ' %';
    $line[] = format_string($letter);
    $data[] = $line;
    $max = $boundary - 0.01;
}
$table = new object();
$table->head = array(get_string('max', 'grades'), get_string('min', 'grades'), get_string('letter', 'grades'));
コード例 #14
0
ファイル: index.php プロジェクト: r007/PMoodle
$strgrades = get_string('grades');
$pagename = get_string('coursesettings', 'grades');
$navigation = grade_build_nav(__FILE__, $pagename, $courseid);
$returnurl = $CFG->wwwroot . '/grade/index.php?id=' . $course->id;
$mform = new course_settings_form();
$settings = grade_get_settings($course->id);
$mform->set_data($settings);
if ($mform->is_cancelled()) {
    redirect($returnurl);
} else {
    if ($data = $mform->get_data()) {
        $data = (array) $data;
        $general = array('displaytype', 'decimalpoints', 'aggregationposition');
        foreach ($data as $key => $value) {
            if (!in_array($key, $general) and strpos($key, 'report_') !== 0 and strpos($key, 'import_') !== 0 and strpos($key, 'export_') !== 0) {
                continue;
            }
            if ($value == -1) {
                $value = null;
            }
            grade_set_setting($course->id, $key, $value);
        }
        redirect($returnurl);
    }
}
/// Print header
print_header_simple($strgrades . ': ' . $pagename, ': ' . $strgrades, $navigation, '', '', true, '', navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($courseid, 'edit', 'settings');
$mform->display();
print_footer($course);
コード例 #15
0
            unset_user_preference($preference);
        } else {
            set_user_preference($preference, $value);
        }
    }
}
/// If cancelled go back to report
if ($mform->is_cancelled()) {
    redirect($CFG->wwwroot . '/grade/report/visual/index.php?id=' . $courseid);
}
$strgrades = get_string('grades');
$strvisualreport = get_string('modulename', 'gradereport_visual');
$strgradepreferences = get_string('gradepreferences', 'grades');
$navigation = grade_build_nav(__FILE__, $strgradepreferences, $courseid);
print_header_simple($strgrades . ': ' . $strvisualreport . ': ' . $strgradepreferences, ': ' . $strgradepreferences, $navigation, '', '', true, '', navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($course->id, 'report', 'visual');
// Add tabs
$currenttab = 'preferences';
include 'tabs.php';
/// If USER has admin capability, print a link to the site config page for this report
/// TODO: Add admin config page for this report
if (has_capability('moodle/site:config', $systemcontext)) {
    echo '<div id="siteconfiglink"><a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=gradereportvisual">';
    echo get_string('changereportdefaults', 'grades');
    echo "</a></div>\n";
}
print_simple_box_start("center");
$mform->display();
print_simple_box_end();
print_footer($course);