Skip to content

Commit

Permalink
Refs #2135
Browse files Browse the repository at this point in the history
 * BETA release of Segment editor.
 * API to add/update/delete/get recorded segments
 * cron script will pre-process segments marked as such
 * UI to create, update, apply segments

TODOs @mattab
 - test with NON super user (anon/view/admin)
 - testing (and more testing)-- try to break it (it's not hard...)
 - UI: Saving the segment for reuse / pre-processing
 - Loading message: "This can take a while based on the amount of data that needs to be pre-archived"
 - i18n
 - Save & Apply this segment ==> "Test this segment" which would call VisitsSummary.get for early feedback ?

+ hoping for Piotr superJS Ninjas skills with some jquery/js that I can't figure out
  • Loading branch information
mattab committed Apr 23, 2013
1 parent 1eff943 commit 7933de1
Show file tree
Hide file tree
Showing 66 changed files with 28,421 additions and 24,622 deletions.
16 changes: 13 additions & 3 deletions core/Piwik.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static public function unlinkRecursive($dir, $deleteRootToo)
* @param int $nFlags glob() flags
* @return array
*/
public static function globr($sDir, $sPattern, $nFlags = NULL)
public static function globr($sDir, $sPattern, $nFlags = null)
{
if (($aFiles = _glob("$sDir/$sPattern", $nFlags)) == false) {
$aFiles = array();
Expand Down Expand Up @@ -1438,7 +1438,7 @@ static public function getPrettyTimeFromSeconds($numberOfSeconds, $displayTimeAs

$seconds = $minusDaysAndHours - $minutes * 60;
$precision = ($seconds > 0 && $seconds < 0.01 ? 3 : 2);
$seconds = round($seconds, $precision);
$seconds = round($seconds, $precision);

if ($years > 0) {
$return = sprintf(Piwik_Translate('General_YearsDays'), $years, $days);
Expand All @@ -1448,7 +1448,7 @@ static public function getPrettyTimeFromSeconds($numberOfSeconds, $displayTimeAs
$return = sprintf(Piwik_Translate('General_HoursMinutes'), $hours, $minutes);
} elseif ($minutes > 0) {
$return = sprintf(Piwik_Translate('General_MinutesSeconds'), $minutes, $seconds);
} else {
} else {
$return = sprintf(Piwik_Translate('General_Seconds'), $seconds);
}
if ($isHtml) {
Expand Down Expand Up @@ -1540,11 +1540,21 @@ static public function getKnownSegmentsToArchive()
if (is_null($cachedResult)) {
$segments = Piwik_Config::getInstance()->Segments;
$cachedResult = isset($segments['Segments']) ? $segments['Segments'] : '';

Piwik_PostEvent('Piwik.getKnownSegmentsToArchiveAllSites', $cachedResult);

}

return $cachedResult;
}

static public function getKnownSegmentsToArchiveForSite($idSite)
{
$segments = array();
Piwik_PostEvent('Piwik.getKnownSegmentsToArchiveForSite', $segments, $idSite);
return $segments;
}

/*
* Access
*/
Expand Down
3 changes: 1 addition & 2 deletions core/SegmentExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function parseSubExpressions()
. '){1}(.+)/';
$match = preg_match($pattern, $operand, $matches);
if ($match == 0) {
throw new Exception('Segment parameter \'' . $operand . '\' does not appear to have a valid format.');
throw new Exception('The segment \'' . $operand . '\' is not valid.');
}

$leftMember = $matches[1];
Expand Down Expand Up @@ -149,7 +149,6 @@ public function parseSubExpressionsIntoSqlExpressions(&$availableTables = array(
* @throws Exception
* @return array
*/
// @todo case insensitive?
protected function getSqlMatchFromDefinition($def, &$availableTables)
{
$field = $def[0];
Expand Down
1 change: 0 additions & 1 deletion lang/be.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
'General_NumberOfVisits' => 'Колькасць наведванняў',
'General_VisitConvertedGoal' => 'Наведванне пераўтвораннае хаця б у адну Мэту',
'General_VisitConvertedGoalId' => 'Наведаць пераўтвораны вызначаным ідэнтыфікатарам мэты',
'General_EcommerceVisitStatus' => 'Наведаць статус электроннай камерцыі у канцы наведвання. Напрыклад, каб выбраць усе наведванні, якія зрабілі электронна-камерцыйнаю замову, API-запыт будзе змяшчаць %s',
'General_VisitConvertedNGoals' => 'Наведванне, якое канвертавалася %s мэту',
'General_NewVisitor' => 'Новы наведвальнік',
'General_NewVisits' => 'Новыя наведвання',
Expand Down
3,613 changes: 1,806 additions & 1,807 deletions lang/bg.php

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion lang/ca.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
'General_NumberOfVisits' => 'Número de visites',
'General_VisitConvertedGoal' => 'La visita ha convertit al menys un objectiu',
'General_VisitConvertedGoalId' => 'La visita ha convertit un id d\'objectiu especific',
'General_EcommerceVisitStatus' => 'Visita l\'estat de l\'e-commerce al final de la visita. Per exempel, seleccionar totes les visites que han fet una comanda d\'e-commerce, la petició de l\'API tindrà %s',
'General_VisitConvertedNGoals' => 'La visita ha convertit %s objectius',
'General_NewVisitor' => 'Nova visita',
'General_NewVisits' => 'Noves visites',
Expand Down
1 change: 0 additions & 1 deletion lang/cy.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
'General_DaysSinceLastEcommerceOrder' => 'Nifer o ddiwrnodau ers yr archeb eFasnach diwethaf',
'General_NumberOfVisits' => 'Nifer o Ymweliadau',
'General_VisitConvertedGoal' => 'Mae\'r ymweliad wedi trosi o leiaf un Nod',
'General_EcommerceVisitStatus' => 'Ymwelwch â statws eFasnach ar ddiwedd yr ymweliad. Er enghraifft, i ddewis yr holl ymweliadau sydd wedi gwneud archeb Efasnach, byddai\'r cais API yn cynnwys %s',
'General_VisitConvertedNGoals' => 'Mae\'r ymweliad wedi trosi %s Nod',
'General_NewVisitor' => 'Ymwelydd Newydd',
'General_ReturningVisitor' => 'Ymwelydd yn ail ymweld',
Expand Down
Loading

0 comments on commit 7933de1

Please sign in to comment.