Add a new setting that toggles the login link of the booking page (#1148).

This commit is contained in:
Alex Tselegidis 2022-01-24 20:02:17 +01:00
parent e9a9314909
commit 2bf9a6193e
32 changed files with 131 additions and 6 deletions

View file

@ -128,6 +128,7 @@ class Booking extends EA_Controller {
$display_privacy_policy = setting('display_privacy_policy');
$privacy_policy_content = setting('privacy_policy_content');
$display_any_provider = setting('display_any_provider');
$display_login_button = setting('display_login_button');
$display_delete_personal_information = setting('display_delete_personal_information');
$book_advance_timeout = setting('book_advance_timeout');
@ -250,6 +251,7 @@ class Booking extends EA_Controller {
'display_privacy_policy' => $display_privacy_policy,
'privacy_policy_content' => $privacy_policy_content,
'display_any_provider' => $display_any_provider,
'display_login_button' => $display_login_button,
'display_delete_personal_information' => $display_delete_personal_information,
'google_analytics_code' => $google_analytics_code,
'matomo_analytics_url' => $matomo_analytics_url,

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -354,4 +354,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -355,4 +355,6 @@ $lang['localization'] = 'Localization';
$lang['integrations'] = 'Integrations';
$lang['company'] = 'Company';
$lang['remove'] = 'Remove';
$lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
// End

View file

@ -0,0 +1,41 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Online Appointment Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) Alex Tselegidis
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
* @link https://easyappointments.org
* @since v1.4.0
* ---------------------------------------------------------------------------- */
class Migration_Add_display_login_button_setting extends EA_Migration {
/**
* Upgrade method.
*/
public function up()
{
if ( ! $this->db->get_where('settings', ['name' => 'display_login_button'])->num_rows())
{
$this->db->insert('settings', [
'name' => 'display_login_button',
'value' => '1'
]);
}
}
/**
* Downgrade method.
*/
public function down()
{
if ( ! $this->db->get_where('settings', ['name' => 'display_login_button'])->num_rows())
{
$this->db->delete('settings', [
'name' => 'display_login_button',
]);
}
}
}

View file

@ -1,3 +1,11 @@
<?php
/**
* Local variables.
*
* @var bool $display_login_button
*/
?>
<div id="frame-footer">
<small>
<span class="footer-powered-by">
@ -11,10 +19,13 @@
<?= ucfirst(config('language')) ?>
</span>
<a class="backend-link badge bg-primary text-decoration-none px-2" href="<?= session('user_id') ? site_url('calendar') : site_url('login'); ?>">
<i class="fas fa-sign-in-alt me-2"></i>
<?= session('user_id') ? lang('backend_section') : lang('login') ?>
</a>
<?php if ($display_login_button): ?>
<a class="backend-link badge bg-primary text-decoration-none px-2"
href="<?= session('user_id') ? site_url('calendar') : site_url('login'); ?>">
<i class="fas fa-sign-in-alt me-2"></i>
<?= session('user_id') ? lang('backend_section') : lang('login') ?>
</a>
<?php endif ?>
</span>
</small>
</div>

View file

@ -25,13 +25,13 @@
<body>
<div id="main" class="container">
<div class="row wrapper">
<div id="book-appointment-wizard" class="col-12 col-lg-10 col-xl-8">
<div id="book-appointment-wizard" class="col-12 col-lg-10 col-xl-8 col-xxl-7">
<?php component('booking_header', ['company_name' => vars('company_name'), 'company_logo' => vars('company_logo')]) ?>
<?php slot('content') ?>
<?php component('booking_footer') ?>
<?php component('booking_footer', ['display_login_button' => vars('display_login_button')]) ?>
</div>
</div>

View file

@ -271,6 +271,22 @@
</div>
</div>
<div class="mb-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="display-login-button"
data-field="display_login_button">
<label class="form-check-label" for="display-login-button">
<?= lang('login_button') ?>
</label>
</div>
<div class="form-text text-muted">
<small>
<?= lang('display_login_button_hint') ?>
</small>
</div>
</div>
<div class="mb-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="display-delete-personal-information"
@ -286,6 +302,7 @@
</small>
</div>
</div>
<div class="mb-3">
<div class="form-check form-switch">