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


PHP grade_update_outcomes函数代码示例

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


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

示例1: process_outcomes

    function process_outcomes($userid) {
        global $CFG, $USER;

        if (empty($CFG->enableoutcomes)) {
            return;
        }

        require_once($CFG->libdir.'/gradelib.php');

        if (!$formdata = data_submitted() or !confirm_sesskey()) {
            return;
        }

        $data = array();
        $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, $userid);

        if (!empty($grading_info->outcomes)) {
            foreach($grading_info->outcomes as $n=>$old) {
                $name = 'outcome_'.$n;
                if (isset($formdata->{$name}[$userid]) and $old->grades[$userid]->grade != $formdata->{$name}[$userid]) {
                    $data[$n] = $formdata->{$name}[$userid];
                }
            }
        }
        if (count($data) > 0) {
            grade_update_outcomes('mod/assignment', $this->course->id, 'mod', 'assignment', $this->assignment->id, $userid, $data);
        }

    }
开发者ID:nuckey,项目名称:moodle,代码行数:29,代码来源:lib.php

示例2: process_outcomes

 /**
  * Save outcomes submitted from grading form
  *
  * @param int $userid
  * @param stdClass $formdata
  */
 protected function process_outcomes($userid, $formdata)
 {
     global $CFG, $USER;
     if (empty($CFG->enableoutcomes)) {
         return;
     }
     if ($this->grading_disabled($userid)) {
         return;
     }
     require_once $CFG->libdir . '/gradelib.php';
     $data = array();
     $gradinginfo = grade_get_grades($this->get_course()->id, 'mod', 'assign', $this->get_instance()->id, $userid);
     if (!empty($gradinginfo->outcomes)) {
         foreach ($gradinginfo->outcomes as $index => $oldoutcome) {
             $name = 'outcome_' . $index;
             if (isset($formdata->{$name}[$userid]) && $oldoutcome->grades[$userid]->grade != $formdata->{$name}[$userid]) {
                 $data[$index] = $formdata->{$name}[$userid];
             }
         }
     }
     if (count($data) > 0) {
         grade_update_outcomes('mod/assign', $this->course->id, 'mod', 'assign', $this->get_instance()->id, $userid, $data);
     }
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:30,代码来源:locallib.php

示例3: array

<?php

$role = $DB->get_record('role', array('shortname' => 'student'));
$table = 'jcode_files';
$context = context_course::instance($course->id);
$students = get_role_users($role->id, $context);
$save = optional_param('savequickgrades', '', PARAM_TEXT);
require_once $CFG->libdir . '/gradelib.php';
if (!empty($save)) {
    foreach ($_POST as $name => $value) {
        if (strstr($name, 'quickgrade_') && !strstr($name, 'comments_')) {
            $name = str_replace('quickgrade_', '', $name);
            $nota = new stdClass();
            $nota->grade = $value;
            $grading_info = grade_get_grades($course->id, 'mod', 'jcode', $jcode->id, 0);
            grade_update_outcomes('mod/jcode', $course->id, 'mod', 'jcode', $jcode->id, $name, array('0' => $value));
            if (is_numeric($nota->grade)) {
                $feedback = $_POST['quickgrade_comments_' . $name];
                $nota->feedback = $feedback;
                if ($n = $DB->get_record($table, array('jcode_id' => $jcode->id, 'user_id' => $name))) {
                    $nota->id = $n->id;
                    $DB->update_record($table, $nota);
                } else {
                    $DB->insert($table, $nota);
                }
            }
        }
    }
}
$t = new html_table();
jcode_add_table_row_cells($t, array('Aluno', 'Nota', 'Feedback', 'Data de Entrega', 'Arquivo', 'Resultado'));
开发者ID:jrlamb,项目名称:alexBado,代码行数:31,代码来源:lista.php

示例4: save_outcomes

 /**
  * Saves outcome data from the form
  *
  * @param $assignment
  * @param $grading_info
  * @param $data
  * @return void
  */
 private function save_outcomes($assignment, $grading_info, $data)
 {
     global $CFG;
     if (empty($CFG->enableoutcomes)) {
         return;
     }
     $outcomedata = array();
     $userid = $data->userid;
     // TODO needs sorting out!
     if (!empty($grading_info->outcomes)) {
         foreach ($grading_info->outcomes as $n => $old) {
             $name = 'outcome_' . $n;
             $newvalue = $old->grades[$userid]->grade != $data->{$name}[$userid];
             if (isset($data->{$name}[$userid]) and $newvalue) {
                 $outcomedata[$n] = $data->{$name}[$userid];
             }
         }
         if (count($outcomedata) > 0) {
             grade_update_outcomes('mod/assignment', $assignment->course, 'mod', 'assignment', $assignment->id, $userid, $outcomedata);
         }
     }
 }
开发者ID:nadavkav,项目名称:moodle-block_ajax_marking,代码行数:30,代码来源:block_ajax_marking_assignment.class.php

示例5: set_grade

 /**
  * Set/update grade
  * @param $info object with grade and comments fields
  * @param $automatic if automatic grading (default false)
  * @return void
  */
 function set_grade($info, $automatic = false)
 {
     global $USER;
     global $CFG;
     global $DB;
     ignore_user_abort(true);
     $scaleid = $this->vpl->get_grade();
     if ($scaleid == 0 && empty($CFG->enableoutcomes)) {
         //No scale no outcomes
         return;
     }
     if (!function_exists('grade_update')) {
         require_once $CFG->libdir . '/gradelib.php';
     }
     if ($automatic) {
         //Who grade
         $this->instance->grader = 0;
     } else {
         $this->instance->grader = $USER->id;
     }
     if ($this->vpl->is_group_activity()) {
         $usersid = array();
         foreach ($this->vpl->get_usergroup_members($this->instance->userid) as $user) {
             $usersid[] = $user->id;
         }
     } else {
         $usersid = array($this->instance->userid);
     }
     $this->instance->dategraded = time();
     if ($scaleid != 0) {
         //Sanitize grade
         if ($scaleid > 0) {
             $info->grade = (double) $info->grade;
         } else {
             $info->grade = (int) $info->grade;
         }
         $this->instance->grade = $info->grade;
         //Save assessment comments
         $comments = $info->comments;
         $fn = $this->get_gradecommentsfilename();
         if ($comments) {
             $fp = vpl_fopen($fn);
             fwrite($fp, $comments);
             fclose($fp);
         } elseif (file_exists($fn)) {
             unlink($fn);
         }
         //update gradebook
         $grades = array();
         $gradeinfo = array();
         //If no grade then don't set rawgrade and feedback
         if (!($info->grade == -1 && $scaleid < 0)) {
             $gradeinfo['rawgrade'] = $info->grade;
             $gradeinfo['feedback'] = $this->result_to_HTML($comments, false);
             $gradeinfo['feedbackformat'] = FORMAT_HTML;
         }
         if ($this->instance->grader > 0) {
             //Don't add grader if automatic
             $gradeinfo['usermodified'] = $this->instance->grader;
         } else {
             //This avoid to use an unexisting userid (0) in the gradebook
             $gradeinfo['usermodified'] = $USER->id;
         }
         $gradeinfo['datesubmitted'] = $this->instance->datesubmitted;
         $gradeinfo['dategraded'] = $this->instance->dategraded;
         foreach ($usersid as $userid) {
             $gradeinfo['userid'] = $userid;
             $grades[$userid] = $gradeinfo;
         }
         if (grade_update('mod/vpl', $this->vpl->get_course()->id, 'mod', VPL, $this->vpl->get_instance()->id, 0, $grades) != GRADE_UPDATE_OK) {
             return false;
         }
     }
     if (!empty($CFG->enableoutcomes)) {
         foreach ($usersid as $userid) {
             $grading_info = grade_get_grades($this->vpl->get_course()->id, 'mod', 'vpl', $this->vpl->get_instance()->id, $userid);
             if (!empty($grading_info->outcomes)) {
                 $outcomes = array();
                 foreach ($grading_info->outcomes as $oid => $dummy) {
                     $field = 'outcome_grade_' . $oid;
                     if (isset($info->{$field})) {
                         $outcomes[$oid] = $info->{$field};
                     } else {
                         $outcomes[$oid] = null;
                     }
                 }
                 grade_update_outcomes('mod/vpl', $this->vpl->get_course()->id, 'mod', VPL, $this->vpl->get_instance()->id, $userid, $outcomes);
             }
         }
     }
     if (!$DB->update_record('vpl_submissions', $this->instance)) {
         print_error('DB error updating submission grade info');
     }
     return true;
//.........这里部分代码省略.........
开发者ID:go38,项目名称:moodle-mod_vpl,代码行数:101,代码来源:vpl_submission.class.php

示例6: stdClass

            // salvando registro
            if ($success == 0) {
                $post_file = new stdClass();
                $post_file->jcode_id = $jcode->id;
                $post_file->filename = $filename;
                $post_file->user_id = $USER->id;
                $post_file->submit_date = time();
                if ($jcode->correctanswer == $response) {
                    $post_file->grade = $jcode->grade;
                } else {
                    $post_file->grade = 0;
                }
                $post_file->result = $out;
                $DB->insert_record('jcode_files', $post_file);
                $grading_info = grade_get_grades($COURSE->id, 'mod', 'jcode', $jcode->id, 0);
                grade_update_outcomes('mod/jcode', $COURSE->id, 'mod', 'jcode', $jcode->id, $post_file->user_id, array('0' => $post_file->grade));
            }
            $url = $CFG->wwwroot . "/mod/jcode/view.php?id=" . $id;
            redirect($url, "Processando arquivo, aguarde por favor...");
        } else {
            $form->display();
        }
    }
} else {
    $o = $OUTPUT->box_start('boxaligncenter submissionsummarytable');
    $t = new html_table();
    //data de envio
    $remove = '';
    if ($jcode->resubmit && $jcode->timedue >= time()) {
        $remove = " <a href='{$CFG->wwwroot}/mod/jcode/view.php?id={$id}&remove={$file->id}' >" . get_string('remove', 'jcode') . "</a>";
    }
开发者ID:jrlamb,项目名称:alexBado,代码行数:31,代码来源:submission.php

示例7: qcreate_process_outcomes

function qcreate_process_outcomes($qcreate, $userid)
{
    global $CFG, $COURSE;
    if (empty($CFG->enableoutcomes)) {
        return;
    }
    require_once $CFG->libdir . '/gradelib.php';
    if (!($formdata = data_submitted())) {
        return;
    }
    $data = array();
    $grading_info = grade_get_grades($COURSE->id, 'mod', 'qcreate', $qcreate->id, $userid);
    if (!empty($grading_info->outcomes)) {
        foreach ($grading_info->outcomes as $n => $old) {
            $name = 'outcome_' . $n;
            if (isset($formdata->{$name}[$userid]) and $old->grades[$userid]->grade != $formdata->{$name}[$userid]) {
                $data[$n] = $formdata->{$name}[$userid];
            }
        }
    }
    if (count($data) > 0) {
        grade_update_outcomes('mod/qcreate', $COURSE->id, 'mod', 'qcreate', $qcreate->id, $userid, $data);
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:24,代码来源:lib.php


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