本文整理汇总了PHP中Export::export_table_csv方法的典型用法代码示例。如果您正苦于以下问题:PHP Export::export_table_csv方法的具体用法?PHP Export::export_table_csv怎么用?PHP Export::export_table_csv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Export
的用法示例。
在下文中一共展示了Export::export_table_csv方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_lang
} else {
$csv_headers[] = get_lang('LastName', '');
$csv_headers[] = get_lang('FirstName', '');
}
$csv_headers[] = get_lang('Login', ''); //
$csv_headers[] = get_lang('TrainingTime', '');
$csv_headers[] = get_lang('CourseProgress', '');
$csv_headers[] = get_lang('ExerciseProgress', '');
$csv_headers[] = get_lang('ExerciseAverage', '');
$csv_headers[] = get_lang('Score', '');
$csv_headers[] = get_lang('Student_publication', '');
$csv_headers[] = get_lang('Messages', '');
if (empty($session_id)) {
$csv_headers[] = get_lang('Survey');
}
$csv_headers[] = get_lang('FirstLogin', '');
$csv_headers[] = get_lang('LatestLogin', '');
if (isset($_GET['additional_profile_field']) AND is_numeric($_GET['additional_profile_field'])) {
$csv_headers[] = $extra_info['field_display_text'];
}
ob_end_clean();
array_unshift($csv_content, $csv_headers); // Adding headers before the content.
Export::export_table_csv($csv_content, 'reporting_student_list');
exit;
}
Display::display_footer();
示例2: api_format_date
$data['username'] = $userinfo['username'];
//$result->get_user_id();
$data['official_code'] = $userinfo['official_code'];
$data['lastname'] = $userinfo['lastname'];
$data['firstname'] = $userinfo['firstname'];
$data['score'] = $result->get_score();
$data['date'] = api_format_date($result->get_date(), "%d/%m/%Y %R");
$alldata[] = $data;
}
switch ($file_type) {
case 'xml':
Export::export_table_xml($alldata, $filename, 'Result', 'XMLResults');
exit;
break;
case 'csv':
Export::export_table_csv($alldata, $filename);
exit;
break;
}
}
}
if (isset($_GET['resultdelete'])) {
$result = Result::load($_GET['resultdelete']);
$result[0]->delete();
header('Location: gradebook_view_result.php?deleteresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
if (isset($_POST['action'])) {
$number_of_selected_items = count($_POST['id']);
if ($number_of_selected_items == '0') {
Display::display_warning_message(get_lang('NoItemsSelected'), false);
示例3: PDF
exit;
break;
case 'export_pdf':
$content = GroupManager::getOverview($courseId, $keyword);
$pdf = new PDF();
$extra = '<div style="text-align:center"><h2>' . get_lang('GroupList') . '</h2></div>';
$extra .= '<strong>' . get_lang('Course') . ': </strong>' . $courseInfo['title'] . ' (' . $courseInfo['code'] . ')';
$content = $extra . $content;
$pdf->content_to_pdf($content, null, null, api_get_course_id());
break;
case 'export':
$groupId = isset($_GET['id']) ? intval($_GET['id']) : null;
$data = GroupManager::exportCategoriesAndGroupsToArray($groupId, true);
switch ($_GET['type']) {
case 'csv':
Export::export_table_csv($data);
exit;
break;
case 'xls':
if (!empty($data)) {
Export::export_table_xls($data);
exit;
}
break;
}
break;
}
}
/* Header */
$interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups'));
if (!isset($_GET['origin']) || $_GET['origin'] != 'learnpath') {
示例4: getLpStats
//.........这里部分代码省略.........
}
}
// NOT Extend all "left green cross"
if (!empty($a_my_id)) {
if ($extendedAttempt) {
// "Right green cross" extended
$total_score = self::get_avg_student_score(
$user_id,
$course_id,
$a_my_id,
$session_id,
false,
false
);
} else {
// "Left green cross" extended
$total_score = self::get_avg_student_score(
$user_id,
$course_id,
$a_my_id,
$session_id,
false,
true
);
}
} else {
// Extend all "left green cross"
$total_score = self::get_avg_student_score(
$user_id,
$course_id,
array($lp_id),
$session_id,
false,
false
);
}
$total_time = learnpathItem::getScormTimeFromParameter('js', $total_time);
$total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
} else {
if (is_numeric($total_score)) {
$final_score = $total_score . '%';
} else {
$final_score = $total_score;
}
}
$progress = learnpath::getProgress($lp_id, $user_id, $course_id, $session_id);
if (($counter % 2) == 0) {
$oddclass = 'row_odd';
} else {
$oddclass = 'row_even';
}
$action = null;
if ($type == 'classic') {
$action = '<td></td>';
}
$output .= '<tr class="'.$oddclass.'">
<td></td>
<td colspan="4">
<i>' . get_lang('AccomplishedStepsTotal') .'</i>
</td>
<td colspan="2">'.$progress.'%</td>
<td colspan="2">
' . $final_score.'
</td>
<td colspan="2">' . $total_time . '</div>
'.$action.'
</tr>';
$output .= "</table>";
if (!empty($export_csv)) {
$temp = array(
'',
'',
'',
''
);
$csv_content[] = $temp;
$temp = array(
get_lang('AccomplishedStepsTotal'),
'',
$final_score,
$total_time
);
$csv_content[] = $temp;
ob_end_clean();
Export :: export_table_csv($csv_content, 'reporting_learning_path_details');
exit;
}
return $output;
}
示例5: array_merge
}
if ($export_csv) {
$csv_content = array_merge($csv_header, $csv_content);
}
foreach ($all_datas as $row) {
$table->addRow($row, 'align="right"');
}
$table->display();
}
}
}
}
// send the csv file if asked
if ($export_csv) {
ob_end_clean();
Export::export_table_csv($csv_content, 'reporting_index');
exit;
}
//footer
if (!$export_csv) {
Display::display_footer();
}
/**
* Get number of courses for sortable with pagination
* @return int
*/
function get_number_of_courses()
{
global $courses;
return count($courses);
}
示例6: foreach
foreach ($column_names as $col) {
$array[0][] = $col;
}
foreach ($result as $row) {
foreach ($columns as $col) {
$array[$j][] = strip_tags($row[$col]);
}
$j++;
}
switch ($export_format) {
case 'xls':
Export::export_table_xls($array, 'company_report');
break;
case 'csv':
default:
Export::export_table_csv($array, 'company_report');
break;
}
exit;
}
$i = 0;
if (!empty($result)) {
foreach ($result as $row) {
//print_r($row);
// if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235
if (!isset($row['id']) || isset($row['id']) && $row['id'] == "") {
$response->rows[$i]['id'] = $i;
} else {
$response->rows[$i]['id'] = $row['id'];
}
$array = array();
示例7: thematic
//.........这里部分代码省略.........
$description_type = 0;
}
if ($key == 'plan') {
$thematic->set_thematic_plan_attributes($current_thematic, $item[0], $item[1], $description_type);
$thematic->thematic_plan_save();
$description_type++;
}
if ($key == 'progress') {
$thematic->set_thematic_advance_attributes(null, $current_thematic, 0, $item[2], $item[0], $item[1]);
$thematic->thematic_advance_save();
}
}
}
$action = 'thematic_details';
break;
case 'thematic_export':
$list = $thematic->get_thematic_list();
$csv = array();
foreach ($list as $theme) {
$csv[] = array('title', $theme['title'], $theme['content']);
$data = $thematic->get_thematic_plan_data($theme['id']);
if (!empty($data)) {
foreach ($data as $plan) {
$csv[] = array('plan', $plan['title'], $plan['description']);
}
}
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
if (!empty($data)) {
foreach ($data as $advance) {
$csv[] = array('progress', $advance['start_date'], $advance['duration'], $advance['content']);
}
}
}
Export::export_table_csv($csv);
exit;
// Don't continue building a normal page.
return;
case 'thematic_export_pdf':
$list = $thematic->get_thematic_list();
$table = array();
$table[] = array(get_lang('Thematic'), get_lang('ThematicPlan'), get_lang('ThematicAdvance'));
foreach ($list as $theme) {
$data = $thematic->get_thematic_plan_data($theme['id']);
$plan_html = null;
if (!empty($data)) {
foreach ($data as $plan) {
$plan_html .= '<strong>' . $plan['title'] . '</strong><br /> ' . $plan['description'] . '<br />';
}
}
$data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
$advance_html = null;
if (!empty($data)) {
foreach ($data as $advance) {
$advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG) . ' (' . $advance['duration'] . ' ' . get_lang('HourShort') . ')<br />' . $advance['content'] . '<br />';
}
}
$table[] = array($theme['title'], $plan_html, $advance_html);
}
$params = array('filename' => get_lang('Thematic') . '-' . api_get_local_time(), 'pdf_title' => get_lang('Thematic'), 'add_signatures' => true, 'format' => 'A4-L', 'orientation' => 'L');
Export::export_table_pdf($table, $params);
break;
case 'moveup':
$thematic->move_thematic('up', $thematic_id);
$action = 'thematic_details';
$thematic_id = null;
break;
示例8: api_get_path
case 'xls':
//TODO add date if exists
$file_name = !empty($action) ? $action : 'company_report';
require_once api_get_path(LIBRARY_PATH) . 'browser/Browser.php';
$browser = new Browser();
if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS) {
Export::export_table_xls_html($array, $file_name, 'ISO-8859-15');
} else {
Export::export_table_xls_html($array, $file_name);
}
break;
case 'csv':
default:
//TODO add date if exists
$file_name = !empty($action) ? $action : 'company_report';
Export::export_table_csv($array, $file_name);
break;
}
exit;
}
$i = 0;
if (!empty($result)) {
foreach ($result as $row) {
// if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235
if (!isset($row['id']) || isset($row['id']) && $row['id'] == '') {
$response->rows[$i]['id'] = $i;
} else {
$response->rows[$i]['id'] = $row['id'];
}
$array = array();
foreach ($columns as $col) {
示例9: export_complete_report_csv
function export_complete_report_csv($filename, $array)
{
$header[] = array(get_lang('Course'), get_lang('LearningPath'), get_lang('Exercise'), get_lang('User'), get_lang('Attempt'), get_lang('Date'), get_lang('Results'));
if (!empty($array)) {
$array = array_merge($header, $array);
Export::export_table_csv($array, $filename);
}
exit;
/*
* Too much encoding problems while exporting to XLS, keep it simple
*
*
global $global, $filter_score;
$workbook = new Spreadsheet_Excel_Writer();
$workbook ->setTempDir(api_get_path(SYS_ARCHIVE_PATH));
$workbook->send($filename);
$workbook->setVersion(8); // BIFF8
$worksheet =& $workbook->addWorksheet('Report');
$worksheet->setInputEncoding(api_get_system_encoding());
$line = 0;
$column = 0; //skip the first column (row titles)
$worksheet->write($line,$column,get_lang('Course'));
$column++;
$worksheet->write($line,$column,get_lang('LearningPath'));
$column++;
$worksheet->write($line,$column,get_lang('Exercise'));
$column++;
$worksheet->write($line,$column,get_lang('User'));
$column++;
$worksheet->write($line,$column,get_lang('Attempt'));
$column++;
$worksheet->write($line,$column,get_lang('Date'));
$column++;
$worksheet->write($line,$column,get_lang('Results'));
$column++;
$line++;
foreach ($array as $row) {
$column = 0;
foreach ($row as $item) {
$worksheet->write($line,$column,html_entity_decode(strip_tags($item)));
$column++;
}
$line++;
}
$line++;
$workbook->close();
exit;*/
}
示例10: indexAction
//.........这里部分代码省略.........
$item['field_filter'] = $item['field_filter'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif');
$new_result[] = $item;
}
$result = $new_result;
}*/
break;
case 'get_usergroups_teacher':
$columns = array('name', 'users', 'actions');
$options = array('order' => "name {$sord}", 'LIMIT' => "{$start} , {$limit}");
$options['course_id'] = $course_id;
switch ($type) {
case 'not_registered':
$options['where'] = array(" (course_id IS NULL OR course_id != ?) " => $course_id);
$result = $obj->get_usergroup_not_in_course($options);
break;
case 'registered':
$options['where'] = array(" usergroup.course_id = ? " => $course_id);
$result = $obj->get_usergroup_in_course($options);
break;
}
$new_result = array();
if (!empty($result)) {
foreach ($result as $group) {
$group['users'] = count($obj->get_users_by_usergroup($group['id']));
if ($obj->usergroup_was_added_in_course($group['id'], $course_id)) {
$url = 'class.php?action=remove_class_from_course&id=' . $group['id'];
$icon = Display::return_icon('delete.png', get_lang('Remove'));
} else {
$url = 'class.php?action=add_class_to_course&id=' . $group['id'];
$icon = Display::return_icon('add.png', get_lang('Add'));
}
$group['actions'] = Display::url($icon, $url);
$new_result[] = $group;
}
$result = $new_result;
}
if (!in_array($sidx, $columns)) {
$sidx = 'name';
}
//Multidimensional sort
\ArrayClass::msort($result, $sidx);
break;
default:
exit;
}
$allowed_actions = array('get_careers', 'get_promotions', 'get_usergroups', 'get_usergroups_teacher', 'get_gradebooks', 'get_sessions', 'get_exercise_results', 'get_hotpotatoes_exercise_results', 'get_work_user_list', 'get_timelines', 'get_grade_models', 'get_event_email_template', 'get_user_skill_ranking', 'get_extra_fields', 'get_extra_field_options', 'get_course_exercise_medias', 'get_user_course_report', 'get_user_course_report_resumed', 'get_group_reporting', 'get_question_list', 'get_user_list_plugin_widescale', 'get_questions');
//5. Creating an obj to return a json
if (in_array($action, $allowed_actions)) {
$response = new \stdClass();
$response->page = $page;
$response->total = $total_pages;
$response->records = $count;
if ($operation && $operation == 'excel') {
$j = 1;
$array = array();
if (empty($column_names)) {
$column_names = $columns;
}
//Headers
foreach ($column_names as $col) {
$array[0][] = $col;
}
foreach ($result as $row) {
foreach ($columns as $col) {
$array[$j][] = strip_tags($row[$col]);
}
$j++;
}
switch ($export_format) {
case 'xls':
Export::export_table_xls($array, 'company_report');
break;
case 'csv':
default:
Export::export_table_csv($array, 'company_report');
break;
}
exit;
}
$i = 0;
if (!empty($result)) {
foreach ($result as $row) {
//print_r($row);
// if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235
if (!isset($row['id']) || isset($row['id']) && $row['id'] == "") {
$response->rows[$i]['id'] = $i;
} else {
$response->rows[$i]['id'] = $row['id'];
}
$array = array();
foreach ($columns as $col) {
$array[] = isset($row[$col]) ? $row[$col] : null;
}
$response->rows[$i]['cell'] = $array;
$i++;
}
}
return json_encode($response);
}
}
示例11: switch
$user['phone']
);
}
$a_users[] = $user_pdf;
} else {
$a_users[] = $user;
}
$data[] = $user;
$counter++;
}
}
switch ($_GET['type']) {
case 'csv' :
Export::export_table_csv($a_users);
exit;
case 'xls' :
Export::export_table_xls($a_users);
exit;
case 'pdf' :
$header_attributes = array(
array('style' => 'width:10px'),
array('style' => 'width:30px'),
array('style' => 'width:50px'),
array('style' => 'width:500px'),
);
$params = array(
'add_signatures' => false,
'filename' => get_lang('UserList'),
示例12: export_tracking_user_overview
//.........这里部分代码省略.........
$orderby = 3 - $orderby;
}
if ($_GET['tracking_user_overview_direction']) {
$direction = $_GET['tracking_user_overview_direction'];
} else {
$direction = 'ASC';
}
$user_data = MySpace::get_user_data_tracking_overview($from, 1000, $orderby, $direction);
// the first line of the csv file with the column headers
$csv_row = array();
$csv_row[] = get_lang('OfficialCode');
if ($is_western_name_order) {
$csv_row[] = get_lang('FirstName', '');
$csv_row[] = get_lang('LastName', '');
} else {
$csv_row[] = get_lang('LastName', '');
$csv_row[] = get_lang('FirstName', '');
}
$csv_row[] = get_lang('LoginName');
$csv_row[] = get_lang('CourseCode');
// the additional user defined fields (only those that were selected to be exported)
$fields = UserManager::get_extra_fields(0, 50, 5, 'ASC');
if (is_array($_SESSION['additional_export_fields'])) {
foreach ($_SESSION['additional_export_fields'] as $key => $extra_field_export) {
$csv_row[] = $fields[$extra_field_export][3];
$field_names_to_be_exported[] = 'extra_'.$fields[$extra_field_export][1];
}
}
$csv_row[] = get_lang('AvgTimeSpentInTheCourse', '');
$csv_row[] = get_lang('AvgStudentsProgress', '');
$csv_row[] = get_lang('AvgCourseScore', '');
$csv_row[] = get_lang('AvgExercisesScore', '');
$csv_row[] = get_lang('AvgMessages', '');
$csv_row[] = get_lang('AvgAssignments', '');
$csv_row[] = get_lang('TotalExercisesScoreObtained', '');
$csv_row[] = get_lang('TotalExercisesScorePossible', '');
$csv_row[] = get_lang('TotalExercisesAnswered', '');
$csv_row[] = get_lang('TotalExercisesScorePercentage', '');
$csv_row[] = get_lang('FirstLogin', '');
$csv_row[] = get_lang('LatestLogin', '');
$csv_content[] = $csv_row;
// the other lines (the data)
foreach ($user_data as $key => $user) {
// getting all the courses of the user
$sql = "SELECT * FROM $tbl_course_user WHERE user_id = '".intval($user[4])."' AND relation_type<>".COURSE_RELATION_TYPE_RRHH." ";
$result = Database::query($sql);
while ($row = Database::fetch_row($result)) {
$csv_row = array();
// user official code
$csv_row[] = $user[0];
// user first|last name
$csv_row[] = $user[1];
// user last|first name
$csv_row[] = $user[2];
// user login name
$csv_row[] = $user[3];
// course code
$csv_row[] = $row[0];
// the additional defined user fields
$extra_fields = MySpace::get_user_overview_export_extra_fields($user[4]);
if (is_array($field_names_to_be_exported)) {
foreach ($field_names_to_be_exported as $key => $extra_field_export) {
$csv_row[] = $extra_fields[$extra_field_export];
}
}
// time spent in the course
$csv_row[] = api_time_to_hms(Tracking :: get_time_spent_on_the_course ($user[4], $row[0]));
// student progress in course
$csv_row[] = round(Tracking :: get_avg_student_progress ($user[4], $row[0]), 2);
// student score
$csv_row[] = round(Tracking :: get_avg_student_score ($user[4], $row[0]), 2);
// student tes score
$csv_row[] = round(Tracking :: get_avg_student_exercise_score ($user[4], $row[0]), 2);
// student messages
$csv_row[] = Tracking :: count_student_messages ($user[4], $row[0]);
// student assignments
$csv_row[] = Tracking :: count_student_assignments ($user[4], $row[0]);
// student exercises results
$exercises_results = MySpace::exercises_results($user[4], $row[0]);
$csv_row[] = $exercises_results['score_obtained'];
$csv_row[] = $exercises_results['score_possible'];
$csv_row[] = $exercises_results['questions_answered'];
$csv_row[] = $exercises_results['percentage'];
// first connection
$csv_row[] = Tracking :: get_first_connection_date_on_the_course ($user[4], $row[0]);
// last connection
$csv_row[] = strip_tags(Tracking :: get_last_connection_date_on_the_course ($user[4], $row[0]));
$csv_content[] = $csv_row;
}
}
Export :: export_table_csv($csv_content, 'reporting_user_overview');
exit;
}
示例13: array
$temp = array(get_lang('LinksMostClicked'), '');
$csv_content[] = array('', '');
$csv_content[] = $temp;
}
if (!empty($links_most_visited)) {
foreach ($links_most_visited as $row) {
echo ' <tr>
<td>' . Display::url($row['title'] . ' (' . $row['url'] . ')', $row['url']) . '</td>
<td align="right">' . $row['count_visits'] . ' ' . get_lang('Clicks') . '</td>
</tr>';
if ($export_csv) {
$temp = array($row['title'], $row['count_visits'] . ' ' . get_lang('Clicks', ''));
$csv_content[] = $temp;
}
}
} else {
echo '<tr><td>' . get_lang('NoLinkVisited') . '</td></tr>';
if ($export_csv) {
$temp = array(get_lang('NoLinkVisited'), '');
$csv_content[] = $temp;
}
}
echo '</table></div>';
echo '<div class="clear"></div>';
// send the csv file if asked
if ($export_csv) {
ob_end_clean();
Export::export_table_csv($csv_content, 'reporting_course_tools');
exit;
}
Display::display_footer();
示例14: get_lang
}
//if (empty($extend_all)) {
$output .= '<tr class="' . $oddclass . '">
<td></td>
<td colspan="4">
<i>' . get_lang('AccomplishedStepsTotal') . '</i>
</td>
<td colspan="2"></td>
<td colspan="2">
' . $final_score . '
</td>
<td colspan="2">' . $total_time . '</div><td></td>
</tr>';
//}
$output .= "</table>";
if (!empty($export_csv)) {
$temp = array('', '', '', '');
$csv_content[] = $temp;
$temp = array(get_lang('AccomplishedStepsTotal'), '', $final_score, $total_time);
$csv_content[] = $temp;
ob_end_clean();
Export::export_table_csv($csv_content, 'reporting_learning_path_details');
exit;
}
if ($origin != 'tracking') {
$output .= "</body></html>";
}
if (empty($export_csv)) {
echo $output;
}
Display::display_footer();
示例15: FormValidator
}
}
$form = new FormValidator('search_user', 'get', api_get_path(WEB_CODE_PATH).'mySpace/teachers.php');
$form = Tracking::setUserSearchForm($form);
$form->setDefaults($params);
if ($export_csv) {
// send the csv file if asked
$content = $table->return_table();
foreach ($content as &$row) {
unset($row[4]);
}
$csv_content = array_merge($csv_header, $content);
ob_end_clean();
Export :: export_table_csv($csv_content, 'reporting_teacher_list');
exit;
} else {
Display::display_header($nameTools);
echo $actions;
$page_title = get_lang('Teachers');
echo Display::page_subheader($page_title);
if (isset($active)) {
if ($active) {
$activeLabel = get_lang('ActiveUsers');
} else {
$activeLabel = get_lang('InactiveUsers');
}
echo Display::page_subheader2($activeLabel);
}
$form->display();