Contao-Camp 2024
Ergebnis 1 bis 2 von 2

Thema: [Rocksolid Custom Elements] - Öffnungszeiten

  1. #1
    Community-Moderator & Contao-Urgestein Avatar von derRenner
    Registriert seit
    23.10.2012.
    Ort
    hoRn|waldviertel
    Beiträge
    2.849
    Contao-Projekt unterstützen

    Support Contao

    Standard [Rocksolid Custom Elements] - Öffnungszeiten

    - Einfaches Ausfüllen von Öffnungszeiten im Backend, vormittags und nachmittags
    - Darstellung im Frontend
    - der heutige Tag bekommt eine eigene Klasse zum Hervorheben

    PHP-Code:
    <?php

       
    ## rsce_openhours_config.php

    return array(
        
    'label' => [
            
    'de'=> ['Öffnungszeiten','Öffnungszeiten'],
        ],
        
    'types' => ['content','module'],
        
    'standardFields' => ['cssID'],
        
    'contentCategory' => 'beRecont'
        
    'moduleCategory' => 'beRecont'
        
    'fields' => [
            
    'monday' => [
                
    'label' => [
                    
    'de' => ['Montag','Geben Sie die Öffnungszeit ein (z.B. 9:00 - 12:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],
            
    'mondayexp' => [
                
    'label' => [
                    
    'de' => ['Montag','Geben Sie die Öffnungszeit ein (z.B. 14:00 - 18:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],        
            
    'tuesday' => [
                
    'label' => [
                    
    'de' => ['Dienstag','Geben Sie die Öffnungszeit ein (z.B. 9:00 - 12:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],
            
    'tuesdayexp' => [
                
    'label' => [
                    
    'de' => ['Dienstag','Geben Sie die Öffnungszeit ein (z.B. 14:00 - 18:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ], 
            
    'wednesday' => [
                
    'label' => [
                    
    'de' => ['Mittwoch','Geben Sie die Öffnungszeit ein (z.B. 9:00 - 12:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],
            
    'wednesdayexp' => [
                
    'label' => [
                    
    'de' => ['Mittwoch','Geben Sie die Öffnungszeit ein (z.B. 14:00 - 18:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ], 
            
    'thursday' => [
                
    'label' => [
                    
    'de' => ['Donnerstag','Geben Sie die Öffnungszeit ein (z.B. 9:00 - 12:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],
            
    'thursdayexp' => [
                
    'label' => [
                    
    'de' => ['Donnerstag','Geben Sie die Öffnungszeit ein (z.B. 14:00 - 18:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ], 
            
    'friday' => [
                
    'label' => [
                    
    'de' => ['Freitag','Geben Sie die Öffnungszeit ein (z.B. 9:00 - 12:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],
            
    'fridayexp' => [
                
    'label' => [
                    
    'de' => ['Freitag','Geben Sie die Öffnungszeit ein (z.B. 14:00 - 18:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ], 
            
    'saturday' => [
                
    'label' => [
                    
    'de' => ['Samstag','Geben Sie die Öffnungszeit ein (z.B. 9:00 - 12:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],
            
    'saturdayexp' => [
                
    'label' => [
                    
    'de' => ['Samstag','Geben Sie die Öffnungszeit ein (z.B. 14:00 - 18:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ], 
            
    'sunday' => [
                
    'label' => [
                    
    'de' => ['Sonntag','Geben Sie die Öffnungszeit ein (z.B. 9:00 - 12:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ],
            
    'sundayexp' => [
                
    'label' => [
                    
    'de' => ['Sonntag','Geben Sie die Öffnungszeit ein (z.B. 14:00 - 18:00)'],
                ],
                
    'inputType' => 'text',
                
    'eval' => [
                    
    'tl_class' => 'w50',
                ],
            ], 
        ],
    );
    PHP-Code:
    <?php

        
    ## rsce_openhours.html5

        
    $css = [
            
    $this->class,
        ];
    ?>

    <div class="open-hours <?php echo implode(' '$css?>"<?php echo $this->cssID ?>>
        <ul>
            <?php if (($this->monday) || ($this->mondayexp)): ?>
            <li><span>Montag </span><span><?php echo $this->monday ?></span><?php if ($this->mondayexp): echo ' und '; endif; ?><span><?php echo $this->mondayexp ?></span></li>
            <?php endif ?>
            <?php if (($this->tuesday) || ($this->tuesdayexp)): ?>
            <li><span>Dienstag </span><span><?php echo $this->tuesday ?></span><?php if ($this->tuesdayexp): echo ' und '; endif; ?><span><?php echo $this->tuesdayexp ?></span></li>
            <?php endif ?>
            <?php if (($this->wednesday) || ($this->wednesdayexp)): ?>
            <li><span>Mittwoch </span><span><?php echo $this->wednesday ?></span><?php if ($this->wednesdayexp): echo ' und '; endif; ?><span><?php echo $this->wednesdayexp ?></span></li>
            <?php endif ?>
            <?php if (($this->thursday) || ($this->thursdayexp)): ?>
            <li><span>Donnerstag </span><span><?php echo $this->thursday ?></span><?php if ($this->thursdayexp): echo ' und '; endif; ?><span><?php echo $this->thursdayexp ?></span></li>
            <?php endif ?>
            <?php if (($this->friday) || ($this->fridayexp)): ?>
            <li><span>Freitag </span><span><?php echo $this->friday ?></span><?php if ($this->fridayexp): echo ' und '; endif; ?><span><?php echo $this->fridayexp ?></span></li>
            <?php endif ?>
            <?php if (($this->saturday) || ($this->saturdayexp)): ?>
            <li><span>Samstag </span><span><?php echo $this->saturday ?></span><?php if ($this->saturdayexp): echo ' und '; endif; ?><span><?php echo $this->saturdayexp ?></span></li>
            <?php endif ?>
            <?php if (($this->sunday) || ($this->sundayexp)): ?>
            <li><span>Sonntag </span><span><?php echo $this->sunday ?></span><?php if ($this->sundayexp): echo ' und '; endif; ?><span><?php echo $this->sundayexp ?></span></li>
            <?php endif ?>
        </ul>
    </div>

    <script>
    $(document).ready(function(){
        $('.open-hours ul li:nth-child('+(((new Date().getDay()+6)%7)+1)+')').addClass('today')
    });
    </script>
    Backend:


    Frontend (Beispiel):


    oeffnungszeiten.png
    oeffnungszeit.png
    Grüsse
    Bernhard


  2. #2
    Contao-Nutzer
    Registriert seit
    23.02.2018.
    Beiträge
    2

    Standard CSS - Code

    Hallo Renner,

    erstmal vielen lieben Dank für diese Script.
    Das erleichtert echt vieles.

    Haben Sie die Möglichkeit auch die CSS Klassen bereit zu stellen?

    Viele Grüße :-)

Aktive Benutzer

Aktive Benutzer

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

Lesezeichen

Lesezeichen

Berechtigungen

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