• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP grade_helper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: print_grades

 public function print_grades()
 {
     global $CFG;
     $export_tracking = $this->track_exports();
     $strgrades = get_string('grades');
     $profilefields = grade_helper::get_user_profile_fields($this->course->id, $this->usercustomfields);
     $shortname = format_string($this->course->shortname, true, array('context' => context_course::instance($this->course->id)));
     $downloadfilename = clean_filename("{$shortname} {$strgrades}");
     $csvexport = new csv_export_writer($this->separator);
     $csvexport->set_filename($downloadfilename);
     // Print names of all the fields
     $exporttitle = array();
     foreach ($profilefields as $field) {
         $exporttitle[] = $field->fullname;
     }
     if (!$this->onlyactive) {
         $exporttitle[] = get_string("suspended");
     }
     // Add a feedback column.
     foreach ($this->columns as $grade_item) {
         $exporttitle[] = $this->format_column_name($grade_item);
         if ($this->export_feedback) {
             $exporttitle[] = $this->format_column_name($grade_item, true);
         }
     }
     $csvexport->add_data($exporttitle);
     // Print all the lines of data.
     $geub = new grade_export_update_buffer();
     $gui = new graded_users_iterator($this->course, $this->columns, $this->groupid);
     $gui->require_active_enrolment($this->onlyactive);
     $gui->allow_user_custom_fields($this->usercustomfields);
     $gui->init();
     while ($userdata = $gui->next_user()) {
         $exportdata = array();
         $user = $userdata->user;
         foreach ($profilefields as $field) {
             $fieldvalue = grade_helper::get_user_field_value($user, $field);
             $exportdata[] = $fieldvalue;
         }
         if (!$this->onlyactive) {
             $issuspended = $user->suspendedenrolment ? get_string('yes') : '';
             $exportdata[] = $issuspended;
         }
         foreach ($userdata->grades as $itemid => $grade) {
             if ($export_tracking) {
                 $status = $geub->track($grade);
             }
             $exportdata[] = $this->format_grade($grade);
             if ($this->export_feedback) {
                 $exportdata[] = $this->format_feedback($userdata->feedbacks[$itemid]);
             }
         }
         $csvexport->add_data($exportdata);
     }
     $gui->close();
     $geub->close();
     $csvexport->download_file();
     exit;
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:59,代码来源:grade_export_txt.php


示例2: elseif

            $grade_item->update();
            $recreatetree = true;
            // Grade item checkbox inputs.
        } elseif (preg_match('/^(weightoverride)_([0-9]+)$/', $key, $matches)) {
            $param = $matches[1];
            $aid = $matches[2];
            $value = clean_param($value, PARAM_BOOL);
            $grade_item = grade_item::fetch(array('id' => $aid, 'courseid' => $courseid));
            $grade_item->{$param} = $value;
            $grade_item->update();
            $recreatetree = true;
        }
    }
    $originalweights = grade_helper::fetch_all_natural_weights_for_course($courseid);
    grade_regrade_final_grades($courseid);
    $alteredweights = grade_helper::fetch_all_natural_weights_for_course($courseid);
    if (array_diff($originalweights, $alteredweights)) {
        $normalisationmessage = get_string('weightsadjusted', 'grades');
    }
}
print_grade_page_head($courseid, 'settings', 'setup', get_string('categoriesanditems', 'grades'));
// Print Table of categories and items
echo $OUTPUT->box_start('gradetreebox generalbox');
echo '<form id="gradetreeform" method="post" action="' . $returnurl . '">';
echo '<div>';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
//did we update something in the db and thus invalidate $grade_edit_tree?
if ($recreatetree) {
    $grade_edit_tree = new grade_edit_tree($gtree, $movingeid, $gpr);
}
// Check to see if we have a normalisation message to send.
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:31,代码来源:index.php


示例3: print_grades

 /**
  * To be implemented by child classes
  */
 public function print_grades()
 {
     global $CFG;
     require_once $CFG->dirroot . '/lib/excellib.class.php';
     $export_tracking = $this->track_exports();
     $strgrades = get_string('grades');
     // Calculate file name
     $shortname = format_string($this->course->shortname, true, array('context' => context_course::instance($this->course->id)));
     $downloadfilename = clean_filename("{$shortname} {$strgrades}.xls");
     // Creating a workbook
     $workbook = new MoodleExcelWorkbook("-");
     // Sending HTTP headers
     $workbook->send($downloadfilename);
     // Adding the worksheet
     $myxls = $workbook->add_worksheet($strgrades);
     // Print names of all the fields
     $profilefields = grade_helper::get_user_profile_fields($this->course->id, $this->usercustomfields);
     foreach ($profilefields as $id => $field) {
         $myxls->write_string(0, $id, $field->fullname);
     }
     $pos = count($profilefields);
     if (!$this->onlyactive) {
         $myxls->write_string(0, $pos++, get_string("suspended"));
     }
     foreach ($this->columns as $grade_item) {
         $myxls->write_string(0, $pos++, $this->format_column_name($grade_item));
         // Add a column_feedback column
         if ($this->export_feedback) {
             $myxls->write_string(0, $pos++, $this->format_column_name($grade_item, true));
         }
     }
     // Print all the lines of data.
     $i = 0;
     $geub = new grade_export_update_buffer();
     $gui = new graded_users_iterator($this->course, $this->columns, $this->groupid);
     $gui->require_active_enrolment($this->onlyactive);
     $gui->allow_user_custom_fields($this->usercustomfields);
     $gui->init();
     while ($userdata = $gui->next_user()) {
         $i++;
         $user = $userdata->user;
         foreach ($profilefields as $id => $field) {
             $fieldvalue = grade_helper::get_user_field_value($user, $field);
             $myxls->write_string($i, $id, $fieldvalue);
         }
         $j = count($profilefields);
         if (!$this->onlyactive) {
             $issuspended = $user->suspendedenrolment ? get_string('yes') : '';
             $myxls->write_string($i, $j++, $issuspended);
         }
         foreach ($userdata->grades as $itemid => $grade) {
             if ($export_tracking) {
                 $status = $geub->track($grade);
             }
             $gradestr = $this->format_grade($grade);
             if (is_numeric($gradestr)) {
                 $myxls->write_number($i, $j++, $gradestr);
             } else {
                 $myxls->write_string($i, $j++, $gradestr);
             }
             // writing feedback if requested
             if ($this->export_feedback) {
                 $myxls->write_string($i, $j++, $this->format_feedback($userdata->feedbacks[$itemid]));
             }
         }
     }
     $gui->close();
     $geub->close();
     /// Close the workbook
     $workbook->close();
     exit;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:75,代码来源:grade_export_xls.php


示例4: display_preview

 /**
  * Prints preview of exported grades on screen as a feedback mechanism
  * @param bool $require_user_idnumber true means skip users without idnumber
  * @deprecated since 2.8 MDL-46548. Previews are not useful on export.
  */
 public function display_preview($require_user_idnumber = false)
 {
     global $OUTPUT;
     debugging('function grade_export::display_preview is deprecated.', DEBUG_DEVELOPER);
     $userprofilefields = grade_helper::get_user_profile_fields($this->course->id, $this->usercustomfields);
     $formatoptions = new stdClass();
     $formatoptions->para = false;
     echo $OUTPUT->heading(get_string('previewrows', 'grades'));
     echo '<table>';
     echo '<tr>';
     foreach ($userprofilefields as $field) {
         echo '<th>' . $field->fullname . '</th>';
     }
     if (!$this->onlyactive) {
         echo '<th>' . get_string("suspended") . "</th>";
     }
     foreach ($this->columns as $grade_item) {
         echo '<th>' . $this->format_column_name($grade_item) . '</th>';
         /// add a column_feedback column
         if ($this->export_feedback) {
             echo '<th>' . $this->format_column_name($grade_item, true) . '</th>';
         }
     }
     echo '</tr>';
     /// Print all the lines of data.
     $i = 0;
     $gui = new graded_users_iterator($this->course, $this->columns, $this->groupid);
     $gui->require_active_enrolment($this->onlyactive);
     $gui->allow_user_custom_fields($this->usercustomfields);
     $gui->init();
     while ($userdata = $gui->next_user()) {
         // number of preview rows
         if ($this->previewrows and $this->previewrows <= $i) {
             break;
         }
         $user = $userdata->user;
         if ($require_user_idnumber and empty($user->idnumber)) {
             // some exports require user idnumber so we can match up students when importing the data
             continue;
         }
         $gradeupdated = false;
         // if no grade is update at all for this user, do not display this row
         $rowstr = '';
         foreach ($this->columns as $itemid => $unused) {
             $gradetxt = $this->format_grade($userdata->grades[$itemid]);
             // get the status of this grade, and put it through track to get the status
             $g = new grade_export_update_buffer();
             $grade_grade = new grade_grade(array('itemid' => $itemid, 'userid' => $user->id));
             $status = $g->track($grade_grade);
             if ($this->updatedgradesonly && ($status == 'nochange' || $status == 'unknown')) {
                 $rowstr .= '<td>' . get_string('unchangedgrade', 'grades') . '</td>';
             } else {
                 $rowstr .= "<td>{$gradetxt}</td>";
                 $gradeupdated = true;
             }
             if ($this->export_feedback) {
                 $rowstr .= '<td>' . $this->format_feedback($userdata->feedbacks[$itemid]) . '</td>';
             }
         }
         // if we are requesting updated grades only, we are not interested in this user at all
         if (!$gradeupdated && $this->updatedgradesonly) {
             continue;
         }
         echo '<tr>';
         foreach ($userprofilefields as $field) {
             $fieldvalue = grade_helper::get_user_field_value($user, $field);
             // @see profile_field_base::display_data().
             echo '<td>' . format_text($fieldvalue, FORMAT_MOODLE, $formatoptions) . '</td>';
         }
         if (!$this->onlyactive) {
             $issuspended = $user->suspendedenrolment ? get_string('yes') : '';
             echo "<td>{$issuspended}</td>";
         }
         echo $rowstr;
         echo "</tr>";
         $i++;
         // increment the counter
     }
     echo '</table>';
     $gui->close();
 }
开发者ID:elie89,项目名称:moodle,代码行数:86,代码来源:lib.php


示例5: required_param

 * @copyright 2008 Petr Skoda
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once __DIR__ . '/../../config.php';
require_once $CFG->dirroot . '/grade/lib.php';
$id = required_param('id', PARAM_INT);
// course id
$PAGE->set_url('/grade/import/keymanager.php', array('id' => $id));
if (!($course = $DB->get_record('course', array('id' => $id)))) {
    print_error('nocourseid');
}
require_login($course);
$context = context_course::instance($id);
require_capability('moodle/grade:import', $context);
// Check if the user has at least one grade publishing capability.
$plugins = grade_helper::get_plugins_import($course->id);
if (!isset($plugins['keymanager'])) {
    print_error('nopermissions');
}
print_grade_page_head($course->id, 'import', 'keymanager', get_string('keymanager', 'grades'));
$stredit = get_string('edit');
$strdelete = get_string('delete');
$data = array();
$params = array($course->id, $USER->id);
if ($keys = $DB->get_records_select('user_private_key', "script='grade/import' AND instance=? AND userid=?", $params)) {
    foreach ($keys as $key) {
        $line = array();
        $line[0] = format_string($key->value);
        $line[1] = $key->iprestriction;
        $line[2] = empty($key->validuntil) ? get_string('always') : userdate($key->validuntil);
        $url = new moodle_url('key.php', array('id' => $key->id));
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:keymanager.php


示例6: get_description

 /**
  * Describe the aggregation settings for this category so the reports make more sense.
  *
  * @return string description
  */
 public function get_description()
 {
     $allhelp = array();
     if ($this->aggregation != GRADE_AGGREGATE_SUM) {
         $aggrstrings = grade_helper::get_aggregation_strings();
         $allhelp[] = $aggrstrings[$this->aggregation];
     }
     if ($this->droplow && $this->can_apply_limit_rules()) {
         $allhelp[] = get_string('droplowestvalues', 'grades', $this->droplow);
     }
     if ($this->keephigh && $this->can_apply_limit_rules()) {
         $allhelp[] = get_string('keephighestvalues', 'grades', $this->keephigh);
     }
     if (!$this->aggregateonlygraded) {
         $allhelp[] = get_string('aggregatenotonlygraded', 'grades');
     }
     if ($this->aggregatesubcats) {
         $allhelp[] = get_string('aggregatesubcatsshort', 'grades');
     }
     if ($allhelp) {
         return implode('. ', $allhelp) . '.';
     }
     return '';
 }
开发者ID:jtibbetts,项目名称:moodle,代码行数:29,代码来源:grade_category.php


示例7: definition

 function definition()
 {
     global $CFG, $COURSE, $DB, $OUTPUT;
     $mform =& $this->_form;
     $category = $this->_customdata['current'];
     $this->aggregation_options = grade_helper::get_aggregation_strings();
     // visible elements
     $mform->addElement('header', 'headercategory', get_string('gradecategory', 'grades'));
     $mform->addElement('text', 'fullname', get_string('categoryname', 'grades'));
     $mform->setType('fullname', PARAM_TEXT);
     $mform->addRule('fullname', null, 'required', null, 'client');
     $mform->addElement('select', 'aggregation', get_string('aggregation', 'grades'), $this->aggregation_options);
     $mform->addHelpButton('aggregation', 'aggregation', 'grades');
     if ((int) $CFG->grade_aggregation_flag & 2) {
         $mform->setAdvanced('aggregation');
     }
     $mform->addElement('checkbox', 'aggregateonlygraded', get_string('aggregateonlygraded', 'grades'));
     $mform->addHelpButton('aggregateonlygraded', 'aggregateonlygraded', 'grades');
     if ((int) $CFG->grade_aggregateonlygraded_flag & 2) {
         $mform->setAdvanced('aggregateonlygraded');
     }
     if (empty($CFG->enableoutcomes)) {
         $mform->addElement('hidden', 'aggregateoutcomes');
         $mform->setType('aggregateoutcomes', PARAM_INT);
     } else {
         $mform->addElement('checkbox', 'aggregateoutcomes', get_string('aggregateoutcomes', 'grades'));
         $mform->addHelpButton('aggregateoutcomes', 'aggregateoutcomes', 'grades');
         if ((int) $CFG->grade_aggregateoutcomes_flag & 2) {
             $mform->setAdvanced('aggregateoutcomes');
         }
     }
     $mform->addElement('text', 'keephigh', get_string('keephigh', 'grades'), 'size="3"');
     $mform->setType('keephigh', PARAM_INT);
     $mform->addHelpButton('keephigh', 'keephigh', 'grades');
     if ((int) $CFG->grade_keephigh_flag & 2) {
         $mform->setAdvanced('keephigh');
     }
     $mform->addElement('text', 'droplow', get_string('droplow', 'grades'), 'size="3"');
     $mform->setType('droplow', PARAM_INT);
     $mform->addHelpButton('droplow', 'droplow', 'grades');
     $mform->disabledIf('droplow', 'keephigh', 'noteq', 0);
     if ((int) $CFG->grade_droplow_flag & 2) {
         $mform->setAdvanced('droplow');
     }
     $mform->disabledIf('keephigh', 'droplow', 'noteq', 0);
     $mform->disabledIf('droplow', 'keephigh', 'noteq', 0);
     // Grade item settings
     // Displayed as Category total to avoid confusion between grade items requiring marking and category totals
     $mform->addElement('header', 'general', get_string('categorytotal', 'grades'));
     $mform->addElement('text', 'grade_item_itemname', get_string('categorytotalname', 'grades'));
     $mform->setType('grade_item_itemname', PARAM_TEXT);
     $mform->setAdvanced('grade_item_itemname');
     $mform->addElement('text', 'grade_item_iteminfo', get_string('iteminfo', 'grades'));
     $mform->addHelpButton('grade_item_iteminfo', 'iteminfo', 'grades');
     $mform->setType('grade_item_iteminfo', PARAM_TEXT);
     $mform->addElement('text', 'grade_item_idnumber', get_string('idnumbermod'));
     $mform->addHelpButton('grade_item_idnumber', 'idnumbermod');
     $mform->setType('grade_item_idnumber', PARAM_RAW);
     if (!empty($category->id)) {
         $gradecategory = grade_category::fetch(array('id' => $category->id));
         $gradeitem = $gradecategory->load_grade_item();
         // If grades exist set a message so the user knows why they can not alter the grade type or scale.
         // We could never change the grade type for external items, so only need to show this for manual grade items.
         if ($gradeitem->has_overridden_grades()) {
             // Set a message so the user knows why the can not alter the grade type or scale.
             if ($gradeitem->gradetype == GRADE_TYPE_SCALE) {
                 $gradesexistmsg = get_string('modgradecategorycantchangegradetyporscalemsg', 'grades');
             } else {
                 $gradesexistmsg = get_string('modgradecategorycantchangegradetypemsg', 'grades');
             }
             $notification = new \core\output\notification($gradesexistmsg, \core\output\notification::NOTIFY_INFO);
             $notification->set_show_closebutton(false);
             $mform->addElement('static', 'gradesexistmsg', '', $OUTPUT->render($notification));
         }
     }
     $options = array(GRADE_TYPE_NONE => get_string('typenone', 'grades'), GRADE_TYPE_VALUE => get_string('typevalue', 'grades'), GRADE_TYPE_SCALE => get_string('typescale', 'grades'), GRADE_TYPE_TEXT => get_string('typetext', 'grades'));
     $mform->addElement('select', 'grade_item_gradetype', get_string('gradetype', 'grades'), $options);
     $mform->addHelpButton('grade_item_gradetype', 'gradetype', 'grades');
     $mform->setDefault('grade_item_gradetype', GRADE_TYPE_VALUE);
     $mform->disabledIf('grade_item_gradetype', 'aggregation', 'eq', GRADE_AGGREGATE_SUM);
     //$mform->addElement('text', 'calculation', get_string('calculation', 'grades'));
     //$mform->disabledIf('calculation', 'gradetype', 'eq', GRADE_TYPE_TEXT);
     //$mform->disabledIf('calculation', 'gradetype', 'eq', GRADE_TYPE_NONE);
     $options = array(0 => get_string('usenoscale', 'grades'));
     if ($scales = grade_scale::fetch_all_local($COURSE->id)) {
         foreach ($scales as $scale) {
             $options[$scale->id] = $scale->get_name();
         }
     }
     if ($scales = grade_scale::fetch_all_global()) {
         foreach ($scales as $scale) {
             $options[$scale->id] = $scale->get_name();
         }
     }
     // ugly BC hack - it was possible to use custom scale from other courses :-(
     if (!empty($category->grade_item_scaleid) and !isset($options[$category->grade_item_scaleid])) {
         if ($scale = grade_scale::fetch(array('id' => $category->grade_item_scaleid))) {
             $options[$scale->id] = $scale->get_name() . ' ' . get_string('incorrectcustomscale', 'grades');
         }
     }
//.........这里部分代码省略.........
开发者ID:evltuma,项目名称:moodle,代码行数:101,代码来源:category_form.php


示例8: display_preview

 public function display_preview($require_user_idnumber = false)
 {
     global $OUTPUT;
     $userprofilefields = grade_helper::get_user_profile_fields($this->course->id, $this->usercustomfields);
     $formatoptions = new stdClass();
     $formatoptions->para = false;
     $exporttitle = array('Client Code', 'Client Name', 'Qualification Code', 'Unit Code', 'Unit Start Date', 'Unit End Date', 'Outcome Name', 'Outcome Code');
     echo $OUTPUT->heading(get_string('previewrows', 'grades'));
     echo '<table class="csv-table">';
     echo '<tr>';
     foreach ($exporttitle as $field) {
         echo '<th>' . $field . '</th>';
     }
     if (!$this->onlyactive) {
         echo '<th>' . get_string("suspended") . "</th>";
     }
     // foreach ($this->columns as $grade_item) {
     //     echo '<th>'.$this->format_column_name($grade_item).'</th>';
     //     /// add a column_feedback column
     //     if ($this->export_feedback) {
     //         echo '<th>'.$this->format_column_name($grade_item, true).'</th>';
     //     }
     // }
     echo '</tr>';
     /// Print all the lines of data.
     $i = 0;
     $gui = new graded_users_iterator($this->course, $this->columns, $this->groupid);
     $gui->require_active_enrolment($this->onlyactive);
     $gui->allow_user_custom_fields($this->usercustomfields);
     $gui->init();
     while ($userdata = $gui->next_user()) {
         // number of preview rows
         if ($this->previewrows and $this->previewrows <= $i) {
             break;
         }
         $user = $userdata->user;
         if ($require_user_idnumber and empty($user->idnumber)) {
             // some exports require user idnumber so we can match up students when importing the data
             continue;
         }
         $gradeupdated = false;
         // if no grade is update at all for this user, do not display this row
         $rowstr = '';
         foreach ($this->columns as $itemid => $grade_item) {
             $gradetxt = $this->format_grade($userdata->grades[$itemid]);
             $activity_start_date = $this->get_activity_start_date($this->course, $user, $grade_item);
             $grade_modified = $userdata->grades[$itemid]->timemodified;
             $client_code = $userdata->user->idnumber;
             $client_name = $userdata->user->firstname . ' ' . $userdata->user->lastname;
             // $course_code = $this->get_course_short_name($grade_item);
             $course_code = $this->course->idnumber;
             // $unit_code = $grade_item->itemname;
             $unit_code = $grade_item->idnumber;
             $unit_start = $activity_start_date ? $activity_start_date->format('d-m-Y') : '-';
             $unit_end = $grade_modified ? userdate($grade_modified, '%d-%m-%Y') : '-';
             $grade_name = $this->get_grade_name($gradetxt);
             if ($grade_item->itemtype == 'category') {
                 $category_start_date = $this->get_category_start_date($this->course, $user, $grade_item);
                 $unit_start = $category_start_date ? $category_start_date->format('d-m-Y') : '-';
             }
             // get the status of this grade, and put it through track to get the status
             $g = new grade_export_update_buffer();
             $grade_grade = new grade_grade(array('itemid' => $itemid, 'userid' => $user->id));
             $status = $g->track($grade_grade);
             if ($this->updatedgradesonly && ($status == 'nochange' || $status == 'unknown')) {
                 $rowstr .= '<td>' . get_string('unchangedgrade', 'grades') . '</td>';
             } else {
                 $rowstr .= "<tr>\n                                    <td>{$client_code}</td>\n                                    <td>{$client_name}</td>\n                                    <td>{$course_code}</td>\n                                    <td>{$unit_code}</td>\n                                    <td>{$unit_start}</td>\n                                    <td>{$unit_end}</td>\n                                    <td>{$grade_name}</td>\n                                    <td>{$gradetxt}</td>\n                                </tr>";
                 $gradeupdated = true;
             }
             if ($this->export_feedback) {
                 $rowstr .= '<td>' . $this->format_feedback($userdata->feedbacks[$itemid]) . '</td>';
             }
         }
         // if we are requesting updated grades only, we are not interested in this user at all
         if (!$gradeupdated && $this->updatedgradesonly) {
             continue;
         }
         echo '<tr>';
         echo $rowstr;
         echo "</tr>";
         $i++;
         // increment the counter
     }
     echo '</table>';
     $gui->close();
 }
开发者ID:abhiahirwar,项目名称:moodle_csv_report,代码行数:87,代码来源:grade_export_csv.php


示例9: print_grades

 public function print_grades()
 {
     global $CFG;
     $exporttracking = $this->track_exports();
     $course = $this->course;
     $strgrades = get_string('grades');
     $profilefields = grade_helper::get_user_profile_fields($this->course->id, $this->usercustomfields);
     $courseid = $course->id;
     $shortname = format_string($this->course->shortname, true, array('context' => context_course::instance($this->course->id)));
     $downloadfilename = clean_filename("{$shortname} {$strgrades}");
     $csvexport = new csv_export_writer($this->separator);
     $csvexport->filename = clean_filename("{$downloadfilename}.csv");
     // Print names of all the fields.
     $exporttitle = array();
     $shortname = format_string($this->course->shortname, true, array('context' => context_course::instance($this->course->id)));
     $exporttitle[] = $shortname . "";
     $csvexport->add_data($exporttitle);
     $exporttitle = array();
     $exporttitle[] = "TERM";
     $exporttitle[] = "Class Number";
     $exporttitle[] = "ID";
     $exporttitle[] = "Final Grade";
     $exporttitle[] = "" . get_string("firstname");
     $exporttitle[] = "" . get_string("lastname");
     $exporttitle[] = "" . get_string("idnumber");
     $exporttitle[] = "" . get_string("institution");
     $exporttitle[] = "" . get_string("department");
     $exporttitle[] = "" . get_string("email");
     foreach ($this->columns as $gradeitem) {
         $exporttitle[] = trim($gradeitem->get_name());
     }
     $csvexport->add_data($exporttitle);
     $sseat = $this->primcomp($courseid);
     // Print all the lines of data.
     $geub = new grade_export_update_buffer();
     $gui = new graded_users_iterator($this->course, $this->columns, $this->groupid);
     $gui->require_active_enrolment($this->onlyactive);
     $gui->allow_user_custom_fields($this->usercustomfields);
     $gui->init();
     while ($userdata = $gui->next_user()) {
         $exportdata = array();
         $user = $userdata->user;
         if (!isset($sseat[$user->username])) {
             continue;
         }
         foreach ($userdata->grades as $itemid => $grade) {
             if ($this->finalitemid == $itemid) {
                 $finalletter = $this->format_grade($userdata->grades[$itemid]);
                 if ($this->displaytype == 1) {
                     $userdata->grades[$itemid]->finalgrade = $finalletter;
                 }
             }
         }
         $coarr = explode('.', $sseat[$user->username]);
         $exportdata[] = $coarr[0];
         $exportdata[] = $coarr[1];
         $exportdata[] = $user->username;
         $exportdata[] = $finalletter;
         $exportdata[] = $user->firstname;
         $exportdata[] = $user->lastname;
         $exportdata[] = $user->idnumber;
         $exportdata[] = $user->institution;
         $exportdata[] = $user->department;
         $exportdata[] = $user->email;
         foreach ($userdata->grades as $itemid => $grade) {
             $gradestr = $userdata->grades[$itemid]->finalgrade;
             $exportdata[] = $gradestr;
         }
         $csvexport->add_data($exportdata);
     }
     $gui->close();
     $geub->close();
     $csvexport->download_file();
     exit;
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:75,代码来源:grade_export_uag.php


示例10: get_plugins_export

 /**
  * Get information export plugins
  * @param int $courseid
  * @return array
  */
 public static function get_plugins_export($courseid)
 {
     global $CFG;
     if (self::$exportplugins !== null) {
         return self::$exportplugins;
     }
     $context = context_course::instance($courseid);
     $exportplugins = array();
     if (has_capability('moodle/grade:export', $context)) {
         foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
             if (!has_capability('gradeexport/' . $plugin . ':view', $context)) {
                 continue;
             }
             $pluginstr = get_string('pluginname', 'gradeexport_' . $plugin);
             $url = new moodle_url('/grade/export/' . $plugin . '/index.php', array('id' => $courseid));
             $exportplugins[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
         }
         if ($CFG->gradepublishing) {
             $url = new moodle_url('/grade/export/keymanager.php', array('id' => $courseid));
             $exportplugins['keymanager'] = new grade_plugin_info('keymanager', $url, get_string('keymanager', 'grades'));
         }
     }
     if (count($exportplugins) > 0) {
         asort($exportplugins);
         self::$exportplugins = $exportplugins;
     } else {
         self::$exportplugins = false;
     }
     return self::$exportplugins;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:35,代码来源:lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP grade_item类代码示例发布时间:2022-05-23
下一篇:
PHP grade_grade类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap