YaWK  24.1
Yet another WebKit
jplayer_video.php
Go to the documentation of this file.
1 <?php
2 if (!isset($jPlayerVideo) || (empty($jPlayerVideo)))
3 { // include player class
4  require_once ("system/widgets/jplayer_video/classes/jplayer_video.class.php");
5  // create new player object
6  $jPlayerVideo = new \YAWK\WIDGETS\JPLAYER\VIDEO\jPlayerVideo();
7 }
8 ?>
9 <?php
10 // set default values
11 $jPlayerRootMediaFolder = 'media/video/';
16 $jPlayerWidth = "100%";
17 $jPlayerSkin = "light";
19 $jPlayerDownload = "false";
20 $heading = '';
21 $subtext = '';
22 
23 // $_GET['widgetID'] will be generated in \YAWK\widget\loadWidgets($db, $position)
24 if (isset($_GET['widgetID']))
25 {
26  // widget ID
27  $widgetID = $_GET['widgetID'];
28 
29  // make sure, the player got it's own instance ID
30  $jPlayerInstance = $_GET['widgetID'];
31 
32  // get widget settings from db
33  $res = $db->query("SELECT * FROM {widget_settings}
34  WHERE widgetID = '".$widgetID."'
35  AND activated = '1'");
36  while($row = mysqli_fetch_assoc($res))
37  { // set widget properties and values into vars
38  $w_property = $row['property'];
39  $w_value = $row['value'];
40  $w_widgetType = $row['widgetType'];
41  $w_activated = $row['activated'];
42  /* end of get widget properties */
43 
44  /* filter and load those widget properties */
45  if (isset($w_property)){
46  switch($w_property)
47  {
48  /* url of the video to stream */
49  case 'jPlayerVideoUserMediaFolder';
50  $jPlayerUserMediaFolder = $w_value;
51  break;
52 
53  /* width */
54  case 'jPlayerVideoWidth';
55  $jPlayerWidth = $w_value;
56  break;
57 
58  /* skin */
59  case 'jPlayerVideoSkin';
60  $jPlayerSkin = $w_value;
61  $jPlayerSkin = mb_strtolower($jPlayerSkin);
62  break;
63 
64  /* heading */
65  case 'jPlayerVideoHeading';
66  $heading = $w_value;
67  break;
68 
69  /* subtext */
70  case 'jPlayerVideoSubtext';
71  $subtext = $w_value;
72  break;
73 
74  /* initial volume */
75  case 'jPlayerVideoDefaultVolume';
76  $jPlayerDefaultVolume = $w_value;
77  break;
78 
79  /* initial mute true|false */
80  case 'jPlayerVideoInitialMute';
81  $jPlayerInitialMute = $w_value;
82  break;
83 
84  /* url to a any poster image */
85  case 'jPlayerVideoPoster';
86  $jPlayerPoster = $w_value;
87  break;
88 
89  /* allow to download file? */
90  case 'jPlayerVideoDownload';
91  $jPlayerDownload = $w_value;
92  break;
93  }
94  } /* END LOAD PROPERTIES */
95  } // end while fetch row (fetch widget settings)
96 }
97 
98 
99 // if a heading is set and not empty
100 if (isset($heading) && (!empty($heading)))
101 { // add a h1 tag to heading string
102  $heading = "$heading";
103 
104  // if subtext is set, add <small> subtext to string
105  if (isset($subtext) && (!empty($subtext)))
106  { // build a headline with heading and subtext
107  $subtext = "<small>$subtext</small>";
108  $headline = "<h1>$heading&nbsp;"."$subtext</h1>";
109  }
110  else
111  { // build just a headline - without subtext
112  $headline = "<h1>$heading</h1>"; // draw just the heading
113  }
114 }
115 else
116 { // leave empty if it's not set
117  $headline = '';
118 }
119 echo $headline;
120 ?>
121  <!-- jplayer -->
122  <link type="text/css" href="system/widgets/jplayer/skins/<?php echo $jPlayerSkin; ?>/jplayer.<?php echo $jPlayerSkin; ?>.css" rel="stylesheet">
123  <script type="text/javascript" src="system/widgets/jplayer/js/jquery.jplayer.min.js"></script>
124  <script type="text/javascript" src="system/widgets/jplayer/js/jplayer.playlist.min.js"></script>
125  <script type="text/javascript" src="system/widgets/jplayer/js/browser.js"></script>
126  <script type="text/javascript">
127  //<![CDATA[
128  $(document).ready(function(){
129 
130  var Playlist = function(instance, playlist, options) {
131  var self = this;
132 
133  this.instance = instance; // String: To associate specific HTML with this playlist
134  this.playlist = playlist; // Array of Objects: The playlist
135  this.options = options; // Object: The jPlayer constructor options for this playlist
136 
137  this.current = 0;
138 
139  this.cssId = {
140  jPlayer: "jquery_jplayer_",
141  interface: "jp_interface_",
142  playlist: "jp_playlist_"
143  };
144  this.cssSelector = {};
145 
146  $.each(this.cssId, function(entity, id) {
147  self.cssSelector[entity] = "#" + id + self.instance;
148  });
149 
150  if(!this.options.cssSelectorAncestor) {
151  this.options.cssSelectorAncestor = this.cssSelector.interface;
152  }
153 
154  $(this.cssSelector.jPlayer).jPlayer(this.options);
155 
156  $(this.cssSelector.interface + " .jp-previous").click(function() {
157  self.playlistPrev();
158  $(this).blur();
159  return false;
160  });
161 
162  $(this.cssSelector.interface + " .jp-next").click(function() {
163  self.playlistNext();
164  $(this).blur();
165  return false;
166  });
167  };
168 
169  Playlist.prototype = {
170  displayPlaylist: function() {
171  var self = this;
172  $(this.cssSelector.playlist + " ul").empty();
173  for (i=0; i < this.playlist.length; i++) {
174  var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>";
175  listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>";
176 
177  // Create links to free media
178  if(this.playlist[i].free) {
179  var first = true;
180  listItem += "<div class='jp-free-media'>(";
181  $.each(this.playlist[i], function(property,value) {
182  if($.jPlayer.prototype.format[property]) { // Check property is a media format.
183  if(first) {
184  first = false;
185  } else {
186  listItem += " | ";
187  }
188  listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>";
189  }
190  });
191  listItem += ")</span>";
192  }
193 
194  listItem += "</li>";
195 
196  // Associate playlist items with their media
197  $(this.cssSelector.playlist + " ul").append(listItem);
198  $(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() {
199  var index = $(this).data("index");
200  if(self.current !== index) {
201  self.playlistChange(index);
202  } else {
203  $(self.cssSelector.jPlayer).jPlayer("play");
204  }
205  $(this).blur();
206  return false;
207  });
208 
209  // Disable free media links to force access via right click
210  if(this.playlist[i].free) {
211  $.each(this.playlist[i], function(property,value) {
212  if($.jPlayer.prototype.format[property]) { // Check property is a media format.
213  $(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() {
214  var index = $(this).data("index");
215  $(self.cssSelector.playlist + "_item_" + index).click();
216  $(this).blur();
217  return false;
218  });
219  }
220  });
221  }
222  }
223  },
224  playlistInit: function(autoplay) {
225  if(autoplay) {
226  this.playlistChange(this.current);
227  } else {
228  this.playlistConfig(this.current);
229  }
230  },
231  playlistConfig: function(index) {
232  $(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current");
233  $(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current");
234  this.current = index;
235  $(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
236  },
237  playlistChange: function(index) {
238  this.playlistConfig(index);
239  $(this.cssSelector.jPlayer).jPlayer("play");
240  },
241  playlistNext: function() {
242  var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0;
243  this.playlistChange(index);
244  },
245  playlistPrev: function() {
246  var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1;
247  this.playlistChange(index);
248  }
249  };
250 
251 
252  var videoPlaylist = new Playlist("<?php echo $jPlayerInstance; ?>",
253 
254  [<?php $jPlayerVideo->getVideoFiles($jPlayerRootMediaFolder, $jPlayerUserMediaFolder, $jPlayerPoster, $jPlayerDownload); ?>],
255  {
256  ready: function() {
257  videoPlaylist.displayPlaylist();
258  videoPlaylist.playlistInit(false); // Parameter is a boolean for autoplay.
259  },
260  ended: function() {
261  videoPlaylist.playlistNext();
262  },
263  play: function() {
264  $(this).jPlayer("pauseOthers");
265  },
266  swfPath: "js",
267  supplied: "ogv, m4v, mp4, mpg, flv",
268  volume: "<?php echo $jPlayerDefaultVolume; ?>", // intial volume value from 0 to 1 eg 0.3
269  muted: <?php echo $jPlayerInitialMute; ?> // inital mute? false | true
270  });
271 
272  });
273  //]]>
274  </script>
275  <div class="jp-video jp-video-270p">
276  <div class="jp-type-playlist">
277  <div id="jquery_jplayer_<?php echo $jPlayerInstance; ?>" class="jp-jplayer"></div>
278  <div id="jp_interface_<?php echo $jPlayerInstance; ?>" class="jp-interface">
279  <div class="jp-video-play"></div>
280  <ul class="jp-controls">
281  <li><a href="#" class="jp-play" tabindex="1">play</a></li>
282  <li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
283  <li><a href="#" class="jp-stop" tabindex="1">stop</a></li>
284  <li><a href="#" class="jp-mute" tabindex="1">mute</a></li>
285  <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li>
286  <li><a href="#" class="jp-previous" tabindex="1">previous</a></li>
287  <li><a href="#" class="jp-next" tabindex="1">next</a></li>
288  </ul>
289  <div class="jp-progress">
290  <div class="jp-seek-bar">
291  <div class="jp-play-bar"></div>
292  </div>
293  </div>
294  <div class="jp-volume-bar">
295  <div class="jp-volume-bar-value"></div>
296  </div>
297  <div class="jp-current-time"></div>
298  <div class="jp-duration"></div>
299  </div>
300  <div id="jp_playlist_<?php echo $jPlayerInstance; ?>" class="jp-playlist">
301  <ul>
302  <!-- The method Playlist.displayPlaylist() uses this unordered list -->
303  <li></li>
304  </ul>
305  </div>
306  </div>
307  </div>
308 
309 
310 <?php
311 // } // end namespace
312 ?>
$subtext
$heading
$jPlayerUserMediaFolder
$jPlayerPoster
$jPlayerSkin
$jPlayerInstance
$jPlayerDownload
$jPlayerInitialMute
$jPlayerWidth
if(!isset($jPlayerVideo)||(empty($jPlayerVideo))) $jPlayerRootMediaFolder
$jPlayerDefaultVolume
function a
Definition: browser.js:14
c jPlayer pause
c jPlayer
type
Definition: menu-new.php:35
print $_GET['id']
Definition: page-edit.php:357
function i(e, t)
Definition: plyr.js:1
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L &ouml;schen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})