本文整理汇总了PHP中Export::arrayToXml方法的典型用法代码示例。如果您正苦于以下问题:PHP Export::arrayToXml方法的具体用法?PHP Export::arrayToXml怎么用?PHP Export::arrayToXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Export
的用法示例。
在下文中一共展示了Export::arrayToXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
}
$res = Database::query($sql);
while ($user = Database::fetch_array($res, 'ASSOC')) {
$student_data = UserManager::get_extra_user_data($user['UserId'], true, false);
foreach ($student_data as $key => $value) {
$key = substr($key, 6);
if (is_array($value)) {
$user[$key] = $value[$key];
} else {
$user[$key] = $value;
}
}
$data[] = $user;
}
switch ($file_type) {
case 'xml':
Export::arrayToXml($data, $filename, 'Contact', 'Contacts');
exit;
break;
case 'csv':
Export::arrayToCsv($data, $filename);
exit;
case 'xls':
Export::arrayToXls($data, $filename);
exit;
break;
}
}
Display::display_header($tool_name);
$form->display();
Display::display_footer();
示例2: foreach
}
// export results to xml or csv file
foreach ($results as $result) {
$userinfo = api_get_user_info($result->get_user_id());
$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::arrayToXml($alldata, $filename, 'Result', 'XMLResults');
exit;
break;
case 'csv':
Export::arrayToCsv($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;
}
示例3: foreach
foreach ($usersInCourse as $user) {
if ($user['status_rel'] == COURSEMANAGER) {
$dataToExport['teachers'] .= $user['username'] . '|';
} else {
$dataToExport['students'] .= $user['username'] . '|';
}
}
$dataToExport['students'] = substr($dataToExport['students'], 0, -1);
$dataToExport['teachers'] = substr($dataToExport['teachers'], 0, -1);
$listToExport[] = $dataToExport;
}
switch ($file_type) {
case 'xml':
// Remove header
unset($listToExport[0]);
Export::arrayToXml($listToExport, $archiveFile);
break;
case 'csv':
Export::arrayToCsv($listToExport, $archiveFile);
case 'xls':
Export::arrayToXls($listToExport, $archiveFile);
break;
}
} else {
Display::addFlash(Display::return_message(get_lang('ThereAreNotSelectedCoursesOrCoursesListIsEmpty')));
}
}
Display::display_header($tool_name);
$form = new FormValidator('export', 'post', api_get_self());
$form->addHeader($tool_name);
$form->addHidden('formSent', 1);