-
Notifications
You must be signed in to change notification settings - Fork 0
/
bible.pages.inc
186 lines (165 loc) · 5.88 KB
/
bible.pages.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
// Read functions.
function bible_all($bibles_ = NULL, $book = NULL, $chapter = NULL, $verse = NULL) {
// Arg: bible/book/chap/verse.
$page_content = '';
$bible_count = _bible_get_bible_count();
if ($bible_count === 0) {
return t('Please import Bible Context File (*.bc) to use Bible module.');
}
else {
if ($bibles_ === NULL) {
drupal_goto('bible/' . _bible_get_select_bid());
}
$bibles = _bible_get_bibles_array($bibles_);
if (count($bibles) === 0 || $bibles === NULL) {
return t('Format invalid. Please check.');
}
$default_bible = $bibles[0];
$bibles_ = implode('_', $bibles);
if (!empty($book)) {
$book = _bible_get_from_book_alias($book);
}
// Output bible breadcrumb.
// @FIXME
// theme() has been renamed to _theme() and should NEVER be called directly.
// Calling _theme() directly can alter the expected output and potentially
// introduce security issues (see https://www.drupal.org/node/2195739). You
// should use renderable arrays instead.
//
//
// @see https://www.drupal.org/node/2195739
// $page_content .= theme('bible_breadcrumb', array(
// 'bibles' => $bibles,
// 'book' => $book,
// 'chapter' => $chapter,
// ));
// Display specific chapter.
if (!empty($chapter)) {
$chapter_query = \Drupal::database()->select('bible_context', 'bc')
->fields('bc')
->condition('bid', $bibles, 'IN')
->condition('book', $book)
->condition('chapter', $chapter)
->orderBy('verse')
->orderBy('linemark', 'desc');
foreach ($bibles as $bid) {
$chapter_query->orderBy('FIELD(bid, ' . $bid . ')');
}
$chapter_data = $chapter_query
->execute();
// Mask verse.
$versemask = array();
// Highlight.
if ($verse !== NULL) {
$singleverse = (strpos($verse, '-') === FALSE);
if ($singleverse) {
$versemask[$verse][] = 'highlight';
}
else {
$vv = explode('-', $verse);
for ($i = $vv[0]; $i <= $vv[1]; $i++) {
$versemask[$i][] = 'highlight';
}
}
}
// Goldenverse.
$versemask = _bible_get_goldenversemask($book, $chapter, $versemask);
// Refverse.
$versemask = _bible_get_refversemask($book, $chapter, $versemask);
// Note.
if (\Drupal::config('bible.settings')->get('bible_config_showbiblenote') == 1) {
$versemask = _bible_get_notemask($book, $chapter, $versemask);
}
// Theme output.
// @FIXME
// theme() has been renamed to _theme() and should NEVER be called directly.
// Calling _theme() directly can alter the expected output and potentially
// introduce security issues (see https://www.drupal.org/node/2195739). You
// should use renderable arrays instead.
//
//
// @see https://www.drupal.org/node/2195739
// $page_content .= theme('bible_chapter', array(
// 'bibles' => $bibles,
// 'book' => $book,
// 'chapter' => $chapter,
// 'chapter_data' => $chapter_data,
// 'versemask' => $versemask,
// ));
}
// Display chapter list.
elseif (!empty($book)) {
$book_data = \Drupal::database()->query('SELECT * FROM {bible_book_name} ' .
'WHERE bid = ? AND book = ?', array(\Drupal\Component\Utility\Html::escape($default_bible), \Drupal\Component\Utility\Html::escape($book)))
->fetch();
// Theme output.
// @FIXME
// theme() has been renamed to _theme() and should NEVER be called directly.
// Calling _theme() directly can alter the expected output and potentially
// introduce security issues (see https://www.drupal.org/node/2195739). You
// should use renderable arrays instead.
//
//
// @see https://www.drupal.org/node/2195739
// $page_content .= theme('bible_select_chapter', array(
// 'bibles' => $bibles_,
// 'book' => $book,
// 'book_data' => $book_data,
// ));
}
// Display book list.
else {
$bible = \Drupal::database()->query('SELECT * FROM {bible_list} WHERE bid = ?', array(\Drupal\Component\Utility\Html::escape($default_bible)))
->fetch();
if ($bible === NULL) {
$page_content .= t('No such Bible.');
}
else {
$book_data = \Drupal::database()->query('SELECT * FROM {bible_book_name} ' .
'WHERE bid = ? ORDER BY bkid', array($bible->bid));
// Theme output.
// @FIXME
// theme() has been renamed to _theme() and should NEVER be called directly.
// Calling _theme() directly can alter the expected output and potentially
// introduce security issues (see https://www.drupal.org/node/2195739). You
// should use renderable arrays instead.
//
//
// @see https://www.drupal.org/node/2195739
// $page_content .= theme('bible_select_book', array(
// 'bibles' => $bibles_,
// 'book_data' => $book_data,
// ));
}
}
// Output links.
// @FIXME
// theme() has been renamed to _theme() and should NEVER be called directly.
// Calling _theme() directly can alter the expected output and potentially
// introduce security issues (see https://www.drupal.org/node/2195739). You
// should use renderable arrays instead.
//
//
// @see https://www.drupal.org/node/2195739
// $page_content .= theme('bible_links', array(
// 'bibles' => $bibles,
// 'bible_count' => $bible_count,
// ));
if (!empty($chapter) && $chapter_data->rowCount() > 0) {
// @FIXME
// theme() has been renamed to _theme() and should NEVER be called directly.
// Calling _theme() directly can alter the expected output and potentially
// introduce security issues (see https://www.drupal.org/node/2195739). You
// should use renderable arrays instead.
//
//
// @see https://www.drupal.org/node/2195739
// $page_content .= theme('bible_chapter_data', array(
// 'book' => $book,
// 'chapter' => $chapter,
// ));
}
}
return $page_content;
}