<?php $search = $this->session->userdata('search_form'); if($search['startdate']){ echo '<h4>'.date('M d, Y',strtotime($search['startdate'])).' - '.date('M d, Y',strtotime($search['enddate'])).'</h4>'; } ?> <table cellspacing="0" cellpadding="1" border="1"> <tr style="background-color:#428bca;color:#fff;"> <th width="8%">Sl.No.</th> <th width="30%">Name</th> <th width="10%">Total Hits</th> <th width="10%">Total Time Watched</th> <th width="15%">Browser</th> <th width="10%">IP</th> <th width="15%">Date</th> </tr> <?php foreach ($result as $value) { $i++;?> <tr> <td width="8%"><?php echo $i;?></td> <td width="30%"><!--a href="<?php echo base_url(); ?>analytics/user/<?php echo $value->id; ?>"--><?php echo ($value->name!='') ? $value->name : 'guest'; ?></td> <td width="10%"><?php echo $value->total_hits; ?></td> <td width="10%"><?php echo time_from_seconds($value->total_watched_time); ?></td> <td width="15%"><?php echo $value->browser; ?></td> <td width="10%"><?php echo $value->ip; ?></td> <td width="15%"><?php echo date("d/m/Y H:i:s", strtotime($value->created)); ?></td> </tr> <?php } ?> </table>
function editChannelCuePoints() { //$new_array = array(); $channel_cue_points = $this->videos_model->getChannelCuePoints($_POST['channel_id']); if (count($channel_cue_points) > 0) { $i = 1; foreach ($channel_cue_points as $key => $val) { $new_array[$i]['title'] = $val->title; $new_array[$i]['cuepoint'] = time_from_seconds($val->cue_points); $i++; } } echo json_encode($new_array); exit; }
function export() { $search = $this->session->userdata('search_form'); //echo $this->uri->segment(4);die; //-- sorting input --// $sort_i = $this->uri->segment(5); $sort_by = $this->uri->segment(6); $type = $this->uri->segment(8); if ($this->uri->segment(9) == 'country') { $country = $this->uri->segment(10); } else { $id = $this->uri->segment(10); } $sort = $this->sort_input($sort_i, $sort_by); //-----// //-- result --// $this->data['result'] = $this->Analytics_model->getReport(array('code' => $country, 'id' => $id, 'type' => $type, 'search' => $search), $sort, $sort_by); //echo '<pre>';print_r($this->data['result']);die; if ($type == 'content') { if ($this->uri->segment(4) == 'pdf') { $content = $this->load->view('templates/pdf_content', $this->data, true); //-- create pdf --// create_pdf($content, 'Content Base Report'); } elseif ($this->uri->segment(4) == 'csv') { $heading = array('Name', 'Content Provider', 'Platform', 'Browser', 'Location', 'Date', 'Total Hits', 'Total time watched'); //$content = $this->load->view('templates/pdf_content',$this->data,true); $dataRpt = array(); $num = 0; foreach ($this->data['result'] as $p) { $dataRpt[$num]['title'] = $p->title; $dataRpt[$num]['content_provider'] = $p->content_provider; $dataRpt[$num]['platform'] = $p->platform; $dataRpt[$num]['browser'] = $p->browser; $dataRpt[$num]['location'] = $p->country; $dataRpt[$num]['date'] = $p->created; $dataRpt[$num]['hits'] = $p->total_hits; $dataRpt[$num]['watched time'] = time_from_seconds($p->total_watched_time); $num++; } query_to_csv($dataRpt, $heading); //echo query_to_csv($content); //exit; } } if ($type == 'usercontent') { if ($this->uri->segment(4) == 'pdf') { $content = $this->load->view('templates/pdf_usercontent', $this->data, true); //-- create pdf --// create_pdf($content, 'User Content Report'); } elseif ($this->uri->segment(4) == 'csv') { $heading = array('Name', 'Content Provider', 'Platform', 'Browser', 'Location', 'Date', 'Total Hits', 'Total time watched'); //$content = $this->load->view('templates/pdf_content',$this->data,true); //print_r($this->data['result']);die; $dataRpt = array(); $num = 0; foreach ($this->data['result'] as $p) { $dataRpt[$num]['title'] = $p->title; $dataRpt[$num]['content_provider'] = $p->content_provider; $dataRpt[$num]['platform'] = $p->platform; $dataRpt[$num]['browser'] = $p->browser; $dataRpt[$num]['location'] = $p->country; $dataRpt[$num]['date'] = $p->created; $dataRpt[$num]['hits'] = $p->total_hits; $dataRpt[$num]['watched time'] = time_from_seconds($p->total_watched_time); $num++; } query_to_csv($dataRpt, $heading); //echo query_to_csv($content); //exit; } } if ($type == 'user') { if ($this->uri->segment(4) == 'pdf') { $user = $this->load->view('templates/pdf_user', $this->data, true); //-- create pdf --// create_pdf($user, 'User Based Report'); } elseif ($this->uri->segment(4) == 'csv') { $heading = array('Name', 'Total Hits', 'Total time watched', 'Browser', 'IP', 'Date'); //$content = $this->load->view('templates/pdf_content',$this->data,true); $dataRpt = array(); $num = 0; foreach ($this->data['result'] as $p) { $dataRpt[$num]['name'] = $p->name != '' ? $p->name : 'guest'; $dataRpt[$num]['hits'] = $p->total_hits; $dataRpt[$num]['watched time'] = time_from_seconds($p->total_watched_time); $dataRpt[$num]['browser'] = $p->browser; $dataRpt[$num]['ip'] = $p->ip; $dataRpt[$num]['date'] = date("d/m/Y H:i:s", strtotime($p->created)); $num++; } query_to_csv($dataRpt, $heading); //echo query_to_csv($content); //exit; } } if ($type == 'useragent') { if ($this->uri->segment(4) == 'pdf') { $content = $this->load->view('templates/pdf_device', $this->data, true); //-- create pdf --// create_pdf($content, 'Device Base Report'); } elseif ($this->uri->segment(4) == 'csv') { $heading = array('Platform', 'Browser', 'Total Hits', 'Total time watched'); //$content = $this->load->view('templates/pdf_content',$this->data,true); $dataRpt = array(); $num = 0; foreach ($this->data['result'] as $p) { $dataRpt[$num]['platform'] = $p->platform; $dataRpt[$num]['browser'] = $p->browser; $dataRpt[$num]['hits'] = $p->total_hits; $dataRpt[$num]['watched time'] = time_from_seconds($p->total_watched_time); $num++; } query_to_csv($dataRpt, $heading); //echo query_to_csv($content); //exit; } } if ($type == 'region') { if ($this->uri->segment(4) == 'pdf') { $geomap = $this->load->view('templates/pdf_geomap', $this->data, true); //-- create pdf --// create_pdf($geomap, 'Region Based Report'); } elseif ($this->uri->segment(4) == 'csv') { $heading = array('Country', 'Region', 'Total Hits', 'Total time watched'); //$content = $this->load->view('templates/pdf_content',$this->data,true); $dataRpt = array(); $num = 0; foreach ($this->data['result'] as $p) { $dataRpt[$num]['country'] = $p->country; $dataRpt[$num]['state'] = $p->state; $dataRpt[$num]['hits'] = $p->total_hits; $dataRpt[$num]['watched time'] = time_from_seconds($p->total_watched_time); $num++; } query_to_csv($dataRpt, $heading); //echo query_to_csv($content); //exit; } } if ($type == 'country') { $this->data['c'] = 1; if ($this->uri->segment(4) == 'pdf') { $geomap = $this->load->view('templates/pdf_geomap', $this->data, true); //-- create pdf --// create_pdf($geomap, 'Country Based Report'); } elseif ($this->uri->segment(4) == 'csv') { $heading = array('Location', 'Country', 'Total Hits', 'Total time watched'); //$content = $this->load->view('templates/pdf_content',$this->data,true); $dataRpt = array(); $num = 0; foreach ($this->data['result'] as $p) { $dataRpt[$num]['Location'] = $p->city != '' ? $p->city : 'Unknown'; $dataRpt[$num]['country'] = $p->country; $dataRpt[$num]['hits'] = $p->total_hits; $dataRpt[$num]['watched time'] = time_from_seconds($p->total_watched_time); $num++; } query_to_csv($dataRpt, $heading); //echo query_to_csv($content); //exit; } } }
</div> <div class="table-responsive"> <!-- .table - Uses sparkline charts--> <table class="table table-striped"> <tr> <th>Location</th> <th>Hits</th> <th>Time Watched</th> </tr> <?php foreach($geomap as $row){ //if($row->state !=''){ ?> <tr> <td><?php echo ($row->city!='') ? $row->city : 'Unknown';?></td> <td><?php echo $row->total_hits;?></td> <td><?php echo time_from_seconds($row->total_watched_time);?></td> </tr> <?php //} }?> <tr><td> <!-- Pagination start ---> <?php if ($this->pagination->total_rows == '0') { echo "<tr><td colspan=\"7\"><h4>" . $welcome->loadPo('No Record Found') . "</td></tr></h4>"; } else { ?> <div class="row pull-left"> <div class="dataTables_info" id="example2_info"><br>
<tr> <th>City</th> <th>Country</th> <th>State</th> <th>Impresion</th> <!--th>Watch time</th--> <!--th>Time Watched</th--> </tr> <?php foreach($country as $row){?> <tr> <td><?=($row->city=='')?'Unknow':$row->city?></td> <td><?=($row->country=='')?'Unknow':$row->country?></td> <td><?=($row->state=='')?'Unknow':$row->state?></td> <td><?=$row->total_hits?></td> <!--td><?=time_from_seconds($row->total_watched_time)?></td--> </tr> <?php }?> </table><!-- /.table --> </div> </div><!-- /.box-body --> <div><a href='<?php echo base_url()?>ads_analytics/geographic?c=1' style="float:right;">View All</a></div> </div><!-- /.box --> <div class="box box-primary"> <div class="box-header"> <!-- tools box --> <div class="pull-right box-tools"> <button class="btn btn-danger btn-sm" data-widget='collapse' data-toggle="tooltip" title="Collapse"><i class="fa fa-minus"></i></button>