本文整理汇总了PHP中Statistics::getQuantitativeDetailsPerCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP Statistics::getQuantitativeDetailsPerCategory方法的具体用法?PHP Statistics::getQuantitativeDetailsPerCategory怎么用?PHP Statistics::getQuantitativeDetailsPerCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistics
的用法示例。
在下文中一共展示了Statistics::getQuantitativeDetailsPerCategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _exportQuantitativeStatement
/**
*
* @param $from
* @param $to
*/
protected function _exportQuantitativeStatement($from, $to)
{
$active_sheet = $this->getDocument()->getActiveSheet();
$acts = Doctrine_Query::create()->select('a.designation')->from('Act a')->where('a.disabled = ?', 0)->orderBy('a.designation')->execute();
$numberOfActs = Doctrine_Query::create()->select('COUNT(*) as total')->from('Act a')->where('a.disabled = ?', 0)->fetchOne();
$statement = Statistics::getQuantitativeStatementValuesByAct($from, $to);
/*Print all the acts at the top:*/
$this->_exportQuantitativeStatementHeader($statement);
$columns = Statistics::getQuantitativeStatementColumns($from, $to);
$total = Statistics::getTotalQuantitativeStatementValues($from, $to);
foreach ($columns as $stat_type => $stat) {
$this->_exportQuantitativeStatementRessourceByString($columns, $statement, $stat_type, $total);
}
foreach ($columns as $stat_type => $stat) {
$this->_exportQuantitativeStatementRessourceById($columns, $statement, $stat_type, $total);
}
//Specific exportations:
$this->_exportQuantitativeStatementByCountry($columns, $statement, $total, $from, $to);
$this->nextLine(3);
$this->_exportQuantitativeStatementByDay($columns, $statement, $total);
$this->nextLine(3);
$this->_exportQuantitativeStatementByBuilding($columns, $statement, $total);
$this->nextLine(3);
//Details per category:
$detailsPerCategory = Statistics::getQuantitativeDetailsPerCategory($from, $to);
$this->_exportDetailsPerCategory($columns, $detailsPerCategory, $total);
$this->nextLine(3);
//Details per time slot:
$detailsPerTimeSlot = Statistics::getQuantitativeDetailsPerTimeSlot($from, $to);
$this->_exportDetailsPerTimeSlot($columns, $detailsPerTimeSlot, $total);
$this->nextLine(3);
//Page setup:
$page_setup = new PHPExcel_Worksheet_PageSetup();
$page_setup->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$page_setup->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$page_setup->setHorizontalCentered(true);
$active_sheet->setPageSetup($page_setup);
$active_sheet->setShowGridlines(true);
$active_sheet->setPrintGridlines(true);
//Margins:
$active_sheet->getPageMargins()->setTop(0.4);
$active_sheet->getPageMargins()->setRight(0.2);
$active_sheet->getPageMargins()->setLeft(0.2);
$active_sheet->getPageMargins()->setBottom(0.4);
}
示例2: executeQuantitativeStatement
public function executeQuantitativeStatement(sfWebRequest $request)
{
$from = $request->getParameter('formattedFrom');
$to = $request->getParameter('formattedTo');
$countries = array();
$citiesTable = array();
$cities = array();
$this->acts = Doctrine_Query::create()->select('a.designation')->from('Act a')->where('a.disabled = ?', 0)->orderBy('a.designation')->execute();
$this->numberOfActs = Doctrine_Query::create()->select('COUNT(*) as total')->from('Act a')->where('a.disabled = ?', 0)->fetchOne();
$imputations = Doctrine_Query::create()->select('i.*')->from('ImputationArchive i')->where('imputation_date BETWEEN ? AND ?', array($from, $to))->execute();
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->statement = Statistics::getQuantitativeStatementValuesByAct($from, $to);
$this->detailsPerCategory = Statistics::getQuantitativeDetailsPerCategory($from, $to);
$this->detailsPerTimeSlot = Statistics::getQuantitativeDetailsPerTimeSlot($from, $to);
$this->total = Statistics::getTotalQuantitativeStatementValues($from, $to);
$this->columns = Statistics::getQuantitativeStatementColumns($from, $to);
$this->from = $from;
$this->to = $to;
$this->setLayout('emptyLayout');
}