Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0a21cfbb00
237
tbl_chart.php
237
tbl_chart.php
@ -117,118 +117,131 @@ $url_params['reload'] = 1;
|
||||
* Displays the page
|
||||
*/
|
||||
// pma_token/url_query needed for chart export
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
|
||||
url_query = '<?php echo $url_query;?>';
|
||||
</script>
|
||||
<!-- Display Chart options -->
|
||||
<div id="div_view_options">
|
||||
<form method="post" id="tblchartform" action="tbl_chart.php" class="ajax">
|
||||
<?php echo PMA_generate_common_hidden_inputs($url_params); ?>
|
||||
<fieldset>
|
||||
<legend><?php echo __('Display chart'); ?></legend>
|
||||
<div style="float:left; width:420px;">
|
||||
<input type="radio" name="chartType" value="bar" id="radio_bar" />
|
||||
<label for ="radio_bar"><?php echo _pgettext('Chart type', 'Bar'); ?></label>
|
||||
<input type="radio" name="chartType" value="column" id="radio_column" />
|
||||
<label for ="radio_column"><?php echo _pgettext('Chart type', 'Column'); ?></label>
|
||||
<input type="radio" name="chartType" value="line" id="radio_line" checked="checked" />
|
||||
<label for ="radio_line"><?php echo _pgettext('Chart type', 'Line'); ?></label>
|
||||
<input type="radio" name="chartType" value="spline" id="radio_spline" />
|
||||
<label for ="radio_spline"><?php echo _pgettext('Chart type', 'Spline'); ?></label>
|
||||
<input type="radio" name="chartType" value="area" id="radio_area" />
|
||||
<label for ="radio_area"><?php echo _pgettext('Chart type', 'Area'); ?></label>
|
||||
<span class="span_pie" style="display:none;">
|
||||
<input type="radio" name="chartType" value="pie" id="radio_pie" />
|
||||
<label for ="radio_pie"><?php echo _pgettext('Chart type', 'Pie'); ?></label>
|
||||
</span>
|
||||
<span class="span_timeline" style="display:none;">
|
||||
<input type="radio" name="chartType" value="timeline" id="radio_timeline" />
|
||||
<label for ="radio_timeline"><?php echo _pgettext('Chart type', 'Timeline'); ?></label>
|
||||
</span>
|
||||
<br /><br />
|
||||
<span class="barStacked">
|
||||
<input type="checkbox" name="barStacked" value="1" id="checkbox_barStacked" />
|
||||
<label for ="checkbox_barStacked"><?php echo __('Stacked'); ?></label>
|
||||
</span>
|
||||
<br /><br />
|
||||
<input type="text" name="chartTitle" value="<?php echo __('Chart title'); ?>">
|
||||
</div>
|
||||
<?php
|
||||
$keys = array_keys($data[0]);
|
||||
$yaxis = -1;
|
||||
if (count($keys) > 1) { ?>
|
||||
<div style="float:left; padding-left:40px;">
|
||||
<label for="select_chartXAxis"><?php echo __('X-Axis:'); ?></label>
|
||||
<select name="chartXAxis" id="select_chartXAxis">
|
||||
<?php
|
||||
$htmlString = '<script type="text/javascript">'
|
||||
. "pma_token = '" . $_SESSION[' PMA_token '] . "';"
|
||||
. "url_query = '" . $url_query . "';"
|
||||
. '</script>'
|
||||
. '<!-- Display Chart options -->'
|
||||
. '<div id="div_view_options">'
|
||||
. '<form method="post" id="tblchartform" action="tbl_chart.php" class="ajax">'
|
||||
. PMA_generate_common_hidden_inputs($url_params)
|
||||
. '<fieldset>'
|
||||
. '<legend>' . __('Display chart') . '</legend>'
|
||||
. '<div style="float:left; width:420px;">'
|
||||
. '<input type="radio" name="chartType" value="bar" id="radio_bar" />'
|
||||
. '<label for ="radio_bar">' . _pgettext('Chart type', 'Bar') . '</label>'
|
||||
. '<input type="radio" name="chartType" value="column" id="radio_column" />'
|
||||
. '<label for ="radio_column">' . _pgettext('Chart type', 'Column') . '</label>'
|
||||
. '<input type="radio" name="chartType" value="line" id="radio_line"'
|
||||
. ' checked="checked" />'
|
||||
. '<label for ="radio_line">' . _pgettext('Chart type', 'Line') . '</label>'
|
||||
. '<input type="radio" name="chartType" value="spline" id="radio_spline" />'
|
||||
. '<label for ="radio_spline">' . _pgettext('Chart type', 'Spline') . '</label>'
|
||||
. '<input type="radio" name="chartType" value="area" id="radio_area" />'
|
||||
. '<label for ="radio_area">' . _pgettext('Chart type', 'Area') . '</label>'
|
||||
. '<span class="span_pie" style="display:none;">'
|
||||
. '<input type="radio" name="chartType" value="pie" id="radio_pie" />'
|
||||
. '<label for ="radio_pie">' . _pgettext('Chart type', 'Pie') . '</label>'
|
||||
. '</span>'
|
||||
. '<span class="span_timeline" style="display:none;">'
|
||||
. '<input type="radio" name="chartType" value="timeline" id="radio_timeline" />'
|
||||
. '<label for ="radio_timeline">' . _pgettext('Chart type', 'Timeline')
|
||||
. '</label>'
|
||||
. '</span>'
|
||||
. '<br /><br />'
|
||||
. '<span class="barStacked">'
|
||||
. '<input type="checkbox" name="barStacked" value="1"'
|
||||
. ' id="checkbox_barStacked" />'
|
||||
. '<label for ="checkbox_barStacked">' . __('Stacked') . '</label>'
|
||||
. '</span>'
|
||||
. '<br /><br />'
|
||||
. '<input type="text" name="chartTitle" value="' . __('Chart title') . '">'
|
||||
. '</div>';
|
||||
|
||||
foreach ($keys as $idx => $key) {
|
||||
if ($yaxis == -1) {
|
||||
echo '<option value="' . htmlspecialchars($idx) . '" selected="selected">' . htmlspecialchars($key) . '</option>';
|
||||
$yaxis = $idx;
|
||||
} else {
|
||||
echo '<option value="' . htmlspecialchars($idx) . '">' . htmlspecialchars($key) . '</option>';
|
||||
}
|
||||
}
|
||||
$keys = array_keys($data[0]);
|
||||
$yaxis = -1;
|
||||
if (count($keys) > 1) {
|
||||
$htmlString .= '<div style="float:left; padding-left:40px;">'
|
||||
. '<label for="select_chartXAxis">' . __('X-Axis:') . '</label>'
|
||||
. '<select name="chartXAxis" id="select_chartXAxis">';
|
||||
|
||||
?>
|
||||
</select><br />
|
||||
<label for="select_chartSeries"><?php echo __('Series:'); ?></label>
|
||||
<select name="chartSeries" id="select_chartSeries" multiple="multiple">
|
||||
<?php
|
||||
$numeric_types = array('int', 'real');
|
||||
foreach ($keys as $idx => $key) {
|
||||
if (in_array($fields_meta[$idx]->type, $numeric_types)) {
|
||||
if ($idx == $yaxis) {
|
||||
echo '<option value="' . htmlspecialchars($idx) . '">'
|
||||
. htmlspecialchars($key) . '</option>';
|
||||
} else {
|
||||
echo '<option value="' . htmlspecialchars($idx)
|
||||
. '" selected="selected">' . htmlspecialchars($key)
|
||||
. '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="dateTimeCols" value="
|
||||
<?php
|
||||
$date_time_types = array('date', 'datetime', 'timestamp');
|
||||
foreach ($keys as $idx => $key) {
|
||||
if (in_array($fields_meta[$idx]->type, $date_time_types)) {
|
||||
echo $idx . " ";
|
||||
}
|
||||
}
|
||||
?>" />
|
||||
</div>
|
||||
<?php
|
||||
foreach ($keys as $idx => $key) {
|
||||
if ($yaxis == -1) {
|
||||
$htmlString .= '<option value="' . htmlspecialchars($idx)
|
||||
. '" selected="selected">' . htmlspecialchars($key) . '</option>';
|
||||
$yaxis = $idx;
|
||||
} else {
|
||||
$htmlString .= '<option value="' . htmlspecialchars($idx) . '">'
|
||||
. htmlspecialchars($key) . '</option>';
|
||||
}
|
||||
?>
|
||||
<div style="float:left; padding-left:40px;">
|
||||
<label for="xaxis_label"><?php echo __('X-Axis label:'); ?></label>
|
||||
<input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label"
|
||||
value="<?php echo ($yaxis == -1) ? __('X Values') : htmlspecialchars($keys[$yaxis]); ?>" /><br />
|
||||
<label for="yaxis_label"><?php echo __('Y-Axis label:'); ?></label>
|
||||
<input type="text" name="yaxis_label" id="yaxis_label" value="<?php echo __('Y Values'); ?>" /><br />
|
||||
</div>
|
||||
<p style="clear:both;"> </p>
|
||||
<fieldset>
|
||||
<div>
|
||||
<label for="pos"><?php echo __('Start row') . ': ' . "\n"; ?></label>
|
||||
<input type="text" name="pos" size="3" value="<?php echo $_SESSION['tmp_user_values']['pos']; ?>" />
|
||||
<label for="session_max_rows"><?php echo __('Number of rows') . ': ' . "\n"; ?></label>
|
||||
<input type="text" name="session_max_rows" size="3" value="<?php echo (($_SESSION['tmp_user_values']['max_rows'] != 'all') ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']); ?>" />
|
||||
<input type="submit" name="submit" class="Go" value="<?php echo __('Go'); ?>" />
|
||||
<input type="hidden" name="sql_query" value="<?php echo htmlspecialchars($sql_query); ?>" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<p style="clear:both;"> </p>
|
||||
<div id="resizer" style="width:600px; height:400px;">
|
||||
<div id="querychart">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
|
||||
$htmlString .= '</select><br />'
|
||||
. '<label for="select_chartSeries">' . __('Series:') . '</label>'
|
||||
. '<select name="chartSeries" id="select_chartSeries" multiple="multiple">';
|
||||
|
||||
$numeric_types = array('int', 'real');
|
||||
foreach ($keys as $idx => $key) {
|
||||
if (in_array($fields_meta[$idx]->type, $numeric_types)) {
|
||||
if ($idx == $yaxis) {
|
||||
$htmlString .= '<option value="' . htmlspecialchars($idx) . '">'
|
||||
. htmlspecialchars($key) . '</option>';
|
||||
} else {
|
||||
$htmlString .= '<option value="' . htmlspecialchars($idx)
|
||||
. '" selected="selected">' . htmlspecialchars($key)
|
||||
. '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$htmlString .= '</select>'
|
||||
. '<input type="hidden" name="dateTimeCols" value="';
|
||||
|
||||
$date_time_types = array('date', 'datetime', 'timestamp');
|
||||
foreach ($keys as $idx => $key) {
|
||||
if (in_array($fields_meta[$idx]->type, $date_time_types)) {
|
||||
$htmlString .= $idx . " ";
|
||||
}
|
||||
}
|
||||
$htmlString .= '" />'
|
||||
. '</div>';
|
||||
}
|
||||
$htmlString .= '<div style="float:left; padding-left:40px;">'
|
||||
. '<label for="xaxis_label">' . __('X-Axis label:') . '</label>'
|
||||
. '<input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label"'
|
||||
. ' value="'
|
||||
. (($yaxis == -1) ? __('X Values') : htmlspecialchars($keys[$yaxis]))
|
||||
. '" /><br />'
|
||||
. '<label for="yaxis_label">' . __('Y-Axis label:') . '</label>'
|
||||
. '<input type="text" name="yaxis_label" id="yaxis_label" value="'
|
||||
. __('Y Values') . '" /><br />'
|
||||
. '</div>'
|
||||
. '<p style="clear:both;"> </p>'
|
||||
. '<fieldset>'
|
||||
. '<div>'
|
||||
. '<label for="pos">' . __('Start row') . ': ' . "\n" . '</label>'
|
||||
. '<input type="text" name="pos" size="3" value="'
|
||||
. $_SESSION['tmp_user_values']['pos'] . '" />'
|
||||
. '<label for="session_max_rows">'
|
||||
. __('Number of rows') . ': ' . "\n" . '</label>'
|
||||
. '<input type="text" name="session_max_rows" size="3" value="'
|
||||
. (($_SESSION['tmp_user_values']['max_rows'] != 'all')
|
||||
? $_SESSION['tmp_user_values']['max_rows']
|
||||
: $GLOBALS['cfg']['MaxRows'])
|
||||
. '" />'
|
||||
. '<input type="submit" name="submit" class="Go" value="' . __('Go') . '" />'
|
||||
. '<input type="hidden" name="sql_query" value="'
|
||||
. htmlspecialchars($sql_query) . '" />'
|
||||
. '</div>'
|
||||
. '</fieldset>'
|
||||
. '<p style="clear:both;"> </p>'
|
||||
. '<div id="resizer" style="width:600px; height:400px;">'
|
||||
. '<div id="querychart">'
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
. '</fieldset>'
|
||||
. '</form>'
|
||||
. '</div>';
|
||||
|
||||
$response->addHTML($htmlString);
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user