[SOLVED] period range does not work on my own plugin


#1

Hello,

I’m creating a plugin und added the achiv mechanism. Everything works fine (selection of day, week, month, year), beside the selection of a time range. Range shows allways no result, though there has to be a result.

Does anyone have an idea where the problem is?

Have a nice day
illuxio


(Matthieu Aubry) #2

Please compare your code with the existing archiving plugins maybe?


#3

I did and there are no real differentes.

Sort update:

I have the following code snippets:


    public function archivePeriod($notification) {
        $archiveProcessing = $notification -> getNotificationObject();

        if (!$archiveProcessing -> shouldProcessReportsForPlugin($this -> getPluginName())) {
            return;
        }

        $archiveProcessing -> archiveDataTable(array(self::ARCHIV_ENTRY_NAME));
    }

[right]For generating the archives of a period.[/right]


    public function getDataTable($idSite, $period, $date, $segment = null, $expanded = null) {
        Piwik::checkUserHasViewAccess($idSite);
        $dataTable = Piwik_Archive::getDataTableFromArchive(Piwik_404Referrer::ARCHIV_ENTRY_NAME, $idSite, $period, $date, $segment, $expanded);
        return $dataTable;
    }

[right]For getting the Piwik_DataTable from the archiv.[/right]

All works excepte the period ‘range’.


(Matthieu Aubry) #4

Sorry I cant say for sure, it would take time beyond the normal “free support” but I agree we should have better examples toreuse…


#5

[quote=illuxio]
I did and there are no real differentes.

Sort update:

I have the following code snippets:


    public function archivePeriod($notification) {
        $archiveProcessing = $notification -> getNotificationObject();

        if (!$archiveProcessing -> shouldProcessReportsForPlugin($this -> getPluginName())) {
            return;
        }

        $archiveProcessing -> archiveDataTable(array(self::ARCHIV_ENTRY_NAME));
    }

[right]For generating the archives of a period.[/right]


    public function getDataTable($idSite, $period, $date, $segment = null, $expanded = null) {
        Piwik::checkUserHasViewAccess($idSite);
        $dataTable = Piwik_Archive::getDataTableFromArchive(Piwik_404Referrer::ARCHIV_ENTRY_NAME, $idSite, $period, $date, $segment, $expanded);
        return $dataTable;
    }

[right]For getting the Piwik_DataTable from the archiv.[/right]

All works excepte the period ‘range’.[/quote]

The problem was that constant “self::ARCHIV_ENTRY_NAME” has the wrong name. The db entries have to begin with the plugin name!


(Matthieu Aubry) #6

OH thanks for noting this this is right… not very clear.