PageRenderTime 55ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/ecofim-services/ecofilm-edicion-player.php

https://gitlab.com/eco-film-festival/ecof-developer-2016
PHP | 265 lines | 192 code | 32 blank | 41 comment | 59 complexity | af1a7297e92c195810890721d841cf59 MD5 | raw file
  1. <?
  2. require 'ecofilm-csv.php';
  3. if(!class_exists('WP_Plugin_Ecofim_Service_Edicion_Player')){
  4. class WP_Plugin_Ecofim_Service_Edicion_Player extends WP_Plugin_Ecofim_Service_csv
  5. {
  6. private $url_path_swf;
  7. public function display_player( $atts, $content = null ){
  8. self::register_styles();
  9. self::regiter_script();
  10. extract(
  11. shortcode_atts(array(
  12. 'lista_url' => 'https://docs.google.com/spreadsheet/pub?key=0Au0m6p_4_7q6dFVybGFfRG1JbmpCTmIyYUNUbExpbnc&output=csv' ,
  13. 'active_filter_categoria' => '' ,
  14. 'active_filter_anno' => '' ,
  15. 'active_filter_lugar' => '' ,
  16. 'active_filter_estatus' => '' ,
  17. ), $atts));
  18. $_GET['c'] = ($active_filter_categoria != '') ? $active_filter_categoria : $_GET['c'];
  19. $_GET['y'] = ($active_filter_anno != '') ? $active_filter_anno : $_GET['y'];
  20. $_GET['pl'] = ($active_filter_lugar != '') ? $active_filter_lugar : $_GET['pl'];
  21. $_GET['es'] = ($active_filter_estatus != '') ? $active_filter_estatus : $_GET['es'];
  22. $active_filter = (
  23. $active_filter_categoria != '' ||
  24. $active_filter_anno != '' ||
  25. $active_filter_lugar != '' ||
  26. $active_filter_estatus != ''
  27. );
  28. $f_cat = (isset($_GET['c']) && $_GET['c'] != '')?$_GET['c']:null;
  29. $f_anno = (isset($_GET['y']) && $_GET['y'] != '')?$_GET['y']:null;
  30. $f_lugar = (isset($_GET['pl']) && $_GET['pl'] != '')?$_GET['pl']:null;
  31. $f_est = (isset($_GET['es']) && $_GET['es'] != '')?$_GET['es']:null;
  32. $_result = $this->get_lista_corto( $lista_url , $f_cat , $f_anno , $f_lugar , $f_est);
  33. //---------- begin : output
  34. ob_start();
  35. ?>
  36. <div id="content">
  37. <div id="basic-playlist"
  38. class="flowplayer is-splash is-closeable"
  39. data-ratio="0.5625">
  40. <video class="bp-video">
  41. <source type="video/mp4"
  42. src="http://ecofilmfestival.org/video_eco_ed/2014/6098b7ce-8f7f-458d-88d7-3158859ed2a0.mp4">
  43. </video>
  44. <a class="fp-prev"></a>
  45. <a class="fp-next"></a>
  46. <div class="fp-playlist" style="display: none;">
  47. <?foreach($_result['data'] as $_c):
  48. $host = $_c["host"];
  49. $directory = $_c["directory"];
  50. $mp4_sd = $_c["mp4_sd"];
  51. /*$hots_img = "https://ecofilmfestival.info";
  52. $directory_img = $_c->StillPath;
  53. $poster = $hots_img.$directory_img.$_c->Still;
  54. $detail = "detail";//$_c['detail'].'?'.$_c['var_detail'].'='.$_c['id_corto'];
  55. $active_detail = false;//$_c['active_detail'];
  56. $read_only = false;
  57. $Nombre = ($_GET['lang'] != 'en' || false)?$_c->Titulo_ES:$_c->Titulo_EN;
  58. $Lugar_Descripcion = ($_GET['lang'] != 'en' || false)?$_c->Categoria_ES:$_c->Categoria_EN;
  59. $Nacionalidad = ($_GET['lang'] != 'en' || false)?$_c->Nacionalidad_ES:$_c->Nacionalidad_EN;
  60. $Categoria = ($_GET['lang'] != 'en' || false)?$_c->Categoria_ES:$_c->Categoria_EN;
  61. $Youtube = "";//($_GET['lang'] != 'en' || false)?'Youtube':'Youtube_EN';
  62. $Sinopsis = ($_GET['lang'] != 'en' || false)?$_c->Sinopsis_ES:$_c->Sinopsis_EN;
  63. $active_sinopsis = 0;*/
  64. ?>
  65. <a class="itemX" href="<?=$host.$directory.$mp4_sd?>"
  66. data-cuepoints="[0.5, 1]"></a>
  67. <?endforeach?>
  68. </div>
  69. </div>
  70. </div>
  71. <!--<code><?php //print_r($_result); ?></code> -->
  72. <?php
  73. $list_markup = ob_get_contents();
  74. ob_end_clean();
  75. //---------- end : output
  76. return $list_markup;
  77. }
  78. public function get_lista_corto($lista_url = 'ultimo_inscrito' , $f_cat = null , $f_anno = null , $f_lugar = null , $f_est = null)
  79. {
  80. $data = $this->feedToArray($lista_url);
  81. // ------------------------------
  82. // ------------------------------
  83. // ------------------------------
  84. $a_est = array();
  85. foreach ($data as $corto) {
  86. if($corto['display'] == 1 ){
  87. if( empty($a_est)){
  88. array_push($a_est , array('class' => $corto['estatus_class'] , 'title' => $corto['Estatus']));
  89. } else{
  90. $insert = true;
  91. foreach ($a_est as $cat)
  92. {
  93. if( $cat['class'] == $corto['estatus_class'])
  94. {
  95. $insert = false;
  96. break;
  97. }
  98. }
  99. if($insert)
  100. {
  101. array_push($a_est , array('class' => $corto['estatus_class'] , 'title' => $corto['Estatus']));
  102. }
  103. }
  104. }
  105. }
  106. // ------------------------------
  107. // ------------------------------
  108. // ------------------------------
  109. $a_cat = array();
  110. foreach ($data as $corto) {
  111. if($corto['display'] == 1 ){
  112. if( empty($a_cat)){
  113. array_push($a_cat , array('class' => $corto['class'] , 'title' => $corto['Categoria']));
  114. } else{
  115. $insert = true;
  116. foreach ($a_cat as $cat)
  117. {
  118. if( $cat['class'] == $corto['class'])
  119. {
  120. $insert = false;
  121. break;
  122. }
  123. }
  124. if($insert)
  125. {
  126. array_push($a_cat , array('class' => $corto['class'] , 'title' => $corto['Categoria']));
  127. }
  128. }
  129. }
  130. }
  131. // ------------------------------
  132. // ------------------------------
  133. // ------------------------------
  134. $a_lugar = array();
  135. foreach ($data as $corto) {
  136. if($corto['display'] == 1 ){
  137. if( empty($a_lugar)){
  138. array_push($a_lugar , array('class' => $corto['Lugar'] , 'title' => $corto['Lugar_Descripcion']));
  139. } else{
  140. $insert = true;
  141. foreach ($a_lugar as $cat)
  142. {
  143. if( $cat['class'] == $corto['Lugar'])
  144. {
  145. $insert = false;
  146. break;
  147. }
  148. }
  149. if($insert)
  150. {
  151. array_push($a_lugar , array('class' => $corto['Lugar'] , 'title' => $corto['Lugar_Descripcion']));
  152. }
  153. }
  154. }
  155. }
  156. // ------------------------------
  157. // ------------------------------
  158. // ------------------------------
  159. $a_anno = array();
  160. foreach ($data as $corto) {
  161. if($corto['display'] == 1 ){
  162. if( empty($a_anno)){
  163. array_push($a_anno , array('class' => $corto['Año'] , 'title' => $corto['Año']));
  164. } else{
  165. $insert = true;
  166. foreach ($a_anno as $cat)
  167. {
  168. if( $cat['class'] == $corto['Año'])
  169. {
  170. $insert = false;
  171. break;
  172. }
  173. }
  174. if($insert)
  175. {
  176. array_push($a_anno , array('class' => $corto['Año'] , 'title' => $corto['Año']));
  177. }
  178. }
  179. }
  180. }
  181. // ------------------------------
  182. // ------------------------------
  183. // ------------------------------
  184. $data_filter = array();
  185. foreach ($data as $corto) {
  186. $insert =
  187. (
  188. ( $f_cat == $corto['class'] || ! $f_cat )
  189. && ( $f_anno == $corto['Año'] || ! $f_anno )
  190. && ( $f_lugar == $corto['Lugar'] || ! $f_lugar )
  191. //&& ( $f_est == $corto['estatus_class'] || ! $f_est )
  192. )
  193. || ( ! $f_cat && ! $f_anno && ! $f_lugar && ! $f_est)
  194. ;
  195. if($insert && $corto['display'] == 1)
  196. {
  197. array_push($data_filter , $corto);
  198. }
  199. }
  200. // ------------------------------
  201. // ------------------------------
  202. // ------------------------------
  203. $result = array(
  204. 'f_cat' => $f_cat ,
  205. 'f_anno' => $f_anno ,
  206. 'f_lugar' => $f_lugar ,
  207. 'data' => $data ,
  208. 'lista_url' => $lista_url ,
  209. 'estatus' => $a_est ,
  210. 'cat' => $a_cat,
  211. 'lugar' => $a_lugar,
  212. 'anno' => $a_anno,
  213. 'result' => $data_filter
  214. );
  215. return $result;
  216. }
  217. public function regiter_script(){
  218. wp_enqueue_script( 'jquery' );
  219. wp_enqueue_script('app_eco_serv_edicion_flowplayer', plugins_url('flowplayer-5.5.2/flowplayer.min.js', __FILE__));
  220. //wp_enqueue_script('app_eco_serv_edicion_flowplayer_display_player', plugins_url('js/ecofilm-display-player.js', __FILE__));
  221. //wp_enqueue_script('app_eco_serv_video_galery_filters', plugins_url('js/ecofilm-video-galery.js', __FILE__));
  222. }
  223. public function register_styles(){
  224. wp_enqueue_style( 'css_eco_serv_edicion_flowplayer_themes', plugins_url('flowplayer-5.5.2/skin/minimalist.css', __FILE__));
  225. wp_enqueue_style( 'css_eco_serv_edicion_flowplayer_basic', plugins_url('flowplayer-5.5.2/playlist/basic.css', __FILE__));
  226. //wp_enqueue_style( 'css_eco_video_galery', plugins_url('css/ecofilm-video-galery.css', __FILE__));
  227. }
  228. }
  229. }