Beispiel #1
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function grabAjaxPlayer()
	{
		global $Itemid, $smartyvs, $hwdvs_selectv, $hwdvs_joinv, $mainframe, $hwdvsAjaxPlayer;

		header('Content-type: text/html; charset=utf-8');

		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$acl= & JFactory::getACL();
		$usersConfig = &JComponentHelper::getParams( 'com_users' );

		$video_id = JRequest::getInt( 'video_id', 0 );
		$template = JRequest::getVar( 'template', '' );
		$showdetails = JRequest::getInt( 'showdetails', '1' );
		$width = JRequest::getInt( 'width', null );
		$height = JRequest::getInt( 'height', null );
		$quality = JRequest::getWord( 'quality', 'hd' );
		$autostart = JRequest::getInt( 'autostart', null );
		$hwdvsAjaxPlayer = true;

		if (!hwd_vs_access::allowAccess( $c->gtree_plyr, $c->gtree_plyr_child, hwd_vs_access::userGID( $my->id ))) {
			if ( ($my->id < 1) && (!$usersConfig->get( 'allowUserRegistration' ) == '0' && hwd_vs_access::allowAccess( $c->gtree_upld, 'RECURSE', $acl->get_group_id('Registered','ARO') ) ) ) {
				hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORPLYR, "exclamation.png", 0, 0);
				exit;
			} else {
				hwd_vs_tools::infomessage(1, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_PLYR_NOT_AUTHORIZED, "exclamation.png", 0, 0);
				exit;
			}
		}

        $where = ' WHERE video.id = '.$video_id;

		$query = "SELECT".$hwdvs_selectv." FROM #__hwdvidsvideos AS video ".$hwdvs_joinv." ".$where;
        $db->SetQuery($query);
        $row = $db->loadObject();

		if (!hwd_vs_tools::validateVideoAccess($row))
		{
			exit;
		}

		hwd_vs_tools::logViewing($row->id);
		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'maintenance_recount.class.php');

		if ($showdetails == 1) {
			$smartyvs->assign("showdetails", 1);
		}

		$videoplayer = hwd_vs_tools::generateVideoDetails($row, $width, $height, null, $Itemid, null, null, $autostart);
		$smartyvs->assign("videoplayer", $videoplayer);
		hwd_vs_javascript::ajaxRate($row);

		if (empty($template) || $template == '') {
			$html = $smartyvs->fetch('plug_jomsocial_ajax.tpl');
		} else if ($template == 'playeronly') {
			$html = $videoplayer->player;
		} else {
			$html = $smartyvs->fetch($template.'.tpl');
		}

		print $html;
		exit;
	}
    /**
     * Generates the video Rating System
     *
     * @param array  $row  the video sql data
     * @return       $code
     */
	function generateRatingSystem($row)
	{
		global $mainframe, $hwdvsItemid, $smartyvs;
		$c = hwd_vs_Config::get_instance();
		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'js.php');

		$rand = rand();
		$code = null;

		hwd_vs_javascript::ajaxRate($row);

		if ( $row->allow_ratings == 1 && $c->showrate == 1)
		{
			if ($row->rating_number_votes < 1)
			{
				$count = 0;
			}
			else
			{
				$count = $row->rating_number_votes; //how many votes total
			}
			$tense = ($count==1) ? _HWDVIDS_INFO_M_VOTE : _HWDVIDS_INFO_M_VOTES; //plural form votes/vote

			$rating0 = @number_format($row->rating_total_points/$count,0);
			$rating1 = @number_format($row->rating_total_points/$count,1);

			$code='<div id="hwdvsrb'.$rand.'">
			         <ul id="1001" class="rating rated'.$rating0.'star">
			           <li id="1" class="rate one"><a href="'.JRoute::_("index.php?option=com_hwdvideoshare&task=rate&videoid='.$row->id.'&rating=1").'" onclick="ajaxFunctionRate(1, '.$row->id.', '.$rand.');return false;" title="'._HWDVIDS_RATE_1STAR.'" rel="nofollow">1</a></li>
			           <li id="2" class="rate two"><a href="'.JRoute::_("index.php?option=com_hwdvideoshare&task=rate&videoid='.$row->id.'&rating=2").'" onclick="ajaxFunctionRate(2, '.$row->id.', '.$rand.');return false;" title="'._HWDVIDS_RATE_2STAR.'" rel="nofollow">2</a></li>
			           <li id="3" class="rate three"><a href="'.JRoute::_("index.php?option=com_hwdvideoshare&task=rate&videoid='.$row->id.'&rating=3").'" onclick="ajaxFunctionRate(3, '.$row->id.', '.$rand.');return false;" title="'._HWDVIDS_RATE_3STAR.'" rel="nofollow">3</a></li>
			           <li id="4" class="rate four"><a href="'.JRoute::_("index.php?option=com_hwdvideoshare&task=rate&videoid='.$row->id.'&rating=4").'" onclick="ajaxFunctionRate(4, '.$row->id.', '.$rand.');return false;" title="'._HWDVIDS_RATE_4STAR.'" rel="nofollow">4</a></li>
			           <li id="5" class="rate five"><a href="'.JRoute::_("index.php?option=com_hwdvideoshare&task=rate&videoid='.$row->id.'&rating=5").'" onclick="ajaxFunctionRate(5, '.$row->id.', '.$rand.');return false;" title="'._HWDVIDS_RATE_5STAR.'" rel="nofollow">5</a></li>
			         </ul>
			       <div>'._HWDVIDS_INFO_RATED.'<strong> '.$rating1.'</strong> ('.$count.' '.$tense.')</div>
			       <!--<script>
                   $$(\'.rate\').each(function(element,i){
                   element.addEvent(\'click\', function(){
                   var myStyles = [\'0star\', \'1star\', \'2star\', \'3star\', \'4star\', \'5star\'];
                   myStyles.each(function(myStyle){
                   if(element.getParent().hasClass(myStyle)){
                   element.getParent().removeClass(myStyle)
                   }
                   });
                   myStyles.each(function(myStyle, index){
                   if(index == element.id){
                   element.getParent().toggleClass(myStyle);
                   }
                   });
                   });
                   });
                   </script>-->
			       </div>';

		}
		return $code;
    }