/app/main/controllers/template/template.php

  1. <?php 
  2. global $rtmedia_query; 
  3.  
  4. if ( is_rtmedia_album_gallery() ) { 
  5. $template = 'album-gallery'; 
  6. } elseif ( is_rtmedia_album() || is_rtmedia_gallery() ) { 
  7. $template = 'media-gallery'; 
  8. if ( 
  9. is_rtmedia_album() && 
  10. isset( $rtmedia_query->media_query ) && 
  11. $rtmedia_query->action_query->action == 'edit' 
  12. ) { 
  13. if ( isset( $rtmedia_query->media_query[ 'media_author' ] ) && (get_current_user_id() == $rtmedia_query->media_query[ 'media_author' ]) ) { 
  14. $template = 'album-single-edit'; 
  15. } else if ( is_rtmedia_single() ) { 
  16. $template = 'media-single'; 
  17. if ( $rtmedia_query->action_query->action == 'edit' ) 
  18. $template = 'media-single-edit'; 
  19.  
  20. $ajax = false; 
  21.  
  22.  
  23. if ( 
  24. ! empty( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) && 
  25. strtolower( $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest' 
  26. $ajax = true; 
  27.  
  28.  
  29. if ( ! $ajax ) { 
  30. ?> 
  31.  
  32. <?php 
  33.  
  34. if ( class_exists( 'BuddyPress' ) && ! bp_is_blog_page() ) { 
  35. $template_type = 'buddypress'; 
  36. } else { 
  37. $template_type = ''; 
  38.  
  39. get_header( $template_type ); 
  40. ?> 
  41. <div id="primary" class="site-content"> 
  42. <?php 
  43.  
  44. if ( $template_type == 'buddypress' ) { 
  45. ?> 
  46. <div id ="content"> 
  47. <div id="buddypress" class="padder"> 
  48.  
  49. <?php if ( bp_displayed_user_id() ) { ?> 
  50. <div id="item-header"> 
  51.  
  52. <?php bp_get_template_part( 'members/single/member-header' ) ?> 
  53.  
  54. </div> 
  55.  
  56. <div id="item-nav"> 
  57. <div class="item-list-tabs no-ajax" id="object-nav" role="navigation"> 
  58. <ul> 
  59.  
  60. <?php bp_get_displayed_user_nav(); ?> 
  61.  
  62. <?php do_action( 'bp_member_options_nav' ); ?> 
  63.  
  64. </ul> 
  65. </div> 
  66. </div> 
  67.  
  68. <div id="item-body"> 
  69.  
  70. <?php do_action( 'bp_before_member_body' ); ?> 
  71. <?php do_action( 'bp_before_member_media' ); ?> 
  72. <div class="item-list-tabs no-ajax" id="subnav"> 
  73. <ul> 
  74.  
  75. <?php rtmedia_sub_nav(); ?> 
  76.  
  77. <?php do_action( 'rtmedia_sub_nav' ); ?> 
  78.  
  79. </ul> 
  80. </div><!-- .item-list-tabs --> 
  81.  
  82. <?php 
  83. } else if ( bp_is_group() ) { 
  84. ?> 
  85.  
  86. <?php 
  87. if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group(); 
  88. ?> 
  89. <div id="item-header"> 
  90.  
  91. <?php bp_get_template_part( 'groups/single/group-header' ); ?> 
  92.  
  93. </div> 
  94. <div id="item-nav"> 
  95. <div class="item-list-tabs no-ajax" id="object-nav" role="navigation"> 
  96. <ul> 
  97.  
  98. <?php bp_get_options_nav(); ?> 
  99.  
  100. <?php do_action( 'bp_group_options_nav' ); ?> 
  101.  
  102. </ul> 
  103. </div> 
  104. </div><!-- #item-nav --> 
  105.  
  106.  
  107. <div id="item-body"> 
  108.  
  109. <?php do_action( 'bp_before_group_body' ); ?> 
  110. <?php do_action( 'bp_before_group_media' ); ?> 
  111. <div class="item-list-tabs no-ajax" id="subnav"> 
  112. <ul> 
  113.  
  114. <?php rtmedia_sub_nav(); ?> 
  115.  
  116. <?php do_action( 'rtmedia_sub_nav' ); ?> 
  117.  
  118. </ul> 
  119. </div><!-- .item-list-tabs --> 
  120. <?php 
  121. endwhile; 
  122. endif; 
  123. include(RTMediaTemplate::locate_template( $template )); 
  124. if ( ! $ajax ) { 
  125. if ( $template_type == 'buddypress' && (bp_displayed_user_id() || bp_is_group()) ) { 
  126.  
  127. if ( bp_is_group() ) { 
  128. do_action( 'bp_after_group_media' ); 
  129. do_action( 'bp_after_group_body' ); 
  130.  
  131. if ( bp_displayed_user_id() ) { 
  132. do_action( 'bp_after_member_media' ); 
  133. do_action( 'bp_after_member_body' ); 
  134.  
  135. ?> 
  136.  
  137.  
  138.  
  139.  
  140. </div> 
  141. </div> 
  142. </div> 
  143.  
  144. <?php 
  145. if ( ! $ajax ) { 
  146. ?> 
  147. </div> 
  148. <?php 
  149. get_sidebar( $template_type ); 
  150.  
  151. get_footer( $template_type ); 
  152. ?> 
.