public function findOrCreateOne($bible_code, $bible_name) { # Attempt to find bible $bible = BibleQuery::create()->filterByCode($bible_code)->findOne(); # Return or create bible if ($bible) { return $bible; } else { $bible = new Bible(); $bible->setCode($bible_code)->setName($bible_name)->save(); return $bible; } }
/** * Returns list of books in bible * * @return Response */ public function getBibleBooks() { $arr = array(); $bibleBooks = Bible::all(); if (count($bibleBooks) == 0) { $arr['Success'] = false; $arr['Status'] = 'Books not found'; $arr['StatusCode'] = 404; } else { $arr['Success'] = true; $arr['Status'] = 'OK'; $arr['StatusCode'] = 200; $i = 0; foreach ($bibleBooks as $book) { $arr['Result'][$i]['dam_id'] = $book->dam_id; $arr['Result'][$i]['number_of_chapters'] = $book->number_of_chapters; $arr['Result'][$i]['chapters'] = $book->chapters; $arr['Result'][$i]['bible_name'] = $book->bible_name; $arr['Result'][$i]['bible_type'] = $book->bible_type; $arr['Result'][$i]['book_id'] = $book->book_id; $arr['Result'][$i]['book_name'] = $book->book_name; $arr['Result'][$i]['book_order'] = $book->book_order; $arr['Result'][$i]['language'] = $book->language; $i++; } } return Response::json($arr); }
private function generate_verses($ranges) { $xml = Bible::getVerses($ranges); $quoted_verses = ''; foreach ($xml->range as $range) { // get range title $title = $range->result; $title = Bible::convertEngRangesToCh($title); $quoted_verses .= " <br><b>" . $title . "</b><br><br>"; // get verses in this range foreach ($range->item as $item) { $verses = " <b>" . $item->verse . "</b> " . $item->text; $quoted_verses .= " <p>" . $verses . "</p> "; } } return $quoted_verses; }
<div class="form-group"> <div class="col-lg-offset-2 col-lg-10"> <button type="submit" class="btn btn-info">添加</button> <a href="<?php echo site_url(); ?> /worship/index" class="btn btn-default" role="button">取消</a> </div> </div> </form> <br><br> <h4>聖經書卷目錄</h4> <table class="table table-bordered table-hover"> <?php $titles = Bible::getArrayTitles(); $array_en = array_keys($titles); $array_ch = array_values($titles); for ($i = 0; $i < 39; $i++) { printf("<tr>"); printf("<td>%s</td>", $array_ch[$i][1]); printf("<td>%s</td>", $array_en[$i]); if ($i < 27) { printf("<td>%s</td>", $array_ch[$i + 39][1]); printf("<td>%s</td>", $array_en[$i + 39]); } printf("</tr>"); } ?> </table>
<div class="container"> <div class="well well-half"> <div class="row"> <div class="col-lg-4"> <h3>經文 <?php echo Bible::convertEngRangesToCh($video['scripture'], false); ?> </h3> </div> <div class="col-lg-8"> <h3><?php echo $video['title']; ?> </h3> </div> </div> <div class="row"> <div class="col-lg-4"> <div id="scroll_panel"> <?php echo $verses; ?> </div> </div> <div class="col-lg-8"> <a href="<?php echo base_url(); ?> /videos/<?php echo $video['file_name']; ?>
$text .= $row[0]->BookTitle.$row[0]->Verse.' '.$row[0]->TextData; } } $data = $text; $result['resultStatus']=100; $result['data']=$data; return json_encode($result); } } } if(isset($_GET['action']) && $action = $_GET['action']){ $bible = new Bible(); switch($action){ case 'queryBooktitle': print $bible->queryBooktitle(); break; case 'query_article_num': print $bible->queryArticleNum(); break; case 'query_verse_num': print $bible->queryVerseNum(); break; case 'query_bible': print $bible->queryBible(); break; case 'query_bible_by_booktitle':
protected static function _bkIndex2singleRef($book, $index, &$chapter, &$verse) { $index++; $v = Bible::getVerseCounts(); $chapter = 0; while (!!$v[$book][$chapter] && $index > $v[$book][$chapter]) { $index -= $v[$book][$chapter]; $chapter++; } $chapter++; $verse = $index; }
require_once "Bible.php"; if (isset($_GET['initialLoadPage'])) { echo json_encode(Bible::getAllBooks()); } elseif (isset($_GET['readEvent'])) { $book_id = $_GET['book_id']; echo json_encode(['book_name' => Bible::getBook($book_id), 'max_chapter' => Bible::getMaxChapter($book_id), 'max_verse' => Bible::getMaxVerse($book_id, 1), 'verse_text' => Bible::getVerseText($book_id, 1, 1)]); } elseif (isset($_GET['infoEvent'])) { $book_id = $_GET['book_id']; echo json_encode(['book_name' => Bible::getBook($book_id), 'book_info' => Bible::getInfo($book_id)]); } elseif (isset($_GET['watchEvent'])) { $book_id = $_GET['book_id']; echo json_encode(['book_name' => Bible::getBook($book_id), 'book_url' => Bible::getUrl($book_id)]); } elseif (isset($_GET['chapterChangeEvent'])) { $book_id = $_GET['book_id']; $chapter = $_GET['chapter']; $verse = isset($_GET['verse']) ? $_GET['verse'] : 1; echo json_encode(['max_verse' => Bible::getMaxVerse($book_id, $chapter), 'verse_text' => Bible::getVerseText($book_id, $chapter, $verse)]); } elseif ($_GET['event'] == "nextBtnPress") { $book_id = $_GET['book_id']; $chapter = $_GET['chapter']; $verse = isset($_GET['verse']) ? $_GET['verse'] : 1; echo Bible::getMaxVerse($book_id, $chapter); } elseif ($_GET['event'] == "displayVerseText") { $book_id = $_GET['book_id']; $chapter = $_GET['chapter']; $verse = isset($_GET['verse']) ? $_GET['verse'] : 1; echo Bible::getVerseText($book_id, $chapter, $verse); } else { echo false; } exit;
'Mark 1:1', 'John 2:5-9' or 'Luke 1:1-4,6,9-10'. It can also take most commonly used abbreviations, such as '1 c 2:3' or 'jn 2'. </p> EOF; $translations = array('kjv' => 'King James Version', 'niv' => 'New International Version', 'nrsv' => 'New Revised Standard Version', 'amp' => 'Amplified Bible', 'cev' => 'Contemporary English Version', 'esv' => 'English Standard Version', 'mkjv' => 'Modern King James Version', 'msg' => 'The Message', 'nasb' => 'New American Standard Bible', 'nkjv' => 'New King James Version', 'nlt' => 'New Living Translation'); if ($_GET['translation']) { $translation = $_GET['translation']; } else { $translation = 'niv'; } require_once 'Form.class'; $form = new Form(); $form->text('Enter Bible Verse', 'verse', $_GET['verse']); $form->select('Select Translation', 'translation', $translations, $translation); $form->submit('submit', 'Search'); $form->reset('Clear'); $page->content .= $form->render(); if (isset($_GET['verse']) && $_GET['verse'] != '') { require_once 'Bible.class'; $bible = new Bible(); if ($bible->setTranslation($translation)) { $page->content .= "<h2>" . $translations[$translation] . "</h2>\n"; $page->content .= $bible->parseVerse($_GET['verse']); } else { $page->content .= "<h2>Unknown Translation</h2>\n"; $page->content .= "<p>Unknown translation: " . $translation . "</p>\n"; } unset($bible); } $page->display();
?> </h2> </div> <table class="table table-striped table-hover"> <thead><th>時間</th><th>信息</th><th>經文</th><th>講員</th><th>下載</th><th>收聽</th><th>錄像</th></thead> <tbody> <?php foreach ($videos as $key => $video) { $video_url = site_url() . '/worship/video/' . $video['id']; $audio_url = site_url() . '/worship/audio/' . $video['id']; $download_url = site_url() . '/worship/direct_download/' . $video['audio_name']; printf("<tr id='sundaymessage-%s'>", $video['id']); printf("<td>%s</td>", $video['date']); printf("<td>%s</td>", $video['title']); printf("<td>%s</td>", Bible::convertEngRangesToCh($video['scripture'])); printf("<td>%s</td>", $video['speaker']); printf("<td><a href=\"%s\">", $download_url); printf(" <span class=\"glyphicon glyphicon-volume-up\"></span></a></td>"); printf("<td><a href=\"%s\">", $audio_url); printf(" <span class=\"glyphicon glyphicon-headphones\"></span></a></td>"); printf("<td><a href=\"%s\">", $video_url); printf(" <span class=\"glyphicon glyphicon-facetime-video\"></span></a></td>"); // update/delete buttons if (Access::hasPrivilege(Access::PRI_UPDATE_WORSHIP)) { $url = site_url() . '/worship/updateSundayMessage/' . $video['id']; printf('<td><span class="pull-right"><a href="%s" class="btn btn-info btn-xs" role="button">更改</a>', $url); $delete_url = site_url() . '/worship/deleteSundayMessage/' . $video['id']; # Delete button printf(' <button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#%s" data-id="%s">刪除</button></span></td>', $video['id'], $video['id']); # Delete modal