示例#1
0
function getPassageDataAndVerses($reference_string, $bible_code = 'kjv')
{
    # Get passage data
    $passage_data = getPassageData($reference_string, $bible_code);
    # Get verses objects
    $verses_objects = VerseQuery::create()->filterByBookId($passage_data['book']['id'])->filterByChapterNumber($passage_data['chapter']['number'])->_if($passage_data['verses'])->filterByVerseNumber($passage_data['verses'])->_endif()->find();
    # Handle verse objects
    $passage_data['verses'] = [];
    foreach ($verses_objects as $verse_object) {
        # Get translation object
        $verse_translation_object = VerseTranslationQuery::create()->filterByBibleId($passage_data['bible']['id'])->filterByVerseId($verse_object->getId())->findOne();
        # Get verse topics tags data
        $verse_topics_tags_data = getVerseTopicsTagsData($verse_object->getId());
        # Get verse lessons tags data
        $verse_lessons_tags_data = getVerseLessonsTagsData($verse_object->getId());
        # Handle verse words
        $verse_translation_text_array = explode(' ', $verse_translation_object->getText());
        foreach ($verse_translation_text_array as $word_number => &$word_value) {
            $index++;
            $word_value = '<span data-verse="' . $verse_object->getId() . '" data-word="' . $index . '">' . $word_value . '</span>';
        }
        $verse_translation_text_array = implode(' ', $verse_translation_text_array);
        # Append verse data
        $passage_data['verses'][] = ['id' => $verse_object->getId(), 'number' => $verse_object->getVerseNumber(), 'tags' => ['lessons' => $verse_lessons_tags_data, 'topics' => $verse_topics_tags_data], 'text' => ['array' => $verse_translation_text_array, 'string' => $verse_translation_object->getText()], 'word_count' => $verse_translation_object->getWordCount()];
    }
    # Return passage data
    return $passage_data;
}
示例#2
0
<?php

require_once '../vendor/autoload.php';
require_once '../generated-conf/config.php';
require_once '../app/functions/functions.php';
$passage_data = getPassageData('Genesis 1:1');
var_dump($passage_data);