当前位置: 首页>>代码示例>>PHP>>正文


PHP Statistics::getDetailedValuesByTypeOfConnection方法代码示例

本文整理汇总了PHP中Statistics::getDetailedValuesByTypeOfConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Statistics::getDetailedValuesByTypeOfConnection方法的具体用法?PHP Statistics::getDetailedValuesByTypeOfConnection怎么用?PHP Statistics::getDetailedValuesByTypeOfConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Statistics的用法示例。


在下文中一共展示了Statistics::getDetailedValuesByTypeOfConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _exportDetailedValuesByTypeOfConnection

 /**
  * 
  * @param unknown_type $from
  * @param unknown_type $to
  * @param unknown_type $numberImputations
  * @param unknown_type $totalDuration
  */
 private function _exportDetailedValuesByTypeOfConnection($from, $to, $numberImputations, $totalTime)
 {
     $begin_row = $this->_row;
     $active_sheet = $this->getDocument()->getActiveSheet();
     /* --------------- EXPORTATION OF THE DETAILED STATS BY TYPE OF CONNEXION -----------------*/
     $typeOfConnectionStats = Statistics::getDetailedValuesByTypeOfConnection($from, $to);
     /*------------------------------ TITLE -----------------------------*/
     $active_sheet->setCellValueByColumnAndRow(0, $this->_row, $this->_translate(self::BY_CONNECTION));
     $active_sheet->mergeCells('A' . $this->_row . ':D' . $this->_row);
     $active_sheet->getStyle('A' . $this->_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $active_sheet->getStyle('A' . $this->_row)->getFont()->setBold(true);
     $active_sheet->getStyle('A' . $this->_row)->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => '808080'), 'endcolor' => array('rgb' => '808080')));
     /*----------------------------- END TITLE ---------------------------*/
     $this->nextLine();
     /*------------------------------ HEADER -----------------------------*/
     $active_sheet->setCellValueByColumnAndRow(0, $this->_row, $this->_translate('Type of connection'));
     $active_sheet->setCellValueByColumnAndRow(1, $this->_row, $this->_translate('Total of uses (with a duration or not)'));
     $active_sheet->setCellValueByColumnAndRow(2, $this->_row, $this->_translate('Percentage'));
     $active_sheet->setCellValueByColumnAndRow(3, $this->_row, $this->_translate('Time'));
     $active_sheet->getStyle('A' . $this->_row . ':D' . $this->_row)->getFont()->setBold(true);
     $active_sheet->getStyle('B' . $this->_row . ':D' . $this->_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     /*----------------------------- END HEADER ---------------------------*/
     $this->nextLine();
     /*------------------------------ BODY -----------------------------*/
     foreach ($typeOfConnectionStats['type'] as $typeOfConnection => $typeOfConnectionStat) {
         $active_sheet->setCellValueByColumnAndRow(0, $this->_row, $typeOfConnection);
         if (isset($typeOfConnectionStat)) {
             $active_sheet->setCellValueByColumnAndRow(1, $this->_row, $typeOfConnectionStat[0]);
             $active_sheet->setCellValueByColumnAndRow(2, $this->_row, $typeOfConnectionStat[1] . ' %');
             $active_sheet->setCellValueByColumnAndRow(3, $this->_row, gmdate('G', $typeOfConnectionStat[2]) . 'h' . gmdate('i', $typeOfConnectionStat[2]));
         } else {
             $active_sheet->setCellValueByColumnAndRow(1, $this->_row, '0');
             $active_sheet->setCellValueByColumnAndRow(2, $this->_row, '0 %');
             $active_sheet->setCellValueByColumnAndRow(3, $this->_row, '0h00');
         }
         $active_sheet->getStyle('B' . $this->_row . ':D' . $this->_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $this->nextLine();
     }
     /*----------------------------- END BODY ---------------------------*/
     /*------------------------------ FOOTER -----------------------------*/
     $active_sheet->setCellValueByColumnAndRow(0, $this->_row, $this->_translate('Total'));
     $active_sheet->setCellValueByColumnAndRow(1, $this->_row, $typeOfConnectionStats['totalUses']);
     $active_sheet->setCellValueByColumnAndRow(2, $this->_row, '100%');
     $active_sheet->setCellValueByColumnAndRow(3, $this->_row, gmdate('G', $typeOfConnectionStats['totalTime']) . 'h' . gmdate('i', $typeOfConnectionStats['totalTime']));
     $active_sheet->getStyle('A' . $this->_row . ':D' . $this->_row)->getFont()->setBold(true);
     $active_sheet->getStyle('B' . $this->_row . ':D' . $this->_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $active_sheet->getStyle('A' . $this->_row . ':D' . $this->_row)->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => 'C0C0C0'), 'endcolor' => array('rgb' => 'C0C0C0')));
     /*----------------------------- END FOOTER ---------------------------*/
     $active_sheet->getStyle('A' . ($begin_row + 1) . ':D' . $this->_row)->applyFromArray(array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => PHPExcel_Style_Color::COLOR_BLACK)))));
 }
开发者ID:xmasclaux,项目名称:OpenGenepi,代码行数:57,代码来源:ExportDocument.class.php

示例2: executeAjaxDetailedStat

 public function executeAjaxDetailedStat(sfWebRequest $request, $xhr = true)
 {
     $begin_date = $request->getParameter('from');
     $end_date = $request->getParameter('to');
     $this->from = $begin_date;
     $this->to = $end_date;
     $this->xhr = $xhr;
     $this->userCulture = $this->getUser()->getCulture();
     $countries = array();
     $cities = array();
     $citiesTable = array();
     $imputationsGlobal = Doctrine_Query::create()->select('COUNT(*) as number, SUM(TIME_TO_SEC(i.duration)) as duration')->from('ImputationArchive i')->where('i.imputation_date BETWEEN ? AND ?', array($begin_date, $end_date))->fetchOne();
     $imputations = Doctrine_Query::create()->select('i.*')->from('ImputationArchive i')->where('imputation_date BETWEEN ? AND ?', array($begin_date, $end_date))->execute();
     $numberImputations = $imputationsGlobal->getNumber();
     $totalDuration = $imputationsGlobal->getDuration();
     /*Global statistics*/
     $this->numberImputations = $numberImputations;
     $this->totalTime = $totalDuration;
     if ($numberImputations != 0) {
         /*Gender Stats*/
         $this->genderStats = Statistics::getDetailedValuesByGender($begin_date, $end_date, $numberImputations);
         /*Age Range Stats*/
         $this->ageRangeStats = Statistics::getDetailedValuesByAgeRange($begin_date, $end_date, $numberImputations);
         /*Countries/Cities Stats*/
         foreach ($imputations as $imputation) {
             $country = $imputation->getUserArchive()->getCountry();
             $city = $imputation->getUserArchive()->getCityName();
             if (!in_array($country, $countries)) {
                 $countries[] = $country;
             }
             if (!in_array($city, $citiesTable)) {
                 $citiesTable[] = $city;
                 $cities[$country][] = $city;
             }
         }
         $this->countries = $countries;
         $this->cities = $cities;
         $this->countryCityStats = Statistics::getDetailedValuesByCountryAndCity($begin_date, $end_date, $numberImputations);
         /*By day/time slot Stats*/
         $this->days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
         $dayStats = Statistics::getDetailedValuesByDay($begin_date, $end_date, $numberImputations);
         $this->dayStats = $dayStats;
         $timeslots = array('8h-12h', '12h-16h', '16h-20h', '20h-24h');
         // KYXAR 0010 : Changement du nom de la fonction getDetailedValuesByTimeSlot -> getDetailedValuesByDaysAndTimeSlot
         //$this->dayAndTimeSlotStats = Statistics::getDetailedValuesByTimeSlot($begin_date,$end_date);
         $this->dayAndTimeSlotStats = Statistics::getDetailedValuesByDaysAndTimeSlot($begin_date, $end_date);
         // KYXAR 0010 : Appel de la nouvelle fonction getDetailedValuesByTimeSlot
         $this->TimeSlotStats = Statistics::getDetailedValuesByTimeSlot($begin_date, $end_date);
         $hours[$timeslots[0]] = array('8h-9h', '9h-10h', '10h-11h', '11h-12h');
         $hours[$timeslots[1]] = array('12h-13h', '13h-14h', '14h-15h', '15h-16h');
         $hours[$timeslots[2]] = array('16h-17h', '17h-18h', '18h-19h', '19h-20h');
         $hours[$timeslots[3]] = array('20h-21h', '21h-22h', '22h-23h', '23h-24h');
         $this->timeslots = $timeslots;
         $this->hours = $hours;
         $this->hourStats = Statistics::getDetailedValuesByHour($begin_date, $end_date, $dayStats);
         /*By public categories*/
         $this->publicCategoryStats = Statistics::getDetailedValuesByPublicCategory($begin_date, $end_date, $numberImputations);
         /*By act*/
         $this->actStats = Statistics::getDetailedValuesByAct($begin_date, $end_date, $numberImputations);
         /*By SEG*/
         $this->segStats = Statistics::getDetailedValuesBySeg($begin_date, $end_date, $numberImputations);
         /*By building/room/computer*/
         $this->buildingStats = Statistics::getDetailedValuesByBuilding($begin_date, $end_date, $numberImputations);
         $this->roomStats = Statistics::getDetailedValuesByRoom($begin_date, $end_date);
         $this->computerStats = Statistics::getDetailedValuesByComputer($begin_date, $end_date);
         /*By type of connection*/
         $this->typeOfConnectionStats = Statistics::getDetailedValuesByTypeOfConnection($begin_date, $end_date);
         /*By way of awareness*/
         $this->awarenessStats = Statistics::getDetailedValuesByAwareness($begin_date, $end_date, $numberImputations);
     } else {
         $this->getUser()->setFlash('notice', 'No uses found between these two dates.');
         $this->setTemplate('index', 'stat');
     }
     $this->setTemplate('detailedStat', 'stat');
 }
开发者ID:xmasclaux,项目名称:OpenGenepi,代码行数:75,代码来源:actions.class.php


注:本文中的Statistics::getDetailedValuesByTypeOfConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。