Exemplo n.º 1
0
 function export($from, $to)
 {
     $productId = $this->common->getCurrentProduct()->id;
     $productName = $this->common->getCurrentProduct()->name;
     $data = $this->device->getDeviceTypeDetail($productId);
     $this->load->library('export');
     $export = new Export();
     //设定文件名
     $export->setFileName($productName . '_' . $from . '_' . $to . '.csv');
     //输出列名第一种方法
     $fields = array();
     foreach ($data->list_fields() as $field) {
         array_push($fields, $field);
     }
     $export->setTitle($fields);
     //输出列名第二种方法
     //        $excel_title = array (iconv("UTF-8", "GBK", "设备型号"),iconv("UTF-8", "GBK", "总数"),iconv("UTF-8", "GBK", "用户比例") );
     //			$export->setTitle ($excel_title );
     //输出内容
     foreach ($data->result() as $row) {
         $export->addRow($row);
     }
     $export->export();
     die;
 }
Exemplo n.º 2
0
Arquivo: os.php Projeto: jianoll/razor
 function export($from, $to)
 {
     $this->load->library('export');
     $productId = $this->common->getCurrentProduct()->id;
     $productName = $this->common->getCurrentProduct()->name;
     $data = $this->os->getTotalUserPercentByOS($productId);
     $export = new Export();
     //设定文件名
     $export->setFileName($productName . '.csv');
     //		//输出列名第一种方法
     $fields = array();
     foreach ($data->list_fields() as $field) {
         array_push($fields, $field);
     }
     $export->setTitle($fields);
     //输出列名第二种方法
     //        $excel_title = array (iconv("UTF-8", "GBK", "操作系统版本"),iconv("UTF-8", "GBK", "用户比例") );
     //			$export->setTitle ($excel_title );
     //输出内容
     foreach ($data->result() as $row) {
         $export->addRow($row);
     }
     $export->export();
     die;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 function exportCSV($label)
 {
     $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();
     if ($label == "country") {
         $titlename = getExportReportTitle("Compare", lang("v_rpt_re_top10Nations"), $fromTime, $toTime);
     } else {
         $titlename = getExportReportTitle("Compare", lang("v_rpt_re_top10Provinces"), $fromTime, $toTime);
     }
     $titlename = iconv("UTF-8", "GBK", $titlename);
     $export->setFileName($titlename);
     $j = 0;
     $mk = 0;
     $title[$j++] = iconv("UTF-8", "GBK", lang('t_activeUsers'));
     $space[$mk++] = ' ';
     for ($i = 0; $i < count($products); $i++) {
         $title[$j++] = iconv("UTF-8", "GBK", $products[$i]->name);
         $title[$j++] = '';
         $space[$mk++] = ' ';
         $space[$mk++] = ' ';
     }
     $export->setTitle($title);
     $k = 0;
     $maxlength = 0;
     $maxlength2 = 0;
     $j = 0;
     $nextlabel[$j++] = lang('t_newUsers');
     for ($m = 0; $m < count($products); $m++) {
         if ($label == "country") {
             $activedata = $this->region->getactivebycountry($fromTime, $toTime, $products[$m]->id);
             $newdata = $this->region->getnewbycountry($fromTime, $toTime, $products[$m]->id);
         } else {
             $country = $this->default_country;
             $activedata = $this->region->getactivebypro($fromTime, $toTime, $products[$m]->id, $country);
             $newdata = $this->region->getnewbypro($fromTime, $toTime, $products[$m]->id, $country);
         }
         $detailData[$m] = $this->change2StandardPrecent($activedata, $label);
         $detailNewData[$m] = $this->change2StandardPrecent($newdata, $label);
         if (count($detailData[$m]) > $maxlength) {
             $maxlength = count($detailData[$m]);
         }
         if (count($detailNewData[$m]) > $maxlength2) {
             $maxlength2 = count($detailNewData[$m]);
         }
         $nextlabel[$j++] = $products[$m]->name;
         $nextlabel[$j++] = ' ';
     }
     $this->getExportRowData($export, $maxlength, $detailData, $products, $label);
     $export->addRow($space);
     $export->addRow($nextlabel);
     $this->getExportRowData($export, $maxlength2, $detailNewData, $products, $label);
     $export->export();
     die;
 }
Exemplo n.º 5
0
 /**
  * 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;
 }
Exemplo n.º 6
0
 /**
  * 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");
     }
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
Arquivo: common.php Projeto: npk/razor
 function export($from, $to, $data)
 {
     $productId = $this->getCurrentProduct()->id;
     $productName = $this->getCurrentProduct()->name;
     $export = new Export();
     // 设定文件名
     $export->setFileName($productName . '_' . $from . '_' . $to . '.xls');
     // 输出列名
     $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;
 }
Exemplo n.º 9
0
 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;
 }