In this week I started the second phase of my work — OOPing table related scripts. I’d like to create a basic MVC structure for table related scripts. Before diving into the MVC structure, in this week I was decomposing tbl_*.lib.php for the convenience of the future work.
Files Covered In This Week
Outcomes In This Week
The new GIS_Visualization class
First I found that the effect of the GIS_Visualization class is to convert raw data into diagrams and images. So I used Factory Pattern on it, and replace the constructor with a new private constructor. When we need to use this class, we can just use it in this way:
require_once 'libraries/gis/GIS_Visualization.class.php'; PMA_GIS_Visualization::get($sql_query, $options, $row, $pos, $data = null);
$sql_query is the SQL using to fetch raw data from database, and the
$pos is the same as
function PMA_GIS_modifyQuery($sql_query, $visualizationSettings, $rows = null, $pos = null) before. When we specify
$data field in the constructor, other parameters except
$options make no effect.
Some tbl_*.lib.php scripts decomposed
I am going to create a TableController to handle logic just I mentioned before, so I decomposed them and move these logics into corresponding tbl_*.php for convenience. Logic processing codes can be easily extracted from tbl_*.php when I started to create the TableController class with these logics represented as methods.
Somethings about the tbl_columns_definition_form.lib.php
Now there is only one functions
PMA_getHtmlForColumnAttributes left in the tbl_columns_definition_form.lib.php. After I figure out ways to elimate it, I will create a new PR.
What Will I Do Next
Now I have almost finished decomposing tbl_*.lib.php scripts. In next few days I will create a TableController class for handling logic processing and communicate with the Table class to fetch data. The TableController class should available at June.18th.