Esempio n. 1
0
    /**
     *
     */
    function viewPlaylist($row)
    {
    	global $mainframe, $Itemid, $smartyvs, $Itemid;
        $c = hwd_vs_Config::get_instance();

		// load the menu name
		jimport( 'joomla.application.menu' );
		$menu   = &JMenu::getInstance('site');
		$mparams = &$menu->getParams($Itemid);
		$mparams_pt	= $mparams->get( 'page_title', '');

		jimport( 'joomla.document.document' );
		$doc = & JFactory::getDocument();

		$active = &$menu->getActive();

		if (!empty($mparams_pt)) {
			$metatitle = $mparams_pt;
		} else if (!empty($active->name)) {
			$metatitle = $active->name;
		} else {
			$metatitle = _HWDVIDS_META_DEFAULT;
		}

        // decode
        $meta_title = html_entity_decode($row->playlist_name);
        // set the page/meta title
        $doc->setTitle( $metatitle." - "._HWDVIDS_META_EPL." - ".$meta_title );
        $doc->setMetaData( 'title' , $metatitle." - "._HWDVIDS_META_EPL." - ".$meta_title );
		hwd_vs_tools::generateActiveLink(1);
		hwd_vs_javascript::confirmdelete();
		hwd_vs_tools::generateBreadcrumbs();

		$smartyvs->assign("playlist_name", stripslashes($row->playlist_name));
		$smartyvs->assign("playlist_description", stripslashes($row->playlist_description));
		$smartyvs->assign("playlist_id", $row->id);

		$hwdvids_params['playlist']		= "pl_$row->id";
		$hwdvids_params['single_id']	= 0;
		$hwdvids_params['width'] 		= 320;
		$hwdvids_params['height'] 		= 240;
		$hwdvids_params['autostart'] 	= 1;
		$hwdvids_params['extended'] 	= 1;
		$hwdvids_params['showdetails'] 	= 1;
		$hwdvids_params['novtd'] 		= 10;

		$hwdvids_params['thumb_width'] 		= 60;
		$hwdvids_params['mod_hwd_itemid'] 	= 0;
		$hwdvids_params['trunc_title'] 		= '';
		$hwdvids_params['trunc_descr'] 		= '';
		$hwdvids_params['showtt'] 		    = '0';

		if ($hwdvids_params['mod_hwd_itemid'] == 0) {
			$hwdvids_params['mod_hwd_itemid'] = hwd_vs_tools::generateValidItemid();
		}

		require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'xml'.DS.'xmlparse.class.php');
		$parser = new HWDVS_xmlParse();
		$parsed_list = $parser->parse($hwdvids_params['playlist']);

		if (count($parsed_list) > 0)
		{
			$smartyvs->assign("vid", $parsed_list[0]['id']);

			$row->video_id = "";
			$row->video_type = "playlist";
			$row->playlist = JURI::base( true )."/components/com_hwdvideoshare/xml/xspf/".$hwdvids_params['playlist'].".xml";
			$video_player = hwd_vs_tools::generateVideoPlayer( $row, $hwdvids_params['width'], $hwdvids_params['height'], $hwdvids_params['autostart'] );

			if ($hwdvids_params['extended'] == 1)
			{
				$tooltip = 1;
				$list = hwd_vs_tools::generateVideoListFromXml($parsed_list, $hwdvids_params['thumb_width'], $hwdvids_params['mod_hwd_itemid'], $tooltip, $hwdvids_params['trunc_title'], $hwdvids_params['trunc_descr'], "hwdvs_insert_playlist_video");
				$smartyvs->assign("list", $list);
			}
		}
		else
		{
			hwd_vs_tools::infomessage(4, 0, "Empty playlist", "This playlist does not contactin any videos", "exclamation.png", 0);
			return;
		}

if ($hwdvids_params['extended'] == 1) {

	if ($hwdvids_params['showdetails'] == 1)
	{
		$showdetails = '&showdetails=1';
		$div_height = $hwdvids_params['height']+70;
	}
	else
	{
		$showdetails = '&showdetails=0';
		$div_height = $hwdvids_params['height']+70;
	}

	$showdetails.= '&width='.$hwdvids_params['width'].'&height='.$hwdvids_params['height'];

	$random = rand();
	$smartyvs->assign("print_extended", 1);
	$smartyvs->assign("random", $random);

	$hwdvs_ajax_video_js = "<script language=\"javascript\" type=\"text/javascript\">
			<!--
			//Browser Support Code
			function hwdvs_insert_playlist_video(video_id){

				var ajaxRequest;  // The variable that makes Ajax possible!

				document.getElementById('hwdvs_player_container".$random."').style.padding = \"0\";
				document.getElementById('hwdvs_player_container".$random."').style.margin = \"0\";
				document.getElementById('hwdvs_player_container".$random."').style.height = \"".$div_height."px\";
				document.getElementById('hwdvs_player_container".$random."').innerHTML = '<div style=\"padding:5px;\">Loading...<br /><img src=\"".JURI::root( true )."/plugins/community/hwdvideoshare/loading.gif\"></div>';

				try{
					// Opera 8.0+, Firefox, Safari
					ajaxRequest = new XMLHttpRequest();
				} catch (e){
					// Internet Explorer Browsers
					try{
						ajaxRequest = new ActiveXObject(\"Msxml2.XMLHTTP\");
					} catch (e) {
						try{
							ajaxRequest = new ActiveXObject(\"Microsoft.XMLHTTP\");
						} catch (e){
							// Something went wrong
							alert(\"Your browser broke!\");
							return false;
						}
					}
				}
				// Create a function that will receive data sent from the server
				ajaxRequest.onreadystatechange = function(){
					if(ajaxRequest.readyState == 4){
						document.getElementById('hwdvs_player_container".$random."').style.padding = \"0\";
						document.getElementById('hwdvs_player_container".$random."').style.margin = \"0\";
						document.getElementById('hwdvs_player_container".$random."').innerHTML = ajaxRequest.responseText;

						var theInnerHTML = ajaxRequest.responseText;
						var theID = 'hwdvs_player_container".$random."';
						setAndExecute(theID,theInnerHTML);
						var containerHeight = document.getElementById('hwdvs_player_container".$random."').offsetHeight;
						var calcHeight = containerHeight-40;
						document.getElementById('videoDetails').style.height = calcHeight+\"px\";
						document.getElementById('videoDetails').style.overflow = \"auto\";
					}
				}
				ajaxRequest.open(\"GET\", \"".JURI::root( true )."/index.php?option=com_hwdvideoshare&task=grabajaxplayer&Itemid=".$hwdvids_params['mod_hwd_itemid'].$showdetails."&template=mod_hwd_vs_video_playlist_container&tmpl=component&video_id=\" + video_id, true);
				ajaxRequest.send(null);

				function setAndExecute(divId, innerHTML)
				{
					var div = document.getElementById(divId);
					div.innerHTML = innerHTML;
					var x = div.getElementsByTagName(\"script\");
					for(var i=0;i<x.length;i++)
					{
						eval(x[i].text);
					}
				}
			}

			//-->
		 </script>";
	$doc->addCustomTag($hwdvs_ajax_video_js);
}

		$smartyvs->assign("hwdvids_params", $hwdvids_params);
		$smartyvs->assign("video_player", $video_player);
		$smartyvs->display('playlist_view.tpl');

		return;
    }