本文整理汇总了PHP中grade_outcome::fetch_all_local方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_outcome::fetch_all_local方法的具体用法?PHP grade_outcome::fetch_all_local怎么用?PHP grade_outcome::fetch_all_local使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_outcome
的用法示例。
在下文中一共展示了grade_outcome::fetch_all_local方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_externalpage_setup
admin_externalpage_setup('outcomes');
}
if (!confirm_sesskey()) {
break;
}
// $outcome = grade_outcome::fetch(array('id'=>$outcomeid));
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
header("Content-Type: text/csv; charset=utf-8");
// TODO: make the filename more useful, include a date, a specific name, something...
header('Content-Disposition: attachment; filename=outcomes.csv');
// sending header with clear names, to make 'what is what' as easy as possible to understand
$header = array('outcome_name', 'outcome_shortname', 'outcome_description', 'scale_name', 'scale_items', 'scale_description');
echo format_csv($header, ';', '"');
$outcomes = array();
if ($courseid) {
$outcomes = array_merge(grade_outcome::fetch_all_global(), grade_outcome::fetch_all_local($courseid));
} else {
$outcomes = grade_outcome::fetch_all_global();
}
foreach ($outcomes as $outcome) {
$line = array();
$line[] = $outcome->get_name();
$line[] = $outcome->get_shortname();
$line[] = $outcome->description;
$scale = $outcome->load_scale();
$line[] = $scale->get_name();
$line[] = $scale->compact_items();
$line[] = $scale->description;
echo format_csv($line, ';', '"');
}
/**
示例2: required_param
require_once '../../../config.php';
require_once $CFG->dirroot . '/grade/lib.php';
require_once $CFG->libdir . '/gradelib.php';
$courseid = required_param('id', PARAM_INT);
/// Make sure they can even access this course
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/course:update', $context);
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'edit', 'plugin' => 'outcomes', 'courseid' => $courseid));
// first of all fix the state of outcomes_course table
$standardoutcomes = grade_outcome::fetch_all_global();
$co_custom = grade_outcome::fetch_all_local($courseid);
$co_standard_used = array();
$co_standard_notused = array();
if ($courseused = $DB->get_records('grade_outcomes_courses', array('courseid' => $courseid), '', 'outcomeid')) {
$courseused = array_keys($courseused);
} else {
$courseused = array();
}
// fix wrong entries in outcomes_courses
foreach ($courseused as $oid) {
if (!array_key_exists($oid, $standardoutcomes) and !array_key_exists($oid, $co_custom)) {
$DB->delete_records('grade_outcomes_courses', array('outcomeid' => $oid, 'courseid' => $courseid));
}
}
// fix local custom outcomes missing in outcomes_course
foreach ($co_custom as $oid => $outcome) {
示例3: get_context_instance
} else {
$outcome->delete();
}
break;
}
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$caneditsystemscales = has_capability('moodle/course:managescales', $systemcontext);
if ($courseid) {
$caneditcoursescales = has_capability('moodle/course:managescales', $context);
} else {
echo $OUTPUT->header();
$caneditcoursescales = $caneditsystemscales;
}
$outcomes_tables = array();
$heading = get_string('outcomes', 'grades');
if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) {
$return = $OUTPUT->heading($strcustomoutcomes, 3, 'main');
$data = array();
foreach ($outcomes as $outcome) {
$line = array();
$line[] = $outcome->get_name();
$line[] = $outcome->get_shortname();
$scale = $outcome->load_scale();
if (empty($scale->id)) {
// hopefully never happens
$line[] = $scale->get_name();
} else {
if (empty($scale->courseid)) {
$caneditthisscale = $caneditsystemscales;
} else {
if ($scale->courseid == $courseid) {