HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   *.list.php: how get records from an SQL query instead of a table (http://www.howtoforge.com/forums/showthread.php?t=55151)

caudatus 28th November 2011 16:18

*.list.php: how get records from an SQL query instead of a table
 
Dear Till!


It's the first time when I can say a big thank for this great admin sw, "ispconfig"!

Could You tell me,
that Is it possible in *.list.php files to get records from an SQL select query instead of a simple table ?

To define the record source by default the form (with an example table) is:

$liste["table"] = "mail_forwarding";

It would be nice to create merged lists, for example primary and secondary dns zones in one list.

Thank You very much!

Janos

till 28th November 2011 16:33

Each list object in ISPConfig is based on the class listform_actions. The listform actions can be found in interface/lib/classes/listform_actions.inc.php file. This class contains a function named getQueryString() which returns the sql string that is used to display the list. To show lists with a more complex sql syntax, you can override the function getQueryString() in your custom list file.

Example:

Code:

$app->load('listform_actions');

class list_action extends listform_actions {
       
        function getQueryString(){
                $my_sql_query = "SELECT * FROM a,b WHERE ......";
                return $my_sql_query;

        }
       
}

$list = new list_action;
$list->onLoad();



All times are GMT +2. The time now is 05:41.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.