function advancedCSVSettingsForm()
{
    getCSVSettings($csvIgnoreNRows, $csvCharsPerLine, $csvFieldSeparator, $csvFieldDelimiter, $csvFieldNamesOnTop, $csvUpdateIfPKExists, $csvBackupBeforeImport);
    ob_start();
    ?>
		<div style="width: 850px; display: none;" id="advancedOptions">
		<table border="0" cellspacing="0" cellpadding="0" width="850">
			<tr>
				<td align="right" class="tdFormCaption" valign="top" width="250">
					<div class="formFieldCaption">Field separator</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvFieldSeparator" class="formTextBox" value="<?php 
    echo htmlspecialchars($csvFieldSeparator);
    ?>
" size="2"> <i>The default is comma (,)</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption">Field delimiter</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvFieldDelimiter" class="formTextBox" value="<?php 
    echo htmlspecialchars($csvFieldDelimiter);
    ?>
" size="2"> <i>The default is double-quote (")</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption">Maximum characters per line</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvCharsPerLine" class="formTextBox" value="<?php 
    echo intval($csvCharsPerLine);
    ?>
" size="6"> <i>If you have trouble importing the CSV file, try increasing this value.</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption">Number of lines to ignore</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvIgnoreNRows" class="formTextBox" value="<?php 
    echo intval($csvIgnoreNRows);
    ?>
" size="8"> <i>Change this value if you want to skip a specific number of lines in the CSV file.</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><input type="checkbox" id="csvFieldNamesOnTop" name="csvFieldNamesOnTop" value="1" <?php 
    echo $csvFieldNamesOnTop ? 'checked' : '';
    ?>
></div>
					</td>
				<td align="left" class="tdFormInput">
					<label for="csvFieldNamesOnTop">The first line of the file contains field names</label>
					<br /><i>field names must <b>exactly</b> match those in the database.</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><input type="checkbox" id="csvUpdateIfPKExists" name="csvUpdateIfPKExists" value="1" <?php 
    echo $csvUpdateIfPKExists ? 'checked' : '';
    ?>
></div>
					</td>
				<td align="left" class="tdFormInput">
					<label for="csvUpdateIfPKExists">Update table records if their primary key values match those in the CSV file.</label>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><input type="checkbox" id="csvBackupBeforeImport" name="csvBackupBeforeImport" value="1" <?php 
    echo $csvBackupBeforeImport ? 'checked' : '';
    ?>
></div>
					</td>
				<td align="left" class="tdFormInput">
					<label for="csvBackupBeforeImport">Back up the table before importing CSV data into it.</label>
					</td>
				</tr>
			</table>
			</div>
		<?php 
    $out = ob_get_contents();
    ob_end_clean();
    return $out;
}
Esempio n. 2
0
function advancedCSVSettingsForm()
{
    global $Translation;
    getCSVSettings($csvIgnoreNRows, $csvCharsPerLine, $csvFieldSeparator, $csvFieldDelimiter, $csvFieldNamesOnTop, $csvUpdateIfPKExists, $csvBackupBeforeImport);
    ob_start();
    ?>
		<div style="display: none;" id="advancedOptions">
		<table class="table table-striped">
			<tr>
				<td align="right" class="tdFormCaption" valign="top" width="250">
					<div class="formFieldCaption"><?php 
    echo $Translation['field separator'];
    ?>
</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvFieldSeparator" class="formTextBox" value="<?php 
    echo htmlspecialchars($csvFieldSeparator);
    ?>
" size="2"> <i><?php 
    echo $Translation['default comma'];
    ?>
</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><?php 
    echo $Translation['field delimiter'];
    ?>
</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvFieldDelimiter" class="formTextBox" value="<?php 
    echo htmlspecialchars($csvFieldDelimiter);
    ?>
" size="2"> <i><?php 
    echo $Translation['default double-quote'];
    ?>
</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><?php 
    echo $Translation['maximum characters per line'];
    ?>
</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvCharsPerLine" class="formTextBox" value="<?php 
    echo intval($csvCharsPerLine);
    ?>
" size="6"> <i><?php 
    echo $Translation['trouble importing CSV'];
    ?>
</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><?php 
    echo $Translation['ignore lines number'];
    ?>
</div>
					</td>
				<td align="left" class="tdFormInput">
					<input type="text" name="csvIgnoreNRows" class="formTextBox" value="<?php 
    echo intval($csvIgnoreNRows);
    ?>
" size="8"> <i><?php 
    echo $Translation['skip lines number'];
    ?>
</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><input type="checkbox" id="csvFieldNamesOnTop" name="csvFieldNamesOnTop" value="1" <?php 
    echo $csvFieldNamesOnTop ? 'checked' : '';
    ?>
></div>
					</td>
				<td align="left" class="tdFormInput">
					<label for="csvFieldNamesOnTop"><?php 
    echo $Translation['first line field names'];
    ?>
</label>
					<br><i><?php 
    echo $Translation['field names must match'];
    ?>
</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><input type="checkbox" id="csvUpdateIfPKExists" name="csvUpdateIfPKExists" value="1" <?php 
    echo $csvUpdateIfPKExists ? 'checked' : '';
    ?>
></div>
					</td>
				<td align="left" class="tdFormInput">
					<label for="csvUpdateIfPKExists"><?php 
    echo $Translation['update table records'];
    ?>
</label>
					<br><i><?php 
    echo $Translation['ignore CSV table records'];
    ?>
</i>
					</td>
				</tr>
			<tr>
				<td align="right" class="tdFormCaption" valign="top">
					<div class="formFieldCaption"><input type="checkbox" id="csvBackupBeforeImport" name="csvBackupBeforeImport" value="1" <?php 
    echo $csvBackupBeforeImport ? 'checked' : '';
    ?>
></div>
					</td>
				<td align="left" class="tdFormInput">
					<label for="csvBackupBeforeImport"><?php 
    echo $Translation['back up the table'];
    ?>
</label>
					</td>
				</tr>
			</table>
			</div>
		<?php 
    $out = ob_get_contents();
    ob_end_clean();
    return $out;
}