Contao-Konferenz 2024
Ergebnis 1 bis 3 von 3

Thema: [gelöst] Datensätze in ptable->ctable-Relation werden gelöscht

  1. #1
    Contao-Nutzer
    Registriert seit
    27.09.2010.
    Beiträge
    23

    Standard [gelöst] Datensätze in ptable->ctable-Relation werden gelöscht

    Tach zusammen,

    ich habe folgendes Problem:
    3 Tabellen, davon ist eine Parent und die anderen beiden Children von dieser:

    Dokument *----------1 Kategorie 1-------------* Zugriffsrecht

    Wenn ich Dokumente anlege ist alles tutti, pid wird entsprechend eingetragen.
    Wenn ich Zugriffsrechte anlege, werden die von Aufräumjob gelöscht, pid bleib immer 0 beim anlegen...

    Hier meine DCA's:
    PHP-Code:
    $GLOBALS['TL_DCA']['tl_mb_dokument'] = array
    (

        
    // Config
        
    'config' => array
        (
            
    'dataContainer'               => 'Table',
            
    'ptable'              => 'tl_mb_kategorie',
            
    'enableVersioning'            => true
        
    ),

        
    // List
        
    'list' => array
        (
            
    'sorting' => array
            (
                
    'mode'                    => 6,
                
    'fields'                  => array('dk_name','dk_datei'),
                
    'flag'                    => 1
            
    ),
            
    'label' => array
            (
                
    'fields'                  => array('dk_name'),
                
    'format'                  => '%s'
            
    ),
            
    'global_operations' => array
            (
                
    'all' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
                    
    'href'                => 'act=select',
                    
    'class'               => 'header_edit_all',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset();" accesskey="e"'
                
    )
            ),
            
    'operations' => array
            (
                
    'edit' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['edit'],
                    
    'href'                => 'act=edit',
                    
    'icon'                => 'edit.gif'
                
    ),
                
    'copy' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['copy'],
                    
    'href'                => 'act=copy',
                    
    'icon'                => 'copy.gif'
                
    ),
                
    'delete' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['delete'],
                    
    'href'                => 'act=delete',
                    
    'icon'                => 'delete.gif',
                    
    'attributes'          => 'onclick="if (!confirm(\'' $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
                
    ),
                
    'show' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['show'],
                    
    'href'                => 'act=show',
                    
    'icon'                => 'show.gif'
                
    )
            )
        ),

        
    // Palettes
        
    'palettes' => array
        (
            
    '__selector__'                => array(''),
            
    'default'                     => '{dokument_legend},dk_name,dk_kategorieid,dk_beschreibung,dk_stichworte;dk_datei,dk_dateityp,dk_dateigroesse;dk_upload_userid,dk_upload_datum,dk_speicherpfad,dk_abgeschlossen'
        
    ),

        
    // Subpalettes
        
    'subpalettes' => array
        (
            
    ''                            => ''
        
    ),

        
    // Fields
        
    'fields' => array
        (
        
    // varchar(64)
            
    'dk_name' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_name'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>64)
            ),

        
    //varchar(10), fk
        
            
    'dk_kategorieid' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_kategorieid'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'foreignKey'          => 'tl_mb_kategorie.kt_name',
                
    'eval'                    => array( 'multiple'=>false'mandatory'=>true,'maxlength'=>10)
            ),

        
    //text
            
    'dk_beschreibung' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_beschreibung'],
                
    'exclude'                 => true,
                
    'inputType'               => 'textarea',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>255)
            ),

        
    //varchar(255)
            
    'dk_stichworte' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_stichworte'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>255)
            ),
        
        
    //varchar(100)
            
    'dk_datei' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_datei'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false'readonly'=>true)
            ),

        
    //varchar(4)
            
    'dk_dateityp' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_dateityp'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false,'readonly'=>true,'maxlength'=>4)
            ),


        
    //int(10)
            
    'dk_upload_userid' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_upload_userid'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false'maxlength'=>64'readonly'=>true)
            ),

        
        
    //varchar(64)
            
    'dk_speicherpfad' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_speicherpfad'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false'maxlength'=>64'readonly'=>true)
            ),

        
    // char(1)
            
    'dk_abgeschlossen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_abgeschlossen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
            )
        )
    ); 
    PHP-Code:
    $GLOBALS['TL_DCA']['tl_mb_kategorie'] = array
    (

        
    // Config
        
    'config' => array
        (
            
    'dataContainer'               => 'Table',
            
    'ctable'              => array('tl_mb_dokument','tl_mb_zugriffsrecht'),
            
    'switchToEdit'              => true,
            
    'enableVersioning'            => true
        
    ),

        
    // List
        
    'list' => array
        (
            
    'sorting' => array
            (
                
    'mode'                    => 1,
                
    'fields'                  => array('kt_parentid'),
                
    'flag'                    => 1
            
    ),
            
    'label' => array
            (
                
    'fields'                  => array('kt_name'),
                
    'format'                  => '%s'
            
    ),
            
    'global_operations' => array
            (
                
    'all' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
                    
    'href'                => 'act=select',
                    
    'class'               => 'header_edit_all',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset();" accesskey="e"'
                
    )
            ),
            
    'operations' => array
            (
                
    'edit' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['edit'],
                    
    'href'                => 'act=edit',
                    
    'icon'                => 'edit.gif'
                
    ),
                
    'copy' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['copy'],
                    
    'href'                => 'act=copy',
                    
    'icon'                => 'copy.gif'
                
    ),
                
    'delete' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['delete'],
                    
    'href'                => 'act=delete',
                    
    'icon'                => 'delete.gif',
                    
    'attributes'          => 'onclick="if (!confirm(\'' $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
                
    ),
                
    'show' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['show'],
                    
    'href'                => 'act=show',
                    
    'icon'                => 'show.gif'
                
    )
            )
        ),

        
    // Palettes
        
    'palettes' => array
        (
            
    '__selector__'                => array(''),
            
    'default'                     => '{kategorie_legend},kt_name,kt_titel,kt_beschreibung,kt_parentid,kt_dateityp,kt_abgeschlossen'
        
    ),

        
    // Subpalettes
        
    'subpalettes' => array
        (
            
    ''                            => ''
        
    ),

        
    // Fields
        
    'fields' => array
        (
            
    'kt_name' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_name'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>64'tl_class'=>'w50')
            ),

            
    'kt_titel' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_titel'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>64)
            ),

            
    'kt_beschreibung' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_beschreibung'],
                
    'exclude'                 => true,
                
    'inputType'               => 'textarea',
                
    'eval'                    => array('rte'=>'tinyMCE''tl_class'=>'clr')
            ),
        
            
    'kt_parentid' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_parentid'],
                
    'exclude'                 => true,
                
    'inputType'               => 'radio',
                
    'foreignKey'          => 'tl_mb_kategorie.kt_name',
                
    'eval'                    => array('multiple'=>true)
            ),
        
            
    'kt_dateityp' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_dateityp'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>64)
            ),
      
            
    'kt_abgeschlossen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_abgeschlossen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    )

        )
    ); 
    PHP-Code:
    /**
     * Table tl_mb_zugriffsrecht 
     */
    $GLOBALS['TL_DCA']['tl_mb_zugriffsrecht'] = array
    (
        
    // Config
        
    'config' => array
        (
            
    'dataContainer'               => 'Table',
            
    'ptabel'              => 'tl_mb_kategorie',
            
    'enableVersioning'            => true
        
    ),

        
    // List
        
    'list' => array
        (
            
    'sorting' => array
            (
                
    'mode'                    => 5,
                
    'fields'                  => array('zr_mitgliedergruppenid','zr_kategorieid'),
                
    'flag'                    => 1
            
    ),
            
    'label' => array
            (
                
    'fields'                  => array('zr_mitgliedergruppenid','zr_kategorieid'),
                
    'format'                  => '%s - %s',
                
    //'label_callback'          => array('tl_mb_zugriffsrecht', 'convertIds')
            
    ),
            
    'global_operations' => array
            (
                
    'all' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
                    
    'href'                => 'act=select',
                    
    'class'               => 'header_edit_all',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset();" accesskey="e"'
                
    )
            ),
            
    'operations' => array
            (
                
    'edit' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['edit'],
                    
    'href'                => 'act=edit',
                    
    'icon'                => 'edit.gif'
                
    ),
                
    'copy' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['copy'],
                    
    'href'                => 'act=copy',
                    
    'icon'                => 'copy.gif'
                
    ),
                
    'delete' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['delete'],
                    
    'href'                => 'act=delete',
                    
    'icon'                => 'delete.gif',
                    
    'attributes'          => 'onclick="if (!confirm(\'' $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
                
    ),
                
    'show' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['show'],
                    
    'href'                => 'act=show',
                    
    'icon'                => 'show.gif'
                
    )
            )
        ),

        
    // Palettes
        
    'palettes' => array
        (
            
    '__selector__'                => array(''),
            
    'default'                     => '{zugriffsrecht_legend},zr_kategorieid,zr_mitgliedergruppenid;{zugriffsrecht_legend_einzelrechte},zr_dokument_lesen,zr_dokument_upload,zr_dokument_loeschen,zr_dokument_editieren,zr_dokument_abschliessen'
        
    ),

        
    // Subpalettes
        
    'subpalettes' => array
        (
            
    ''                            => ''
        
    ),

        
    // Fields
        
    'fields' => array
        (
            
    'zr_kategorieid' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_kategorieid'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'foreignKey'              => 'tl_mb_kategorie.kt_name',
                
    'eval'                    => array('multiple'=>false,'mandatory'=>true,'tl_class'=>'w40')
            ),

            
    'zr_mitgliedergruppenid' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_mitgliedergruppenid'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'foreignKey'              => 'tl_member_group.name',
                
    'eval'                    => array('multiple'=>false,'mandatory'=>true,'tl_class'=>'clr')
            ),
            
            
    'zr_dokument_lesen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_lesen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'default'                 => '1'
            
    ),

            
    'zr_dokument_upload' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_upload'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    ),

            
    'zr_dokument_loeschen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_loeschen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox' 
            
    ),

            
    'zr_dokument_editieren' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_editieren'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    ),

            
    'zr_dokument_abschliessen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_abschliessen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    )
        )
    ); 
    Kann da jemand ne Fehlkonfiguration entdecken?
    Geändert von theguzz (15.10.2010 um 17:53 Uhr)

  2. #2
    Contao-Nutzer
    Registriert seit
    27.09.2010.
    Beiträge
    23

    Standard

    Also, ich habe mal den Debug Modus angeschaltet:
    PHP-Code:
    [4] => Array
            (
                [
    0] => DELETE FROM tl_mb_zugriffsrecht WHERE id IN(1,2,3,4,5,6,7,8,9,10,11,12,13) AND tstamp=0
                
    [1] => 0 rows affected
            
    )

        [
    5] => Array
            (
                [
    0] => DELETE FROM tl_mb_zugriffsrecht WHERE NOT EXISTS (SELECT FROM tl_mb_kategorie WHERE tl_mb_zugriffsrecht.pid tl_mb_kategorie.id)
                [
    1] => 0 rows affected
            

    Das steht direkt da direkt nach dem Anlegen eines Zugriffsrechtes...
    Den mit der pid kann ich ja nachvollziehen, aber wenn ich jetzt einen neuen Datensatz im BE anlegen will dann wird gemäß autoincrement die id z.b. 14 angelegt.
    Wenn ich dann meine Angaben zu id 14 mache und auf speichern drücke, dann steht in den Debug-Infos eben auch dabei, dass alle id's von 1 bis 14 gelöscht werden sollen...

    Die obige Ausgabe ist analog dazu, mit der id 13 erschienen... Ich hoffe es ist klar, was ich meine?

  3. #3
    Contao-Nutzer
    Registriert seit
    27.09.2010.
    Beiträge
    23

    Standard

    Alles klar, habe es selber hinbekommen:

    anscheinend hat der "mode" etwas damit zu tun. Habe jetzt meine Dateien angepasst:
    PHP-Code:
    $GLOBALS['TL_DCA']['tl_mb_dokument'] = array
    (

        
    // Config
        
    'config' => array
        (
            
    'dataContainer'               => 'Table',
            
    'ptable'              => 'tl_mb_kategorie',
            
    'enableVersioning'            => true
        
    ),

        
    // List
        
    'list' => array
        (
            
    'sorting' => array
            (
                
    'mode'                    => 6,
                
    'fields'                  => array('dk_name','dk_datei'),
                
    'flag'                    => 1
            
    ),
            
    'label' => array
            (
                
    'fields'                  => array('dk_name'),
                
    'format'                  => '%s',
                
    'label_callback'          => array('tl_mb_dokument''addIcon')
            ),
            
    'global_operations' => array
            (
                
    'all' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
                    
    'href'                => 'act=select',
                    
    'class'               => 'header_edit_all',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset();" accesskey="e"'
                
    )
            ),
            
    'operations' => array
            (
                
    'edit' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['edit'],
                    
    'href'                => 'act=edit',
                    
    'icon'                => 'edit.gif'
                
    ),
                
    'copy' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['copy'],
                    
    'href'                => 'act=copy',
                    
    'icon'                => 'copy.gif'
                
    ),
                
    'delete' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['delete'],
                    
    'href'                => 'act=delete',
                    
    'icon'                => 'delete.gif',
                    
    'attributes'          => 'onclick="if (!confirm(\'' $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
                
    ),
                
    'show' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_dokument']['show'],
                    
    'href'                => 'act=show',
                    
    'icon'                => 'show.gif'
                
    )
            )
        ),

        
    // Palettes
        
    'palettes' => array
        (
            
    '__selector__'                => array(''),
            
    'default'                     => '{dokument_legend},dk_name,dk_kategorieid,dk_beschreibung,dk_stichworte;dk_datei,dk_dateityp,dk_dateigroesse;dk_upload_userid,dk_upload_datum,dk_speicherpfad,dk_abgeschlossen'
        
    ),

        
    // Subpalettes
        
    'subpalettes' => array
        (
            
    ''                            => ''
        
    ),

        
    // Fields
        
    'fields' => array
        (
        
    // varchar(64)
            
    'dk_name' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_name'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>64)
            ),

        
    //varchar(10), fk
        
        /*    'dk_kategorieid' => array
            (
                'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_kategorieid'],
                'exclude'                 => true,
                'inputType'               => 'select',
                'foreignKey'          => 'tl_mb_kategorie.kt_name',
                'eval'                    => array( 'multiple'=>false, 'mandatory'=>true,'maxlength'=>10)
            ),
        */
        //text
            
    'dk_beschreibung' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_beschreibung'],
                
    'exclude'                 => true,
                
    'inputType'               => 'textarea',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>255)
            ),

        
    //varchar(255)
            
    'dk_stichworte' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_stichworte'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>255)
            ),
        
        
    //varchar(100)
            
    'dk_datei' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_datei'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false'readonly'=>true)
            ),

        
    //varchar(4)
            
    'dk_dateityp' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_dateityp'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false,'readonly'=>true,'maxlength'=>4)
            ),


        
    //int(10)
            
    'dk_upload_userid' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_upload_userid'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false'maxlength'=>64'readonly'=>true)
            ),

        
        
    //varchar(64)
            
    'dk_speicherpfad' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_speicherpfad'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false'maxlength'=>64'readonly'=>true)
            ),

        
    // char(1)
            
    'dk_abgeschlossen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_dokument']['dk_abgeschlossen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
            )
        )
    );

    class 
    tl_mb_dokument extends Backend
    {

        
    /**
         * Import the back end user object
         */
        
    public function __construct()
        {
            
    parent::__construct();
            
    $this->import('BackendUser''User');
        }


        
    /**
         *  add an icon
         */
        
    public function addIcon($row,$label)
        {
            
    $image 'system/modules/mb_dokman/article.gif';
            return 
    $this->generateImage($image)." ".$label;
        }

    PHP-Code:
    $GLOBALS['TL_DCA']['tl_mb_kategorie'] = array
    (

        
    // Config
        
    'config' => array
        (
            
    'dataContainer'               => 'Table',
            
    'ctable'              => array('tl_mb_dokument','tl_mb_zugriffsrecht'),
            
    'enableVersioning'            => true
        
    ),

        
    // List
        
    'list' => array
        (
            
    'sorting' => array
            (
                
    'mode'                    => 5,
                
    'fields'                  => array('kt_parentid'),
                
    'flag'              => 1
            
    ),
            
    'label' => array
            (
                
    'fields'                  => array('kt_name'),
                
    'format'                  => '%s',
                
    'label_callback'    => array('tl_mb_kategorie''addIcon')
            ),
            
    'global_operations' => array
            (
                
    'all' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
                    
    'href'                => 'act=select',
                    
    'class'               => 'header_edit_all',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset();" accesskey="e"'
                
    )
            ),
            
    'operations' => array
            (
                
    'edit' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['edit'],
                    
    'href'                => 'act=edit',
                    
    'icon'                => 'edit.gif'
                
    ),
                
    'copy' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['copy'],
                    
    'href'                => 'act=copy',
                    
    'icon'                => 'copy.gif'
                
    ),
                
    'delete' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['delete'],
                    
    'href'                => 'act=delete',
                    
    'icon'                => 'delete.gif',
                    
    'attributes'          => 'onclick="if (!confirm(\'' $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
                
    ),
                
    'show' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['show'],
                    
    'href'                => 'act=show',
                    
    'icon'                => 'show.gif'
                
    )
            )
        ),

        
    // Palettes
        
    'palettes' => array
        (
            
    '__selector__'                => array(''),
            
    'default'                     => '{kategorie_legend},kt_name,kt_titel,kt_beschreibung,kt_parentid,kt_dateityp,kt_abgeschlossen'
        
    ),

        
    // Subpalettes
        
    'subpalettes' => array
        (
            
    ''                            => ''
        
    ),

        
    // Fields
        
    'fields' => array
        (
            
    'kt_name' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_name'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>64'tl_class'=>'w50')
            ),

            
    'kt_titel' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_titel'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>false'maxlength'=>64)
            ),

            
    'kt_beschreibung' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_beschreibung'],
                
    'exclude'                 => true,
                
    'inputType'               => 'textarea',
                
    'eval'                    => array('rte'=>'tinyMCE''tl_class'=>'clr')
            ),
        
            
    /*'kt_parentid' => array
            (
                'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_parentid'],
                'exclude'                 => true,
                'inputType'               => 'pageTree',
                'foreignKey'          => 'tl_mb_kategorie.kt_name',
                'eval'                    => array('multiple'=>true)
            ),*/
        
            
    'kt_dateityp' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_dateityp'],
                
    'exclude'                 => true,
                
    'inputType'               => 'text',
                
    'eval'                    => array('mandatory'=>true'maxlength'=>64)
            ),
      
            
    'kt_abgeschlossen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_kategorie']['kt_abgeschlossen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    )

        )
    );

    class 
    tl_mb_kategorie extends Backend
    {

        
    /**
         * Import the back end user object
         */
        
    public function __construct()
        {
            
    parent::__construct();
            
    $this->import('BackendUser''User');
        }


        
    /**
         *  add an icon
         */
        
    public function addIcon($row,$label)
        {    
            
    $image 'system/modules/mb_dokman/folder.gif';
            return 
    $this->generateImage($image)." ".$label;
        }

    PHP-Code:
    $GLOBALS['TL_DCA']['tl_mb_zugriffsrecht'] = array
    (
        
    // Config
        
    'config' => array
        (
            
    'label'                => "test",
            
    'dataContainer'               => 'Table',
            
    'ptable'              => 'tl_mb_kategorie',
            
    'enableVersioning'            => true
        
    ),

        
    // List
        
    'list' => array
        (
            
    'sorting' => array
            (
                
    'mode'                    => 6,
                
    'fields'                  => array('zr_mitgliedergruppenid'),
                
    'icon'                    => 'edit.gif',
                
    'flag'                    => 1
            
    ),
            
    'label' => array
            (
                
    'fields'                  => array('zr_mitgliedergruppenid'),
                
    'format'                  => '%s',
                
    'label_callback'          => array('tl_mb_zugriffsrecht''convertIds')
            ),
            
    'global_operations' => array
            (
                
    'all' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
                    
    'href'                => 'act=select',
                    
    'class'               => 'header_edit_all',
                    
    'attributes'          => 'onclick="Backend.getScrollOffset();" accesskey="e"'
                
    )
            ),
            
    'operations' => array
            (
                
    'edit' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['edit'],
                    
    'href'                => 'act=edit',
                    
    'icon'                => 'edit.gif'
                
    ),
                
    'copy' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['copy'],
                    
    'href'                => 'act=copy',
                    
    'icon'                => 'copy.gif'
                
    ),
                
    'delete' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['delete'],
                    
    'href'                => 'act=delete',
                    
    'icon'                => 'delete.gif',
                    
    'attributes'          => 'onclick="if (!confirm(\'' $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
                
    ),
                
    'show' => array
                (
                    
    'label'               => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['show'],
                    
    'href'                => 'act=show',
                    
    'icon'                => 'show.gif'
                
    )
            )
        ),

        
    // Palettes
        
    'palettes' => array
        (
            
    '__selector__'                => array(''),
            
    'default'                     => '{zugriffsrecht_legend},zr_kategorieid,zr_mitgliedergruppenid;{zugriffsrecht_legend_einzelrechte},zr_dokument_lesen,zr_dokument_upload,zr_dokument_loeschen,zr_dokument_editieren,zr_dokument_abschliessen'
        
    ),

        
    // Subpalettes
        
    'subpalettes' => array
        (
            
    ''                            => ''
        
    ),

        
    // Fields
        
    'fields' => array
        (
            
    /*'zr_kategorieid' => array
            (
                'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_kategorieid'],
                'exclude'                 => true,
                'inputType'               => 'select',
                'foreignKey'              => 'tl_mb_kategorie.kt_name',
                'eval'                    => array('multiple'=>false,'mandatory'=>true,'tl_class'=>'w40')
            ),
            */
            
    'zr_mitgliedergruppenid' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_mitgliedergruppenid'],
                
    'exclude'                 => true,
                
    'inputType'               => 'select',
                
    'foreignKey'              => 'tl_member_group.name',
                
    'eval'                    => array('multiple'=>false,'mandatory'=>true,'tl_class'=>'clr')
            ),
            
            
    'zr_dokument_lesen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_lesen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox',
                
    'default'                 => '1'
            
    ),

            
    'zr_dokument_upload' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_upload'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    ),

            
    'zr_dokument_loeschen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_loeschen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox' 
            
    ),

            
    'zr_dokument_editieren' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_editieren'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    ),

            
    'zr_dokument_abschliessen' => array
            (
                
    'label'                   => &$GLOBALS['TL_LANG']['tl_mb_zugriffsrecht']['zr_dokument_abschliessen'],
                
    'exclude'                 => true,
                
    'inputType'               => 'checkbox'
            
    )
        )
    );

    /**
     * Class tl_user
     *
     * Provide miscellaneous methods that are used by the data configuration array.
     * @copyright  Götz-Daniel Jantsch 2010
     * @author     Götz-Daniel Jantsch
     * @package    mb
     */
    class tl_mb_zugriffsrecht extends Backend
    {

        
    /**
         * Import the back end user object
         */
        
    public function __construct()
        {
            
    parent::__construct();
            
    $this->import('BackendUser''User');
        }


        
    /**
         *  Convert the Groupid to Groupname and add an icon
         */
        
    public function convertIds($row)
        {
            
    // Gruppennamen holen
            
    $objRes $this->Database->prepare("SELECT * FROM tl_member_group WHERE id=?")
                                        ->
    limit(1)
                                        ->
    execute($row['zr_mitgliedergruppenid']);
            
            
    $label ' '.$objRes->name;
            
    $image 'system/modules/mb_dokman/schlossoffen.gif';
            return 
    $this->generateImage($image).$label;

        }

    Ich bitte mal jemanden um Aufklärung: Kann es sein, dass mode 5 und 6 das pid Feld befüllen und die id des parents über dieses Ablagesymbol bekommen?

    Oder kann man das mit den anderen modes auch realisieren, ohne "mit der Hand" Fremdschlüssel zu verwalten?

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Ähnliche Themen

  1. DCA, 1:N, 'ptable' vs. 'ctable' Array
    Von deerwood im Forum Entwickler-Fragen
    Antworten: 3
    Letzter Beitrag: 12.01.2010, 00:13
  2. Selber gelöst! Kann gelöscht werden
    Von netnite im Forum visitors
    Antworten: 1
    Letzter Beitrag: 17.10.2009, 12:20
  3. Newsletter Abos werden gelöscht ?
    Von tobisnet im Forum Newsletter
    Antworten: 0
    Letzter Beitrag: 22.09.2009, 09:54
  4. Entwicklung: dca ptable class an dca ctable class vererben
    Von xs-hoppelhase im Forum Entwickler-Tutorials
    Antworten: 0
    Letzter Beitrag: 17.08.2009, 17:40
  5. CSS-Kommentare werden automatisch gelöscht
    Von Buckshot im Forum Sonstiges zu Contao
    Antworten: 0
    Letzter Beitrag: 14.07.2009, 16:10

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •