Пример #1
0
   /**
	* view the plugin page
	*/
	function insertVideo()
	{
		global $limitstart;
		$eName	= JRequest::getVar('e_name');
		$eName	= preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );

		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();
		$doc = & JFactory::getDocument();
		$doc->addStyleSheet( JURI::root().'plugins/editors-xtd/plug_hwd_vs_insertvideo.css', 'text/css', null, array() );

		$query = 'SELECT count(*) FROM #__hwdvidsvideos';
		$db->SetQuery($query);
		$total = $db->loadResult();

		$limit = 10;
		jimport('joomla.html.pagination');
		$pageNav = new JPagination( $total, $limitstart, $limit );

		// get matching video data
		$query = 'SELECT * FROM #__hwdvidsvideos ORDER BY date_uploaded DESC';
        $db->SetQuery($query, $pageNav->limitstart, $pageNav->limit);
		$rows = $db->loadObjectList();

		?>
		<script type="text/javascript">
			function insertVideo()
			{
				var video_style = document.getElementById("style").value;
				var video_id = document.getElementById("video_id").value;
				var video_width = document.getElementById("video_width").value;
				var video_height = document.getElementById("video_height").value;

				if (video_style == "videoPlayerWithDetails")
				  {
				  var tag = "\{hwdvs-player\}id="+video_id+"|width="+video_width+"|height="+video_height+"\{/hwdvs-player\}";
				  }
				else if (video_style == "videoPlayerOnly")
				  {
				  var tag = "\{hwdvs-player\}id="+video_id+"|width="+video_width+"|height="+video_height+"|tpl=playeronly\{/hwdvs-player\}";
				  }
				else if (video_style == "videoThumbnailLightbox")
				  {
				  var tag = "\{hwdvs-player\}id="+video_id+"|width="+video_width+"|height="+video_height+"|tpl=lightbox\{/hwdvs-player\}";
				  }
				window.parent.jInsertEditorText(tag, '<?php echo $eName; ?>');
				window.parent.document.getElementById('sbox-window').close();
				return false;
			}
			function insertVideoID(id)
			{
				document.getElementById('videoId').innerHTML = '<input type="text" id="video_id" value="'+id+'" name="video_id" />';
				return false;
			}
		</script>

		<table width="100%" cellpadding="2" cellspacing="2" border="0">
			<tr>
				<td width="150" style="vertical-align:top;width:150px;">
					<form>
					<table cellpadding="2" cellspacing="2" border="0">
						<tr>
							<td class="key">
								<label for="title">
									<?php echo JText::_( 'Style' ); ?>
								</label>
								<br />
								<select name="style" id="style">
									<option value="videoPlayerWithDetails">Video player (with details)</option>
									<option value="videoPlayerOnly">Video player (player only)</option>
									<option value="videoThumbnailLightbox">Video thumbnail (lightbox)</option>
								</select>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="title">
									<?php echo JText::_( 'Video ID' ); ?>
								</label>
								<br />
								<div id="videoId"><input type="text" id="video_id" name="video_id" /></div>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="alias">
									<?php echo JText::_( 'Video Width' ); ?>
								</label>
								<br />
								<input type="text" id="video_width" name="video_width" value="560" />
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="alias">
									<?php echo JText::_( 'Video Height' ); ?>
								</label>
								<br />
								<input type="text" id="video_height" name="video_height" value="340" />
							</td>
						</tr>
						<tr>
							<td>
								<button onclick="insertVideo();return false;"><?php echo JText::_( 'Insert Video' ); ?></button>
							</td>
						</tr>
					</table>
					</form>
				</td>
				<td>
				<div style="height:270px;overflow-y:scroll;">
				<?php
					for ($i=0, $n=count($rows); $i < $n; $i++)
					{
						$row = $rows[$i];

						$title     = hwd_vs_tools::generateVideoLink( $row->id, $row->title, null, "insertVideoID", 1000);
						$thumbnail = hwd_vs_tools::generateVideoThumbnailLink($row->id, $row->video_id, $row->video_type, $row->thumbnail, 0, "70", null, null, null, null, "insertVideoID", null, null, $row->video_length);

						echo "<div style=\"float:left;padding:0 5px 5px 0;\">$thumbnail</div>";
						echo "<div>$title</div>";
						echo "<div style=\"clear:both;\"></div>";
					}
				?>
				</div>
				</td>
			</tr>
		</table>
		<?php
	}
Пример #2
0
    /**
     * Generates the human readable allowed video formats string
     *
     * @return       $code
     */
	function generateVideoDetails($row, $player_width=null, $player_height=null, $thumb_width=null, $hwdvsItemid=null, $tooltip=null, $lightbox=null, $autoplay=null)
	{
		global $hwdvsItemid, $option, $mainframe, $smartyvs;
		$c = hwd_vs_Config::get_instance();
		$my = & JFactory::getUser();

		if (!isset($row->username)) { $row->username = ""; }
		if (!isset($row->name)) { $row->name = ""; }
		if (!isset($row->avatar)) { $row->avatar = null; }
		if ($c->cbint == 3) { $row->avatar = $row->username; }

		$quality = JRequest::getWord( 'quality', '' );
		if (empty($quality))
		{
			if ($c->usehq == "1" || $c->usehq == "3")
			{
				$quality = "hd";
			}
			else if ($c->usehq == "0" || $c->usehq == "2")
			{
				$quality = "sd";
			}
		}

		$details->id = intval($row->id);
		$details->titleText = stripslashes($row->title);
		$details->title = hwd_vs_tools::generateVideoLink( $row->id, $row->title, $hwdvsItemid, null, 10000 );
		$details->player = hwd_vs_tools::generateVideoPlayer($row, $player_width, $player_height, $autoplay, $quality);
		$details->videourl = hwd_vs_tools::generateVideoUrl($row);
		$details->embedcode = hwd_vs_tools::generateEmbedCode($row);
		$details->socialbmlinks = hwd_vs_tools::generateSocialBookmarks();
		$details->duration = $row->video_length;
		$details->ratingsystem = hwd_vs_tools::generateRatingSystem($row);
		$details->favouritebutton = hwd_vs_tools::generateFavouriteButton($row);
		$details->thumbnail = hwd_vs_tools::generateVideoThumbnailLink($row->id, $row->video_id, $row->video_type, $row->thumbnail, 0, $thumb_width, null, null, null, $hwdvsItemid, null, $tooltip, $lightbox);
		$details->avatar = hwd_vs_tools::generateAvatar($row->user_id, $row->avatar, 0);
		$details->category = hwd_vs_tools::generateCategoryLink($row->category_id);
		$details->description_truncated = hwd_vs_tools::truncateText($row->description, $c->trunvdesc);
		$details->rating = hwd_vs_tools::generateRatingImg($row->updated_rating);
		$details->deletevideo = hwd_vs_tools::generateDeleteVideoLink($row);
		$details->editvideo = hwd_vs_tools::generateEditVideoLink($row);
		$details->publishvideo = hwd_vs_tools::generatePublishVideoLink($row);
		$details->approvevideo = hwd_vs_tools::generateApproveVideoLink($row);
		$details->views = intval($row->number_of_views);
		$details->upload_date = strftime("%l%P - %b %e, %Y", strtotime($row->date_uploaded));
		$details->sendToFriend = hwd_vs_tools::sendToFriend($row);
		$details->uploader = hwd_vs_tools::generateUserFromID($row->user_id, $row->username, $row->name);
		$details->k = 0;

		$details->addtogroup = hwd_vs_tools::generateAddToGroupButton($row);
		$details->nextprev = hwd_vs_tools::generateNextPrevLinks($row);
		$details->switchquality = hwd_vs_tools::generateSwitchQuality($row);
		$details->downloadoriginal = hwd_vs_tools::generateDownloadVideoLink($row);
		$details->vieworiginal = hwd_vs_tools::generateViewOriginalLink($row);
		$details->reportmedia = hwd_vs_tools::generateReportMediaButton($row);
		$details->tags = hwd_vs_tools::generateTagListString($row->tags);
		$details->favourties = hwd_vs_tools::generateFavouriteButton($row);
		$details->addtoplaylist = hwd_vs_tools::generateAddToPlaylistButton($row);

		if ($option == "com_hwdvideoshare")
		{
			$details->comments = hwd_vs_tools::generateVideoComments($row);
		}

		if ($c->showdesc == "1")
		{
			$smartyvs->assign("print_description", 1);
			$details->description = stripslashes($row->description);

			//$item                 = JTable::getInstance('content');
			//$dispatcher           = JDispatcher::getInstance();
			//$params               = new JParameter('');
			//JPluginHelper::importPlugin('content');
			//$item->parameters     = new JParameter('');
			//$item->text           = $details->description;
			//// Apply content plugins to custom text
			//$results              = $dispatcher->trigger('onPrepareContent', array ($item, $params, 0));
			//$details->description = $item->text;
		}
		return $details;
    }