+
+
+ 'getbible_favourite_book',
+ 'label' => JText::_('COM_GETBIBLE_BOOKS'),
+ 'options' => $displayData['book_options'],
+ 'default' => $displayData['book_default']
+ ]); ?>
+
+
+
+
+ 'getbible_favourite_chapter',
+ 'label' => JText::_('COM_GETBIBLE_CHAPTERS'),
+ 'options' => $chapters,
+ 'default' => $displayData['chapter_default']
+ ]); ?>
+
+
+
+
+ 'getbible_favourite_verse',
+ 'label' => JText::_('COM_GETBIBLE_VERSES'),
+ 'options' => $verses,
+ 'default' => $displayData['verse_default']
+ ]); ?>
+
+
+
+
+ 'getbible_favourite_linker',
+ 'class_other' => 'getbible-linker-guid-input uk-text-center',
+ 'label' => JText::_('COM_GETBIBLE_SESSION_KEY'),
+ 'class_other_label' => 'getbible-linker-name-value',
+ 'placeholder' => JText::_('COM_GETBIBLE_AUTO_GENERATED')
+ ]); ?>
+
+' . JText::_('COM_GETBIBLE_YOU_SHOULD_SELECT_ONE_OF_BYOUR_FAVOURITEB_VERSES') . '
';
-$content .= '' . JText::_('COM_GETBIBLE_THIS_VERSE_IN_COMBINATION_WITH_YOUR_ISESSION_KEYI_WILL_BE_USED_TO_AUTHENTICATE_YOU_IN_THE_FUTURE') . '
';
-$content .= '';
-$content .= '
';
-$content .= JLayoutHelper::render('selectbox', ['id' => 'getbible_favourite_book', 'label' => JText::_('COM_GETBIBLE_BOOKS'), 'options' => $options, 'default' => $this->chapter->book_nr]);
-$content .= '
';
-$options = array_map( function ($item) {
- return (object) ['key' => $item, 'value' => $item];
-}, range(1, 150));
-$content .= '
';
-$content .= JLayoutHelper::render('selectbox', ['id' => 'getbible_favourite_chapter', 'label' => JText::_('COM_GETBIBLE_CHAPTERS'), 'options' => $options, 'default' => $this->chapter->chapter]);
-$content .= '
';
-$options = array_map( function ($item) {
- return (object) ['key' => $item, 'value' => $item];
-}, range(1, 176));
-$content .= '
';
-$content .= JLayoutHelper::render('selectbox', ['id' => 'getbible_favourite_verse', 'label' => JText::_('COM_GETBIBLE_VERSES'), 'options' => $options, 'default' => (string) $this->verses->first]);
-$content .= '
';
-$content .= '
';
-$content .= '' . JText::_('COM_GETBIBLE_THIS_IS_CURRENTLY_THE_ACTIVE_SESSION_KEY') . '
';
-$content .= '';
-$content .= JLayoutHelper::render('inputbox', ['id' => 'getbible_favourite_linker', 'class_other' => 'getbible-linker-guid-input uk-text-center', 'label' => JText::_('COM_GETBIBLE_SESSION_KEY'), 'placeholder' => JText::_('COM_GETBIBLE_AUTO_GENERATED')]);
-$content .= '
';
-$content .= '' . JText::_('COM_GETBIBLE_SHOULD_YOU_HAVE_BANOTHER_SESSION_KEYB_FROM_A_PREVIOUS_SESSION') . '
' . JText::_('COM_GETBIBLE_YOU_CAN_ADD_IT_HERE_TO_LOAD_YOUR_PREVIOUS_SESSION') . '
';
-
+$favourite_verse['book_default'] = (int) $this->chapter->book_nr;
+// set chapter
+$favourite_verse['chapter_default'] = (int) $this->chapter->chapter;
+// set verse
+$favourite_verse['verse_default'] = (int) $this->verses->first;
// set buttons
$buttons = [
- ['id' => 'getbible-select-favourite-verse', 'name' => JText::_('COM_GETBIBLE_SELECT'), 'class' => 'uk-button uk-button-default uk-width-2-3'],
- ['id' => 'getbible-cancel-favourite-verse', 'close' => true, 'name' => JText::_('COM_GETBIBLE_CANCEL'), 'class' => 'uk-button uk-button-danger uk-width-1-3']
+ ['id' => 'getbible-new-favourite-verse-session', 'name' => JText::_('COM_GETBIBLE_NEW'), 'class' => 'uk-button uk-button-default uk-width-1-4'],
+ ['id' => 'getbible-select-favourite-verse', 'name' => JText::_('COM_GETBIBLE_SELECT'), 'class' => 'uk-button uk-button-default uk-width-2-4'],
+ ['id' => 'getbible-cancel-favourite-verse', 'close' => true, 'name' => JText::_('COM_GETBIBLE_CANCEL'), 'class' => 'uk-button uk-button-danger uk-width-1-4']
];
@@ -61,7 +41,7 @@ $buttons = [
'header' => JText::_('COM_GETBIBLE_FAVOURITE_VERSE'),
'header_class_other' => 'uk-text-center',
'close' => true,
- 'content' => $content,
+ 'content' => JLayoutHelper::render('getbiblefavouriteverse', $favourite_verse),
'buttons_class' => 'uk-button-group uk-width-1-1',
'buttons_id' => 'getbible-favourite-buttons',
'buttons' => $buttons
@@ -76,6 +56,8 @@ const favouriteVerse = document.getElementById('getbible_favourite_verse');
const favouriteLinker = document.getElementById('getbible_favourite_linker');
const favouriteSelection = document.getElementById('getbible-select-favourite-verse');
const cancelFavouriteSelection = document.getElementById('getbible-cancel-favourite-verse');
+const newFavouriteSession = document.getElementById('getbible-new-favourite-verse-session');
+const favouriteBooks = ;
params->get('show_settings') == 1): ?>
const sessionAccessStatusSwitch = document.getElementById('getbible-session-status-switch');
@@ -107,26 +89,76 @@ const setGetBibleFavouriteVerse = () => {
rejectFavouriteVerse = reject;
});
};
+newFavouriteSession.addEventListener('click', async () => {
+ try {
+ favouriteError.style.display = 'none';
+ // build selected verse values
+ let selection = favouriteBook.value + ' ' + favouriteChapter.value + ':' + favouriteVerse.value;
+ let selectedBookName = getFavouriteBookName(favouriteBook.value);
+ if (selectedBookName) {
+ selection = '