mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-21 23:42:21 +03:00
Added translation change button in frontend.
This commit is contained in:
parent
6b03dcff90
commit
05416823f6
12 changed files with 95 additions and 17 deletions
Binary file not shown.
|
@ -1072,6 +1072,30 @@ class Backend_api extends CI_Controller {
|
|||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will return a list of the available google calendars.
|
||||
*
|
||||
* The user will need to select a specific calendar from this list to sync his
|
||||
* appointments with. Google access must be already granted for the specific
|
||||
* provider.
|
||||
*
|
||||
* @param string $_POST['provider_id'] Provider record id.
|
||||
*/
|
||||
public function ajax_get_google_calendars() {
|
||||
try {
|
||||
$this->load->library('google_sync');
|
||||
$this->load->model('providers_model');
|
||||
|
||||
$calendars = $this->google_sync->get_google_calendars($_POST['provider_id']);
|
||||
echo json_encode($calendars);
|
||||
|
||||
} catch(Exception $exc) {
|
||||
echo json_encode(array(
|
||||
'exceptions' => array(exceptionToJavaScript($exc))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file backend_api.php */
|
||||
|
|
|
@ -58,6 +58,8 @@ class Google extends CI_Controller {
|
|||
$_SESSION['oauth_provider_id']);
|
||||
$this->providers_model->set_setting('google_token', $token,
|
||||
$_SESSION['oauth_provider_id']);
|
||||
$this->providers_model->set_setting('google_calendar', 'primary',
|
||||
$_SESSION['oath_provider_id']);
|
||||
|
||||
} else {
|
||||
echo '<h1>Sync provider id not specified!</h1>';
|
||||
|
|
|
@ -262,3 +262,5 @@ $lang['select_time'] = 'Select Time';
|
|||
$lang['time'] = 'Time';
|
||||
$lang['hour'] = 'Hour';
|
||||
$lang['minute'] = 'Minute';
|
||||
$lang['google_sync_completed'] = 'Google synchronization completed successfully!';
|
||||
$lang['google_sync_failed'] = 'Google synchronization failed: Could not establish server connection.';
|
||||
|
|
|
@ -261,4 +261,6 @@ $lang['now'] = 'Jetzt';
|
|||
$lang['select_time'] = 'Zeit Wählen';
|
||||
$lang['time'] = 'Zeit';
|
||||
$lang['hour'] = 'Uhr';
|
||||
$lang['minute'] = 'Minute';
|
||||
$lang['minute'] = 'Minute';
|
||||
$lang['google_sync_completed'] = 'Google Synchronisation erfolgreich beendet!';
|
||||
$lang['google_sync_failed'] = 'Google Synchronisation fehlgeschlagen: Serververbindung konnte nicht hergestellt werden.';
|
|
@ -261,4 +261,6 @@ $lang['now'] = 'Τώρα';
|
|||
$lang['select_time'] = 'Επιλέξτε Ώρα';
|
||||
$lang['time'] = 'Χρόνος';
|
||||
$lang['hour'] = 'Ώρα';
|
||||
$lang['minute'] = 'Λεπτά';
|
||||
$lang['minute'] = 'Λεπτά';
|
||||
$lang['google_sync_completed'] = 'Ο συγχρονισμός με την Google ολοκληρώθηκε επιτυχώς!';
|
||||
$lang['google_sync_failed'] = 'Ο συγχρονισμός με την Google απέτυχε: Δεν μπόρεσε να πραγματοποιηθεί σύνδεση με τον server.';
|
|
@ -9,7 +9,8 @@ require_once dirname(dirname(dirname(__FILE__))) . '/configuration.php';
|
|||
* Google Synchronization Class
|
||||
*
|
||||
* This class implements all the core synchronization between the Google Calendar
|
||||
* and the Easy!Appointments system.
|
||||
* and the Easy!Appointments system. Do not place any model handling inside this
|
||||
* library.
|
||||
*/
|
||||
class Google_Sync {
|
||||
private $CI;
|
||||
|
@ -293,6 +294,19 @@ class Google_Sync {
|
|||
|
||||
return $this->service->events->listEvents('primary', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return available google calendars for specific user.
|
||||
*
|
||||
* The given user's token must already exist in db in order to get access to his
|
||||
* Google Calendar account.
|
||||
*
|
||||
* @param numeric $provider_id The provider's record id.
|
||||
* @return array Returns an array with the available calendars.
|
||||
*/
|
||||
public function get_google_calendars($provider_id) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file google_sync.php */
|
||||
|
|
|
@ -81,10 +81,12 @@
|
|||
};
|
||||
|
||||
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
||||
var availableLanguages = <?php echo json_encode($this->config->item('available_languages')); ?>;
|
||||
|
||||
$(document).ready(function() {
|
||||
FrontendBook.initialize(true, GlobalVariables.manageMode);
|
||||
GeneralFunctions.centerElementOnPage($('#book-appointment-wizard'));
|
||||
GeneralFunctions.enableLanguageSelection($('#select-language'));
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
@ -368,6 +370,10 @@
|
|||
<a href="http://easyappointments.org" target="_blank">
|
||||
Easy!Appointments
|
||||
</a>
|
||||
|
|
||||
<span id="select-language" class="badge badge-inverse">
|
||||
<?php echo ucfirst($this->config->item('language')); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="<?php echo $this->config->base_url(); ?>assets/css/libs/bootstrap/bootstrap-responsive.css">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="<?php echo $this->config->base_url(); ?>assets/css/general.css">
|
||||
|
||||
<?php // SET FAVICON FOR PAGE ?>
|
||||
<link
|
||||
|
@ -54,7 +58,7 @@
|
|||
}
|
||||
|
||||
.forgot-password {
|
||||
margin-left: 20px;
|
||||
/* margin-left: 20px; */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -67,8 +71,11 @@
|
|||
};
|
||||
|
||||
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
||||
var availableLanguages = <?php echo json_encode($this->config->item('available_languages')); ?>;
|
||||
|
||||
$(document).ready(function() {
|
||||
GeneralFunctions.enableLanguageSelection($('#select-language'));
|
||||
|
||||
/**
|
||||
* Event: Login Button "Click"
|
||||
*
|
||||
|
@ -112,16 +119,30 @@
|
|||
<div class="alert hidden"></div>
|
||||
<form id="login-form">
|
||||
<label for="username"><?php echo $this->lang->line('username'); ?></label>
|
||||
<input type="text" id="username" placeholder="<?php echo $this->lang->line('enter_username_here'); ?>" class="span3" />
|
||||
<input type="text" id="username"
|
||||
placeholder="<?php echo $this->lang->line('enter_username_here'); ?>"
|
||||
class="span3" />
|
||||
|
||||
<label for="password"><?php echo $this->lang->line('password'); ?></label>
|
||||
<input type="password" id="password" placeholder="<?php echo $this->lang->line('enter_password_here'); ?>" class="span3" />
|
||||
<input type="password" id="password"
|
||||
placeholder="<?php echo $this->lang->line('enter_password_here'); ?>"
|
||||
class="span3" />
|
||||
|
||||
<br>
|
||||
|
||||
<button type="submit" id="login" class="btn btn-primary">
|
||||
<?php echo $this->lang->line('login'); ?>
|
||||
</button>
|
||||
|
||||
<br><br>
|
||||
|
||||
<button type="submit" id="login" class="btn btn-primary btn-large"><?php echo $this->lang->line('login'); ?></button>
|
||||
|
||||
<a href="<?php echo $base_url; ?>user/forgot_password" class="forgot-password"><?php echo $this->lang->line('forgot_your_password'); ?></a>
|
||||
<a href="<?php echo $base_url; ?>user/forgot_password" class="forgot-password">
|
||||
<?php echo $this->lang->line('forgot_your_password'); ?>
|
||||
</a>
|
||||
|
|
||||
<span id="select-language" class="badge badge-inverse">
|
||||
<?php echo ucfirst($this->config->item('language')); ?>
|
||||
</span>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -287,23 +287,24 @@ var BackendCalendar = {
|
|||
|
||||
if (response.exceptions) {
|
||||
response.exceptions = GeneralFunctions.parseExceptions(response.exceptions);
|
||||
GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE, GeneralFunctions.EXCEPTIONS_MESSAGE);
|
||||
GeneralFunctions.displayMessageBox(GeneralFunctions.EXCEPTIONS_TITLE,
|
||||
GeneralFunctions.EXCEPTIONS_MESSAGE);
|
||||
$('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions));
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.warnings) {
|
||||
response.warnings = GeneralFunctions.parseExceptions(response.warnings);
|
||||
GeneralFunctions.displayMessageBox(GeneralFunctions.WARNINGS_TITLE, GeneralFunctions.WARNINGS_MESSAGE);
|
||||
GeneralFunctions.displayMessageBox(GeneralFunctions.WARNINGS_TITLE,
|
||||
GeneralFunctions.WARNINGS_MESSAGE);
|
||||
$('#message_box').append(GeneralFunctions.exceptionsToHtml(response.warnings));
|
||||
}
|
||||
|
||||
Backend.displayNotification('Google synchronization completed successfully!');
|
||||
Backend.displayNotification(EALang['google_sync_completed']);
|
||||
$('#reload-appointments').trigger('click');
|
||||
},
|
||||
'error': function(jqXHR, textStatus, errorThrown) {
|
||||
Backend.displayNotification('Google synchronization failed: Could not establish '
|
||||
+ 'server connection.');
|
||||
Backend.displayNotification(EALang['google_sync_failed']);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -706,6 +707,9 @@ var BackendCalendar = {
|
|||
$('#enable-sync span').text(EALang['disable_sync']);
|
||||
$('#google-sync').prop('disabled', false);
|
||||
$('#select-filter-item option:selected').attr('google-sync', 'true');
|
||||
|
||||
// Display the calendar selection dialog.
|
||||
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
|
|
|
@ -324,9 +324,9 @@ var FrontendBook = {
|
|||
var ajaxurl = GlobalVariables.baseUrl + 'appointments/ajax_get_available_hours';
|
||||
jQuery.post(ajaxurl, postData, function(response) {
|
||||
///////////////////////////////////////////////////////////////
|
||||
//console.log('Get Available Hours JSON Response:', response);
|
||||
console.log('Get Available Hours JSON Response:', response);
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
|
||||
|
||||
// The response contains the available hours for the selected provider and
|
||||
|
|
|
@ -173,6 +173,7 @@ CREATE TABLE IF NOT EXISTS `ea_user_settings` (
|
|||
`notifications` tinyint(4) DEFAULT '0',
|
||||
`google_sync` tinyint(4) DEFAULT '0',
|
||||
`google_token` text,
|
||||
`google_calendar` varchar(128) DEFAULT NULL,
|
||||
`sync_past_days` int(11) DEFAULT '5',
|
||||
`sync_future_days` int(11) DEFAULT '5',
|
||||
PRIMARY KEY (`id_users`)
|
||||
|
@ -234,4 +235,4 @@ INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `appointments`, `custo
|
|||
|
||||
INSERT INTO `ea_settings` (`name`, `value`) VALUES
|
||||
('company_working_plan', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}'),
|
||||
('book_advance_timeout', '30');
|
||||
('book_advance_timeout', '30');
|
||||
|
|
Loading…
Reference in a new issue