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

<?php include_once('__includedFiles/header_top_files.php');
 unset($_SESSION['nonewpredictions']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>365Hops</title>
<?php include_once('__includedFiles/dashboard_header.php');?>
<?php include_once('__includedFiles/dashboard_menu.php');?>
<?php $obj1=new Social();?>
<?php  $obj_frontc=new FrontController();
?>
<script> 
	FB.init({appId: "267984193361306", status: true, cookie: true});

   function postfbauto_review(pdid){
    var play_points=$("#play_points"+pdid+" option:selected").text();
    if($('#option1_'+pdid).is(':checked'))
	  {
	  var option_val=$('#option1_'+pdid).val();
	   }
	   else
	    {
	     var option_val=$('#option2_'+pdid).val();
	    }

    FB.getLoginStatus(function(response) {
    	//alert("checking status");
		if (response.status=="connected" && response.authResponse){
			//alert("logged in");
		 FB.api(
			  'me/threesixtyfivehops:make',
			  'post',
			  {
			     prediction: "http://www.365hops.com/social/predictions_share.php?id="+pdid+"&optionchoosed="+option_val+"&pointsplayed="+play_points
			  },respo );	 	
		}
	    else{
	         	alert("fb not logged in");
	    }
	 },true);
    }
    function respo(response) {
		    if (response){
				if (response.error){
					//alert(response.error.message);
					var fberror= "ERROR :"+response.error.message;
					alert(fberror);
				}				
			}
		  }

    </script>
<script type="text/javascript">
function submit_bid(pred_id)
 {
	<?php if($_SESSION['userid']!=''){?> 
	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');
			$('#btn_predict_'+pred_id).hide('fast');
			$('#loader_predict_'+pred_id).show('fast');
	        if($('#fb_share_review').is(':checked')){
			 postfbauto_review(pred_id);
			  }
			 //return false;
			 $.ajax({ 
               url:"prediction_ajax.php",
               type:"POST",
	           data:$("#bidform_"+pred_id).serialize(),
               success:function()
               { 
		         setTimeout( function(){ 
                    window.location='';
                    }, 3000 );
	       }
              }); 
		     }
			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;
			 }
	 }
	<? }else{ ?>
	 var page_url2p2=$(location).attr('href');
	     login_triger2(page_url2p2);
	  
<? }?>
	}

</script>
<link href="css/styles.css" rel="stylesheet" />
<div class="side_detail">
<?php include_once('__includedFiles/prediction_left.php');?>
        <div class="main_wrapper predictions">
    <?php include_once('__includedFiles/prediction_main_nav.php');?>
    <div style="clear:both"></div>
         <?php $predictionss=$obj1->predictions('0',$segmentid,'',$_SESSION['userid'],'time');
		      $no_of_prediction=count($predictionss);
		
		 ?>
            <div class="content_wrap" id="tab1_containerbox">
            <? if($no_of_prediction>0){
				foreach($predictionss as $prediction){
				?>
                <div class="row">
                    <div class="doublecolumn">
                        <center>
                            <table>
                                <tr>
                                    <td class="minicolumn"><img src="../admin/<?=$prediction['img1']?>" /></td>
                                    <td id="vs"><span>vs</span></td>
                                    <td class="minicolumn"><span><img src="../admin/<?=$prediction['img2']?>" /></span></td>
                                </tr>
                                <tr>
                                    <td><?=ucwords($prediction['option1'])?></td>
                                    <td></td>
                                    <td><span><?=ucwords($prediction['option2'])?></span></td>
                                </tr>

                                <tr class="currentbids">
                                    <td><span class="span1">Current Bids:</span></td>
                                    <td>
                                        <span class="span2">
                                            <?=$prediction['bidsofoption1']?>
                                        </span>
                                    </td>
                                    <td valign="middle">
                                        <span class="span3">
                                            <?=$prediction['bidsofoption2']?>
                                        </span>
                                    </td>
                                </tr>

                            </table>
                        </center>
                    </div>
                    <div class="singlecolumn">
                        <p class="line1"><?=$prediction['questions']?>?</p>
                        <div style="clear:both"></div>
                        <form class="form1" id="bidform_<?=$prediction['id']?>" action="" method="post" >
                        <input type="hidden" id="predictionid_<?=$prediction['id']?>"  name="predictionid" value="<?=$prediction['id']?>" />
                        <input type="hidden" id="segmentid_<?=$prediction['id']?>"  name="segmentid" value="<?=$prediction['segmentid']?>" />
                        <input type="hidden" name="Submit_Bid" id="Submit_Bid_<?=$prediction['id']?>" value="Ok" />
                         <input type="radio" name="option" id="option1_<?=$prediction['id']?>" value="1" /><?=$prediction['option1']?>
                         <input type="radio" name="option" id="option2_<?=$prediction['id']?>" value="2" /><?=$prediction['option2']?>
                        <input type="hidden" id="pdtitle_<?=$prediction['id']?>" value="<?=$prediction['title']?>" />
                         <input type="hidden" id="pddes_<?=$prediction['id']?>" value="<?=$prediction['questions']?>" />
                          <input type="hidden" id="pdimg_<?=$prediction['id']?>" value="<?=$prediction['img1']?>" />
                         <span class="error_predictions" id="options_error_<?=$prediction['id']?>">* required</span>
                         <br /><br />
                         
                            <center>
                                For:  <select name="play_points" id="play_points<?=$prediction['id']?>">
                                    <option value="">select</option>
                                    <?php for($i=5;$i<=$_SESSION['points'];$i=$i+5){?>
                                    <option value="<?=$i?>"><?=$i?></option>
                                    <? }?>
                                     </select><span class="error_predictions" id="play_points_error_<?=$prediction['id']?>">* required</span>
                            </center>
                        </form>
                        <center>
                        <?php if($prediction['closetime']!=''){?><a id="btn_predict_<?=$prediction['id']?>" href="javascript:void(0);" class="btn play" onClick="return submit_bid('<?=$prediction['id']?>');" >Play</a> <? }?>
                          <span style="display:none;" id="loader_predict_<?=$prediction['id']?>" ><img src="images/720gif.GIF" width="80" height="20" /></span>
                        </center>
                    
                    </div>
                    <div class="aftercolumns">
                    <?php $intersrname=$obj1->get_interest_by_id($prediction['segmentid']);  ?>
                        <p class="part1"><?=$intersrname['name']?></p>
                        <p class="part2"><?=$prediction['title']?></p>
                    </div>
                </div>

                <div class="content-padding"></div>
                 <? } }
                  else{?>
              
                <p class="norecord_error" >No record found...</p>
               
              <? }?>  
                </div>
            <!------ Tab 2-------->
            <div class="content_wrap" id="tab2_containerbox" style="margin-left:191px; display:none;">
           <?php $earlier_predictionss=$obj1->predictions('1',$segmentid,'','');
		      $no_of_earlierprediction=count($earlier_predictionss);
		    if($no_of_earlierprediction>0){
		     foreach($earlier_predictionss as $earlier_pre){?>
            <div class="row fivee">
                    <div class="doublecolumn">
                        <center>
                            <table>
                                <tbody><tr>
                                    <td class="minicolumn"><img src="../admin/<?=$earlier_pre['img1']?>"></td>
                                    <td id="vs"><span>vs</span></td>
                                    <td class="minicolumn"><span><img src="../admin/<?=$earlier_pre['img2']?>"></span></td>
                                </tr>
                                <tr>
                                    <td><?=$earlier_pre['option1']?></td>
                                    <td></td>
                                    <td><span><?=$earlier_pre['option2']?></span></td>
                                </tr>
                            </tbody></table>
                        </center>
                        <div class="subdc">
                        <?php $intersrname_earlie=$obj1->get_interest_by_id($earlier_pre['segmentid']);  ?>
                            <p class="part1"><?=$intersrname_earlie['name']?></p>
                            <p class="part2"><?=$earlier_pre['title']?></p>
                        </div>
<?php $result=$obj1->userpredictionresultByid($_SESSION['userid'],$earlier_pre['id']);
      $str_res_prediction='';
	  if(count($result)>0){ 
	     $str_res_prediction.='You Played '.$result['play_points'].' Points on ';
	       if($result['option']==1)
		      {
			    $str_res_prediction.=$earlier_pre['option1'];
			   }
			   else
			    {
				   $str_res_prediction.=$earlier_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;"><?=$earlier_pre['questions']?> </td></tr>
                            <tr ><td class="left country1" style="height:38px !important;"><?=$earlier_pre['option1']?> -  <?=$earlier_pre['bidsofoption1']?></td><td valign="bottom" class="right country"  style="height:38px !important;">Result : <?php if($earlier_pre['result']==1){ echo $earlier_pre['option1'];}elseif($earlier_pre['result']==2){ echo $earlier_pre['option2'];}elseif($earlier_pre['result']==3){echo 'Drawn';}else{ }?></td></tr>
                            <tr><td class="left country2"  style="height:38px !important;"><?=$earlier_pre['option2']?> -  <?=$earlier_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>   
              <? }} else{?>
              
                <p class="norecord_error" >No record found...</p>
               
              <? }?>  
                </div>
            <div class="content-padding"></div>
           
        </div>

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

,