本文整理汇总了PHP中Piwik::getCurrentUserEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::getCurrentUserEmail方法的具体用法?PHP Piwik::getCurrentUserEmail怎么用?PHP Piwik::getCurrentUserEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik
的用法示例。
在下文中一共展示了Piwik::getCurrentUserEmail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
Piwik::checkUserIsNotAnonymous();
$view = Piwik_View::factory('index');
$this->setGeneralVariablesView($view);
$view->currentUserEmail = Piwik::getCurrentUserEmail();
$availableReports = Piwik_API_API::getInstance()->getReportMetadata($this->idSite);
$reportsByCategory = array();
foreach ($availableReports as $report) {
$reportsByCategory[$report['category']][] = $report;
}
unset($reportsByCategory['API']);
$reports = Piwik_PDFReports_API::getInstance()->getReports($this->idSite, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = true);
$reportsById = array();
foreach ($reports as &$report) {
$report['additional_emails'] = str_replace(',', "\n", $report['additional_emails']);
$report['reports'] = explode(',', str_replace('.', '_', $report['reports']));
$reportsById[$report['idreport']] = $report;
}
$view->downloadOutputType = Piwik_PDFReports_API::OUTPUT_DOWNLOAD;
$columnsCount = 2;
$view->newColumnAfter = ceil(count($reportsByCategory) / $columnsCount);
$view->reportsByCategory = $reportsByCategory;
$view->reportsJSON = Piwik_Common::json_encode($reportsById);
$view->periods = array_merge(array('never' => Piwik_Translate('General_Never')), Piwik_PDFReports_API::getPeriodToFrequency());
$view->defaultFormat = Piwik_PDFReports::DEFAULT_FORMAT;
$view->formats = Piwik_ReportRenderer::$availableReportRenderers;
$view->aggregateReportsFormats = Piwik_PDFReports_API::getAggregateReportsFormats();
$view->reports = $reports;
$view->language = Piwik_LanguagesManager::getLanguageCodeForCurrentUser();
echo $view->render();
}
示例2: sendEmailReport
public function sendEmailReport($idReport, $idSite, $period = false, $date = false)
{
Piwik::checkUserIsNotAnonymous();
$reports = $this->getReports($idSite, false, $idReport);
$report = reset($reports);
if ($report['period'] == 'never') {
$report['period'] = 'day';
}
if (!empty($period)) {
$report['period'] = $period;
}
if (empty($date)) {
$date = Piwik_Date::now()->subPeriod(1, $report['period'])->toString();
}
// Get user emails and languages
$emails = self::getEmailsFromString($report['additional_emails']);
if ($report['email_me'] == 1) {
if (Piwik::getCurrentUserLogin() == $report['login']) {
$emails[] = Piwik::getCurrentUserEmail();
} elseif ($report['login'] == Piwik_Config::getInstance()->superuser['login']) {
$emails[] = Piwik::getSuperUserEmail();
} else {
try {
$user = Piwik_UsersManager_API::getInstance()->getUser($report['login']);
} catch (Exception $e) {
return;
}
$emails[] = $user['email'];
}
}
$language = Piwik_LanguagesManager_API::getInstance()->getLanguageForUser($report['login']);
list($outputFilename, $prettyDate, $websiteName, $reportFormat, $additionalFiles) = $this->generateReport($idReport, $date, $idSite, $language, self::OUTPUT_SAVE_ON_DISK, $report['period']);
$this->sendReportEmail($emails, $outputFilename, $prettyDate, $websiteName, $report, $reportFormat, $additionalFiles);
}
示例3: template_reportParametersPDFReports
/**
* @param Piwik_Event_Notification $notification notification object
*/
public static function template_reportParametersPDFReports($notification)
{
$out =& $notification->getNotificationObject();
$view = Piwik_View::factory('report_parameters');
$view->currentUserEmail = Piwik::getCurrentUserEmail();
$view->displayFormats = self::getDisplayFormats();
$view->reportType = self::EMAIL_TYPE;
$view->defaultDisplayFormat = self::DEFAULT_DISPLAY_FORMAT;
$view->defaultEmailMe = self::EMAIL_ME_PARAMETER_DEFAULT_VALUE;
$out .= $view->render();
}
示例4: sendEmailReport
public function sendEmailReport($idReport, $idSite)
{
$reports = $this->getReports($idSite, $period = false, $idReport);
$report = reset($reports);
if ($report['period'] == 'never') {
$report['period'] = 'day';
}
// Get user emails and languages
$emails = self::getEmailsFromString($report['additional_emails']);
if ($report['email_me'] == 1) {
if (Piwik::getCurrentUserLogin() == $report['login']) {
$emails[] = Piwik::getCurrentUserEmail();
} elseif ($report['login'] == Zend_Registry::get('config')->superuser->login) {
$emails[] = Zend_Registry::get('config')->superuser->email;
} else {
try {
$user = Piwik_UsersManager_API::getInstance()->getUser($report['login']);
} catch (Exception $e) {
return;
}
$emails[] = $user['email'];
}
}
$language = Piwik_LanguagesManager_API::getInstance()->getLanguageForUser($report['login']);
list($outputFilename, $prettyDate, $websiteName) = $this->generateReport($idReport, Piwik_Date::now()->subPeriod(1, $report['period'])->toString(), $idSite, $language, $outputType = Piwik_PDFReports_API::OUTPUT_PDF_SAVE_ON_DISK);
$this->sendReportEmailPdfAttached($emails, $outputFilename, $prettyDate, $websiteName, $report);
}