本文整理汇总了PHP中Piwik\View类的典型用法代码示例。如果您正苦于以下问题:PHP View类的具体用法?PHP View怎么用?PHP View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$view = new View('@VisitTime/index');
$view->dataTableVisitInformationPerLocalTime = $this->renderReport(new GetVisitInformationPerLocalTime());
$view->dataTableVisitInformationPerServerTime = $this->renderReport(new GetVisitInformationPerServerTime());
return $view->render();
}
示例2: render
/**
* @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();
}
示例3: displayDbConnectionMessage
public function displayDbConnectionMessage($exception = null)
{
$view = new PiwikView("@Installation/cannotConnectToDb");
$view->exceptionMessage = $exception->getMessage();
$ex = new DatabaseConnectionFailedException($view->render());
$ex->setIsHtmlMessage();
throw $ex;
}
示例4: getLanguagesSelector
/**
* 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();
}
示例5: getPromoVideo
/**
* 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();
}
示例6: testJsInclude2
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();
}
示例7: promoPiwikPro
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();
}
示例8: promoServices
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();
}
示例9: render
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();
}
示例10: index
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();
}
示例11: getDatabaseSize
/**
* 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();
}
示例12: goalConversionsOverview
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();
}
示例13: render
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();
}
示例14: renderTemplate
/**
* 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();
}
示例15: renderReport
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();
}