mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
Created new render helper for the timezone dropdown.
This commit is contained in:
parent
26efa3c410
commit
c0cd2346fd
3 changed files with 44 additions and 1 deletions
|
@ -65,7 +65,7 @@ $autoload['libraries'] = ['database'];
|
|||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
|
||||
$autoload['helper'] = ['custom_exceptions', 'url', 'file', 'language', 'asset', 'config'];
|
||||
$autoload['helper'] = ['custom_exceptions', 'url', 'file', 'language', 'asset', 'config', 'render'];
|
||||
|
||||
|
||||
/*
|
||||
|
|
33
application/helpers/render_helper.php
Normal file
33
application/helpers/render_helper.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.4.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Render the HTML output of a timezone dropdown element.
|
||||
*
|
||||
* @param string $attributes HTML element attributes of the dropdown.
|
||||
* @return false|string
|
||||
*/
|
||||
function render_timezone_dropdown($attributes = '')
|
||||
{
|
||||
$framework = get_instance();
|
||||
|
||||
$framework->load->model('timezones_model');
|
||||
|
||||
$timezones = $framework->timezones_model->to_grouped_array();
|
||||
|
||||
ob_start();
|
||||
|
||||
require __DIR__ . '/../views/partial/timezone_dropdown.php';
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
10
application/views/partial/timezone_dropdown.php
Normal file
10
application/views/partial/timezone_dropdown.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<select <?= $attributes ?>>
|
||||
<option value="UTC">UTC</option>
|
||||
<?php foreach ($timezones as $continent => $entries): ?>
|
||||
<optgroup label="<?= $continent ?>">
|
||||
<?php foreach ($entries as $value => $name): ?>
|
||||
<option value="<?= $value ?>"><?= $name ?></option>
|
||||
<?php endforeach ?>
|
||||
</optgroup>
|
||||
<?php endforeach ?>
|
||||
</select>
|
Loading…
Reference in a new issue