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


PHP grade_item::get_calculation方法代码示例

本文整理汇总了PHP中grade_item::get_calculation方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_item::get_calculation方法的具体用法?PHP grade_item::get_calculation怎么用?PHP grade_item::get_calculation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grade_item的用法示例。


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

示例1: backup_gradebook_item_info

function backup_gradebook_item_info($bf, $preferences, $backupall)
{
    global $CFG;
    $status = true;
    // get all the grade_items, ordered by sort order since upon restoring, it is not always
    // possible to use the same sort order. We could at least preserve the sortorder by restoring
    // grade_items in the original sortorder
    if ($grade_items = get_records_sql("SELECT *\n                                              FROM {$CFG->prefix}grade_items\n                                             WHERE courseid = {$preferences->backup_course}\n                                          ORDER BY sortorder ASC")) {
        //Begin grade_items tag
        fwrite($bf, start_tag("GRADE_ITEMS", 3, true));
        //Iterate over each item
        foreach ($grade_items as $item) {
            // Instantiate a grade_item object, to access its methods
            $grade_item = new grade_item($item, false);
            // do not restore if this grade_item is a mod, and
            if ($grade_item->itemtype == 'mod') {
                //MDL-12463 - exclude grade_items of instances not chosen for backup
                if (empty($preferences->mods[$grade_item->itemmodule]->instances[$grade_item->iteminstance]->backup)) {
                    continue;
                }
            } else {
                if ($grade_item->itemtype == 'category') {
                    // if not all grade items are being backed up
                    // we ignore this type of grade_item and grades associated
                    if (!$backupall) {
                        continue;
                    }
                }
            }
            //Begin grade_item
            fwrite($bf, start_tag("GRADE_ITEM", 4, true));
            //Output individual fields
            fwrite($bf, full_tag("ID", 5, false, $grade_item->id));
            fwrite($bf, full_tag("CATEGORYID", 5, false, $grade_item->categoryid));
            fwrite($bf, full_tag("ITEMNAME", 5, false, $grade_item->itemname));
            fwrite($bf, full_tag("ITEMTYPE", 5, false, $grade_item->itemtype));
            fwrite($bf, full_tag("ITEMMODULE", 5, false, $grade_item->itemmodule));
            fwrite($bf, full_tag("ITEMINSTANCE", 5, false, $grade_item->iteminstance));
            fwrite($bf, full_tag("ITEMNUMBER", 5, false, $grade_item->itemnumber));
            fwrite($bf, full_tag("ITEMINFO", 5, false, $grade_item->iteminfo));
            fwrite($bf, full_tag("IDNUMBER", 5, false, $grade_item->idnumber));
            // use [idnumber] in calculation instead of [#giXXX#]
            fwrite($bf, full_tag("CALCULATION", 5, false, $grade_item->get_calculation()));
            fwrite($bf, full_tag("GRADETYPE", 5, false, $grade_item->gradetype));
            fwrite($bf, full_tag("GRADEMAX", 5, false, $grade_item->grademax));
            fwrite($bf, full_tag("GRADEMIN", 5, false, $grade_item->grademin));
            fwrite($bf, full_tag("SCALEID", 5, false, $grade_item->scaleid));
            fwrite($bf, full_tag("OUTCOMEID", 5, false, $grade_item->outcomeid));
            fwrite($bf, full_tag("GRADEPASS", 5, false, $grade_item->gradepass));
            fwrite($bf, full_tag("MULTFACTOR", 5, false, $grade_item->multfactor));
            fwrite($bf, full_tag("PLUSFACTOR", 5, false, $grade_item->plusfactor));
            fwrite($bf, full_tag("AGGREGATIONCOEF", 5, false, $grade_item->aggregationcoef));
            fwrite($bf, full_tag("DISPLAY", 5, false, $grade_item->display));
            fwrite($bf, full_tag("DECIMALS", 5, false, $grade_item->decimals));
            fwrite($bf, full_tag("HIDDEN", 5, false, $grade_item->hidden));
            fwrite($bf, full_tag("LOCKED", 5, false, $grade_item->locked));
            fwrite($bf, full_tag("LOCKTIME", 5, false, $grade_item->locktime));
            fwrite($bf, full_tag("NEEDSUPDATE", 5, false, $grade_item->needsupdate));
            fwrite($bf, full_tag("TIMECREATED", 5, false, $grade_item->timecreated));
            fwrite($bf, full_tag("TIMEMODIFIED", 5, false, $grade_item->timemodified));
            // back up the other stuff here
            // mod grades should only be backed up if selected
            if ($grade_item->itemtype == 'mod' && !backup_userdata_selected($preferences, $grade_item->itemmodule, $grade_item->iteminstance)) {
                // do not write grades if a mod grade_item is being restored
                // but userdata is not selected
            } else {
                $status = backup_gradebook_grades_info($bf, $preferences, $grade_item->id);
            }
            //End grade_item
            fwrite($bf, end_tag("GRADE_ITEM", 4, true));
        }
        //End grade_items tag
        $status = fwrite($bf, end_tag("GRADE_ITEMS", 3, true));
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:76,代码来源:backuplib.php


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