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


PHP assignment_update_grades函数代码示例

本文整理汇总了PHP中assignment_update_grades函数的典型用法代码示例。如果您正苦于以下问题:PHP assignment_update_grades函数的具体用法?PHP assignment_update_grades怎么用?PHP assignment_update_grades使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: xmldb_assignment_upgrade

function xmldb_assignment_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    if ($result && $oldversion < 2007072200) {
        require_once $CFG->dirroot . '/mod/assignment/lib.php';
        // too much debug output
        $db->debug = false;
        assignment_update_grades();
        $db->debug = true;
    }
    if ($result && $oldversion < 2007091900) {
        /// MDL-11268
        /// Changing nullability of field data1 on table assignment_submissions to null
        $table = new XMLDBTable('assignment_submissions');
        $field = new XMLDBField('data1');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
        /// Launch change of nullability for field data1
        $result = $result && change_field_notnull($table, $field);
        /// Changing nullability of field data2 on table assignment_submissions to null
        $field = new XMLDBField('data2');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
        /// Launch change of nullability for field data2
        $result = $result && change_field_notnull($table, $field);
    }
    return $result;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:27,代码来源:upgrade.php

示例2: xmldb_assignment_upgrade

function xmldb_assignment_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    if ($result && $oldversion < 2007091900) {
        /// MDL-11268
        /// Changing nullability of field data1 on table assignment_submissions to null
        $table = new XMLDBTable('assignment_submissions');
        $field = new XMLDBField('data1');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
        /// Launch change of nullability for field data1
        $result = $result && change_field_notnull($table, $field);
        /// Changing nullability of field data2 on table assignment_submissions to null
        $field = new XMLDBField('data2');
        $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
        /// Launch change of nullability for field data2
        $result = $result && change_field_notnull($table, $field);
    }
    if ($result && $oldversion < 2007091902) {
        // add draft tracking default to existing upload assignments
        $sql = "UPDATE {$CFG->prefix}assignment SET var4=1 WHERE assignmenttype='upload'";
        $result = execute_sql($sql);
    }
    //===== 1.9.0 upgrade line ======//
    if ($result && $oldversion < 2007101511) {
        notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
        // change grade typo to text if no grades MDL-13920
        require_once $CFG->dirroot . '/mod/assignment/lib.php';
        // too much debug output
        $db->debug = false;
        assignment_update_grades();
        $db->debug = true;
    }
    return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:35,代码来源:upgrade.php

示例3: update_grade

 /**
  * Update grade item for this submission.
  */
 function update_grade($submission) {
     assignment_update_grades($this->assignment, $submission->userid);
 }
开发者ID:nuckey,项目名称:moodle,代码行数:6,代码来源:lib.php

示例4: process_data

 /**
  * Process and save the data from the feedback form. Mostly lifted from
  * $assignmentinstance->process_feedback().
  *
  * @param object $data from the feedback form
  * @param $params
  * @return string
  */
 public function process_data($data, $params)
 {
     global $CFG, $DB;
     // TODO validate data.
     require_once $CFG->libdir . '/gradelib.php';
     require_once "{$CFG->dirroot}/repository/lib.php";
     // For save and next, we need to know the userid to save, and the userid to go
     // We use a new hidden field in the form, and set it to -1. If it's set, we use this
     // as the userid to store.
     // This seems to be something that the pop up javascript will change in the normal run of
     // things. Normally it will be the -1 default.
     if ((int) $data->saveuserid !== -1) {
         $data->userid = $data->saveuserid;
     }
     if (!empty($data->cancel)) {
         // User hit cancel button.
         return 'cancelled';
     }
     // Get DB records.
     $coursemodule = $DB->get_record('course_modules', array('id' => $params['coursemoduleid']), '*', MUST_EXIST);
     $course = $DB->get_record('course', array('id' => $coursemodule->course), '*', MUST_EXIST);
     $assignment = $DB->get_record('assignment', array('id' => $coursemodule->instance), '*', MUST_EXIST);
     /* @var stdClass[] $grading_info */
     $grading_info = grade_get_grades($coursemodule->course, 'mod', 'assignment', $assignment->id, $data->userid);
     $submission = $DB->get_record('assignment_submissions', array('assignment' => $assignment->id, 'userid' => $data->userid), '*', MUST_EXIST);
     $user = $DB->get_record('user', array('id' => $data->userid), '*', MUST_EXIST);
     $assignmentinstance = $this->get_assignment_instance($assignment, $coursemodule, $course);
     // If 'revert to draft' has been clicked, we want a confirm button only.
     // We don't want to return yet because the main use case is to comment/grade and then
     // ask the student to improve.
     if (!empty($data->unfinalize) || !empty($data->revertbutton)) {
         $this->unfinalise_submission($submission, $assignment, $coursemodule, $course);
     }
     if (!$grading_info) {
         return 'Could not retrieve grading info.';
     }
     // Check to see if grade has been locked or overridden. If so, we can't save anything.
     if ($grading_info->items[0]->grades[$data->userid]->locked || $grading_info->items[0]->grades[$data->userid]->overridden) {
         return 'Grade is locked or overridden';
     }
     // Advanced grading if enabled. From assignment_base->validate_and_process_feedback().
     // Sort out the form ready to tell it to display.
     list($mformdata, $advancedgradingwarning) = $this->get_mform_data_object($course, $assignment, $submission, $user, $coursemodule, $assignmentinstance);
     $submitform = new block_ajax_marking_assignment_form(block_ajax_marking_form_url($params), $mformdata);
     $submitform->set_data($mformdata);
     if ($submitform->is_submitted() || !empty($data->revertbutton)) {
         // Possibly redundant.
         // Form was submitted (= a submit button other than 'cancel' or 'next' has been
         // clicked).
         if (!$submitform->is_validated()) {
             return 'form not validated';
         }
         /* @var gradingform_instance $gradinginstance */
         $gradinginstance = $submitform->use_advanced_grading();
         // Preprocess advanced grading here.
         if ($gradinginstance) {
             $formdata = $submitform->get_data();
             // Create submission if it did not exist yet because we need submission->id for
             // storing the grading instance.
             $advancedgrading = $formdata->advancedgrading;
             // Calculates the gradebook grade based on the rubrics.
             $data->xgrade = $gradinginstance->submit_and_get_grade($advancedgrading, $submission->id);
         }
     }
     // Save outcomes if necessary.
     if (!empty($CFG->enableoutcomes)) {
         $assignmentinstance->process_outcomes($data->userid);
     }
     $submission = $this->save_submission($submission, $data);
     if (!$submission) {
         return 'Problem saving feedback';
     }
     // Trigger grade event to update gradebook.
     $assignment->cmidnumber = $coursemodule->id;
     assignment_update_grades($assignment, $data->userid);
     add_to_log($coursemodule->course, 'assignment', 'update grades', 'submissions.php?id=' . $coursemodule->id . '&user=' . $data->userid, $data->userid, $coursemodule->id);
     // Save files if necessary.
     $this->save_files($assignment, $submission, $data);
     return '';
 }
开发者ID:nadavkav,项目名称:moodle-block_ajax_marking,代码行数:88,代码来源:block_ajax_marking_assignment.class.php

示例5: process_feedback

 /**
  *  Display and process the submissions 
  *  We need to do this to add teachers submission to students feedback. It is a bad bad hack, but it looks ok	 
  */
 function process_feedback()
 {
     global $USER, $CFG;
     if (!($feedback = data_submitted())) {
         // No incoming data?
         return false;
     }
     ///For save and next, we need to know the userid to save, and the userid to go...
     ///We use a new hidden field in the form, and set it to -1. If it's set, we use this
     ///as the userid to store...
     if ((int) $feedback->saveuserid !== -1) {
         $feedback->userid = $feedback->saveuserid;
     }
     if (!empty($feedback->cancel)) {
         // User hit cancel button
         return false;
     }
     $newsubmission = $this->get_submission($feedback->userid, true);
     // Get or make one
     //if we are grading journals
     $newsubmission->grade = $feedback->grade;
     $newsubmission->submissioncomment = $feedback->submissioncomment;
     $newsubmission->format = $feedback->format;
     $newsubmission->teacher = $USER->id;
     $newsubmission->mailed = 0;
     // Make sure mail goes out (again, even)
     $newsubmission->timemarked = time();
     //---------------Justin Video Message start 20090105-------------------
     if (!empty($_POST['mediafilename'])) {
         $mediafile = $_POST['mediafilename'];
         if ($mediafile) {
             if ($CFG->filter_poodll_journal_video) {
                 $newtext = '{POODLL:type=video,path=' . $mediafile . '}';
             } else {
                 $newtext = '{POODLL:type=audio,path=' . $mediafile . '}';
             }
             $feedback->submissioncomment = $newtext . '<BR />' . $feedback->submissioncomment;
         }
     }
     //---------------Video Message end 20090105---------------------
     //tack teachers comment onto students
     $newsubmission->data1 = $feedback->submissioncomment . PARTSDELIM . $USER->id . PARTSDELIM . time() . COMMENTSDELIM . addslashes($newsubmission->data1);
     //unset($newsubmission->data1);
     unset($newsubmission->data2);
     // Don't need to update this.
     if (!update_record('assignment_submissions', $newsubmission)) {
         return false;
     }
     // trigger grade event(lib.php)
     assignment_update_grades($this->assignment, $feedback->userid);
     add_to_log($this->course->id, 'assignment', 'update grades', 'submissions.php?id=' . $this->assignment->id . '&user=' . $feedback->userid, $feedback->userid, $this->cm->id);
     return $newsubmission;
 }
开发者ID:laiello,项目名称:poodll,代码行数:57,代码来源:assignment.class.php


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