Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3fa41c7a0a
@ -60,14 +60,14 @@ function isEmpty(obj) {
|
||||
**/
|
||||
function getDate(val,type) {
|
||||
if(type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
|
||||
return Highcharts.dateFormat('%Y-%m-%e %H:%M:%S', val)
|
||||
}
|
||||
return Highcharts.dateFormat('%Y-%m-%e %H:%M:%S', val)
|
||||
}
|
||||
else if(type.toString().search(/time/i) != -1) {
|
||||
return Highcharts.dateFormat('%H:%M:%S', val)
|
||||
}
|
||||
}
|
||||
else if (type.toString().search(/date/i) != -1) {
|
||||
return Highcharts.dateFormat('%Y-%m-%e', val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,14 +77,14 @@ function getDate(val,type) {
|
||||
**/
|
||||
function getTimeStamp(val,type) {
|
||||
if(type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
|
||||
return getDateFromFormat(val,'yyyy-MM-dd HH:mm:ss', val)
|
||||
}
|
||||
return getDateFromFormat(val,'yyyy-MM-dd HH:mm:ss', val)
|
||||
}
|
||||
else if(type.toString().search(/time/i) != -1) {
|
||||
return getDateFromFormat('1970-01-01 ' + val,'yyyy-MM-dd HH:mm:ss')
|
||||
}
|
||||
return getDateFromFormat('1970-01-01 ' + val,'yyyy-MM-dd HH:mm:ss')
|
||||
}
|
||||
else if (type.toString().search(/date/i) != -1) {
|
||||
return getDateFromFormat(val,'yyyy-MM-dd')
|
||||
}
|
||||
return getDateFromFormat(val,'yyyy-MM-dd')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,12 +92,12 @@ function getTimeStamp(val,type) {
|
||||
** @param field: field type (as in database structure)
|
||||
**/
|
||||
function getType(field) {
|
||||
if(field.toString().search(/int/i) != -1 || field.toString().search(/decimal/i) != -1 || field.toString().search(/year/i) != -1)
|
||||
return 'numeric';
|
||||
else if(field.toString().search(/time/i) != -1 || field.toString().search(/date/i) != -1)
|
||||
return 'time';
|
||||
else
|
||||
return 'text';
|
||||
if(field.toString().search(/int/i) != -1 || field.toString().search(/decimal/i) != -1 || field.toString().search(/year/i) != -1)
|
||||
return 'numeric';
|
||||
else if(field.toString().search(/time/i) != -1 || field.toString().search(/date/i) != -1)
|
||||
return 'time';
|
||||
else
|
||||
return 'text';
|
||||
}
|
||||
/**
|
||||
** Converts a categorical array into numeric array
|
||||
@ -140,29 +140,29 @@ function includePan(currentChart) {
|
||||
$('#querychart').mousemove(function(e) {
|
||||
if (mouseDown == 1) {
|
||||
if (e.pageX > lastX) {
|
||||
var xExtremes = currentChart.xAxis[0].getExtremes();
|
||||
var xExtremes = currentChart.xAxis[0].getExtremes();
|
||||
var diff = (e.pageX - lastX) * (xExtremes.max - xExtremes.min) / chartWidth;
|
||||
currentChart.xAxis[0].setExtremes(xExtremes.min - diff, xExtremes.max - diff);
|
||||
}
|
||||
else if (e.pageX < lastX) {
|
||||
var xExtremes = currentChart.xAxis[0].getExtremes();
|
||||
var xExtremes = currentChart.xAxis[0].getExtremes();
|
||||
var diff = (lastX - e.pageX) * (xExtremes.max - xExtremes.min) / chartWidth;
|
||||
currentChart.xAxis[0].setExtremes(xExtremes.min + diff, xExtremes.max + diff);
|
||||
currentChart.xAxis[0].setExtremes(xExtremes.min + diff, xExtremes.max + diff);
|
||||
}
|
||||
|
||||
if (e.pageY > lastY) {
|
||||
var yExtremes = currentChart.yAxis[0].getExtremes();
|
||||
var yExtremes = currentChart.yAxis[0].getExtremes();
|
||||
var ydiff = 1.0 * (e.pageY - lastY) * (yExtremes.max - yExtremes.min) / chartHeight;
|
||||
currentChart.yAxis[0].setExtremes(yExtremes.min + ydiff, yExtremes.max + ydiff);
|
||||
currentChart.yAxis[0].setExtremes(yExtremes.min + ydiff, yExtremes.max + ydiff);
|
||||
}
|
||||
else if (e.pageY < lastY) {
|
||||
var yExtremes = currentChart.yAxis[0].getExtremes();
|
||||
var yExtremes = currentChart.yAxis[0].getExtremes();
|
||||
var ydiff = 1.0 * (lastY - e.pageY) * (yExtremes.max - yExtremes.min) / chartHeight;
|
||||
currentChart.yAxis[0].setExtremes(yExtremes.min - ydiff, yExtremes.max - ydiff);
|
||||
currentChart.yAxis[0].setExtremes(yExtremes.min - ydiff, yExtremes.max - ydiff);
|
||||
}
|
||||
}
|
||||
lastX = e.pageX;
|
||||
lastY = e.pageY;
|
||||
lastX = e.pageX;
|
||||
lastY = e.pageY;
|
||||
});
|
||||
}
|
||||
|
||||
@ -216,8 +216,8 @@ $(document).ready(function() {
|
||||
**/
|
||||
$('#inputFormSubmitId').click(function() {
|
||||
if ($('#tableid_0').get(0).selectedIndex == 0 || $('#tableid_1').get(0).selectedIndex == 0)
|
||||
PMA_ajaxShowMessage(PMA_messages['strInputNull']);
|
||||
else if (xLabel == yLabel)
|
||||
PMA_ajaxShowMessage(PMA_messages['strInputNull']);
|
||||
else if (xLabel == yLabel)
|
||||
PMA_ajaxShowMessage(PMA_messages['strSameInputs']);
|
||||
});
|
||||
|
||||
@ -240,16 +240,16 @@ $(document).ready(function() {
|
||||
} else {
|
||||
$link.text(PMA_messages['strHideSearchCriteria']);
|
||||
}
|
||||
// avoid default click action
|
||||
return false;
|
||||
});
|
||||
// avoid default click action
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
** Set dialog properties for the data display form
|
||||
**/
|
||||
$("#dataDisplay").dialog({
|
||||
autoOpen: false,
|
||||
title: 'Data point content',
|
||||
title: 'Data point content',
|
||||
modal: false, //false otherwise other dialogues like timepicker may not function properly
|
||||
height: $('#dataDisplay').height() + 80,
|
||||
width: $('#dataDisplay').width() + 80
|
||||
@ -260,152 +260,152 @@ $(document).ready(function() {
|
||||
*/
|
||||
|
||||
$("#submitForm").click(function(event) {
|
||||
|
||||
|
||||
//Prevent default submission of form
|
||||
event.preventDefault();
|
||||
|
||||
//Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = new Array();//Stores the values changed from original
|
||||
|
||||
//Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = new Array();//Stores the values changed from original
|
||||
var it = 4;
|
||||
var xChange = false;
|
||||
var yChange = false;
|
||||
for (key in selectedRow) {
|
||||
if (key != 'where_clause'){
|
||||
var oldVal = selectedRow[key];
|
||||
var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
|
||||
if (oldVal != newVal){
|
||||
selectedRow[key] = newVal;
|
||||
newValues[key] = newVal;
|
||||
if(key == xLabel) {
|
||||
xChange = true;
|
||||
data[currentData][xLabel] = newVal;
|
||||
}
|
||||
else if(key == yLabel) {
|
||||
yChange = true;
|
||||
data[currentData][yLabel] = newVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
it++
|
||||
}//End data update
|
||||
for (key in selectedRow) {
|
||||
if (key != 'where_clause'){
|
||||
var oldVal = selectedRow[key];
|
||||
var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
|
||||
if (oldVal != newVal){
|
||||
selectedRow[key] = newVal;
|
||||
newValues[key] = newVal;
|
||||
if(key == xLabel) {
|
||||
xChange = true;
|
||||
data[currentData][xLabel] = newVal;
|
||||
}
|
||||
else if(key == yLabel) {
|
||||
yChange = true;
|
||||
data[currentData][yLabel] = newVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
it++
|
||||
}//End data update
|
||||
|
||||
//Update the chart series and replot
|
||||
//Update the chart series and replot
|
||||
if (xChange || yChange) {
|
||||
var newSeries = new Array();
|
||||
newSeries[0] = new Object();
|
||||
var newSeries = new Array();
|
||||
newSeries[0] = new Object();
|
||||
newSeries[0].marker = {
|
||||
symbol: 'circle'
|
||||
};
|
||||
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes. Code includes a lot of checks so as to replot only when necessary
|
||||
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes. Code includes a lot of checks so as to replot only when necessary
|
||||
if(xChange) {
|
||||
xCord[currentData] = selectedRow[xLabel];
|
||||
if(xType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ x : selectedRow[xLabel] });
|
||||
currentChart.xAxis[0].setExtremes(Array.min(xCord) - 6,Array.max(xCord) + 6);
|
||||
xCord[currentData] = selectedRow[xLabel];
|
||||
if(xType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ x : selectedRow[xLabel] });
|
||||
currentChart.xAxis[0].setExtremes(Array.min(xCord) - 6,Array.max(xCord) + 6);
|
||||
}
|
||||
else if(xType == 'time') {
|
||||
currentChart.series[0].data[currentData].update({ x : getTimeStamp(selectedRow[xLabel],$('#types_0').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
else if(xType == 'time') {
|
||||
currentChart.series[0].data[currentData].update({ x : getTimeStamp(selectedRow[xLabel],$('#types_0').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
|
||||
$.each(data,function(key,value) {
|
||||
$.each(data,function(key,value) {
|
||||
if(yType != 'text')
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: value[yLabel], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
else
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: value[yLabel], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
else
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
i++;
|
||||
i++;
|
||||
});
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
}
|
||||
currentSettings.series = newSeries;
|
||||
currentSettings.series = newSeries;
|
||||
currentChart = PMA_createChart(currentSettings);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(yChange) {
|
||||
|
||||
yCord[currentData] = selectedRow[yLabel];
|
||||
if(yType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] });
|
||||
currentChart.yAxis[0].setExtremes(Array.min(yCord) - 6,Array.max(yCord) + 6);
|
||||
yCord[currentData] = selectedRow[yLabel];
|
||||
if(yType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] });
|
||||
currentChart.yAxis[0].setExtremes(Array.min(yCord) - 6,Array.max(yCord) + 6);
|
||||
}
|
||||
else if(yType =='time') {
|
||||
currentChart.series[0].data[currentData].update({ y : getTimeStamp(selectedRow[yLabel],$('#types_1').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
else if(yType =='time') {
|
||||
currentChart.series[0].data[currentData].update({ y : getTimeStamp(selectedRow[yLabel],$('#types_1').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
|
||||
$.each(data,function(key,value) {
|
||||
if(xType != 'text' )
|
||||
$.each(data,function(key,value) {
|
||||
if(xType != 'text' )
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: value[xLabel], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
else
|
||||
else
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
i++;
|
||||
i++;
|
||||
});
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
}
|
||||
currentSettings.series = newSeries;
|
||||
currentSettings.series = newSeries;
|
||||
currentChart = PMA_createChart(currentSettings);
|
||||
}
|
||||
}
|
||||
currentChart.series[0].data[currentData].select();
|
||||
}
|
||||
//End plot update
|
||||
}
|
||||
currentChart.series[0].data[currentData].select();
|
||||
}
|
||||
//End plot update
|
||||
|
||||
//Generate SQL query for update
|
||||
if (!isEmpty(newValues)) {
|
||||
//Generate SQL query for update
|
||||
if (!isEmpty(newValues)) {
|
||||
var sql_query = 'UPDATE `' + window.parent.table + '` SET ';
|
||||
for (key in newValues) {
|
||||
if(key != 'where_clause') {
|
||||
sql_query += '`' + key + '`=' ;
|
||||
var value = newValues[key];
|
||||
if(!isNumeric(value) && value != null)
|
||||
sql_query += '\'' + value + '\' ,';
|
||||
else
|
||||
sql_query += value + ' ,';
|
||||
}
|
||||
}
|
||||
sql_query = sql_query.substring(0, sql_query.length - 1);
|
||||
sql_query += ' WHERE ' + PMA_urldecode(data[currentData]['where_clause']);
|
||||
|
||||
//Post SQL query to sql.php
|
||||
$.post('sql.php', {
|
||||
for (key in newValues) {
|
||||
if(key != 'where_clause') {
|
||||
sql_query += '`' + key + '`=' ;
|
||||
var value = newValues[key];
|
||||
if(!isNumeric(value) && value != null)
|
||||
sql_query += '\'' + value + '\' ,';
|
||||
else
|
||||
sql_query += value + ' ,';
|
||||
}
|
||||
}
|
||||
sql_query = sql_query.substring(0, sql_query.length - 1);
|
||||
sql_query += ' WHERE ' + PMA_urldecode(data[currentData]['where_clause']);
|
||||
|
||||
//Post SQL query to sql.php
|
||||
$.post('sql.php', {
|
||||
'token' : window.parent.token,
|
||||
'db' : window.parent.db,
|
||||
'ajax_request' : true,
|
||||
'sql_query' : sql_query,
|
||||
'inline_edit' : false
|
||||
}, function(data) {
|
||||
if(data.success == true) {
|
||||
$('#sqlqueryresults').html(data.sql_query);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
}
|
||||
else
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
})//End $.post
|
||||
}//End database update
|
||||
$("#dataDisplay").dialog("close");
|
||||
'inline_edit' : false
|
||||
}, function(data) {
|
||||
if(data.success == true) {
|
||||
$('#sqlqueryresults').html(data.sql_query);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
}
|
||||
else
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
})//End $.post
|
||||
}//End database update
|
||||
$("#dataDisplay").dialog("close");
|
||||
});//End submit handler
|
||||
|
||||
/*
|
||||
@ -418,14 +418,14 @@ $(document).ready(function() {
|
||||
.hide();
|
||||
$('#togglesearchformlink')
|
||||
.text(PMA_messages['strShowSearchCriteria'])
|
||||
$('#togglesearchformdiv').show();
|
||||
$('#togglesearchformdiv').show();
|
||||
var selectedRow;
|
||||
var colorCodes = ['#FF0000','#00FFFF','#0000FF','#0000A0','#FF0080','#800080','#FFFF00','#00FF00','#FF00FF'];
|
||||
var series = new Array();
|
||||
var xCord = new Array();
|
||||
var yCord = new Array();
|
||||
var tempX, tempY;
|
||||
var it = 0;
|
||||
var colorCodes = ['#FF0000','#00FFFF','#0000FF','#0000A0','#FF0080','#800080','#FFFF00','#00FF00','#FF00FF'];
|
||||
var series = new Array();
|
||||
var xCord = new Array();
|
||||
var yCord = new Array();
|
||||
var tempX, tempY;
|
||||
var it = 0;
|
||||
var xMax; // xAxis extreme max
|
||||
var xMin; // xAxis extreme min
|
||||
var yMax; // yAxis extreme max
|
||||
@ -434,33 +434,33 @@ $(document).ready(function() {
|
||||
// Set the basic plot settings
|
||||
var currentSettings = {
|
||||
chart: {
|
||||
renderTo: 'querychart',
|
||||
type: 'scatter',
|
||||
//zoomType: 'xy',
|
||||
width:$('#resizer').width() -3,
|
||||
height:$('#resizer').height()-20
|
||||
},
|
||||
credits: {
|
||||
renderTo: 'querychart',
|
||||
type: 'scatter',
|
||||
//zoomType: 'xy',
|
||||
width:$('#resizer').width() -3,
|
||||
height:$('#resizer').height()-20
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
exporting: { enabled: false },
|
||||
exporting: { enabled: false },
|
||||
label: { text: $('#dataLabel').val() },
|
||||
plotOptions: {
|
||||
series: {
|
||||
allowPointSelect: true,
|
||||
plotOptions: {
|
||||
series: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
showInLegend: false,
|
||||
showInLegend: false,
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
},
|
||||
point: {
|
||||
point: {
|
||||
events: {
|
||||
click: function() {
|
||||
var id = this.id;
|
||||
var fid = 4;
|
||||
currentData = id;
|
||||
// Make AJAX request to tbl_zoom_select.php for getting the complete row info
|
||||
var post_params = {
|
||||
var id = this.id;
|
||||
var fid = 4;
|
||||
currentData = id;
|
||||
// Make AJAX request to tbl_zoom_select.php for getting the complete row info
|
||||
var post_params = {
|
||||
'ajax_request' : true,
|
||||
'get_data_row' : true,
|
||||
'db' : window.parent.db,
|
||||
@ -469,33 +469,33 @@ $(document).ready(function() {
|
||||
'token' : window.parent.token,
|
||||
}
|
||||
$.post('tbl_zoom_select.php', post_params, function(data) {
|
||||
// Row is contained in data.row_info, now fill the displayResultForm with row values
|
||||
for ( key in data.row_info) {
|
||||
if (data.row_info[key] == null)
|
||||
$('#fields_null_id_' + fid).attr('checked', true);
|
||||
else
|
||||
$('#fieldID_' + fid).val(data.row_info[key]);
|
||||
fid++;
|
||||
}
|
||||
selectedRow = new Object();
|
||||
selectedRow = data.row_info;
|
||||
// Row is contained in data.row_info, now fill the displayResultForm with row values
|
||||
for ( key in data.row_info) {
|
||||
if (data.row_info[key] == null)
|
||||
$('#fields_null_id_' + fid).attr('checked', true);
|
||||
else
|
||||
$('#fieldID_' + fid).val(data.row_info[key]);
|
||||
fid++;
|
||||
}
|
||||
selectedRow = new Object();
|
||||
selectedRow = data.row_info;
|
||||
});
|
||||
|
||||
$("#dataDisplay").dialog("open");
|
||||
$("#dataDisplay").dialog("open");
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return this.point.name;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return this.point.name;
|
||||
}
|
||||
},
|
||||
title: { text: 'Query Results' },
|
||||
xAxis: {
|
||||
title: { text: $('#tableid_0').val() },
|
||||
events: {
|
||||
xAxis: {
|
||||
title: { text: $('#tableid_0').val() },
|
||||
events: {
|
||||
setExtremes: function(e){
|
||||
this.resetZoom.show();
|
||||
}
|
||||
@ -503,16 +503,16 @@ $(document).ready(function() {
|
||||
|
||||
},
|
||||
yAxis: {
|
||||
min: null,
|
||||
title: { text: $('#tableid_1').val() },
|
||||
endOnTick: false,
|
||||
min: null,
|
||||
title: { text: $('#tableid_1').val() },
|
||||
endOnTick: false,
|
||||
startOnTick: false,
|
||||
events: {
|
||||
events: {
|
||||
setExtremes: function(e){
|
||||
this.resetZoom.show();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
$('#resizer').resizable({
|
||||
@ -525,159 +525,159 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// Classify types as either numeric,time,text
|
||||
xType = getType(xType);
|
||||
yType = getType(yType);
|
||||
// Classify types as either numeric,time,text
|
||||
xType = getType(xType);
|
||||
yType = getType(yType);
|
||||
|
||||
//Set the axis type based on the field
|
||||
currentSettings.xAxis.type = (xType == 'time') ? 'datetime' : 'linear';
|
||||
currentSettings.yAxis.type = (yType == 'time') ? 'datetime' : 'linear';
|
||||
//Set the axis type based on the field
|
||||
currentSettings.xAxis.type = (xType == 'time') ? 'datetime' : 'linear';
|
||||
currentSettings.yAxis.type = (yType == 'time') ? 'datetime' : 'linear';
|
||||
|
||||
// Formulate series data for plot
|
||||
series[0] = new Object();
|
||||
series[0].data = new Array();
|
||||
series[0].marker = {
|
||||
series[0].marker = {
|
||||
symbol: 'circle'
|
||||
};
|
||||
if (xType != 'text' && yType != 'text') {
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
if (xType != 'text' && yType != 'text') {
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
series[0].data.push({ name: value[dataLabel], x: xVal, y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
it++;
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
it++;
|
||||
});
|
||||
if(xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
if(xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
}
|
||||
if(yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
if(yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (xType =='text' && yType !='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
|
||||
tempX = getCord(xCord);
|
||||
$.each(data,function(key,value) {
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
|
||||
else if (xType =='text' && yType !='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
|
||||
tempX = getCord(xCord);
|
||||
$.each(data,function(key,value) {
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
it++;
|
||||
it++;
|
||||
});
|
||||
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
}
|
||||
if(yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
if(yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
}
|
||||
xCord = tempX[2];
|
||||
}
|
||||
|
||||
else if (xType !='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
xCord = tempX[2];
|
||||
}
|
||||
|
||||
else if (xType !='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
series[0].data.push({ name: value[dataLabel], y: tempY[0][it], x: xVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
it++;
|
||||
it++;
|
||||
});
|
||||
if(xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
if(xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
}
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
yCord = tempY[2];
|
||||
}
|
||||
|
||||
else if (xType =='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempX = getCord(xCord);
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
}
|
||||
yCord = tempY[2];
|
||||
}
|
||||
|
||||
else if (xType =='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempX = getCord(xCord);
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: tempY[0][it], marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
it++;
|
||||
it++;
|
||||
});
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
}
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
}
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
}
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
currentSettings.series = series;
|
||||
currentSettings.series = series;
|
||||
currentChart = PMA_createChart(currentSettings);
|
||||
xMin = currentChart.xAxis[0].getExtremes().min;
|
||||
xMax = currentChart.xAxis[0].getExtremes().max;
|
||||
yMin = currentChart.yAxis[0].getExtremes().min;
|
||||
yMax = currentChart.yAxis[0].getExtremes().max;
|
||||
includePan(currentChart); //Enable panning feature
|
||||
xMin = currentChart.xAxis[0].getExtremes().min;
|
||||
xMax = currentChart.xAxis[0].getExtremes().max;
|
||||
yMin = currentChart.yAxis[0].getExtremes().min;
|
||||
yMax = currentChart.yAxis[0].getExtremes().max;
|
||||
includePan(currentChart); //Enable panning feature
|
||||
var setZoom = function() {
|
||||
var newxm = xMin + (xMax - xMin) * (1 - zoomRatio) / 2;
|
||||
var newxM = xMax - (xMax - xMin) * (1 - zoomRatio) / 2;
|
||||
var newym = yMin + (yMax - yMin) * (1 - zoomRatio) / 2;
|
||||
var newyM = yMax - (yMax - yMin) * (1 - zoomRatio) / 2;
|
||||
var newxm = xMin + (xMax - xMin) * (1 - zoomRatio) / 2;
|
||||
var newxM = xMax - (xMax - xMin) * (1 - zoomRatio) / 2;
|
||||
var newym = yMin + (yMax - yMin) * (1 - zoomRatio) / 2;
|
||||
var newyM = yMax - (yMax - yMin) * (1 - zoomRatio) / 2;
|
||||
currentChart.xAxis[0].setExtremes(newxm,newxM);
|
||||
currentChart.yAxis[0].setExtremes(newym,newyM);
|
||||
};
|
||||
//Enable zoom feature
|
||||
$("#querychart").mousewheel(function(objEvent, intDelta) {
|
||||
};
|
||||
//Enable zoom feature
|
||||
$("#querychart").mousewheel(function(objEvent, intDelta) {
|
||||
if (intDelta > 0) {
|
||||
if (zoomRatio > 0.1) {
|
||||
zoomRatio = zoomRatio - 0.1;
|
||||
@ -703,6 +703,6 @@ $(document).ready(function() {
|
||||
currentChart.yAxis[0].setExtremes(null, null)
|
||||
this.style.display = 'none'
|
||||
});
|
||||
scrollToChart();
|
||||
scrollToChart();
|
||||
}
|
||||
});
|
||||
|
||||
@ -111,13 +111,13 @@ class PMA_EPS
|
||||
* font can be set whenever needed in EPS
|
||||
*
|
||||
* @param string $value sets the font name e.g Arial
|
||||
* @param integer $value sets the size of the font e.g 10
|
||||
* @param integer $size sets the size of the font e.g 10
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function setFont($value,$size)
|
||||
function setFont($value, $size)
|
||||
{
|
||||
$this->font = $value;
|
||||
$this->fontSize = $size;
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
* It contains those methods which are common in them
|
||||
* it works like factory pattern
|
||||
*/
|
||||
|
||||
class PMA_Export_Relation_Schema
|
||||
{
|
||||
private $_pageTitle;
|
||||
@ -27,8 +26,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set Page Number
|
||||
*
|
||||
* @param integer value Page Number of the document to be created
|
||||
* @param integer $value Page Number of the document to be created
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setPageNumber($value)
|
||||
@ -39,8 +40,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set Show Grid
|
||||
*
|
||||
* @param boolean value show grid of the document or not
|
||||
* @param boolean $value show grid of the document or not
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setShowGrid($value)
|
||||
@ -48,6 +51,13 @@ class PMA_Export_Relation_Schema
|
||||
$this->showGrid = (isset($value) && $value == 'on') ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets showColor
|
||||
*
|
||||
* @param string $value 'on' to set the the variable
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
public function setShowColor($value)
|
||||
{
|
||||
$this->showColor = (isset($value) && $value == 'on') ? 1 : 0;
|
||||
@ -56,8 +66,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set Table Dimension
|
||||
*
|
||||
* @param boolean value show table co-ordinates or not
|
||||
* @param boolean $value show table co-ordinates or not
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setTableDimension($value)
|
||||
@ -68,8 +80,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set same width of All Tables
|
||||
*
|
||||
* @param boolean value set same width of all tables or not
|
||||
* @param boolean $value set same width of all tables or not
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setAllTableSameWidth($value)
|
||||
@ -80,8 +94,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set Data Dictionary
|
||||
*
|
||||
* @param boolean value show selected database data dictionary or not
|
||||
* @param boolean $value show selected database data dictionary or not
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setWithDataDictionary($value)
|
||||
@ -92,8 +108,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set Show only keys
|
||||
*
|
||||
* @param boolean value show only keys or not
|
||||
* @param boolean $value show only keys or not
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setShowKeys($value)
|
||||
@ -104,8 +122,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set Orientation
|
||||
*
|
||||
* @param string value Orientation will be portrait or landscape
|
||||
* @param string $value Orientation will be portrait or landscape
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setOrientation($value)
|
||||
@ -116,8 +136,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set type of paper
|
||||
*
|
||||
* @param string value paper type can be A4 etc
|
||||
* @param string $value paper type can be A4 etc
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setPaper($value)
|
||||
@ -128,8 +150,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set title of the page
|
||||
*
|
||||
* @param string value title of the page displayed at top of the document
|
||||
* @param string $title title of the page displayed at top of the document
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setPageTitle($title)
|
||||
@ -140,8 +164,10 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Set type of export relational schema
|
||||
*
|
||||
* @param string value can be pdf,svg,dia,visio,eps etc
|
||||
* @param string $value can be pdf,svg,dia,visio,eps etc
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setExportType($value)
|
||||
@ -152,22 +178,26 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* get all tables involved or included in page
|
||||
*
|
||||
* @param string db name of the database
|
||||
* @param integer pageNumber page number whose tables will be fetched in an array
|
||||
* @param string $db name of the database
|
||||
* @param integer $pageNumber page no. whose tables will be fetched in an array
|
||||
*
|
||||
* @return Array an array of tables
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getAllTables($db,$pageNumber)
|
||||
public function getAllTables($db, $pageNumber)
|
||||
{
|
||||
global $cfgRelation;
|
||||
// Get All tables
|
||||
$tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
|
||||
. ' AND pdf_page_number = ' . $pageNumber;
|
||||
$tab_sql = 'SELECT table_name FROM '
|
||||
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. PMA_backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
|
||||
. ' AND pdf_page_number = ' . $pageNumber;
|
||||
|
||||
$tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE);
|
||||
if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) {
|
||||
$this->dieSchema('',__('This page does not contain any tables!'));
|
||||
$this->dieSchema('', __('This page does not contain any tables!'));
|
||||
}
|
||||
while ($curr_table = @PMA_DBI_fetch_assoc($tab_rs)) {
|
||||
$alltables[] = PMA_sqlAddSlashes($curr_table['table_name']);
|
||||
@ -178,12 +208,15 @@ class PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Displays an error message
|
||||
*
|
||||
* @param integer pageNumber ID of the chosen page
|
||||
* @param string type Schema Type
|
||||
* @param string error_message the error mesage
|
||||
* @param integer $pageNumber ID of the chosen page
|
||||
* @param string $type Schema Type
|
||||
* @param string $error_message The error mesage
|
||||
*
|
||||
* @global array the PMA configuration array
|
||||
* @global string the current database name
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function dieSchema($pageNumber, $type = '', $error_message = '')
|
||||
@ -191,18 +224,19 @@ class PMA_Export_Relation_Schema
|
||||
global $cfg;
|
||||
global $db;
|
||||
|
||||
require_once './libraries/header.inc.php';
|
||||
echo "<p><strong>" . __("SCHEMA ERROR: ") . $type ."</strong></p>" . "\n";
|
||||
include_once './libraries/header.inc.php';
|
||||
echo "<p><strong>" . __("SCHEMA ERROR: ") . $type . "</strong></p>" . "\n";
|
||||
if (!empty($error_message)) {
|
||||
$error_message = htmlspecialchars($error_message);
|
||||
}
|
||||
echo '<p>' . "\n";
|
||||
echo ' ' . $error_message . "\n";
|
||||
echo '</p>' . "\n";
|
||||
echo '<a href="schema_edit.php?' . PMA_generate_common_url($db).'&do=selectpage&chpage='.$pageNumber.'&action_choose=0'
|
||||
. '">' . __('Back') . '</a>';
|
||||
echo '<a href="schema_edit.php?' . PMA_generate_common_url($db)
|
||||
. '&do=selectpage&chpage=' . $pageNumber . '&action_choose=0'
|
||||
. '">' . __('Back') . '</a>';
|
||||
echo "\n";
|
||||
require_once './libraries/footer.inc.php';
|
||||
include_once './libraries/footer.inc.php';
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
|
||||
include_once("Export_Relation_Schema.class.php");
|
||||
|
||||
require_once 'Export_Relation_Schema.class.php';
|
||||
require_once './libraries/PDF.class.php';
|
||||
|
||||
/**
|
||||
@ -32,6 +31,13 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
var $widths;
|
||||
private $_ff = PMA_PDF_FONT;
|
||||
|
||||
/**
|
||||
* Sets the value for margins
|
||||
*
|
||||
* @param float $c_margin margin
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
public function setCMargin($c_margin)
|
||||
{
|
||||
$this->cMargin = $c_margin;
|
||||
@ -40,12 +46,15 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
/**
|
||||
* Sets the scaling factor, defines minimum coordinates and margins
|
||||
*
|
||||
* @param float scale The scaling factor
|
||||
* @param float _xMin The minimum X coordinate
|
||||
* @param float _yMin The minimum Y coordinate
|
||||
* @param float leftMargin The left margin
|
||||
* @param float topMargin The top margin
|
||||
* @param float $scale The scaling factor
|
||||
* @param float $xMin The minimum X coordinate
|
||||
* @param float $yMin The minimum Y coordinate
|
||||
* @param float $leftMargin The left margin
|
||||
* @param float $topMargin The top margin
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function PMA_PDF_setScale($scale = 1, $xMin = 0, $yMin = 0, $leftMargin = -1, $topMargin = -1)
|
||||
{
|
||||
@ -63,14 +72,19 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
/**
|
||||
* Outputs a scaled cell
|
||||
*
|
||||
* @param float w The cell width
|
||||
* @param float h The cell height
|
||||
* @param string txt The text to output
|
||||
* @param mixed border Whether to add borders or not
|
||||
* @param integer ln Where to put the cursor once the output is done
|
||||
* @param string align Align mode
|
||||
* @param integer fill Whether to fill the cell with a color or not
|
||||
* @param float $w The cell width
|
||||
* @param float $h The cell height
|
||||
* @param string $txt The text to output
|
||||
* @param mixed $border Whether to add borders or not
|
||||
* @param integer $ln Where to put the cursor once the output is done
|
||||
* @param string $align Align mode
|
||||
* @param integer $fill Whether to fill the cell with a color or not
|
||||
* @param string $link Link
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see TCPDF::Cell()
|
||||
*/
|
||||
function PMA_PDF_cellScale($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '')
|
||||
@ -83,11 +97,15 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
/**
|
||||
* Draws a scaled line
|
||||
*
|
||||
* @param float x1 The horizontal position of the starting point
|
||||
* @param float y1 The vertical position of the starting point
|
||||
* @param float x2 The horizontal position of the ending point
|
||||
* @param float y2 The vertical position of the ending point
|
||||
* @param float $x1 The horizontal position of the starting point
|
||||
* @param float $y1 The vertical position of the starting point
|
||||
* @param float $x2 The horizontal position of the ending point
|
||||
* @param float $y2 The vertical position of the ending point
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see TCPDF::Line()
|
||||
*/
|
||||
function PMA_PDF_lineScale($x1, $y1, $x2, $y2)
|
||||
@ -102,9 +120,13 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
/**
|
||||
* Sets x and y scaled positions
|
||||
*
|
||||
* @param float x The x position
|
||||
* @param float y The y position
|
||||
* @param float $x The x position
|
||||
* @param float $y The y position
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see TCPDF::SetXY()
|
||||
*/
|
||||
function PMA_PDF_setXyScale($x, $y)
|
||||
@ -117,8 +139,12 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
/**
|
||||
* Sets the X scaled positions
|
||||
*
|
||||
* @param float x The x position
|
||||
* @param float $x The x position
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see TCPDF::SetX()
|
||||
*/
|
||||
function PMA_PDF_setXScale($x)
|
||||
@ -130,8 +156,12 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
/**
|
||||
* Sets the scaled font size
|
||||
*
|
||||
* @param float size The font size (in points)
|
||||
* @param float $size The font size (in points)
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see TCPDF::SetFontSize()
|
||||
*/
|
||||
function PMA_PDF_setFontSizeScale($size)
|
||||
@ -145,7 +175,11 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
* Sets the scaled line width
|
||||
*
|
||||
* @param float $width The line width
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see TCPDF::SetLineWidth()
|
||||
*/
|
||||
function PMA_PDF_setLineWidthScale($width)
|
||||
@ -154,6 +188,13 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
$this->SetLineWidth($width);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to render the page header.
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see TCPDF::Header()
|
||||
*/
|
||||
function Header()
|
||||
{
|
||||
// We only show this if we find something in the new pdf_pages table
|
||||
@ -161,9 +202,11 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
// This function must be named "Header" to work with the TCPDF library
|
||||
global $cfgRelation, $db, $pdf_page_number, $with_doc;
|
||||
if ($with_doc) {
|
||||
$test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
|
||||
. ' AND page_nr = \'' . $pdf_page_number . '\'';
|
||||
$test_query = 'SELECT * FROM '
|
||||
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
|
||||
. ' AND page_nr = \'' . $pdf_page_number . '\'';
|
||||
$test_rs = PMA_query_as_controluser($test_query);
|
||||
$pages = @PMA_DBI_fetch_assoc($test_rs);
|
||||
$this->SetFont($this->_ff, 'B', 14);
|
||||
@ -175,6 +218,10 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
|
||||
/**
|
||||
* This function must be named "Footer" to work with the TCPDF library
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see PMA_PDF::Footer()
|
||||
*/
|
||||
function Footer()
|
||||
{
|
||||
@ -184,6 +231,13 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets widths
|
||||
*
|
||||
* @param array $w array of widths
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
function SetWidths($w)
|
||||
{
|
||||
// column widths
|
||||
@ -195,8 +249,9 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
// line height
|
||||
$nb = 0;
|
||||
$data_cnt = count($data);
|
||||
for ($i = 0;$i < $data_cnt;$i++)
|
||||
$nb = max($nb, $this->NbLines($this->widths[$i], $data[$i]));
|
||||
for ($i = 0;$i < $data_cnt;$i++) {
|
||||
$nb = max($nb, $this->NbLines($this->widths[$i], $data[$i]));
|
||||
}
|
||||
$il = $this->FontSize;
|
||||
$h = ($il + 1) * $nb;
|
||||
// page break if necessary
|
||||
@ -225,8 +280,9 @@ class PMA_Schema_PDF extends PMA_PDF
|
||||
/**
|
||||
* Compute number of lines used by a multicell of width w
|
||||
*
|
||||
* @param int $w
|
||||
* @param string $txt
|
||||
* @param int $w width
|
||||
* @param string $txt text
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function NbLines($w, $txt)
|
||||
@ -309,18 +365,22 @@ class Table_Stats
|
||||
/**
|
||||
* The "Table_Stats" constructor
|
||||
*
|
||||
* @param string table_name The table name
|
||||
* @param integer fontSize The font size
|
||||
* @param integer pageNumber The current page number (from the
|
||||
* $cfg['Servers'][$i]['table_coords'] table)
|
||||
* @param integer sameWideWidth The max. with among tables
|
||||
* @param boolean showKeys Whether to display keys or not
|
||||
* @param boolean showInfo Whether to display table position or not
|
||||
* @param string $tableName The table name
|
||||
* @param integer $fontSize The font size
|
||||
* @param integer $pageNumber The current page number (from the
|
||||
* $cfg['Servers'][$i]['table_coords'] table)
|
||||
* @param integer &$sameWideWidth The max. with among tables
|
||||
* @param boolean $showKeys Whether to display keys or not
|
||||
* @param boolean $showInfo Whether to display table position or not
|
||||
*
|
||||
* @global object The current PDF document
|
||||
* @global array The relations settings
|
||||
* @global string The current db name
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see PMA_Schema_PDF, Table_Stats::Table_Stats_setWidth,
|
||||
Table_Stats::Table_Stats_setHeight
|
||||
* Table_Stats::Table_Stats_setHeight
|
||||
*/
|
||||
function __construct($tableName, $fontSize, $pageNumber, &$sameWideWidth, $showKeys = false, $showInfo = false)
|
||||
{
|
||||
@ -329,7 +389,7 @@ class Table_Stats
|
||||
$this->_tableName = $tableName;
|
||||
$sql = 'DESCRIBE ' . PMA_backquote($tableName);
|
||||
$result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
|
||||
if (!$result || !PMA_DBI_num_rows($result)) {
|
||||
if (! $result || ! PMA_DBI_num_rows($result)) {
|
||||
$pdf->Error(sprintf(__('The %s table doesn\'t exist!'), $tableName));
|
||||
}
|
||||
// load fields
|
||||
@ -338,7 +398,10 @@ class Table_Stats
|
||||
$indexes = PMA_Index::getFromTable($this->_tableName, $db);
|
||||
$all_columns = array();
|
||||
foreach ($indexes as $index) {
|
||||
$all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
|
||||
$all_columns = array_merge(
|
||||
$all_columns,
|
||||
array_flip(array_keys($index->getColumns()))
|
||||
);
|
||||
}
|
||||
$this->fields = array_keys($all_columns);
|
||||
} else {
|
||||
@ -358,13 +421,19 @@ class Table_Stats
|
||||
$sameWideWidth = $this->width;
|
||||
}
|
||||
$sql = 'SELECT x, y FROM '
|
||||
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
|
||||
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. PMA_backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
|
||||
. ' AND table_name = \'' . PMA_sqlAddSlashes($tableName) . '\''
|
||||
. ' AND pdf_page_number = ' . $pageNumber;
|
||||
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
|
||||
if (!$result || !PMA_DBI_num_rows($result)) {
|
||||
$pdf->Error(sprintf(__('Please configure the coordinates for table %s'), $tableName));
|
||||
if (! $result || ! PMA_DBI_num_rows($result)) {
|
||||
$pdf->Error(
|
||||
sprintf(
|
||||
__('Please configure the coordinates for table %s'),
|
||||
$tableName
|
||||
)
|
||||
);
|
||||
}
|
||||
list($this->x, $this->y) = PMA_DBI_fetch_row($result);
|
||||
$this->x = (double) $this->x;
|
||||
@ -376,7 +445,10 @@ class Table_Stats
|
||||
/*
|
||||
* index
|
||||
*/
|
||||
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
|
||||
$result = PMA_DBI_query(
|
||||
'SHOW INDEX FROM ' . PMA_backquote($tableName) . ';',
|
||||
null, PMA_DBI_QUERY_STORE
|
||||
);
|
||||
if (PMA_DBI_num_rows($result) > 0) {
|
||||
while ($row = PMA_DBI_fetch_assoc($result)) {
|
||||
if ($row['Key_name'] == 'PRIMARY') {
|
||||
@ -400,9 +472,14 @@ class Table_Stats
|
||||
/**
|
||||
* Sets the width of the table
|
||||
*
|
||||
* @param integer fontSize The font size
|
||||
* @param integer $fontSize The font size
|
||||
*
|
||||
* @global object The current PDF document
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see PMA_Schema_PDF
|
||||
*/
|
||||
private function _setWidth($fontSize)
|
||||
@ -427,6 +504,8 @@ class Table_Stats
|
||||
/**
|
||||
* Sets the height of the table
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function _setHeight()
|
||||
@ -437,10 +516,16 @@ class Table_Stats
|
||||
/**
|
||||
* Do draw the table
|
||||
*
|
||||
* @param integer fontSize The font size
|
||||
* @param boolean setColor Whether to display color
|
||||
* @global object The current PDF document
|
||||
* @param integer $fontSize The font size
|
||||
* @param boolean $withDoc
|
||||
* @param boolean $setColor Whether to display color
|
||||
*
|
||||
* @global object The current PDF document
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see PMA_Schema_PDF
|
||||
*/
|
||||
public function tableDraw($fontSize, $withDoc, $setColor = 0)
|
||||
@ -459,7 +544,16 @@ class Table_Stats
|
||||
$pdf->PMA_links['doc'][$this->_tableName]['-'] = '';
|
||||
}
|
||||
|
||||
$pdf->PMA_PDF_cellScale($this->width, $this->heightCell, $this->_getTitle(), 1, 1, 'C', $setColor, $pdf->PMA_links['doc'][$this->_tableName]['-']);
|
||||
$pdf->PMA_PDF_cellScale(
|
||||
$this->width,
|
||||
$this->heightCell,
|
||||
$this->_getTitle(),
|
||||
1,
|
||||
1,
|
||||
'C',
|
||||
$setColor,
|
||||
$pdf->PMA_links['doc'][$this->_tableName]['-']
|
||||
);
|
||||
$pdf->PMA_PDF_setXScale($this->x);
|
||||
$pdf->SetFont($this->_ff, '', $fontSize);
|
||||
$pdf->SetTextColor(0);
|
||||
@ -480,12 +574,23 @@ class Table_Stats
|
||||
$pdf->PMA_links['doc'][$this->_tableName][$field] = '';
|
||||
}
|
||||
|
||||
$pdf->PMA_PDF_cellScale($this->width, $this->heightCell, ' ' . $field, 1, 1, 'L', $setColor, $pdf->PMA_links['doc'][$this->_tableName][$field]);
|
||||
$pdf->PMA_PDF_cellScale(
|
||||
$this->width,
|
||||
$this->heightCell,
|
||||
' ' . $field,
|
||||
1,
|
||||
1,
|
||||
'L',
|
||||
$setColor,
|
||||
$pdf->PMA_links['doc'][$this->_tableName][$field]
|
||||
);
|
||||
$pdf->PMA_PDF_setXScale($this->x);
|
||||
$pdf->SetFillColor(255);
|
||||
}
|
||||
/*if ($pdf->PageNo() > 1) {
|
||||
$pdf->PMA_PDF_die(__('The scale factor is too small to fit the schema on one page'));
|
||||
$pdf->PMA_PDF_die(
|
||||
__('The scale factor is too small to fit the schema on one page')
|
||||
);
|
||||
} */
|
||||
}
|
||||
}
|
||||
@ -499,7 +604,8 @@ class Table_Stats
|
||||
* in PDF document.
|
||||
*
|
||||
* @name Relation_Stats
|
||||
* @see PMA_Schema_PDF::SetDrawColor,PMA_Schema_PDF::PMA_PDF_setLineWidthScale,PMA_Schema_PDF::PMA_PDF_lineScale
|
||||
* @see PMA_Schema_PDF::SetDrawColor, PMA_Schema_PDF::PMA_PDF_setLineWidthScale,
|
||||
* PMA_Schema_PDF::PMA_PDF_lineScale
|
||||
*/
|
||||
class Relation_Stats
|
||||
{
|
||||
@ -515,10 +621,13 @@ class Relation_Stats
|
||||
/**
|
||||
* The "Relation_Stats" constructor
|
||||
*
|
||||
* @param string master_table The master table name
|
||||
* @param string master_field The relation field in the master table
|
||||
* @param string foreign_table The foreign table name
|
||||
* @param string foreigh_field The relation field in the foreign table
|
||||
* @param string $master_table The master table name
|
||||
* @param string $master_field The relation field in the master table
|
||||
* @param string $foreign_table The foreign table name
|
||||
* @param string $foreign_field The relation field in the foreign table
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see Relation_Stats::_getXy
|
||||
*/
|
||||
function __construct($master_table, $master_field, $foreign_table, $foreign_field)
|
||||
@ -569,9 +678,11 @@ class Relation_Stats
|
||||
/**
|
||||
* Gets arrows coordinates
|
||||
*
|
||||
* @param string table The current table name
|
||||
* @param string column The relation column name
|
||||
* @param string $table The current table name
|
||||
* @param string $column The relation column name
|
||||
*
|
||||
* @return array Arrows coordinates
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function _getXy($table, $column)
|
||||
@ -582,13 +693,17 @@ class Relation_Stats
|
||||
}
|
||||
|
||||
/**
|
||||
* draws relation links and arrows
|
||||
* shows foreign key relations
|
||||
* draws relation links and arrows shows foreign key relations
|
||||
*
|
||||
* @param boolean $changeColor Whether to use one color per relation or not
|
||||
* @param integer $i The id of the link to draw
|
||||
*
|
||||
* @param boolean changeColor Whether to use one color per relation or not
|
||||
* @param integer i The id of the link to draw
|
||||
* @global object The current PDF document
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see PMA_Schema_PDF
|
||||
*/
|
||||
public function relationDraw($changeColor, $i)
|
||||
@ -607,7 +722,7 @@ class Relation_Stats
|
||||
array(1, 1, 0),
|
||||
array(1, 0, 1),
|
||||
array(0, 1, 1)
|
||||
);
|
||||
);
|
||||
list ($a, $b, $c) = $case[$d];
|
||||
$e = (1 - ($j - 1) / 6);
|
||||
$pdf->SetDrawColor($a * 255 * $e, $b * 255 * $e, $c * 255 * $e);
|
||||
@ -615,19 +730,54 @@ class Relation_Stats
|
||||
$pdf->SetDrawColor(0);
|
||||
}
|
||||
$pdf->PMA_PDF_setLineWidthScale(0.2);
|
||||
$pdf->PMA_PDF_lineScale($this->xSrc, $this->ySrc, $this->xSrc + $this->srcDir * $this->wTick, $this->ySrc);
|
||||
$pdf->PMA_PDF_lineScale($this->xDest + $this->destDir * $this->wTick, $this->yDest, $this->xDest, $this->yDest);
|
||||
$pdf->PMA_PDF_lineScale(
|
||||
$this->xSrc,
|
||||
$this->ySrc,
|
||||
$this->xSrc + $this->srcDir * $this->wTick,
|
||||
$this->ySrc
|
||||
);
|
||||
$pdf->PMA_PDF_lineScale(
|
||||
$this->xDest + $this->destDir * $this->wTick,
|
||||
$this->yDest,
|
||||
$this->xDest,
|
||||
$this->yDest
|
||||
);
|
||||
$pdf->PMA_PDF_setLineWidthScale(0.1);
|
||||
$pdf->PMA_PDF_lineScale($this->xSrc + $this->srcDir * $this->wTick, $this->ySrc, $this->xDest + $this->destDir * $this->wTick, $this->yDest);
|
||||
$pdf->PMA_PDF_lineScale(
|
||||
$this->xSrc + $this->srcDir * $this->wTick,
|
||||
$this->ySrc,
|
||||
$this->xDest + $this->destDir * $this->wTick,
|
||||
$this->yDest
|
||||
);
|
||||
/*
|
||||
* Draws arrows ->
|
||||
*/
|
||||
$root2 = 2 * sqrt(2);
|
||||
$pdf->PMA_PDF_lineScale($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc, $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick, $this->ySrc + $this->wTick / $root2);
|
||||
$pdf->PMA_PDF_lineScale($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc, $this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick, $this->ySrc - $this->wTick / $root2);
|
||||
$pdf->PMA_PDF_lineScale(
|
||||
$this->xSrc + $this->srcDir * $this->wTick * 0.75,
|
||||
$this->ySrc,
|
||||
$this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick,
|
||||
$this->ySrc + $this->wTick / $root2
|
||||
);
|
||||
$pdf->PMA_PDF_lineScale(
|
||||
$this->xSrc + $this->srcDir * $this->wTick * 0.75,
|
||||
$this->ySrc,
|
||||
$this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick,
|
||||
$this->ySrc - $this->wTick / $root2
|
||||
);
|
||||
|
||||
$pdf->PMA_PDF_lineScale($this->xDest + $this->destDir * $this->wTick / 2, $this->yDest, $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick, $this->yDest + $this->wTick / $root2);
|
||||
$pdf->PMA_PDF_lineScale($this->xDest + $this->destDir * $this->wTick / 2, $this->yDest, $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick, $this->yDest - $this->wTick / $root2);
|
||||
$pdf->PMA_PDF_lineScale(
|
||||
$this->xDest + $this->destDir * $this->wTick / 2,
|
||||
$this->yDest,
|
||||
$this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick,
|
||||
$this->yDest + $this->wTick / $root2
|
||||
);
|
||||
$pdf->PMA_PDF_lineScale(
|
||||
$this->xDest + $this->destDir * $this->wTick / 2,
|
||||
$this->yDest,
|
||||
$this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick,
|
||||
$this->yDest - $this->wTick / $root2
|
||||
);
|
||||
$pdf->SetDrawColor(0);
|
||||
}
|
||||
}
|
||||
@ -688,11 +838,17 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
|
||||
// Initializes a new document
|
||||
$pdf = new PMA_Schema_PDF($this->orientation, 'mm', $this->paper);
|
||||
$pdf->SetTitle(sprintf(__('Schema of the %s database - Page %s'), $GLOBALS['db'], $this->pageNumber));
|
||||
$pdf->SetTitle(
|
||||
sprintf(
|
||||
__('Schema of the %s database - Page %s'),
|
||||
$GLOBALS['db'],
|
||||
$this->pageNumber
|
||||
)
|
||||
);
|
||||
$pdf->setCMargin(0);
|
||||
$pdf->Open();
|
||||
$pdf->SetAutoPageBreak('auto');
|
||||
$alltables = $this->getAllTables($db,$this->pageNumber);
|
||||
$alltables = $this->getAllTables($db, $this->pageNumber);
|
||||
|
||||
if ($this->withDoc) {
|
||||
$pdf->SetAutoPageBreak('auto', 15);
|
||||
@ -707,7 +863,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
if ($this->withDoc) {
|
||||
$pdf->SetLink($pdf->PMA_links['RT']['-'], -1);
|
||||
$pdf->Bookmark(__('Relational schema'));
|
||||
$pdf->SetAlias('{00}', $pdf->PageNo()) ;
|
||||
$pdf->SetAlias('{00}', $pdf->PageNo());
|
||||
$this->topMargin = 28;
|
||||
$this->bottomMargin = 28;
|
||||
}
|
||||
@ -715,7 +871,13 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
/* snip */
|
||||
foreach ($alltables as $table) {
|
||||
if (! isset($this->tables[$table])) {
|
||||
$this->tables[$table] = new Table_Stats($table, $this->_ff, $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
|
||||
$this->tables[$table] = new Table_Stats(
|
||||
$table, $this->_ff,
|
||||
$this->pageNumber,
|
||||
$this->_tablewidth,
|
||||
$this->showKeys,
|
||||
$this->tableDimension
|
||||
);
|
||||
}
|
||||
if ($this->sameWide) {
|
||||
$this->tables[$table]->width = $this->_tablewidth;
|
||||
@ -727,10 +889,17 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
$this->scale = ceil(
|
||||
max(
|
||||
($this->_xMax - $this->_xMin) / ($pdf->getPageWidth() - $this->rightMargin - $this->leftMargin),
|
||||
($this->_yMax - $this->_yMin) / ($pdf->getPageHeight() - $this->topMargin - $this->bottomMargin))
|
||||
* 100) / 100;
|
||||
($this->_yMax - $this->_yMin) / ($pdf->getPageHeight() - $this->topMargin - $this->bottomMargin)
|
||||
) * 100
|
||||
) / 100;
|
||||
|
||||
$pdf->PMA_PDF_setScale($this->scale, $this->_xMin, $this->_yMin, $this->leftMargin, $this->topMargin);
|
||||
$pdf->PMA_PDF_setScale(
|
||||
$this->scale,
|
||||
$this->_xMin,
|
||||
$this->_yMin,
|
||||
$this->leftMargin,
|
||||
$this->topMargin
|
||||
);
|
||||
// Builds and save the PDF document
|
||||
$pdf->PMA_PDF_setLineWidthScale(0.1);
|
||||
|
||||
@ -753,7 +922,13 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
// (do not use array_search() because we would have to
|
||||
// to do a === false and this is not PHP3 compatible)
|
||||
if (in_array($rel['foreign_table'], $alltables)) {
|
||||
$this->_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
|
||||
$this->_addRelation(
|
||||
$one_table,
|
||||
$master_field,
|
||||
$rel['foreign_table'],
|
||||
$rel['foreign_field'],
|
||||
$this->tableDimension
|
||||
);
|
||||
}
|
||||
} // end while
|
||||
} // end if
|
||||
@ -770,7 +945,10 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Sets X and Y minimum and maximum for a table cell
|
||||
*
|
||||
* @param string table The table name of which sets XY co-ordinates
|
||||
* @param string $table The table name of which sets XY co-ordinates
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function _setMinMax($table)
|
||||
@ -784,32 +962,49 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Defines relation objects
|
||||
*
|
||||
* @param string master_table The master table name
|
||||
* @param string master_field The relation field in the master table
|
||||
* @param string foreign_table The foreign table name
|
||||
* @param string foreign_field The relation field in the foreign table
|
||||
* @param boolean show_info Whether to display table position or not
|
||||
* @param string $masterTable The master table name
|
||||
* @param string $masterField The relation field in the master table
|
||||
* @param string $foreignTable The foreign table name
|
||||
* @param string $foreignField The relation field in the foreign table
|
||||
* @param boolean $showInfo Whether to display table position or not
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see _setMinMax
|
||||
*/
|
||||
private function _addRelation($masterTable, $masterField, $foreignTable, $foreignField, $showInfo)
|
||||
{
|
||||
if (! isset($this->tables[$masterTable])) {
|
||||
$this->tables[$masterTable] = new Table_Stats($masterTable, $this->_ff, $this->pageNumber, $this->_tablewidth, false, $showInfo);
|
||||
$this->tables[$masterTable] = new Table_Stats(
|
||||
$masterTable, $this->_ff, $this->pageNumber,
|
||||
$this->_tablewidth, false, $showInfo
|
||||
);
|
||||
$this->_setMinMax($this->tables[$masterTable]);
|
||||
}
|
||||
if (! isset($this->tables[$foreignTable])) {
|
||||
$this->tables[$foreignTable] = new Table_Stats($foreignTable, $this->_ff, $this->pageNumber, $this->_tablewidth, false, $showInfo);
|
||||
$this->tables[$foreignTable] = new Table_Stats(
|
||||
$foreignTable, $this->_ff, $this->pageNumber,
|
||||
$this->_tablewidth, false, $showInfo
|
||||
);
|
||||
$this->_setMinMax($this->tables[$foreignTable]);
|
||||
}
|
||||
$this->relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
|
||||
$this->relations[] = new Relation_Stats(
|
||||
$this->tables[$masterTable], $masterField,
|
||||
$this->tables[$foreignTable], $foreignField
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the grid
|
||||
*
|
||||
* @global object the current PMA_Schema_PDF instance
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see PMA_Schema_PDF
|
||||
*/
|
||||
private function _strokeGrid()
|
||||
@ -831,19 +1026,35 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
$pdf->SetDrawColor(200, 200, 200);
|
||||
// Draws horizontal lines
|
||||
for ($l = 0; $l <= intval(($pdf->getPageHeight() - $topSpace - $bottomSpace) / $gridSize); $l++) {
|
||||
$pdf->line(0, $l * $gridSize + $topSpace, $pdf->getPageWidth(), $l * $gridSize + $topSpace);
|
||||
$pdf->line(
|
||||
0, $l * $gridSize + $topSpace,
|
||||
$pdf->getPageWidth(), $l * $gridSize + $topSpace
|
||||
);
|
||||
// Avoid duplicates
|
||||
if ($l > 0 && $l <= intval(($pdf->getPageHeight() - $topSpace - $bottomSpace - $labelHeight) / $gridSize)) {
|
||||
if ($l > 0
|
||||
&& $l <= intval(($pdf->getPageHeight() - $topSpace - $bottomSpace - $labelHeight) / $gridSize)
|
||||
) {
|
||||
$pdf->SetXY(0, $l * $gridSize + $topSpace);
|
||||
$label = (string) sprintf('%.0f', ($l * $gridSize + $topSpace - $this->topMargin) * $this->scale + $this->_yMin);
|
||||
$label = (string) sprintf(
|
||||
'%.0f',
|
||||
($l * $gridSize + $topSpace - $this->topMargin) * $this->scale + $this->_yMin
|
||||
);
|
||||
$pdf->Cell($labelWidth, $labelHeight, ' ' . $label);
|
||||
} // end if
|
||||
} // end for
|
||||
// Draws vertical lines
|
||||
for ($j = 0; $j <= intval($pdf->getPageWidth() / $gridSize); $j++) {
|
||||
$pdf->line($j * $gridSize, $topSpace, $j * $gridSize, $pdf->getPageHeight() - $bottomSpace);
|
||||
$pdf->line(
|
||||
$j * $gridSize,
|
||||
$topSpace,
|
||||
$j * $gridSize,
|
||||
$pdf->getPageHeight() - $bottomSpace
|
||||
);
|
||||
$pdf->SetXY($j * $gridSize, $topSpace);
|
||||
$label = (string) sprintf('%.0f', ($j * $gridSize - $this->leftMargin) * $this->scale + $this->_xMin);
|
||||
$label = (string) sprintf(
|
||||
'%.0f',
|
||||
($j * $gridSize - $this->leftMargin) * $this->scale + $this->_xMin
|
||||
);
|
||||
$pdf->Cell($labelWidth, $labelHeight, $label);
|
||||
}
|
||||
}
|
||||
@ -851,8 +1062,12 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Draws relation arrows
|
||||
*
|
||||
* @param boolean changeColor Whether to use one color per relation or not
|
||||
* @param boolean $changeColor Whether to use one color per relation or not
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see Relation_Stats::relationdraw()
|
||||
*/
|
||||
private function _drawRelations($changeColor)
|
||||
@ -867,8 +1082,12 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
/**
|
||||
* Draws tables
|
||||
*
|
||||
* @param boolean changeColor Whether to display table position or not
|
||||
* @param boolean $changeColor Whether to display table position or not
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see Table_Stats::tableDraw()
|
||||
*/
|
||||
private function _drawTables($changeColor = 0)
|
||||
@ -882,11 +1101,16 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
* Ouputs the PDF document to a file
|
||||
* or sends the output to browser
|
||||
*
|
||||
* @param integer $pageNumber page number
|
||||
*
|
||||
* @global object The current PDF document
|
||||
* @global string The current database name
|
||||
* @global integer The current page number (from the
|
||||
* $cfg['Servers'][$i]['table_coords'] table)
|
||||
* $cfg['Servers'][$i]['table_coords'] table)
|
||||
* @access private
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
* @see PMA_Schema_PDF
|
||||
*/
|
||||
private function _showOutput($pageNumber)
|
||||
@ -894,8 +1118,10 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
global $pdf, $db, $cfgRelation;
|
||||
|
||||
// Get the name of this pdfpage to use as filename
|
||||
$_name_sql = 'SELECT page_descr FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE page_nr = ' . $pageNumber;
|
||||
$_name_sql = 'SELECT page_descr FROM '
|
||||
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. PMA_backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE page_nr = ' . $pageNumber;
|
||||
$_name_rs = PMA_query_as_controluser($_name_sql);
|
||||
if ($_name_rs) {
|
||||
$_name_row = PMA_DBI_fetch_row($_name_rs);
|
||||
@ -919,36 +1145,54 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
$pdf->PMA_links['doc'][$table]['-'] = $pdf->AddLink();
|
||||
$pdf->SetX(10);
|
||||
// $pdf->Ln(1);
|
||||
$pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$table]['-']);
|
||||
$pdf->Cell(
|
||||
0, 6, __('Page number:') . ' {' . sprintf("%02d", $i) . '}', 0, 0,
|
||||
'R', 0, $pdf->PMA_links['doc'][$table]['-']
|
||||
);
|
||||
$pdf->SetX(10);
|
||||
$pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
|
||||
$pdf->Cell(
|
||||
0, 6, $i . ' ' . $table, 0, 1,
|
||||
'L', 0, $pdf->PMA_links['doc'][$table]['-']
|
||||
);
|
||||
// $pdf->Ln(1);
|
||||
$fields = PMA_DBI_get_columns($GLOBALS['db'], $table);
|
||||
foreach($fields as $row) {
|
||||
foreach ($fields as $row) {
|
||||
$pdf->SetX(20);
|
||||
$field_name = $row['Field'];
|
||||
$pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();
|
||||
// $pdf->Cell(0, 6, $field_name,0,1,'L',0, $pdf->PMA_links['doc'][$table][$field_name]);
|
||||
//$pdf->Cell(
|
||||
// 0, 6, $field_name, 0, 1,
|
||||
// 'L', 0, $pdf->PMA_links['doc'][$table][$field_name]
|
||||
//);
|
||||
}
|
||||
$lasttable = $table;
|
||||
$i++;
|
||||
}
|
||||
$pdf->PMA_links['RT']['-'] = $pdf->AddLink();
|
||||
$pdf->SetX(10);
|
||||
$pdf->Cell(0, 6, __('Page number:') . ' {00}', 0, 0, 'R', 0, $pdf->PMA_links['RT']['-']);
|
||||
$pdf->Cell(
|
||||
0, 6, __('Page number:') . ' {00}', 0, 0,
|
||||
'R', 0, $pdf->PMA_links['RT']['-']
|
||||
);
|
||||
$pdf->SetX(10);
|
||||
$pdf->Cell(0, 6, $i . ' ' . __('Relational schema'), 0, 1, 'L', 0, $pdf->PMA_links['RT']['-']);
|
||||
$pdf->Cell(
|
||||
0, 6, $i . ' ' . __('Relational schema'), 0, 1,
|
||||
'L', 0, $pdf->PMA_links['RT']['-']
|
||||
);
|
||||
$z = 0;
|
||||
foreach ($alltables as $table) {
|
||||
$z++;
|
||||
$pdf->SetAutoPageBreak(true, 15);
|
||||
$pdf->addpage($GLOBALS['orientation']);
|
||||
$pdf->Bookmark($table);
|
||||
$pdf->SetAlias('{' . sprintf("%02d", $z) . '}', $pdf->PageNo()) ;
|
||||
$pdf->SetAlias('{' . sprintf("%02d", $z) . '}', $pdf->PageNo());
|
||||
$pdf->PMA_links['RT'][$table]['-'] = $pdf->AddLink();
|
||||
$pdf->SetLink($pdf->PMA_links['doc'][$table]['-'], -1);
|
||||
$pdf->SetFont($this->_ff, 'B', 18);
|
||||
$pdf->Cell(0, 8, $z . ' ' . $table, 1, 1, 'C', 0, $pdf->PMA_links['RT'][$table]['-']);
|
||||
$pdf->Cell(
|
||||
0, 8, $z . ' ' . $table, 1, 1,
|
||||
'C', 0, $pdf->PMA_links['RT'][$table]['-']
|
||||
);
|
||||
$pdf->SetFont($this->_ff, '', 8);
|
||||
$pdf->ln();
|
||||
|
||||
@ -962,11 +1206,21 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
* Gets table informations
|
||||
*/
|
||||
$showtable = PMA_Table::sGetStatusInfo($db, $table);
|
||||
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
|
||||
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
|
||||
$create_time = (isset($showtable['Create_time']) ? PMA_localisedDate(strtotime($showtable['Create_time'])) : '');
|
||||
$update_time = (isset($showtable['Update_time']) ? PMA_localisedDate(strtotime($showtable['Update_time'])) : '');
|
||||
$check_time = (isset($showtable['Check_time']) ? PMA_localisedDate(strtotime($showtable['Check_time'])) : '');
|
||||
$num_rows = isset($showtable['Rows'])
|
||||
? $showtable['Rows']
|
||||
: 0;
|
||||
$show_comment = isset($showtable['Comment'])
|
||||
? $showtable['Comment']
|
||||
: '';
|
||||
$create_time = isset($showtable['Create_time'])
|
||||
? PMA_localisedDate(strtotime($showtable['Create_time']))
|
||||
: '';
|
||||
$update_time = isset($showtable['Update_time'])
|
||||
? PMA_localisedDate(strtotime($showtable['Update_time']))
|
||||
: '';
|
||||
$check_time = isset($showtable['Check_time'])
|
||||
? PMA_localisedDate(strtotime($showtable['Check_time']))
|
||||
: '';
|
||||
|
||||
/**
|
||||
* Gets table keys and retains them
|
||||
@ -996,7 +1250,7 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
$indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
|
||||
}
|
||||
// I don't know what does following column mean....
|
||||
// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed'];
|
||||
// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed'];
|
||||
$indexes_info[$row['Key_name']]['Comment'] = $row['Comment'];
|
||||
|
||||
$indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
|
||||
@ -1032,22 +1286,22 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
*/
|
||||
|
||||
$break = false;
|
||||
if (!empty($show_comment)) {
|
||||
if (! empty($show_comment)) {
|
||||
$pdf->Cell(0, 3, __('Table comments') . ' : ' . $show_comment, 0, 1);
|
||||
$break = true;
|
||||
}
|
||||
|
||||
if (!empty($create_time)) {
|
||||
if (! empty($create_time)) {
|
||||
$pdf->Cell(0, 3, __('Creation') . ': ' . $create_time, 0, 1);
|
||||
$break = true;
|
||||
}
|
||||
|
||||
if (!empty($update_time)) {
|
||||
if (! empty($update_time)) {
|
||||
$pdf->Cell(0, 3, __('Last update') . ': ' . $update_time, 0, 1);
|
||||
$break = true;
|
||||
}
|
||||
|
||||
if (!empty($check_time)) {
|
||||
if (! empty($check_time)) {
|
||||
$pdf->Cell(0, 3, __('Last check') . ': ' . $check_time, 0, 1);
|
||||
$break = true;
|
||||
}
|
||||
@ -1095,8 +1349,8 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
|
||||
foreach ($columns as $row) {
|
||||
$extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
|
||||
$type = $extracted_fieldspec['print_type'];
|
||||
$attribute = $extracted_fieldspec['attribute'];
|
||||
$type = $extracted_fieldspec['print_type'];
|
||||
$attribute = $extracted_fieldspec['attribute'];
|
||||
if (! isset($row['Default'])) {
|
||||
if ($row['Null'] != '' && $row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
@ -1107,22 +1361,28 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
|
||||
$pdf->PMA_links['RT'][$table][$field_name] = $pdf->AddLink();
|
||||
$pdf->Bookmark($field_name, 1, -1);
|
||||
$pdf->SetLink($pdf->PMA_links['doc'][$table][$field_name], -1);
|
||||
$pdf_row = array($field_name,
|
||||
$pdf_row = array(
|
||||
$field_name,
|
||||
$type,
|
||||
$attribute,
|
||||
($row['Null'] == '' || $row['Null'] == 'NO') ? __('No') : __('Yes'),
|
||||
((isset($row['Default'])) ? $row['Default'] : ''),
|
||||
(isset($row['Default']) ? $row['Default'] : ''),
|
||||
$row['Extra'],
|
||||
((isset($res_rel[$field_name])) ? $res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] : ''),
|
||||
((isset($comments[$field_name])) ? $comments[$field_name] : ''),
|
||||
((isset($mime_map) && isset($mime_map[$field_name])) ? str_replace('_', '/', $mime_map[$field_name]['mimetype']) : '')
|
||||
);
|
||||
(isset($res_rel[$field_name])
|
||||
? $res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']
|
||||
: ''),
|
||||
(isset($comments[$field_name])
|
||||
? $comments[$field_name]
|
||||
: ''),
|
||||
(isset($mime_map) && isset($mime_map[$field_name])
|
||||
? str_replace('_', '/', $mime_map[$field_name]['mimetype'])
|
||||
: '')
|
||||
);
|
||||
$links[0] = $pdf->PMA_links['RT'][$table][$field_name];
|
||||
if (isset($res_rel[$field_name]['foreign_table']) AND
|
||||
isset($res_rel[$field_name]['foreign_field']) AND
|
||||
isset($pdf->PMA_links['doc'][$res_rel[$field_name]['foreign_table']][$res_rel[$field_name]['foreign_field']])
|
||||
)
|
||||
{
|
||||
if (isset($res_rel[$field_name]['foreign_table'])
|
||||
AND isset($res_rel[$field_name]['foreign_field'])
|
||||
AND isset($pdf->PMA_links['doc'][$res_rel[$field_name]['foreign_table']][$res_rel[$field_name]['foreign_field']])
|
||||
) {
|
||||
$links[6] = $pdf->PMA_links['doc'][$res_rel[$field_name]['foreign_table']][$res_rel[$field_name]['foreign_field']];
|
||||
} else {
|
||||
unset($links[6]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user