Esempio n. 1
0
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::TRANSLATOR_LEVEL);
$header = new Assets_Header(Locale_Translate::_("Order"));
$header->jQueryUIOn("sortable");
$header->run();
$view = new Assets_View(__FILE__);
$database_config_bible = Database_Config_Bible::getInstance();
$database_books = Database_Books::getInstance();
$database_bibles = Database_Bibles::getInstance();
$bible = Access_Bible::clamp($_GET['bible']);
$view->view->bible = Filter_Html::sanitize($bible);
@($reset = $_GET["reset"]);
if (isset($reset)) {
    $database_config_bible->setBookOrder($bible, "");
}
@($order = $_POST['order']);
if (isset($order)) {
    $order = explode(",", $order);
    $ids = array();
    foreach ($order as $english) {
        $id = $database_books->getIdFromEnglish($english);
        $ids[] = $id;
    }
    $order = implode(" ", $ids);
    $database_config_bible->setBookOrder($bible, $order);
Esempio n. 2
0
 public function run()
 {
     $this->view->view->include_jquery_ui = $this->includeJQueryUI;
     $this->view->view->include_jquery_ui_subset = $this->JQueryUISubset;
     $this->view->view->head_lines = $this->headLines;
     $this->view->view->display_topbar = $this->displayTopbar();
     if ($this->view->view->display_topbar) {
         $menu_main = new Menu_Main();
         $this->view->view->mainmenu = $menu_main->create();
         $menu_user = new Menu_User();
         $this->view->view->usermenu = $menu_user->create();
     }
     $this->view->view->display_navigator = $this->displayNavigator;
     if ($this->view->view->display_navigator) {
         $database_config_user = Database_Config_User::getInstance();
         $bible = Access_Bible::clamp($database_config_user->getBible());
         $this->view->view->navigationHtml = Navigation_Passage::getContainer();
         $this->view->view->navigationCode = Navigation_Passage::code($bible, true);
     }
     $this->view->view->included_stylesheet = $this->includedStylesheet;
     $this->view->view->included_editor_stylesheet = $this->includedEditorStylesheet;
     $this->view->render("xhtml_start.php");
     $this->view->render("header.php");
 }
Esempio n. 3
0
        // Going to another Bible, ensure that the focused book exists there.
        $book = $ipc_focus->getBook();
        $books = $database_bibles->getBooks($changebible);
        if (!in_array($book, $books)) {
            if (count($books) > 0) {
                $book = $books[0];
            } else {
                $book = 0;
            }
            $ipc_focus->set($book, 1, 1);
        }
    }
}
$view = new Assets_View(__FILE__);
// Active Bible, and check access.
$bible = Access_Bible::clamp($database_config_user->getBible());
$view->view->bible = $bible;
// Store the active Bible in the page's javascript.
$view->view->navigationCode = Navigation_Passage::code($bible);
// Write access?
$write_access = Access_Bible::write($bible);
$view->view->write_access = $write_access;
$chapterLoaded = Locale_Translate::_("Loaded");
$chapterSaving = Locale_Translate::_("Saving...");
$chapterRetrying = Locale_Translate::_("Retrying...");
$write_access = $write_access ? "true" : "false";
$script = <<<EOD
var editorChapterLoaded = '{$chapterLoaded}';
var editorChapterSaving = '{$chapterSaving}';
var editorChapterRetrying = '{$chapterRetrying}';
var editorWriteAccess = {$write_access};
Esempio n. 4
0
 public function response()
 {
     // The databases to access.
     $database_config_user = Database_Config_User::getInstance();
     $database_volatile = Database_Volatile::getInstance();
     $database_bibles = Database_Bibles::getInstance();
     // The resources to display in the Consistency tool.
     $resources = array();
     $resources[] = Access_Bible::clamp($database_config_user->getBible());
     $resources = array_merge($resources, $database_config_user->getConsistencyResources());
     // The passages entered in the Consistency tool.
     $passages = $database_volatile->getValue($this->id, "passages");
     $passages = trim($passages);
     $passages = Filter_String::string2array($passages);
     // The translations from the Consistency tool.
     $translations = $database_volatile->getValue($this->id, "translations");
     $translations = trim($translations);
     $translations = Filter_String::string2array($translations);
     // Contains the response to display.
     $response = array();
     // Go through the passages interpreting them.
     $previousPassage = array(1, 1, 1);
     foreach ($passages as $line) {
         $line = trim($line);
         if ($line == "") {
             continue;
         }
         $range_sequence = Filter_Books::handleSequencesRanges($line);
         foreach ($range_sequence as $line) {
             $passage = Filter_Books::interpretPassage($previousPassage, $line);
             if ($passage[0] != 0) {
                 $book = $passage[0];
                 $chapter = $passage[1];
                 $verse = $passage[2];
                 $line = Filter_Books::linkForOpeningEditorAt($book, $chapter, $verse);
                 $line .= " ";
                 // Check whether the chapter identifier has changed for this reference.
                 // If so, set a flag so the data can be re-assembled for this verse.
                 // If there was no change, then the data can be fetched from the volatile database.
                 $redoPassage = false;
                 $passageKey = "{$book}.{$chapter}.{$verse}";
                 $currentChapterId = $database_bibles->getChapterId($resources[0], $book, $chapter);
                 $storedChapterId = $database_volatile->getValue($this->id, "{$passageKey}.id");
                 if ($currentChapterId != $storedChapterId) {
                     $database_volatile->setValue($this->id, "{$passageKey}.id", $currentChapterId);
                     $redoPassage = true;
                 }
                 // Go through each resource.
                 foreach ($resources as $resource) {
                     // Produce new verse text if the passage is to be redone, or else fetch the existing text.
                     if ($redoPassage) {
                         $text = $this->verseText($resource, $book, $chapter, $verse);
                         if ($translations != "") {
                             $text = Filter_Markup::words($translations, $text);
                         }
                         $database_volatile->setValue($this->id, "{$passageKey}.{$resource}", $text);
                     } else {
                         $text = $database_volatile->getValue($this->id, "{$passageKey}.{$resource}");
                     }
                     // Formatting.
                     if (count($resources) > 1) {
                         $line .= "<br>";
                     }
                     $line .= $text;
                 }
                 $response[] = $line;
                 $previousPassage = $passage;
             } else {
                 $response[] = '<span class="error">' . Locale_Translate::_("Unknown passage") . " " . $line . '</span>';
             }
         }
     }
     $output = "";
     foreach ($response as $line) {
         $output .= "<div>{$line}</div>\n";
     }
     return $output;
 }