[TYPO3-core] make class.t3lib_db.php usable for backend modules

Holzinger Franz franz at fholzinger.com
Wed Nov 30 16:24:14 CET 2005

Hello Core list people,

I am new to this list now. I live in Köln/Germany and are currently 
developing for the 2 TYPO3 shop extensions you certainly have already 
heard of.

I am currently developing the Graytree Library which is good for 
displaying a category tree in the backend and frontend.
On the right side of this tree the same list like in the LIST module 
should get displayed. However I could not use the class.t3lib_db.php to 
do this but had to copy most of its code, because the BACKPATH variable 
is not used. And the class file has its own creation parts so nobody can 
derive a class from it.

And what I also need is to pass paramters there. E.g.

        // Graytree Anfang
        $this->graytree = t3lib_div::_GP('graytree');
        if ($this->graytree) {
            $this->table = key ($this->graytree);
            $this->valueArray = current($this->graytree);

The name can be different of course. Which name do you prefer? The 
paramters are necessary to make it possible to create a filter on the 
records on the list and display only parts of them. And it also tells 
which tables should be displayed there. This is because it will depend 
on categories and not on the page ids.

And I also need additional class member variables:

        // Graytree Start
    var $control;                //Array of tree leaf names and leaf 
data classes 
                                /* Example.
        $this->control = array (
            'category' => array ('selType' => 'txmyextCategory', 
                                'selClass' => 
                                'parent'   => 'parent_category'),
            'product' => array ( 'selType' => 'txmyextProduct', 
                                'selClass' => 
                                'parent'   => 'categories')
                                ); */
    var $script;                // the script calling this class
    var $params;                // the parameters for the script
        // Graytree Ende

The control paramter tells the type, the data class and the table field 
which will be the link to the parent. The extension programmer will 
derive a class from a new subclass of t3lib_DB which will contain 
everything of the current t3lib_DB. These member variables can be set on 
his init routine outside of the base class. The 'selClass' will be 
instantiated in the new subclass of t3lib_DB. The 'selClass' is 
necessary to deliver the database records which belong to the current 
category. Only they should get displayed in the list. And this class 
knows how to get them. Every backend programmer can write his own 
classes for this as he likes. They have a common interface:

When this control array is missing then it should behave like it is now 
where all records of the current page id are displayed.

And the dblist needs additional parameters:

                $dblist->script = $this->script;            // Current 
script name
                $dblist->params = $this->params;
                $dblist->defVals = 
'&defVals['.$treedb->table.']['.$controldat['parent'].']=' .$parent_uid;

The defVals are necessary when the record gets edited or a new record 
gets created. These will be used as the default values by the dynaflex 

Also the other class needs some modification:
class graytreeRecordList extends localRecordList {
    // Graytree Start
    var $uid;                         // uid - unique record ids
    var $parent_uid;             // uid of the parent category
    var $params;                  // the paramters for the script
    var $defVals;                  // default values necessary for the 
    // Graytree Ende

I hope you agree that I can start to bring the changes from Graytree 
record list view into TYPO3.



More information about the TYPO3-team-core mailing list