// Find out how often this word occurs in the Bible. Skip if too often. $details = $database_kjv->searchStrong($strong); $count = count($details); if ($count < 1) { continue; } if ($count > $maxcount) { continue; } // Store the identifiers and their count. foreach ($details as $detail) { $book = $detail['book']; $chapter = $detail['chapter']; $verse = $detail['verse']; $passage = array($book, $chapter, $verse); $passage = Filter_Books::passage2integer($passage); if (isset($passages[$passage])) { $passages[$passage]++; } else { $passages[$passage] = 1; } } } // Sort on occurence from high to low. arsort($passages, SORT_NUMERIC); // Output the passage identifiers to the browser. // Skip identifiers that only occur once. foreach ($passages as $key => $value) { if ($value <= 1) { continue; }
require_once "../bootstrap/bootstrap.php"; page_access_level(Filter_Roles::TRANSLATOR_LEVEL); $database_config_user = Database_Config_User::getInstance(); $database_bibles = Database_Bibles::getInstance(); $ipc_focus = Ipc_Focus::getInstance(); $bible = $database_config_user->getTargetXrefBible(); $currentBook = $ipc_focus->getBook(); $currentChapter = $ipc_focus->getChapter(); $currentPassage = array($currentBook, $currentChapter, 1); $currentLocation = Filter_Books::passage2integer($currentPassage); $books = $database_bibles->getBooks($bible); foreach ($books as $book) { $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) { if ($chapter == 0) { continue; } $passage = array($book, $chapter, 1); $location = Filter_Books::passage2integer($passage); if ($location > $currentLocation) { $usfm = $database_bibles->getChapter($bible, $book, $chapter); $xrefs = Filter_Usfm::extractNotes($usfm, array("x")); if (empty($xrefs)) { $ipc_focus->set($book, $chapter, 1); Filter_Url::redirect("index.php"); die; } } } } Filter_Url::redirect("index.php");
public function testPassageInteger() { $standard = explode(".", "6.4.2"); $numeric = Filter_Books::passage2integer($standard); $passage = Filter_Books::integer2passage($numeric); $this->assertEquals($standard, $passage); }
$resources = $database_config_user->getPrintResourcesForUser($user); $from = $database_config_user->getPrintPassageFromForUser($user); $passage = explode(".", $from); $from = Filter_Books::passage2integer($passage); $to = $database_config_user->getPrintPassageToForUser($user); $passage = explode(".", $to); $to = Filter_Books::passage2integer($passage); $result = array(); $books = $database_bibles->getBooks($bible); foreach ($books as $book) { $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) { $usfm = $database_bibles->getChapter($bible, $book, $chapter); $verses = Filter_Usfm::getVerseNumbers($usfm); foreach ($verses as $verse) { $passage = Filter_Books::passage2integer(array($book, $chapter, $verse)); if ($passage >= $from && $passage <= $to) { $passageText = Filter_Books::passageDisplay($book, $chapter, $verse); $database_jobs->setProgress($jobId, $passageText); $result[] = '<div class="nextresource">'; $result[] = "<p>{$passageText}</p>"; foreach ($resources as $resource) { $result[] = "<p>"; $result[] = $resource; $html = Resource_Logic::getHtml($resource, $book, $chapter, $verse); $result[] = $html; $result[] = "</p>"; } $result[] = "</div>"; $result[] = "<br>"; }
$passage = explode(".", $database_config_user->getPrintPassageTo()); $usfm = $database_bibles->getChapter($bible, $passage[0], $passage[1]); $verses = Filter_Usfm::getVerseNumbers($usfm); foreach ($verses as $verse) { $parameter = "toverse={$verse}"; $dialog_list->add_row($verse, $parameter); } $dialog_list->run(); } else { // Set ending verse. $topassage = explode(".", $database_config_user->getPrintPassageTo()); $topassage[2] = $toverse; $database_config_user->setPrintPassageTo(implode(".", $topassage)); // Match starting verse. $frompassage = explode(".", $database_config_user->getPrintPassageFrom()); if (Filter_Books::passage2integer($topassage) < Filter_Books::passage2integer($frompassage)) { // Set starting passage to a sensible value. $frompassage[0] = $topassage[0]; $frompassage[1] = $topassage[1]; $frompassage[2] = 0; $database_config_user->setPrintPassageFrom(implode(".", $frompassage)); } } } $view = new Assets_View(__FILE__); $resources = $database_config_user->getPrintResources(); $view->view->resources = $resources; $passage = explode(".", $database_config_user->getPrintPassageFrom()); $view->view->from_book = $database_books->getEnglishFromId($passage[0]); $view->view->from_chapter = $passage[1]; $view->view->from_verse = $passage[2];