本文整理汇总了PHP中Piwik_DataTable::addRowFromSimpleArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::addRowFromSimpleArray方法的具体用法?PHP Piwik_DataTable::addRowFromSimpleArray怎么用?PHP Piwik_DataTable::addRowFromSimpleArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_DataTable
的用法示例。
在下文中一共展示了Piwik_DataTable::addRowFromSimpleArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCompetitionDatatable
public function getCompetitionDatatable()
{
$dataTable = new Piwik_DataTable();
$row1 = new Piwik_DataTable_Row();
$row1->setColumns(array('name' => 'piwik', 'license' => 'GPL'));
$dataTable->addRow($row1);
$dataTable->addRowFromSimpleArray(array('name' => 'google analytics', 'license' => 'commercial'));
return $dataTable;
}
示例2: getCompetitionDatatable
/**
* Returns a custom data table.
* This data table will be converted to all available formats
* when requested in the API request.
*
* @return Piwik_DataTable
*/
public function getCompetitionDatatable()
{
$dataTable = new Piwik_DataTable();
$row1 = new Piwik_DataTable_Row();
$row1->setColumns(array('name' => 'piwik', 'license' => 'GPL'));
// Rows Metadata is useful to store non stats data for example (logos, urls, etc.)
// When printed out, they are simply merged with columns
$row1->setMetadata('logo', 'logo.png');
$dataTable->addRow($row1);
$dataTable->addRowFromSimpleArray(array('name' => 'google analytics', 'license' => 'commercial'));
return $dataTable;
}
示例3: archiveDay
function archiveDay($notification)
{
/**
* @var Piwik_ArchiveProcessing_Day
*/
$archiveProcessing = $notification->getNotificationObject();
$funnelDefinitions = Piwik_Funnels_API::getInstance()->getFunnels($archiveProcessing->idsite);
$funnelDefinitions = $this->initializeStepData($funnelDefinitions);
list($funnelDefinitions, $total) = $this->storeRefAndNextUrls($funnelDefinitions, $archiveProcessing);
// Add the calculations of dropout
foreach ($funnelDefinitions as $funnelDefinition) {
$last_index = count($funnelDefinition['steps']) - 1;
$idFunnel = $funnelDefinition['idfunnel'];
$idGoal = $funnelDefinition['idgoal'];
// get the goal conversions grouped by the converting action
$goal_query = $archiveProcessing->queryConversionsBySegment('idaction_url');
$goalConversions = array();
while ($row = $goal_query->fetch()) {
if ($row['idgoal'] == $idGoal) {
$goalConversions[$row['idaction_url']] = $row['nb_conversions'];
}
}
for ($i = 0; $i <= $last_index; $i++) {
$current_step =& $funnelDefinition['steps'][$i];
$idStep = $current_step['idstep'];
// record number of actions for the step
$recordName = Piwik_Funnels::getRecordName('nb_actions', $idFunnel, $idStep);
$archiveProcessing->insertNumericRecord($recordName, $current_step['nb_actions']);
# Remove the previous step urls from the idaction_url_ref array and add their actions to the
# count of actions moving from the previous step to this one
if ($i > 0) {
$previous_step = $funnelDefinition['steps'][$i - 1];
$nb_prev_step_actions = 0;
foreach ($previous_step['idaction_url'] as $key => $value) {
if (isset($current_step['idaction_url_ref'][$key])) {
$nb_prev_step_actions += $current_step['idaction_url_ref'][$key]['value'];
unset($current_step['idaction_url_ref'][$key]);
}
}
$recordName = Piwik_Funnels::getRecordName('nb_next_step_actions', $idFunnel, $previous_step['idstep']);
$archiveProcessing->insertNumericRecord($recordName, $nb_prev_step_actions);
// calculate a percent of people continuing from the previous step to this
$recordName = Piwik_Funnels::getRecordName('percent_next_step_actions', $idFunnel, $previous_step['idstep']);
$archiveProcessing->insertNumericRecord($recordName, $this->percent($nb_prev_step_actions, $previous_step['nb_actions']));
}
if ($i < $last_index) {
$next_step = $funnelDefinition['steps'][$i + 1];
# Remove this step's next actions that are actions for the next funnel step
foreach ($current_step['idaction_url_next'] as $key => $value) {
if (isset($next_step['idaction_url'][$key])) {
unset($current_step['idaction_url_next'][$key]);
}
}
# Archive the next urls that aren't funnel steps
$idActionNext = new Piwik_DataTable();
$exitCount = 0;
foreach ($current_step['idaction_url_next'] as $id => $data) {
$idActionNext->addRowFromSimpleArray($data);
$exitCount += $data['value'];
}
$recordName = Piwik_Funnels::getRecordName('idaction_url_next', $idFunnel, $idStep);
$archiveProcessing->insertBlobRecord($recordName, $idActionNext->getSerialized());
destroy($idActionNext);
# and a sum of exit actions
$recordName = Piwik_Funnels::getRecordName('nb_exit', $idFunnel, $idStep);
$archiveProcessing->insertNumericRecord($recordName, $exitCount);
}
// Archive the referring urls that aren't funnel steps
$idActionRef = new Piwik_DataTable();
$entryCount = 0;
foreach ($current_step['idaction_url_ref'] as $id => $data) {
$idActionRef->addRowFromSimpleArray($data);
$entryCount += $data['value'];
}
$recordName = Piwik_Funnels::getRecordName('idaction_url_ref', $idFunnel, $idStep);
$archiveProcessing->insertBlobRecord($recordName, $idActionRef->getSerialized());
destroy($idActionRef);
# and a sum of entry actions
$recordName = Piwik_Funnels::getRecordName('nb_entry', $idFunnel, $idStep);
$archiveProcessing->insertNumericRecord($recordName, $entryCount);
}
// For the last step, the comparison is the goal itself
$last_step = $funnelDefinition['steps'][$last_index];
$idStep = $last_step['idstep'];
$recordName = Piwik_Funnels::getRecordName('nb_next_step_actions', $idFunnel, $idStep);
$nb_goal_actions = 0;
foreach ($goalConversions as $key => $value) {
if (isset($last_step['idaction_url_next'][$key])) {
$nb_goal_actions += $last_step['idaction_url_next'][$key]['value'];
unset($last_step['idaction_url_next'][$key]);
}
}
$archiveProcessing->insertNumericRecord($recordName, $nb_goal_actions);
$recordName = Piwik_Funnels::getRecordName('percent_next_step_actions', $idFunnel, $idStep);
$archiveProcessing->insertNumericRecord($recordName, $this->percent($nb_goal_actions, $last_step['nb_actions']));
# Archive the next urls that aren't funnel steps
$idActionNext = new Piwik_DataTable();
$exitCount = 0;
foreach ($last_step['idaction_url_next'] as $id => $data) {
$idActionNext->addRowFromSimpleArray($data);
//.........这里部分代码省略.........
示例4: getTablesSummary
/**
* Returns a datatable representation of a set of table statuses.
*
* @param array $statuses The table statuses to summarize.
* @return Piwik_DataTable
*/
private function getTablesSummary($statuses)
{
$dataTable = new Piwik_DataTable();
foreach ($statuses as $status) {
$dataTable->addRowFromSimpleArray(array('label' => $status['Name'], 'data_size' => $status['Data_length'], 'index_size' => $status['Index_length'], 'row_count' => $status['Rows']));
}
return $dataTable;
}