/**
*
* @service banner_stats read
* @param $data
*/
public function loadFullStatistics(Gpf_Rpc_Params $params) {
$data = new Gpf_Rpc_Data($params);
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->from->add(Pap_Db_Table_Banners::getName());
$select->select->add("COUNT(".Pap_Db_Table_Banners::ID.")", "count");
$select->select->add(Pap_Db_Table_Banners::TYPE, 'type');
$select->groupBy->add(Pap_Db_Table_Banners::TYPE);
Gpf_Plugins_Engine::extensionPoint('AffiliateNetwork.modifyWhere',
new Gpf_Common_SelectBuilderCompoundRecord($select, new Gpf_Data_Record(array(), array())));
$result = $select->getAllRowsIndexedBy('type');
$bannerTypes = explode(',', $data->getParam('bannerTypes'));
$bannersCount = 0;
foreach ($bannerTypes as $bannerType) {
$bannerTypeCount = 0;
try {
$bannerTypeCount = $result->getRecord($bannerType)->get('count');
} catch (Gpf_Data_RecordSetNoRowException $e) {
}
$data->setValue($bannerType, "$bannerTypeCount");
$bannersCount += $bannerTypeCount;
}
$data->setValue("bannersCount", "$bannersCount");
return $data;
}