function index() { Piwik::checkUserIsSuperUser(); $plugins = array(); $listPlugins = array_merge(Piwik_PluginsManager::getInstance()->readPluginsDirectory(), Piwik_Config::getInstance()->Plugins['Plugins']); $listPlugins = array_unique($listPlugins); foreach ($listPlugins as $pluginName) { $oPlugin = Piwik_PluginsManager::getInstance()->loadPlugin($pluginName); $plugins[$pluginName] = array('activated' => Piwik_PluginsManager::getInstance()->isPluginActivated($pluginName), 'alwaysActivated' => Piwik_PluginsManager::getInstance()->isPluginAlwaysActivated($pluginName)); } Piwik_PluginsManager::getInstance()->loadPluginTranslations(); $loadedPlugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins(); foreach ($loadedPlugins as $oPlugin) { $pluginName = $oPlugin->getPluginName(); $plugins[$pluginName]['info'] = $oPlugin->getInformation(); } foreach ($plugins as $pluginName => &$plugin) { if (!isset($plugin['info'])) { $plugin['info'] = array('description' => '<strong><em>' . Piwik_Translate('CorePluginsAdmin_PluginCannotBeFound') . '</strong></em>', 'version' => Piwik_Translate('General_Unknown')); } } $view = Piwik_View::factory('manage'); $view->pluginsName = $plugins; $this->setBasicVariablesView($view); $view->menu = Piwik_GetAdminMenu(); if (!Piwik_Config::getInstance()->isFileWritable()) { $view->configFileNotWritable = true; } echo $view->render(); }
public function getReportMetadata($notification) { $reports = &$notification->getNotificationObject(); $reports[] = array( 'category' => Piwik_Translate('General_Visitors'), 'name' => Piwik_Translate('VisitorInterest_WidgetLengths'), 'module' => 'VisitorInterest', 'action' => 'getNumberOfVisitsPerVisitDuration', 'dimension' => Piwik_Translate('VisitorInterest_ColumnVisitDuration'), 'metrics' => array( 'nb_visits' ), 'processedMetrics' => false, 'constantRowsCount' => true, 'documentation' => Piwik_Translate('VisitorInterest_WidgetLengthsDocumentation') .'<br />'.Piwik_Translate('General_ChangeTagCloudView'), 'order' => 15 ); $reports[] = array( 'category' => Piwik_Translate('General_Visitors'), 'name' => Piwik_Translate('VisitorInterest_WidgetPages'), 'module' => 'VisitorInterest', 'action' => 'getNumberOfVisitsPerPage', 'dimension' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit'), 'metrics' => array( 'nb_visits' ), 'processedMetrics' => false, 'constantRowsCount' => true, 'documentation' => Piwik_Translate('VisitorInterest_WidgetPagesDocumentation') .'<br />'.Piwik_Translate('General_ChangeTagCloudView'), 'order' => 20 ); }
/** * Returns the translated country name for a given country code * * @param string $label country code * @return string Country name */ function Piwik_CountryTranslate($label) { if ($label == 'xx') { return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); } return html_entity_decode(Piwik_Translate('UserCountry_country_' . $label), ENT_COMPAT, 'UTF-8'); }
/** * send email to Piwik team and display nice thanks */ function sendFeedback() { $body = Piwik_Common::getRequestVar('body', '', 'string'); $email = Piwik_Common::getRequestVar('email', '', 'string'); $view = new Piwik_View('Feedback/templates/sent.tpl'); try { $minimumBodyLength = 35; if (strlen($body) < $minimumBodyLength) { throw new Exception(sprintf("Message must be at least %s characters long.", $minimumBodyLength)); } if (!Piwik::isValidEmailString($email)) { throw new Exception(Piwik_Translate('UsersManager_ExceptionInvalidEmail')); } if (strpos($body, 'http://') !== false) { throw new Exception("The message cannot contain a URL, to avoid spams messages."); } $mail = new Piwik_Mail(); $mail->setFrom($email); $mail->addTo('*****@*****.**', 'Piwik Team'); $mail->setSubject('[ Feedback form - Piwik ]'); $mail->setBodyText($body); @$mail->send(); } catch (Exception $e) { $view->ErrorString = $e->getMessage(); $view->message = $body; } echo $view->render(); }
function index() { Piwik::checkUserIsNotAnonymous(); $view = Piwik_View::factory('Settings'); $view->isSuperUser = Piwik::isUserIsSuperUser(); $mobileMessagingAPI = Piwik_MobileMessaging_API::getInstance(); $view->delegatedManagement = $mobileMessagingAPI->getDelegatedManagement(); $view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided(); $view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement; $view->strHelpAddPhone = Piwik_Translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array(Piwik_Translate('UserSettings_SubmenuSettings'), Piwik_Translate('MobileMessaging_SettingsMenu'))); if ($view->credentialSupplied && $view->accountManagedByCurrentUser) { $view->provider = $mobileMessagingAPI->getSMSProvider(); $view->creditLeft = $mobileMessagingAPI->getCreditLeft(); } $view->smsProviders = Piwik_MobileMessaging_SMSProvider::$availableSMSProviders; // construct the list of countries from the lang files $countries = array(); foreach (Piwik_Common::getCountriesList() as $countryCode => $continentCode) { if (isset(Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode])) { $countries[$countryCode] = array('countryName' => Piwik_CountryTranslate($countryCode), 'countryCallingCode' => Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode]); } } $view->countries = $countries; $view->defaultCountry = Piwik_Common::getCountry(Piwik_LanguagesManager::getLanguageCodeForCurrentUser(), true, Piwik_IP::getIpFromHeader()); $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers(); $this->setBasicVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); }
function init() { $infos = Piwik_Installation_Controller::getSystemInformation(); $adapters = array(); foreach($infos['adapters'] as $adapter => $port) { $adapters[$adapter] = $adapter; } $formElements = array( array('text', 'host', Piwik_Translate('Installation_DatabaseSetupServer'), 'value='.'localhost'), array('text', 'username', Piwik_Translate('Installation_DatabaseSetupLogin')), array('password', 'password', Piwik_Translate('Installation_DatabaseSetupPassword')), array('text', 'dbname', Piwik_Translate('Installation_DatabaseSetupDatabaseName')), array('text', 'tables_prefix', Piwik_Translate('Installation_DatabaseSetupTablePrefix'), 'value='.'piwik_'), array('select', 'adapter', Piwik_Translate('Installation_DatabaseSetupAdapter'), $adapters), ); $this->addElements( $formElements ); $formRules = array(); foreach($formElements as $row) { if($row[1] != 'password' && $row[1] != 'tables_prefix') { $formRules[] = array($row[1], Piwik_Translate('General_Required', $row[2]), 'required'); } } $this->addRules( $formRules ); $this->addElement('submit', 'submit', Piwik_Translate('Installation_SubmitGo')); }
public function setColumnsToDisplay($columnsNames) { $newColumnsNames = array(); $goals = array(); $idSite = $this->getIdSite(); if ($idSite) { $goals = Piwik_Goals_API::getInstance()->getGoals($idSite); } foreach ($columnsNames as $columnName) { if (in_array($columnName, array('goal_%s_conversion_rate', 'goal_%s_nb_conversions', 'goal_%s_revenue_per_visit'))) { foreach ($goals as $goal) { $idgoal = $goal['idgoal']; if ($this->processOnlyIdGoal > Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE && $this->processOnlyIdGoal != $idgoal) { continue; } $name = Piwik_Translate($this->getColumnTranslation($columnName), $goal['name']); $columnNameGoal = str_replace('%s', $idgoal, $columnName); $this->setColumnTranslation($columnNameGoal, $name); if (strstr($columnNameGoal, '_rate') === false && $this->processOnlyIdGoal == Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW) { continue; } if (strstr($columnNameGoal, '_revenue') !== false) { $this->columnsToRevenueFilter[] = $columnNameGoal; } else { $this->columnsToConversionFilter[] = $columnNameGoal; } $newColumnsNames[] = $columnNameGoal; } } else { $newColumnsNames[] = $columnName; } } parent::setColumnsToDisplay($newColumnsNames); }
/** * Piwik - Open source web analytics * * @link https://github.com/pklaus/IntranetSubNetwork * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * * @package Piwik_IntranetSubNetwork */ function Piwik_getSubnetName($in) { if (empty($in)) { return Piwik_Translate('General_Unknown'); } return $in; }
function init() { HTML_QuickForm2_Factory::registerRule('checkValidFilename', 'Piwik_Installation_FormDatabaseSetup_Rule_checkValidFilename'); $checkUserPrivilegesClass = 'Piwik_Installation_FormDatabaseSetup_Rule_checkUserPrivileges'; HTML_QuickForm2_Factory::registerRule('checkUserPrivileges', $checkUserPrivilegesClass); $availableAdapters = Piwik_Db_Adapter::getAdapters(); $adapters = array(); foreach ($availableAdapters as $adapter => $port) { $adapters[$adapter] = $adapter; } $this->addElement('text', 'host')->setLabel(Piwik_Translate('Installation_DatabaseSetupServer'))->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupServer'))); $user = $this->addElement('text', 'username')->setLabel(Piwik_Translate('Installation_DatabaseSetupLogin')); $user->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupLogin'))); $requiredPrivileges = Piwik_Installation_FormDatabaseSetup_Rule_checkUserPrivileges::getRequiredPrivilegesPretty(); $user->addRule('checkUserPrivileges', Piwik_Translate('Installation_InsufficientPrivileges', $requiredPrivileges . '<br/><br/>') . Piwik_Translate('Installation_InsufficientPrivilegesHelp')); $this->addElement('password', 'password')->setLabel(Piwik_Translate('Installation_DatabaseSetupPassword')); $item = $this->addElement('text', 'dbname')->setLabel(Piwik_Translate('Installation_DatabaseSetupDatabaseName')); $item->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupDatabaseName'))); $item->addRule('checkValidFilename', Piwik_Translate('General_NotValid', Piwik_Translate('Installation_DatabaseSetupDatabaseName'))); $this->addElement('text', 'tables_prefix')->setLabel(Piwik_Translate('Installation_DatabaseSetupTablePrefix'))->addRule('checkValidFilename', Piwik_Translate('General_NotValid', Piwik_Translate('Installation_DatabaseSetupTablePrefix'))); $this->addElement('select', 'adapter')->setLabel(Piwik_Translate('Installation_DatabaseSetupAdapter'))->loadOptions($adapters)->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Installation_DatabaseSetupAdapter'))); $this->addElement('submit', 'submit', array('value' => Piwik_Translate('General_Next') . ' »', 'class' => 'submit')); // default values $this->addDataSource(new HTML_QuickForm2_DataSource_Array(array('host' => '127.0.0.1', 'tables_prefix' => 'piwik_'))); }
function Piwik_CountryTranslate($label) { if ($label == 'xx') { return Piwik_Translate('General_Unknown'); } return Piwik_Translate('UserCountry_country_' . $label); }
function dispatch($notification = null) { if($notification) { $exception = $notification->getNotificationObject(); $message = $exception->getMessage(); } else { $message = ''; } Piwik_Translate::getInstance()->loadCoreTranslation(); Piwik_PostEvent('Installation.startInstallation', $this); $step = Piwik_Common::getRequestVar('action', 'welcome', 'string'); $controller = $this->getInstallationController(); if(in_array($step, array_keys($controller->getInstallationSteps())) || $step == 'saveLanguage') { $controller->$step($message); } else { Piwik::exitWithErrorMessage(Piwik_Translate('Installation_NoConfigFound')); } exit; }
function init() { $this->addElement('text', 'form_login') ->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('General_Username'))); $password = $this->addElement('password', 'form_password'); $password->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_Password'))); $passwordBis = $this->addElement('password', 'form_password_bis'); $passwordBis->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_PasswordRepeat'))); $passwordBis->addRule('eq', Piwik_Translate( 'Login_PasswordsDoNotMatch'), $password); $this->addElement('text', 'form_token') ->addRule('required', Piwik_Translate('General_Required', Piwik_Translate('Login_PasswordResetToken'))); $this->addElement('hidden', 'form_nonce'); $this->addElement('submit', 'submit'); $resetToken = Piwik_Common::getRequestVar('token', '', 'string'); if(!empty($resetToken)) { // default values $this->addDataSource(new HTML_QuickForm2_DataSource_Array(array( 'form_token' => $resetToken, ))); $this->attributes['action'] = 'index.php' . Piwik_Url::getCurrentQueryStringWithParametersModified( array('token' => null) ); } }
public function getVisitorLog($fetch = false) { // If previous=1 is set, user clicked previous // we can't deal with previous so we force display of the first page if (Piwik_Common::getRequestVar('previous', 0, 'int') == 1) { $_GET['maxIdVisit'] = ''; } $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'Live.getLastVisitsDetails'); $view->disableGenericFilters(); $view->disableSort(); $view->setTemplate("Live/templates/visitorLog.tpl"); $view->setSortedColumn('idVisit', 'ASC'); $view->disableSearchBox(); $view->setLimit(20); $view->disableOffsetInformation(); $view->disableExcludeLowPopulation(); // disable the tag cloud, pie charts, bar chart icons $view->disableShowAllViewsIcons(); // disable the button "show more datas" $view->disableShowAllColumns(); // disable the RSS feed $view->disableShowExportAsRssFeed(); // disable all row actions if ($view instanceof Piwik_ViewDataTable_HtmlTable) { $view->disableRowActions(); } $view->setReportDocumentation(Piwik_Translate('Live_VisitorLogDocumentation', array('<br />', '<br />'))); $view->setCustomParameter('dataTablePreviousIsFirst', 1); $view->setCustomParameter('filterEcommerce', Piwik_Common::getRequestVar('filterEcommerce', 0, 'int')); $view->setCustomParameter('pageUrlNotDefined', Piwik_Translate('General_NotDefined', Piwik_Translate('Actions_ColumnPageURL'))); return $this->renderView($view, $fetch); }
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(); }
function init() { $resetToken = Piwik_Common::getRequestVar('token', '', 'string'); $formElements = array( array('text', 'form_login'), array('password', 'form_password'), array('password', 'form_password_bis'), array('text', 'form_token'), ); $this->addElements( $formElements ); $defaults = array( 'form_token' => $resetToken, ); $this->setDefaults($defaults); $formRules = array( array('form_login', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('General_Username')), 'required'), array('form_password', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_Password')), 'required'), array('form_password_bis', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordRepeat')), 'required'), array('form_token', sprintf(Piwik_Translate('General_Required'), Piwik_Translate('Login_PasswordResetToken')), 'required'), array('form_password', Piwik_Translate( 'Login_PasswordsDoNotMatch'), 'fieldHaveSameValue', 'form_password_bis'), ); $this->addRules( $formRules ); $this->addElement('submit', 'submit'); }
public function getReportMetadata($notification) { $reports =& $notification->getNotificationObject(); $i = 0; foreach ($this->reportMetadata as $report) { list($category, $name, $apiModule, $apiAction, $columnName) = $report; if ($category == false) { continue; } $report = array('category' => Piwik_Translate($category), 'name' => Piwik_Translate($name), 'module' => $apiModule, 'action' => $apiAction, 'dimension' => Piwik_Translate($columnName), 'order' => $i++); $translation = $name . 'Documentation'; $translated = Piwik_Translate($translation, '<br />'); if ($translated != $translation) { $report['documentation'] = $translated; } // getPlugin returns only a subset of metrics if ($apiAction == 'getPlugin') { $report['metrics'] = array('nb_visits', 'nb_visits_percentage' => Piwik_Translate('General_ColumnPercentageVisits')); // There is no processedMetrics for this report $report['processedMetrics'] = array(); // Always has same number of rows, 1 per plugin $report['constantRowsCount'] = true; } $reports[] = $report; } }
public function getReportMetadata($notification) { $reports = &$notification->getNotificationObject(); $reports[] = array( 'category' => Piwik_Translate('General_Visitors'), 'name' => Piwik_Translate('VisitFrequency_ColumnReturningVisits'), 'module' => 'VisitFrequency', 'action' => 'get', 'metrics' => array( 'nb_visits_returning' => Piwik_Translate('VisitFrequency_ColumnReturningVisits'), 'nb_actions_returning' => Piwik_Translate('VisitFrequency_ColumnActionsByReturningVisits'), 'avg_time_on_site_returning' => Piwik_Translate('VisitFrequency_ColumnAverageVisitDurationForReturningVisitors'), 'bounce_rate_returning' => Piwik_Translate('VisitFrequency_ColumnBounceRateForReturningVisits'), 'nb_actions_per_visit_returning' => Piwik_Translate('VisitFrequency_ColumnAvgActionsPerReturningVisit'), // Not displayed // 'nb_uniq_visitors_returning', // 'nb_visits_converted_returning', // 'sum_visit_length_returning', // 'max_actions_returning', // 'bounce_count_returning', ), 'processedMetrics' => false, 'order' => 40 ); }
/** Translate a column */ public static function displayColumns($view, $columns) { foreach ($columns as $column) { $view->setColumnTranslation($column, Piwik_Translate(self::$columnTranslations[$column])); } $view->setColumnsToDisplay($columns); }
public function __construct($width = Piwik_ImageGraph_API::GRAPH_WIDTH, $height = Piwik_ImageGraph_API::GRAPH_HEIGHT, $fontSize = Piwik_ImageGraph_API::GRAPH_FONT_SIZE) { //validate $width and $height $minWidth = 150; $maxWidth = 1500; if (!is_numeric($width) || $width < $minWidth || $width > $maxWidth) { throw new Exception(Piwik_Translate("General_ParameterMustIntegerBetween", array('$width', $minWidth, $maxWidth))); } $minHeight = 150; $maxHeight = 1500; if (!is_numeric($height) || $height < $minHeight || $height > $maxHeight) { throw new Exception(Piwik_Translate("General_ParameterMustIntegerBetween", array('$height', $minHeight, $maxHeight))); } $minFontSize = 3; $maxFontSize = 25; if (!is_numeric($fontSize) || $fontSize < $minFontSize || $fontSize > $maxFontSize) { throw new Exception(Piwik_Translate("General_ParameterMustIntegerBetween", array('$fontSize', $minFontSize, $maxFontSize))); } $this->widthImg = $width; $this->heightImg = $height; //Contruct the inherited pChart //parent::__construct($this->widthImg, $this->heightImg); //Workaround for white background $this->XSize = $this->widthImg; $this->YSize = $this->heightImg; $this->Picture = imagecreatetruecolor($this->widthImg, $this->heightImg); $C_White = $this->AllocateColor($this->Picture, 255, 255, 255); imagefilledrectangle($this->Picture, 0, 0, $this->widthImg, $this->heightImg, $C_White); //Set font and properties $this->fontSize = $fontSize; $this->setFontProperties(PIWIK_INCLUDE_PATH . "/libs/pChart.1.27d/Fonts/tahoma.ttf", $fontSize); $Position = imageftbbox($this->FontSize, 0, $this->FontName, "Test"); $this->imageFontHeight = $Position[1] - $Position[7]; }
public function getEvolutionGraph( $fetch = false, $columns = false) { $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, "VisitFrequency.get"); if(empty($columns)) { $columns = Piwik_Common::getRequestVar('columns'); } $columns = !is_array($columns) ? array($columns) : $columns; $view->setColumnsToDisplay($columns); $view->setColumnsTranslations(array( 'nb_visits_returning' => Piwik_Translate('VisitFrequency_ColumnReturningVisits'), 'nb_actions_returning' => Piwik_Translate('VisitFrequency_ColumnActionsByReturningVisits'), 'avg_time_on_site_returning' => Piwik_Translate('VisitFrequency_ColumnAverageVisitDurationForReturningVisitors'), 'bounce_rate_returning' => Piwik_Translate('VisitFrequency_ColumnBounceRateForReturningVisits'), 'nb_actions_per_visit_returning' => Piwik_Translate('VisitFrequency_ColumnAvgActionsPerReturningVisit'), )); $doc = Piwik_Translate('VisitFrequency_ReturningVisitsDocumentation').'<br />' . Piwik_Translate('General_BrokenDownReportDocumentation').'<br />' . Piwik_Translate('VisitFrequency_ReturningVisitDocumentation'); $view->setReportDocumentation($doc); return $this->renderView($view, $fetch); }
protected function setGeneralVariablesView($view) { // date $view->date = $this->strDate; $oDate = new Piwik_Date($this->strDate); $view->prettyDate = $oDate->getLocalized(Piwik_Translate('Home_LocalizedDateFormat')); // period $currentPeriod = Piwik_Common::getRequestVar('period'); $otherPeriodsAvailable = array('day', 'week', 'month', 'year'); $otherPeriodsNames = array('day' => Piwik_Translate('Home_PeriodDay'), 'week' => Piwik_Translate('Home_PeriodWeek'), 'month' => Piwik_Translate('Home_PeriodMonth'), 'year' => Piwik_Translate('Home_PeriodYear')); $found = array_search($currentPeriod, $otherPeriodsAvailable); if ($found !== false) { unset($otherPeriodsAvailable[$found]); } $view->period = $currentPeriod; $view->otherPeriods = $otherPeriodsAvailable; $view->periodsNames = $otherPeriodsNames; // other $view->idSite = Piwik_Common::getRequestVar('idSite'); $view->userLogin = Piwik::getCurrentUserLogin(); $view->sites = Piwik_SitesManager_API::getSitesWithAtLeastViewAccess(); $view->url = Piwik_Url::getCurrentUrl(); $view->menu = Piwik_GetMenu(); $view->menuJson = json_encode($view->menu); //var_dump($view->menuJson); }
public function getEvolutionGraph( $fetch = false, $columns = false) { $view = $this->getLastUnitGraph($this->pluginName, __FUNCTION__, "VisitsSummary.get"); if(empty($columns)) { $columns = Piwik_Common::getRequestVar('columns'); } $columns = !is_array($columns) ? array($columns) : $columns; $view->setColumnsToDisplay($columns); $doc = Piwik_Translate('VisitsSummary_VisitsSummaryDocumentation').'<br />' . Piwik_Translate('General_BrokenDownReportDocumentation').'<br /><br />' . '<b>'.Piwik_Translate('General_ColumnNbVisits').':</b> ' . Piwik_Translate('General_ColumnNbVisitsDocumentation').'<br />' . '<b>'.Piwik_Translate('General_ColumnNbUniqVisitors').':</b> ' . Piwik_Translate('General_ColumnNbUniqVisitorsDocumentation').'<br />' . '<b>'.Piwik_Translate('General_ColumnNbActions').':</b> ' . Piwik_Translate('General_ColumnNbActionsDocumentation').'<br />' . '<b>'.Piwik_Translate('General_ColumnActionsPerVisit').':</b> ' . Piwik_Translate('General_ColumnActionsPerVisitDocumentation'); $view->setReportDocumentation($doc); return $this->renderView($view, $fetch); }
public function getSegmentsMetadata($notification) { $segments =& $notification->getNotificationObject(); $acceptedValues = "0, 1, 2, 3, ..., 20, 21, 22, 23"; $segments[] = array('type' => 'dimension', 'category' => 'Visit', 'name' => Piwik_Translate('VisitTime_ColumnServerTime'), 'segment' => 'visitServerHour', 'sqlSegment' => 'HOUR(log_visit.visit_last_action_time)', 'acceptedValues' => $acceptedValues); $segments[] = array('type' => 'dimension', 'category' => 'Visit', 'name' => Piwik_Translate('VisitTime_ColumnLocalTime'), 'segment' => 'visitLocalHour', 'sqlSegment' => 'HOUR(log_visit.visitor_localtime)', 'acceptedValues' => $acceptedValues); }
static function add($widgetCategory, $widgetName, $controllerName, $controllerAction, $customParameters) { $widgetCategory = Piwik_Translate($widgetCategory); $widgetName = Piwik_Translate($widgetName); $widgetUniqueId = 'widget' . $controllerName . $controllerAction; self::$widgets[$widgetCategory][] = array('name' => $widgetName, 'uniqueId' => $widgetUniqueId, 'parameters' => array('module' => $controllerName, 'action' => $controllerAction) + $customParameters); }
public function getLastVisitsDetails($fetch = false) { $view = Piwik_ViewDataTable::factory(''); $view->init($this->pluginName, __FUNCTION__, 'Live.getLastVisitsDetails', 'getPagesFromVisitId'); // All colomns in DB which could be shown //'ip', 'idVisit', 'countActions', 'isVisitorReturning', 'country', 'countryFlag', 'continent', 'provider', 'providerUrl', 'idSite', //'serverDate', 'visitLength', 'visitLengthPretty', 'firstActionTimestamp', 'lastActionTimestamp', 'refererType', 'refererName', //'keywords', 'refererUrl', 'searchEngineUrl', 'searchEngineIcon', 'operatingSystem', 'operatingSystemShortName', 'operatingSystemIcon', //'browserFamily', 'browserFamilyDescription', 'browser', 'browserIcon', 'screen', 'resolution', 'screenIcon', 'plugins', 'lastActionDateTime', //'serverDatePretty', 'serverTimePretty', 'actionDetails' $view->setColumnsToDisplay(array('idVisit', 'serverDatePretty', 'serverTimePretty', 'ip', 'countActions', 'visitLengthPretty', 'keywords', 'refererUrl', 'operatingSystemShortName', 'browser', 'screen', 'resolution', 'plugins')); $view->setColumnsTranslations(array('idVisit' => Piwik_Translate(''), 'serverDatePretty' => Piwik_Translate('Live_Date'), 'serverTimePretty' => Piwik_Translate('Live_Time'), 'ip' => 'IP', 'countActions' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit'), 'visitLengthPretty' => Piwik_Translate('VisitorInterest_ColumnVisitDuration'), 'keywords' => Piwik_Translate('Referers_ColumnKeyword'), 'refererUrl' => Piwik_Translate('Live_Referrer_URL'), 'operatingSystemShortName' => Piwik_Translate('UserSettings_ColumnOperatingSystem'), 'browser' => Piwik_Translate('UserSettings_ColumnBrowser'), 'screen' => Piwik_Translate('UserSettings_ColumnTypeOfScreen'), 'resolution' => Piwik_Translate('UserSettings_ColumnResolution'), 'plugins' => Piwik_Translate('UserSettings_ColumnPlugin'))); $view->disableSort(); $view->setLimit(10); $view->disableExcludeLowPopulation(); $view->setSortedColumn('idVisit', 'ASC'); $view->disableSearchBox(); // "Include low population" link won't be displayed under this table $view->disableExcludeLowPopulation(); // disable the tag cloud, pie charts, bar chart icons $view->disableShowAllViewsIcons(); // disable the button "show more datas" $view->disableShowAllColumns(); return $this->renderView($view, $fetch); }
/** * @param Piwik_DataTable $table * @param string|null $newLabel new label for summary row */ public function __construct($table, $newLabel = null) { parent::__construct($table); if (is_null($newLabel)) { $newLabel = Piwik_Translate('General_Others'); } $this->newLabel = $newLabel; }
function getContinent($fetch = false) { $view = $this->getStandardDataTableUserCountry(__FUNCTION__, "UserCountry.getContinent", 'graphVerticalBar'); $view->disableSearchBox(); $view->disableOffsetInformation(); $view->setColumnTranslation('label', Piwik_Translate('UserCountry_Continent')); return $this->renderView($view, $fetch); }
/** * Returns a DataTable that associates ranges of visit numbers with the count of visits * whose visit number falls within those ranges. * * @param int $idSite The site to select data from. * @param string $period The period type. * @param string $date The date type. * @param string|bool $segment The segment. * @return Piwik_DataTable the archived report data. */ public function getNumberOfVisitsByVisitCount($idSite, $period, $date, $segment = false) { $dataTable = $this->getDataTable('VisitorInterest_visitsByVisitCount', $idSite, $period, $date, $segment, Piwik_Archive::INDEX_NB_VISITS); $dataTable->queueFilter('BeautifyRangeLabels', array(Piwik_Translate('General_OneVisit'), Piwik_Translate('General_NVisits'))); // add visit percent column self::addVisitsPercentColumn($dataTable); return $dataTable; }
public function getLocalizedLongString() { //"Mon 15 Aug" $date = $this->getDateStart(); $template = Piwik_Translate('CoreHome_DateFormat'); $out = $date->getLocalized($template); return $out; }
/** * Render the popover * @param Piwik_CoreHome_Controller * @param Piwik_View (the popover_rowevolution template) */ public function renderPopover($controller, $view) { // add data for metric select box $view->availableMetrics = $this->metricsForSelect; $view->selectedMetric = $this->metric; $view->availableRecordsText = $this->dimension . ': ' . Piwik_Translate('RowEvolution_ComparingRecords', array(count($this->availableMetrics))); return parent::renderPopover($controller, $view); }