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


PHP grade_report::get_pref方法代码示例

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


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

示例1: grade_regrade_final_grades

$returnurl = $gpr->get_return_url(null);
//first make sure we have proper final grades - we need it for locking changes
grade_regrade_final_grades($courseid);
// get the grading tree object
// note: total must be first for moving to work correctly, if you want it last moving code must be rewritten!
$gtree = new grade_tree($courseid, false, false);
if (empty($eid)) {
    $element = null;
    $object = null;
} else {
    if (!($element = $gtree->locate_element($eid))) {
        error('Incorrect element id!', $returnurl);
    }
    $object = $element['object'];
}
$switch = grade_report::get_pref('aggregationposition');
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$strcategoriesedit = get_string('categoriesedit', 'grades');
$strcategoriesanditems = get_string('categoriesanditems', 'grades');
$navigation = grade_build_nav(__FILE__, $strcategoriesanditems, array('courseid' => $courseid));
$moving = false;
switch ($action) {
    case 'delete':
        if ($eid) {
            $confirm = optional_param('confirm', 0, PARAM_BOOL);
            if ($confirm and confirm_sesskey()) {
                $object->delete('grade/report/grader/category');
                redirect($returnurl);
            } else {
                print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcategoriesedit, $navigation, '', '', true, '', navmenu($course));
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:index.php

示例2: get_pref

 /**
  * Given the name of a user preference (without grade_report_ prefix), locally saves then returns
  * the value of that preference. If the preference has already been fetched before,
  * the saved value is returned. If the preference is not set at the User level, the $CFG equivalent
  * is given (site default).
  * @static (Can be called statically, but then doesn't benefit from caching)
  * @param string $pref The name of the preference (do not include the grade_report_ prefix)
  * @param int $objectid An optional itemid or categoryid to check for a more fine-grained preference
  * @return mixed The value of the preference
  */
 public function get_pref($pref, $objectid = null)
 {
     global $CFG;
     $fullprefname = 'grade_report_' . $pref;
     $shortprefname = 'grade_' . $pref;
     $retval = null;
     if (!isset($this) or get_class($this) != 'grade_report') {
         if (!empty($objectid)) {
             $retval = get_user_preferences($fullprefname . $objectid, grade_report::get_pref($pref));
         } elseif (isset($CFG->{$fullprefname})) {
             $retval = get_user_preferences($fullprefname, $CFG->{$fullprefname});
         } elseif (isset($CFG->{$shortprefname})) {
             $retval = get_user_preferences($fullprefname, $CFG->{$shortprefname});
         } else {
             $retval = null;
         }
     } else {
         if (empty($this->prefs[$pref . $objectid])) {
             if (!empty($objectid)) {
                 $retval = get_user_preferences($fullprefname . $objectid);
                 if (empty($retval)) {
                     // No item pref found, we are returning the global preference
                     $retval = $this->get_pref($pref);
                     $objectid = null;
                 }
             } else {
                 $retval = get_user_preferences($fullprefname, $CFG->{$fullprefname});
             }
             $this->prefs[$pref . $objectid] = $retval;
         } else {
             $retval = $this->prefs[$pref . $objectid];
         }
     }
     return $retval;
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:45,代码来源:lib.php

示例3: require_login

}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/grade:manage', $context);
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url('index.php?id=' . $course->id);
$mform = new edit_category_form(null, array('gpr' => $gpr));
if ($id) {
    if (!($grade_category = grade_category::fetch(array('id' => $id, 'courseid' => $course->id)))) {
        error('Incorrect category id!');
    }
    $grade_category->apply_forced_settings();
    $category = $grade_category->get_record_data();
    // Get Category preferences
    $category->pref_aggregationview = grade_report::get_pref('aggregationview', $id);
    // Load agg coef
    $grade_item = $grade_category->load_grade_item();
    $category->aggregationcoef = format_float($grade_item->aggregationcoef, 4);
    // set parent
    $category->parentcategory = $grade_category->parent;
} else {
    $grade_category = new grade_category(array('courseid' => $courseid), false);
    $grade_category->apply_default_settings();
    $grade_category->apply_forced_settings();
    $category = $grade_category->get_record_data();
    $category->aggregationcoef = format_float(0, 4);
}
$mform->set_data($category);
if ($mform->is_cancelled()) {
    redirect($returnurl);
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:category.php


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