本文整理汇总了PHP中Export::build_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Export::build_file方法的具体用法?PHP Export::build_file怎么用?PHP Export::build_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Export
的用法示例。
在下文中一共展示了Export::build_file方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
//print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)");
if ($newcode) {
$array_selected[$_GET["field"]] = $newpos;
$array_selected[$newcode] = $pos;
$_SESSION["export_selected_fields"] = $array_selected;
}
}
if ($step == 1 || $action == 'cleanselect') {
$_SESSION["export_selected_fields"] = array();
$_SESSION["export_filtered_fields"] = array();
$array_selected = array();
$array_filtervalue = array();
}
if ($action == 'builddoc') {
// Build export file
$result = $objexport->build_file($user, GETPOST('model', 'alpha'), $datatoexport, $array_selected, $array_filtervalue);
if ($result < 0) {
setEventMessage($objexport->error, 'errors');
$sqlusedforexport = $objexport->sqlusedforexport;
} else {
setEventMessage($langs->trans("FileSuccessfullyBuilt"));
$sqlusedforexport = $objexport->sqlusedforexport;
}
}
// Delete file
if ($step == 5 && $action == 'confirm_deletefile' && $confirm == 'yes') {
$file = $upload_dir . "/" . GETPOST('file');
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret = dol_delete_file($file);
if ($ret) {
setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
示例2: testExportSociete
/**
* Test export function
*
* @return void
*/
public function testExportSociete()
{
global $conf,$user,$langs,$db;
$sql = "";
$datatoexport='societe_1';
$array_selected = array("s.rowid"=>1, "s.nom"=>2); // Mut be fields found into declaration of dataset
$model='csv';
$objexport=new Export($db);
$result=$objexport->load_arrays($user,$datatoexport);
// Build export file
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $sql);
$expectedresult=1;
$this->assertEquals($result,$expectedresult);
return true;
}
示例3: array
}
}
//print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)");
if ($newcode) {
$array_selected[$_GET["field"]] = $newpos;
$array_selected[$newcode] = $pos;
$_SESSION["export_selected_fields"] = $array_selected;
}
}
if ($step == 1 || $action == 'cleanselect') {
$_SESSION["export_selected_fields"] = array();
$array_selected = array();
}
if ($action == 'builddoc') {
// Build export file
$result = $objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected);
if ($result < 0) {
$mesg = '<div class="error">' . $objexport->error . '</div>';
} else {
$mesg = '<div class="ok">' . $langs->trans("FileSuccessfullyBuilt") . '</div>';
$sqlusedforexport = $objexport->sqlusedforexport;
}
}
if ($action == 'deleteprof') {
if ($_GET["id"]) {
$objexport->fetch($_GET["id"]);
$result = $objexport->delete($user);
}
}
if ($action == 'add_export_model') {
if ($export_name) {
示例4: testExportModulesDatasets
/**
* Test export function for all dataset predefined into modules
*
* @depends testExportPersonalizedWithFilter
* @return void
*/
public function testExportModulesDatasets()
{
global $conf, $user, $langs, $db;
$model = 'csv';
$filterdatatoexport = '';
//$filterdatatoexport='';
//$array_selected = array("s.rowid"=>1, "s.nom"=>2); // Mut be fields found into declaration of dataset
// Load properties of arrays to make export
$objexport = new Export($db);
$result = $objexport->load_arrays($user, $filterdatatoexport);
// This load ->array_export_xxx properties for datatoexport
// Loop on each dataset
foreach ($objexport->array_export_code as $key => $datatoexport) {
$exportfile = $conf->export->dir_temp . '/' . $user->id . '/export_' . $datatoexport . '.csv';
print "Process export for dataset " . $datatoexport . " into " . $exportfile . "\n";
dol_delete_file($exportfile);
// Generate $array_selected
$i = 0;
$array_selected = array();
foreach ($objexport->array_export_fields[$key] as $key => $val) {
$array_selected[$key] = $i++;
}
//var_dump($array_selected);
// Build export file
$sql = "";
$result = $objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
$expectedresult = 1;
$this->assertEquals($result, $expectedresult, 'Call build_file to export ' . $exportfile . ' failed');
$result = dol_is_file($exportfile);
$this->assertTrue($result, $expectedresult, 'File ' . $exportfile . ' not found');
}
return true;
}