本文整理汇总了PHP中emarking_validate_rubric函数的典型用法代码示例。如果您正苦于以下问题:PHP emarking_validate_rubric函数的具体用法?PHP emarking_validate_rubric怎么用?PHP emarking_validate_rubric使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emarking_validate_rubric函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_contribution_per_marker
function get_contribution_per_marker($cmid, $emarkingid)
{
global $DB;
$context = context_module::instance($cmid);
list($gradingmanager, $gradingmethod) = emarking_validate_rubric($context);
$rubriccontroller = $gradingmanager->get_controller($gradingmethod);
$definition = $rubriccontroller->get_definition();
// Calculates the number of criteria for this evaluation
$numcriteria = 0;
if ($rubriccriteria = $rubriccontroller->get_definition()) {
$numcriteria = count($rubriccriteria->rubric_criteria);
}
$totalsubmissions = get_totalsubmissions($cmid, $emarkingid);
$sqlcontributorstats = "SELECT\n\t\tec.markerid,\n\t\tCONCAT(u.firstname , ' ', u.lastname) AS markername,\n\t\tCOUNT(distinct ec.id) AS comments\n FROM {emarking_submission} AS s\n INNER JOIN {emarking} AS e ON (s.emarking=e.id)\n\t\tINNER JOIN {course_modules} AS cm ON (e.id=cm.instance AND e.id=?)\n INNER JOIN {context} AS c ON (s.status>=10 AND cm.id = c.instanceid )\n INNER JOIN {grading_areas} AS ar ON (c.id = ar.contextid)\n INNER JOIN {grading_definitions} AS d ON (ar.id = d.areaid)\n INNER JOIN {grading_instances} AS i ON (d.id=i.definitionid)\n INNER JOIN {gradingform_rubric_fillings} AS f ON (i.id=f.instanceid)\n INNER JOIN {gradingform_rubric_levels} AS b ON (b.id = f.levelid)\n INNER JOIN {gradingform_rubric_criteria} AS a ON (a.id = f.criterionid)\n INNER JOIN {emarking_comment} as ec ON (b.id = ec.levelid)\n INNER JOIN {user} as u ON (ec.markerid = u.id)\n\t\tGROUP BY ec.markerid";
$markingstatstotalcontribution = $DB->get_records_sql($sqlcontributorstats, array($emarkingid));
$contributioners = array();
$contributions = array();
foreach ($markingstatstotalcontribution as $contributioner) {
$contributions[] = array("contrib" => round($contributioner->comments * 100 / ($totalsubmissions * $numcriteria), 2));
}
return $contributions;
}
示例2: list
}
// Page navigation and URL settings
$PAGE->set_url($urlemarking);
$PAGE->set_context($context);
$PAGE->set_course($course);
$PAGE->set_pagelayout('incourse');
$PAGE->set_cm($cm);
$PAGE->set_heading($emarking->name);
$PAGE->set_title(get_string('emarking', 'mod_emarking'));
$PAGE->navbar->add(get_string('emarking', 'mod_emarking'));
// Show header and heading
echo $OUTPUT->header();
echo $OUTPUT->heading_with_help(get_string('emarking', 'mod_emarking'), 'annotatesubmission', 'mod_emarking');
// Navigation tabs
echo $OUTPUT->tabtree(emarking_tabs($context, $cm, $emarking), "mark");
list($gradingmanager, $gradingmethod) = emarking_validate_rubric($context);
// User filter checking capabilities. If user can not grade, then she can not
// see other users
$userfilter = 'WHERE 1=1 ';
if (!has_capability('mod/emarking:grade', $context)) {
$userfilter .= 'AND ue.userid = ' . $USER->id;
}
// As we have a rubric we can get the controller
$rubriccontroller = $gradingmanager->get_controller($gradingmethod);
if (!$rubriccontroller instanceof gradingform_rubric_controller) {
print_error(get_string('invalidrubric', 'mod_emarking'));
}
// Calculates the number of criteria for this evaluation
$numcriteria = 0;
$rubricscores = $rubriccontroller->get_min_max_score();
$levels = array();
示例3: list
echo $OUTPUT->header();
// Heading and tabs if we are within a course module.
echo $OUTPUT->heading($emarking->name);
// Navigation tabs.
$tabname = $scan ? "scanlist" : "mark";
echo $OUTPUT->tabtree(emarking_tabs($context, $cm, $emarking), $tabname);
// Reassign peers if everything is ok with it.
if ($reassignpeers && $usercangrade && $issupervisor && $numdraftsgrading == 0) {
if (emarking_assign_peers($emarking)) {
echo $OUTPUT->notification(get_string('transactionsuccessfull', 'mod_emarking'), 'notifysuccess');
} else {
echo $OUTPUT->notification(get_string('fatalerror', 'mod_emarking'), 'notifyproblem');
}
}
// Get rubric instance.
list($gradingmanager, $gradingmethod, $rubriccriteria, $rubriccontroller) = emarking_validate_rubric($context, $emarking->type == EMARKING_TYPE_MARKER_TRAINING || $emarking->type == EMARKING_TYPE_PEER_REVIEW, !$scan);
// Show rubric creation button.
// User filter checking capabilities. If user can not grade, then she can not.
// see other users.
$userfilter = 'WHERE 1=1 ';
if (!$usercangrade) {
$userfilter .= 'AND (u.id = ' . $USER->id . ' OR NM.answerkey = ' . EMARKING_ANSWERKEY_ACCEPTED . ')';
} else {
if ($emarking->type == EMARKING_TYPE_MARKER_TRAINING && !is_siteadmin($USER->id) && !$issupervisor) {
$userfilter .= 'AND um.id = ' . $USER->id;
} else {
if ($emarking->type == EMARKING_TYPE_PEER_REVIEW && !$issupervisor && !is_siteadmin($USER->id)) {
$userfilter .= 'AND (um.id = ' . $USER->id . ' OR u.id = ' . $USER->id . ')';
}
}
}
示例4: array
$PAGE->set_pagelayout('incourse');
$PAGE->set_title(get_string('emarking', 'mod_emarking'));
$PAGE->navbar->add(get_string('markers', 'mod_emarking'));
// Verify capability for security issues.
if (!has_capability('mod/emarking:assignmarkers', $context)) {
$item = array('context' => $context, 'objectid' => $emarking->id);
// Add to Moodle log so some auditing can be done.
\mod_emarking\event\unauthorizedaccess_attempted::create($item)->trigger();
print_error(get_string('invalidaccess', 'mod_emarking'));
}
echo $OUTPUT->header();
// Heading and tabs if we are within a course module.
echo $OUTPUT->heading($emarking->name);
echo $OUTPUT->tabtree(emarking_tabs($context, $cm, $emarking), "markers");
// Get rubric instance.
list($gradingmanager, $gradingmethod, $definition) = emarking_validate_rubric($context, false, false);
$mformmarkers = new emarking_markers_form(null, array('context' => $context, 'criteria' => $definition->rubric_criteria, 'id' => $cm->id, 'totalpages' => $exam->totalpages, 'emarking' => $emarking, "action" => "addmarkers"));
if ($mformmarkers->get_data()) {
$newmarkers = process_mform($mformmarkers, "addmarkers", $emarking);
}
if ($action === 'deletemarkers') {
$DB->delete_records('emarking_marker_criterion', array('emarking' => $emarking->id, 'criterion' => $criterion->id));
echo $OUTPUT->notification(get_string("transactionsuccessfull", "mod_emarking"), 'notifysuccess');
} else {
if ($action === 'deletesinglemarker') {
$DB->delete_records('emarking_marker_criterion', array('emarking' => $emarking->id, 'marker' => $markerid, 'criterion' => $criterion->id));
echo $OUTPUT->notification(get_string("transactionsuccessfull", "mod_emarking"), 'notifysuccess');
}
}
$nummarkerscriteria = $DB->count_records("emarking_marker_criterion", array("emarking" => $emarking->id));
$markercriteria = $DB->get_recordset_sql("\n SELECT\n id,\n description,\n GROUP_CONCAT(uid) AS markers,\n sortorder\n FROM (\n SELECT\n c.id,\n c.description,\n c.sortorder,\n u.id as uid\n FROM {gradingform_rubric_criteria} c\n LEFT JOIN {emarking_marker_criterion} mc ON (c.definitionid = :definition AND mc.emarking = :emarking AND c.id = mc.criterion)\n LEFT JOIN {user} u ON (mc.marker = u.id)\n WHERE c.definitionid = :definition2\n ORDER BY c.id ASC, u.lastname ASC) T\n GROUP BY id", array("definition" => $definition->id, "definition2" => $definition->id, "emarking" => $emarking->id));
示例5: moodle_url
// Page settings (URL, breadcrumbs and title).
$PAGE->set_context($context);
$PAGE->set_course($course);
$PAGE->set_cm($cm);
$PAGE->set_url($url);
$PAGE->set_pagelayout('incourse');
echo $OUTPUT->header();
echo $OUTPUT->heading($emarking->name);
// Print eMarking tabs.
echo $OUTPUT->tabtree(emarking_tabs($context, $cm, $emarking), "justicereport");
if ($issupervisor && $emarking->type == EMARKING_TYPE_ON_SCREEN_MARKING && $emarking->justiceperception) {
$csvurl = new moodle_url('justice.php', array('id' => $cm->id, 'exportcsv' => 'justice'));
echo $OUTPUT->single_button($csvurl, get_string('exporttoexcel', 'mod_emarking'));
}
// Get rubric instance.
list($gradingmanager, $gradingmethod, $definition, $rubriccontroller) = emarking_validate_rubric($context, true, true);
// Calculates the number of criteria for this evaluation.
$numcriteria = count($definition->rubric_criteria);
$emarkingids = '' . $emarking->id;
$studentsanswered = $DB->get_records_sql("\nSELECT\n\ts.emarking,\n\te.course,\n c.shortname,\n c.fullname,\n\tCOUNT(DISTINCT s.student) AS total,\n\tCOUNT(DISTINCT p.id) AS answered\nFROM {emarking_submission} s\nINNER JOIN {emarking_draft} d ON (d.qualitycontrol = 0 AND d.submissionid = s.id\n AND s.emarking in ({$emarkingids}) AND d.status >= :status)\nINNER JOIN {emarking} e ON (s.emarking = e.id)\nINNER JOIN {course} c ON (e.course = c.id)\nLEFT JOIN {emarking_perception} p ON (p.submission = s.id)\nGROUP BY s.emarking", array("status" => EMARKING_STATUS_PUBLISHED));
foreach ($studentsanswered as $section) {
$pending = $section->total - $section->answered;
$datatable[$section->emarking] = "['Status', 'Students'],\n ['Answered', {$section->answered}],\n ['Not yet', {$pending}]\n ";
}
if ($emarking->justiceperception == EMARKING_JUSTICE_PER_CRITERION) {
$sqljustice = "\n SELECT 'of' as name,\n pc.criterion,\n c.description,\n pc.overall_fairness AS level,\n COUNT(DISTINCT s.student) as total\nFROM {emarking_perception} p\nINNER JOIN {emarking_submission} s ON (s.emarking = :emarkingid AND p.submission = s.id)\nINNER JOIN {emarking_draft} d ON (d.submissionid = s.id AND d.qualitycontrol = 0 AND d.status >= :status)\nINNER JOIN {emarking_perception_criteria} pc ON (p.id = pc.perception)\nINNER JOIN {gradingform_rubric_criteria} c ON (pc.criterion = c.id)\nGROUP BY pc.criterion, pc.overall_fairness\n UNION ALL\n SELECT 'er' as name,\n pc.criterion,\n c.description,\n pc.expectation_reality AS level,\n COUNT(DISTINCT s.student) as total\nFROM {emarking_perception} p\nINNER JOIN {emarking_submission} s ON (s.emarking = :emarkingid2 AND p.submission = s.id)\nINNER JOIN {emarking_draft} d ON (d.submissionid = s.id AND d.qualitycontrol = 0 AND d.status >= :status2)\nINNER JOIN {emarking_perception_criteria} pc ON (p.id = pc.perception)\nINNER JOIN {gradingform_rubric_criteria} c ON (pc.criterion = c.id)\nGROUP BY pc.criterion, pc.expectation_reality";
} else {
$sqljustice = "\n SELECT 'of' as name,\n overall_fairness AS level,\n COUNT(DISTINCT s.student) as total\nFROM {emarking_perception} p\nINNER JOIN {emarking_submission} s ON (s.emarking = :emarkingid AND p.submission = s.id)\nINNER JOIN {emarking_draft} d ON (d.submissionid = s.id AND d.qualitycontrol = 0 AND d.status >= :status)\nGROUP BY overall_fairness\n UNION ALL\n SELECT 'er' as name,\n expectation_reality AS level,\n COUNT(DISTINCT s.student) as total\nFROM {emarking_perception} p\nINNER JOIN {emarking_submission} s ON (s.emarking = :emarkingid2 AND p.submission = s.id)\nINNER JOIN {emarking_draft} d ON (d.submissionid = s.id AND d.qualitycontrol = 0 AND d.status >= :status2)\nGROUP BY expectation_reality";
}
$justiceperception = $DB->get_recordset_sql($sqljustice, array('status' => EMARKING_STATUS_PUBLISHED, 'status2' => EMARKING_STATUS_PUBLISHED, 'emarkingid' => $emarking->id, 'emarkingid2' => $emarking->id));
$fairnessdata = array();
示例6: COUNT
$definition = $controller->get_definition();
$totalsubmissions = $DB->count_records_sql("\n\t\tSELECT COUNT(e.id) AS total\n\t\tFROM {emarking_submission} AS e\n\t\tWHERE e.emarking = :emarkingid AND e.grade >= 0 AND e.status >= " . EMARKING_STATUS_RESPONDED, array('emarkingid' => $emarking->id));
if (!$totalsubmissions || $totalsubmissions == 0) {
echo $OUTPUT->notification(get_string('nosubmissionsgraded', 'mod_emarking'), 'notifyproblem');
echo $OUTPUT->footer();
die;
}
$emarkingsform = new emarking_comparativereport_form(null, array('course' => $course, 'cm' => $cm));
$emarkingsform->display();
if ($emarkingsform->get_data()) {
// Get the emarking activity to compare this one to
$emarking2 = $DB->get_record('emarking', array('id' => $emarkingsform->get_data()->emarking2));
// Get rubric definition for second activity
$cm2 = get_coursemodule_from_instance('emarking', $emarking2->id);
$context2 = context_module::instance($cm2->id);
list($gradingmanager2, $gradingmethod2) = emarking_validate_rubric($context2, false, false);
if ($gradingmethod2 == null) {
echo $OUTPUT->notification(get_string('rubrcismustbeidentical', 'mod_emarking'), 'notifyproblem');
echo $OUTPUT->footer();
die;
}
$controller2 = $gradingmanager2->get_controller($gradingmethod2);
$definition2 = $controller2->get_definition();
$criteria = array_values($definition->rubric_criteria);
$criteria2 = array_values($definition2->rubric_criteria);
$problems = false;
for ($i = 0; $i < count($criteria); $i++) {
if ($criteria[$i]['description'] !== $criteria2[$i]['description']) {
$problems = true;
break;
$levels = array_values($criteria[$i]['levels']);
示例7: array
<?php
$results = array();
// Get rubric instance
list($gradingmanager, $gradingmethod, $notification, $button_rubric) = emarking_validate_rubric($context);
// As we have a rubric we can get the controller
$rubriccontroller = $gradingmanager->get_controller($gradingmethod);
if (!$rubriccontroller instanceof gradingform_rubric_controller) {
print_error(get_string('invalidrubric', 'mod_emarking'));
}
$definition = $rubriccontroller->get_definition();
$results['rubricname'] = $definition->name;
$results['criteria'] = array();
foreach ($definition->rubric_criteria as $criterion) {
$results['criteria'][] = array('id' => $criterion['id'], 'description' => $criterion['description']);
}
// Generate markers list
$results['markers'] = array();
$indices = array();
// Get all users with permission to grade in emarking
$markers = get_enrolled_users($context, 'mod/emarking:grade');
// Add all users to markers list, we set criterion to 0
$i = 0;
foreach ($markers as $marker) {
$results['markers'][] = array('id' => $marker->id, 'fullname' => $marker->firstname . ' ' . $marker->lastname, 'criteria' => array());
$indices[$marker->id] = $i;
$i++;
}
// We get previous configuration of criteria for markers and set accordingly
$markerscriteria = $DB->get_records('emarking_marker_criterion', array('emarking' => $emarking->id));
foreach ($markerscriteria as $markercriterion) {
示例8: get_string
}
}
// Show header and heading
echo $OUTPUT->header();
// Heading and tabs if we are within a course module
echo $OUTPUT->heading($emarking->name);
// If we come from a redirect when scan or osm was just enabled we show a confirmation message
if ($enabled) {
$message = $enabled == EMARKING_TYPE_PRINT_SCAN ? get_string("scanwasenabled", "mod_emarking") : get_string("osmwasenabled", "mod_emarking");
echo $OUTPUT->notification($message, 'notifysuccess');
}
// Navigation tabs
$tabname = $scan ? "scanlist" : "mark";
echo $OUTPUT->tabtree(emarking_tabs($context, $cm, $emarking), $tabname);
// Get rubric instance
list($gradingmanager, $gradingmethod) = emarking_validate_rubric($context, $emarking->type == EMARKING_TYPE_MARKER_TRAINING, !$scan);
// User filter checking capabilities. If user can not grade, then she can not
// see other users
$userfilter = 'WHERE 1=1 ';
if (!$usercangrade) {
$userfilter .= 'AND u.id = ' . $USER->id;
} else {
if ($emarking->type == EMARKING_TYPE_MARKER_TRAINING && !is_siteadmin($USER->id) && !$issupervisor) {
$userfilter .= 'AND um.id = ' . $USER->id;
}
}
$qcfilter = ' AND d.qualitycontrol = 0';
if ($emarking->qualitycontrol && ($DB->count_records('emarking_markers', array('emarking' => $emarking->id, 'marker' => $USER->id, 'qualitycontrol' => 1)) > 0 || is_siteadmin($USER))) {
$qcfilter = '';
}
// Default variables for the number of criteria for this evaluation
示例9: get_string
$PAGE->requires->jquery_plugin('ui');
$PAGE->requires->jquery_plugin('ui-css');
// Show header and heading
echo $OUTPUT->header();
// Heading and tabs if we are within a course module
echo $OUTPUT->heading($emarking->name);
// If we come from a redirect when scan or osm was just enabled we show a confirmation message
if ($enabled) {
$message = $enabled == EMARKING_TYPE_PRINT_SCAN ? get_string("scanwasenabled", "mod_emarking") : get_string("osmwasenabled", "mod_emarking");
echo $OUTPUT->notification($message, 'notifysuccess');
}
// Navigation tabs
$tabname = $scan ? "scanlist" : "mark";
echo $OUTPUT->tabtree(emarking_tabs($context, $cm, $emarking), $tabname);
// Get rubric instance
list($gradingmanager, $gradingmethod) = emarking_validate_rubric($context, false, !$scan);
// User filter checking capabilities. If user can not grade, then she can not
// see other users
$userfilter = 'WHERE 1=1 ';
if (!$usercangrade) {
$userfilter .= 'AND u.id = ' . $USER->id;
} else {
if ($emarking->type == EMARKING_TYPE_MARKER_TRAINING && !is_siteadmin($USER->id) && !$issupervisor) {
$userfilter .= 'AND um.id = ' . $USER->id;
}
}
$qcfilter = ' AND d.qualitycontrol = 0';
if ($emarking->qualitycontrol && ($DB->count_records('emarking_markers', array('emarking' => $emarking->id, 'marker' => $USER->id, 'qualitycontrol' => 1)) > 0 || is_siteadmin($USER))) {
$qcfilter = '';
}
// Default variables for the number of criteria for this evaluation
示例10: emarking_get_markers_configuration
/**
*
* @param unknown $context
* @param unknown $emarking
* @return Ambigous <multitype:multitype: NULL , multitype:NULL >
*/
function emarking_get_markers_configuration($context, $emarking)
{
global $DB;
// Initially we have empty results.
$results = array();
// Get rubric instance.
list($gradingmanager, $gradingmethod, $definition) = emarking_validate_rubric($context, false, false);
$results['rubricname'] = $definition->name;
$results['criteria'] = array();
foreach ($definition->rubric_criteria as $criterion) {
$results['criteria'][] = array('id' => $criterion['id'], 'description' => $criterion['description']);
}
// Generate markers list.
$results['markers'] = array();
$indices = array();
// Get all users with permission to grade in emarking.
$markers = get_enrolled_users($context, 'mod/emarking:grade');
// Add all users to markers list, we set criterion to 0.
$i = 0;
foreach ($markers as $marker) {
$results['markers'][] = array('id' => $marker->id, 'fullname' => $marker->firstname . ' ' . $marker->lastname, 'criteria' => array());
$indices[$marker->id] = $i;
$i++;
}
// We get previous configuration of criteria for markers and set accordingly.
$markerscriteria = $DB->get_records('emarking_marker_criterion', array('emarking' => $emarking->id));
foreach ($markerscriteria as $markercriterion) {
$results['markers'][$indices[$markercriterion->marker]]['criteria'][] = array('id' => $markercriterion->criterion);
}
// Generate pages list.
$results['pages'] = array();
$indices = array();
// We create a list of pages according to the total pages configured for emarking.
// All pages are set to criterion 0.
for ($i = 1; $i <= $emarking->totalpages; $i++) {
$results['pages'][] = array('page' => $i, 'criteria' => array());
}
// We load previous configuration of page criterion assignments.
$pagescriteria = $DB->get_records('emarking_page_criterion', array('emarking' => $emarking->id));
foreach ($pagescriteria as $pagecriterion) {
$results['pages'][$pagecriterion->page - 1]['criteria'][] = array('id' => $pagecriterion->criterion);
}
return $results;
}
示例11: emarking_match_rubrics
/**
* Matches the rubrics from two emarking activities making sure it has the same
* criteria (two criteria are equal if their description are equal).
*
* @param unknown $emarkingsrc
* @param unknown $emarkingdst
* @param unknown $context
* @throws moodle_exception
* @return multitype:unknown
*/
function emarking_match_rubrics($emarkingsrc, $emarkingdst, $copyrubric = false)
{
global $DB;
$cmsrc = get_coursemodule_from_instance('emarking', $emarkingsrc->id);
$cmdst = get_coursemodule_from_instance('emarking', $emarkingdst->id);
$contextsrc = context_module::instance($cmsrc->id);
$contextdst = context_module::instance($cmdst->id);
list($gradingmanagersrc, $gradingmethodsrc, $definitionsrc, $rubriccontrollersrc) = emarking_validate_rubric($contextsrc, false, false);
list($gradingmanagerdst, $gradingmethoddst, $definitiondst, $rubriccontrollerdst) = emarking_validate_rubric($contextdst, false, false);
if ($copyrubric) {
if (!$rubriccontrollerdst) {
$method = $gradingmanagerdst->get_active_method();
$rubriccontrollerdst = $gradingmanagerdst->get_controller($method);
}
if ($rubriccontrollerdst->get_definition()) {
$rubriccontrollerdst->delete_definition();
}
$rubriccontrollerdst->update_definition($rubriccontrollersrc->get_definition_copy($rubriccontrollerdst));
$DB->set_field('grading_definitions', 'timecopied', time(), array('id' => $definitionsrc->id));
list($gradingmanagerdst, $gradingmethoddst, $definitiondst, $rubriccontrollerdst) = emarking_validate_rubric($contextdst, false, false);
}
if (!$definitionsrc || !$definitiondst) {
throw new moodle_exception("Invalid rubrics for copying, destination emarking doesn't have a rubric and you didn't selected to copy it.");
}
$criteriasrc = $definitionsrc->rubric_criteria;
$criteriadst = $definitiondst->rubric_criteria;
if (count($criteriasrc) != count($criteriadst)) {
throw new moodle_exception("Invalid rubric for copying, they don't have the same number of criteria");
}
$criteriaitems = array();
foreach ($criteriasrc as $criterionsrc) {
foreach ($criteriadst as $criteriondst) {
if ($criterionsrc['description'] === $criteriondst['description']) {
$criteriaitems[$criterionsrc['id']] = $criteriondst['id'];
}
}
}
if (count($criteriaitems) != count($criteriadst)) {
throw new moodle_exception("Not every criterion name matches in both source and destination emarking activities.");
}
return $criteriaitems;
}