コード例 #1
0
ファイル: mappings.php プロジェクト: alerque/bibledit
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new Database_Mappings();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: logic.php プロジェクト: alerque/bibledit
 public static function getHtml($resource, $book, $chapter, $verse)
 {
     $database_bibles = Database_Bibles::getInstance();
     $database_resources = Database_Resources::getInstance();
     $database_usfmresources = Database_UsfmResources::getInstance();
     $database_offlineresources = Database_OfflineResources::getInstance();
     $database_mappings = Database_Mappings::getInstance();
     $database_config_user = Database_Config_User::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $bibles = $database_bibles->getBibles();
     $usfms = $database_usfmresources->getResources();
     $externals = $database_resources->getNames();
     $isBible = in_array($resource, $bibles);
     $isUsfm = in_array($resource, $usfms);
     if ($isBible || $isUsfm) {
         if ($isBible) {
             $chapter_usfm = $database_bibles->getChapter($resource, $book, $chapter);
         }
         if ($isUsfm) {
             $chapter_usfm = $database_usfmresources->getUsfm($resource, $book, $chapter);
         }
         $verse_usfm = Filter_Usfm::getVerseText($chapter_usfm, $verse);
         $database_config_user = Database_Config_User::getInstance();
         $stylesheet = $database_config_user->getStylesheet();
         $filter_text = new Filter_Text($resource);
         $filter_text->html_text_standard = new Html_Text(Locale_Translate::_("Bible"));
         $filter_text->addUsfmCode($verse_usfm);
         $filter_text->run($stylesheet);
         $html = $filter_text->html_text_standard->getInnerHtml();
     } else {
         if (in_array($resource, $externals)) {
             // Use offline copy if it exists, else fetch it online.
             if ($database_offlineresources->exists($resource, $book, $chapter, $verse)) {
                 $bible = $database_config_user->getBible();
                 $bible_mapping = $database_config_bible->getVerseMapping($bible);
                 $resource_mapping = $database_resources->getMapping($resource);
                 $passages = $database_mappings->translate($bible_mapping, $resource_mapping, $book, $chapter, $verse);
                 $html = "";
                 foreach ($passages as $passage) {
                     $html .= $database_offlineresources->get($resource, $passage[0], $passage[1], $passage[2]);
                 }
             } else {
                 $html = Resource_Logic::getExternal($resource, $book, $chapter, $verse, true);
             }
         } else {
             $html = "";
         }
     }
     return $html;
 }
コード例 #3
0
ファイル: map.php プロジェクト: alerque/bibledit
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::MANAGER_LEVEL);
Assets_Page::header(Locale_Translate::_("Verse mappings"));
$view = new Assets_View(__FILE__);
$database_mappings = Database_Mappings::getInstance();
$session_logic = Session_Logic::getInstance();
$username = $session_logic->currentUser();
$userlevel = $session_logic->currentLevel();
$name = $_GET['name'];
$view->view->name = Filter_Html::sanitize($name);
//$write = $database_styles->hasWriteAccess ($username, $name);
$write = true;
if ($userlevel >= Filter_Roles::ADMIN_LEVEL) {
    $write = true;
}
if (isset($_POST['submit'])) {
    $data = $_POST['data'];
    if ($write) {
        $database_mappings->import($name, $data);
    }