generatePageVisitHitTopDays speziell für den Export
Filterung nach Anzahl Tagen

@param integer $VisitorsID
@param number $days
@param string $parse
@return string|multitype:string NULL
775529
public function generatePageVisitHitTopDays($VisitorsID, $days = 365, $parse = false)
    {
        $STARTDATE = date("Y-m-d", mktime(0, 0, 0, date("m")  , date("d")-$days, date("Y")) ); 
        $arrPageStatCount = false;
        $objPageStatCount = \Database::getInstance()
                            ->prepare("SELECT
                                        visitors_page_id,
                                        visitors_page_pid,
                                        visitors_page_lang,
                                        visitors_page_type,
                                        SUM(visitors_page_visit) AS visitors_page_visits,
                                        SUM(visitors_page_hit)   AS visitors_page_hits
                                    FROM
                                        tl_visitors_pages
                                    WHERE
                                        vid = ?
                                    AND
                                        visitors_page_date >= ?
                                    GROUP BY
                                        visitors_page_id,
                                        visitors_page_pid,
                                        visitors_page_lang,
                                        visitors_page_type
                                    ORDER BY
                                        visitors_page_visits DESC,
                                        visitors_page_hits DESC,
                                        visitors_page_id,
                                        visitors_page_pid,
                                        visitors_page_lang
                                    ")
                            ->execute($VisitorsID, $STARTDATE);
    
        while ($objPageStatCount->next())
        {
            switch ($objPageStatCount->visitors_page_type)
            {
            	case self::PAGE_TYPE_NORMAL :
            	    $objPage = \PageModel::findWithDetails($objPageStatCount->visitors_page_id);
            	    $alias   = $objPage->alias;
            	    break;
            	case self::PAGE_TYPE_NEWS :
            	    $alias   = false;
            	    $aliases = $this->getNewsAliases($objPageStatCount->visitors_page_id);
            	    if (false !== $aliases['PageAlias'])
            	    {
            	        $alias = $aliases['PageAlias'] .'/'. $aliases['NewsAlias'];
            	    }
            	    break;
            	case self::PAGE_TYPE_FAQ :
            	    $alias   = false;
            	    $aliases = $this->getFaqAliases($objPageStatCount->visitors_page_id);
            	    if (false !== $aliases['PageAlias'])
            	    {
            	        $alias = $aliases['PageAlias'] .'/'. $aliases['FaqAlias'];
            	    }
            	    break;
        	    case self::PAGE_TYPE_ISOTOPE:
        	        $alias   = false;
        	        $aliases = $this->getIsotopeAliases($objPageStatCount->visitors_page_id, $objPageStatCount->visitors_page_pid);
        	        if (false !== $aliases['PageAlias'])
        	        {
        	            $alias = $aliases['PageAlias'] .'/'. $aliases['ProductAlias'];
        	        }
        	        break;
            	case self::PAGE_TYPE_FORBIDDEN :
            	    $alias   = false;
            	    $objPage  = \PageModel::findWithDetails($objPageStatCount->visitors_page_id);
            	    $alias403 = $this->getForbiddenAlias($objPageStatCount->visitors_page_id,
            	        $objPageStatCount->visitors_page_lang);
            	    $alias = $alias403 .' ['.$objPage->alias.']';
            	    break;
            	default:
            	    $alias = '-/-';
                	break;
            }
    
            if (false !== $alias)
            {
                $arrPageStatCount[] = array
                (
                    'alias'         => $alias,
                    'lang'          => $objPageStatCount->visitors_page_lang,
                    'visits'        => $objPageStatCount->visitors_page_visits,
                    'hits'          => $objPageStatCount->visitors_page_hits
                );
            }
        }
    
        if ($parse === true)
        {
            $this->TemplatePartial = new \BackendTemplate('mod_visitors_be_stat_partial_pagevisithittop');
            $this->TemplatePartial->PageVisitHitTop = $arrPageStatCount;
            return $this->TemplatePartial->parse();
        }
        else
        {
            return $arrPageStatCount;
        }
    }
678633
public static function calToJd($calendar_id, $month, $day, $year)
    {
        switch ($calendar_id) {
            case CAL_FRENCH:
                return self::frenchToJd($month, $day, $year);

            case CAL_GREGORIAN:
                return self::gregorianToJd($month, $day, $year);

            case CAL_JEWISH:
                return self::jewishToJd($month, $day, $year);

            case CAL_JULIAN:
                return self::julianToJd($month, $day, $year);

            default:
                return trigger_error('invalid calendar ID ' . $calendar_id . '.', E_USER_WARNING);
        }
    }
368565
public static function parseDays(string $annotation)
	{
		static $validValues = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun',];

		$days = NULL;
		$annotation = Strings::trim($annotation);
		if (Strings::length($annotation)) {
			$days = static::translateToDayNames($annotation);
			$days = static::expandDaysRange($days);
			foreach ($days as $day) {
				if (!in_array($day, $validValues)) {
					throw new InvalidParameterException(
						"Given day parameter '" . $day . "' must be one from " . implode(', ', $validValues) . "."
					);
				}
			}
			$days = array_values(array_intersect($validValues, $days));
		}

		return $days ?: NULL;
	}
1192058
protected function getSearchEngine($VisitorsKatID)
	{
		$VisitorsSearchEngines        = array(); // only searchengines
		$VisitorsSearchEngineKeywords = array(); //searchengine - keywords, order by keywords
		$day60 = mktime(0, 0, 0, date("m")-2 , date("d") ,date("Y"));
		
		$objVisitors = \Database::getInstance()
		        ->prepare("SELECT 
                                tl_visitors.id AS id
                            FROM 
                                tl_visitors 
                            LEFT JOIN 
                                tl_visitors_category ON (tl_visitors_category.id=tl_visitors.pid)
                            WHERE 
                                tl_visitors.pid=? AND published=?
                            ORDER BY id")
                ->limit(1)
                ->execute($VisitorsKatID,1);
		if ($objVisitors->numRows > 0) 
		{
			$objVisitors->next();
			$VisitorsID = $objVisitors->id;
			
			$objVisitorsSearchEngines = \Database::getInstance()
			        ->prepare("SELECT 
                                    `visitors_searchengine`,
                                    count(*) as anz 
                                FROM 
                                    `tl_visitors_searchengines` 
                                WHERE 
                                    `vid`=? AND `tstamp` > ? 
                                GROUP BY 1 
                                ORDER BY anz DESC")
                    ->limit(20)
                    ->execute($VisitorsID,$day60);
			if ($objVisitorsSearchEngines->numRows > 0) 
			{
			    while ($objVisitorsSearchEngines->next()) 
			    {
			        if ('Generic' == $objVisitorsSearchEngines->visitors_searchengine)
			        {
			            $objVisitorsSearchEngines->visitors_searchengine = $GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['searchengine_unknown'];
			        }
	            	$VisitorsSearchEngines[] = array($objVisitorsSearchEngines->visitors_searchengine, 
                                                     $objVisitorsSearchEngines->anz);
			    }
		    }
		    
		    $objVisitorsSearchEngineKeywords = \Database::getInstance()
		            ->prepare("SELECT 
                                    `visitors_searchengine`, 
                                    lower(`visitors_keywords`) AS keyword, 
                                    count(*) AS anz 
                                FROM 
                                    `tl_visitors_searchengines` 
                                WHERE 
                                    `vid`=? AND `tstamp` > ? 
                                GROUP BY 1,2 
                                ORDER BY anz DESC")
                    ->limit(20)
                    ->execute($VisitorsID,$day60);
			if ($objVisitorsSearchEngineKeywords->numRows > 0) 
			{
			    while ($objVisitorsSearchEngineKeywords->next()) 
			    {
			        // Issue #67
			        if ('notdefined' == $objVisitorsSearchEngineKeywords->keyword) 
			        {
			            $objVisitorsSearchEngineKeywords->keyword = $GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['not_defined'];
			        }
			        if ('Generic' == $objVisitorsSearchEngineKeywords->visitors_searchengine)
			        {
			            $objVisitorsSearchEngineKeywords->visitors_searchengine = $GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['searchengine_unknown'];
			        }
	            	$VisitorsSearchEngineKeywords[] = array($objVisitorsSearchEngineKeywords->visitors_searchengine, 
                                                            $objVisitorsSearchEngineKeywords->keyword, 
                                                            $objVisitorsSearchEngineKeywords->anz);
			    }
		    }
	    }
	    if (0 == count($VisitorsSearchEngines) && 0 == count($VisitorsSearchEngineKeywords)) 
	    { 
	        return false;
	    }
	    return array('SearchEngines' => $VisitorsSearchEngines, 
                     'SearchEngineKeywords' =>$VisitorsSearchEngineKeywords);
	}
226731
protected function getFourteenDays($KatID, $VisitorsXid)
	{
		$visitors_today_visit     = 0;
		$visitors_today_hit       = 0;
		$visitors_yesterday_visit = 0;
		$visitors_yesterday_hit   = 0;
		$visitors_visit_start     = 0;
		$visitors_hit_start       = 0;
		$visitors_day_of_week_prefix = '';
		//Anzahl Tage zu erst auslesen die angezeigt werden sollen
		$objVisitors = \Database::getInstance()->prepare("SELECT tv.visitors_statistic_days FROM tl_visitors tv WHERE tv.pid = ? AND tv.id = ?")
                                               ->limit(1)
                                               ->execute($KatID, $VisitorsXid);
		while ($objVisitors->next())
		{
		    $visitors_statistic_days = $objVisitors->visitors_statistic_days;
		}
		if ($visitors_statistic_days < 14) 
		{
			$visitors_statistic_days = 14;
		}
		if ($visitors_statistic_days > 99)
		{
		    $visitors_statistic_days = 99;
		}
	    // 7 Tages Statistik und Vorgabewerte
	    $objVisitors = \Database::getInstance()
	            ->prepare("SELECT 
                                tv.id,
                                tv.visitors_name,
                                tv.visitors_startdate,
                                tv.visitors_visit_start,
                                tv.visitors_hit_start,
                                tv.published,
                                tvc.visitors_date,
                                tvc.visitors_visit,
                                tvc.visitors_hit
                            FROM
                                tl_visitors tv,
                                tl_visitors_counter tvc
                            WHERE
                                tv.id = tvc.vid AND tv.pid = ? AND tv.id = ?
                            ORDER BY tv.visitors_name , tvc.visitors_date DESC")
                ->limit($visitors_statistic_days)
                ->execute($KatID, $VisitorsXid);
		$intRowsVisitors = $objVisitors->numRows;
		if ($intRowsVisitors>0) 
		{ // Zählungen vorhanden
		    while ($objVisitors->next())
    		{
    		    if ($objVisitors->published == 1) 
    		    {
    		        
    		        $objVisitors->published = '<span class="visitors_stat_yes">'.$GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['pub_yes'].'</span>';
    		    } 
    		    else 
    		    {
    		    	$objVisitors->published = '<span class="visitors_stat_no">'.$GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['pub_no'].'</span>';
    		    }
    		    if (!strlen($objVisitors->visitors_startdate)) 
    		    {
    		    	$visitors_startdate = $GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['startdate_not_defined'];
    		    } 
    		    else 
    		    {
    		        $visitors_startdate = $this->parseDateVisitors($GLOBALS['TL_LANGUAGE'], $objVisitors->visitors_startdate);
    		    }
    		    // day of the week prüfen
    		    if (strpos($GLOBALS['TL_CONFIG']['dateFormat'],'D')===false  // day of the week short 
    		     && strpos($GLOBALS['TL_CONFIG']['dateFormat'],'l')===false) // day of the week long
    		    {
    		        $visitors_day_of_week_prefix = 'D, ';
    		    }
    		    $arrVisitorsStat[] = array
    			(
    			    'visitors_id'           => $objVisitors->id,
    				'visitors_name'         => \StringUtil::specialchars(ampersand($objVisitors->visitors_name)),
    				'visitors_active'       => $objVisitors->published,
    				'visitors_date'         => $this->parseDateVisitors($GLOBALS['TL_LANGUAGE'], strtotime($objVisitors->visitors_date), $visitors_day_of_week_prefix),
    				'visitors_date_ymd'     => $objVisitors->visitors_date,
    				'visitors_startdate'    => $visitors_startdate,
    				'visitors_visit'        => $this->getFormattedNumber($objVisitors->visitors_visit,0),
    				'visitors_hit'          => $this->getFormattedNumber($objVisitors->visitors_hit,0)
	            );
	            if ($objVisitors->visitors_date == date("Y-m-d")) 
	            {
	                $visitors_today_visit = $objVisitors->visitors_visit;
	                $visitors_today_hit   = $objVisitors->visitors_hit;
	            }
	            if ($objVisitors->visitors_date == date("Y-m-d", time()-(60*60*24))) 
	            {
	                $visitors_yesterday_visit = $objVisitors->visitors_visit;
	                $visitors_yesterday_hit   = $objVisitors->visitors_hit;
	            }
    		} // while
    		$arrVisitorsStat[104]['VisitorsID'] = $objVisitors->id;
			$visitors_visit_start = $objVisitors->visitors_visit_start;
			$visitors_hit_start   = $objVisitors->visitors_hit_start;
		} 
		else 
		{
			$objVisitors = \Database::getInstance()
			        ->prepare("SELECT 
                                    tv.id, 
                                    tv.visitors_name, 
                                    tv.visitors_startdate, 
                                    tv.published
                                FROM
                                    tl_visitors tv
                                WHERE
                                    tv.pid = ? AND tv.id = ?
                                ORDER BY tv.visitors_name")
                    ->limit(1)
                    ->execute($KatID, $VisitorsXid);
			$objVisitors->next();
			if ($objVisitors->published == 1) 
			{
		        $objVisitors->published = '<span class="visitors_stat_yes">'.$GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['pub_yes'].'</span>';
		    } 
		    else 
		    {
		    	$objVisitors->published = '<span class="visitors_stat_no">'.$GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['pub_no'].'</span>';
		    }
		    if (!strlen($objVisitors->visitors_startdate)) 
		    {
		    	$visitors_startdate = $GLOBALS['TL_LANG']['MSC']['tl_visitors_stat']['startdate_not_defined'];
		    } 
		    else 
		    {
		        $visitors_startdate = $this->parseDateVisitors($GLOBALS['TL_LANGUAGE'],$objVisitors->visitors_startdate);
		    }
		    $arrVisitorsStat[] = array
			(
			    'visitors_id'           => $objVisitors->id,
				'visitors_name'         => \StringUtil::specialchars(ampersand($objVisitors->visitors_name)),
				'visitors_active'       => $objVisitors->published,
				'visitors_startdate'    => $visitors_startdate
            );
		    $arrVisitorsStat[104]['VisitorsID'] = 0;
		}
		$arrVisitorsStat[100]['visitors_today_visit']     = $this->getFormattedNumber($visitors_today_visit,0);
	    $arrVisitorsStat[100]['visitors_today_hit']       = $this->getFormattedNumber($visitors_today_hit,0);
	    $arrVisitorsStat[100]['visitors_yesterday_visit'] = $this->getFormattedNumber($visitors_yesterday_visit,0);
	    $arrVisitorsStat[100]['visitors_yesterday_hit']   = $this->getFormattedNumber($visitors_yesterday_hit,0);
	    $arrVisitorsStat[110]['visitors_visit_start']     = $this->getFormattedNumber($visitors_visit_start,0);
		$arrVisitorsStat[110]['visitors_hit_start']       = $this->getFormattedNumber($visitors_hit_start,0);
		return $arrVisitorsStat;
	}
202893
public function generateScreenTopResolution($VisitorsID,$limit=20)
    {
        $arrScreenStatCount = false;
        
        $this->TemplatePartial = new \BackendTemplate('mod_visitors_be_stat_partial_screentopresolution');
        
        $objScreenStatCount = \Database::getInstance()
                        ->prepare("SELECT 
                                        `v_s_w`,
                                        `v_s_h`,
                                        `v_s_iw`,
                                        `v_s_ih`,
                                        SUM(`v_screen_counter`) AS v_screen_sum
                                    FROM
                                        `tl_visitors_screen_counter`
                                    WHERE
                                        `vid` = ?
                                    GROUP BY `v_s_w`, `v_s_h`, `v_s_iw`, `v_s_ih`
                                    ORDER BY v_screen_sum DESC
                                ")
                        ->limit($limit)
                        ->execute($VisitorsID);

        while ($objScreenStatCount->next())
        {
            $arrScreenStatCount[] = array
            (
                'v_s_width'     => $objScreenStatCount->v_s_w,
                'v_s_height'    => $objScreenStatCount->v_s_h,
                'v_s_iwidth'    => $objScreenStatCount->v_s_iw,
                'v_s_iheight'   => $objScreenStatCount->v_s_ih,
                'v_screen_sum'  => $objScreenStatCount->v_screen_sum
            );
        }
        $this->TemplatePartial->ScreenTopResolution = $arrScreenStatCount;        
        return $this->TemplatePartial->parse();
    }
445435
public function getSearchEngines($parameters = [], $parseResult = true)
    {
        $this->setParams([
            'metrics'    => 'ga:pageviews,ga:sessionDuration,ga:exits',
            'dimensions' => 'ga:source',
            'filters'    => 'ga:medium==cpa,ga:medium==cpc,ga:medium==cpm,ga:medium==cpp,ga:medium==cpv,ga:medium==organic,ga:medium==ppc',
            'sort'       => '-ga:pageviews',
        ]);

        return $this->execute($parameters, $parseResult);
    }
208935
public function setNoWorkingDays(array $days, $format = null)
    {
        $this->noWorkingDays = $days;
        if ($format) {
            $this->formatNoWorkingDays = $format;
        }
        return $this;
    }
1180048
public function getVisitorProfile($visitorId, $arguments = [], $format = null)
    {
        $arguments = array_add($arguments, 'visitorId', $visitorId);
        $options = $this->getOptions($format)->setArguments($arguments);

        return $this->request->send($options);
    }
814875
public function getExitPageUrls($idSite, $period, $date, $segment = false, $expanded = false, $idSubtable = false, $flat = false)
    {
        Piwik::checkUserHasViewAccess($idSite);

        $dataTable = $this->getPageUrls($idSite, $period, $date, $segment, $expanded, $idSubtable, false, $flat);
        $this->filterNonExitActions($dataTable);
        return $dataTable;
    }
754730
public function getHolidayListInICalendarFormat(HolidayList $holidayList, TranslatorInterface $translator = null, DateHelper $dateHelper = null)
    {
        $calendarFormatter = new ICalendarFormatter($translator, $dateHelper);
        $content = [];
        $content[] = $calendarFormatter->getHeader();
        $content = array_merge($content, $calendarFormatter->formatList($holidayList));
        $content[] = $calendarFormatter->getFooter();

        return implode(ICalendarFormatter::LINE_ENDING, $content).ICalendarFormatter::LINE_ENDING;
    }
693577
private function visitZones(Layout $layout, VisitorInterface $subVisitor): Generator
    {
        foreach ($layout->getZones() as $zone) {
            yield $zone->getIdentifier() => $subVisitor->visit($zone, $subVisitor);
        }
    }
57037
protected function getSourcesSearchPhrases($days = 30, $maxResult = 10)
    {
        list($startDate, $endDate) = $this->calculateDays($days);

        $this->getSourcesSearchPhrasesForPeriod($startDate, $endDate,
            $maxResult);
    }
369332
public function getMostVisitedPages($numberOfDays = 365, $maxResults = 20)
    {
        list($startDate, $endDate) = $this->calculateNumberOfDays($numberOfDays);

        return $this->getMostVisitedPagesForPeriod($startDate, $endDate, $maxResults);
    }
494878
public function deleteVisits($visitIds)
    {
        $numDeletedVisits = 0;

        foreach ($this->logTablesProvider->getAllLogTables() as $logTable) {
            if ($logTable->getColumnToJoinOnIdVisit()) {
                $numVisits = $this->rawLogDao->deleteFromLogTable($logTable->getName(), $visitIds);
                if ($logTable->getName() === 'log_visit') {
                    $numDeletedVisits = $numVisits;
                }
            }
        }

        return $numDeletedVisits;
    }
1121850
@Override
  public void parse (final int nYear, final HolidayMap aHolidayMap, final Holidays aConfig)
  {
    for (final ChristianHoliday aChristianHoliday : aConfig.getChristianHoliday ())
    {
      if (!isValid (aChristianHoliday, nYear))
        continue;

      ChronoLocalDate aEasterSunday;
      if (aChristianHoliday.getChronology () == ChronologyType.JULIAN)
        aEasterSunday = getJulianEasterSunday (nYear);
      else
        if (aChristianHoliday.getChronology () == ChronologyType.GREGORIAN)
          aEasterSunday = getGregorianEasterSunday (nYear);
        else
          aEasterSunday = getEasterSunday (nYear);

      switch (aChristianHoliday.getType ())
      {
        case EASTER:
          break;
        case CLEAN_MONDAY:
        case SHROVE_MONDAY:
          aEasterSunday = aEasterSunday.minus (48, ChronoUnit.DAYS);
          break;
        case MARDI_GRAS:
        case CARNIVAL:
          aEasterSunday = aEasterSunday.minus (47, ChronoUnit.DAYS);
          break;
        case ASH_WEDNESDAY:
          aEasterSunday = aEasterSunday.minus (46, ChronoUnit.DAYS);
          break;
        case MAUNDY_THURSDAY:
          aEasterSunday = aEasterSunday.minus (3, ChronoUnit.DAYS);
          break;
        case GOOD_FRIDAY:
          aEasterSunday = aEasterSunday.minus (2, ChronoUnit.DAYS);
          break;
        case EASTER_SATURDAY:
          aEasterSunday = aEasterSunday.minus (1, ChronoUnit.DAYS);
          break;
        case EASTER_MONDAY:
          aEasterSunday = aEasterSunday.plus (1, ChronoUnit.DAYS);
          break;
        case EASTER_TUESDAY:
          aEasterSunday = aEasterSunday.plus (2, ChronoUnit.DAYS);
          break;
        case GENERAL_PRAYER_DAY:
          aEasterSunday = aEasterSunday.plus (26, ChronoUnit.DAYS);
          break;
        case ASCENSION_DAY:
          aEasterSunday = aEasterSunday.plus (39, ChronoUnit.DAYS);
          break;
        case PENTECOST:
        case WHIT_SUNDAY:
          aEasterSunday = aEasterSunday.plus (49, ChronoUnit.DAYS);
          break;
        case WHIT_MONDAY:
        case PENTECOST_MONDAY:
          aEasterSunday = aEasterSunday.plus (50, ChronoUnit.DAYS);
          break;
        case CORPUS_CHRISTI:
          aEasterSunday = aEasterSunday.plus (60, ChronoUnit.DAYS);
          break;
        case SACRED_HEART:
          aEasterSunday = aEasterSunday.plus (68, ChronoUnit.DAYS);
          break;
        default:
          throw new IllegalArgumentException ("Unknown christian holiday type " + aChristianHoliday.getType ());
      }
      final LocalDate aConvertedDate = LocalDate.from (aEasterSunday);
      final IHolidayType aType = XMLHolidayHelper.getType (aChristianHoliday.getLocalizedType ());
      final String sPropertiesKey = "christian." + aChristianHoliday.getType ().name ();
      addChrstianHoliday (aConvertedDate, sPropertiesKey, aType, aHolidayMap);
    }
  }
1309376
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('UrlAliasList');
        $visitor->setHeader('Content-Type', $generator->getMediaType('UrlAliasList'));

        $generator->startAttribute('href', $data->path);
        $generator->endAttribute('href');

        $generator->startList('UrlAlias');
        foreach ($data->urlAliases as $urlAlias) {
            $visitor->visitValueObject($urlAlias);
        }
        $generator->endList('UrlAlias');

        $generator->endObjectElement('UrlAliasList');
    }