Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -38,6 +38,45 @@ |
39 | 39 | // months, normalized, data, reportlanguage |
40 | 40 | // selectregions, selectcountries, selectwebproperties, selectprojects, selectwikis, selecteditors, selectedits, selectplatform |
41 | 41 | |
| 42 | + $query['conds']['date'] = $params['months']; |
| 43 | + |
| 44 | + if ( $params['normalised'] ) { |
| 45 | + // Do data normalisation stuffs here |
| 46 | + } |
| 47 | + // if/switch on $params['data'] |
| 48 | + |
| 49 | + // $params['reportlanguage'] Change join based on select language |
| 50 | + |
| 51 | + foreach( $this->getAllowedFilters() as $filter ) { |
| 52 | + if ( isset( $params[$filter] ) ) { |
| 53 | + switch ( $filter ) { |
| 54 | + case 'selectregions': |
| 55 | + $query['conds']['region_code'] = $params[$filter]; |
| 56 | + break; |
| 57 | + case 'selectcountries': |
| 58 | + $query['conds']['country_code'] = $params[$filter]; |
| 59 | + break; |
| 60 | + case 'selectwebproperties': |
| 61 | + $query['conds']['web_property'] = $params[$filter]; |
| 62 | + break; |
| 63 | + case 'selectprojects': |
| 64 | + $query['conds']['project_code'] = $params[$filter]; |
| 65 | + break; |
| 66 | + case 'selectwikis': |
| 67 | + $query['conds'][''] = $params[$filter]; |
| 68 | + break; |
| 69 | + case 'selecteditors': |
| 70 | + $query['conds'][''] = $params[$filter]; |
| 71 | + break; |
| 72 | + case 'selectedits': |
| 73 | + $query['conds'][''] = $params[$filter]; |
| 74 | + break; |
| 75 | + case 'selectplatform': |
| 76 | + $query['conds'][''] = $params[$filter]; |
| 77 | + break; |
| 78 | + } |
| 79 | + } |
| 80 | + } |
42 | 81 | $db = $this->getDB(); |
43 | 82 | |
44 | 83 | $this->profileDBIn(); |
— | — | @@ -45,9 +84,19 @@ |
46 | 85 | $this->profileDBOut(); |
47 | 86 | |
48 | 87 | $result = $this->getResult(); |
| 88 | + $data = array(); |
| 89 | + |
| 90 | + $fields = $this->getQueryFields(); |
49 | 91 | foreach( $res as $row ) { |
| 92 | + $item = array(); |
| 93 | + foreach( $fields as $field ) { |
| 94 | + $item[$field] = $row->$field; |
| 95 | + } |
| 96 | + $data[] = $item; |
| 97 | + } |
50 | 98 | |
51 | | - } |
| 99 | + $result->setIndexedTagName( $data, 'metric' ); |
| 100 | + $result->addValue( 'quermetricy', $this->getModuleName(), $data ); |
52 | 101 | } |
53 | 102 | |
54 | 103 | protected abstract function getQueryInfo(); |