示例#1
0
 /**
  * Utility function that adds a visit percent column to a data table,
  * regardless of whether the data table is an data table array or just
  * a data table.
  *
  * @param Piwik_DataTable $dataTable The data table to modify.
  */
 private static function addVisitsPercentColumn($dataTable)
 {
     if ($dataTable instanceof Piwik_DataTable_Array) {
         foreach ($dataTable->getArray() as $table) {
             self::addVisitsPercentColumn($table);
         }
     } else {
         $totalVisits = array_sum($dataTable->getColumn(Piwik_Archive::INDEX_NB_VISITS));
         $dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('nb_visits_percentage', 'nb_visits', $totalVisits));
     }
 }