| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU General Public License |
| 6 |
as published by the Free Software Foundation; either version 2 |
| 7 |
of the License, or (at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License |
| 15 |
along with this program; if not, write to the Free Software |
| 16 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 |
|
| 18 |
Copyright 2017 Buttonizer |
| 19 |
*/ |
| 20 |
namespace Buttonizer\Admin; |
| 21 |
|
| 22 |
# No script kiddies |
| 23 |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
| 24 |
class CompanyOpened |
| 25 |
{ |
| 26 |
private $aSavedData = array() ; |
| 27 |
public function __construct() |
| 28 |
{ |
| 29 |
$this->loadData(); |
| 30 |
$this->createTable(); |
| 31 |
} |
| 32 |
|
| 33 |
private function loadData() |
| 34 |
{ |
| 35 |
$this->aSavedData = (array) get_option( 'buttonizer_opening_settings' ); |
| 36 |
} |
| 37 |
|
| 38 |
public function createTable() |
| 39 |
{ |
| 40 |
echo '<div class="time-table">' ; |
| 41 |
echo '<h4>' . $this->fieldOpenedToday( 'monday' ) . '</h4>' ; |
| 42 |
echo $this->fieldOpeningTimeSelector( 'monday', false ) ; |
| 43 |
echo '<h4>' . $this->fieldOpenedToday( 'tuesday' ) . '</h4>' ; |
| 44 |
echo $this->fieldOpeningTimeSelector( 'tuesday', false ) ; |
| 45 |
echo '<h4>' . $this->fieldOpenedToday( 'wednesday' ) . '</h4>' ; |
| 46 |
echo $this->fieldOpeningTimeSelector( 'wednesday', false ) ; |
| 47 |
echo '<h4>' . $this->fieldOpenedToday( 'thursday' ) . '</h4>' ; |
| 48 |
echo $this->fieldOpeningTimeSelector( 'thursday', false ) ; |
| 49 |
echo '<h4>' . $this->fieldOpenedToday( 'friday' ) . '</h4>' ; |
| 50 |
echo $this->fieldOpeningTimeSelector( 'friday', false ) ; |
| 51 |
echo '<h4>' . $this->fieldOpenedToday( 'saturday' ) . '</h4>' ; |
| 52 |
echo $this->fieldOpeningTimeSelector( 'saturday', false ) ; |
| 53 |
echo '<h4>' . $this->fieldOpenedToday( 'sunday' ) . '</h4>' ; |
| 54 |
echo $this->fieldOpeningTimeSelector( 'sunday', false ) ; |
| 55 |
echo '</div>' ; |
| 56 |
echo '<script>initOpeningTimes()</script>' ; |
| 57 |
echo '<div class="buttonizer-pro-text"><i class="fa fa-lock"></i> You are missing the fun! When upgrading to <a href="admin.php?page=Buttonizer-pricing">Buttonizer Pro</a> you will unlock opening hours.</div>' ; |
| 58 |
} |
| 59 |
|
| 60 |
public function fieldOpeningTimeSelector( $sDay ) |
| 61 |
{ |
| 62 |
return '<div class="buttonizer-slider buttonizer-click-to-pro" data-day="' . $sDay . '"></div>'; |
| 63 |
} |
| 64 |
|
| 65 |
public function fieldOpenedToday( $sDay = 'monday' ) |
| 66 |
{ |
| 67 |
return '<input type="checkbox" class="buttonizer-click-to-pro" readonly /> <span class="buttonizer-click-to-pro">Opened on ' . $sDay . ' (<span class="opening-' . $sDay . '"></span>)</span>'; |
| 68 |
} |
| 69 |
|
| 70 |
} |