function exportpro() { $country = $this->default_country; $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $currentProduct = $this->common->getCurrentProduct(); $this->common->requireProduct(); $fromTime = $this->product->getReportStartDate($currentProduct, $fromTime); $activepro = $this->region->getproexport($fromTime, $toTime, $currentProduct->id, $country); if ($activepro != null && $activepro->num_rows() > 0) { $data = $activepro; $titlename = getExportReportTitle($currentProduct->name, lang("v_rpt_re_detailsOfProvince"), $fromTime, $toTime); $titlename = iconv("UTF-8", "GBK", $titlename); $this->export->setFileName($titlename); $fields = array(); foreach ($data->list_fields() as $field) { array_push($fields, $field); } $this->export->setTitle($fields); foreach ($data->result() as $row) { $this->export->addRow($row); } $this->export->export(); die; } else { $this->load->view("usage/nodataview"); } }
function export() { $this->load->library('export'); $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $productId = $this->common->getCurrentProduct(); $productId = $productId->id; $productName = $this->common->getCurrentProduct()->name; $data = $this->orientationmodel->getTotalUsersPercentByResolution($fromTime, $toTime, $productId); $export = new Export(); $titlename = getExportReportTitle($productName, lang('v_rpt_re_details'), $fromTime, $toTime); $title = iconv("UTF-8", "GBK", $titlename); $export->setFileName($title); $fields = array(); foreach ($data->list_fields() as $field) { array_push($fields, $field); } $export->setTitle($fields); foreach ($data->result() as $row) { $export->addRow($row); } $export->export(); die; }
function exportdetaildata() { $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $currentProduct = $this->common->getCurrentProduct(); $productName = trim($currentProduct->name); $detaildata = $this->newusermodel->getDetailUserDataByDay($fromTime, $toTime); if ($detaildata != null && count($detaildata) > 0) { $data = $detaildata; $titlename = getExportReportTitle($productName, lang("v_rpt_pb_userDataDetail"), $fromTime, $toTime); $title = iconv("UTF-8", "GBK", $titlename); $this->export->setFileName($title); //Set the column headings $excel_title = array(iconv("UTF-8", "GBK", lang('g_date')), iconv("UTF-8", "GBK", lang('t_newUsers')), iconv("UTF-8", "GBK", lang('t_accumulatedUsers')), iconv("UTF-8", "GBK", lang('t_activeUsers')), iconv("UTF-8", "GBK", lang('t_sessions')), iconv("UTF-8", "GBK", lang('t_averageUsageDuration'))); $this->export->setTitle($excel_title); //output content for ($i = 0; $i < count($data); $i++) { $row = $data[$i]; $this->export->addRow($row); } $this->export->export(); die; } else { $this->load->view("usage/nodataview"); } }
/** * ExportComparedata funciton * Export the compares error data * * @return query result */ function exportComparedata() { $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $products = $this->common->getCompareProducts(); if (empty($products)) { $this->common->requireProduct(); return; } $this->load->library('export'); $export = new Export(); $titlename = getExportReportTitle("Compare", lang("m_rpt_errors"), $fromTime, $toTime); $titlename = iconv("UTF-8", "GBK", $titlename); $export->setFileName($titlename); $j = 0; $mk = 0; $maxlength = 0; $title[$j++] = iconv("UTF-8", "GBK", ''); $space[$mk++] = lang('g_date'); for ($i = 0; $i < count($products); $i++) { $detailData[$i] = $this->errormodel->getCompareErrorData($products[$i]->id, $fromTime, $toTime); $maxlength = count($detailData[$i]['content']); $title[$j++] = iconv("UTF-8", "GBK", $products[$i]->name); $title[$j++] = iconv("UTF-8", "GBK", ''); $space[$mk++] = lang('v_rpt_err_errorNums'); $space[$mk++] = lang('v_rpt_err_errorNumsInSessions'); } $export->setTitle($title); $export->addRow($space); $k = 0; $j = 0; for ($m = 0; $m < $maxlength; $m++) { $detailcontent = array(); for ($j = 0; $j < count($products); $j++) { $obj = $detailData[$j]['content']; if ($j == 0) { array_push($detailcontent, $obj[$m]['date']); } array_push($detailcontent, $obj[$m]['count']); array_push($detailcontent, $obj[$m]['percentage']); } $export->addRow($detailcontent); } $export->export(); die; }
function exportComparedata() { $user_id = $this->common->getUserId(); $fromTime = $this->common->getFromTime(); $products = $this->common->getCompareProducts(); $toTime = $this->common->getToTime(); $titlename = getExportReportTitle('Compare', lang('v_rpt_re_funnelModel'), $fromTime, $toTime); $titlename = iconv("UTF-8", "GBK", $titlename); $this->export->setFileName($titlename); $result = array(); for ($i = 0; $i < count($products); $i++) { $data = $this->conversion->getConversionListByProductIdAndUserId($products[$i]->id, $user_id, $fromTime, $toTime); $targetdata = $data['targetdata']; $eventdata = $data['eventdata']; $result['result'][$i] = $this->prepareUnitAndeventCount($targetdata, $eventdata); $result['result'][$i]['name'] = $products[$i]->name; } $excel_title = array(); for ($i = 0; $i < count($result['result']); $i++) { if ($i == 0) { array_push($excel_title, iconv("UTF-8", "GBK", lang('g_date'))); } array_push($excel_title, iconv("UTF-8", "GBK", " ")); array_push($excel_title, iconv("UTF-8", "GBK", $result['result'][$i]['name'])); } $this->export->setTitle($excel_title); $rowTitle = array(); // set firest row $rowTitle[0] = " "; for ($i = 0; $i < count($result['result']); $i++) { array_push($rowTitle, lang('v_rpt_re_funneleventC')); array_push($rowTitle, lang('v_rpt_re_unitprice')); } $this->export->addRow($rowTitle); $datelist = $result['result'][0]['date']; foreach ($datelist as $key => $value) { $row = array(); $row[0] = $key; for ($i = 0; $i < count($result['result']); $i++) { $r = $result['result'][$i]; $date = $r['date']; foreach ($date as $k => $v) { if ($key == $k) { array_push($row, $date[$key]); if (!isset($r['unitprice'])) { echo 0; } else { array_push($row, $r['unitprice'][0][$key]); } } } } $this->export->addRow($row); } $this->export->export(); die; }
/** * Export * * @return void */ function export() { $this->load->library('export'); $productId = $this->common->getCurrentProduct(); $this->common->requireProduct(); $productId = $productId->id; $productName = $this->common->getCurrentProduct()->name; $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $data = $this->os->getTotalUserPercentByOS($productId, $fromTime, $toTime); if ($data != null && $data->num_rows() > 0) { $export = new Export(); // set file name $titlename = getExportReportTitle($productName, lang('v_rpt_os_version'), $fromTime, $toTime); $title = iconv("UTF-8", "GBK", $titlename); $export->setFileName($title); // set title name $excel_title = array(iconv("UTF-8", "GBK", lang("v_rpt_os_version")), iconv("UTF-8", "GBK", lang("t_sessions")), iconv("UTF-8", "GBK", lang("t_sessionsP")), iconv("UTF-8", "GBK", lang("t_newUsers")), iconv("UTF-8", "GBK", lang("t_newUsersP"))); $export->setTitle($excel_title); //// $Total = $this->os->getOsSessionNewuserTotal($productId, $fromTime, $toTime); if ($Total) { $sessions = $Total->first_row()->sessions; $newusers = $Total->first_row()->newusers; } else { $sessions = 0; $newusers = 0; } foreach ($data->result() as $row) { if (!$row->deviceos_name) { $row->deviceos_name = 'unknown'; } $rowadd['deviceos_name'] = $row->deviceos_name; $rowadd['sessions'] = $row->sessions; $rowadd['sessions_p'] = $sessions > 0 ? round(100 * $row->sessions / $sessions, 1) . '%' : '0%'; $rowadd['newusers'] = $row->newusers; $rowadd['newusers_p'] = $newusers > 0 ? round(100 * $row->newusers / $newusers, 1) . '%' : '0%'; $export->addRow($rowadd); } $export->export(); die; } else { $this->load->view("usage/nodataview"); } }
function exportComparePhaseusetime($timePhase, $fromDate = '', $toDate = '') { $time = $this->changeDate($timePhase, $fromDate, $toDate); $fromTime = $time['fromTime']; $toTime = $time['toTime']; $products = $this->common->getCompareProducts(); if (empty($products)) { $this->common->requireProduct(); return; } $this->load->library('export'); $export = new Export(); $titlename = getExportReportTitle("Compare", lang("v_rpt_pb_timeTrendOfUsers_detail"), $fromTime, $toTime); $titlename = iconv("UTF-8", "GBK", $titlename); $export->setFileName($titlename); $j = 0; $mk = 0; $maxlength = 0; $title[$j++] = iconv("UTF-8", "GBK", ''); $space[$mk++] = lang('t_date_part'); for ($i = 0; $i < count($products); $i++) { $detailData[$i] = $this->product->getStarterUserCountByTime($fromTime, $toTime, $products[$i]->id)->result_array(); $maxlength = count($detailData[$i]); $title[$j++] = iconv("UTF-8", "GBK", $products[$i]->name); $title[$j++] = iconv("UTF-8", "GBK", ''); $space[$mk++] = lang('t_activeUsers'); $space[$mk++] = lang('t_newUsers'); } $export->setTitle($title); $export->addRow($space); $k = 0; $j = 0; for ($m = 0; $m < $maxlength; $m++) { $detailcontent = array(); for ($j = 0; $j < count($products); $j++) { $obj = $detailData[$j]; if ($j == 0) { array_push($detailcontent, $obj[$m]['hour'] . ":00"); } array_push($detailcontent, $obj[$m]['startusers']); array_push($detailcontent, $obj[$m]['newusers']); } $export->addRow($detailcontent); } $export->export(); die; }
function export() { $this->load->library('export'); $productId = $this->common->getCurrentProduct(); $this->common->requireProduct(); $productId = $productId->id; $productName = $this->common->getCurrentProduct()->name; $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $data = $this->network->getALlNetWorkData($productId, $fromTime, $toTime); $export = new Export(); // set file name $titlename = getExportReportTitle($productName, lang('v_rpt_nw_details'), $fromTime, $toTime); $title = iconv("UTF-8", "GBK", $titlename); $export->setFileName($title); $fields = array(); foreach ($data->list_fields() as $field) { array_push($fields, $field); } $export->setTitle($fields); foreach ($data->result() as $row) { $export->addRow($row); } $export->export(); die; }
/** * ExportCompareUsefrequency function,export the compare data of Usefrequency * * @return void */ function exportCompareUsefrequency() { $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $products = $this->common->getCompareProducts(); $result = array(); for ($i = 0; $i < count($products); $i++) { $result[$i]['content'] = $this->analyze->getUsingFrequenceByProduct($products[$i]->id, $fromTime, $toTime)->result_array(); $result[$i]['name'] = $products[$i]->name; } $excel_title = array(); for ($i = 0; $i < count($result); $i++) { $content = $result[$i]['content']; if ($i == 0) { for ($j = 0; $j < count($content); $j++) { if ($j == 0) { $excel_title[0] = iconv('UTF-8', 'GBK', lang('v_app')); $excel_title[1] = iconv('UTF-8', 'GBK', $content[0]['segment_name']); } else { array_push($excel_title, iconv('UTF-8', 'GBK', $content[$j]['segment_name'])); } } } } $titlename = getExportReportTitle("Compare", lang("v_rpt_uf_distribution"), $fromTime, $toTime); $titlename = iconv("UTF-8", "GBK", $titlename); $this->export->setFileName($titlename); $this->export->setTitle($excel_title); for ($i = 0; $i < count($result); $i++) { $content = $result[$i]['content']; $name = $result[$i]['name']; $rows = array(); $rows[0] = $name; for ($j = 0; $j < count($content); $j++) { $rows[$j + 1] = $content[$j]['access'] . '(' . round(100 * $content[$j]['percentage'], 1) . '%)'; } $this->export->addRow($rows); } $this->export->export(); }
/** * Exportcity * * @return void */ function exportcity() { $country = $this->default_country; $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $currentProduct = $this->common->getCurrentProduct(); $this->common->requireProduct(); $fromTime = $this->product->getReportStartDate($currentProduct, $fromTime); $fromTime = date("Y-m-d", strtotime($fromTime)); $city = $this->region->getcitynum($fromTime, $toTime, $currentProduct->id, $country); $city_session = 0; $city_newuser = 0; if (isset($city)) { foreach ($city as $row) { $city_session += $row->sessions; $city_newuser += $row->newusers; } } $activepro = $this->region->getcityexport($fromTime, $toTime, $currentProduct->id, $country); if ($activepro != null && $activepro->num_rows() > 0) { $data = $activepro; $titlename = getExportReportTitle($currentProduct->name, lang("v_rpt_re_detailsOfCity"), $fromTime, $toTime); $titlename = iconv("UTF-8", "GBK", $titlename); $this->export->setFileName($titlename); // $fields = array (); // foreach ( $data->list_fields () as $field ) { // array_push ( $fields, $field ); // } // $this->export->setTitle ( $fields ); $excel_title = array(iconv("UTF-8", "GBK", lang("v_rpt_re_city")), iconv("UTF-8", "GBK", lang("t_sessions")), iconv("UTF-8", "GBK", lang("t_sessionsP")), iconv("UTF-8", "GBK", lang("t_newUsers")), iconv("UTF-8", "GBK", lang("t_newUsersP"))); $this->export->setTitle($excel_title); foreach ($data->result() as $row) { $rowadd['city_name'] = $row->city_name; $rowadd['sessions'] = $row->sessions; $rowadd['session_p'] = $city_session > 0 ? round(100 * $row->sessions / $city_session, 1) . '%' : '0%'; $rowadd['newusers'] = $row->newusers; $rowadd['newuser_p'] = $city_newuser > 0 ? round(100 * $row->newusers / $city_newuser, 1) . '%' : '0%'; $this->export->addRow($rowadd); } $this->export->export(); die; } else { $this->load->view("usage/nodataview"); } }
function exportCompareUsetime() { $fromTime = $this->common->getFromTime(); $toTime = $this->common->getToTime(); $products = $this->common->getCompareProducts(); $result = array(); for ($i = 0; $i < count($products); $i++) { $result[$i]['content'] = $this->analyze->getUsingTimeByProduct($products[$i]->id, $fromTime, $toTime)->result_array(); $result[$i]['name'] = $products[$i]->name; } //print_r($result); $times = array(); for ($i = 0; $i < count($result); $i++) { $content = $result[$i]['content']; for ($j = 0; $j < count($content); $j++) { if ($i == 0) { array_push($times, $content[$j]['segment_name']); } } } $titlename = getExportReportTitle("Compare", lang("v_rpt_ud_distribution"), $fromTime, $toTime); $titlename = iconv("UTF-8", "GBK", $titlename); $this->export->setFileName($titlename); $excel_title = array(); for ($i = 0; $i < count($times); $i++) { if ($i == 0) { $excel_title[0] = iconv('UTF-8', 'GBK', lang('v_app')); $excel_title[1] = iconv('UTF-8', 'GBK', $times[0]); } else { array_push($excel_title, iconv('UTF-8', 'GBK', $times[$i])); } } //print_r($excel_title); $this->export->setTitle($excel_title); for ($k = 0; $k < count($result); $k++) { $row = array(); $row[0] = $result[$k]['name']; $content = $result[$k]['content']; for ($j = 0; $j < count($content); $j++) { $row[$j + 1] = $content[$j]['numbers'] . '(' . round($content[$j]['percentage'] * 100, 1) . '%)'; } $this->export->addRow($row); } $this->export->export(); die; }