作者:bossrabbi
项目:piwi
public function index()
{
$view = new View('@VisitTime/index');
$view->dataTableVisitInformationPerLocalTime = $this->renderReport(new GetVisitInformationPerLocalTime());
$view->dataTableVisitInformationPerServerTime = $this->renderReport(new GetVisitInformationPerServerTime());
return $view->render();
}
作者:piwi
项目:piwi
/**
* @see ViewDataTable::main()
* @return mixed
*/
public function render()
{
$view = new View('@CoreVisualizations/_dataTableViz_sparklines.twig');
$columnsList = array();
if ($this->config->hasSparklineMetrics()) {
foreach ($this->config->getSparklineMetrics() as $cols) {
$columns = $cols['columns'];
if (!is_array($columns)) {
$columns = array($columns);
}
$columnsList = array_merge($columns, $columnsList);
}
}
$view->allMetricsDocumentation = Metrics::getDefaultMetricsDocumentation();
$this->requestConfig->request_parameters_to_modify['columns'] = $columnsList;
$this->requestConfig->request_parameters_to_modify['format_metrics'] = '1';
if (!empty($this->requestConfig->apiMethodToRequestDataTable)) {
$this->fetchConfiguredSparklines();
}
$view->sparklines = $this->config->getSortedSparklines();
$view->isWidget = Common::getRequestVar('widget', 0, 'int');
$view->titleAttributes = $this->config->title_attributes;
$view->footerMessage = $this->config->show_footer_message;
$view->areSparklinesLinkable = $this->config->areSparklinesLinkable();
$view->title = '';
if ($this->config->show_title) {
$view->title = $this->config->title;
}
return $view->render();
}
作者:CaptainShar
项目:SSAD_Projec
public function displayDbConnectionMessage($exception = null)
{
$view = new PiwikView("@Installation/cannotConnectToDb");
$view->exceptionMessage = $exception->getMessage();
$ex = new DatabaseConnectionFailedException($view->render());
$ex->setIsHtmlMessage();
throw $ex;
}
作者:CaptainShar
项目:SSAD_Projec
/**
* Renders and returns the language selector HTML.
*
* @return string
*/
public function getLanguagesSelector()
{
$view = new View("@LanguagesManager/getLanguagesSelector");
$view->languages = API::getInstance()->getAvailableLanguageNames();
$view->currentLanguageCode = self::getLanguageCodeForCurrentUser();
$view->currentLanguageName = self::getLanguageNameForCurrentUser();
return $view->render();
}
作者:diosmosi
项目:piwi
/**
* Renders and echo's HTML that displays the Piwik promo video.
*/
public function getPromoVideo()
{
$view = new View('@CoreHome/getPromoVideo');
$view->shareText = $this->translator->translate('CoreHome_SharePiwikShort');
$view->shareTextLong = $this->translator->translate('CoreHome_SharePiwikLong');
$view->promoVideoUrl = 'https://www.youtube.com/watch?v=OslfF_EH81g';
return $view->render();
}
作者:carriercom
项目:piwi
public function testJsInclude2()
{
$view = new View('@Widgetize/testJsInclude2');
$view->url1 = '?module=Widgetize&action=js&moduleToWidgetize=UserSettings&actionToWidgetize=getBrowser&idSite=1&period=day&date=yesterday';
$view->url2 = '?module=Widgetize&action=js&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&idSite=1&period=day&date=yesterday&viewDataTable=cloud&show_footer=0';
$view->url3 = '?module=Widgetize&action=js&moduleToWidgetize=Referrers&actionToWidgetize=getKeywords&idSite=1&period=day&date=yesterday&viewDataTable=table&show_footer=0';
return $view->render();
}
作者:sebastianpiskorsk
项目:piwi
public function promoPiwikPro()
{
$view = new View('@PiwikPro/promoPiwikProWidget');
$promo = $this->promo->getContent();
$view->ctaLinkUrl = $this->advertising->getPromoUrlForOnPremises('PromoWidget', $promo['campaignContent']);
$view->ctaText = $promo['text'];
$view->ctaLinkTitle = $this->promo->getLinkTitle();
return $view->render();
}
作者:diosmosi
项目:piwi
public function promoServices()
{
$view = new View('@ProfessionalServices/promoServicesWidget');
$promo = $this->promo->getContent();
$view->ctaLinkUrl = $this->advertising->getPromoUrlForPiwikProUpgrade();
$view->ctaText = $promo['text'];
$view->ctaLinkTitle = $this->promo->getLinkTitle();
return $view->render();
}
作者:piwi
项目:piwi
public function render()
{
$view = new View('@ProfessionalServices/promoServicesWidget');
$promo = $this->promo->getContent();
$view->ctaLinkUrl = $promo['url'];
$view->ctaText = $promo['text'];
$view->ctaLinkTitle = $this->promo->getLinkTitle();
return $view->render();
}
作者:brienomatt
项目:elmsl
public function index()
{
$view = new View('@VisitorInterest/index');
$view->dataTableNumberOfVisitsPerVisitDuration = $this->getNumberOfVisitsPerVisitDuration(true);
$view->dataTableNumberOfVisitsPerPage = $this->getNumberOfVisitsPerPage(true);
$view->dataTableNumberOfVisitsByVisitNum = $this->getNumberOfVisitsByVisitCount(true);
$view->dataTableNumberOfVisitsByDaysSinceLast = $this->getNumberOfVisitsByDaysSinceLast(true);
return $view->render();
}
作者:piwi
项目:piwi
/**
* Echo's an HTML chunk describing the current database size, and the estimated space
* savings after the scheduled data purge is run.
*/
public function getDatabaseSize()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@PrivacyManager/getDatabaseSize');
$forceEstimate = Common::getRequestVar('forceEstimate', 0);
$view->dbStats = $this->getDeleteDBSizeEstimate($getSettingsFromQuery = true, $forceEstimate);
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
return $view->render();
}
作者:piwi
项目:piwi
public function goalConversionsOverview()
{
$view = new View('@Goals/conversionOverview');
$idGoal = Common::getRequestVar('idGoal', null, 'string');
$view->topDimensions = $this->getTopDimensions($idGoal);
$goalMetrics = Request::processRequest('Goals.get', array('idGoal' => $idGoal));
// conversion rate for new and returning visitors
$view->conversion_rate_returning = $this->formatConversionRate($goalMetrics, 'conversion_rate_returning_visit');
$view->conversion_rate_new = $this->formatConversionRate($goalMetrics, 'conversion_rate_new_visit');
$view->idGoal = $idGoal;
return $view->render();
}
作者:a4tunad
项目:piwi
public function render()
{
$lastMinutes = Config::getInstance()->General[Controller::SIMPLE_VISIT_COUNT_WIDGET_LAST_MINUTES_CONFIG_KEY];
$lastNData = Request::processRequest('Live.getCounters', array('lastMinutes' => $lastMinutes));
$view = new View('@Live/getSimpleLastVisitCount');
$view->lastMinutes = $lastMinutes;
$view->visitors = MetricsFormatter::getPrettyNumber($lastNData[0]['visitors']);
$view->visits = MetricsFormatter::getPrettyNumber($lastNData[0]['visits']);
$view->actions = MetricsFormatter::getPrettyNumber($lastNData[0]['actions']);
$view->refreshAfterXSecs = Config::getInstance()->General['live_widget_refresh_after_seconds'];
$view->translations = array('one_visitor' => Piwik::translate('Live_NbVisitor'), 'visitors' => Piwik::translate('Live_NbVisitors'), 'one_visit' => Piwik::translate('General_OneVisit'), 'visits' => Piwik::translate('General_NVisits'), 'one_action' => Piwik::translate('General_OneAction'), 'actions' => Piwik::translate('VisitsSummary_NbActionsDescription'), 'one_minute' => Piwik::translate('General_OneMinute'), 'minutes' => Piwik::translate('General_NMinutes'));
return $view->render();
}
作者:piwi
项目:piwi
/**
* Assigns the given variables to the template and renders it.
*
* Example:
*
* public function myControllerAction () {
* return $this->renderTemplate('index', array(
* 'answerToLife' => '42'
* ));
* }
*
* This will render the 'index.twig' file within the plugin templates folder and assign the view variable
* `answerToLife` to `42`.
*
* @param string $template The name of the template file. If only a name is given it will automatically use
* the template within the plugin folder. For instance 'myTemplate' will result in
* '@$pluginName/myTemplate.twig'. Alternatively you can include the full path:
* '@anyOtherFolder/otherTemplate'. The trailing '.twig' is not needed.
* @param array $variables For instance array('myViewVar' => 'myValue'). In template you can use {{ myViewVar }}
* @return string
* @api
*/
protected function renderTemplate($template, array $variables = array())
{
if (false === strpos($template, '@') || false === strpos($template, '/')) {
$aPluginName = explode('\\', get_class($this));
$aPluginName = $aPluginName[2];
$template = '@' . $aPluginName . '/' . $template;
}
$view = new View($template);
foreach ($variables as $key => $value) {
$view->{$key} = $value;
}
return $view->render();
}
作者:dorelljame
项目:piwi
public function renderReport($processedReport)
{
$isGoalPluginEnabled = Common::isGoalPluginEnabled();
$prettyDate = $processedReport['prettyDate'];
$reportData = $processedReport['reportData'];
$evolutionMetrics = array();
$multiSitesAPIMetrics = API::getApiMetrics($enhanced = true);
foreach ($multiSitesAPIMetrics as $metricSettings) {
$evolutionMetrics[] = $metricSettings[API::METRIC_EVOLUTION_COL_NAME_KEY];
}
$floatRegex = self::FLOAT_REGEXP;
// no decimal for all metrics to shorten SMS content (keeps the monetary sign for revenue metrics)
$reportData->filter('ColumnCallbackReplace', array(array_merge(array_keys($multiSitesAPIMetrics), $evolutionMetrics), function ($value) use($floatRegex) {
return preg_replace_callback($floatRegex, function ($matches) {
return round($matches[0]);
}, $value);
}));
// evolution metrics formatting :
// - remove monetary, percentage and white spaces to shorten SMS content
// (this is also needed to be able to test $value != 0 and see if there is an evolution at all in SMSReport.twig)
// - adds a plus sign
$reportData->filter('ColumnCallbackReplace', array($evolutionMetrics, function ($value) use($floatRegex) {
$matched = preg_match($floatRegex, $value, $matches);
$formatted = $matched ? sprintf("%+d", $matches[0]) : $value;
return \Piwik\NumberFormatter::getInstance()->formatPercentEvolution($formatted);
}));
$dataRows = $reportData->getRows();
$reportMetadata = $processedReport['reportMetadata'];
$reportRowsMetadata = $reportMetadata->getRows();
$siteHasECommerce = array();
foreach ($reportRowsMetadata as $rowMetadata) {
$idSite = $rowMetadata->getColumn('idsite');
$siteHasECommerce[$idSite] = Site::isEcommerceEnabledFor($idSite);
}
$view = new View('@MobileMessaging/SMSReport');
$view->assign("isGoalPluginEnabled", $isGoalPluginEnabled);
$view->assign("reportRows", $dataRows);
$view->assign("reportRowsMetadata", $reportRowsMetadata);
$view->assign("prettyDate", $prettyDate);
$view->assign("siteHasECommerce", $siteHasECommerce);
$view->assign("displaySiteName", $processedReport['metadata']['action'] == 'getAll');
// segment
$segment = $processedReport['segment'];
$displaySegment = $segment != null;
$view->assign("displaySegment", $displaySegment);
if ($displaySegment) {
$view->assign("segmentName", $segment['name']);
}
$this->rendering .= $view->render();
}
作者:cem
项目:piwi
public function displayDbConnectionMessage($exception = null)
{
Common::sendResponseCode(500);
$errorMessage = $exception->getMessage();
if (Request::isApiRequest($_GET)) {
$ex = new DatabaseConnectionFailedException($errorMessage);
throw $ex;
}
$view = new PiwikView("@Installation/cannotConnectToDb");
$view->exceptionMessage = $errorMessage;
$ex = new DatabaseConnectionFailedException($view->render());
$ex->setIsHtmlMessage();
throw $ex;
}
作者:Abin
项目:piwi
/**
* @param bool $standalone When set to true, the Top controls will be hidden to provide better full screen view
* @param bool $fetch
* @param bool|string $segmentOverride
*
* @return string
*/
public function realtimeMap($standalone = false, $fetch = false, $segmentOverride = false)
{
$this->checkUserCountryPluginEnabled();
$idSite = Common::getRequestVar('idSite', 1, 'int');
Piwik::checkUserHasViewAccess($idSite);
$token_auth = Piwik::getCurrentUserTokenAuth();
$view = new View('@UserCountryMap/realtimeMap');
$view->mapIsStandaloneNotWidget = $standalone;
$view->metrics = $this->getMetrics($idSite, 'range', self::REAL_TIME_WINDOW, $token_auth);
$view->defaultMetric = 'nb_visits';
$liveRefreshAfterMs = (int) Config::getInstance()->General['live_widget_refresh_after_seconds'] * 1000;
$goals = APIGoals::getInstance()->getGoals($idSite);
$site = new Site($idSite);
$hasGoals = !empty($goals) || $site->isEcommerceEnabled();
// maximum number of visits to be displayed in the map
$maxVisits = Common::getRequestVar('filter_limit', 100, 'int');
// some translations
$locale = array('nb_actions' => Piwik::translate('VisitsSummary_NbActionsDescription'), 'local_time' => Piwik::translate('VisitTime_ColumnLocalTime'), 'from' => Piwik::translate('General_FromReferrer'), 'seconds' => Piwik::translate('UserCountryMap_Seconds'), 'seconds_ago' => Piwik::translate('UserCountryMap_SecondsAgo'), 'minutes' => Piwik::translate('UserCountryMap_Minutes'), 'minutes_ago' => Piwik::translate('UserCountryMap_MinutesAgo'), 'hours' => Piwik::translate('UserCountryMap_Hours'), 'hours_ago' => Piwik::translate('UserCountryMap_HoursAgo'), 'days_ago' => Piwik::translate('UserCountryMap_DaysAgo'), 'actions' => Piwik::translate('VisitsSummary_NbPageviewsDescription'), 'searches' => Piwik::translate('UserCountryMap_Searches'), 'goal_conversions' => Piwik::translate('UserCountryMap_GoalConversions'));
$segment = $segmentOverride ?: Request::getRawSegmentFromRequest() ?: '';
$params = array('period' => 'range', 'idSite' => $idSite, 'segment' => $segment, 'token_auth' => $token_auth);
$realtimeWindow = Common::getRequestVar('realtimeWindow', self::REAL_TIME_WINDOW, 'string');
if ($realtimeWindow != 'false') {
// handle special value
$params['date'] = $realtimeWindow;
}
$reqParams = $this->getEnrichedRequest($params, $encode = false);
$view->config = array('metrics' => array(), 'svgBasePath' => $view->piwikUrl . 'plugins/UserCountryMap/svg/', 'liveRefreshAfterMs' => $liveRefreshAfterMs, '_' => $locale, 'reqParams' => $reqParams, 'siteHasGoals' => $hasGoals, 'maxVisits' => $maxVisits, 'changeVisitAlpha' => Common::getRequestVar('changeVisitAlpha', true, 'int'), 'removeOldVisits' => Common::getRequestVar('removeOldVisits', true, 'int'), 'showFooterMessage' => Common::getRequestVar('showFooterMessage', true, 'int'), 'showDateTime' => Common::getRequestVar('showDateTime', true, 'int'), 'doNotRefreshVisits' => Common::getRequestVar('doNotRefreshVisits', false, 'int'), 'enableAnimation' => Common::getRequestVar('enableAnimation', true, 'int'), 'forceNowValue' => Common::getRequestVar('forceNowValue', false, 'int'));
return $view->render();
}
作者:jos
项目:CGE-File-Sharin
/**
* Called on Core install, update, plugin enable/disable
* Will clear all cache that could be affected by the change in configuration being made
*/
public static function deleteAllCacheOnUpdate($pluginName = false)
{
AssetManager::getInstance()->removeMergedAssets($pluginName);
View::clearCompiledTemplates();
Cache::deleteTrackerCache();
self::clearPhpCaches();
}
作者:FluentDevelopmen
项目:piwi
public function indexSiteSearch()
{
$view = new View('@Actions/indexSiteSearch');
$keyword = Report::factory($this->pluginName, 'getSiteSearchKeywords');
$noResult = Report::factory($this->pluginName, 'getSiteSearchNoResultKeywords');
$pageUrls = Report::factory($this->pluginName, 'getPageUrlsFollowingSiteSearch');
$view->keywords = $keyword->render();
$view->noResultKeywords = $noResult->render();
$view->pagesUrlsFollowingSiteSearch = $pageUrls->render();
$categoryTrackingEnabled = Actions::isCustomVariablesPluginsEnabled();
if ($categoryTrackingEnabled) {
$categories = Report::factory($this->pluginName, 'getSiteSearchCategories');
$view->categories = $categories->render();
}
return $view->render();
}
作者:nuxwi
项目:piwi
/**
* @return View
* @throws \Exception
*/
public function getOptOutView()
{
if ($this->view) {
return $this->view;
}
$trackVisits = !IgnoreCookie::isIgnoreCookieFound();
$dntFound = $this->getDoNotTrackHeaderChecker()->isDoNotTrackFound();
$setCookieInNewWindow = Common::getRequestVar('setCookieInNewWindow', false, 'int');
if ($setCookieInNewWindow) {
$reloadUrl = Url::getCurrentQueryStringWithParametersModified(array('showConfirmOnly' => 1, 'setCookieInNewWindow' => 0));
} else {
$reloadUrl = false;
$nonce = Common::getRequestVar('nonce', false);
if ($nonce !== false && Nonce::verifyNonce('Piwik_OptOut', $nonce)) {
Nonce::discardNonce('Piwik_OptOut');
IgnoreCookie::setIgnoreCookie();
$trackVisits = !$trackVisits;
}
}
$language = Common::getRequestVar('language', '');
$lang = APILanguagesManager::getInstance()->isLanguageAvailable($language) ? $language : LanguagesManager::getLanguageCodeForCurrentUser();
$this->view = new View("@CoreAdminHome/optOut");
$this->view->setXFrameOptions('allow');
$this->view->dntFound = $dntFound;
$this->view->trackVisits = $trackVisits;
$this->view->nonce = Nonce::getNonce('Piwik_OptOut', 3600);
$this->view->language = $lang;
$this->view->showConfirmOnly = Common::getRequestVar('showConfirmOnly', false, 'int');
$this->view->reloadUrl = $reloadUrl;
$this->view->javascripts = $this->getJavascripts();
$this->view->stylesheets = $this->getStylesheets();
$this->view->title = $this->getTitle();
return $this->view;
}