Пример #1
0
 public static function track($user_id = 0, $event = '', $props = array())
 {
     // an event is required
     if ($event == '') {
         return;
     }
     if (!$user_id && is_user_logged_in()) {
         $user_id = get_current_user_id();
     }
     // A user is necessary
     if (!$user_id) {
         return;
     }
     self::load_segment_api();
     Analytics::track(array('userId' => $user_id, 'event' => $event, 'properties' => $props));
 }
Пример #2
0
	function init() {
		$return = false;

		$source = $this->input->get('src');
		if( $source && !$this->session->userdata('user_source_id') ) {
			$data = array();
			$data['source_id'] = $source;
			$data['source_sub_id'] = $this->input->get('sub');
			$data['timestamp'] = time();

			$this->db->insert('user_source', $data);
			$user_source_id = $this->db->insert_id();
			
			$this->session->set_userdata('user_source_id', $user_source_id);
			
			$this->load->model('users');
			Analytics::track( $this->users->id(), "Source", array('src' => $source, 'sub' => $this->input->get('sub')) );
			
			$return = true;
		}

		return $return;
	}
Пример #3
0
 /**
  * Track what people are doing on your website.
  * 
  * @param array $track				The array of group data for Segment's \Analytics::track()
  * @param bool $js					Set this to generate the content as JS once you run render()
  * @param array $js_options			The array of options to set for the JS "options" parameter - "integrations"
  * 									options get specified in $track, but may be overridden here.
  * @param string $js_callback		If you want to use a callback function with "track," specify it here.
  * @param bool $noninteraction		Set this variable to true to tell Google Analytics that the event is a
  * 									non-interaction event.
  * 
  * @return mixed True or false depending on if the PHP version succeeded, or the JS code if we compiled the JS code
  */
 public function track(array $track, $js = true, array $js_options = array(), $js_callback = null, $noninteraction = true)
 {
     // Set the userId or anonymousId if userId is missing.
     $this->_set_identity($track);
     // Add the context data.
     $track = \Arr::merge($this->_get_context($js), $track);
     // If we're processing noninteractive calls through Google Analytics...
     if ($noninteraction === true) {
         if (empty($track['properties'])) {
             $track['properties']['nonInteraction'] = 1;
         } else {
             $track['properties'] = \Arr::merge(array('nonInteraction' => 1), $track['properties']);
         }
     }
     if ($js !== true) {
         return \Analytics::track($track);
     } else {
         // Event
         $js_params[] = "'" . $track['event'] . "'";
         // Properties
         $js_params[] = !empty($track['properties']) ? json_encode($track['properties']) : "{}";
         // Integrations and options
         $js_params[] = $this->_set_js_options($js_options, $track);
         // Callback function
         $js_params[] = !empty($js_callback) ? $js_callback : "null";
         // Add it to the queue.
         return $this->_js_scripts['track'][] = "analytics.track(" . implode(',', $js_params) . ");";
     }
 }
Пример #4
0
	function process_ajax(){
		$this->load->model('tracked_events');
		$this->load->library('authnet_aim');
		$post_data=$this->input->post();
		$user_id=$this->input->post('user_id');
		if(!empty($post_data)){
			//echo "<pre>".print_R($post_data,true)."</pre>";
			$gateway=$this->payments->get_gateway_by_system_name('authnet');
			$method=$this->payments->get_method_by_gateway_id($gateway->cid);
			$methodx=json_decode($method->data);

			$payment_data=array(
				"x_login"=>$methodx->api_login,
				"x_tran_key"=>$methodx->api_key,
				"x_type"=>"AUTH_CAPTURE",
				"x_amount"=>$this->input->post('amount'),
				"x_card_num"=>str_replace(" ","",$this->input->post('cc_num')),
				"x_exp_date"=>str_replace(" ","",$this->input->post('cc_exp')),
				"x_card_code"=>$this->input->post('cc_security'),
				"x_description"=>"Deposit $".$this->input->post('amount'),				
				"x_first_name"=>$this->input->post('first_name'),
				"x_last_name"=>$this->input->post('last_name'),
				"x_zip"=>$this->input->post('zip'),
			);
			//echo "<pre>".print_R($payment_data,true)."</pre>";
			foreach($payment_data as $k=>$v) $this->authnet_aim->add_field($k,$v);
			//$this->authnet_aim->set_test();
			$response_id=$this->authnet_aim->process();

			if($response_id == 1){
				$response=$this->authnet_aim->response;
				
				//Add transaction to the payment log
				$payment_log=array(
					'user_id'=>$user_id,
					'trans_id'=>$response['Transaction ID'],
					'amount'=>$response['Amount'],
					'type'=>1,
					'status'=>1,
					'approval_code'=>$response['Approval Code'],
					'product_id'=>$this->input->post('item_id'),
					'time'=>time(),
					'method_id'=>$method->cid,
					'raw_return_data'=>json_encode($response)
				);
				
				$this->db->insert('payments',$payment_log);
				$payment_id = $this->db->insert_id();
				
				//integrate with user_funds plugin
				$this->load->model('user_funds');
				//add transaction
				//$product_data=json_decode($product->extradata);
				$this->user_funds->add_payment($user_id, $response['Amount'], $payment_id);
				$this->user_funds->apply_sign_up_promos($user_id, $response['Amount']);
				//add promo code stuff
				$promo_code=$this->input->post('promo_code');
				if(isset($promo_code) && !empty($promo_code)){
					if($debug) $debug_mail.="made it to the model function with ".$user_id.",".$promo_code.",".$response['Amount']."\n\n";
					$this->user_funds->apply_promo($user_id,$promo_code,$response['Amount']);
				}
				
				if( ! $this->tracked_events->check(3, $this->users->id()) ) {
					$this->tracked_events->tracked(3, $this->users->id());
					Analytics::track( $this->users->id(), "First time added funds", array('revenue' => $response['Amount']) );
				}else {
					$this->tracked_events->add(4, $this->users->id());
					Analytics::track( $this->users->id(), "Other time added funds", array('revenue' => $response['Amount']) );
				}
				
				$this->session->set_userdata('amount_deposit', $response['Amount']);
				echo json_encode(array("status"=>"tiptop"));
			}else{
				$response_reason=$this->authnet_aim->get_response_reason_text();
				$this->session->set_flashdata('error',$response_reason);
				echo json_encode(array("status"=>"bogus","message"=>$response_reason));
			}			
		}else{
			$this->session->set_flashdata('error','There was an error proccessing your payment, please try again.');
			echo json_encode(array("status"=>"bogus","message"=>"There was an error proccessing your payment, please try again."));
		}
	}	
Пример #5
0
	function player_select($league_id = '', $team_id = ''){
		$this->load->model('tracked_events');
		$this->load->model('events');
		date_default_timezone_set('America/Detroit');
		$this->load->helper(array('form', 'url', 'cookie'));
		$this->load->library('form_validation');
		$this->form_validation->set_error_delimiters('<p class="help-block">', '</p>');
		$this->load->model('teams');
		$data['lang'] = 'english';
		$data['theme'] = $this->options->get('theme');
		$data['title'] = vlang('league_player_select_title');
		$data['user'] = $this->users->get_by_id($this->users->id());
		$data['user_can_edit'] = $user_can_edit = 0;
		$data['ticket_types'] = $this->config->item('ticket_types');
		$data['user_balance'] = $data['balance'] = $this->user_funds->user_balance($this->users->id());
		$existing_league_team = '';
		
		
		if($this->users->is_loggedin() === TRUE) {
			$this->users->auth_check();
		}
		
		if($league_id == ''){
		$data_from_create = unserialize(get_cookie('leaguedata', TRUE));
		$sport = strtolower($data_from_create['sport']);
		}
		
		if( $team_id == 'welcome' || $team_id == '') {
			$team_id = $data['team_id'] = null;
		}else {	
			$data['team_id'] = $team_id;
		}
		
		$edit=false;
		if(!empty($team_id)){
			$this->session->unset_userdata('temp_league_team');
			$edit=true;
		}
		
		if ($data['user']->activation_code == 'mailchimp'){
			$this->load->model('mailchimp');
			$this->config->load('mailchimp');
			$main_list=$this->config->item('mailchimp_main_list');
			$member_info=$this->mailchimp->lists_member_info($main_list,$data['user']->email);
			if(isset($member_info->data[0]->status) && in_array($member_info->data[0]->status,array("subscribed","unsubscribed"))){
				$this->db->where('cid',$data['user']->cid)->update('users',array('activation_code'=>''));
			}
		}
		
		$email_confirmation=$this->options->get('email_confirmation');
		if($edit!=true && !empty($data['user']->activation_code) && $email_confirmation==1){
			$this->session->set_flashdata('error','You must validate your email before you can join any games');
			
			redirect('lobby');
		}
		
		if(!empty($league_id)){
			//either joining or editing
			$league_info=(array)$this->leagues->get_by_id($league_id);
			if(empty($team_id)){
				//if this game is password protected make sure right password has been entered
				$session_pass=$this->session->userdata('league_passwords');
				if((!empty($league_info['password']) && (!isset($session_pass[$league_info['cid']]) || (isset($session_pass[$league_info['cid']]) && $session_pass[$league_info['cid']]!=$league_info['password'])))){
					$this->session->set_flashdata('error','This game is password protected');
					redirect('lobby');
					exit;
				}
			}
			//check if it's okay to start making rosters yet
			//if($league_info !== FALSE && $league_info['first_game_cutoff']>time()+(2*86400)){
			if($league_info !== FALSE && $league_info['early_reg']==1){
				if(!empty($team_id)) {
					$this->session->set_flashdata('error','You are not allowed to set rosters yet.');
					redirect('lobby');
				}
			}
			//no league found - offer user to create one
			if ($league_info === FALSE || (isset($league_info[0]) && $league_info[0] === FALSE)){
				$this->session->set_flashdata('error',vlang('league_player_select_league_not_found'));
				redirect('league/create');
				exit;
			}elseif(isset($league_info['cid'])){
				$league_info['id'] = $league_info['cid'];
			}
			
			if($league_info["finalized"]==1 || ($edit==false && $league_info['first_game_cutoff'] < time())) {
				$this->session->set_flashdata('error',vlang('league_player_select_league_expired'));
				redirect('league/create');
			}
			
			if($league_info["multi_entry"]==1){
				//first try to grab the correct team, if there's no team specified then the user is trying to create a new one
				if(!empty($team_id)) $league_team = $this->leagues->get_league_team(array('user_id' => $this->users->id(),'league_id' => $league_id,"id"=>$team_id));
				else $league_team = false;
			}else{
				//no need to bother with the team id stuff,
				$league_team = $this->leagues->get_league_team(array('user_id' => $this->users->id(),'league_id' => $league_id));
			}
			
			if($league_team!=false) $data['user_can_edit'] = $user_can_edit = 1;
			
			$players=$this->input->post('players');
			
			if(!empty($players)){
				//keep team info in case of error/redirect/exit/etc
				$old_team=$this->session->userdata('temp_league_team');
				if(isset($old_team['temp_id'])) {
				//get rid of users old temp data if exists
				$this->db->delete('league_temp',array('id'=>$old_team['temp_id']));
				}
				//put the new roster into a temp table
				$temp_roster=json_encode($players);
				$created=time();
				$rdata = array('roster'=>$temp_roster,'league_id'=>$league_id,'created'=>$created);
				
				$this->db->insert('league_temp',$rdata);
				$temp_id = $this->db->insert_id();
				$temp_league_team = array(
					"temp_id"=>$temp_id,
					"temp_created"=>$created,
					"temp_league_uri"=>$_SERVER['REQUEST_URI']
				);
				
				//set some session data so this works for both logged in/logged out(invited) users
				$this->session->set_userdata('temp_league_team', $temp_league_team);
			}

			//see if user has a temp league team from error/redirect/whatever
			$temp_team=$this->session->userdata('temp_league_team');

			if(!empty($temp_team) && isset($temp_team['temp_id']) && isset($temp_team['temp_created'])) {
				$this->db->where('id',$temp_team['temp_id']);
				$this->db->where('created',$temp_team['temp_created']);
				$tquery=$this->db->get('league_temp');

				if($tquery->num_rows() > 0) {
					$trow = $tquery->row_object();					
					$temp_team_league = $trow->league_id;
					$temp_team_roster = $trow->roster;
					
					if($temp_team_league == $league_id) {
						if(!empty($temp_team_roster)){					
						    if( ! $league_team ){
    							
								$league_team->roster = $temp_team_roster;
								$data['existing_league_team'] = $existing_league_team = $league_team;
							}
						}
					}
				}
				
			} elseif(empty($temp_team) && $league_id != "" && $team_id != ""){
    			$this->db->where('id',$team_id);
				$this->db->where('league_id',$league_id);
				$this->db->limit(1);
				$tquery=$this->db->get('league_temp');
                
				if($tquery->num_rows() > 0) {
					$trow = $tquery->row_object();					
					$temp_team_league = $trow->league_id;
					$temp_team_roster = $trow->roster;
					
					if($temp_team_league == $league_id) {
						if(!empty($temp_team_roster)){					
						    if( ! $league_team ){
    							
								$league_team->roster = $temp_team_roster;
								$data['existing_league_team'] = $existing_league_team = $league_team;
							}
						}
					}
				}

			}
			
			
			//If user logged in and match is multi-entry
			if ($league_team === FALSE && $this->users->is_loggedin() && $league_info['multi_entry']==1){
				$league_team = new stdClass;
				$league_team->id = 'new';
				$league_team->user_id = $this->users->id();
				$league_team->created = 0;
				$league_team->roster = '{}';
			}

			//If user not logged in (invited) - offer to create a line up first, then require them to register
			if ($league_team === FALSE && $this->users->is_loggedin() === FALSE && $this->session->userdata('is_invite') == 'yes'){
				$league_team = new stdClass;
				$league_team->id = 'new';
				$league_team->user_id = 'new';
				$league_team->created = 0;
				$league_team->roster = '{}';
			}
			
			//If user not logged in (invited) - offer to create a line up first, then require them to register
			if ($league_team === FALSE && $this->users->is_loggedin() === FALSE){
				$league_team = new stdClass;
				$league_team->id = 'new';
				$league_team->user_id = 'new';
				$league_team->created = 0;
				$league_team->roster = '{}';
			}
			
			//If user logged in and invited to private league -- let them in
			if ($this->users->is_loggedin() && $league_team === FALSE && isset($league_info['visibility']) && $league_info['visibility'] == 'private' && $this->session->userdata('is_invite') == 'yes'){
				$league_team = new stdClass;
				$league_team->id = 'new';
				$league_team->user_id = $this->users->id();
				$league_team->created = 0;
				$league_team->roster = '{}';
			}

			//If user not logged in and not invited, boot them to the login screen
/*
			if ($league_team === FALSE && $this->users->is_loggedin() === FALSE && $this->session->userdata('is_invite') != 'yes') {
				$this->session->set_flashdata('error',vlang('league_login_info'));
				$this->users->auth_check();
			}
*/

			//joining an existing public league
			if ($this->users->is_loggedin() && $league_team === FALSE && isset($league_info['visibility']) && $league_info['visibility'] == 'public'){
				$league_team = new stdClass;
				$league_team->id = 'new';
				$league_team->user_id = $this->users->id();
				$league_team->created = 0;
				$league_team->roster = '{}';
			}

			if ($league_team === FALSE){
				//joining a league
				$this->session->set_flashdata('error',vlang('league_player_select_league_not_found'));
				redirect('league/create');
			}else{
				if($league_info['sport'] == 'NHL' && $league_team->id != 'new') {
					$data['goalie_start'] = 'N';
					$event_arr = array();
					$included_events = json_decode($league_info['included_events']);
					foreach($included_events as $ie) {
						$event_arr[] = $ie;
					}
					//find out if goalies are starting or not
					$this->db->where_in('event_id',$event_arr);
					$this->db->where('type','Starter');
					$starters = $this->db->get('sport_event_lineup');
					$start_arr = array();
					foreach($starters->result() as $st) {
						$start_arr[] = $st->player_id;
					}

					$curr_roster = json_decode($league_team->roster,true);

					if(in_array($curr_roster['G']['1']['id'],$start_arr)) {
					$data['goalie_start'] = 'Y';
					}
				}
				//editing an existing team
				$data['existing_league_team'] = $existing_league_team = $league_team;

			}

			$data['entries']=$entries=count($this->leagues->get_teams_by_league($league_id));
			if($data['entries'] < $league_info['size']) {
				$data['entries_text'] = vlang('league_entries_extra_text');
			} else {
				$data['entries_text'] = '';
			}
			$data['leaguecid'] = $league_info['cid'];
			//get all teams in the league
			$sql = 'SELECT * FROM ci_league_team JOIN ci_users on cid = user_id WHERE league_id = "'.$league_id.'" ORDER BY username ASC';
			$entrants=$this->db->query($sql);
			if($entrants->num_rows() > 0) {
				$data['entrants'] = $entrants->result();
			} else {
				$data['entrants'] = '';
			}
		}else{
			$league_info=$this->session->userdata('leaguedata');
			if(empty($league_info)){
				$league_info = unserialize(get_cookie('leaguedata', TRUE));
			}
			$data['entries']=$entries=0;
			$data['entries_text'] = vlang('league_entries_extra_text');
			$data['leaguecid'] = '';
			$data['entrants'] = '';

		}
		

		if($league_info['type'] == 3 || $league_info['type'] == 6) {
			redirect('game/pick5/'.$league_id.'/'.$team_id);
		} elseif($league_info['type'] == 4) {
			redirect('game/over_under/'.$league_id.'/'.$team_id);
		}
		elseif($league_info['type'] == 111) {
			
			if(!isset($league_info['cid'])){
				$league_id = $this->leagues->create($league_info); 
			}
			redirect('game/pick/'.$league_id.'/'.$team_id);
		}
		
		
		$multi_h2h=$this->session->userdata('multi_h2h');
		if($multi_h2h==true){
			$temp_team=$this->session->userdata('temp_league_team');

			if(!empty($temp_team)) {
				$this->db->where('id',$temp_team['temp_id']);
				$this->db->where('created',$temp_team['temp_created']);
				$tquery=$this->db->get('league_temp');
				if($tquery->num_rows() > 0) {
					$trow = $tquery->row();
					$temp_team_league = $trow->league_id;
					$temp_team_roster = $trow->roster;
					if($temp_team_league == $league_id) {
						$league_team->roster = $temp_team_roster;
						$data['existing_league_team'] = $existing_league_team=$league_team;
					}
				}
			}
		}
		
		$data['scoring']= (array) json_decode($this->options->get('scoring'),true);
		
		$data['sport'] = strtolower($league_info['sport']);

		if (isset($league_info['first_game_cutoff']) && ($league_info['first_game_cutoff']) < time()){
			$this->session->set_flashdata('error',vlang('league_player_select_league_expired'));
			redirect('league/create');
		}

		if (isset($league_info['auto_game_id']) && $league_info['auto_game_id']==0 && isset($league_info['size']) && ($league_info['size']) == $data['entries'] && $data['user_can_edit'] == 0){
		$this->session->set_flashdata('error',vlang('league_player_select_league_full'));
		redirect('league/importexport');
		}
		
		

		if (isset($league_info['entry_fee']) && $league_info['entry_fee'] > 0 && $this->session->userdata('is_invite') == 'yes') {
			$this->session->set_flashdata('error',vlang('league_player_select_league_payment'));
		}
		

		//similar thing below also used in view/view_min, should prob go in a function
		$prize_structures_options=$this->leagues->get_prize_structures();

		foreach ($prize_structures_options as $pso) {
			$pid = $pso->id;
			$title=json_decode($pso->title);
			//determine # of winners
			if($pid == $league_info['prize_structure']) {
				//see if we have a custom prize
				$fgd='';
				if(isset($league_info['feat_game_data'])) {
					$fgd=json_decode($league_info['feat_game_data']);
				}
				$company_take = $this->options->get('company_take');
				$prize=(isset($fgd->custom_prize) && $fgd->custom_prize!==false)?$fgd->custom_prize:($league_info['size'] * $league_info['entry_fee']);
				$take=(isset($fgd->custom_rake) && $fgd->custom_rake!==false)?(1-($fgd->custom_rake/100)):(1 - $company_take);

				$prizetotal=$prize*$take;
				if(isset($prizetotal)) {
					switch($league_info['prize_structure']) {
						case 1: //winner take all
						$data['winner_text'] = $title->$data['lang'].' : $'.number_format($prizetotal,2,'.',',');
						break;
						case 2: //top 3
						$data['winner_text'] = $title->$data['lang'].' : $'.number_format($prizetotal*.444,2,'.',',').' / $'.number_format($prizetotal*.333,2,'.',',').' / $'.number_format($prizetotal*.222,2,'.',',');
						break;
						case 3: //top 3rd
						$data['winner_text'] = $title->$data['lang'].' : Each winner $'.number_format($prizetotal/($league_info['size']/3),2,'.',',');
						break;
						case 4: //50/50
						$data['winner_text'] = $title->$data['lang'].' : Each winner $'.number_format($prizetotal/($league_info['size']/2),2,'.',',');
						break;
						case 100: //LFP
							//these numbers are set by the admin
						$data['winner_text'] = $title->$data['lang'].' : Total prizes $'.number_format($prizetotal,2,'.',',').' <a href="#lfp_modal" data-toggle="modal" class="question">Learn More</a>';
							$lfp=json_decode($league_info['winn_perc_data']);
							$data['lfp_modal'] = '';
							if(isset($lfp)) {
								foreach($lfp as $k=>$v){
										if (!in_array(($k % 100),array(11,12,13))){
										  switch ($k % 10) {
											// Handle 1st, 2nd, 3rd
											case 1:  $k = $k.'st';
											break;
											case 2:  $k = $k.'nd';
											break;
											case 3:  $k = $k.'rd';
											break;
											default: $k = $k.'th';
											break;
										  }
										}
									$data['lfp_modal'] .= '<p><strong>'.$k.':</strong> '.$v.'% - $'.number_format($prizetotal*($v/100),2,'.',',').'</p>';
								}
							}
						break;
						default:
						$data['winner_text'] = $title->$data['lang'];
						break;
					}
				} else {
					$data['winner_text'] = $title->$data['lang'];
				}
			}
		}
		//end potential function
		
		$data['league_info']=$league_info;
		$league_info['feat']=0;
		$data['prize_structure']=$this->leagues->get_prize_structure_by_id($league_info['prize_structure']);

		

		$data['sport_data'] = json_decode($this->options->get('sport_data'), true);
		
		//$data['avail_games']=$this->leagues->get_avail_games_by_time_slot($league_info['date'],$league_info['time'],$league_info['sport']);
		if(!empty($league_info['included_events'])){    		
			$data['avail_games'] = $avail_games = $this->leagues->get_avail_games_custom($league_info['included_events'],$league_info['sport']);
		} else { 
			$data['avail_games'] = $avail_games = $this->leagues->get_avail_games_by_time_slot($league_info['date'],$league_info['time'],$league_info['sport']);
		}
		
		if(isset($data['sport']) && $data['sport'] != ""){
			$sport = $data['sport'];
		}
		
		$data['extra_js'] = '<script type="text/javascript">var players = '.$this->get_player_list_json($sport,$avail_games,'ALL').'</script>';
		//determine earliest league play for count-down ticker
		$countdown_until = $this->leagues->get_games_cutoff_time($data['avail_games']);
		$data['extra_js'] .= "<script type='text/javascript'>var cutoff_time = new Date(".date('Y, ', $countdown_until).(date('m', $countdown_until) - 1).", ".date('d, H, i, s', $countdown_until).");</script>";
		$data['extra_js'] .= "<script type='text/javascript' src='".site_url('assets/'.$data['theme'].'/js/player_select.js?v='.$this->config->item('ftd_version'))."'></script>";
		$data['extra_js'] .= "<script type='text/javascript' src='/assets/".$data['theme']."/js/typeahead.js'></script>";
		

		
		if($data['user_can_edit'] == 0) {
			$post_plus_league = $_POST;
				
			$this->session->set_userdata('post_plus_league', $post_plus_league);
			if($this->users->is_loggedin() === TRUE) {
				$this->form_validation->set_rules('leaguedata', '', 'xss_clean|trim|callback_has_enough_money');
			}
		}
		$this->form_validation->set_rules('players[][]', 'Players', 'xss_clean|trim');

		if ($this->form_validation->run() === FALSE){
		}else{
			
			$session_pass=$this->session->userdata('league_passwords');
			if($user_can_edit==1 || ($user_can_edit==0 && (!empty($league_info['password']) && isset($session_pass[$league_info['cid']]) && $session_pass[$league_info['cid']]==$league_info['password']) || empty($league_info['password']))){
				
				if($this->users->is_loggedin()){
    				
    				    				
					$this->leagues->player_select_post($this->input->post(),$team_id,$edit,$league_info,$entries,$existing_league_team,$user_can_edit,$avail_games);
				}else{
				
				$data = array(
	               'roster' => json_encode($_POST['players']),
	               'league_id' => $league_info['cid'],
	               'created' => time(),
	            );
				
				//$this->db->insert('league_temp', $data); 
				$temp_team['temp_id'] = $this->db->insert_id();
				$temp_team['league_uri'] = $_SERVER['REQUEST_URI'];
				$this->session->set_userdata('temp_league_team', $temp_team); 
				 
				$this->session->set_flashdata('warning','Don\'t worry your lineup is safe but lets first register for an account.');
				
				redirect('login');
				
				}
				
			}else{
				$this->session->set_flashdata('error','That league requires a password.');
				redirect('lobby');
			}
		}
		$data["body_sport"]=strtolower($league_info['sport']);
		

		if( $team_id == 'welcome' ) {
			$this->tracked_events->tracked(2, $this->users->id());
			$data['extra_js'] .= <<<HTML
	<!-- Google Code for Account Registration Conversion Page -->
	<script type="text/javascript">
	/* <![CDATA[ */
	var google_conversion_id = 984690397;
	var google_conversion_language = "en";
	var google_conversion_format = "3";
	var google_conversion_color = "ffffff";
	var google_conversion_label = "NNkfCNOvvwYQ3d3E1QM";
	var google_conversion_value = 0;
	var google_remarketing_only = false;
	/* ]]> */
	</script>
	<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
	</script>
	<noscript>
	<div style="display:inline;">
	<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/984690397/?value=0&amp;label=NNkfCNOvvwYQ3d3E1QM&amp;guid=ON&amp;script=0"/>
	</div>
	</noscript>

HTML;
			$data['extra_js'] .= <<<JAVASCRIPT

	<script type=""text/javascript"">
	var fb_param = {};
	fb_param.pixel_id = '6008179574698';
	fb_param.value = '0.00';
	fb_param.currency = 'USD';
	(function(){
	  var fpw = document.createElement('script');
	  fpw.async = true;
	  fpw.src = '//connect.facebook.net/en_US/fp.js';
	  var ref = document.getElementsByTagName('script')[0];
	  ref.parentNode.insertBefore(fpw, ref);
	})();
	</script>
	<noscript><img height=""1"" width=""1"" alt="""" style=""display:none"" src=""https://www.facebook.com/offsite_event.php?id=6008179574698&amp;value=0&amp;currency=USD"" /></noscript>

JAVASCRIPT;
			
		}elseif( ! $this->tracked_events->check(2, $this->users->id()) ) {
			$this->tracked_events->tracked(2, $this->users->id());
			Analytics::track( $this->users->id(), "First time in player select" );
			$data['modal'] = array(
				'title' => 'Pick Your Team!',
				'content' => '
				<ul>
					<li>1.  Pick your team while staying under the $'.number_format($league_info['salary_cap']).' salary cap</li>
					<li>2.  Submit your team and compete against everyone in the contest!</li>
					<li>3.  Win BIG!</li>
				</ul>
				<p style="text-align:center"><a class="btn btn-success btn-large green" href="#" data-dismiss="modal">START DRAFTING</a></p>',
			);
		}

		//$this->load->view($data['theme'].'/league/player_select',$data);
		$this->load->view($data['theme'].'/league/player_select_advanced',$data);
	}
Пример #6
0
 function testTrack() {
   $tracked = Analytics::track("some_user", "Module PHP Event");
   $this->assertTrue($tracked);
 }
Пример #7
0
 public function wp_footer()
 {
     // Identify the user if the current user merits it.
     $identify = $this->get_current_user_identify();
     if ($identify) {
         Analytics::identify($identify['user_id'], $identify['traits']);
     }
     // Track a custom page view event if the current page merits it.
     $track = $this->get_current_page_track();
     if ($track) {
         Analytics::track($track['event'], $track['properties']);
     }
 }