Current Path : /var/www/html/social/
Upload File :
Current File : /var/www/html/social/yourpredictions.php

<?php include_once('__includedFiles/header_top_files.php');?>
<?php require "__dashboardconfig/session.php"; ?>
<?php include_once('__includedFiles/header_top.php');?>
<?php include_once('__includedFiles/dashboard_header.php');?>
<?php include_once('__includedFiles/dashboard_menu.php');?>
<?php $obj1=new Social();?>
<?php  $obj_frontc=new FrontController();
// Update_user Point();
?>
<script type="text/javascript">
function submit_bid(pred_id)
 {
	if(pred_id!=''){
	  if($('#option1_'+pred_id).is(':checked') || $('#option2_'+pred_id).is(':checked'))
	  {
	    $("#options_error_"+pred_id).hide('fast');
		  if($('#play_points'+pred_id).val()!='')
	       { 
		    $("#play_points_error_"+pred_id).hide('fast');
	         $.ajax({ 
               url:"prediction_ajax.php",
               type:"POST",
	           data:$("#bidform_"+pred_id).serialize(),
               success:function()
               { 
		       window.location='';
		       }
              }); 
		     }
			else{ 
			  $("#play_points_error_"+pred_id).show('fast');
		      $('#play_points'+pred_id).focus();
			  return false;
			 }
		}
		else{ 
			  $("#options_error_"+pred_id).show('fast');
		      $('#option1_'+pred_id).focus();
			  return false;
			 }
	 }
	}

</script>
 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    
<link href="css/styles.css" rel="stylesheet" />
<div class="side_detail">
<?php include_once('__includedFiles/prediction_left.php');?>
        <div class="main_wrapper">
    <?php include_once('__includedFiles/yourprediction_main_nav.php');?>
    <div style="clear:both"></div>
         
              <div class="content_wrap"  id="tab2_containerbox"  style="display:block;">
           <?php   $userearlier_predictionss=$obj1->usercurrentpredictions('1',$segmentid,'',$_SESSION['userid']);
		      $no_of_earlierprediction=count($userearlier_predictionss); 
			  
			  ?>
                <?php $userplayedPoints_array=$obj1->usertotalPlayedPoints($segmentid,$_SESSION['userid']);
				     if(count($userplayedPoints_array)>0)
					 {
					  if($userplayedPoints_array['total_points']!=''){
					     $userplayedPoints=$userplayedPoints_array['total_points'];
					    }else{$userplayedPoints=0;}
						 if($userplayedPoints_array['total_gained']!=''){
					  $userwonPoints=$userplayedPoints_array['total_gained'];
					  }else{$userwonPoints=0;}	
					   if($userplayedPoints_array['total_lost']!=''){
					  $userlostPoints=$userplayedPoints_array['total_lost'];
					  }else{$userlostPoints=0;}	 
					 }
					 else
					 {
						 $userplayedPoints=0;
						  $userwonPoints=0;
						  $userlostPoints=0;
						 }
						
					 ?>
                <div class="row one">
                    <div class="column">
                        <img src="images_new/predictions/playing-points.png" />
                        <p><?=round($userplayedPoints,2);?></p>
                        <div style="clear:both"></div>
                        <span class="view_type1">Points You Played So Far</span>
                    </div>
                    <div class="column">
                        <img src="images_new/predictions/won.png" />
                        <p><?=round($userwonPoints,2);?></p>
                        <div style="clear:both"></div>
                        <center><span class="view_type2">WON</span></center>
                    </div>
                    <div class="column">
                        <img src="images_new/predictions/lost.png" />
                        <p><?=round($userlostPoints,2);?></p>
                        <div style="clear:both"></div>
                        <center><span class="view_type2">LOST</span></center>
                    </div>
                </div>

                <div class="content-padding"></div>
<?php if($no_of_earlierprediction>0){ if($segmentid==''){
	$bestPred=$obj1->bestPredictedsegment($_SESSION['userid']);
	 if($bestPred['tonum']!='')
	 {
	  $bestPredictions=$bestPred['tonum'];
	  $bestpredictedseg=$bestPred['segmentid'];
	   $besttotal_of_segment=$bestPred['total_of_segment'];
	  $percentageofwinning=round(($bestPredictions/$besttotal_of_segment)*100,2);
	  $winingClass=$obj1->convert_number_to_words($percentageofwinning);
	  $bestsegname=$obj1->get_interest_by_id($bestpredictedseg); 
	 }
	 // Worst//
	 $worstPred=$obj1->worstPredictedsegment($_SESSION['userid']);
	 if($worstPred>0){
	      list($key, $value)=each($worstPred);
	  $worstPredictions=$value;
	  $worstpredictedseg=$key;
	  $worstsegname=$obj1->get_interest_by_id($worstpredictedseg); 
	  $worstplayed_num=$obj1->totalplayedinsegmentbyId($_SESSION['userid'],$worstpredictedseg);
	  
	    $wrostwiningClass=$obj1->convert_number_to_words($worstPredictions);
	  }
	// OverAll
        $yourtotalWins=$obj1->UseroverallWins($_SESSION['userid'],''); 
		$yourtotalLosses=$obj1->UseroverallLosses($_SESSION['userid'],'');
		
				 $yourtotalPlayed=$yourtotalWins+$yourtotalLosses;
				if($yourtotalPlayed>0)
				  {
					$youroveralltotalwininfPercent=round(($yourtotalWins/$yourtotalPlayed)*100,2);
					
					}
					else
					{
				     $youroveralltotalwininfPercent=0;
					 
					}
	
		$overallwiningClass=$obj1->convert_number_to_words($youroveralltotalwininfPercent);
	?>
              <script type="text/javascript">
              google.load("visualization", "1", {packages:["corechart"]});
               /********** Best Graph*************/
			   google.setOnLoadCallback(drawChart);
               function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Winning', 'Persentage'],
          ['<?=$bestsegname['name']?>(<?=$percentageofwinning?>%)', <?=$percentageofwinning?>],
          ['',  <?=(100-$percentageofwinning)?>]
        ]);

      var options = {
        legend: 'none',
		pieSliceText: 'label',
        backgroundColor:'none',
		pieSliceBorderColor:"transparent",
		colors:['#090','#FF0000'],
		pieStartAngle: 100,
		width: 180,
		height: 180,
      };

        var chart = new google.visualization.PieChart(document.getElementById('piechart1'));
        chart.draw(data, options); 
      }
	         /********* Wrost Graph*********/
	     google.setOnLoadCallback(drawChart2);
               function drawChart2() {
        var data2 = google.visualization.arrayToDataTable([
           ['Winning', 'Persentage'],
          ['<?=$worstsegname['name']?>(<?=$worstPredictions?>%)', <?=$worstPredictions?>],
          ['',  <?=(100-$worstPredictions)?>]
        ]);

      var options2 = {
        legend: 'none',
        pieSliceText: 'label',
		pieSliceBorderColor:"transparent",
		colors:['#090','#FF0000'],
        backgroundColor:'none',
		pieStartAngle: 100,
		width: 180,
		height: 180,
      };

        var chart2 = new google.visualization.PieChart(document.getElementById('piechart2'));
        chart2.draw(data2, options2); 
      }
             
			 /********* Overall Graph*********/
	     google.setOnLoadCallback(drawChart3);
               function drawChart3() {
        var data3 = google.visualization.arrayToDataTable([
          ['Winning', 'Persentage'],
          ['overall(<?=$youroveralltotalwininfPercent?>%)', <?=$youroveralltotalwininfPercent?>],
          ['',  <?=(100-$youroveralltotalwininfPercent)?>]
        ]);

      var options3 = {
        legend: 'none',
        pieSliceText: 'label',
        backgroundColor:'none',
		pieSliceBorderColor:"transparent",
		colors:['#090','#FF0000'],
		pieStartAngle: 100,
		width: 180,
		height: 180,
      };

        var chart3 = new google.visualization.PieChart(document.getElementById('piechart3'));
        chart3.draw(data3, options3); 
      }
             
			   </script>
                <div class="row two">
                    <span class="view_type3">Predictions</span>
                </div>

                <hr class="urpredictionshr" />

                <div class="row three">
                    <div class="column">
                      <!--  <div class="pie green <?=$winingClass?>">
                        <p ><?=$percentageofwinning?>%</p>
                        </div>-->
                        <div id="piechart1" style="margin:-28px 0 -25px -27px"></div>
                        <div style="clear:both"></div>
                        <ul>
                            <li class="top">Best</li>
                            <li class="bottom"><?=$bestsegname['name']?>(<?=$besttotal_of_segment?>)</li>
                        </ul>
                    </div>
                    <div class="column">
                        <!--<div class="pie blue <?=$wrostwiningClass?>">
                            <p><?=$worstPredictions?>%</p>
                        </div>-->
                         <div id="piechart2" style="margin:-28px 0 -25px -27px"></div> 
                        <div style="clear:both"></div>
                        <ul>
                            <li class="top">Worst</li>
                            <li class="bottom"><?=$worstsegname['name']?>(<?=$worstplayed_num?>)</li>
                        </ul>
                    </div>
                    <div class="column">
                        <!--<div class="pie red <?=$overallwiningClass?>">
                            <p><?=$youroveralltotalwininfPercent?>%</p>
                        </div>-->
                        <div id="piechart3" style="margin:-28px 0 -25px -27px"></div>
                        <div style="clear:both"></div>
                        <ul>
                            <li class="top">All</li>
                            <li class="bottom">Select Sport(<?=$yourtotalPlayed?>)</li></li>
                        </ul>
                    </div>
                </div>
<? } }?>
                <div class="content-padding"></div>

                <div class="row four" style="">

                    <span class="view_type3">Predictions</span>

                    <span class="view_type3" style="float:right;">Earned Money</span>


                </div>

                <hr class="urpredictionshr" />

                <div class="content-padding"></div>
               <?php $current_predictionss=$obj1->usercurrentpredictions('0',$segmentid,'',$_SESSION['userid']);
		      $no_of_currentprediction=count($current_predictionss);
		    if($no_of_currentprediction>0){
		     foreach($current_predictionss as $current_pre){?>
               <div class="row fivee">
                    <div class="doublecolumn">
                        <center>
                            <table>
                                <tbody><tr>
                                    <td class="minicolumn"><img src="../admin/<?=$current_pre['img1']?>" /></td>
                                    <td id="vs"><span>vs</span></td>
                                    <td class="minicolumn"><span><img src="../admin/<?=$current_pre['img2']?>"></span></td>
                                </tr>
                                <tr>
                                    <td><?=$current_pre['option1']?></td>
                                    <td></td>
                                    <td><span><?=$current_pre['option2']?></span></td>
                                </tr>
                            </tbody></table>
                        </center>
                        <div class="subdc">
                        <?php $intersrname_earlie=$obj1->get_interest_by_id($current_pre['segmentid']);  ?>
                            <p class="part1"><?=$intersrname_earlie['name']?></p>
                            <p class="part2"><?=$current_pre['title']?></p>
                        </div>
<?php $result=$obj1->userpredictionresultByid($_SESSION['userid'],$current_pre['id']);
      $str_res_prediction='';
	  //print_r($result);
	  if(count($result)>0){ 
	     $str_res_prediction.='You Played '.$result['play_points'].' Points on ';
	       if($result['option']==1)
		      {
			    $str_res_prediction.=$current_pre['option1'];
			   }
			   else
			    {
				   $str_res_prediction.=$current_pre['option2'];
				   }
		     }
		  else{$str_res_prediction.='&nbsp;';}
 ?>
                        <table class="result" style="height:80px !important;">
                            <tbody>
                            <tr ><td class="left country1" colspan="2" style="height:38px !important;"><?=$current_pre['questions']?> </td></tr>
                            <tr ><td class="left country1" style="height:38px !important;"><?=$current_pre['option1']?> -  <?=$current_pre['bidsofoption1']?></td><td valign="bottom" class="right country"  style="height:38px !important;">Result : <?php if($current_pre['result']==1){ echo $current_pre['option1'];}elseif($current_pre['result']==2){ echo $current_pre['option2'];}elseif($current_pre['result']==3){echo 'Drawn';}else{ echo 'Not declared yet'; }?></td></tr>
                            <tr><td class="left country2"  style="height:38px !important;"><?=$current_pre['option2']?> -  <?=$current_pre['bidsofoption2']?></td><td valign="top" class="right points"  style="height:38px !important;"><?=$str_res_prediction?></td></tr>
                        </tbody></table>

                    </div>
                </div>

                <div class="content-padding"></div>
                <? }}?>
              
                 
<?php 
		    if($no_of_earlierprediction>0){
		     foreach($userearlier_predictionss as $userearlier_pre){?>

                <div class="row fivee">
                    <div class="doublecolumn">
                        <center>
                            <table>
                                <tr>
                                    <td class="minicolumn"><img src="../admin/<?=$userearlier_pre['img1']?>" /></td>
                                    <td id="vs"><span>vs</span></td>
                                    <td class="minicolumn"><span><img src="../admin/<?=$userearlier_pre['img2']?>" /></span></td>
                                </tr>
                                <tr>
                                    <td><?=$userearlier_pre['option1']?></td>
                                    <td></td>
                                    <td><span><?=$userearlier_pre['option2']?></span></td>
                                </tr>
                            </table>
                        </center><?php $segmnene=$obj1->get_interest_by_id($userearlier_pre['segmentid']); ?>
                        <div class="subdc">
                            <p class="part1"><?=$segmnene['name']?></p>
                            <p class="part2"><?=$userearlier_pre['title']?></p>
                        </div>
<?php $result2=$obj1->userpredictionresultByid($_SESSION['userid'],$userearlier_pre['id']);
      $str_res_prediction2='';
	  if(count($result2)>0){ 
	     $str_res_prediction2.='You Played '.$result2['play_points'].' Points on ';
	       if($result2['option']==1)
		      {
			    $str_res_prediction2.=$userearlier_pre['option1'];
			   }
			   else
			    {
				   $str_res_prediction2.=$userearlier_pre['option2'];
				   }
		     }
		  else{$str_res_prediction2.='&nbsp;';}
 ?>
                        <table class="result">
                        <tr ><td class="left country1" colspan="2" style="height:38px !important;"><?=$userearlier_pre['questions']?> </td></tr>
                            <tr><td class="left country1"><?=$userearlier_pre['option1']?> - <?=$userearlier_pre['bidsofoption1']?></td><td valign="bottom" class="right country">Result : <?php if($userearlier_pre['result']==1){ echo $userearlier_pre['option1'];}elseif($userearlier_pre['result']==2){ echo $userearlier_pre['option2'];}elseif($userearlier_pre['result']==3){ echo 'Drawn';}else{ echo 'Drawn';}?></td></tr>
                            <tr><td class="left country2"><?=$userearlier_pre['option2']?> - <?=$userearlier_pre['bidsofoption2']?></td><td valign="top" class="right points"><?=$str_res_prediction2?></td></tr>
                        </table>

                    </div>

                    <table class="output" style="height:310px">
                        <tr>
                            <td><img src="images_new/predictions/arrow-icon.png" /></td>
                            <td align="center">
                                <div class="circle" <?php if($result2['lost']!=0){ echo 'style="background-color:#F00 !important";'; }?> >
                                    <p><?php if($result2['lost']!=0){echo '-'.$result2['lost'];} else{ echo round($result2['gained'],2);}?></p>
                                </div>
                            </td>
                        </tr>
                    </table>

                </div>

                <div class="content-padding"></div>
               <? }}?>
     
       
            </div>
                 
           <div class="content-padding"></div>
           
        </div>

    </div>
<div class="clear"></div>
<?php include_once('__includedFiles/dashboard_footer.php');?>

,