本文整理汇总了PHP中MoodleODSWorkbook类 的典型用法代码示例。如果您正苦于以下问题:PHP MoodleODSWorkbook类的具体用法?PHP MoodleODSWorkbook怎么用?PHP MoodleODSWorkbook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MoodleODSWorkbook类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: user_download_ods
function user_download_ods($fields)
{
global $CFG, $SESSION, $DB;
require_once "{$CFG->libdir}/odslib.class.php";
require_once $CFG->dirroot . '/user/profile/lib.php';
$filename = clean_filename(get_string('users') . '.ods');
$workbook = new MoodleODSWorkbook('-');
$workbook->send($filename);
$worksheet = array();
$worksheet[0] =& $workbook->add_worksheet('');
$col = 0;
foreach ($fields as $fieldname) {
$worksheet[0]->write(0, $col, $fieldname);
$col++;
}
$row = 1;
foreach ($SESSION->bulk_users as $userid) {
if (!($user = $DB->get_record('user', array('id' => $userid)))) {
continue;
}
$col = 0;
profile_load_data($user);
foreach ($fields as $field => $unused) {
$worksheet[0]->write($row, $col, $user->{$field});
$col++;
}
$row++;
}
$workbook->close();
die;
}
开发者ID:nmicha, 项目名称:moodle, 代码行数:31, 代码来源:user_bulk_download.php
示例2: user_download_ods
function user_download_ods($fields, $extrafields = array())
{
global $CFG, $SESSION, $DB;
require_once "{$CFG->libdir}/odslib.class.php";
require_once $CFG->dirroot . '/user/profile/lib.php';
$filename = clean_filename(get_string('users') . '.ods');
$workbook = new MoodleODSWorkbook('-');
$workbook->send($filename);
$worksheet = array();
$worksheet[0] = $workbook->add_worksheet('');
$col = 0;
foreach ($fields as $fieldname) {
$worksheet[0]->write(0, $col, $fieldname);
$col++;
}
$extrafield_sql = '';
foreach ($extrafields as $n => $v) {
$extrafield_sql .= " MAX(IF(muif.shortname = '" . $v->shortname . "', muid.data, NULL)) profile_field_" . $v->shortname . ",";
}
$extrafield_sql = rtrim($extrafield_sql, ",");
$idstoload = $SESSION->bulk_users;
$users = array();
foreach (array_chunk($idstoload, 10000, true) as $user_id) {
$userids = implode(",", $user_id);
$users[] = $DB->get_records_sql("SELECT mu.*,\r\n {$extrafield_sql}\r\n FROM mdl_user AS mu\r\n LEFT JOIN mdl_user_info_data AS muid ON mu.id = muid.userid\r\n LEFT JOIN mdl_user_info_field AS muif ON muif.id = muid.fieldid\r\n WHERE mu.id IN ({$userids}) GROUP BY mu.id");
}
$row = 1;
foreach ($users as $userdetails) {
foreach ($userdetails as $user) {
#if (!$user = $DB->get_record('user', array('id'=>$userid))) {
#continue;
#}
$col = 0;
#profile_load_data($user,$userfields);
foreach ($fields as $field => $unused) {
$worksheet[0]->write($row, $col, $user->{$field});
$col++;
}
$row++;
}
}
$workbook->close();
die;
}
开发者ID:vinoth4891, 项目名称:clinique, 代码行数:44, 代码来源:user_bulk_download_list.php
示例3: export_report
/** Configurable Reports
* A Moodle block for creating customizable reports
* @package blocks
* @author: Juan leyva <http://www.twitter.com/jleyvadelgado>
* @date: 2009
*/
function export_report($report) {
global $DB, $CFG;
require_once($CFG->dirroot . '/lib/odslib.class.php');
$table = $report->table;
$matrix = array();
$filename = 'report_' . (time()) . '.ods';
if (!empty($table->head)) {
$countcols = count($table->head);
$keys = array_keys($table->head);
$lastkey = end($keys);
foreach ($table->head as $key => $heading) {
$matrix[0][$key] = str_replace("\n", ' ', htmlspecialchars_decode(strip_tags(nl2br($heading))));
}
}
if (!empty($table->data)) {
foreach ($table->data as $rkey => $row) {
foreach ($row as $key => $item) {
$matrix[$rkey + 1][$key] = str_replace("\n", ' ', htmlspecialchars_decode(strip_tags(nl2br($item))));
}
}
}
$downloadfilename = clean_filename($filename);
/// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
/// Sending HTTP headers
$workbook->send($downloadfilename);
/// Adding the worksheet
$myxls = & $workbook->add_worksheet($filename);
foreach ($matrix as $ri => $col) {
foreach ($col as $ci => $cv) {
$myxls->write_string($ri, $ci, $cv);
}
}
$workbook->close();
exit;
}
开发者ID:narasimhaeabyas, 项目名称:tataaiapro, 代码行数:48, 代码来源:export.php
示例4: groups_get_activity_groupmode
$groupmode = groups_get_activity_groupmode($cm);
}
add_to_log($course->id, 'certificate', 'view', "report.php?id={$cm->id}", '$certificate->id', $cm->id);
// Ensure there are issues to display, if not display notice
if (!($users = certificate_get_issues($certificate->id, $DB->sql_fullname(), $groupmode, $cm))) {
echo $OUTPUT->header();
notify(get_string('nocertificatesissued', 'certificate'));
echo $OUTPUT->footer($course);
exit;
}
if ($download == "ods") {
require_once "{$CFG->libdir}/odslib.class.php";
// Calculate file name
$filename = clean_filename("{$course->shortname} " . strip_tags(format_string($certificate->name, true))) . '.ods';
// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
// Send HTTP headers
$workbook->send($filename);
// Creating the first worksheet
$myxls =& $workbook->add_worksheet($strreport);
// Print names of all the fields
$myxls->write_string(0, 0, get_string("lastname"));
$myxls->write_string(0, 1, get_string("firstname"));
$myxls->write_string(0, 2, get_string("idnumber"));
$myxls->write_string(0, 3, get_string("group"));
$myxls->write_string(0, 4, $strdate);
$myxls->write_string(0, 5, $strgrade);
$myxls->write_string(0, 6, $strcode);
// Generate the data for the body of the spreadsheet
$i = 0;
$row = 1;
开发者ID:noisyjerm, 项目名称:moodle-mod_certificate, 代码行数:31, 代码来源:report.php
示例5: Export_ODS
function Export_ODS(&$questions, $filename)
{
global $CFG;
require_once "{$CFG->libdir}/odslib.class.php";
/// Calculate file name
$filename .= ".ods";
/// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
/// Sending HTTP headers
$workbook->send($filename);
/// Creating the first worksheet
$sheettitle = get_string('reportanalysis', 'quiz_analysis');
$myxls =& $workbook->add_worksheet($sheettitle);
/// format types
$format =& $workbook->add_format();
$format->set_bold(0);
$formatbc =& $workbook->add_format();
$formatbc->set_bold(1);
$formatb =& $workbook->add_format();
$formatb->set_bold(1);
$formaty =& $workbook->add_format();
$formaty->set_bg_color('yellow');
$formatyc =& $workbook->add_format();
$formatyc->set_bg_color('yellow');
//bold text on yellow bg
$formatyc->set_bold(1);
$formatyc->set_align('center');
$formatc =& $workbook->add_format();
$formatc->set_align('center');
$formatbc->set_align('center');
$formatbpct =& $workbook->add_format();
$formatbpct->set_bold(1);
$formatbpct->set_num_format('0.0%');
$formatbrt =& $workbook->add_format();
$formatbrt->set_bold(1);
$formatbrt->set_align('right');
$formatred =& $workbook->add_format();
$formatred->set_bold(1);
$formatred->set_color('red');
$formatred->set_align('center');
$formatblue =& $workbook->add_format();
$formatblue->set_bold(1);
$formatblue->set_color('blue');
$formatblue->set_align('center');
/// Here starts workshhet headers
$myxls->write_string(0, 0, $sheettitle, $formatb);
$headers = array(get_string('qidtitle', 'quiz_analysis'), get_string('qtypetitle', 'quiz_analysis'), get_string('qnametitle', 'quiz_analysis'), get_string('qtexttitle', 'quiz_analysis'), get_string('responsestitle', 'quiz_analysis'), get_string('rfractiontitle', 'quiz_analysis'), get_string('rcounttitle', 'quiz_analysis'), get_string('rpercenttitle', 'quiz_analysis'), get_string('qcounttitle', 'quiz_analysis'), get_string('facilitytitle', 'quiz_analysis'), get_string('stddevtitle', 'quiz_analysis'), get_string('dicsindextitle', 'quiz_analysis'), get_string('disccoefftitle', 'quiz_analysis'));
foreach ($headers as $key => $header) {
$headers[$key] = preg_replace('/<br[^>]*>/', ' ', $header);
}
$col = 0;
foreach ($headers as $item) {
$myxls->write(2, $col, $item, $formatbc);
$col++;
}
$row = 3;
foreach ($questions as $q) {
$rows = $this->print_row_stats_data($q);
foreach ($rows as $rowdata) {
$col = 0;
foreach ($rowdata as $item) {
$myxls->write($row, $col, $item, $format);
$col++;
}
$row++;
}
}
/// Close the workbook
$workbook->close();
exit;
}
开发者ID:veritech, 项目名称:pare-project, 代码行数:71, 代码来源:report.php
示例6: data_export_ods
/**
* @global object
* @param array $export
* @param string $dataname
* @param int $count
* @param string
*/
function data_export_ods($export, $dataname, $count) {
global $CFG;
require_once("$CFG->libdir/odslib.class.php");
$filename = clean_filename("{$dataname}-{$count}_record");
if ($count > 1) {
$filename .= 's';
}
$filename .= clean_filename('-' . gmdate("Ymd_Hi"));
$filename .= '.ods';
$filearg = '-';
$workbook = new MoodleODSWorkbook($filearg);
$workbook->send($filename);
$worksheet = array();
$worksheet[0] =& $workbook->add_worksheet('');
$rowno = 0;
foreach ($export as $row) {
$colno = 0;
foreach($row as $col) {
$worksheet[0]->write($rowno, $colno, $col);
$colno++;
}
$rowno++;
}
$workbook->close();
return $filename;
}
开发者ID:nottmoo, 项目名称:moodle, 代码行数:33, 代码来源:lib.php
示例7: print_log_ods
function print_log_ods($course, $user, $date, $order = 'l.time DESC', $modname, $modid, $modaction, $groupid)
{
global $CFG, $DB;
require_once "{$CFG->libdir}/odslib.class.php";
if (!($logs = build_logs_array($course, $user, $date, $order, '', '', $modname, $modid, $modaction, $groupid))) {
return false;
}
$courses = array();
if ($course->id == SITEID) {
$courses[0] = '';
if ($ccc = get_courses('all', 'c.id ASC', 'c.id,c.shortname')) {
foreach ($ccc as $cc) {
$courses[$cc->id] = $cc->shortname;
}
}
} else {
$courses[$course->id] = $course->shortname;
}
$count = 0;
$ldcache = array();
$tt = getdate(time());
$today = mktime(0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
$strftimedatetime = get_string("strftimedatetime");
$nroPages = ceil(count($logs) / (EXCELROWS - FIRSTUSEDEXCELROW + 1));
$filename = 'logs_' . userdate(time(), get_string('backupnameformat', 'langconfig'), 99, false);
$filename .= '.ods';
$workbook = new MoodleODSWorkbook('-');
$workbook->send($filename);
$worksheet = array();
$headers = array(get_string('course'), get_string('time'), get_string('ip_address'), get_string('fullnameuser'), get_string('action'), get_string('info'));
// Creating worksheets
for ($wsnumber = 1; $wsnumber <= $nroPages; $wsnumber++) {
$sheettitle = get_string('logs') . ' ' . $wsnumber . '-' . $nroPages;
$worksheet[$wsnumber] =& $workbook->add_worksheet($sheettitle);
$worksheet[$wsnumber]->set_column(1, 1, 30);
$worksheet[$wsnumber]->write_string(0, 0, get_string('savedat') . userdate(time(), $strftimedatetime));
$col = 0;
foreach ($headers as $item) {
$worksheet[$wsnumber]->write(FIRSTUSEDEXCELROW - 1, $col, $item, '');
$col++;
}
}
if (empty($logs['logs'])) {
$workbook->close();
return true;
}
$formatDate =& $workbook->add_format();
$formatDate->set_num_format(get_string('log_excel_date_format'));
$row = FIRSTUSEDEXCELROW;
$wsnumber = 1;
$myxls =& $worksheet[$wsnumber];
foreach ($logs['logs'] as $log) {
if (isset($ldcache[$log->module][$log->action])) {
$ld = $ldcache[$log->module][$log->action];
} else {
$ld = $DB->get_record('log_display', array('module' => $log->module, 'action' => $log->action));
$ldcache[$log->module][$log->action] = $ld;
}
if ($ld && !empty($log->info)) {
// ugly hack to make sure fullname is shown correctly
if ($ld->mtable == 'user' and $ld->field == $DB->sql_concat('firstname', "' '", 'lastname')) {
$log->info = fullname($DB->get_record($ld->mtable, array('id' => $log->info)), true);
} else {
$log->info = $DB->get_field($ld->mtable, $ld->field, array('id' => $log->info));
}
}
// Filter log->info
$log->info = format_string($log->info);
$log->info = strip_tags(urldecode($log->info));
// Some XSS protection
if ($nroPages > 1) {
if ($row > EXCELROWS) {
$wsnumber++;
$myxls =& $worksheet[$wsnumber];
$row = FIRSTUSEDEXCELROW;
}
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$myxls->write_string($row, 0, format_string($courses[$log->course], true, array('context' => $coursecontext)));
$myxls->write_date($row, 1, $log->time);
$myxls->write_string($row, 2, $log->ip);
$fullname = fullname($log, has_capability('moodle/site:viewfullnames', $coursecontext));
$myxls->write_string($row, 3, $fullname);
$myxls->write_string($row, 4, $log->module . ' ' . $log->action);
$myxls->write_string($row, 5, $log->info);
$row++;
}
$workbook->close();
return true;
}
开发者ID:numbas, 项目名称:moodle, 代码行数:90, 代码来源:lib.php
示例8: display
//.........这里部分代码省略.........
// This is done to prevent redundant data, when a user has multiple attempts
$table->column_suppress('picture');
$table->column_suppress('fullname');
foreach ($extrafields as $field) {
$table->column_suppress($field);
}
$table->no_sorting('start');
$table->no_sorting('finish');
$table->no_sorting('score');
foreach ($scoes as $sco) {
if ($sco->launch != '') {
$table->no_sorting('scograde'.$sco->id);
}
}
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'bold');
$table->column_class('score', 'bold');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'generaltable generalbox');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
} else if ($download == 'ODS') {
require_once("$CFG->libdir/odslib.class.php");
$filename .= ".ods";
// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
// Sending HTTP headers
$workbook->send($filename);
// Creating the first worksheet
$sheettitle = get_string('report', 'scorm');
$myxls =& $workbook->add_worksheet($sheettitle);
// format types
$format =& $workbook->add_format();
$format->set_bold(0);
$formatbc =& $workbook->add_format();
$formatbc->set_bold(1);
$formatbc->set_align('center');
$formatb =& $workbook->add_format();
$formatb->set_bold(1);
$formaty =& $workbook->add_format();
$formaty->set_bg_color('yellow');
$formatc =& $workbook->add_format();
$formatc->set_align('center');
$formatr =& $workbook->add_format();
$formatr->set_bold(1);
$formatr->set_color('red');
$formatr->set_align('center');
$formatg =& $workbook->add_format();
$formatg->set_bold(1);
$formatg->set_color('green');
$formatg->set_align('center');
// Here starts workshhet headers
$colnum = 0;
foreach ($headers as $item) {
$myxls->write(0, $colnum, $item, $formatbc);
$colnum++;
}
开发者ID:numbas, 项目名称:moodle, 代码行数:67, 代码来源:report.php
示例9: display
//.........这里部分代码省略.........
$number += $questions[$id]->length;
} else {
// Get rid of zero length questions.
unset($questions[$id]);
unset($questionids[$key]);
}
}
}
if ($hasfeedback) {
$tablecolumns[] = 'feedbacktext';
$tableheaders[] = get_string('feedback', 'game');
}
if (!$download) {
// Set up the table.
$table = new flexible_table('mod-game-report-overview-report');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($CFG->wwwroot . '/mod/game/report.php?mode=overview&id=' . $cm->id . '&noattempts=' . $noattempts . '&detailedmarks=' . $detailedmarks . '&pagesize=' . $pagesize);
$table->sortable(true);
$table->collapsible(true);
$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_class('picture', 'picture');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'generaltable generalbox');
// Start working -- this is necessary as soon as the niceties are over.
$table->setup();
} else {
if ($download == 'ODS') {
require_once "{$CFG->libdir}/odslib.class.php";
$filename .= ".ods";
// Creating a workbook.
$workbook = new MoodleODSWorkbook("-");
// Sending HTTP headers.
$workbook->send($filename);
// Creating the first worksheet.
$sheettitle = get_string('reportoverview', 'game');
$myxls =& $workbook->add_worksheet($sheettitle);
// Format types.
$format =& $workbook->add_format();
$format->set_bold(0);
$formatbc =& $workbook->add_format();
$formatbc->set_bold(1);
$formatbc->set_align('center');
$formatb =& $workbook->add_format();
$formatb->set_bold(1);
$formaty =& $workbook->add_format();
$formaty->set_bg_color('yellow');
$formatc =& $workbook->add_format();
$formatc->set_align('center');
$formatr =& $workbook->add_format();
$formatr->set_bold(1);
$formatr->set_color('red');
$formatr->set_align('center');
$formatg =& $workbook->add_format();
$formatg->set_bold(1);
$formatg->set_color('green');
$formatg->set_align('center');
// Here starts workshhet headers.
$headers = array(get_string('fullname'), get_string('startedon', 'game'), get_string('timecompleted', 'game'), get_string('attemptduration', 'game'));
if ($game->grade) {
$headers[] = get_string('grade', 'game') . '/' . $game->grade;
}
if ($detailedmarks) {
foreach ($questionids as $id) {
开发者ID:antoniorodrigues, 项目名称:redes-digitais, 代码行数:67, 代码来源:report.php
示例10: print_grades
/**
* To be implemented by child classes
*/
function print_grades()
{
global $CFG;
require_once $CFG->dirroot . '/lib/odslib.class.php';
$export_tracking = $this->track_exports();
$strgrades = get_string('grades');
$shortname = format_string($this->course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $this->course->id)));
/// Calculate file name
$downloadfilename = clean_filename("{$shortname} {$strgrades}.ods");
/// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
/// Sending HTTP headers
$workbook->send($downloadfilename);
/// Adding the worksheet
$myxls = $workbook->add_worksheet($strgrades);
/// Print names of all the fields
$myxls->write_string(0, 0, get_string("firstname"));
$myxls->write_string(0, 1, get_string("lastname"));
$myxls->write_string(0, 2, get_string("idnumber"));
$myxls->write_string(0, 3, get_string("institution"));
$myxls->write_string(0, 4, get_string("department"));
$myxls->write_string(0, 5, get_string("email"));
$pos = 6;
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->init();
while ($userdata = $gui->next_user()) {
$i++;
$user = $userdata->user;
$myxls->write_string($i, 0, $user->firstname);
$myxls->write_string($i, 1, $user->lastname);
$myxls->write_string($i, 2, $user->idnumber);
$myxls->write_string($i, 3, $user->institution);
$myxls->write_string($i, 4, $user->department);
$myxls->write_string($i, 5, $user->email);
$j = 6;
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:saurabh947, 项目名称:MoodleLearning, 代码行数:71, 代码来源:grade_export_ods.php
示例11: markdown_to_html
* Excel 2007 borders appear too thick in LibreOffice
* Excel 2007 can not be opened in Calligra Suite
';
echo markdown_to_html($notes);
echo $OUTPUT->box_end();
echo $OUTPUT->single_button(new moodle_url($PAGE->url, array('type' => 'excel2007')), 'Test Excel 2007 format');
echo $OUTPUT->single_button(new moodle_url($PAGE->url, array('type' => 'ods')), 'Test ODS format');
echo $OUTPUT->footer();
die;
}
if ($type === 'excel2007') {
$workbook = new MoodleExcelWorkbook('moodletest.xlsx', 'Excel2007');
} else {
if ($type === 'ods') {
$workbook = new MoodleODSWorkbook('moodletest.ods');
}
}
$worksheet = array();
$worksheet = $workbook->add_worksheet('Supported');
$worksheet->hide_screen_gridlines();
$worksheet->write_string(0, 0, 'Moodle worksheet export test', $workbook->add_format(array('color' => 'red', 'size' => 20, 'bold' => 1, 'italic' => 1)));
$worksheet->set_row(0, 25);
$worksheet->write(1, 0, 'Moodle release: ' . $CFG->release, $workbook->add_format(array('size' => 8, 'italic' => 1)));
$worksheet->set_column(0, 0, 20);
$worksheet->set_column(1, 1, 30);
$worksheet->set_column(2, 2, 5);
$worksheet->set_column(3, 3, 30);
$worksheet->set_column(4, 4, 20);
$miniheading = $workbook->add_format(array('size' => 15, 'bold' => 1, 'italic' => 1, 'underline' => 1));
$worksheet->write(2, 0, 'Cell types', $miniheading);
开发者ID:evltuma, 项目名称:moodle, 代码行数:30, 代码来源:spreadsheettestpage.php
示例12: grade_download
function grade_download($download, $id)
{
global $CFG;
require_login();
if (!($course = get_record("course", "id", $id))) {
error("Course ID was incorrect");
}
require_capability('moodle/course:viewcoursegrades', get_context_instance(CONTEXT_COURSE, $id));
$strgrades = get_string("grades");
$strgrade = get_string("grade");
$strmax = get_string("maximumshort");
$stractivityreport = get_string("activityreport");
/// Check to see if groups are being used in this course
$currentgroup = get_current_group($course->id);
if (($currentgroup = get_current_group($course->id)) && groupmode($course) != 0) {
$students = get_group_students($currentgroup, "u.lastname ASC");
} else {
$students = grade_get_course_students($course->id);
}
if (!empty($students)) {
foreach ($students as $student) {
$grades[$student->id] = array();
// Collect all grades in this array
$gradeshtml[$student->id] = array();
// Collect all grades html formatted in this array
$totals[$student->id] = array();
// Collect all totals in this array
}
}
$columns = array();
// Accumulate column names in this array.
$columnhtml = array();
// Accumulate column html in this array.
/// Collect modules data
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
/// Search through all the modules, pulling out grade data
$sections = get_all_sections($course->id);
// Sort everything the same as the course
for ($i = 0; $i <= $course->numsections; $i++) {
if (isset($sections[$i])) {
// should always be true
$section = $sections[$i];
if ($section->sequence) {
$sectionmods = explode(",", $section->sequence);
foreach ($sectionmods as $sectionmod) {
$mod = $mods[$sectionmod];
$instance = get_record("{$mod->modname}", "id", "{$mod->instance}");
$libfile = "{$CFG->dirroot}/mod/{$mod->modname}/lib.php";
if (file_exists($libfile)) {
require_once $libfile;
$gradefunction = $mod->modname . "_grades";
if (function_exists($gradefunction)) {
// Skip modules without grade function
if ($modgrades = $gradefunction($mod->instance)) {
if (!empty($modgrades->maxgrade)) {
if ($mod->visible) {
$maxgrade = "{$strmax}: {$modgrades->maxgrade}";
} else {
$maxgrade = "{$strmax}: {$modgrades->maxgrade}";
}
} else {
$maxgrade = "";
}
$columns[] = "{$mod->modfullname}: " . format_string($instance->name, true) . " - {$maxgrade}";
if (!empty($students)) {
foreach ($students as $student) {
if (!empty($modgrades->grades[$student->id])) {
$grades[$student->id][] = $currentstudentgrade = $modgrades->grades[$student->id];
} else {
$grades[$student->id][] = $currentstudentgrade = "";
$gradeshtml[$student->id][] = "";
}
if (!empty($modgrades->maxgrade)) {
$totals[$student->id] = (double) $totals[$student->id] + (double) $currentstudentgrade;
} else {
$totals[$student->id] = (double) $totals[$student->id] + 0;
}
}
}
}
}
}
}
}
}
}
// a new Moodle nesting record? ;-)
/// OK, we have all the data, now present it to the user
/// OK, we have all the data, now present it to the user
if ($download == "ods" and confirm_sesskey()) {
require_once "../lib/odslib.class.php";
/// Calculate file name
$downloadfilename = clean_filename("{$course->shortname} {$strgrades}.ods");
/// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
/// Sending HTTP headers
$workbook->send($downloadfilename);
/// Adding the worksheet
$myxls =& $workbook->add_worksheet($strgrades);
/// Print names of all the fields
//.........这里部分代码省略.........
开发者ID:veritech, 项目名称:pare-project, 代码行数:101, 代码来源:lib.php
示例13: get_coursemodule_from_instance
$cm = get_coursemodule_from_instance('scormfull', $scormfull->id, $course->id, false, MUST_EXIST);
} else {
error('You must specify a course_module ID or an scormfull ID');
}
}
$quiz = $DB->get_record('quiz', array("id" => $scormfull->quid), '*', MUST_EXIST);
require_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!has_capability('mod/scormfull:manage', $context)) {
redirect("{$CFG->wwwroot}/mod/scormfull/user.php?id={$id}");
}
$tt = getdate(time());
$today = mktime(0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
$filename = 'scormfull' . userdate(time(), get_string('backupnameformat'), 99, false);
$filename .= '.ods';
$workbook = new MoodleODSWorkbook('-');
$workbook->send($filename);
$worksheet = array();
$sheettitle = 'scormfull';
$worksheet =& $workbook->add_worksheet($sheettitle);
$struen_name = get_string('struen_name', 'scormfull');
$strthreshold_boo = get_string('threshold_boo', 'scormfull');
$Thresholdvalue = get_string('Thresholdvalue', 'scormfull');
$scrom_name = get_string('scrom_name', 'scormfull');
$starnopass = get_string('starnopass', 'scormfull');
$connected_exam = get_string('connected_exam', 'scormfull');
$strsetvalue = get_string('strsetvalue', 'scormfull');
$cssting = get_string('curriculum_standards_setting', 'scormfull');
$hours_of_the_event = get_string('hours_of_the_event', 'scormfull');
$through_standard_assessment = get_string('through_standard_assessment', 'scormfull');
$scorm_quiz_score = get_string('scorm_quiz_score', 'scormfull');
开发者ID:stepsgithub, 项目名称:moodle-mod_scormfull, 代码行数:31, 代码来源:print_view.php
示例14: print_coursereport_ods
function print_coursereport_ods($coursereport_ods)
{
global $CFG;
require_once "{$CFG->libdir}/odslib.class.php";
//release coursereport ods data
$courseID = $coursereport_ods->courseID;
$courseName = $coursereport_ods->courseName;
$categoryName = $coursereport_ods->categoryName;
$userIDDataArray = $coursereport_ods->userIDDataArray;
$actionIDNameArray = $coursereport_ods->actionIDNameArray;
$courseUserArray = $coursereport_ods->courseUserArray;
$userPassArray = $coursereport_ods->userPassArray;
$tt = getdate(time());
$today = mktime(0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
$filename = 'course_reports_' . userdate(time(), get_string('backupnameformat', 'langconfig'), 99, false);
$filename .= '.ods';
$workbook = new MoodleODSWorkbook('-');
$workbook->send($filename);
$worksheet = array();
// Creating worksheets
$sheettitle = 'course_report';
//紀錄1-1
$worksheet =& $workbook->add_worksheet($sheettitle);
$worksheet->set_column(1, 1, 60);
$worksheet->write_string(0, 0, $categoryName);
$worksheet->write_string(1, 0, $courseName);
$col = 0;
$row = 4;
$headerArray = processCourseReportHeader($courseUserArray, $actionIDNameArray);
foreach ($headerArray as $item) {
$worksheet->write($row - 1, $col, $item, '');
$col++;
}
$myxls =& $worksheet;
foreach ($courseUserArray as $userID => $actionInfo) {
$col = 0;
$myxls->write_string($row, $col, $userIDDataArray[$userID]['name']);
$col++;
$myxls->write_string($row, $col, $userIDDataArray[$userID]['description']);
$col++;
$myxls->write_string($row, $col, $userIDDataArray[$userID]['email']);
$col++;
foreach ($actionInfo as $actionID => $actionContent) {
if ($actionContent['timeEnable']) {
$myxls->write_string($row, $col, $actionContent['time']);
$col++;
}
if ($actionContent['scoreEnable']) {
$myxls->write_string($row, $col, $actionContent['score']);
$col++;
}
if ($actionContent['timePass'] and $actionContent['scorePass']) {
$myxls->write_string($row, $col, '通過');
$col++;
} else {
$myxls->write_string($row, $col, '不通過');
$col++;
}
}
$myxls->write_string($row, $col, $userPassArray[$userID] ? '通過' : '不通過');
$col++;
$row++;
}
$workbook->close();
return true;
}
开发者ID:stepsgithub, 项目名称:moodle-block_report_module, 代码行数:66, 代码来源:ods.php
示例15: print_grades
/**
* To be implemented by child classes
*/
function print_grades()
{
global $CFG;
require_once $CFG->dirroot . '/lib/odslib.class.php';
$export_tracking = $this->track_exports();
$strgrades = get_string('grades');
$shortname = format_string($this->course->shortname, true, array('context' => context_course::instance($this->course->id)));
// Calculate file name
$downloadfilename = clean_filename("{$shortname} {$strgrades}.ods");
// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
// 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:abhilash1994, 项目名称:moodle, 代码行数:75, 代码来源:grade_export_ods.php
示例16: display
//.........这里部分代码省略.........
$table->collapsible(true);
// This is done to prevent redundant data, when a user has multiple attempts.
$table->column_suppress('picture');
$table->column_suppress('fullname');
foreach ($extrafields as $field) {
$table->column_suppress($field);
}
foreach ($nosort as $field) {
$table->no_sorting($field);
}
$table->no_sorting('start');
$table->no_sorting('finish');
$table->no_sorting('score');
$table->no_sorting('checkbox');
$table->no_sorting('picture');
foreach ($scoes as $sco) {
if ($sco->launch != '') {
$table->no_sorting('scograde' . $sco->id);
}
}
$table->column_class('picture', 'picture');
$table->column_class('fullname', 'bold');
$table->column_class('score', 'bold');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'generaltable generalbox');
// Start working -- this is necessary as soon as the niceties are over.
$table->setup();
} else {
if ($download == 'ODS') {
require_once "{$CFG->libdir}/odslib.class.php";
$filename .= ".ods";
// Creating a workbook.
$workbook = new \MoodleODSWorkbook("-");
// Sending HTTP headers.
$workbook->send($filename);
// Creating the first worksheet.
$sheettitle = get_string('report', 'scorm');
$myxls = $workbook->add_worksheet($sheettitle);
// Format types.
$format = $workbook->add_format();
$format->set_bold(0);
$formatbc = $workbook->add_format();
$formatbc->set_bold(1);
$formatbc->set_align('center');
$formatb = $workbook->add_format();
$formatb->set_bold(1);
$formaty = $workbook->add_format();
$formaty->set_bg_color('yellow');
$formatc = $workbook->add_format();
$formatc->set_align('center');
$formatr = $workbook->add_format();
$formatr->set_bold(1);
$formatr->set_color('red');
$formatr->set_align('center');
$formatg = $workbook->add_format();
$formatg->set_bold(1);
$formatg->set_color('green');
$formatg->set_align('center');
// Here starts workshhet headers.
$colnum = 0;
foreach ($headers as $item) {
$myxls->write(0, $colnum, $item, $formatbc);
$colnum++;
}
$rownum = 1;
开发者ID:lucaboesch, 项目名称:moodle, 代码行数:67, 代码来源:report.php
LaravelDaily/Laravel-Roadmap-Learning-Path
阅读:608| 2022-08-12
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1222| 2022-08-30
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1135| 2022-08-17
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:946| 2022-11-06
上次说到我想为DirectUI增加脚本支持,今天我们就来研究下脚本的实现问题。
虽然现在
阅读:631| 2022-07-18
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1343| 2022-08-18
IBM Engineering Requirements Quality Assistant On-Premises (All versions) could
阅读:583| 2022-07-29
learn-co-students/intro-to-redux-library-codealong-v-000
阅读:984| 2022-08-15
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:490| 2022-08-16
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:644| 2022-11-06
请发表评论