├── install ├── modules │ ├── Buchungskalender - Preise │ │ ├── input.php │ │ └── output.php │ ├── Buchungskalender - E-Mail Bestaetigung │ │ ├── input.php │ │ └── output.php │ ├── Buchungskalender ical Ausgabe │ │ ├── output.php │ │ └── input.php │ ├── Buchungskalender - Buchung Zusammenfassung │ │ ├── input.php │ │ └── output.php │ ├── Buchungskalender - Minikalender │ │ ├── input.php │ │ └── output.php │ ├── Buchungskalender - Kalender │ │ ├── input.php │ │ └── output.php │ └── Buchungskalender - Text und Bild │ │ ├── input.php │ │ └── output.php ├── yform_email │ ├── booking_confirm │ │ ├── body_html.php │ │ ├── metadata.yml │ │ └── body.php │ ├── booking_message │ │ ├── body_html.php │ │ ├── metadata.yml │ │ └── body.php │ └── confirmation_info │ │ ├── body_html.php │ │ ├── body.php │ │ └── metadata.yml └── demo │ └── buchungskalender_demo.tar.gz ├── assets ├── img │ ├── buchungskalender-screenshot.png │ ├── buchungskalender-saisondetail.png │ ├── buchungskalender-screenshot-2.png │ ├── buchungskalender-screenshot-3.png │ ├── buchungskalender-preisverwaltung.png │ ├── buchungskalender-objektverwaltung.png │ └── buchungskalender-screenshot-streifenkalender.png ├── js │ └── buchungskalender.js └── frontend │ └── js │ └── buchungskalender.js ├── pages ├── index.php ├── bukabookingsprint.php ├── setup.php ├── calendar.php ├── bookings.php └── settings.php ├── ytemplates └── uikit │ ├── value.ycom_auth_form_password.tpl.php │ ├── value.ycom_auth_form_info.tpl.php │ ├── value.hidden___old.tpl.php │ ├── value.article.tpl.php │ ├── value.resetbutton.tpl.php │ ├── value.fieldset.tpl.php │ ├── value.showvalue.tpl.php │ ├── errors.tpl.php │ ├── value.captcha.tpl.php │ ├── value.checkbox.tpl.php │ ├── value.submit.tpl.php │ ├── form.tpl.php │ ├── value.mediafile.tpl.php │ ├── value.select.tpl.php │ ├── value.checkbox_group.tpl.php │ ├── value.text.tpl.php │ ├── value.ycom_auth_form_login.tpl.php │ ├── value.textarea.tpl.php │ ├── value.radio.tpl.php │ ├── value.upload.tpl.php │ ├── value.choice.check_old.tpl.php │ ├── value.choice.check.tpl.php │ ├── value.choice.select.tpl.php │ ├── value.datetime.tpl.php │ ├── value.google_geocode.tpl.php │ └── value.ycom_password.tpl.php ├── lib ├── buka_datetime.php ├── buka_date.php ├── buka_additionals.php ├── buka_season.php ├── aw_helper.php ├── buka_objects.php ├── buka_ical.php ├── buka_date_cal.php ├── module_helpers.php ├── buka_barcal.php └── awnav.php ├── update.php ├── fragments ├── frag_buka_form.php ├── buka_date_confirm.php └── buka_confirm.php ├── install.php ├── uninstall.php ├── LICENSE ├── package.yml ├── lang ├── en_gb.lang └── de_de.lang ├── CHANGELOG.md └── boot.php /install/modules/Buchungskalender - Preise/input.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /install/yform_email/booking_confirm/body_html.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /install/yform_email/booking_message/body_html.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /install/yform_email/confirmation_info/body_html.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - E-Mail Bestaetigung/input.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /install/yform_email/confirmation_info/body.php: -------------------------------------------------------------------------------- 1 | Die Buchung wurde soeben bestätigt. -------------------------------------------------------------------------------- /assets/img/buchungskalender-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtpop/buchungskalender/HEAD/assets/img/buchungskalender-screenshot.png -------------------------------------------------------------------------------- /install/demo/buchungskalender_demo.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtpop/buchungskalender/HEAD/install/demo/buchungskalender_demo.tar.gz -------------------------------------------------------------------------------- /assets/img/buchungskalender-saisondetail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtpop/buchungskalender/HEAD/assets/img/buchungskalender-saisondetail.png -------------------------------------------------------------------------------- /assets/img/buchungskalender-screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtpop/buchungskalender/HEAD/assets/img/buchungskalender-screenshot-2.png -------------------------------------------------------------------------------- /assets/img/buchungskalender-screenshot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtpop/buchungskalender/HEAD/assets/img/buchungskalender-screenshot-3.png -------------------------------------------------------------------------------- /pages/index.php: -------------------------------------------------------------------------------- 1 | parse(['value.ycom_auth_form_login.tpl.php'], ['type' => $type, 'value' => $value]); 4 | -------------------------------------------------------------------------------- /assets/img/buchungskalender-screenshot-streifenkalender.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dtpop/buchungskalender/HEAD/assets/img/buchungskalender-screenshot-streifenkalender.png -------------------------------------------------------------------------------- /ytemplates/uikit/value.ycom_auth_form_info.tpl.php: -------------------------------------------------------------------------------- 1 | getName() ?>" id="getHTMLId() ?>" value="getValue()) ?>" /> 2 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.article.tpl.php: -------------------------------------------------------------------------------- 1 | getHTMLClass() . ' ' . $this->getWarningClass()); 3 | ?> 4 |
5 | getArticle() ?> 6 |
7 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender ical Ausgabe/output.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.resetbutton.tpl.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /install/yform_email/booking_confirm/metadata.yml: -------------------------------------------------------------------------------- 1 | name: booking_confirm 2 | mail_from: webserver@example.com 3 | mail_from_name: 'Ferienwohnung Alpenblick' 4 | mail_reply_to: info@example.com 5 | mail_reply_to_name: 'Ferienwohnung Alpenblick' 6 | subject: 'Ihre REX_YFORM_DATA[field="booking_type"] der Ferienwohnung Alpenblick' 7 | attachments: '' 8 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender ical Ausgabe/input.php: -------------------------------------------------------------------------------- 1 | setTable(rex::getTable('buka_objects'))->select()->getArray(); 4 | $objects = []; 5 | foreach ($result as $res) { 6 | $objects[$res['id']] = $res['name']; 7 | } 8 | // dump($objects); 9 | $mform = new MForm(); 10 | 11 | $mform->addSelectField("$id.object_id",$objects,['label'=>'Objekt auswählen']); 12 | 13 | echo $mform->show(); -------------------------------------------------------------------------------- /install/yform_email/confirmation_info/metadata.yml: -------------------------------------------------------------------------------- 1 | name: confirmation_info 2 | mail_from: webserver@example.com 3 | mail_from_name: 'REX_YFORM_DATA[field="vorname"] REX_YFORM_DATA[field="nachname"]' 4 | mail_reply_to: 'REX_YFORM_DATA[field="email"]' 5 | mail_reply_to_name: '' 6 | subject: 'Buchung wurde bestätigt - REX_YFORM_DATA[field="object_name"] - REX_YFORM_DATA[field="date_start"] - REX_YFORM_DATA[field="date_end"]' 7 | attachments: '' 8 | -------------------------------------------------------------------------------- /install/yform_email/booking_message/metadata.yml: -------------------------------------------------------------------------------- 1 | name: booking_message 2 | mail_from: webserver@example.com 3 | mail_from_name: 'REX_YFORM_DATA[field="vorname"] REX_YFORM_DATA[field="nachname"]' 4 | mail_reply_to: 'REX_YFORM_DATA[field="email"]' 5 | mail_reply_to_name: '' 6 | subject: 'REX_YFORM_DATA[field="booking_type"] REX_YFORM_DATA[field="object_name"], REX_YFORM_DATA[field="date_start"] - REX_YFORM_DATA[field="date_end"]' 7 | attachments: '' 8 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.fieldset.tpl.php: -------------------------------------------------------------------------------- 1 | 2 |
3 | getLabel()): ?> 4 | getLabel() ?> 5 | 6 | 7 |
8 | 9 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - E-Mail Bestaetigung/output.php: -------------------------------------------------------------------------------- 1 | 9 |
10 |
11 |

Bestätigungslink wurde aktiviert

12 |

13 |
14 |
-------------------------------------------------------------------------------- /update.php: -------------------------------------------------------------------------------- 1 | ensureColumn(new rex_sql_column('colorcode', 'varchar(255)')) 13 | ->ensure(); 14 | 15 | $addon->includeFile(__DIR__.'/install.php'); -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Buchung Zusammenfassung/input.php: -------------------------------------------------------------------------------- 1 | addTextAreaField("$id.headline", ['label'=>'Headline','class'=>'tinyMCE-headline']); 15 | $mform->addTextAreaField("$id.maintext", ['label'=>'Haupttext','class'=>'tinyMCE-text']); 16 | 17 | echo $mform->show(); 18 | 19 | -------------------------------------------------------------------------------- /fragments/frag_buka_form.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
-------------------------------------------------------------------------------- /install.php: -------------------------------------------------------------------------------- 1 | setTable(rex::getTable('buka_bookings')); 10 | $sql->select(); 11 | $rows = $sql->getRows(); 12 | 13 | if (!$rows) { 14 | $sql->setTable(rex::getTable('buka_bookings')); 15 | $sql->setValue('name','Normale Buchung'); 16 | $sql->insert(); 17 | } 18 | 19 | $sql = rex_sql::factory(); 20 | $sql->setTable(rex::getTable('buka_objects')); 21 | $sql->setWhere('colorcode = ""'); 22 | $sql->setValue('colorcode','rgba(0, 13, 255, 1)'); 23 | $sql->update(); 24 | 25 | 26 | rex_delete_cache(); 27 | rex_yform_manager_table::deleteCache(); 28 | -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 | setQuery('DELETE FROM `'.rex::getTable('yform_table').'` WHERE table_name = "'.rex::getTable('buka_bookings').'"'); 5 | $sql->setQuery('DELETE FROM `'.rex::getTable('yform_field').'` WHERE table_name = "'.rex::getTable('buka_objects').'"'); 6 | $sql->setQuery('DELETE FROM `'.rex::getTable('yform_history').'` WHERE table_name = "'.rex::getTable('buka_season').'"'); 7 | $sql->setQuery('DELETE FROM `'.rex::getTable('yform_history').'` WHERE table_name = "'.rex::getTable('buka_price').'"'); 8 | 9 | 10 | rex_sql_table::get(rex::getTable('buka_bookings'))->drop(); 11 | rex_sql_table::get(rex::getTable('buka_objects'))->drop(); 12 | rex_sql_table::get(rex::getTable('buka_season'))->drop(); 13 | rex_sql_table::get(rex::getTable('buka_price'))->drop(); 14 | 15 | rex_yform_manager_table::deleteCache(); 16 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Minikalender/input.php: -------------------------------------------------------------------------------- 1 | setTable(rex::getTable('buka_objects'))->select()->getArray(); 4 | $objects = []; 5 | foreach ($result as $res) { 6 | $objects[$res['id']] = $res['name']; 7 | } 8 | // dump($objects); 9 | $mform = new MForm(); 10 | 11 | $mform->addSelectField("$id.object_id",$objects,['label'=>'Objekt auswählen']); 12 | if (rex_config::get('buchungskalender','booking_page')) { 13 | $mform->addHtml('
14 |
15 |

Die Buchungsseite ist über die Einstellungen des AddOns festgelegt.

16 |
17 |
'); 18 | } else { 19 | $mform->addLinkField(1,array('label'=>'Buchungsseite')); 20 | } 21 | $mform->addLinkField(2,array('label'=>'Buchungsinfo')); 22 | 23 | 24 | 25 | echo $mform->show(); -------------------------------------------------------------------------------- /lib/buka_date.php: -------------------------------------------------------------------------------- 1 | date = new buka_datetime(); 19 | $this->date->setDate($y, $m, $d); 20 | $this->date->wd = $this->date->format('N'); 21 | 22 | return $this->date; 23 | } 24 | 25 | 26 | 27 | /** 28 | * get_date_period 29 | * 30 | * Liefert ein Period Array aus Datestrings 31 | */ 32 | public static function get_date_period ($start,$end) { 33 | $startDate = new DateTime($start); 34 | $endDate = new DateTime($end); 35 | return buka_cal::getDatePeriod($startDate,$endDate); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /fragments/buka_date_confirm.php: -------------------------------------------------------------------------------- 1 | booking; 3 | $price = $this->price; 4 | $object = buka_objects::get_object_for_id($booking['object_id']); 5 | 6 | ?> 7 | 8 |
9 |

Zusammenfassung Ihrer Reservierung

10 |

Objekt: name ?>

11 | 12 |

Termin:

13 | 14 |

Mein Platz:

15 | 16 | 17 | 18 |

19 | 20 |
21 | 22 | 23 | Telefon
24 | 25 | 26 | E-Mail 27 | 28 |

29 |

Wir senden Ihnen eine E-Mail, in der Sie die Terminbuchung bestätigen müssen.

30 |
-------------------------------------------------------------------------------- /install/modules/Buchungskalender - Minikalender/output.php: -------------------------------------------------------------------------------- 1 | 14 | 15 |
16 |
17 | 18 |

name ?> Belegungskalender

19 |
20 | 21 |
22 | 23 | ">Buchungsinformationen 24 | 25 | 26 | reservation == 'book' ? 'Direkt buchen' : 'anfragen' ?> 27 | 28 | 29 |
30 |
-------------------------------------------------------------------------------- /install/yform_email/booking_message/body.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | reservation == 'book') : ?> 13 | 14 | 15 | Eingegangene Buchung. 16 | 17 | name ?> 18 | 19 | 20 | 21 | Eingegangene Anfrage. 22 | 23 | name ?> 24 | 25 | 26 | Anreisedatum: 27 | 28 | Abreisedatum: 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Telefon: 37 | 38 | E-Mail: 39 | 40 | Personen: 41 | 42 | Anreisezeit: 43 | 44 | Preis: 45 | 46 | 47 | Nachricht: 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Wolfgang Bund 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.showvalue.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notice[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 8 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 9 | } 10 | if (count($notice) > 0) { 11 | $notice = '

' . implode('
', $notice) . '

'; 12 | } else { 13 | $notice = ''; 14 | } 15 | 16 | $class_group = trim('form-group yform-element ' . $this->getHTMLClass()); 17 | 18 | ?> 19 |
20 | 21 |

getValue()); ?>

22 | 23 | 24 |
25 | -------------------------------------------------------------------------------- /lib/buka_additionals.php: -------------------------------------------------------------------------------- 1 | whereRaw('(saison = "" OR FIND_IN_SET(:saison,saison))',['saison'=>(int) $season->id]); 12 | } 13 | if ($object_id) { 14 | $query->whereRaw('(objects = "" OR FIND_IN_SET(:object_id,objects))',['object_id'=>(int) $object_id]); 15 | } 16 | if ($where_raw) { 17 | $query->whereRaw($where_raw,$where_raw_params); 18 | } 19 | 20 | $query->whereRaw('statustype > 0'); 21 | 22 | // dump($query->getQuery()); 23 | 24 | $items = $query->find(); 25 | 26 | if (buka_cal::is_change_lang()) { 27 | foreach ($items as $item) { 28 | $item->price = buka_cal::change_price($item->price); 29 | } 30 | } 31 | 32 | return $items; 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /lib/buka_season.php: -------------------------------------------------------------------------------- 1 | orderBy('prio') 11 | ->find(); 12 | foreach ($items as $item) { 13 | $item = $item->get_dates(); 14 | } 15 | return $items; 16 | } 17 | 18 | public function get_dates () { 19 | $dates = json_decode($this->dates,true); 20 | $season_dates = []; 21 | foreach ($dates as $date) { 22 | if (count($date) == 3) { 23 | $season_dates[] = [ 24 | 'from'=>self::chk_date_format($date[1]), 25 | 'to'=>self::chk_date_format($date[2]) 26 | ]; 27 | } 28 | } 29 | $this->season_dates = $season_dates; 30 | return $this; 31 | } 32 | 33 | public static function chk_date_format($string) { 34 | if (strpos($string,'.')) { 35 | $string = implode('-',array_reverse(explode('.',$string))); 36 | } 37 | return $string; 38 | } 39 | 40 | 41 | } -------------------------------------------------------------------------------- /ytemplates/uikit/errors.tpl.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | objparams['warning_messages'] || $this->objparams['unique_error']): 5 | if ($this->objparams['Error-occured']): ?> 6 |
7 |
objparams['Error-occured'] ?>
8 |
9 |
    10 | 11 |
      12 | 13 | objparams['warning_messages'] as $k => $v) { 17 | $warning_messages[rex_i18n::translate("$v", null)] = '
    • '.rex_i18n::translate("$v", null).'
    • '; 18 | } 19 | if (count($warning_messages) > 0) { 20 | echo implode('', $warning_messages); 21 | } 22 | 23 | if ($this->objparams['unique_error'] != '') { 24 | echo '
    • '.rex_i18n::translate(preg_replace('~\\*|:|\\(.*\\)~Usim', '', $this->objparams['unique_error'])).'
    • '; 25 | } 26 | 27 | ?> 28 |
    29 | objparams['Error-occured']): ?> 30 |
31 |
32 | 35 |
36 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.captcha.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('required') ? 'form-is-required ' : ''; 5 | $notice = $this->getElement('notice') != '' ? '

' . $this->getElement('notice') . '

' : ''; 6 | 7 | $class_group = trim('form-group ' . $class . $this->getWarningClass()); 8 | $class_control = trim('form-control'); 9 | 10 | ?> 11 |
12 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /package.yml: -------------------------------------------------------------------------------- 1 | package: buchungskalender 2 | version: "1.4.2" 3 | author: Wolfgang Bund 4 | supportpage: https://github.com/redaxo/redaxo 5 | 6 | page: 7 | title: 'translate:buka_booking_calendar' 8 | perm: buchungskalender 9 | pjax: true 10 | icon: rex-icon fa-calendar 11 | subpages: 12 | overview: 13 | title: 'translate:buchungskalender_overview' 14 | calendar: 15 | title: translate:buchungskalender_calendar 16 | bookings: 17 | title: 'translate:buchungskalender_bookings' 18 | settings: 19 | title: 'translate:buchungskalender_subpage_config' 20 | perm: buchungskalender[settings] 21 | setup: 22 | title: 'translate:buchungskalender_subpage_setup' 23 | perm: admin[] 24 | help: 25 | title: 'translate:buchungskalender_help' 26 | icon: rex-icon fa-question-circle 27 | itemclass: pull-right 28 | subPath: README.md 29 | 30 | pages: 31 | bukabookingsprint: 32 | title: translate:bookings_print 33 | main: true 34 | # block: system 35 | popup: true 36 | hidden: true 37 | perm: buchungskalender_print[] 38 | # pjax: true 39 | 40 | 41 | requires: 42 | php: 43 | version: '>=7.4' 44 | redaxo: ">=5.8.0" 45 | packages: 46 | yform: '>=4.0' 47 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.checkbox.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 7 | $notices[] = rex_i18n::translate($this->getElement('notice'), false); 8 | } 9 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 10 | $notices[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 11 | } 12 | 13 | $notice = ''; 14 | if (count($notices) > 0) { 15 | $notice = '

' . implode('
', $notices) . '

'; 16 | } 17 | 18 | $class_group = trim('checkbox ' . $this->getHTMLClass() . ' ' . $this->getWarningClass()); 19 | 20 | $attributes = [ 21 | 'type' => 'checkbox', 22 | 'id' => $this->getFieldId(), 23 | 'name' => $this->getFieldName(), 24 | 'value' => 1, 25 | 'class' => 'uk-checkbox', 26 | ]; 27 | if ($value == 1) { 28 | $attributes['checked'] = 'checked'; 29 | } 30 | 31 | $attributes = $this->getAttributeElements($attributes, ['required', 'disabled', 'autofocus']); 32 | 33 | ?> 34 |
35 | 39 | 40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.submit.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('css_classes') != '') { 5 | $css_classes = explode(',', $this->getElement('css_classes')); 6 | } 7 | 8 | if (count($labels) > 1) { 9 | if (rex::isBackend()) { 10 | echo ''; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /install/yform_email/booking_confirm/body.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | Guten Tag REX_YFORM_DATA[field="vorname"] REX_YFORM_DATA[field="nachname"] 12 | 13 | reservation == 'book') : ?> 14 | 15 | 16 | Vielen Dank für Ihre Reservierung. 17 | 18 | W I C H T I G! 19 | 20 | Bitte bestätigen Sie diese Reservierung mit einem Klick auf den folgenden Link: 21 | 22 | 23 | getUrl(['hash'=>$booking['hashval'],'email'=>md5("REX_YFORM_DATA[field='email']"),'action'=>'booking_confirm'],'&'); ?> 24 | 25 | Ihre Buchung: name ?> 26 | 27 | 28 | Ihre Anfrage: name ?> 29 | 30 | 31 | Anreisedatum: 32 | 33 | Abreisedatum: 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Telefon: 43 | 44 | E-Mail: 45 | 46 | Personen: 47 | 48 | Anreisezeit: 49 | 50 | Preis: 51 | 52 | 53 | Nachricht: 54 | 55 | 56 | 57 | 58 | Vielen Dank! -------------------------------------------------------------------------------- /ytemplates/uikit/form.tpl.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | objparams['hide_top_warning_messages']) { 7 | if ($this->objparams['warning_messages'] || $this->objparams['unique_error']) { 8 | echo $this->parse('errors.tpl.php'); 9 | } 10 | } 11 | ?> 12 | 13 | objparams['form_output'] as $field): 14 | echo $field; 15 | endforeach ?> 16 | 17 | objparams['fieldsets_opened']; ++$i): 18 | echo $this->parse('value.fieldset.tpl.php', ['option' => 'close']); 19 | endfor ?> 20 | 21 | objparams['form_hiddenfields'] as $k => $v): ?> 22 | $w): ?> 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Kalender/input.php: -------------------------------------------------------------------------------- 1 | setTable(rex::getTable('buka_objects'))->select()->getArray(); 4 | $objects = []; 5 | foreach ($result as $res) { 6 | $objects[$res['id']] = $res['name']; 7 | } 8 | 9 | $var1 = (array) rex_var::toArray("REX_VALUE[1]"); 10 | 11 | // dump($objects); 12 | $mform = new MForm(); 13 | 14 | $mform->addSelectField("$id.object_id",$objects,['label'=>'Objekt auswählen']); 15 | 16 | if (rex_config::get('buchungskalender','booking_page')) { 17 | $mform->addHtml(' 18 |
19 |
20 |
21 |

Buchungsseite ist in den Settings Settings eingestellt.
22 | Aktuelle Seite: '.rex_getUrl(rex_config::get('buchungskalender','booking_page')).' 23 |

24 |
25 |
26 | '); 27 | 28 | } else { 29 | $mform->addLinkField(1,['label'=>'Buchungsseite']); 30 | $mform->addHtml(' 31 |
32 |
33 |

Die Einstellung für die Buchungsseite kann auch zentral in den Settings des AddOns im Feld Buchungsseite vorgenommen werden.

34 |
35 | '); 36 | } 37 | 38 | 39 | $mform->addLinkField(2,['label'=>'Buchungsinfo']); 40 | 41 | 42 | 43 | echo $mform->show(); -------------------------------------------------------------------------------- /ytemplates/uikit/value.mediafile.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notice[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 8 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 9 | } 10 | if (count($notice) > 0) { 11 | $notice = '

' . implode('
', $notice) . '

'; 12 | } else { 13 | $notice = ''; 14 | } 15 | 16 | $class_group = trim('form-group yform-element ' . $this->getHTMLClass() . ' ' . $this->getWarningClass()); 17 | 18 | ?> 19 | 20 |
21 | 22 | 23 | getValue()): ?> 24 |
25 |
26 |
Dateiname
27 |
getValue()).'">'.htmlspecialchars($this->getValue()).''; 29 | ?>
30 |
31 |
32 | 36 |
37 |
38 | 39 | 40 | 41 |
42 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.select.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notice[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 8 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 9 | } 10 | if (count($notice) > 0) { 11 | $notice = '

' . implode('
', $notice) . '

'; 12 | } else { 13 | $notice = ''; 14 | } 15 | 16 | $class = $this->getElement('required') ? 'form-is-required ' : ''; 17 | $class_group = trim('form-group ' . $class . $this->getWarningClass()); 18 | 19 | $class_label[] = 'uk-form-label'; 20 | 21 | $attributes = []; 22 | $attributes['class'] = 'form-control uk-select'; 23 | $attributes['id'] = $this->getFieldId(); 24 | if ($multiple) { 25 | $attributes['name'] = $this->getFieldName() . '[]'; 26 | $attributes['multiple'] = 'multiple'; 27 | } else { 28 | $attributes['name'] = $this->getFieldName(); 29 | } 30 | if ($size > 1) { 31 | $attributes['size'] = $size; 32 | } 33 | 34 | $attributes = $this->getAttributeElements($attributes, ['autocomplete', 'pattern', 'required', 'disabled', 'readonly']); 35 | 36 | echo ' 37 |
38 | 39 | 51 | ' . $notice . ' 52 |
'; 53 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Text und Bild/input.php: -------------------------------------------------------------------------------- 1 | addTextAreaField("$id.headline", ['label'=>'Headline','class'=>'tinyMCE-headline']); 15 | $mform->addSelectField("19.headline_type", ['1'=>'Grosse Überschrift (h1)','2'=>'Mittlere Überschrift (h2)','3'=>'Kleine Überschrift (h3)'],['label'=>'Überschrift Grösse']); 16 | 17 | $mform->addTextAreaField("$id.maintext", ['label'=>'Haupttext','class'=>'tinyMCE-text']); 18 | 19 | $mform->addFieldset('Bild'); 20 | 21 | $mform->addTextAreaField("$id.sidetext", ['label'=>'Bildbeschreibung','class'=>'tinyMCE-text sidetext']); 22 | 23 | $mform->addMediaField(1,['label'=>'Bild']); 24 | 25 | 26 | $mform->addFieldset('Layout'); 27 | 28 | $mform->addSelectField("19.padding", ['uk-padding-remove'=>'kein Abstand','uk-padding-small'=>'kleiner Abstand','uk-padding'=>'normaler Abstand','uk-padding-large'=>'großer Abstand'],['label'=>'Innerer Abstand']); 29 | 30 | $mform->addSelectField("19.background", ['uk-section-muted'=>'Hellgrauer Hintergrund','uk-section-primary'=>'Blauer Hintergrund','uk-section-default'=>'Standard'],['label'=>'Hintergrund']); 31 | 32 | $mform->addSelectField("19.layout", ['image_wide'=>'Grosses Bild','image_left'=>'Bild links','image_right'=>'Bild rechts','small-text-center'=>'Schmaler Textblock zentriert'],['label'=>'Layout']); 33 | 34 | $mform->addSelectField("19.topmargin", ['uk-margin-remove-top'=>"kein Abstand zum vorhergehenden Element",'uk-margin-small-top'=>"kleiner Abstand zum vorhergehenden Element",'uk-margin-top'=>"normaler Abstand zum vorhergehenden Element",'uk-margin-large-top'=>"großer Abstand zum vorhergehenden Element"],['label'=>'Abstand oben']); 35 | $mform->addSelectField("19.textwidth", ['uk-container-small'=>"Schmaler Textblock",'uk-container-wide'=>"Breiter Textblock"],['label'=>'Breite des Textblocks']); 36 | 37 | echo $mform->show(); 38 | 39 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.checkbox_group.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notices[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 8 | $notices[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 9 | } 10 | 11 | $notice = ''; 12 | if (count($notices) > 0) { 13 | $notice = '

' . implode('
', $notices) . '

'; 14 | } 15 | 16 | $class_label = ''; 17 | $field_before = ''; 18 | $field_after = ''; 19 | 20 | if (trim($this->getElement('grid')) != '') { 21 | $grid = explode(',', trim($this->getElement('grid'))); 22 | 23 | if (isset($grid[0]) && $grid[0] != '') { 24 | $class_label .= ' ' . trim($grid[0]); 25 | } 26 | 27 | if (isset($grid[1]) && $grid[1] != '') { 28 | $field_before = '
'; 29 | $field_after = '
'; 30 | } 31 | } 32 | 33 | ?> 34 | 35 | getLabel()) != ''): ?> 36 |
37 | 38 | 39 | 40 | 41 | 42 | $v): ?> 43 | getHTMLClass($k) . ' ' . $this->getWarningClass()); 45 | ?> 46 |
47 | 51 |
52 | 53 | 54 | 55 | getLabel()) != ''): ?> 56 |
57 | 58 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.text.tpl.php: -------------------------------------------------------------------------------- 1 | getValue(); 7 | } 8 | 9 | $notice = []; 10 | if ($this->getElement('notice') != '') { 11 | $notice[] = rex_i18n::translate($this->getElement('notice'), false); 12 | } 13 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 14 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()]) . ''; // var_dump(); 15 | } 16 | if (count($notice) > 0) { 17 | $notice = '

' . implode('
', $notice) . '

'; 18 | } else { 19 | $notice = ''; 20 | } 21 | 22 | $class_group = trim('form-group yform-element ' . $this->getWarningClass()); 23 | 24 | $class_label[] = 'uk-form-label'; 25 | $field_before = ''; 26 | $field_after = ''; 27 | 28 | if (trim($this->getElement('grid')) != '') { 29 | $grid = explode(',', trim($this->getElement('grid'))); 30 | 31 | if (isset($grid[0]) && $grid[0] != '') { 32 | $class_label[] = trim($grid[0]); 33 | } 34 | 35 | if (isset($grid[1]) && $grid[1] != '') { 36 | $field_before = '
'; 37 | $field_after = '
'; 38 | } 39 | } 40 | 41 | $attributes = [ 42 | 'class' => 'form-control uk-input', 43 | 'name' => $this->getFieldName(), 44 | 'type' => $type, 45 | 'id' => $this->getFieldId(), 46 | 'value' => $value, 47 | ]; 48 | 49 | $attributes = $this->getAttributeElements($attributes, ['placeholder', 'autocomplete', 'pattern', 'required', 'disabled', 'readonly']); 50 | 51 | echo '
52 | '.$notice . $field_after.' 54 |
'; 55 | -------------------------------------------------------------------------------- /lib/aw_helper.php: -------------------------------------------------------------------------------- 1 | 'all','rel'=>'stylesheet','type'=>'text/css'],$arguments); 7 | $arguments_string = ''; 8 | foreach ($arguments as $k=>$v) { 9 | $arguments_string .= $k.'="'.$v.'" '; 10 | } 11 | 12 | return ''; 13 | 14 | } 15 | 16 | 17 | 18 | public static function get_js_tag ($fpath) { 19 | return ''; 20 | } 21 | 22 | 23 | public static function get_custom_link($url, $text = '', $url_only = false) 24 | { 25 | 26 | if ($url) { 27 | 28 | $url = self::get_custom_url($url); 29 | 30 | if ($text != '') { 31 | $linkText = $text; 32 | } else { 33 | $linkText = 'Es wurde kein Linktext oder Inhalt übergeben'; 34 | } 35 | 36 | // Beipiel für die Rückgabe , gerne selbst anpassen 37 | $link = '' . $linkText . ''; 38 | return $link; 39 | } 40 | return ''; 41 | } 42 | 43 | public static function get_custom_url($url) 44 | { 45 | if (!$url) { 46 | return ''; 47 | } 48 | // Ist es eine Mediendatei? 49 | if (file_exists(rex_path::media($url)) === true) { 50 | $url = rex_url::media($url); 51 | } else { 52 | // Ist es keine Mediendatei oder URL, dann als REDAXO-Artikel-ID behandeln 53 | if (filter_var($url, FILTER_VALIDATE_URL) === FALSE and is_numeric($url)) { 54 | $url = rex_getUrl($url); 55 | } 56 | } 57 | return $url; 58 | } 59 | 60 | public static function get_short_date($date) { 61 | return implode('.',array_reverse(explode('-',$date))); 62 | } 63 | 64 | 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /lib/buka_objects.php: -------------------------------------------------------------------------------- 1 | where('status',1); 7 | } 8 | return $query; 9 | } 10 | 11 | public function find_related() { 12 | if ($this->combination) { 13 | return self::get_query()->whereRaw('FIND_IN_SET(id,"'.$this->object_ids.'")')->find(); 14 | } else { 15 | return self::get_query()->whereRaw('FIND_IN_SET('.$this->id.',object_ids)')->find(); 16 | } 17 | } 18 | 19 | public static function get_object_for_id ($id) { 20 | return self::get_query(false)->where('id',$id)->findOne(); 21 | } 22 | 23 | public static function get_objects_with_prices ($object_id = 0) { 24 | $query = self::get_query(); 25 | if ($object_id) { 26 | $query->where('id',$object_id); 27 | } 28 | $objects = $query->find(); 29 | foreach ($objects as $object) { 30 | $object->prices = buka_cal::get_prices($object->id,'ASC'); 31 | } 32 | /* 33 | $query->leftJoin(rex::getTable('buka_price'),'price',rex::getTable('buka_objects').'.id','object_id'); 34 | $query->select('price.season_id','price_season_id'); 35 | $query->select('price.nightscount','price_nightscount'); 36 | $query->select('price.price','price_price'); 37 | */ 38 | // return $query->find(); 39 | return $objects; 40 | } 41 | 42 | public static function get_name_by_id ($params) { 43 | if (isset($params['value']) && $params['value']) { 44 | $object_id = $params['value']; 45 | if (!$object_id) { 46 | return '-- kein Objekt gewählt --'; 47 | } 48 | $object = self::get_object_for_id($object_id); 49 | if (!$object) { 50 | return '-- Objekt '.$object_id.' nicht gefunden --'; 51 | } 52 | return $object->name; 53 | } 54 | return '--'; 55 | 56 | } 57 | 58 | 59 | 60 | } -------------------------------------------------------------------------------- /ytemplates/uikit/value.ycom_auth_form_login.tpl.php: -------------------------------------------------------------------------------- 1 | getValue(); 8 | } 9 | 10 | $notice = []; 11 | if ($this->getElement('notice') != '') { 12 | $notice[] = $this->getElement('notice'); 13 | } 14 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 15 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()]) . ''; // var_dump(); 16 | } 17 | if (count($notice) > 0) { 18 | $notice = '

' . implode('
', $notice) . '

'; 19 | } else { 20 | $notice = ''; 21 | } 22 | 23 | $class_group = trim('form-group yform-element ' . $this->getWarningClass()); 24 | 25 | $class_label[] = 'uk-form-label'; 26 | $field_before = ''; 27 | $field_after = ''; 28 | 29 | if (trim($this->getElement('grid')) != '') { 30 | $grid = explode(',', trim($this->getElement('grid'))); 31 | 32 | if (isset($grid[0]) && $grid[0] != '') { 33 | $class_label[] = trim($grid[0]); 34 | } 35 | 36 | if (isset($grid[1]) && $grid[1] != '') { 37 | $field_before = '
'; 38 | $field_after = '
'; 39 | } 40 | } 41 | 42 | $attributes = [ 43 | 'class' => 'form-control uk-input', 44 | 'name' => $this->getFieldName(), 45 | 'type' => $type, 46 | 'id' => $this->getFieldId(), 47 | 'value' => $value, 48 | ]; 49 | 50 | $attributes = $this->getAttributeElements($attributes, ['placeholder', 'autocomplete', 'pattern', 'required', 'disabled', 'readonly']); 51 | 52 | echo ' 53 |
54 | 61 | ' . $notice . $field_after.' 62 |
'; 63 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.textarea.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notice[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | 8 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 9 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 10 | } 11 | if (count($notice) > 0) { 12 | $notice = '

' . implode('
', $notice) . '

'; 13 | } else { 14 | $notice = ''; 15 | } 16 | 17 | $class = $this->getElement('required') ? 'form-is-required ' : ''; 18 | 19 | $class_group = trim('form-group uk-margin ' . $this->getWarningClass()); 20 | 21 | $class_label = ['uk-form-label']; 22 | $field_before = ''; 23 | $field_after = ''; 24 | 25 | if (trim($this->getElement('grid')) != '') { 26 | $grid = explode(',', trim($this->getElement('grid'))); 27 | 28 | if (isset($grid[0]) && $grid[0] != '') { 29 | $class_label[] = trim($grid[0]); 30 | } 31 | 32 | if (isset($grid[1]) && $grid[1] != '') { 33 | $field_before = '
'; 34 | $field_after = '
'; 35 | } 36 | } 37 | 38 | $rows = $this->getElement('rows'); 39 | if (!$rows) { 40 | $rows = 10; 41 | } 42 | 43 | $attributes = [ 44 | 'class' => 'form-control uk-textarea', 45 | 'name' => $this->getFieldName(), 46 | 'id' => $this->getFieldId(), 47 | 'rows' => $rows, 48 | ]; 49 | 50 | $attributes = $this->getAttributeElements($attributes, ['placeholder', 'pattern', 'required', 'disabled', 'readonly']); 51 | 52 | echo '
53 |
'; 58 | 59 | 60 | /* 61 |
62 | 63 |
64 | 65 | */ 66 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.radio.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notices[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 8 | $notices[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 9 | } 10 | 11 | $notice = ''; 12 | if (count($notices) > 0) { 13 | $notice = '

' . implode('
', $notices) . '

'; 14 | } 15 | 16 | $class_label = ''; 17 | $class = $this->getElement('required') ? 'form-is-required ' : ''; 18 | $class_group = trim('radio-group form-group ' . $class . $this->getWarningClass()); 19 | $field_before = ''; 20 | $field_after = ''; 21 | 22 | if (trim($this->getElement('grid')) != '') { 23 | $grid = explode(',', trim($this->getElement('grid'))); 24 | 25 | if (isset($grid[0]) && $grid[0] != '') { 26 | $class_label .= ' ' . trim($grid[0]); 27 | } 28 | 29 | if (isset($grid[1]) && $grid[1] != '') { 30 | $field_before = '
'; 31 | $field_after = '
'; 32 | } 33 | } 34 | 35 | if (trim($this->getLabel()) != '') { 36 | echo '
37 | '; 38 | } 39 | 40 | echo $field_before; 41 | 42 | foreach ($options as $key => $value) { 43 | echo '
'; 47 | 48 | $attributes = [ 49 | 'id' => $this->getFieldId() . '-' . htmlspecialchars($key), 50 | 'name' => $this->getFieldName(), 51 | 'value' => $key, 52 | 'type' => 'radio', 53 | ]; 54 | 55 | if ($key == $this->getValue()) { 56 | $attributes['checked'] = 'checked'; 57 | } 58 | 59 | $attributes = $this->getAttributeElements($attributes); 60 | 61 | echo ' 65 |
'; 66 | } 67 | 68 | echo $notice; 69 | echo $field_after; 70 | 71 | if (trim($this->getLabel()) != '') { 72 | echo '
'; 73 | } 74 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.upload.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notice[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 8 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()], false) . ''; // var_dump(); 9 | } 10 | if (count($notice) > 0) { 11 | $notice = '

' . implode('
', $notice) . '

'; 12 | } else { 13 | $notice = ''; 14 | } 15 | 16 | $class = $this->getElement('required') ? 'form-is-required ' : ''; 17 | 18 | $class_group = trim('form-group ' . $class . $this->getWarningClass()); 19 | $class_control = trim('form-control'); 20 | 21 | $class_label = ''; 22 | $field_before = ''; 23 | $field_after = ''; 24 | 25 | if (trim($this->getElement('grid')) != '') { 26 | $grid = explode(',', trim($this->getElement('grid'))); 27 | 28 | if (isset($grid[0]) && $grid[0] != '') { 29 | $class_label .= ' ' . trim($grid[0]); 30 | } 31 | 32 | if (isset($grid[1]) && $grid[1] != '') { 33 | $field_before = '
'; 34 | $field_after = '
'; 35 | } 36 | } 37 | ?> 38 |
39 | 40 | 41 | 42 | 43 |
44 | 45 | getValue(); 48 | if ($filename != '') { 49 | $label = htmlspecialchars($filename); 50 | 51 | /* 52 | if (rex::isBackend() && $download_link != "") { 53 | $label = '' . $label . ''; 54 | 55 | } 56 | */ 57 | 58 | echo ' 59 |
60 | 64 |
'; 65 | } 66 | 67 | ?> 68 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.choice.check_old.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice')) { 8 | $notices[] = rex_i18n::translate($this->getElement('notice'), false); 9 | } 10 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 11 | $notices[] = ''.rex_i18n::translate($this->params['warning_messages'][$this->getId()], false).''; 12 | } 13 | 14 | $elementType = $choiceList->isMultiple() ? 'checkbox' : 'radio'; 15 | $uk_warning = $this->getWarningClass() ? ' uk-form-danger' : ''; 16 | 17 | $groupAttributes['class'] = 'form-check-group'; 18 | $elementAttributes['class'] = trim($elementType.' '.'uk-form-controls '.$this->getWarningClass().$uk_warning); 19 | 20 | 21 | ?> 22 | 23 | 24 | > 25 | 34 | 35 | 36 | 37 | 38 |
39 | 40 | getChoices() as $choiceView): ?> 41 | 42 | 43 |
44 | 45 | 46 | > 47 | getLabel()): ?> 48 | 51 | 52 | 53 | getPreferredChoices() as $view): ?> 54 | 55 | 56 | 57 | getChoices() as $view): ?> 58 | 59 | 60 | 61 | 62 |

', $notices) ?>

63 | 64 | 65 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Buchung Zusammenfassung/output.php: -------------------------------------------------------------------------------- 1 | 5) { 15 | 16 | $hash_val = sha1(microtime(true) . rand(111, 999) . 'gehasht', false); 17 | 18 | $buka = new buka_cal($booking['object_id']); 19 | $price = $buka->get_booking_price(); 20 | $booking['price'] = number_format($price['price'], 2, ',', "'"); 21 | $booking['hashval'] = $hash_val; 22 | 23 | $email_me = explode(',',rex_config::get('buchungskalender','email_me')); 24 | 25 | // dump($booking); 26 | 27 | rex_set_session('buka_booking', $booking); 28 | 29 | $object = buka_objects::get_object_for_id($booking['object_id']); 30 | 31 | 32 | $fragment = new rex_fragment(); 33 | $fragment->setVar('price', $price); 34 | $fragment->setVar('booking', $booking); 35 | 36 | 37 | 38 | $confirm_html = $fragment->parse('buka_confirm.php'); 39 | 40 | $yform = new rex_yform(); 41 | 42 | $yform->setObjectparams('form_ytemplate', 'uikit,bootstrap,classic'); 43 | $yform->setObjectparams('form_action', rex_getUrl()); 44 | $yform->setObjectparams('error_class', 'uk-form-danger has-error'); 45 | $yform->setObjectparams('form_class', 'uk-form rex-yform'); 46 | 47 | $yform->setValueField('hidden', ['email', $booking['email']]); 48 | $yform->setValueField('hidden', ['vorname', $booking['vorname']]); 49 | $yform->setValueField('hidden', ['nachname', $booking['nachname']]); 50 | $yform->setValueField('hidden', ['date_start', $booking['date_start']]); 51 | $yform->setValueField('hidden', ['date_end', $booking['date_end']]); 52 | $yform->setValueField('hidden', ['object_name', $object->name]); 53 | $yform->setValueField('hidden', ['booking_type', $object->reservation == 'book' ? 'Buchung' : 'Anfrage']); 54 | $yform->setValueField('hidden', ['booking_json', json_encode($booking)]); 55 | 56 | $yform->setValueField('html', ['', $confirm_html]); 57 | 58 | $yform->setValueField('html', ['', 'Zurück']); 59 | 60 | $yform->setValueField('submit', ['Submit', 'Absenden', 'no_db', '', '', 'uk-active']); 61 | 62 | $yform->setActionField('callback', ['buka_booking::save_in_db']); 63 | $yform->setActionField('tpl2email', ['booking_confirm', 'email']); 64 | foreach ($email_me as $email) { 65 | $yform->setActionField('tpl2email', ['booking_message', $email]); 66 | } 67 | 68 | $yform->setActionField('showtext', ['

' . $val1['headline'] . '

' . $val1['maintext'] . '

', '', '', 1]); 69 | 70 | 71 | 72 | } 73 | 74 | 75 | ?> 76 | 77 | 78 | 79 |
80 |
81 | 5) : ?> 82 | getForm() ?> 83 | 84 |

Keine Buchungsdaten vorhanden

85 | 86 |
87 |
88 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Preise/output.php: -------------------------------------------------------------------------------- 1 | season_calendar = true; 8 | $cal->cal_wrapper_class = 'buka-cal-wrapper season-calendar minikalender'; 9 | 10 | 11 | ?> 12 | 13 |
14 |
15 |

Saisonkalender

16 | getCalendar(); ?> 17 | get_season_legend() ?> 18 |
19 |
20 | 21 |

name ?>

22 | 23 |

name ?>

24 | 25 | prices as $price) : ?> 26 | season_id != $season->id) { 27 | continue; 28 | } ?> 29 | nightscount == 1) : ?> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
3 Nächte (Mindestbuchungszeit)price * 3 + $object->grundpreis, 2, ',', '.') ?> EUR
Weitere Nachtprice, 2, ',', '.') ?> EUR
nightscount ?> Nächteprice * $price->nightscount + $object->grundpreis, 2, ',', '.') ?> EUR
Weitere Nachtprice, 2, ',', '.') ?> EUR
51 | 52 | 53 | 54 | 55 | 56 | 57 |

name ?>

58 | dates)) : ?> 59 |

Übrige Zeit

60 | 61 | 62 | dates) as $date) : ?> 63 | 64 |

- ()

65 | 66 | 67 | dates,true)); ?> 68 | 69 | 70 |
71 |
-------------------------------------------------------------------------------- /ytemplates/uikit/value.choice.check.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice')) { 8 | $notices[] = rex_i18n::translate($this->getElement('notice'), false); 9 | } 10 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 11 | $notices[] = ''.rex_i18n::translate($this->params['warning_messages'][$this->getId()], false).''; 12 | } 13 | 14 | if (!isset($groupAttributes)) { 15 | $groupAttributes = []; 16 | } 17 | 18 | $groupClass = 'form-check-group'; 19 | if (isset($groupAttributes['class']) && is_array($groupAttributes['class'])) { 20 | $groupAttributes['class'][] = $groupClass; 21 | } elseif (isset($groupAttributes['class'])) { 22 | $groupAttributes['class'] .= ' '.$groupClass; 23 | } else { 24 | $groupAttributes['class'] = $groupClass; 25 | } 26 | 27 | if (!isset($elementAttributes)) { 28 | $elementAttributes = []; 29 | } 30 | $elementClass = trim(($choiceList->isMultiple() ? 'checkbox' : 'radio').' '.$this->getWarningClass()); 31 | $elementClass .= $this->getWarningClass() ? ' uk-form-danger' : ''; 32 | 33 | if (isset($elementAttributes['class']) && is_array($elementAttributes['class'])) { 34 | $elementAttributes['class'][] = $elementClass; 35 | } elseif (isset($elementAttributes['class'])) { 36 | $elementAttributes['class'] .= ' '.$elementClass; 37 | } else { 38 | $elementAttributes['class'] = $elementClass; 39 | } 40 | 41 | 42 | ?> 43 | 44 | 46 | > 47 | 56 | 57 | 59 | 60 | 62 |
63 | 64 | getChoices() as $choiceView): ?> 65 | 66 | 67 |
68 | 70 | 71 | > 72 | getLabel()): ?> 73 | 76 | 77 | 78 | getPreferredChoices() as $view): ?> 79 | 80 | 81 | 82 | getChoices() as $view): ?> 83 | 84 | 85 | 86 | 87 |

', $notices) ?>

88 | 89 | 90 | -------------------------------------------------------------------------------- /lang/en_gb.lang: -------------------------------------------------------------------------------- 1 | buka_booking_calendar = Booking Calendar 2 | 3 | buka_startdate = Start Date 4 | buka_enddate = End Date 5 | buka_object = Object 6 | buka_please_select_object = -- please select object -- 7 | 8 | buka_booking_uncorrect = This booking is uncorrect. There is allready a booking for this date. 9 | datefrom_dateto_booking = The departure date must be later than the arrival date 10 | buka_double_bookings = Existing bookings for this date 11 | 12 | buka_please_select = please select 13 | buka_confirmed = confirmed 14 | buka_firstname = Firstname 15 | buka_lastname = Lastname 16 | buka_country = Country 17 | buka_address = Address 18 | buka_zip = ZIP 19 | buka_city = City 20 | buka_phone = Phone 21 | buka_participants = Participants 22 | buka_arrivaltime = Arrival time 23 | buka_message = Message 24 | buka_bookingdate = Booking Date 25 | buka_state = State 26 | buka_asked = Reservation 27 | buka_confirmed = Booking 28 | buka_canceled = Canceled 29 | buka_pre_booking = Request 30 | buka_blocked = blocked 31 | buka_price = Price 32 | buka_edit_booking = Edit Booking 33 | buka_all = All 34 | buka_next_arrival = Next Arrival 35 | buka_next_arrival_print = Next Arrival (Print) 36 | buka_notice = More Info 37 | 38 | buka_buka_objects = Booking Calendar Objects 39 | buka_buka_bookings = Booking Calendar Bookings 40 | buka_buka_seasons = Booking Calendar Seasons 41 | buka_buka_prices = Booking Calendar Prices 42 | buka_buka_additionals = Booking Calendar Additionals 43 | buka_buka_participants = Booking Calendar Participants 44 | buka_buka_participants_state = Booking Calendar Participants State 45 | buka_buka_bookingtype = Booking Booking Type 46 | buka_buka_bookingstate = Booking Booking State 47 | buka_bookingstate = Booking state 48 | 49 | buka_booking = Booking 50 | buka_birthdate = Birthdate 51 | buka_age = Age 52 | buka_arrivaltime = Arrival Time 53 | buka_arrivalpoint = Arrival Point 54 | buka_departuretime = Departure Time 55 | buka_departurepoint = Departure Point 56 | booking_type = Booking Type 57 | 58 | buka_name_of_object = Name of object 59 | buka_combination_object = Combined Object 60 | buka_objects = Objects 61 | buka_base_price = Base Price 62 | buka_ical_sync_link = Ical Synchronizsation Link 63 | buka_reservation_settings = Reservation settings 64 | buka_season_name = Season 65 | buka_prio = Priority 66 | buka_mindays = Minimum Stay 67 | buka_dates = Dates 68 | buka_whole_weeks = Whole Weeks 69 | buka_color = Farbe 70 | buka_season = Season 71 | buka_multiselectable = multiple selectable 72 | buka_additionals_max_count = Max. Count 73 | buka_perperson = per person 74 | buka_perday = per day 75 | buka_is_standard = Standard 76 | buka_min_num_of_nights = Min. num. of nights 77 | buka_max_num_of_nights = Max. num. of nights 78 | buka_participants_min = Min. num. of participants 79 | buka_participants_max = Max. num. of participants 80 | buka_preferred_season = Preferred Season 81 | buka_additionals_name = Name 82 | buka_key = Key 83 | buka_send_button = Send 84 | 85 | buchungskalender_calendar = Calendar 86 | buchungskalender_subpage_config = Settings 87 | buchungskalender = Booking Calendar 88 | buchungskalender_help = Help/Info 89 | buchungskalender_subpage_setup = Setup 90 | buchungskalender_bookings = Bookings 91 | buchungskalender_setup = Install modules and e-mail templates 92 | buchungskalender_overview = Overview 93 | 94 | perm_general_buchungskalender[settings] = Booking Calender: Settings 95 | 96 | buka_mandatory_field = Mandatory Field 97 | buka_notice_mandatoryfield_additional = If the checkbox is checked, the additional is not optional and can not be deactivated. 98 | -------------------------------------------------------------------------------- /lang/de_de.lang: -------------------------------------------------------------------------------- 1 | buka_booking_calendar = Buchungskalender 2 | 3 | buka_startdate = Anreisedatum 4 | buka_enddate = Abreisedatum 5 | buka_object = Objekt 6 | buka_please_select_object = -- bitte Objekt wählen -- 7 | 8 | buka_booking_uncorrect = Dieses Buchungsdatum ist ungültig. Es gibt bereits eine Buchung für dieses Datum. 9 | datefrom_dateto_booking = Das Abreisedatum muss später als das Anreisedatum liegen 10 | buka_double_bookings = Bereits vorhandene Buchungen für diesen Termin 11 | 12 | buka_please_select = bitte auswählen 13 | buka_confirmed = bestätigt 14 | buka_firstname = Vorname 15 | buka_lastname = Nachname 16 | buka_country = Land 17 | buka_address = Adresse 18 | buka_zip = PLZ 19 | buka_city = Ort 20 | buka_phone = Telefon 21 | buka_participants = Teilnehmer 22 | buka_message = Nachricht 23 | buka_bookingdate = Buchungsdatum 24 | buka_state = Status 25 | buka_asked = Angefragt 26 | buka_confirmed = Bestätigt 27 | buka_canceled = Storniert 28 | buka_pre_booking = Voranfrage 29 | buka_blocked = blockiert 30 | buka_price = Preis 31 | buka_edit_booking = Buchung bearbeiten 32 | buka_all = Alle 33 | buka_next_arrival = Nächste Anreisen 34 | buka_next_arrival_print = Nächste Anreisen (Print) 35 | buka_notice = Bemerkung 36 | 37 | buka_buka_objects = Buchungskalender Objekte 38 | buka_buka_bookings = Buchungskalender Buchungen 39 | buka_buka_seasons = Buchungskalender Saisons 40 | buka_buka_prices = Buchungskalender Preise 41 | buka_buka_additionals = Buchungskalender Zusatzleistungen 42 | buka_buka_participants = Buchungskalender Teilnehmer 43 | buka_buka_participants_state = Buchungskalender Teilnehmerstatus 44 | 45 | buka_booking = Buchung 46 | buka_birthdate = Geburtsdatum 47 | buka_age = Alter 48 | buka_arrivaltime = Ankunftszeit 49 | buka_arrivalpoint = Ankunftsort 50 | buka_departuretime = Abfahrtszeit 51 | buka_departurepoint = Abreiseort 52 | booking_type = Buchungstype 53 | buka_bookingstate = Buchungsstatus 54 | 55 | buka_name_of_object = Name des Objekts 56 | buka_combination_object = Kombinationsobjekt 57 | buka_objects = Objekte 58 | buka_base_price = Grundpreis 59 | buka_ical_sync_link = Ical Synchronisationslinks 60 | buka_reservation_settings = Reservierungseinstellung 61 | buka_season_name = Saison 62 | buka_prio = Priorität 63 | buka_mindays = Mindestbuchungsdauer 64 | buka_dates = Termine 65 | buka_whole_weeks = Ganze Wochen 66 | buka_color = Farbe 67 | buka_season = Saison 68 | buka_multiselectable = Mehrfach wählbar 69 | buka_additionals_max_count = Max. Anzahl 70 | buka_perperson = pro Person 71 | buka_perday = pro Tag 72 | buka_is_standard = Standard 73 | buka_min_num_of_nights = Mindest Anzahl Nächste 74 | buka_max_num_of_nights = Maximal Anzahl Nächte 75 | buka_participants_min = Mindestanzahl Teilnehmer 76 | buka_participants_max = Maximalanzahl Teilnehmer 77 | buka_preferred_season = Bevorzugte Saison 78 | buka_additionals_name = Name 79 | buka_key = Schlüssel 80 | buka_send_button = Absenden 81 | 82 | buchungskalender_calendar = Kalender 83 | buchungskalender_subpage_config = Einstellungen 84 | buchungskalender = Buchungskalender 85 | buchungskalender_help = Hilfe/Info 86 | buchungskalender_subpage_setup = Setup 87 | buchungskalender_bookings = Buchungen 88 | buchungskalender_setup = Module und E-Mail Templates installieren 89 | buchungskalender_overview = Übersicht 90 | 91 | buka_startdate = Startdatum 92 | buka_enddate = Enddatum 93 | buka_object = Objekt 94 | buka_please_select_object = -- bitte Objekt auswählen -- 95 | 96 | buka_mandatory_field = Pflichtfeld 97 | buka_notice_mandatoryfield_additional = Wenn die Checkbox angewählt ist, ist die Leistung nicht optional und kann nicht abgewählt werden. 98 | 99 | -------------------------------------------------------------------------------- /fragments/buka_confirm.php: -------------------------------------------------------------------------------- 1 | booking; 3 | $price = $this->price; 4 | $object = buka_objects::get_object_for_id($booking['object_id']); 5 | 6 | 7 | 8 | $str_summery = 'Zusammenfassung Ihrer '; 9 | $str_booking = 'Buchung'; 10 | $str_request = 'Anfrage'; 11 | $str_object = 'Objekt'; 12 | $str_arrival = 'Anreise'; 13 | $str_departure = 'Abreise'; 14 | $str_overnightstays = 'Übernachtungen'; 15 | $str_country = 'Land'; 16 | $str_tel = 'Telefon'; 17 | $str_email = 'E-Mail'; 18 | $str_no_persons = 'Anzahl Personen'; 19 | $str_arrival_time = 'Anreisezeit'; 20 | $str_price = 'Preis'; 21 | $str_agree_1 = 'Mit dem Absenden dieser'; 22 | $str_agree_2 = 'erklären Sie sich mit unserer Hausordnung und AGB einverstanden.'; 23 | 24 | // schön wäre wenn "Hausordnung und AGB" ein Link wäre 25 | 26 | 27 | 28 | 29 | if (rex_addon::get('sprog')->isAvailable()) { 30 | $str_summery = sprogcard('buka_summery') ?: $str_summery; 31 | $str_booking = sprogcard('buka_booking') ?: $str_booking; 32 | $str_request = sprogcard('buka_request') ?: $str_request; 33 | $str_object = sprogcard('buka_object') ?: $str_object; 34 | $str_arrival = sprogcard('buka_arrival') ?: $str_arrival; 35 | $str_departure = sprogcard('buka_departure') ?: $str_departure; 36 | $str_overnightstays = sprogcard('buka_overnightstays') ?: $str_overnightstays; 37 | $str_country = sprogcard('buka_country') ?: $str_country; 38 | $str_tel = sprogcard('buka_tel') ?: $str_tel; 39 | $str_email = sprogcard('buka_email') ?: $str_email; 40 | $str_no_persons = sprogcard('buka_no_persons') ?: $str_no_persons; 41 | $str_arrival_time = sprogcard('buka_arrival_time') ?: $str_arrival_time; 42 | $str_price = sprogcard('buka_price') ?: $str_price; 43 | $str_agree_1 = sprogcard('buka_agree_1') ?: $str_agree_1; 44 | $str_agree_2 = sprogcard('buka_agree_2') ?: $str_agree_2; 45 | } 46 | 47 | 48 | ?> 49 | 50 |
51 | 52 |

reservation == 'book' ? $str_booking : $str_request) ?>

53 |

name ?>

54 |

55 |

56 |

57 |

58 | 59 |
60 | 61 | 62 |
63 | 64 | 65 |
66 | 67 | 68 |
69 | 70 | 71 |
72 | 73 | 74 | 75 | 76 |

77 | 78 |

79 | 80 | 81 |

82 | 83 |

EUR

84 |

85 |

reservation == 'book' ? $str_booking : $str_request).' '.$str_agree_2 ?>

86 | 87 |
-------------------------------------------------------------------------------- /ytemplates/uikit/value.choice.select.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice')) { 8 | $notices[] = rex_i18n::translate($this->getElement('notice'), false); 9 | } 10 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 11 | $notices[] = ''.rex_i18n::translate($this->params['warning_messages'][$this->getId()], false).''; 12 | } 13 | 14 | if (!isset($groupAttributes)) { 15 | $groupAttributes = []; 16 | } 17 | 18 | $groupClass = trim('form-group '.$this->getWarningClass()); 19 | if (isset($groupAttributes['class']) && is_array($groupAttributes['class'])) { 20 | $groupAttributes['class'][] = $groupClass; 21 | } elseif (isset($groupAttributes['class'])) { 22 | $groupAttributes['class'] .= ' '.$groupClass; 23 | } else { 24 | $groupAttributes['class'] = $groupClass; 25 | } 26 | 27 | if (!isset($elementAttributes)) { 28 | $elementAttributes = []; 29 | } 30 | $elementClass = 'form-control uk-select'; 31 | if (isset($elementAttributes['class']) && is_array($elementAttributes['class'])) { 32 | $elementAttributes['class'][] = $elementClass; 33 | } elseif (isset($elementAttributes['class'])) { 34 | $elementAttributes['class'] .= ' '.$elementClass; 35 | } else { 36 | $elementAttributes['class'] = $elementClass; 37 | } 38 | ?> 39 | 40 | 42 | 49 | 51 | 52 | 54 | 55 | getChoices() as $choiceView): ?> 56 | 57 | 58 | 59 | 61 | 62 | > 63 | getLabel()): ?> 64 | 87 | 88 | 89 |

', $notices) ?>

90 | 91 | 92 | -------------------------------------------------------------------------------- /pages/bukabookingsprint.php: -------------------------------------------------------------------------------- 1 | 54 | resetWhere(); 60 | // $qry->selectRaw('CONCAT(telefon," ",email) kontakt'); 61 | // $qry->selectRaw('CONCAT(anschrift,"\n",plz," ",ort,"\n",land) fulladdress'); 62 | $qry->whereRaw('dateend >= "' . date('Y-m-d') . '" AND status = "confirmed"'); 63 | $qry->orderBy('datestart'); 64 | } 65 | 66 | 67 | $list = rex_list::factory($qry); 68 | $list->removeColumn('hashval'); 69 | $list->removeColumn('telefon'); 70 | $list->removeColumn('email'); 71 | $list->removeColumn('datestart'); 72 | $list->removeColumn('dateend'); 73 | $list->removeColumn('startyear'); 74 | $list->removeColumn('endyear'); 75 | $list->removeColumn('vorname'); 76 | $list->removeColumn('nachname'); 77 | $list->removeColumn('anschrift'); 78 | $list->removeColumn('plz'); 79 | $list->removeColumn('ort'); 80 | $list->removeColumn('land'); 81 | $list->removeColumn('status'); 82 | $list->removeColumn('id'); 83 | $list->removeColumn('bookingdate'); 84 | $list->removeColumn('object_id'); 85 | $list->removeColumn('bookingstate_id'); 86 | $list->removeColumn('bookingtype_id'); 87 | 88 | $list->addColumn('Reisezeit','###datestart###
###dateend###',1); 89 | $list->addColumn('Objekt','',2); 90 | $list->setColumnFormat('Objekt', 'custom', function($params) { return buka_objects::get_name_by_id(['value'=>$params['list']->getValue('object_id')]); }); 91 | $list->addColumn('Name','###vorname###
###nachname###',3); 92 | $list->addColumn('Kontakt','###telefon###
###email###',10); 93 | $list->setColumnLabel('nachricht', 'Nachricht'); 94 | $list->setColumnLabel('anreisezeit', 'Anreisezeit'); 95 | $list->setColumnLabel('price', 'Preis'); 96 | $list->setColumnLabel('personen', 'Personen'); 97 | 98 | // $list->setColumnFormat('nachricht', 'custom', function($params) { return nl2br($params['list']->getValue('nachricht')); }); 99 | 100 | 101 | 102 | 103 | 104 | ?> 105 | 106 |
107 | 108 | 109 | 110 | 111 | 112 |
113 | get() ?> -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | Version 1.4.1 - 15.01.2023 5 | -------------------------- 6 | 7 | * PHP 8.2 Kompatibilität - Danke an den unvergleichlichen Joachim Dörr! 8 | * Installation und Update, Datenbankanpassungen 9 | 10 | 11 | Version 1.2.1 beta - 24.10.2022 12 | ------------------------------- 13 | 14 | * FE-Javascript erweitert, sodass keine überschneidenden Termine markiert werden können 15 | * Buchungsseite über Einstellungen definierbar. 16 | * Minikalender übernimmt Link zur Buchungsseite aus den Einstellungen 17 | * Kalendernavigation übersetzt "Monat/e" über sprog buka_month / buka_months Platzhalter, wenn sprog installiert ist 18 | * In der Demo das Ui-Kit JS vom allgemeinen JS getrennt 19 | * Demo aktualisiert 20 | * Zahlreiche Detailverbesserungen 21 | * Status "Blockiert" implementiert - damit lassen sich Termine im Frontend blockieren, im Backend ist dennoch eine Buchung auf diese Termine möglich 22 | * Mehrsprachigkeit verbessert 23 | * Erweiterte Darstellung bei Versuch einer Doppelbuchung im Backend. Die überschneidenden Datensätze werden angezeigt 24 | * Validierung, sodass im Backend bei der Eingabe eines neuen Buchungsdatensatzes geprüft werden kann, ob das Abreisedatum nach dem Anreisedatum liegt. 25 | 26 | Version 1.2 - 15.04.2022 27 | ------------------------ 28 | 29 | * Fix Klick auf Kalendereintrag öffnet Detailansicht 30 | * Storno Datensatz immer ermöglichen, auch bei überschneidenden Terminen 31 | * Kalender Blätterfunktion verbessert 32 | * Objekttabelle mit Reihenfolge prio versehen 33 | * Weiterer Streifenkalender in linearer Ansicht 34 | * Datenbankerweiterung um Teilnehmer und Zusatzleistungen, zusätzliche Felder 35 | * Datenbankerweiterung um Buchungstyp 36 | * Buchungsliste im AddOn als yform Liste mit Suchfeldern 37 | * Fix: FE Auswahl Anreise und Abreise nicht mehr über gebuchte Termine möglich 38 | * Englisches Backend 39 | * Grundkonfiguration für zweite Währung 40 | 41 | Version 1.1.2 - 23.01.2022 42 | -------------------------- 43 | 44 | * Verbesserung Labeldarstellung im Streifenkalender 45 | * Labeldarstellung bei Blockierung von Kombinationsobjekten durch Einzelbuchungen 46 | 47 | 48 | Version 1.1.1 - 26.12.2021 49 | -------------------------- 50 | 51 | * Im Backend wird eine Validierung eingeführt, sodass sowohl über yform als auch direkt in der Buchungsliste keine Doppelbuchungen vorgenommen werden können. 52 | * Demo geupdated für REX 5.13.1 53 | * Fix: für offline Objekte wird auch der Name in der Buchungsliste angezeigt 54 | * Fix: im Streifenkalender wird nun auch für den Januar die korrekte Jahreszahl angezeigt 55 | * Doku erweitert 56 | 57 | 58 | Version 1.1.0 - 25.12.2021 59 | -------------------------- 60 | 61 | Der Streifenkalender wird eingeführt. Der Streifenkalender wird direkt als Startseite gezeigt. Über den Streifenkalender kann man die Buchungen auch direkt aufrufen. 62 | 63 | * Streifenkalender für Übersichtsdarstellung 64 | * Verbesserte ical Synchronisation 65 | * Datenbankerweiterung für Zusatzleistungen 66 | * Datenbankerweiterung für Teilnehmer/Gäste 67 | * Umbau auf yform 4beta7 68 | * Die Dokumentation wird erweitert 69 | 70 | 71 | Version 1.0.0 - 28.07.2021 72 | -------------------------- 73 | 74 | Viele schicke Verbesserungen. Das Update ist uneingeschränkt kompatibel zur Vorversion. Es wurden keine Änderungen an der Datenbank vorgenommen. 75 | 76 | * Buchungen können im Backend aus dem Kalender mit Shift+Click aufgerufen und bearbeitet werden 77 | * Buchungen können aus der Liste der AddOn Page direkt bearbeitet werden 78 | * Nach der Bearbeitung einer Buchung im AddOn landet man wieder auf der Ursprungsseite (Liste bzw. Kalenderansicht) 79 | * Module können auf der Setup Seite einzeln installiert oder upgedated werden 80 | * E-Mail Templates können auf der Setup Seite einzeln installiert oder upgedated werden 81 | * Blätterbugfix im Kalender beseitigt 82 | * Standardwerte für Konfiguration 83 | * Settings und Setup nur für Admin 84 | * Abhängigkeit yform hinzugefügt 85 | 86 | 87 | Version 0.9.0 . 26.04.2021 88 | -------------------------- 89 | 90 | Erster Wurf, basierend auf ferien-am-tressower-see.de 91 | 92 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Text und Bild/output.php: -------------------------------------------------------------------------------- 1 | '', 5 | 'textwidth' => 'uk-container-small', 6 | 7 | ], rex_var::toArray("REX_VALUE[19]")); 8 | 9 | 10 | 11 | // dump($val1); 12 | // dump($val19); 13 | $media = rex_media::get("REX_MEDIA[1]"); 14 | 15 | preg_match_all('/__Jahre_seit_(\d\d\d\d-\d\d-\d\d)__/', $val1['maintext'], $matches, PREG_SET_ORDER); 16 | // dump($matches); 17 | if ($matches) { 18 | foreach ($matches as $match) { 19 | $birthDate = explode("-", $match[1]); 20 | //get age from date or birthdate 21 | $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[1], $birthDate[2], $birthDate[0]))) > date("md") ? ((date("Y") - $birthDate[0]) - 1) : (date("Y") - $birthDate[0])); 22 | $val1['maintext'] = str_replace($match[0], $age, $val1['maintext']); 23 | } 24 | } 25 | 26 | ?> 27 | 28 | 29 | 30 | 31 |
32 |
33 | 34 | class="uk-h">> 35 | 36 | 37 | 38 | 39 | 40 |
41 |
42 | 43 | 44 | 45 |
46 |
47 |
48 |
49 | 50 | class="uk-h">> 51 | 52 | 53 |
54 |
55 |
56 |
57 | 58 | 59 |
60 |
61 | 62 |
63 |
64 | 65 | 66 | 67 |
68 |
69 | 70 |
71 |
72 | 73 |
74 |
75 | 76 |
77 |
78 | 79 | 80 | 81 |
82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 |
90 | 91 |
92 | 93 | 94 |
95 |
96 | 97 | -------------------------------------------------------------------------------- /ytemplates/uikit/value.datetime.tpl.php: -------------------------------------------------------------------------------- 1 | getElement('notice') != '') { 5 | $notices[] = rex_i18n::translate($this->getElement('notice'), false); 6 | } 7 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 8 | $notices[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()]) . ''; // var_dump(); 9 | } 10 | 11 | $notice = ''; 12 | if (count($notices) > 0) { 13 | $notice = '

' . implode('
', $notices) . '

'; 14 | } 15 | 16 | $class_group = trim('form-group yform-element ' . $this->getWarningClass()); 17 | 18 | $class_label[] = 'uk-form-label'; 19 | $field_before = ''; 20 | $field_after = ''; 21 | 22 | if (trim($this->getElement('grid')) != '') { 23 | $grid = explode(',', trim($this->getElement('grid'))); 24 | 25 | if (isset($grid[0]) && $grid[0] != '') { 26 | $class_label[] = trim($grid[0]); 27 | } 28 | 29 | if (isset($grid[1]) && $grid[1] != '') { 30 | $field_before = '
'; 31 | $field_after = '
'; 32 | } 33 | } 34 | 35 | $output = $format; 36 | 37 | $search = []; 38 | $replace = []; 39 | 40 | $pos = strpos($format, 'YYYY'); 41 | if ($pos !== false) { 42 | $replace_i = ''; 49 | $replace['YYYY'] = $replace_i; 50 | $search[] = 'YYYY'; 51 | } 52 | 53 | $pos = strpos($format, 'MM'); 54 | if ($pos !== false) { 55 | $replace_i = ''; 62 | $replace['MM'] = $replace_i; 63 | $search[] = 'MM'; 64 | } 65 | 66 | $pos = strpos($format, 'DD'); 67 | if ($pos !== false) { 68 | $replace_i = ''; 75 | $replace['DD'] = $replace_i; 76 | $search[] = 'DD'; 77 | } 78 | 79 | $pos = strpos($format, 'HH'); 80 | if ($pos !== false) { 81 | $replace_i = ''; 87 | $replace['HH'] = $replace_i; 88 | $search[] = 'HH'; 89 | } 90 | 91 | $pos = strpos($format, 'ii'); 92 | if ($pos !== false) { 93 | $replace_i = ''; 99 | $replace['ii'] = $replace_i; 100 | $search[] = 'ii'; 101 | } 102 | 103 | $pos = strpos($format, 'ss'); 104 | if ($pos !== false) { 105 | $replace_i = ''; 111 | $replace['ss'] = $replace_i; 112 | $search[] = 'ss'; 113 | } 114 | 115 | // $output = str_replace($search, $replace, $output); 116 | $output = strtr($output, $replace); 117 | 118 | echo ' 119 |
120 | 121 | ' . $field_before . '
' . $output . '
' . $notice . $field_after . ' 122 |
123 | '; 124 | -------------------------------------------------------------------------------- /pages/setup.php: -------------------------------------------------------------------------------- 1 | isAdmin()) { 5 | 6 | $content = ''; 7 | $all_modules = rex_sql::factory()->getArray('SELECT * FROM '.rex::getTable('module')); 8 | $all_etpls = rex_sql::factory()->getArray('SELECT * FROM '.rex::getTable('yform_email_template')); 9 | 10 | $modules_dir = scandir(rex_path::addon($this->getName(), 'install/modules/')); 11 | foreach ($modules_dir as $k=>$v) { 12 | if (in_array($v,['.','..'])) { 13 | unset($modules_dir[$k]); 14 | } 15 | } 16 | 17 | $etpl_dir = scandir(rex_path::addon($this->getName(), 'install/yform_email/')); 18 | foreach ($etpl_dir as $k=>$v) { 19 | if (in_array($v,['.','..'])) { 20 | unset($etpl_dir[$k]); 21 | } 22 | } 23 | 24 | 25 | 26 | if (rex_request('install_module')) { 27 | $mod_to_install = ''; 28 | foreach ($modules_dir as $mod_name) { 29 | if (md5($mod_name) == rex_request('install_module')) { 30 | $mod_to_install = $mod_name; 31 | break; 32 | } 33 | 34 | } 35 | 36 | if ($mod_to_install) { 37 | $input = rex_file::get(rex_path::addon($this->getName(), 'install/modules/'.$mod_to_install.'/input.php')); 38 | $output = rex_file::get(rex_path::addon($this->getName(), 'install/modules/'.$mod_to_install.'/output.php')); 39 | 40 | $is_installed = false; 41 | foreach ($all_modules as $mod) { 42 | if (rex_string::normalize($mod_to_install) == $mod['key']) { 43 | $is_installed = true; 44 | } 45 | } 46 | 47 | 48 | $mi = rex_sql::factory(); 49 | $mi->setTable(rex::getTable("module")); 50 | $mi->setValue('input', $input); 51 | $mi->setValue('output', $output); 52 | if ($is_installed) { 53 | $mi->setWhere('`key`=:key',['key'=>rex_string::normalize($mod_to_install)]); 54 | $mi->update(); 55 | echo rex_view::success('Modul "' . $mod_to_install . '" wurde aktualisiert.'); 56 | } else { 57 | $mi->setValue('name', $mod_to_install); 58 | $mi->setValue('key', rex_string::normalize($mod_to_install)); 59 | $mi->insert(); 60 | echo rex_view::success('Modul wurde angelegt unter "' . $mod_to_install . '"'); 61 | } 62 | $all_modules = rex_sql::factory()->getArray('SELECT * FROM '.rex::getTable('module')); 63 | } 64 | 65 | } 66 | 67 | if (rex_request('install_etpl')) { 68 | $tpl_key = rex_request('install_etpl'); 69 | $body = rex_file::get(rex_path::addon($this->getName(), 'install/yform_email/'.$tpl_key.'/body.php')); 70 | $body_html = rex_file::get(rex_path::addon($this->getName(), 'install/yform_email/'.$tpl_key.'/body_html.php')); 71 | $meta = rex_string::yamlDecode(rex_file::get(rex_path::addon($this->getName(), 'install/yform_email/'.$tpl_key.'/metadata.yml'))); 72 | $meta['name'] = $tpl_key; 73 | 74 | 75 | $mi = rex_sql::factory(); 76 | $mi->setTable(rex::getTable("yform_email_template")); 77 | $mi->setValue('body', $body); 78 | $mi->setValue('body_html', $body_html); 79 | $mi->setValues($meta); 80 | 81 | $is_installed = false; 82 | foreach ($all_etpls as $tpl) { 83 | if ($tpl_key == $tpl['name']) { 84 | $is_installed = true; 85 | } 86 | } 87 | 88 | 89 | if ($is_installed) { 90 | $mi->setWhere('`name`=:name',['name'=>$tpl_key]); 91 | $mi->update(); 92 | echo rex_view::success('E-Mail Template "' . $tpl_key . '" wurde aktualisiert.'); 93 | } else { 94 | $mi->insert(); 95 | echo rex_view::success('E-Mail Template "' . $tpl_key . '" wurde angelegt'); 96 | } 97 | $all_etpls = rex_sql::factory()->getArray('SELECT * FROM '.rex::getTable('yform_email_template')); 98 | } 99 | 100 | 101 | $content = ''; 102 | 103 | 104 | $content .= '

Module intallieren oder aktualisieren

'; 105 | 106 | foreach ($modules_dir as $mod_name) { 107 | $is_installed = false; 108 | foreach ($all_modules as $mod) { 109 | if (rex_string::normalize($mod_name) == $mod['key']) { 110 | $is_installed = true; 111 | } 112 | } 113 | $content .= '

Modul '.$mod_name.' '.($is_installed ? 'aktualisieren' : 'installieren') .'

'; 114 | } 115 | 116 | 117 | 118 | 119 | $content .= '

E-Mail Templates intallieren

'; 120 | 121 | foreach ($etpl_dir as $etpl_name) { 122 | $is_installed = false; 123 | foreach ($all_etpls as $tpl) { 124 | if ($etpl_name == $tpl['name']) { 125 | $is_installed = true; 126 | } 127 | } 128 | $content .= '

Template '.$etpl_name.' '.($is_installed ? 'aktualisieren' : 'installieren') .'

'; 129 | } 130 | 131 | 132 | 133 | $fragment = new rex_fragment(); 134 | $fragment->setVar('title', $this->i18n('buchungskalender_setup'), false); 135 | $fragment->setVar('body', $content, false); 136 | echo $fragment->parse('core/page/section.php'); 137 | } -------------------------------------------------------------------------------- /ytemplates/uikit/value.google_geocode.tpl.php: -------------------------------------------------------------------------------- 1 | params['values'] as $address_value) { 7 | if (in_array($address_value->getName(), $LabelsAddress)) { 8 | $FieldsAddress[] = '#'.$address_value->getFieldId(); 9 | } 10 | } 11 | 12 | if ($googleapikey != '') { 13 | echo ''; 14 | } else { 15 | echo ''; 16 | } 17 | 18 | ?> 19 | 130 | 131 | 141 | 142 |
143 | 144 |

145 | | 146 | 147 |

148 |
Google Map
153 |
154 | -------------------------------------------------------------------------------- /pages/calendar.php: -------------------------------------------------------------------------------- 1 | find(); 4 | 5 | if (!count($objects)) { 6 | echo rex_view::error('Es wurde noch kein Objekt angelegt.'); 7 | return; 8 | } 9 | 10 | $start_year = min([buka_booking::get_min_year(), date('Y') - 2]); 11 | $end_year = max([buka_booking::get_max_year(), date('Y') + 2]); 12 | 13 | // $object_id = rex_request("object_id", 'int',$objects[0]->id); 14 | 15 | if (rex_request('object_id','int',0)) { 16 | rex_set_session('buka_object_id',rex_request('object_id','int',0)); 17 | $object_id = rex_request('object_id','int'); 18 | } else { 19 | $object_id = rex_session('buka_object_id','int',$objects[0]->id); 20 | } 21 | 22 | 23 | if (!$object_id) { 24 | echo rex_view::info('Es muss ein Objekt ausgewählt werden.'); 25 | return; 26 | } 27 | 28 | 29 | // dump($start_year); 30 | // dump($end_year); 31 | 32 | $cal = new buka_cal($object_id); 33 | 34 | $cal->set_start_date(); 35 | $cal->set_bookings(); 36 | 37 | // $cal->set_show_form(); 38 | 39 | 40 | // $cal->set_month_count(3); 41 | 42 | 43 | // echo $cal->getMonth(); 44 | 45 | $row_start_6 = '
'; 46 | $row_start_3 = '
'; 47 | $next_col_3 = '
'; 48 | $next_col_6 = '
'; 49 | $next_col_9 = '
'; 50 | $row_end = '
'; 51 | $div_end = '
'; 52 | 53 | $hidden_start = '
'; 54 | 55 | $yform = new rex_yform(); 56 | $yform->setObjectparams('form_action', rex_url::currentBackendPage()); 57 | 58 | $yform->setValueField('hidden', ['bookingdate', date('Y-m-d H:i:s')]); 59 | $yform->setValueField('hidden', ['status', 'confirmed']); 60 | $yform->setValueField('hidden', ['object_id', $object_id, 'REQUEST']); 61 | 62 | $yform->setValueField('html', ['', $hidden_start]); 63 | $yform->setValueField('text', ['datestart', '', '', '', ['type' => 'hidden', 'id' => 'datestart']]); 64 | $yform->setValueField('text', ['dateend', '', '', '', ['type' => 'hidden', 'id' => 'dateend']]); 65 | $yform->setValueField('html', ['', $div_end]); 66 | 67 | 68 | $yform->setValueField('html', ['', $row_start_3]); 69 | $yform->setValueField('text', ['date_start', 'Anreise', '', 'no_db', ['id' => 'date_start', 'disabled' => 'disabled']]); 70 | $yform->setValueField('html', ['', $next_col_3]); 71 | $yform->setValueField('text', ['date_end', 'Abreise', '', 'no_db', ['id' => 'date_end', 'disabled' => 'disabled']]); 72 | $yform->setValueField('html', ['', $row_end]); 73 | 74 | $yform->setValueField('html', ['', '
']); 75 | 76 | $yform->setValueField('html', ['', $row_start_6]); 77 | $yform->setValueField('text', ['vorname', 'Vorname']); 78 | $yform->setValueField('html', ['', $next_col_6]); 79 | $yform->setValueField('text', ['nachname', 'Nachname']); 80 | $yform->setValueField('html', ['', $row_end]); 81 | 82 | $yform->setValueField('text', ['anschrift', 'Anschrift']); 83 | $yform->setValueField('html', ['', $row_start_3]); 84 | $yform->setValueField('text', ['plz', 'PLZ']); 85 | $yform->setValueField('html', ['', $next_col_9]); 86 | $yform->setValueField('text', ['ort', 'Ort']); 87 | $yform->setValueField('html', ['', $row_end]); 88 | $yform->setValueField('text', ['land', 'Land']); 89 | 90 | $yform->setValueField('html', ['', $row_start_6]); 91 | $yform->setValueField('text', ['telefon', 'Telefon']); 92 | $yform->setValueField('html', ['', $next_col_6]); 93 | $yform->setValueField('text', ['email', 'E-Mail']); 94 | $yform->setValueField('html', ['', $row_end]); 95 | 96 | $yform->setValueField('html', ['', $row_start_6]); 97 | $yform->setValueField('text', ['personen', 'Anzahl Personen']); 98 | $yform->setValueField('html', ['', $next_col_6]); 99 | $yform->setValueField('text', ['anreisezeit', 'Anreisezeit']); 100 | $yform->setValueField('html', ['', $row_end]); 101 | 102 | $yform->setValueField('textarea', ['nachricht', 'Nachricht']); 103 | 104 | $yform->setValueField('submit', ['Submit', 'Buchung speichern', 'no_db']); 105 | $yform->setValueField('html', ['', '']); 106 | 107 | $yform->setValueField('html', ['', '
']); 108 | 109 | $yform->setValueField('html', ['', '
']); 110 | $yform->setValueField('html', ['', $cal->getCalendar()]); 111 | $yform->setValueField('html', ['', '

Eine Buchung kann mit Shift+Click angezeigt und bearbeitet werden. Per Click auf ein grünes Datumsfeld ein Anreisedatum (muss in der Zukunft liegen) wählen.

']); 112 | $yform->setValueField('html', ['', '']); 113 | $yform->setValueField('html', ['', '
']); 114 | 115 | $yform->setActionField('db', ['rex_buka_bookings']); 116 | $yform->setActionField('redirect', [rex_url::currentBackendPage()]); 117 | 118 | 119 | 120 | ?> 121 | 122 |
123 |

124 |
125 | 126 |
127 |
128 | 1) : ?> 129 |
130 | 131 | 136 |
137 |
138 | 139 |
140 |
141 | 142 | getForm(); ?> 143 | 144 | 147 | 148 | 149 | 150 | 151 |
152 |
153 | 154 |
155 | 156 |
157 | 158 |
159 | -------------------------------------------------------------------------------- /lib/buka_ical.php: -------------------------------------------------------------------------------- 1 | format('Y-m-d'); 21 | $strAbreise = $oAbreise->format('Y-m-d'); 22 | 23 | $booked = buka_booking::is_booked($strAnreise, $strAbreise, $objectid); 24 | 25 | 26 | // dump(trim(rex_config::get('buchungskalender','ignore_airbnb_blocked'),'|')); 27 | // geblockte Daten von Airbnb nicht übernehmen. 28 | if (trim(rex_config::get('buchungskalender','ignore_airbnb_blocked'),'|')) { 29 | if (strpos($date['UID'],'airbnb')) { 30 | if (strpos($date['SUMMARY'],'Not available')) { 31 | continue; 32 | } 33 | } 34 | } 35 | 36 | // wenn die Periode noch frei ist, eintragen .... 37 | if (!$booked && $strAnreise && $strAbreise) { 38 | 39 | $name = explode(' ', $date['SUMMARY']); 40 | $nachricht = isset($date['DESCRIPTION']) ? str_replace('\n', "\n", $date['DESCRIPTION']) : 'ical-Buchung'; 41 | 42 | $sql = rex_sql::factory()->setTable(rex::getTable('buka_bookings')); 43 | $values = [ 44 | 'vorname' => $name[0], 45 | 'nachname' => $name[1], 46 | 'nachricht' => $nachricht, 47 | 'email' => $date['UID'] ?? '', 48 | 'object_id' => $objectid, 49 | 'datestart' => $strAnreise, 50 | 'dateend' => $strAbreise, 51 | 'bookingdate' => date('Y-m-d H:i:s'), 52 | 'status' => 'confirmed' 53 | ]; 54 | $sql->setValues($values); 55 | $sql->insert(); 56 | } 57 | } 58 | } 59 | 60 | 61 | public static function ics_string_to_dates ($icsText) { 62 | $icsDates = []; 63 | // $icsFile = file_get_contents($paramUrl); 64 | // print_r($icsFile); 65 | $icsText = preg_replace('/\r\n |\r |\n /', '', $icsText); 66 | 67 | $icsData = explode("BEGIN:", $icsText); 68 | 69 | foreach ($icsData as $key => $value) { 70 | $icsDatesMeta[$key] = explode("\n", $value); 71 | } 72 | 73 | foreach ($icsDatesMeta as $key => $value) { 74 | foreach ($value as $subKey => $subValue) { 75 | if ($subValue != "") { 76 | if ($key != 0 && $subKey == 0) { 77 | $icsDates[$key]["BEGIN"] = $subValue; 78 | } else { 79 | $subValueArr = explode(":", $subValue, 2); 80 | $icsDates[$key][$subValueArr[0]] = $subValueArr[1]; 81 | } 82 | } 83 | } 84 | } 85 | 86 | return $icsDates; 87 | 88 | } 89 | 90 | 91 | public static function send_ical_data_for_obj ($object_id = 0) { 92 | $query = buka_booking::get_query($object_id); 93 | // nur Daten aus der Zukunft ausliefern 94 | $query->whereRaw('(datestart > :today OR dateend > :today)',['today'=>date('Y-m-d')]); 95 | $query->where('status','confirmed'); 96 | 97 | $out = 'BEGIN:VCALENDAR 98 | VERSION:2.0 99 | PRODID;X-RICAL-TZSOURCE=TZINFO:-//Agile Websites//buchungskalender 0.5//EN 100 | CALSCALE:GREGORIAN 101 | '; 102 | 103 | foreach ($query->find() as $i => $data) { 104 | // Terminstart 105 | $out .= 'BEGIN:VEVENT 106 | DTSTART;VALUE=DATE:' . str_replace('-', '', $data->datestart) . PHP_EOL; 107 | $out .= 'DTEND;VALUE=DATE:' . str_replace('-', '', $data->dateend) . ' 108 | UID:'.rex_config::get('buchungskalender','ical_uid').' 109 | SUMMARY:Booked date 110 | END:VEVENT 111 | '; 112 | } 113 | 114 | $out .= 'END:VCALENDAR'; 115 | 116 | return $out; 117 | 118 | 119 | } 120 | 121 | 122 | /** 123 | * Erneuert den Ical Cache alle 15 Minuten 124 | * Wenn ical Source nicht erreichbar ist, bleibt die Datei für 24 Stunden gültig 125 | * Danach wird false zurück gegeben. 126 | * 127 | * @param type $src 128 | * @param type $file 129 | * @return boolean 130 | */ 131 | public static function check_ical_data() { 132 | 133 | $objects = rex_yform_manager_table::get(rex::getTable('buka_objects'))->query()->where('ical_sync_link',"",'>') 134 | ->find(); 135 | 136 | foreach ($objects as $object) { 137 | $ical_urls = preg_split('/\R/',$object->ical_sync_link); 138 | foreach ($ical_urls as $ical_url) { 139 | self::fetch_ical_data($object,$ical_url); 140 | } 141 | } 142 | 143 | } 144 | 145 | public static function fetch_ical_data ($object,$ical_url) { 146 | $ical_url = trim($ical_url); 147 | // $icalfile = rex_path::cache('buchungskalender/' . md5($object->name.$ical_url).'.ics'); 148 | $icalfile = rex_path::addonCache('buchungskalender', md5($object->name.$ical_url).'.ics'); 149 | 150 | 151 | // dump($icalfile); 152 | 153 | // Alter prüfen 154 | if (file_exists($icalfile)) { 155 | // Wenn Datei erst 15 Minuten alt, dann ok 156 | if (filemtime($icalfile) > time() - intval(rex_config::get('buchungskalender','ical_interval'))) { 157 | return true; 158 | } 159 | } 160 | 161 | $ch = curl_init($ical_url); 162 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // als String zurückgeben 163 | curl_setopt($ch, CURLOPT_HEADER, false); 164 | $content = curl_exec($ch); 165 | curl_close($ch); 166 | 167 | if (!$content) { 168 | $content = file_get_contents($ical_url); 169 | } 170 | 171 | // dump($content); 172 | 173 | 174 | if (strlen($content) > 5) { 175 | rex_file::putCache($icalfile,$content); 176 | // rex_file::put($icalfile,$content); 177 | self::CheckIcalSource($content,$object->id); 178 | return true; 179 | } 180 | 181 | // Falls nicht erfolgreich, wird geprüft, ob das Alter älter als 1 Tag ist. 182 | if (file_exists($icalfile) && filemtime($icalfile) > time() - 86400) { 183 | return true; 184 | } 185 | 186 | return false; 187 | 188 | } 189 | 190 | } 191 | -------------------------------------------------------------------------------- /pages/bookings.php: -------------------------------------------------------------------------------- 1 |
'; 4 | $next_col_1_2 = '
'; 5 | $row_start_1_4 = '
'; 6 | $next_col_3_4 = '
'; 7 | $row_end = '
'; 8 | 9 | $params = $_REQUEST; 10 | $func = rex_request('func','string'); 11 | $id = rex_request('data_id','int'); 12 | 13 | $qry = buka_booking::get_query(); 14 | 15 | if (rex_request('filter','string') == 'next_arrival') { 16 | $qry->resetWhere(); 17 | $qry->whereRaw('dateend >= "'.date('Y-m-d').'" AND status = "confirmed"'); 18 | $qry->orderBy('datestart'); 19 | } 20 | 21 | // Achtung! Indexwerte des Arrays sind abhängig von der Feldposition 22 | 23 | $next_arrival = [ 24 | 'FORM' => [ 25 | 'rex_yform_searchvars-rex_buka_bookings' => [ 26 | 2 => '>'.date('Y-m-d'), 27 | 9 => [0 => 'confirmed'] 28 | ], 29 | ], 30 | 'sort'=>'datestart', 31 | 'sorttype'=>'asc' 32 | ]; 33 | 34 | if ($func == 'edit' && $id) { 35 | 36 | $yform = new rex_yform(); 37 | $yform->setObjectparams('form_name', 'table-rex_buka_bookings'); 38 | $yform->setObjectparams('form_action','index.php'); 39 | $yform->setValueField('hidden',['page','buchungskalender/bookings','REQUEST','no_db']); 40 | $yform->setValueField('hidden',['func','edit','REQUEST','no_db']); 41 | $yform->setValueField('hidden',['src',rex_request('src','string'),'REQUEST','no_db']); 42 | $yform->setValueField('hidden',['data_id',$id,'REQUEST','no_db']); 43 | // $yform->setDebug(TRUE); 44 | $yform->setObjectparams('form_showformafterupdate', 0); 45 | $yform->setObjectparams('getdata', true); 46 | $yform->setObjectparams('main_id', $id); 47 | $yform->setObjectparams('main_table', rex::getTable('buka_bookings')); 48 | $yform->setObjectparams('main_where', 'id='.$id); 49 | $yform->setObjectparams('submit_btn_label', rex_i18n::msg('buka_send_button')); 50 | 51 | $yform->setValueField('html', ['html1','HTML','
']); 52 | $yform->setValueField('date', ['datestart','translate:buka_startdate','2019','2050','d.m.Y','0','0','input:date']); 53 | $yform->setValueField('date', ['dateend','translate:buka_enddate','2019','2050','d.m.Y','0','0','input:date']); 54 | $yform->setValueField('text', ['anreisezeit','translate:buka_arrivaltime','','0']); 55 | $yform->setValueField('html', ['html2','html2','
']); 56 | $yform->setValueField('be_manager_relation', ['object_id','translate:buka_object','rex_buka_objects','name','0','1','translate:buka_please_select_object']); 57 | $yform->setValueField('be_manager_relation', ['bookingtype_id','translate:booking_type','rex_buka_bookingtype','name','0','1']); 58 | $yform->setValueField('html', ['html3','html3','
']); 59 | $yform->setValueField('text', ['vorname','translate:buka_firstname','','0']); 60 | $yform->setValueField('text', ['nachname','translate:buka_lastname','','0']); 61 | $yform->setValueField('html', ['html4','html4','
']); 62 | $yform->setValueField('text', ['personen','translate:buka_participants','','0']); 63 | $yform->setValueField('choice', ['status','translate:buka_state','translate:buka_asked=asked,translate:buka_confirmed=confirmed,translate:buka_canceled=storno,translate:buka_pre_booking=pre_booking,translate:buka_blocked=blocked','0','0','asked','','','-- bitte auswählen --','','','','','0']); 64 | $yform->setValueField('text', ['price','translate:buka_price','','0']); 65 | $yform->setValueField('html', ['html5','html5','
']); 66 | $yform->setValueField('textarea', ['nachricht','translate:buka_message','','0']); 67 | $yform->setValueField('html', ['html6','html6','
']); 68 | $yform->setValueField('text', ['telefon','translate:buka_phone','','0']); 69 | $yform->setValueField('text', ['email','E-Mail']); 70 | $yform->setValueField('html', ['html7','html7','
']); 71 | $yform->setValueField('text', ['anschrift','translate:buka_address','','0']); 72 | $yform->setValueField('text', ['plz','translate:buka_zip','','0']); 73 | $yform->setValueField('text', ['ort','translate:buka_city','','0']); 74 | $yform->setValueField('html', ['html8','html8','
']); 75 | $yform->setValueField('text', ['land','translate:buka_country','','0']); 76 | $yform->setValueField('choice', ['bookingstate_id','Buchungsstatus','SELECT id value, name label FROM rex_buka_bookingstate ORDER BY prio','1','1','','','','','','','','','0']); 77 | $yform->setValueField('be_manager_relation', ['participants','translate:buka_participants','rex_buka_participants','booking_id','5','0']); 78 | $yform->setValueField('text', ['hashval','','','','{"type":"hidden"}']); 79 | $yform->setValueField('datestamp', ['bookingdate','translate:buka_bookingdate','Y-m-d H:i:s','0','1']); 80 | 81 | // $yform->setValidateField('customfunction', ['datestart,dateend,object_id,status','buka_booking::unique_booking','','Dieses Buchungsdatum ist ungültig. Es gibt bereits eine Buchung für dieses Datum.','0']); 82 | 83 | $yform->setValidateField('customfunction', ['datestart,dateend,object_id,status','buka_booking::unique_booking','',rex_i18n::msg('buka_booking_uncorrect'),'0']); 84 | $yform->setValidateField('compare', ['datestart','dateend','>=',rex_i18n::msg('datefrom_dateto_booking')]); 85 | 86 | $yform->setActionField('db',['rex_buka_bookings','main_where']); 87 | 88 | if (rex_request('src','string') == 'calendar') { 89 | $yform->setActionField('redirect',['index.php?page=buchungskalender/calendar']); 90 | } elseif (rex_session('returnto')) { 91 | $yform->setActionField('redirect',[str_replace('&','&',rex_session('returnto'))]); 92 | } else { 93 | $yform->setActionField('redirect',['index.php?page=buchungskalender/bookings']); 94 | } 95 | 96 | $fragment = new rex_fragment(); 97 | $fragment->setVar('class', 'edit', false); 98 | $fragment->setVar('title', rex_i18n::msg('buka_edit_booking'), false); 99 | $fragment->setVar('body', $yform->getForm(), false); 100 | echo $fragment->parse('core/page/section.php'); 101 | 102 | 103 | } else { 104 | 105 | echo ''; 110 | 111 | 112 | $_REQUEST['table_name'] = 'rex_buka_bookings'; 113 | include \rex_path::plugin('yform','manager','pages/data_edit.php'); 114 | 115 | } 116 | 117 | ?> -------------------------------------------------------------------------------- /lib/buka_date_cal.php: -------------------------------------------------------------------------------- 1 | set_slots(); 11 | $this->set_places(); 12 | 13 | } 14 | 15 | 16 | private function set_slots () { 17 | foreach (json_decode($this->object->available_times) as $item) { 18 | $day_str = str_replace($this->weekdays,array_keys($this->weekdays),$item[0]); // Mo-Fr => 0-4 19 | $days = explode('-',$day_str); 20 | if (count($days) > 1) { 21 | for ($i = $days[0]; $i <= $days[1]; $i++) { 22 | $this->time_slots[$i] = array_merge($this->time_slots[$i] ?? [],$this->fill_slots($item[1],$item[2])); 23 | } 24 | } else { 25 | $this->time_slots[$days[0]] = array_merge($this->time_slots[$days[0]] ?? [], $this->fill_slots($item[1],$item[2])); 26 | } 27 | } 28 | } 29 | 30 | 31 | private function set_places () { 32 | foreach (json_decode($this->object->places) as $pl) { 33 | $this->places[$pl[0]] = $pl[0]; 34 | } 35 | } 36 | 37 | private function fill_slots($start,$end) { 38 | $slots = []; 39 | $start = str_pad(str_replace('.',':',$start),5,'0',STR_PAD_LEFT); 40 | $end = str_pad(str_replace('.',':',$end),5,'0',STR_PAD_LEFT); 41 | 42 | $period_sek = strtotime($this->object->period) - strtotime('TODAY'); // Sekunden, z.B. 00:45:00 = 2700 43 | 44 | $period = new DateInterval('PT'.$period_sek.'S'); 45 | $d0 = new DateTime('2021-09-02 '.$start); 46 | 47 | $current = $d0->format('H:i'); 48 | 49 | while($current < $end) { 50 | $slots[$current] = ['start'=>$current]; 51 | $d0->add($period); 52 | $current = $d0->format('H:i'); 53 | } 54 | array_pop($slots); 55 | 56 | return $slots; 57 | } 58 | 59 | 60 | public function getMonth($year = 0, $month = 0, $nth_month = 0) { 61 | if (!$year) { 62 | $year = date('Y'); 63 | } 64 | if (!$month) { 65 | $month = date('m'); 66 | } 67 | 68 | $dt = new DateTime(); 69 | $dt->setDate($year, $month, 1); 70 | 71 | $class = ''; 72 | 73 | foreach ($this->mobile_month_count as $k=>$mclass) { 74 | if ($nth_month > $k) { 75 | $class = $mclass; 76 | } 77 | } 78 | 79 | $out = '
    '; 80 | $out .= '
  • ' . $this->months[$month - 1] . ' ' . $year . '
  • '; 81 | foreach ($this->weekdays as $wd) { 82 | $out .= '
  • ' . $wd . '
  • '; 83 | } 84 | $out .= str_repeat('
  •  
  • ', ($dt->format('N') - 1)); 85 | $day = 1; 86 | while ($day <= $dt->format('t')) { 87 | $date = $year . '-' . $dt->format('m') . '-' . str_pad($day, 2, '0', STR_PAD_LEFT); 88 | $bookingData = $this->get_booking_data_for_date($date); 89 | $season = $this->get_season($date); 90 | $out .= '
  • ' . $day . '
  • '; 91 | if ($date >= date('Y-m-d')) { 92 | $this->set_radio_values_for_date($date); 93 | } 94 | $day++; 95 | 96 | } 97 | $out .= '
'; 98 | 99 | return $out; 100 | } 101 | 102 | public function set_radio_values_for_date($date) { 103 | // dump($this->bookings); 104 | $dateval = strtotime($date); 105 | if (!isset($this->time_slots[date('N',$dateval)-1])) { 106 | return; 107 | } 108 | // dump($this->bookings[0]->slotvalue); 109 | // dump(count(json_decode($this->object->places))); 110 | 111 | foreach ($this->time_slots[date('N',$dateval)-1] as $time) { 112 | self::$radio_values[$date][$time['start']] = $time; 113 | self::$radio_values[$date][$time['start']]['countbookings'] = $this->get_bookings_for_time($date . ' ' . $time['start'],$date,$time['start']); 114 | self::$radio_values[$date][$time['start']]['places'] = $this->get_places_for_time($date,$time['start']); 115 | self::$radio_values[$date][$time['start']]['bookedout'] = self::$radio_values[$date][$time['start']]['countbookings'] >= count(json_decode($this->object->places)); 116 | $this->set_available($date,$time['start']); 117 | } 118 | } 119 | 120 | 121 | public static function format_slot_date ($date) { 122 | $weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So']; 123 | return $weekdays[date('N',strtotime($date))-1] .', '. date('d.m.Y - H:i',strtotime($date)).' Uhr'; 124 | } 125 | 126 | 127 | public function get_bookings_for_time($datetime,$date,$time) { 128 | $datebookings = []; 129 | foreach ($this->bookings as $booking) { 130 | if (strpos($booking->slotvalue,$datetime) === 0) { 131 | $datebookings[] = $booking; 132 | } 133 | } 134 | self::$radio_values[$date][$time]['bookings'] = $datebookings; 135 | return count($datebookings); 136 | } 137 | 138 | public function get_places_for_time($date,$time) { 139 | return $this->places; 140 | } 141 | 142 | /** 143 | * Hier lässt sich noch Urlaub einklinken 144 | */ 145 | 146 | private function set_available($date,$time) { 147 | $bookings = self::$radio_values[$date][$time]['bookings']; 148 | $places = self::$radio_values[$date][$time]['places']; 149 | $new_places = []; 150 | foreach ($places as $place_name=>$val) { 151 | $new_places[$place_name] = ['status'=>1,'name'=>$val]; 152 | foreach ($bookings as $booking) { 153 | if ($booking->place == $place_name) { 154 | $new_places[$place_name]['status'] = 0; 155 | } 156 | } 157 | 158 | } 159 | self::$radio_values[$date][$time]['places'] = $new_places; 160 | $available = []; 161 | foreach ($new_places as $place_name=>$val) { 162 | if ($val['status'] == 1) { 163 | $available[] = $place_name; 164 | } 165 | } 166 | self::$radio_values[$date][$time]['available'] = '"'.implode('","',$available).'"'; 167 | } 168 | 169 | 170 | public function set_date_bookings() { 171 | $query = rex_yform_manager_table::get(rex::getTable('buka_date_bookings'))->query(); 172 | $query->whereRaw('status = :status AND object_id = :object_id',['status'=>'confirmed','object_id'=>$this->objectId]); 173 | $this->bookings = $query->find(); 174 | } 175 | 176 | 177 | 178 | 179 | 180 | } -------------------------------------------------------------------------------- /lib/module_helpers.php: -------------------------------------------------------------------------------- 1 | ' . $linkText . ''; 102 | return $link; 103 | } 104 | } 105 | 106 | public static function downloadYoutubeThumbnailImage($youTubeLink = '', $thumbNamilQuality = '', $fileNameWithExt = '', $fileDownLoadPath = '') 107 | { 108 | $videoIdExploded = explode('?v=', $youTubeLink); 109 | if (sizeof($videoIdExploded) == 1) { 110 | $videoIdExploded = explode('&v=', $youTubeLink); 111 | $videoIdEnd = end($videoIdExploded); 112 | $removeOtherInVideoIdExploded = explode('&', $videoIdEnd); 113 | $youTubeVideoId = current($removeOtherInVideoIdExploded); 114 | } else { 115 | $videoIdExploded = explode('?v=', $youTubeLink); 116 | $videoIdEnd = end($videoIdExploded); 117 | $removeOtherInVideoIdExploded = explode('&', $videoIdEnd); 118 | $youTubeVideoId = current($removeOtherInVideoIdExploded); 119 | } 120 | switch ($thumbNamilQuality) { 121 | case 'LOW': 122 | $imageUrl = 'http://img.youtube.com/vi/' . $youTubeVideoId . '/sddefault.jpg'; 123 | break; 124 | case 'MEDIUM': 125 | $imageUrl = 'http://img.youtube.com/vi/' . $youTubeVideoId . '/mqdefault.jpg'; 126 | break; 127 | case 'HIGH': 128 | $imageUrl = 'http://img.youtube.com/vi/' . $youTubeVideoId . '/hqdefault.jpg'; 129 | break; 130 | case 'MAXIMUM': 131 | $imageUrl = 'http://img.youtube.com/vi/' . $youTubeVideoId . '/maxresdefault.jpg'; 132 | break; 133 | default: 134 | return 'Choose The Quality Between [ LOW (or) MEDIUM (or) HIGH (or) MAXIMUM]'; 135 | break; 136 | } 137 | if (empty($fileNameWithExt) || is_null($fileNameWithExt) || $fileNameWithExt === '') { 138 | $toArray = explode('/', $imageUrl); 139 | $fileNameWithExt = md5(time() . mt_rand(1, 10)) . '.' . substr(strrchr(end($toArray), '.'), 1); 140 | } 141 | if (!is_dir($fileDownLoadPath)) { 142 | mkdir($fileDownLoadPath, 0777, true); 143 | } 144 | file_put_contents($fileDownLoadPath . $fileNameWithExt, file_get_contents($imageUrl)); 145 | return $fileNameWithExt; 146 | } 147 | // Sprachumschaltung 148 | public static function getUrlOfOtherLanguage() 149 | { 150 | $other_language = rex_clang::getCurrentId() == 1 ? 2 : 1; 151 | if (rex_article::get(rex_article::getCurrentId(), $other_language)->isOnline()) { 152 | $other_id = rex_article::getCurrentId(); 153 | } else { 154 | $other_id = rex_article::getSiteStartArticle()->getId(); 155 | } 156 | return rex_yrewrite::getFullUrlByArticleId($other_id, $other_language); 157 | } 158 | 159 | public static function getArticlesOfList($list) 160 | { 161 | $return = []; 162 | $list = explode(",", $list); 163 | foreach ($list as $art) { 164 | $article = rex_article::get($art); 165 | if ($article && $article->isOnline()) { 166 | $return[] = $article; 167 | } 168 | } 169 | return $return; 170 | } 171 | 172 | 173 | public static function get_icon ($article) { 174 | while (!$article->getValue('art_icon')) { 175 | $article = $article->getParent(); 176 | if (!$article) { 177 | break; 178 | } 179 | } 180 | if ($article) { 181 | return $article->getValue('art_icon'); 182 | } 183 | return false; 184 | } 185 | 186 | } 187 | -------------------------------------------------------------------------------- /pages/settings.php: -------------------------------------------------------------------------------- 1 | addFieldset('Buchungskalender - Einstellungen'); 4 | foreach (rex_clang::getAll() as $clang) { 5 | $field = $form->addTextField('weekdays_'.$clang->getId()); 6 | if (!$field->getValue()) { 7 | $field->setValue('Mo,Di,Mi,Do,Fr,Sa,So'); 8 | } 9 | $field->setLabel('Wochentage '.$clang->getName()); 10 | $field->setNotice('Wochentage durch Komma getrennt eingeben'); 11 | } 12 | 13 | foreach (rex_clang::getAll() as $clang) { 14 | $field = $form->addTextField('months_'.$clang->getId()); 15 | if (!$field->getValue()) { 16 | $field->setValue('Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember'); 17 | } 18 | $field->setLabel('Monate '.$clang->getName()); 19 | $field->setNotice('Monate durch Komma getrennt eingeben'); 20 | } 21 | 22 | 23 | $field = $form->addTextField('max_booking_time'); 24 | if (!$field->getValue()) { 25 | $field->setValue('365 * 24 * 60 * 60'); 26 | } 27 | $field->setLabel('Maximale Buchungszeit'); 28 | $field->setNotice('Zeitraum, wie lange im voraus Buchungen vorgenommen werden können in Sekunden. Auch Formel möglich. z.B. 365 * 1.25 * 24 * 60 * 60 ergibt ein Jahr und drei Monate.'); 29 | 30 | $field = $form->addTextField('min_booking_days_futur'); 31 | if (!$field->getValue()) { 32 | $field->setValue('3'); 33 | } 34 | $field->setLabel('Mindestens Tage vor Anreise'); 35 | $field->setNotice('Anzahl Tage, die die Buchung mindestens vor der Anreise liegen muss.'); 36 | 37 | $field = $form->addTextField('min_booking_days'); 38 | if (!$field->getValue()) { 39 | $field->setValue('3'); 40 | } 41 | $field->setLabel('Mindestbuchungszeit'); 42 | $field->setNotice('Anzahl Nächte, die mindestens gebucht werden müssen.'); 43 | 44 | $field = $form->addTextAreaField('message_min_booking_days'); 45 | if (!$field->getValue()) { 46 | $field->setValue('Die Mindestbuchungsdauer beträgt drei Nächte.'); 47 | } 48 | $field->setLabel('Meldung Mindestbuchungszeit'); 49 | $field->setNotice('Die Nachricht wird angezeigt, wenn die Mindestbuchungszeit nicht erreicht ist.'); 50 | 51 | $field = $form->addTextField('ical_interval'); 52 | $field->setLabel('Ical Cachedauer in Sekunden'); 53 | $field->setNotice('Leer lassen, wenn keine ical Synchronisation verwendet wird. Sinnvoller Eintrag: 900 für 15 Minuten.'); 54 | 55 | $field = $form->addTextField('ical_uid'); 56 | $field->setLabel('Ical Uid'); 57 | $field->setNotice('Leer lassen, wenn keine ical Synchronisation verwendet wird. Sinnvoller Eintrag: ical@ferien-am-tressower-see.de.'); 58 | 59 | $field = $form->addCheckboxField('ignore_airbnb_blocked'); 60 | $field->setLabel('Geblockte Airbnb Termine ignorieren'); 61 | $field->addOption('Geblockte Airbnb Termine ignorieren', "1"); 62 | $field->setNotice('Wenn ical Synchronisation mit airbnb verwendet wird, werden standardmäßig in airbnb geblockte Termine auch synchronisiert. Dies kann durch anklicken dieser Checkbox verhindert werden. Es können dann in airbnb Termine blockiert werden, ohne dass diese dann automatisch im Buchungskalender blockiert werden. rex_config::get(\'buchungskalender\',\'ignore_airbnb_blocked\').'); 63 | 64 | $field = $form->addLinkmapField('booking_page'); 65 | $field->setLabel('Buchungsseite'); 66 | $field->setNotice('rex_config::get(\'buchungskalender\',\'booking_page\').'); 67 | 68 | $field = $form->addLinkmapField('summary_page'); 69 | $field->setLabel('Buchung Zusammenfassung'); 70 | $field->setNotice('rex_config::get(\'buchungskalender\',\'summary_page\').'); 71 | 72 | $field = $form->addLinkmapField('confirmation_page'); 73 | $field->setLabel('E-Mail-Link Bestätigungsseite'); 74 | $field->setNotice('rex_config::get(\'buchungskalender\',\'confirmation_page\').'); 75 | 76 | $field = $form->addTextField('email_me'); 77 | $field->setLabel('E-Mail Adressen des Betreibers'); 78 | $field->setNotice('rex_config::get(\'buchungskalender\',\'email_me\'). Mehrere Adressen durch Komma trennen. An diese E-Mail Adressen werden die Reservierungsmails geschickt.'); 79 | 80 | $field = $form->addTextField('asked_offset'); 81 | $field->setLabel('Reservierungsdauer'); 82 | $field->setNotice('rex_config::get(\'buchungskalender\',\'asked_offset\'). Wenn das Feld ausgefüllt wird, werden reservierte Termine im Kalender als belegt gekennzeichnet. 83 | Leer lassen für keine Reservierungsdauer. Mögliche Werte (Beispiele): 10 minutes, 2 hours, 7 days.'); 84 | 85 | $field = $form->addSelectField('calendar_view'); 86 | $field->setLabel('Kalender Darstellung'); 87 | $select = $field->getSelect(); 88 | $select->addOptions([ 89 | 'month'=>'Monatskalender', 90 | 'gant'=>'Gant Ansicht' 91 | ]); 92 | $field->setNotice('rex_config::get("buchungskalender","calendar_view")'); 93 | 94 | $field = $form->addTextField('minicalendar_count_month'); 95 | $field->setLabel('Anzahl Monate im Minikalender'); 96 | $field->setNotice('Hier kann eine abweichende Anzahl von Monaten eingestellt werden, die im Minikalender dargestellt werden sollen: rex_config::get(\'buchungskalender\',\'minicalendar_count_month\').'); 97 | 98 | 99 | $form->addFieldset('Währungseinstellungen'); 100 | 101 | $field = $form->addTextField('currency_default'); 102 | $field->setLabel('Standardwährung'); 103 | $field->setNotice('rex_config::get(\'buchungskalender\',\'currency_default\'). Beispiel: EUR.'); 104 | 105 | $field = $form->addTextField('currency_formula'); 106 | $field->setLabel('Währungsformel'); 107 | $field->setNotice('rex_config::get(\'buchungskalender\',\'currency_formula\'). Beispiel: {"10":0,"100":1,"1000":2}. Bis zu einem Wert von 10 wird auf ganze Stellen gerundet (9.6 => 10, 3.3 => 3) Bis zu einem Wert von 100 wird auf 10er gerundet (123 => 120, 178 => 180), ab 1000 wird auf 100er gerundet. Als Rundungswert sind auch negative Angaben möglich. -2 rundet z.B. auf die zweite Nachkommastelle. Wichtig: die Angaben müssen vom kleinsten Rundungsbetrag zum größten gesetzt werden. Die Rundung bezieht sich immer auf den Einzelpreis. Summen werden nicht gerundet.'); 108 | 109 | $field = $form->addTextField('currency_factor'); 110 | $field->setLabel('Umrechnungskurs'); 111 | $field->setNotice('rex_config::get(\'buchungskalender\',\'currency_factor\'). Beispiel: 9.9.'); 112 | 113 | $field = $form->addTextField('currency_name'); 114 | $field->setLabel('Währung'); 115 | $field->setNotice('rex_config::get(\'buchungskalender\',\'currency_name\'). Beispiel: CHF.'); 116 | 117 | $field = $form->addSelectField('currency_langs'); 118 | $field->setLabel('Sprachen'); 119 | $field->setAttribute('class','form-control selectpicker'); 120 | // $field->setStyle('class="form-control selectpicker"'); 121 | 122 | 123 | 124 | $select = $field->getSelect(); 125 | $select->setAttribute('multiple',1); 126 | $select->addSqlOptions('SELECT name, id FROM rex_clang ORDER BY priority'); 127 | $field->setNotice('rex_config::get("buchungskalender","currency_langs")'); 128 | 129 | 130 | 131 | 132 | /* 133 | $form->addFieldset('Terminbuchung - Einstellungen'); 134 | 135 | $field = $form->addLinkmapField('summary_datebooking_page'); 136 | $field->setLabel('Buchung Zusammenfassung'); 137 | $field->setNotice('rex_config::get(\'buchungskalender\',\'summary_datebooking_page\').'); 138 | 139 | $field = $form->addLinkmapField('confirmation_datebooking_page'); 140 | $field->setLabel('E-Mail-Link Bestätigungsseite'); 141 | $field->setNotice('rex_config::get(\'buchungskalender\',\'confirmation_datebooking_page\').'); 142 | */ 143 | 144 | 145 | 146 | 147 | 148 | $content = $form->get(); 149 | 150 | $fragment = new rex_fragment(); 151 | $fragment->setVar('title', 'Einstellungen'); 152 | $fragment->setVar('body', $content, false); 153 | $content = $fragment->parse('core/page/section.php'); 154 | 155 | echo $content; 156 | -------------------------------------------------------------------------------- /install/modules/Buchungskalender - Kalender/output.php: -------------------------------------------------------------------------------- 1 | maxBookingYear = date('Y', buka_booking::get_end_time()); 28 | $cal->maxBookingMonth = date('m', buka_booking::get_end_time()); 29 | $cal->objectId = $var1['object_id']; 30 | $cal->cal_wrapper_class = 'buka-cal-wrapper'; 31 | $cal->monthcount = 4; 32 | $cal->mobile_month_count = [2=>'uk-visible@m',3=>'uk-visible@l',4=>'uk-visible@xl']; 33 | 34 | $cal->set_start_date(); 35 | $cal->set_bookings(); 36 | 37 | $object = buka_objects::get_object_for_id($var1['object_id']); 38 | 39 | 40 | $row_start_12 = '
'; 41 | $row_start_6 = '
'; 42 | $row_start_3 = '
'; 43 | $next_col_3 = '
'; 44 | $next_col_6 = '
'; 45 | $next_col_9 = '
'; 46 | $row_end = '
'; 47 | $div_end = '
'; 48 | 49 | $hidden_start = '
'; 50 | 51 | $yform = new rex_yform(); 52 | $yform->setObjectparams('form_ytemplate','uikit,bootstrap,classic'); 53 | $yform->setObjectparams('form_action', rex_getUrl()); 54 | $yform->setObjectparams('error_class', 'uk-form-danger has-error'); 55 | $yform->setObjectparams('form_class', 'uk-form rex-yform'); 56 | 57 | // $yform->setObjectparams('form_showformafterupdate',1); 58 | // $yform->setObjectparams('debug',true); 59 | 60 | $yform->setValueField('hidden', ['bookingdate', date('Y-m-d H:i:s')]); 61 | $yform->setValueField('hidden', ['status', 'asked']); 62 | $yform->setValueField('hidden', ['object_id', $cal->objectId]); 63 | $yform->setValueField('hidden', ['last_art_id', rex_article::getCurrentId()]); 64 | 65 | $yform->setValueField('html', ['', $hidden_start]); 66 | $yform->setValueField('text', ['datestart', '', $booking['datestart'] ?? '', '', ['type' => 'hidden', 'id' => 'datestart']]); 67 | $yform->setValueField('text', ['dateend', '', $booking['dateend'] ?? '', '', ['type' => 'hidden', 'id' => 'dateend']]); 68 | 69 | // $yform->setValueField('html', ['','']); 70 | // $yform->setValueField('html', ['','']); 71 | 72 | // $yform->setValueField('hidden', ['datestart', '', 'REQUEST', '', ['id' => 'datestart']]); 73 | // $yform->setValueField('hidden', ['dateend', '','REQUEST', '',['id' => 'dateend']]); 74 | $yform->setValueField('html', ['', $div_end]); 75 | 76 | $yform->setValueField('html', ['', $row_start_3]); 77 | $yform->setValueField('text', ['date_start', 'Anreise', $booking['date_start'] ?? '', 'no_db', ['id' => 'date_start', 'readonly' => 'readonly']]); 78 | $yform->setValueField('html', ['', $next_col_3]); 79 | $yform->setValueField('text', ['date_end', 'Abreise', $booking['date_end'] ?? '', 'no_db', ['id' => 'date_end', 'readonly' => 'readonly']]); 80 | $yform->setValueField('html', ['', $row_end]); 81 | 82 | $yform->setValueField('html', ['', '
']); 83 | 84 | $yform->setValueField('html', ['', $row_start_6]); 85 | $yform->setValueField('text', ['vorname', 'Vorname*', $booking['vorname'] ?? '']); 86 | $yform->setValueField('html', ['', $next_col_6]); 87 | $yform->setValueField('text', ['nachname', 'Nachname*', $booking['nachname'] ?? '']); 88 | $yform->setValueField('html', ['', $row_end]); 89 | 90 | $yform->setValueField('html', ['', $row_start_12]); 91 | $yform->setValueField('text', ['anschrift', 'Anschrift', $booking['anschrift'] ?? '']); 92 | $yform->setValueField('html', ['', $row_end]); 93 | $yform->setValueField('html', ['', $row_start_3]); 94 | $yform->setValueField('text', ['plz', 'PLZ', $booking['plz'] ?? '']); 95 | $yform->setValueField('html', ['', $next_col_9]); 96 | $yform->setValueField('text', ['ort', 'Ort', $booking['ort'] ?? '']); 97 | $yform->setValueField('html', ['', $row_end]); 98 | 99 | $yform->setValueField('html', ['', $row_start_12]); 100 | $yform->setValueField('text', ['land', 'Land', $booking['land'] ?? '']); 101 | $yform->setValueField('html', ['', $row_end]); 102 | 103 | $yform->setValueField('html', ['', $row_start_6]); 104 | $yform->setValueField('text', ['telefon', 'Telefon', $booking['telefon'] ?? '']); 105 | $yform->setValueField('html', ['', $next_col_6]); 106 | $yform->setValueField('text', ['email', 'E-Mail', $booking['email'] ?? '']); 107 | $yform->setValueField('html', ['', $row_end]); 108 | 109 | $yform->setValueField('html', ['', $row_start_6]); 110 | $yform->setValueField('text', ['personen', 'Anzahl Personen', $booking['personen'] ?? '']); 111 | $yform->setValueField('html', ['', $next_col_6]); 112 | $yform->setValueField('text', ['anreisezeit', 'Anreisezeit', $booking['anreisezeit'] ?? '']); 113 | $yform->setValueField('html', ['', $row_end]); 114 | 115 | $yform->setValueField('textarea', ['nachricht', 'Nachricht', $booking['nachricht'] ?? '']); 116 | 117 | $yform->setValueField('html', ['', '']); 118 | $yform->setValueField('submit', ['Submit', 'weiter ...', 'no_db','','','uk-active']); 119 | 120 | $yform->setValueField('html', ['', '
']); 121 | 122 | $yform->setValueField('html', ['', '
']); 123 | $yform->setValueField('html', ['', '
']); 124 | $yform->setValueField('html', ['', $cal->getCalendar()]); 125 | if (rex_request('FORM','array') || $booking) { 126 | $yform->setValueField('html', ['', '']); 127 | } else { 128 | $yform->setValueField('html', ['', '']); 129 | } 130 | $yform->setValueField('html', ['', '
']); 131 | $yform->setValueField('html', ['', '
']); 132 | 133 | // $yform->setValidateField('customfunction',['datestart','buka_booking::save_form1_in_session',['datestart','dateend']]); 134 | $yform->setValidateField('type',['email','email','Bitte geben Sie eine gültige E-Mail Adresse an.']); 135 | $yform->setValidateField('empty',['vorname','Bitte füllen Sie die markierten Felder aus.']); 136 | $yform->setValidateField('empty',['nachname','Bitte füllen Sie die markierten Felder aus.']); 137 | $yform->setValidateField('type',['datestart','date','Bitte geben Sie ein gültiges Datum an.']); 138 | $yform->setValidateField('type',['dateend','date','Bitte geben Sie ein gültiges Datum an.']); 139 | 140 | 141 | // $yform->setActionField('db', ['rex_buka_bookings']); 142 | $yform->setActionField('callback', ['buka_booking::save_in_session']); 143 | $yform->setActionField('redirect', [rex_getUrl(rex_config::get('buchungskalender','summary_page'))]); 144 | 145 | ?> 146 | 147 |
148 |
149 |
150 |

151 |
152 |

name .' ' . ($object->reservation == 'book' ? 'buchen' : 'anfragen') ?>

153 | getForm() ?> 154 |
155 |
-------------------------------------------------------------------------------- /lib/buka_barcal.php: -------------------------------------------------------------------------------- 1 | set_start_date($start_date); 19 | } 20 | $this->set_weekdays(); 21 | return $this; 22 | } 23 | 24 | public function set_num_of_months ($num) { 25 | $this->num_of_months = $num; 26 | } 27 | 28 | public function set_start_date ($start_date = false) { 29 | if (!$start_date) { 30 | $start_date = date('Y-m-d'); 31 | } 32 | $this->months = []; 33 | self::$start_date = $start_date; 34 | $this->init_start_end_date(); 35 | $this->init_calendar(); 36 | return $this; 37 | } 38 | 39 | public function get_calendar () { 40 | return $this; 41 | } 42 | 43 | public function get_months () { 44 | if (!$this->months) { 45 | $this->set_start_date(); 46 | } 47 | // dump($this->months); 48 | return $this->months; 49 | } 50 | 51 | public function init_calendar () { 52 | $n = 0; 53 | $this->current_year = $this->start_year; 54 | $this->current_month = $this->start_month; 55 | 56 | $with_reservation = ''; 57 | // nur im Backend Reservierte Datensätze im Kalender anzeigen. 58 | if (rex::isBackend()) { 59 | $with_reservation = ' OR status = "asked"'; 60 | } 61 | 62 | 63 | $objects = buka_objects::get_query()->find(); 64 | foreach ($objects as $object) { 65 | $qry = buka_booking::get_query($object->id,true); 66 | $qry->orderBy('datestart'); 67 | if (rex_config::get('buchungskalender','asked_offset')) { 68 | $qry->whereRaw('(( 69 | (status = "confirmed"'.$with_reservation.') AND ((dateend >= :start AND datestart <= :end) 70 | OR (dateend <= :start AND datestart >= :end) 71 | OR (datestart >= :start AND datestart <= :end)) 72 | 73 | ) OR (status = "asked" AND bookingdate > :bookingdate))',['start'=>self::$start_date,'end'=>self::$end_date,'bookingdate'=>date('Y-m-d H:i:s',strtotime('-'.rex_config::get('buchungskalender','asked_offset')))]) 74 | ; 75 | } else { 76 | $qry->whereRaw('(( 77 | (status = "confirmed"'.$with_reservation.') AND ((dateend >= :start AND datestart <= :end) 78 | OR (dateend <= :start AND datestart >= :end) 79 | OR (datestart >= :start AND datestart <= :end)) 80 | 81 | ))',['start'=>self::$start_date,'end'=>self::$end_date]) 82 | ; 83 | 84 | } 85 | $result = $qry->find(); 86 | $result->populateRelation('bookingtype_id'); 87 | foreach ($result as $res) { 88 | $bt_name = $res->getRelatedDataset('bookingtype_id'); 89 | $res->bookingtype_name = ''; 90 | if ($bt_name) { 91 | $res->bookingtype_name = $bt_name->name; 92 | } 93 | } 94 | if ($object->combination) { 95 | // Kombinationsobjekte kompaktieren 96 | $result = self::combine_result($result); 97 | } 98 | $object->bookings = $result; 99 | 100 | } 101 | 102 | self::$objects = $objects; 103 | // dump(self::$objects[6]); 104 | 105 | while ($n < $this->num_of_months) { 106 | $this->months[] = $this->get_month($this->current_month,$this->current_year); 107 | $this->current_month ++; 108 | 109 | if ($this->current_month > 12) { 110 | $this->current_month = 1; 111 | $this->current_year ++; 112 | } 113 | 114 | $n++; 115 | } 116 | 117 | } 118 | 119 | private function set_weekdays () { 120 | 121 | self::$weekdays = [ 122 | rex_formatter::intlDate(strtotime('2021-12-13'),'ccc'), 123 | rex_formatter::intlDate(strtotime('2021-12-14'),'ccc'), 124 | rex_formatter::intlDate(strtotime('2021-12-15'),'ccc'), 125 | rex_formatter::intlDate(strtotime('2021-12-16'),'ccc'), 126 | rex_formatter::intlDate(strtotime('2021-12-17'),'ccc'), 127 | rex_formatter::intlDate(strtotime('2021-12-18'),'ccc'), 128 | rex_formatter::intlDate(strtotime('2021-12-19'),'ccc'), 129 | ]; 130 | } 131 | 132 | private function get_month ($month,$year) { 133 | $dt = new DateTime(); 134 | $out = []; 135 | $dt->setDate($year, $month, 1); 136 | $day = 1; 137 | while ($day <= $dt->format('t')) { 138 | $buka_date = new buka_date($year,$month,$day); 139 | $buka_date->booking = $this->get_bookings_for_date($buka_date); 140 | $out[] = $buka_date; 141 | $day++; 142 | } 143 | return $out; 144 | } 145 | 146 | private function get_bookings_for_date($buka_date) { 147 | $date = $buka_date->date->format('Y-m-d'); 148 | $bookings = []; 149 | foreach (self::$objects as $object) { 150 | foreach ($object->bookings as $booking) { 151 | if (!$booking) { 152 | continue; 153 | } 154 | if (($date >= $booking->datestart) && ($date <= $booking->dateend)) { 155 | $booking->is_start = $date == $booking->datestart; 156 | $booking->is_end = $date == $booking->dateend; 157 | 158 | // Label Max. Länge errechnen 159 | // Ende der Woche 160 | // verbleibende Tage der Buchung 161 | $endDate = date_create_from_format('Y-m-d', $booking->dateend); 162 | $leftDays = (array) date_diff($endDate, $buka_date->date); 163 | $booking->leftdays = $leftDays['days'] ?? 0; // Tage bis zur Abreise 164 | 165 | if (rex_config::get("buchungskalender", "calendar_view") == 'gant') { 166 | $booking->lbl_max_len = $booking->leftdays; 167 | } else { 168 | $booking->lbl_max_len = min([ 169 | $booking->leftdays, // bis zur Abreise 170 | 8 - (int) $buka_date->date->wd, // Ende der Woche 171 | (int) $buka_date->date->format('t') - (int) $buka_date->date->format('d') + 1 // Ende des Monats 172 | ]); 173 | } 174 | 175 | if (!isset($bookings[$object->id])) { 176 | $bookings[$object->id] = []; 177 | } 178 | $bookings[$object->id][] = clone $booking; 179 | } 180 | } 181 | } 182 | return $bookings; 183 | } 184 | 185 | private function init_start_end_date () { 186 | $this->start_year = date('Y',strtotime(self::$start_date)); 187 | $this->start_month = date('m',strtotime(self::$start_date)); 188 | 189 | 190 | $dt2 = new DateTime(); 191 | $dt2->setDate($this->start_year, $this->start_month, 1); 192 | $dt2->modify('+ '.($this->num_of_months - 1).' months'); 193 | 194 | self::$end_date = $dt2->format('Y-m-t'); 195 | 196 | } 197 | 198 | 199 | // kompaktiert die Ergebnisse für Kombinationsobjekte 200 | 201 | private static function combine_result ($result) { 202 | if (!isset($result[0])) { 203 | return $result; 204 | } 205 | $current = $result[0]; 206 | $current_i = 0; 207 | foreach ($result as $i=>$booking) { 208 | if ($i <= $current_i) { 209 | continue; 210 | } 211 | if ($booking->datestart < $current->dateend) { 212 | if ($booking->dateend > $result[$current_i]->dateend) { 213 | $result[$current_i]->dateend = $booking->dateend; 214 | } 215 | unset($result[$i]); 216 | } else { 217 | $current = $booking; 218 | $current_i = $i; 219 | } 220 | } 221 | return $result; 222 | } 223 | } -------------------------------------------------------------------------------- /ytemplates/uikit/value.ycom_password.tpl.php: -------------------------------------------------------------------------------- 1 | getValue(); 7 | } 8 | 9 | $notice = []; 10 | if ($this->getElement('notice') != '') { 11 | $notice[] = rex_i18n::translate($this->getElement('notice'), false); 12 | } 13 | if (isset($this->params['warning_messages'][$this->getId()]) && !$this->params['hide_field_warning_messages']) { 14 | $notice[] = '' . rex_i18n::translate($this->params['warning_messages'][$this->getId()]) . ''; // var_dump(); 15 | } 16 | if (count($notice) > 0) { 17 | $notice = '

' . implode('
', $notice) . '

'; 18 | } else { 19 | $notice = ''; 20 | } 21 | 22 | $class_group = trim('form-group yform-element ' . $this->getWarningClass()); 23 | 24 | $class_label[] = 'uk-form-label'; 25 | 26 | $attributes = [ 27 | 'class' => 'form-control uk-input', 28 | 'name' => $this->getFieldName(), 29 | 'type' => $type, 30 | 'id' => $this->getFieldId(), 31 | 'value' => $value, 32 | 'autocomplete' => 'new-password', 33 | ]; 34 | 35 | $attributes = $this->getAttributeElements($attributes, ['placeholder', 'autocomplete', 'pattern', 'required', 'disabled', 'readonly']); 36 | 37 | $span = ''; 38 | $input_group_start = ''; 39 | $input_group_end = ''; 40 | 41 | if ($script) { 42 | $funcName = uniqid('rex_ycom_password_create'.$this->getId()); 43 | $span = ' 44 | 45 | 46 | '; ?>'; 214 | $input_group_end = '
'; 215 | } 216 | 217 | echo ' 218 |
219 | 226 |
'; 227 | 228 | ?> -------------------------------------------------------------------------------- /assets/js/buchungskalender.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | let StartDate; 4 | 5 | // Im yform Buchungsformular Teilnehmer auf- und zuklappen 6 | $(document).on('click','.aufklappen',function(e) { 7 | e.preventDefault(); 8 | $(this).closest('.yform').find('.zugeklappt').toggle(); 9 | }); 10 | 11 | $(document).on("click", '.buka-cal-wrapper .bk-day.fix-booked', function(e) { 12 | var DateClicked = $(this); 13 | if (e.shiftKey) { 14 | if (DateClicked.data('bookingid')) { 15 | editBooking(DateClicked.data('bookingid')); 16 | } 17 | return; 18 | } 19 | }); 20 | 21 | // Streifenkalender 22 | $(document).on('click','.buka_bar_cal .obj_booking', function(e) { 23 | var DateClicked = $(this); 24 | if (DateClicked.data('bookingid')) { 25 | window.location.href = 'index.php?page=buchungskalender/bookings&func=edit&data_id='+DateClicked.data('bookingid'); 26 | } 27 | }); 28 | 29 | // Gantkalender 30 | $(document).on('click','.buka_gant_cal .obj_booking', function(e) { 31 | var DateClicked = $(this); 32 | if (DateClicked.data('bookingid')) { 33 | window.location.href = 'index.php?page=buchungskalender/bookings&func=edit&data_id='+DateClicked.data('bookingid'); 34 | } 35 | }); 36 | 37 | // Backend 38 | function editBooking (bookingid) { 39 | window.location.href = 'index.php?src=calendar&page=buchungskalender/bookings&func=edit&data_id='+bookingid; 40 | } 41 | 42 | $(document).on("click", ".buka-cal-wrapper .bookable", function () { 43 | if ($(".buka-cal-wrapper").hasClass("booking-complete")) { 44 | clear_booking(); 45 | } 46 | if ($(this).data("date") < $("input#datestart").val()) { 47 | clear_booking(); 48 | } 49 | 50 | if ($(".bk-day.reserve-start").length) { 51 | find_end($(this)); 52 | } else { 53 | find_start($(this)); 54 | } 55 | }); 56 | 57 | // Kalender blättern 58 | $(document).on('click','#bookingform-step1 .buka_pager_nav a',function(e) { 59 | e.preventDefault(); 60 | let href = $(this).attr('href')+"&bukacal=1"; 61 | $("#bookingform-step1").parent().load(href); 62 | return false; 63 | }); 64 | 65 | $(document).on("click", "#to-step-2", function () { 66 | $("#bookingform-step1").slideUp(); 67 | $("#bookingform-step2").slideDown(); 68 | }); 69 | $(document).on("click", "#to-step-1", function () { 70 | $("#bookingform-step2").slideUp(); 71 | $("#bookingform-step1").slideDown(); 72 | }); 73 | 74 | if ($('.uk-form-danger').length) { 75 | $("#bookingform-step1").hide(); 76 | $("#bookingform-step2").show(); 77 | } 78 | 79 | function clear_booking() { 80 | $(".buka-cal-wrapper").removeClass("booking-complete"); 81 | $(".bk-cal-day").removeClass("reserve-start"); 82 | $(".bk-cal-day").removeClass("reserve-end"); 83 | $(".bk-cal-day").removeClass("add-reserve"); 84 | $("input#date_start").val(""); 85 | $("input#date_end").val(""); 86 | $("input#datestart").val(""); 87 | $("input#dateend").val(""); 88 | $("#to-step-2").prop("disabled", true); 89 | } 90 | 91 | function mark_end($elem) { 92 | let min_booking_days = $elem.data('minbookingdays'); 93 | $(".buka-cal-wrapper").removeClass("booking-start"); 94 | $(".buka-cal-wrapper").addClass("booking-complete"); 95 | $elem.addClass("reserve-end"); 96 | $("input#date_end").val( 97 | $elem.data("date").split("-").reverse().join(".") 98 | ); 99 | $("input#dateend").val($elem.data("date")); 100 | $(".mind_booking_message").hide(); 101 | $("#to-step-2").prop("disabled", false).addClass('uk-active'); 102 | if ($(".add-reserve").length <= min_booking_days) { 103 | $(".mind_booking_message").show(); 104 | $("#to-step-2").prop("disabled", true).removeClass('uk-active'); 105 | } 106 | } 107 | 108 | function find_end ($elem) { 109 | let EndDate = new Date($elem.data("date")); 110 | if ($elem.data("fullweek") == 1 && EndDate.getDay() != 6 && !$elem.hasClass('fix-booked-start')) { 111 | while (EndDate.getDay() != 6) { 112 | EndDate.setDate(EndDate.getDate() + 1); 113 | if ($("ul").find("[data-date='"+date_to_string(EndDate)+"']").hasClass('fix-booked-start')) { 114 | break; 115 | } 116 | } 117 | let $endElem = $("ul").find("[data-date='"+date_to_string(EndDate)+"']"); 118 | mark_range($endElem); 119 | mark_end($endElem); 120 | return; 121 | } 122 | mark_range($elem); 123 | mark_end($elem); 124 | } 125 | 126 | 127 | function find_start($elem) { 128 | let StartDate = new Date($elem.data("date")); 129 | if ($elem.data("fullweek") == 1 && StartDate.getDay() != 6 && !$elem.hasClass('fix-booked-end')) { 130 | while (StartDate.getDay() != 6) { 131 | StartDate.setDate(StartDate.getDate() - 1); 132 | if ($("ul").find("[data-date='"+date_to_string(StartDate)+"']").hasClass('fix-booked-end')) { 133 | break; 134 | } 135 | } 136 | mark_start($("ul").find("[data-date='"+date_to_string(StartDate)+"']")); 137 | $elem.trigger('mouseenter'); 138 | return; 139 | } 140 | 141 | mark_start($elem); 142 | } 143 | 144 | function mark_start_old($elem) { 145 | $(".buka-cal-wrapper").addClass("booking-start"); 146 | $elem.addClass("reserve-start"); 147 | $("input#date_start").val( 148 | $elem.data("date").split("-").reverse().join(".") 149 | ); 150 | $("input#datestart").val($elem.data("date")); 151 | } 152 | 153 | 154 | function mark_start($elem) { 155 | let addthis = 0; 156 | $(".buka-cal-wrapper").addClass("booking-start"); 157 | $elem.addClass("reserve-start"); 158 | $elem.addClass("bookable"); 159 | $("input#date_start").val( 160 | $elem.data("date").split("-").reverse().join(".") 161 | ); 162 | $("input#datestart").val($elem.data("date")); 163 | $(".bk-cal-day").removeClass("booking-range"); 164 | 165 | $(".bk-cal-day").each(function () { 166 | if ($(this).hasClass("reserve-start")) { 167 | addthis = 1; 168 | } 169 | if (addthis && $(this).hasClass("bookable")) { 170 | $(this).addClass("booking-range"); 171 | } 172 | if (!$(this).hasClass("bookable")) { 173 | addthis = 0; 174 | } 175 | }); 176 | 177 | } 178 | 179 | 180 | function date_to_string(jsDate) { 181 | return ( 182 | jsDate.getFullYear() + 183 | "-" + 184 | pad(jsDate.getMonth() + 1, 2) + 185 | "-" + 186 | pad(jsDate.getDate(), 2) 187 | ); 188 | } 189 | 190 | function pad(str, max) { 191 | str = str.toString(); 192 | return str.length < max ? pad("0" + str, max) : str; 193 | } 194 | 195 | $('.minikalender-wrapper').on('click','a',function(e) { 196 | e.preventDefault(); 197 | let href = $(this).attr('href')+"&minicalendar=1"; 198 | $($(this).parents('.minikalender-wrapper')).load(href); 199 | return false; 200 | }); 201 | 202 | $(document).on( 203 | "mouseenter", 204 | ".buka-cal-wrapper.booking-start .bk-cal-day", 205 | function () { 206 | mark_range($(this)); 207 | } 208 | ); 209 | 210 | function mark_range ($elem) { 211 | var addthis = 0; 212 | var $current = $elem; 213 | $(".bk-cal-day").removeClass("add-reserve"); 214 | if ($current.data("date") >= $(".reserve-start").data("date")) { 215 | $(".bk-cal-day").each(function () { 216 | if ($(this).hasClass("reserve-start")) { 217 | addthis = 1; 218 | } 219 | if ($(this).data("date") > $current.data("date")) { 220 | addthis = 0; 221 | } 222 | if (addthis && $(this).hasClass("bookable")) { 223 | $(this).addClass("add-reserve"); 224 | } 225 | if (!$(this).hasClass("bookable")) { 226 | addthis = 0; 227 | } 228 | }); 229 | } 230 | 231 | } 232 | 233 | $('#yform-data_edit-rex_buka_bookings-datestart input').on('change',function() { 234 | let fromdatum = $(this).val(); 235 | let bisdatum = $('#yform-data_edit-rex_buka_bookings-dateend input').val(); 236 | if (bisdatum < fromdatum) { 237 | $('#yform-data_edit-rex_buka_bookings-dateend input').val(fromdatum); 238 | } 239 | }); 240 | 241 | $('#yform-data_edit-rex_buka_bookings-dateend input').on('change',function() { 242 | let bisdatum = $(this).val(); 243 | let fromdatum = $('#yform-data_edit-rex_buka_bookings-datestart input').val(); 244 | if (bisdatum < fromdatum) { 245 | $('#yform-data_edit-rex_buka_bookings-datestart input').val(bisdatum); 246 | } 247 | }); 248 | 249 | 250 | 251 | 252 | }); 253 | 254 | $(document).on('rex:ready',function() { 255 | $('.sortable_table table tbody').sortable(); 256 | }) 257 | -------------------------------------------------------------------------------- /lib/awnav.php: -------------------------------------------------------------------------------- 1 | Zurück'; 29 | var $ulWrapper = []; 30 | var $func_ul_end = ''; 31 | var $func_li_end = ''; 32 | var $hasNavPoints = false; 33 | var $withParent = false; 34 | var $MegaMenuFunc = ''; 35 | 36 | public function __construct() 37 | { 38 | $this->currentCat = rex_category::getCurrent(); 39 | if (is_object($this->currentCat)) { 40 | $this->currentCatId = $this->currentCat->getId(); 41 | $this->currentPath = explode('|', trim($this->currentCat->getPath(), '|') . '|' . $this->currentCatId); 42 | if (!is_array($this->currentPath)) 43 | $this->currentPath = []; 44 | $this->startCategory = $this->currentPath[0] ? $this->currentPath[0] : $this->currentPath[1]; 45 | } 46 | } 47 | 48 | public function getNavigation() 49 | { 50 | $out = ''; 51 | $cssclass = (isset($this->ulClasses[0])) ? ' ' . $this->ulClasses[0] : ''; 52 | $dataAttribute = (isset($this->dataAttribute[0])) ? ' ' . $this->dataAttribute[0] : ''; 53 | $categories = rex_category::getRootCategories($this->ignoreOffline); 54 | if (!empty($categories)) { 55 | if (!empty($categories)) { 56 | $out .= '
    '; 57 | foreach ($categories as $key => $category) { 58 | if ($this->metaField) { 59 | if ($this->filterNav($category)) 60 | continue; 61 | } 62 | $out .= $this->_getCategory($category); 63 | } 64 | $out .= $this->additionalLi; 65 | $out .= '
'; 66 | return $out; 67 | } 68 | } 69 | } 70 | 71 | public function getCategoryNav($category_id) 72 | { 73 | $lev = 0; 74 | $out = ''; 75 | if (!$category_id) 76 | return ''; 77 | $cssclass = (isset($this->ulClasses[0])) ? ' ' . $this->ulClasses[0] : ''; 78 | $dataAttribute = (isset($this->dataAttribute[0])) ? ' ' . $this->dataAttribute[0] : ''; 79 | if ($this->withParent) { 80 | $cat = rex_category::get($category_id); 81 | if (!$cat) { 82 | return ''; 83 | } 84 | $out .= ''; 105 | } 106 | return $out; 107 | } 108 | 109 | private function filterNav($category) 110 | { 111 | $metaval = explode('|', trim($category->getValue($this->metaField), '|')); 112 | if (array_search($this->metaValue, $metaval) === false) { 113 | return true; 114 | } 115 | return false; 116 | } 117 | 118 | private function _getCategory($cat, $lev = 0) 119 | { 120 | $lev++; 121 | 122 | $out = ''; 123 | $class = ''; 124 | $cssclass = (isset($this->ulClasses[$lev])) ? ' ' . $this->ulClasses[$lev] : ''; 125 | $dataAttribute = (isset($this->dataAttribute[$lev])) ? ' ' . $this->dataAttribute[$lev] : ''; 126 | $_categories = $cat->getChildren($this->ignoreOffline); 127 | $li_end_text = ''; 128 | if ($this->func_li_end) { 129 | $li_end_text = call_user_func($this->func_li_end, $cat); 130 | } 131 | 132 | if ($this->metaField) { 133 | if ($this->filterNav($cat)) { 134 | return ''; 135 | } 136 | } 137 | 138 | 139 | if ($cat->getId() == $this->currentCatId) { 140 | $class = $this->currentClass; 141 | } elseif (is_array($this->currentPath) && in_array($cat->getId(), $this->currentPath)) { 142 | $class = $this->activeClass; 143 | } 144 | 145 | if (isset($this->liClassMeta[$lev - 1])) { 146 | $class .= ' scheme-' . $cat->getValue($this->liClassMeta[$lev - 1]); 147 | } 148 | 149 | 150 | if (isset($this->liClasses[$lev - 1])) { 151 | $class .= ' ' . $this->liClasses[$lev - 1]; 152 | } 153 | 154 | if ((!empty($_categories) || $li_end_text) && isset($this->liHasChildsClasses[$lev - 1])) { 155 | $class .= ' ' . $this->liHasChildsClasses[$lev - 1]; 156 | } 157 | $class = trim($class); 158 | 159 | $this->hasNavPoints = true; 160 | if (empty($_categories)) { 161 | $class = str_replace('uk-parent', '', $class); 162 | } 163 | $out .= ' 164 |
  • 165 | ' . $cat->getName() . ''; 166 | 167 | // Megamenü einbauen 168 | if ($this->MegaMenuFunc) { 169 | $out .= call_user_func($this->MegaMenuFunc, $cat); 170 | } 171 | 172 | 173 | if (!empty($_categories) && ($this->fullTree || (is_array($this->currentPath) && in_array($cat->getId(), $this->currentPath)) && $lev < $this->maxLev)) { 174 | if (isset($this->ulWrapper[$lev]) && $this->ulWrapper[$lev]) { 175 | $out .= $this->ulWrapper[$lev][0]; 176 | } 177 | 178 | if ($lev < $this->maxLev) { 179 | $out .= '
      '; 180 | 181 | if ($this->showBackButton) { 182 | $out .= $this->backButtonText; 183 | } 184 | 185 | 186 | // Wiederholt den übergeordneten Menüpunkt in der Liste 187 | if ($this->showTopCategory) { 188 | $out .= ' 189 |
    • 190 | {{ Overview }}' 191 | . '
    • '; 192 | } 193 | 194 | foreach ($_categories as $_cat) { 195 | $out .= $this->_getCategory($_cat, $lev); 196 | } 197 | $out .= '
    '; 198 | } 199 | 200 | 201 | if (isset($this->ulWrapper[$lev]) && $this->ulWrapper[$lev]) { 202 | $out .= $this->ulWrapper[$lev][1]; 203 | } 204 | if ($this->func_ul_end) { 205 | $out .= call_user_func($this->func_ul_end, $cat); 206 | } 207 | } 208 | $out .= $li_end_text; 209 | $out .= '
  • '; 210 | return $out; 211 | } 212 | 213 | public function getBreadcrumb() 214 | { 215 | $out = ''; 216 | if ($this->breadcrumbWithHome) { 217 | $out .= '
  • ' . rex_article::get(rex_article::getSiteStartArticleId())->getName() . '
  • '; 218 | } 219 | if (rex_article::getCurrentId() == rex_article::getSiteStartArticleId()) { 220 | $out = ''; 221 | } 222 | 223 | foreach ($this->currentPath as $i => $p) { 224 | $cat = rex_category::get($p); 225 | if (!is_object($cat)) { 226 | continue; 227 | } 228 | if ($p == rex_article::getSiteStartArticleId() && $this->breadcrumbNameHome) { 229 | $out .= '
  • Home
  • '; 230 | continue; 231 | } 232 | if (count($this->currentPath) == ($i + 1) && !$this->breadcrumbLastLink) { //
  • Disabled Category
  • 233 | $out .= '
  • '; 234 | $out .= $cat->getName(); 235 | $out .= '
  • '; 236 | } else { 237 | $out .= '
  • '; 238 | $out .= ''; 239 | $out .= $cat->getName(); 240 | $out .= ''; 241 | $out .= '
  • '; 242 | } 243 | } 244 | return '
      ' . $out . '
    '; 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /assets/frontend/js/buchungskalender.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var StartDate; 3 | 4 | $(document).on("click", '.buka-cal-wrapper .bk-day.fix-booked', function(e) { 5 | var DateClicked = $(this); 6 | 7 | if (e.shiftKey) { 8 | if (DateClicked.data('bookingid')) { 9 | // console.log('click clicked'); 10 | editBooking(DateClicked.data('bookingid')); 11 | } 12 | return; 13 | } 14 | }); 15 | 16 | 17 | $(document).on('change','.onchangesubmit input',function() { 18 | let this_var = $(this).val(); 19 | $('input[name=reloadpage]').val(2); 20 | $(this).parents('form').trigger('submit'); 21 | }); 22 | 23 | $(document).on('click','#clearbutton',function() { 24 | clear_booking(); 25 | }) 26 | 27 | 28 | 29 | // Backend 30 | function editBooking (bookingid) { 31 | // window.location.href = 'index.php?page=yform/manager/data_edit&table_name=rex_buka_bookings&rex_yform_manager_popup=0&func=edit&data_id='+bookingid; 32 | window.location.href = 'index.php?src=calendar&page=buchungskalender/bookings&func=edit&id='+bookingid; 33 | 34 | // http://buchungskalender.localhost/redaxo/index.php?page=buchungskalender/bookings&func=edit&id=434&start=&list=89b0b572 35 | 36 | } 37 | 38 | $(document).on("click", ".buka-cal-wrapper .bookable", function () { 39 | let $clicked_elem = $(this); 40 | if ($(".buka-cal-wrapper").hasClass("booking-complete")) { 41 | clear_booking(); 42 | } 43 | if ($clicked_elem.data("date") < $("input#datestart").val()) { 44 | clear_booking(); 45 | } 46 | 47 | if ($(".bk-day.reserve-start").length) { 48 | find_end($(this)); 49 | } else { 50 | find_start($(this)); 51 | } 52 | }); 53 | 54 | // Kalender blättern 55 | $(document).on('click','#bookingform-step1 .buka_pager_nav a',function(e) { 56 | e.preventDefault(); 57 | let rooms = $('#buka_accomodation_select option:selected').val(); 58 | let href = $(this).attr('href'); 59 | $("#bookingform-step1").parent().load(href,{bukacal:1,count_accomodations:rooms}); 60 | return false; 61 | }); 62 | $(document).on('change','#bookingform-step1 #buka_daterange_select',function(e) { 63 | e.preventDefault(); 64 | // console.log($(this).val()); 65 | let param = $(this).val(); 66 | let ym = param.split('-'); 67 | let rooms = $('#buka_accomodation_select option:selected').val(); 68 | let href = location.href; 69 | $("#bookingform-step1").parent().load(href,{year:ym[0],month:ym[1],bukacal:1,ym:param,count_accomodations:rooms}); 70 | return false; 71 | }); 72 | // Select in .ajax_element (Anzahl Räume) 73 | $(document).on('change','#buka_accomodation_select select',function(e) { 74 | let href = location.href; 75 | let rooms = $(this).val(); 76 | let ym = $('#buka_daterange_select option:selected').val().split('-'); 77 | $('input[name="count_accomodations"]').val(rooms); 78 | $("#bookingform-step1").parent().load(href,{bukacal:1,count_accomodations:rooms,year:ym[0],month:ym[1]}); 79 | return false; 80 | }); 81 | 82 | 83 | 84 | 85 | $(document).on("click", "#to-step-2", function () { 86 | $("#bookingform-step1").slideUp(); 87 | $("#bookingform-step2").slideDown(); 88 | }); 89 | $(document).on("click", "#to-step-1", function () { 90 | $("#bookingform-step2").slideUp(); 91 | $("#bookingform-step1").slideDown(); 92 | }); 93 | 94 | if ($('.uk-form-danger').length) { 95 | $("#bookingform-step1").hide(); 96 | $("#bookingform-step2").show(); 97 | } 98 | 99 | function clear_booking() { 100 | $(".buka-cal-wrapper").removeClass("booking-complete"); 101 | $(".buka-cal-wrapper").removeClass("booking-start"); 102 | $(".bk-cal-day").removeClass("reserve-start"); 103 | $(".bk-cal-day").removeClass("reserve-end"); 104 | $(".bk-cal-day").removeClass("add-reserve"); 105 | $(".bk-cal-day").removeClass("booking-range"); 106 | $("input#date_start").val(""); 107 | $("input#date_end").val(""); 108 | $("input#datestart").val(""); 109 | $("input#dateend").val(""); 110 | $("#to-step-2").prop("disabled", true); 111 | } 112 | 113 | function mark_end($elem) { 114 | let min_booking_days = $elem.data('minbookingdays'); 115 | $(".bk-cal-day").removeClass("booking-range"); 116 | $(".buka-cal-wrapper").removeClass("booking-start"); 117 | $(".buka-cal-wrapper").addClass("booking-complete"); 118 | $elem.addClass("reserve-end"); 119 | $("input#date_end").val( 120 | $elem.data("date").split("-").reverse().join(".") 121 | ); 122 | $("input#dateend").val($elem.data("date")); 123 | $(".mind_booking_message").hide(); 124 | $("#to-step-2").prop("disabled", false).addClass('uk-active'); 125 | $("#to-step-3").prop("disabled", false).addClass('bluered'); 126 | if ($(".add-reserve").length <= min_booking_days) { 127 | $(".mind_booking_message").show(); 128 | $("#to-step-2").prop("disabled", true).removeClass('uk-active'); 129 | $("#to-step-3").prop("disabled", true).removeClass('bluered'); 130 | } 131 | } 132 | 133 | function find_end ($elem) { 134 | let EndDate = new Date($elem.data("date")); 135 | if ($elem.data("fullweek") == 1 && EndDate.getDay() != 6 && !$elem.hasClass('fix-booked-start')) { 136 | while (EndDate.getDay() != 6) { 137 | EndDate.setDate(EndDate.getDate() + 1); 138 | if ($("ul").find("[data-date='"+date_to_string(EndDate)+"']").hasClass('fix-booked-start')) { 139 | break; 140 | } 141 | } 142 | let $endElem = $("ul").find("[data-date='"+date_to_string(EndDate)+"']"); 143 | mark_range($endElem); 144 | mark_end($endElem); 145 | return; 146 | } 147 | mark_range($elem); 148 | mark_end($elem); 149 | } 150 | 151 | 152 | function find_start($elem) { 153 | StartDate = new Date($elem.data("date")); 154 | if ($elem.data("fullweek") == 1 && StartDate.getDay() != 6 && !$elem.hasClass('fix-booked-end')) { 155 | while (StartDate.getDay() != 6) { 156 | StartDate.setDate(StartDate.getDate() - 1); 157 | if ($("ul").find("[data-date='"+date_to_string(StartDate)+"']").hasClass('fix-booked-end')) { 158 | break; 159 | } 160 | } 161 | mark_start($("ul").find("[data-date='"+date_to_string(StartDate)+"']")); 162 | $elem.trigger('mouseenter'); 163 | return; 164 | } 165 | 166 | mark_start($elem); 167 | } 168 | 169 | function mark_start($elem) { 170 | let addthis = 0; 171 | $(".buka-cal-wrapper").addClass("booking-start"); 172 | $elem.addClass("reserve-start"); 173 | $elem.addClass("bookable"); 174 | $("input#date_start").val( 175 | $elem.data("date").split("-").reverse().join(".") 176 | ); 177 | $("input#datestart").val($elem.data("date")); 178 | $(".bk-cal-day").removeClass("booking-range"); 179 | 180 | $(".bk-cal-day").each(function () { 181 | if ($(this).hasClass("reserve-start")) { 182 | addthis = 1; 183 | } 184 | if (addthis && $(this).hasClass("bookable")) { 185 | $(this).addClass("booking-range"); 186 | } 187 | if (!$(this).hasClass("bookable")) { 188 | addthis = 0; 189 | } 190 | if (addthis && $(this).hasClass("fix-booked-start")) { 191 | $(this).addClass("booking-range"); 192 | addthis = 0; 193 | } 194 | }); 195 | 196 | 197 | 198 | } 199 | 200 | function date_to_string(jsDate) { 201 | return ( 202 | jsDate.getFullYear() + 203 | "-" + 204 | pad(jsDate.getMonth() + 1, 2) + 205 | "-" + 206 | pad(jsDate.getDate(), 2) 207 | ); 208 | } 209 | 210 | function pad(str, max) { 211 | str = str.toString(); 212 | return str.length < max ? pad("0" + str, max) : str; 213 | } 214 | 215 | $('.minikalender-wrapper').on('click','a',function(e) { 216 | e.preventDefault(); 217 | let href = $(this).attr('href')+"&minicalendar=1"; 218 | $($(this).parents('.minikalender-wrapper')).load(href); 219 | return false; 220 | }); 221 | 222 | $(document).on( 223 | "mouseenter", 224 | ".buka-cal-wrapper.booking-start .bk-cal-day", 225 | function () { 226 | mark_range($(this)); 227 | } 228 | ); 229 | 230 | function mark_range ($elem) { 231 | var addthis = 0; 232 | var $current = $elem; 233 | $(".bk-cal-day").removeClass("add-reserve"); 234 | if ($current.data("date") >= $(".reserve-start").data("date")) { 235 | $(".bk-cal-day").each(function () { 236 | if ($(this).hasClass("reserve-start")) { 237 | addthis = 1; 238 | } 239 | if ($(this).data("date") > $current.data("date")) { 240 | addthis = 0; 241 | } 242 | if (addthis && $(this).hasClass("bookable")) { 243 | $(this).addClass("add-reserve"); 244 | } 245 | if (!$(this).hasClass("bookable")) { 246 | addthis = 0; 247 | } 248 | }); 249 | } 250 | 251 | } 252 | 253 | }); 254 | 255 | $(document).on('rex:ready',function() { 256 | $('.sortable_table table tbody').sortable(); 257 | }) 258 | -------------------------------------------------------------------------------- /boot.php: -------------------------------------------------------------------------------- 1 | getPath('ytemplates')); 11 | 12 | if (rex::isBackend() && isset($_REQUEST['page'])) { 13 | rex_view::addCssFile(rex_addon::get('buchungskalender')->getAssetsUrl('css/buchungskalender.css')); 14 | rex_view::addJsFile(rex_addon::get('buchungskalender')->getAssetsUrl('js/buchungskalender.js')); 15 | } 16 | 17 | if (rex::isBackend() && rex_request('table_name') == 'rex_buka_objects') { 18 | rex_extension::register('YFORM_DATA_LIST', function( $ep ) { 19 | $list = $ep->getSubject(); 20 | $list->setColumnFormat('colorcode', 'custom', function ($params ) { 21 | return '
    '; 22 | }); 23 | }); 24 | } 25 | 26 | if (rex::isBackend() && rex::getUser()) { 27 | if (rex::isDebugMode() && rex_request_method() == 'get') { 28 | $run_compiler = false; 29 | if (!file_exists($this->getPath('assets/css/buchungskalender.css'))) { 30 | $run_compiler = true; 31 | } elseif (!file_exists($this->getAssetsPath('css/buchungskalender.css'))) { 32 | $run_compiler = true; 33 | } elseif (filemtime($this->getPath('scss/buchungskalender.scss')) > filemtime($this->getAssetsPath('css/buchungskalender.css'))) { 34 | $run_compiler = true; 35 | } 36 | if ($run_compiler) { 37 | $compiler = new rex_scss_compiler(); 38 | $compiler->setRootDir($this->getPath()); 39 | $compiler->setScssFile($this->getPath('scss/buchungskalender.scss')); 40 | $compiler->setCssFile($this->getPath('assets/css/buchungskalender.css')); 41 | $compiler->compile(); 42 | rex_file::copy($this->getPath('assets/css/buchungskalender.css'), $this->getAssetsPath('css/buchungskalender.css')); 43 | } 44 | 45 | // Backend JS 46 | $copy_js = false; 47 | if (!file_exists($this->getAssetsPath('js/buchungskalender.js'))) { 48 | $copy_js = true; 49 | } elseif (filemtime($this->getPath('assets/js/buchungskalender.js')) > filemtime($this->getAssetsPath('js/buchungskalender.js'))) { 50 | $copy_js = true; 51 | } 52 | if ($copy_js) { 53 | rex_file::copy($this->getPath('assets/js/buchungskalender.js'), $this->getAssetsPath('js/buchungskalender.js')); 54 | } 55 | 56 | // Frontend JS 57 | $copy_js = false; 58 | if (!file_exists($this->getAssetsPath('frontend/js/buchungskalender.js'))) { 59 | $copy_js = true; 60 | } elseif (filemtime($this->getPath('assets/frontend/js/buchungskalender.js')) > filemtime($this->getAssetsPath('frontend/js/buchungskalender.js'))) { 61 | $copy_js = true; 62 | } 63 | if ($copy_js) { 64 | rex_file::copy($this->getPath('assets/frontend/js/buchungskalender.js'), $this->getAssetsPath('frontend/js/buchungskalender.js')); 65 | } 66 | } 67 | 68 | 69 | 70 | rex_extension::register('PACKAGES_INCLUDED', function() { 71 | if (rex_request('addon','string') == 'buka' && rex_request('action','string') == 'editrecord') { 72 | $data_id = rex_get('data_id','int'); 73 | $_csrf_key = rex_yform_manager_table::get('rex_buka_bookings')->getCSRFKey(); 74 | $token = rex_csrf_token::factory($_csrf_key)->getUrlParams(); 75 | $params = [ 76 | 'page'=>'yform/manager/data_edit', 77 | 'table_name'=>'rex_buka_bookings', 78 | 'data_id'=>$data_id, 79 | 'func'=>'edit', 80 | '_csrf_token' => $token['_csrf_token'] 81 | ]; 82 | rex_response::sendRedirect(rex_url::backendPage('yform/manager/data_edit', $params,false)); 83 | } 84 | }); 85 | } 86 | 87 | if (rex::isFrontend()) { 88 | rex_extension::register('PACKAGES_INCLUDED', function() { 89 | 90 | // rex_file::copy($this->getPath('assets/frontend/js/buchungskalender.js'), $this->getAssetsPath('frontend/js/buchungskalender.js')); 91 | 92 | rex_login::startSession(); 93 | if (rex_config::get('buchungskalender','ical_interval') && !rex_request::isXmlHttpRequest()) { 94 | buka_ical::check_ical_data(); 95 | } 96 | 97 | if (rex_request('action','string') == 'get_ical_data' && rex_request('object_id','int')) { 98 | rex_logger::factory()->log('info',(string) $_SERVER['HTTP_REFERER'],[],__FILE__,__LINE__); 99 | echo buka_ical::send_ical_data_for_obj(rex_request('object_id','int')); 100 | exit; 101 | } 102 | if (rex_request::isXmlHttpRequest() && rex_request('minicalendar','int') == 1) { 103 | echo buka_cal::get_mini_calendar(rex_request('object_id','int')); 104 | exit; 105 | } 106 | 107 | // Buchungskalender 108 | 109 | if (rex_request::isXmlHttpRequest() && rex_request('bukacal','int') == 1) { 110 | $art = new rex_article_content(); 111 | if (rex_config::get('buchungskalender','booking_page')) { 112 | $art->setArticleId(rex_config::get('buchungskalender','booking_page')); 113 | } else { 114 | $art->setArticleId(rex_article::getCurrentId()); 115 | } 116 | $content = $art->getArticle(); 117 | if (rex_addon::get('sprog')->isAvailable()) { 118 | $content = sprogdown($content); 119 | } 120 | $dom = new DOMDocument('1.0', 'UTF-8'); 121 | libxml_use_internal_errors(true); 122 | $dom->preserveWhiteSpace = false; 123 | $dom->formatOutput = true; 124 | $dom->loadHTML(''.$content.''); 125 | libxml_clear_errors(); 126 | $node = $dom->getElementById('bookingform-step1'); 127 | echo $dom->saveHTML($node); 128 | exit; 129 | } 130 | 131 | // Termine Kalender 132 | 133 | // if (rex_request::isXmlHttpRequest() && rex_request('bukadate','int') == 1) { 134 | if (rex_request('bukadate','int') == 1) { 135 | $art = new rex_article_content(); 136 | $art->setArticleId(rex_article::getCurrentId()); 137 | $dom = new DOMDocument('1.0', 'UTF-8'); 138 | libxml_use_internal_errors(true); 139 | $dom->preserveWhiteSpace = false; 140 | $dom->formatOutput = true; 141 | $dom->loadHTML(''.$art->getArticle().''); 142 | libxml_clear_errors(); 143 | $node = $dom->getElementById('datebookingform-step1'); 144 | echo $dom->saveHTML($node); 145 | exit; 146 | } 147 | 148 | 149 | // Buchungsbestätigungslink aktiviert 150 | if (rex_request('action') == 'booking_confirm' && rex_request('email') && rex_request('hash')) { 151 | if (buka_booking::confirm_booking()) { 152 | rex_redirect(rex_config::get('buchungskalender','confirmation_page'),'',['success'=>1]); 153 | } else { 154 | rex_redirect(rex_config::get('buchungskalender','confirmation_page'),'',['success'=>0]); 155 | } 156 | } 157 | // Terminbestätigungslink aktiviert 158 | if (rex_request('action') == 'date_booking_confirm' && rex_request('email') && rex_request('hash')) { 159 | if (buka_booking::confirm_date_booking()) { 160 | rex_redirect(rex_config::get('buchungskalender','confirmation_page'),'',['success'=>1]); 161 | } else { 162 | rex_redirect(rex_config::get('buchungskalender','confirmation_page'),'',['success'=>0]); 163 | } 164 | } 165 | 166 | 167 | 168 | }); 169 | } 170 | 171 | 172 | 173 | 174 | 175 | // register a custom yrewrite scheme 176 | // rex_yrewrite::setScheme(new rex_project_rewrite_scheme()); 177 | 178 | // register yform template path 179 | // rex_yform::addTemplatePath($addon->getPath('yform-templates')); 180 | 181 | // register yorm class 182 | // rex_yform_manager_dataset::setModelClass('rex_my_table', my_classname::class); 183 | 184 | // Example of mediapool Whitelist 185 | /* 186 | rex_addon::get('mediapool')->setProperty('allowed_mime_types', [ 187 | 'gif' => ['image/gif'], 188 | 'jpg' => ['image/jpeg', 'image/pjpeg'], 189 | 'jpeg' => ['image/jpeg', 'image/pjpeg'], 190 | 'png' => ['image/png'], 191 | 'eps' => ['application/postscript'], 192 | 'tif' => ['image/tiff'], 193 | 'tiff' => ['image/tiff'], 194 | 'svg' => ['image/svg+xml'], 195 | 'pdf' => ['application/pdf'], 196 | 'xls' => ['application/vnd.ms-excel'], 197 | 'xlsx' => ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], 198 | 'xlsm' => ['application/vnd.ms-excel.sheet.macroEnabled.12'], 199 | 'doc' => ['application/msword'], 200 | 'docx' => ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'], 201 | 'docm' => ['application/vnd.ms-word.document.macroEnabled.12'], 202 | 'dot' => ['application/msword'], 203 | 'dotx' => ['application/vnd.openxmlformats-officedocument.wordprocessingml.template'], 204 | 'dotm' => ['application/vnd.ms-word.template.macroEnabled.12'], 205 | 'ppt' => ['application/vnd.ms-powerpoint'], 206 | 'pptx' => ['application/vnd.openxmlformats-officedocument.presentationml.presentation'], 207 | 'pptm' => ['application/vnd.ms-powerpoint.presentation.macroEnabled.12'], 208 | 'pot' => ['application/vnd.ms-powerpoint'], 209 | 'potx' => ['application/vnd.openxmlformats-officedocument.presentationml.template'], 210 | 'potm' => ['application/vnd.ms-powerpoint.template.macroEnabled.12'], 211 | 'pps' => ['application/vnd.ms-powerpoint'], 212 | 'ppsx' => ['application/vnd.openxmlformats-officedocument.presentationml.slideshow'], 213 | 'ppsm' => ['application/vnd.ms-powerpoint.slideshow.macroEnabled.12'], 214 | 'rtf' => ['application/rtf'], 215 | 'txt' => ['text/plain', 'application/octet-stream'], 216 | 'csv' => ['text/plain', 'application/octet-stream'], 217 | 'zip' => ['application/x-zip-compressed','application/zip'], 218 | 'gz' => ['application/x-gzip'], 219 | 'tar' => ['application/x-tar'], 220 | 'mov' => ['video/quicktime'], 221 | 'movie' => ['video/quicktime'], 222 | 'mp3' => ['audio/mpeg'], 223 | 'mpe' => ['video/mpeg'], 224 | 'mpeg' => ['video/mpeg'], 225 | 'mpg' => ['video/mpeg'], 226 | ]); 227 | */ 228 | --------------------------------------------------------------------------------