src/NCBS/WebsiteBundle/Resources/views/Bible/interface/popup/translation_section.html.twig line 1

Open in your IDE?
  1. {% if translations_by_language is defined %}
  2. {% set sCurrGroupName = '' %}
  3. {% set bHasTrans2 = (translation2 is defined and translation2 is not null) %}
  4. {% set bHasTrans3 = (translation3 is defined and translation3 is not null) %}
  5. {% set sLinkTarget = "" %}
  6. {% if bInFrame %}    
  7.     {% set sLinkTarget = " target=_top " %}    
  8. {% endif %}
  9.     
  10. {% set sPopup = "" %}
  11. {% set bAllTrans = (all_translations is defined) %}
  12.   {% if content_type is defined and content_type == 'single_verse' %}        
  13.         {% set sUrl1 = "" %}
  14.         {% if not bAllTrans %}
  15.            {% set sUrl1 = path('bible_verse_all_translations', {'bookUrl': book_url, 'chapterIndex': chapter_index, 'verseIndex': verse_index}) %}
  16.            {% set sPopup = sPopup~'<button type="button" onclick="javascript:showhideDiv();top.location.href = \'{{ sUrl1 }}\';" class="btn btn-secondary" style="text-align:left; color:#000; background-color: #f8f9fa; border: 1px solid rgba(0, 0, 0, 0.125);">' ~ app.session.get('ui_str')["popup.allbibletranslations"] ~ '</button><br><br>' %}           
  17.         {% else %}    
  18.             
  19.         {% endif %}            
  20.   {% endif %}
  21.       
  22.   {% for other_translation in translations_by_language %}
  23.           {% if other_translation["group_name"] != sCurrGroupName %}              
  24.               {% if sCurrGroupName != '' %}     
  25.                   {% set sPopup = sPopup~'</div></div></div><div class="row"><div class="col">' %}                                                                       
  26.               {% endif %} 
  27.               
  28.               {% set sPopup = sPopup~'<h4>' ~ other_translation.group_name ~ '</h4><div class="btn-group-vertical" role="group" aria-label="Vertical button group" style="width:100%;padding-bottom:15px;">' %}
  29.               
  30.               {% set sCurrGroupName = other_translation.group_name %}
  31.           {% endif %} 
  32.                 
  33.           {% set the_story = null %}
  34.           {% if route_story is defined and route_story is not null %}              
  35.               {% set the_story = route_story %}              
  36.           {% elseif story is defined and story is not null %}
  37.               {% set the_story = story %} 
  38.           {% endif %}
  39.           
  40.           {% set book_url = null %}
  41.           {% if(canonical_book is defined and canonical_book is not null and other_translation["has_book"]) %}
  42.               {% set book_url = canonical_book.url %}
  43.           {% else %}
  44.               {% set book_url = other_translation["first_book_url"] %}
  45.           {% endif %}    
  46.           
  47.           {% set nChapterStart = 1 %}
  48.           {% set nChapterEnd = null %}
  49.           {% set bHasChapter = other_translation["has_chapter"] %}
  50.           {% if bHasChapter and canonical_chapter_start is defined and canonical_chapter_start is not null %}
  51.               {% set nChapterStart = canonical_chapter_start %}
  52.               {% set nChapterEnd = canonical_chapter_end %}
  53.           {% endif %}
  54.       
  55.       {% set sUrl = "" %}  
  56.       {% if other_translation["id"] == currTranslation.id %}   
  57.            
  58.       {% elseif (dropdown_target == 1 and translation2 is not null and other_translation["id"] == translation2.id) or (dropdown_target == 1 and bHasTrans3 and other_translation["id"] == translation3.id) or (dropdown_target == 2 and translation1 is not null and other_translation["id"] == translation1.id) or (dropdown_target == 2 and bHasTrans3 and other_translation["id"] == translation3.id) or (dropdown_target == 3 and translation1 is not null and other_translation["id"] == translation1.id) or (dropdown_target == 3 and translation2 is not null and other_translation["id"] == translation2.id) %}
  59.         {# disabled #}
  60.         {% set first_book = other_translation["first_book_url"] %}
  61.         {% if first_book is not null and first_book != '' %}
  62.             {% set sUrl =  path('bible_book', {'translationUrl': other_translation["url"], 'bookUrl': other_translation["first_book_url"]}) %}
  63.         {% else %}    
  64.             {# disabled #}
  65.         {% endif %}          
  66.       {% elseif dropdown_target == 'index' %}
  67.         {% set sUrl =   path('bible_translation', {'translationUrl': other_translation["url"]}) %}
  68.       {% elseif readingplan and plan_step is defined %}          
  69.             {% set sUrl =  path('reading_plan_step_translated', {'readingPlanUrl': reading_plan_url, 'stepOrder': plan_step.step_order, 'translationUrl': other_translation["url"]}) %}
  70.       {% elseif quickview and chapter_id is defined %}          
  71.             {% set sUrl =  path('quickview_bible_translation_chapter', {'translationId': other_translation["id"], 'chapterId': chapter_id}) %}         
  72.       {% elseif dropdown_target is null %}
  73.         {% if content_class is defined and content_class == 'storytext' %}
  74.           {% set sUrl =  path('bible_translated_story_text', {'storyUrl': story.url, 'bibleTranslationUrl': other_translation["url"]}) %}
  75.         {% elseif canonical_chapter_start is defined and canonical_chapter_start is not null %}
  76.           {% if nChapterEnd is not null %} {# multi-chapter in canonical numbering #}
  77.             {% if canonical_verse_start is defined and canonical_verse_start is not null %} {# not complete canonical chapters #}
  78.               {% set sUrl =  path('bible_canonicalized_chapter_verse_range', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterStartIndex': nChapterStart, 'chapterEndIndex': nChapterEnd, 'verseStartIndex': canonical_verse_start, 'verseEndIndex': canonical_verse_end}) %}
  79.             {% else %} {# complete canonical chapters #}
  80.               {% set sUrl =  path('bible_canonicalized_chapter_range', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterStartIndex': nChapterStart, 'chapterEndIndex': nChapterEnd}) %}
  81.             {% endif %}
  82.           {% else %} {# single-chapter in canonical numbering #}               
  83.                {% if bHasChapter %}    
  84.                 {% if canonical_verse_end is defined and canonical_verse_end is not null %} {# range of verses from single canonical chapter #}
  85.                   {% set sUrl =  path('bible_canonicalized_verse_range', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterStartIndex': nChapterStart, 'verseStartIndex': canonical_verse_start, 'verseEndIndex': canonical_verse_end}) %}
  86.                 {% elseif canonical_verse_start is defined and canonical_verse_start is not null %} {# single canonical verse #}
  87.                   {% set sUrl =  path('bible_canonicalized_verse', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterStartIndex': nChapterStart, 'verseStartIndex': canonical_verse_start}) %}
  88.                 {% elseif content_type is defined and content_type == 'single_verse' %} {# single verse #}
  89.                   {% set sUrl =  path('bible_canonicalized_verse', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterStartIndex': chapter_index, 'verseStartIndex': verse_index}) %}
  90.                 {% else %} {# complete single canonical chapter #}
  91.                   {% if bInFrame %}    
  92.                         {% set sUrl =  path('bible_new', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterIndex': nChapterStart}) %}
  93.                     {% else %}                        
  94.                         {% set sUrl =  path('bible_chapter', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterIndex': nChapterStart}) %}                                            
  95.                     {% endif %}                  
  96.                 {% endif %}
  97.              {% else %}
  98.                  {% set sUrl =  path('bible_chapter', {'translationUrl': other_translation["url"], 'bookUrl': book_url, 'chapterIndex': nChapterStart}) %}
  99.              {% endif %}                     
  100.           {% endif %}        
  101.         {% else %}
  102.           {# disabled #}
  103.         {% endif %}
  104.       {% elseif dropdown_target != 'multicolumn' %} {# dropdown_target is either 1 or 2 or 'add', but other_translation is not one that's currently shown #}
  105.         {% if dropdown_target == 'add' %}
  106.           {% if two_column is defined and two_column %}    
  107.               {% set translation1_new, translation2_new, translation3_new = translation1, translation2, other_translation %}
  108.           {% else %}
  109.             {% set translation1_new, translation2_new = translation, other_translation %}
  110.           {% endif %}          
  111.         {% elseif dropdown_target == 1 %}
  112.           {% if translation3 is defined and translation3 is not null %}    
  113.               {% set translation1_new, translation2_new, translation3_new = other_translation, translation2, translation3 %}
  114.           {% else %}
  115.             {% set translation1_new, translation2_new = other_translation, translation2 %}
  116.           {% endif %}
  117.         {% elseif dropdown_target == 2 %}
  118.             {% if translation3 is defined and translation3 is not null %}    
  119.                   {% set translation1_new, translation2_new, translation3_new = translation1, other_translation, translation3 %}
  120.               {% else %}
  121.                 {% set translation1_new, translation2_new = translation1, other_translation %}
  122.               {% endif %}          
  123.         {% elseif dropdown_target == 3 %}
  124.           {% set translation1_new, translation2_new, translation3_new = translation1, translation2, other_translation %}  
  125.         {% endif %}
  126.           {% if verse_index is defined and verse_index is not null %}
  127.             {% set path_name = 'bible_compare_verse' %}
  128.             {% set canonical_verse_start = verse_index %}
  129.           {% elseif canonical_verse_start is null %}
  130.           {% if nChapterEnd is null %}
  131.             {% set path_name = 'bible_compare_chapter' %}
  132.           {% else %}
  133.             {% set path_name = 'bible_compare_chapters' %}
  134.           {% endif %}
  135.         {% else %}
  136.           {% if canonical_verse_end is null %}
  137.             {% set path_name = 'bible_compare_verse' %}
  138.           {% elseif nChapterEnd is null %}
  139.             {% set path_name = 'bible_compare_chapter_verses' %}
  140.           {% else %}
  141.             {% set path_name = 'bible_compare_chapters_verses' %}
  142.           {% endif %}
  143.         {% endif %}
  144.              {% if (translation3 is defined and translation3 is not null) or (dropdown_target == 'add' and two_column is defined and two_column) %}    
  145.                   {% set sUrl =  path(path_name~"_3col", {'translationUrl1': translation1_new.url, 'translationUrl2': translation2_new.url, 'translationUrl3': translation3_new.url, 'bookUrl': book_url, 'chapterStartIndex': nChapterStart, 'chapterEndIndex': nChapterEnd, 'verseStartIndex': canonical_verse_start, 'verseEndIndex': canonical_verse_end}) %}
  146.               {% else %}
  147.                 {% set sUrl =  path(path_name, {'translationUrl1': translation1_new.url, 'translationUrl2': translation2_new.url, 'bookUrl': book_url, 'chapterStartIndex': nChapterStart, 'chapterEndIndex': nChapterEnd, 'verseStartIndex': canonical_verse_start, 'verseEndIndex': canonical_verse_end}) %}
  148.               {% endif %}  
  149.       {% elseif route_story is defined and route_story is not null %}
  150.           {% if commentary_url_from_link is defined and commentary_url_from_link is not null %}
  151.               {% set sUrl =  path('bible_translated_story_for_commentary', {'storyUrl': story.url, 'bibleTranslationUrl': other_translation["url"], 'commentaryUrl': commentary_url_from_link}) %}
  152.           {% else %}
  153.             {% set sUrl =  path('bible_translated_story', {'storyUrl': story.url, 'bibleTranslationUrl': other_translation["url"]}) %}
  154.         {% endif %}                        
  155.       {% else %} {# dropdown_target == 'multicolumn' and other_translation != translation and there is no route_story #}
  156.           {% if translate_pattern is defined and translate_pattern is not null %}
  157.             {% set sUrl =  path(multicolumn_path, multicolumn_route_params|merge({('column'~column_num~'Details'): translate_pattern~other_translation["id"]}) ) %}
  158.         {% else %}
  159.             {% if bHasChapter %}
  160.                 {% set sUrl =  path(multicolumn_path, multicolumn_route_params|merge({('column'~column_num~'Details'): translate_pattern1~other_translation["url"]~'_'~book_url~translate_pattern2}) ) %}
  161.             {% else %}    
  162.                 {% set sUrl =  path(multicolumn_path, multicolumn_route_params|merge({('column'~column_num~'Details'): translate_pattern1~other_translation["url"]~'_'~book_url~'_1'}) ) %}
  163.             {% endif %}    
  164.         {% endif %}        
  165.       {% endif %}
  166.                   
  167.           {% if sUrl != "" %}
  168.               {% set sPopup = sPopup~'<button type="button" onclick="javascript:showhideDiv();top.location.href = \'' ~ sUrl ~ '\';" ' ~ sLinkTarget ~ '  class="btn btn-secondary" style="text-align:left; color:#000; background-color: #f8f9fa; border: 1px solid rgba(0, 0, 0, 0.125);">' ~ other_translation["name"] ~ '</button>' %}
  169.          {% else %} 
  170.              {% set sPopup = sPopup~'<button type="button" class="btn btn-secondary" style="text-align:left; color:grey; background-color: #f8f9fa; border: 1px solid rgba(0, 0, 0, 0.125);">' ~ other_translation["name"] ~ '</button>' %}
  171.           {% endif %}     
  172.               
  173.   {% endfor %}
  174.   
  175.   {% set sPopup = sPopup~'</div></div>' %}
  176.     
  177.   <script>
  178.      aPopupTranslation[{{ nPopupNum }}] = '{{ sPopup|replace({"'": "\\\'"})|raw }}';
  179.   </script>
  180. {% endif %}