diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2010-06-23 07:45:36 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2010-06-23 07:45:36 +0400 |
commit | 7e1b5d6b762340cbff1bb928d15815980c7649a7 (patch) | |
tree | e07da179b9e1372866d2349777bd1cc6b4c9e8cf /plugins/SitesManager/Controller.php | |
parent | 999f46479294713104c962bfe7469e9b6e7a4bbf (diff) | |
parent | c98ea06f2cccec81c6ccce49162a583494e44d91 (diff) |
Diffstat (limited to 'plugins/SitesManager/Controller.php')
-rw-r--r-- | plugins/SitesManager/Controller.php | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php index ddf93d109b..84dc3d5a03 100644 --- a/plugins/SitesManager/Controller.php +++ b/plugins/SitesManager/Controller.php @@ -19,17 +19,56 @@ class Piwik_SitesManager_Controller extends Piwik_Controller function index() { $view = Piwik_View::factory('SitesManager'); - $sites = Piwik_SitesManager_API::getSitesWithAdminAccess(); + $sites = Piwik_SitesManager_API::getInstance()->getSitesWithAdminAccess(); foreach($sites as &$site) { - $site['alias_urls'] = Piwik_SitesManager_API::getSiteUrlsFromId($site['idsite']); + $site['alias_urls'] = Piwik_SitesManager_API::getInstance()->getSiteUrlsFromId($site['idsite']); + $site['excluded_ips'] = str_replace(',','<br/>', $site['excluded_ips']); + $site['excluded_parameters'] = str_replace(',','<br/>', $site['excluded_parameters']); } $view->adminSites = $sites; + + $timezones = Piwik_SitesManager_API::getInstance()->getTimezonesList(); + $view->timezoneSupported = Piwik::isTimezoneSupportEnabled(); + $view->timezones = json_encode($timezones); + $view->defaultTimezone = Piwik_SitesManager_API::getInstance()->getDefaultTimezone(); + + $view->currencies = json_encode(Piwik_SitesManager_API::getInstance()->getCurrencyList()); + $view->defaultCurrency = Piwik_SitesManager_API::getInstance()->getDefaultCurrency(); + + $view->utcTime = Piwik_Date::now()->getDatetime(); + $excludedIpsGlobal = Piwik_SitesManager_API::getInstance()->getExcludedIpsGlobal(); + $view->globalExcludedIps = str_replace(',',"\n", $excludedIpsGlobal); + $excludedQueryParametersGlobal = Piwik_SitesManager_API::getInstance()->getExcludedQueryParametersGlobal(); + $view->globalExcludedQueryParameters = str_replace(',',"\n", $excludedQueryParametersGlobal); + $view->currentIpAddress = Piwik_Common::getIpString(); + $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); echo $view->render(); } + function setGlobalSettings() + { + $response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format')); + + try { + $this->checkTokenInUrl(); + $timezone = Piwik_Common::getRequestVar('timezone', false); + $excludedIps = Piwik_Common::getRequestVar('excludedIps', false); + $excludedQueryParameters = Piwik_Common::getRequestVar('excludedQueryParameters', false); + $currency = Piwik_Common::getRequestVar('currency', false); + Piwik_SitesManager_API::getInstance()->setDefaultTimezone($timezone); + Piwik_SitesManager_API::getInstance()->setDefaultCurrency($currency); + Piwik_SitesManager_API::getInstance()->setGlobalExcludedQueryParameters($excludedQueryParameters); + Piwik_SitesManager_API::getInstance()->setGlobalExcludedIps($excludedIps); + $toReturn = $response->getResponse(); + } catch(Exception $e ) { + $toReturn = $response->getResponseException( $e ); + } + echo $toReturn; + } + function displayJavascriptCode() { $idSite = Piwik_Common::getRequestVar('idsite', 1); @@ -38,6 +77,8 @@ class Piwik_SitesManager_Controller extends Piwik_Controller $view = Piwik_View::factory('DisplayJavascriptCode'); $this->setGeneralVariablesView($view); $view->menu = Piwik_GetAdminMenu(); + $site = new Piwik_Site($idSite); + $view->displaySiteName = $site->getName(); $view->jsTag = $jsTag; echo $view->render(); } |