本文整理匯總了PHP中Piwik_Site::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Piwik_Site::getName方法的具體用法?PHP Piwik_Site::getName怎麽用?PHP Piwik_Site::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik_Site
的用法示例。
在下文中一共展示了Piwik_Site::getName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: displayJavascriptCode
function displayJavascriptCode()
{
$idSite = Piwik_Common::getRequestVar('idsite', 1);
Piwik::checkUserHasViewAccess($idSite);
$jsTag = Piwik::getJavascriptCode($idSite, Piwik_Url::getCurrentUrlWithoutFileName());
$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();
}
示例2: setGeneralVariablesView
/**
* Sets general variables to the view that are used by various templates and Javascript.
* If any error happens, displays the login screen
* @param Piwik_View $view
* @return void
*/
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$view->idSite = $this->idSite;
if(empty($this->site) || empty($this->idSite))
{
throw new Exception("The requested website idSite is not found in the request, or is invalid.
Please check that you are logged in Piwik and have permission to access the specified website.");
}
$this->setPeriodVariablesView($view);
$rawDate = Piwik_Common::getRequestVar('date');
$periodStr = Piwik_Common::getRequestVar('period');
if($periodStr != 'range')
{
$date = Piwik_Date::factory($this->strDate);
$period = Piwik_Period::factory($periodStr, $date);
}
else
{
$period = new Piwik_Period_Range($periodStr, $rawDate, $this->site->getTimezone());
}
$view->rawDate = $rawDate;
$view->prettyDate = $period->getPrettyString();
$view->siteName = $this->site->getName();
$view->siteMainUrl = $this->site->getMainUrl();
$datetimeMinDate = $this->site->getCreationDate()->getDatetime();
$minDate = Piwik_Date::factory($datetimeMinDate, $this->site->getTimezone());
$this->setMinDateView($minDate, $view);
$maxDate = Piwik_Date::factory('now', $this->site->getTimezone());
$this->setMaxDateView($maxDate, $view);
// Setting current period start & end dates, for pre-setting the calendar when "Date Range" is selected
$dateStart = $period->getDateStart();
if($dateStart->isEarlier($minDate)) { $dateStart = $minDate; }
$dateEnd = $period->getDateEnd();
if($dateEnd->isLater($maxDate)) { $dateEnd = $maxDate; }
$view->startDate = $dateStart;
$view->endDate = $dateEnd;
$this->setBasicVariablesView($view);
} catch(Exception $e) {
Piwik_ExitWithMessage($e->getMessage());
}
}
示例3: setGeneralVariablesView
/**
* Sets general variables to the view that are used by
* various templates and Javascript.
* If any error happens, displays the login screen
*
* @param Piwik_View $view
* @throws Exception
* @return void
*/
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$view->idSite = $this->idSite;
if (empty($this->site) || empty($this->idSite)) {
throw new Exception("The requested website idSite is not found in the request, or is invalid.\n\t\t\t\tPlease check that you are logged in Piwik and have permission to access the specified website.");
}
$this->setPeriodVariablesView($view);
$rawDate = Piwik_Common::getRequestVar('date');
$periodStr = Piwik_Common::getRequestVar('period');
if ($periodStr != 'range') {
$date = Piwik_Date::factory($this->strDate);
$period = Piwik_Period::factory($periodStr, $date);
} else {
$period = new Piwik_Period_Range($periodStr, $rawDate, $this->site->getTimezone());
}
$view->rawDate = $rawDate;
$view->prettyDate = self::getCalendarPrettyDate($period);
$view->siteName = $this->site->getName();
$view->siteMainUrl = $this->site->getMainUrl();
$datetimeMinDate = $this->site->getCreationDate()->getDatetime();
$minDate = Piwik_Date::factory($datetimeMinDate, $this->site->getTimezone());
$this->setMinDateView($minDate, $view);
$maxDate = Piwik_Date::factory('now', $this->site->getTimezone());
$this->setMaxDateView($maxDate, $view);
// Setting current period start & end dates, for pre-setting the calendar when "Date Range" is selected
$dateStart = $period->getDateStart();
if ($dateStart->isEarlier($minDate)) {
$dateStart = $minDate;
}
$dateEnd = $period->getDateEnd();
if ($dateEnd->isLater($maxDate)) {
$dateEnd = $maxDate;
}
$view->startDate = $dateStart;
$view->endDate = $dateEnd;
$language = Piwik_LanguagesManager::getLanguageForSession();
$view->language = !empty($language) ? $language : Piwik_LanguagesManager::getLanguageCodeForCurrentUser();
$view->config_action_url_category_delimiter = Piwik_Config::getInstance()->General['action_url_category_delimiter'];
$this->setBasicVariablesView($view);
$view->topMenu = Piwik_GetTopMenu();
} catch (Exception $e) {
Piwik_ExitWithMessage($e->getMessage(), '');
}
}
示例4: getProcessedReport
public function getProcessedReport($idSite, $period, $date, $apiModule, $apiAction, $segment = false, $apiParameters = false, $idGoal = false, $language = false, $showTimer = true)
{
$timer = new Piwik_Timer();
if ($apiParameters === false) {
$apiParameters = array();
}
if (!empty($idGoal) && empty($apiParameters['idGoal'])) {
$apiParameters['idGoal'] = $idGoal;
}
// Is this report found in the Metadata available reports?
$reportMetadata = $this->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language, $period, $date);
if (empty($reportMetadata)) {
throw new Exception("Requested report {$apiModule}.{$apiAction} for Website id={$idSite} not found in the list of available reports. \n");
}
$reportMetadata = reset($reportMetadata);
// Generate Api call URL passing custom parameters
$parameters = array_merge($apiParameters, array('method' => $apiModule . '.' . $apiAction, 'idSite' => $idSite, 'period' => $period, 'date' => $date, 'format' => 'original', 'serialize' => '0', 'language' => $language));
if (!empty($segment)) {
$parameters['segment'] = $segment;
}
$url = Piwik_Url::getQueryStringFromParameters($parameters);
$request = new Piwik_API_Request($url);
try {
/** @var Piwik_DataTable */
$dataTable = $request->process();
} catch (Exception $e) {
throw new Exception("API returned an error: " . $e->getMessage() . "\n");
}
list($newReport, $columns, $rowsMetadata) = $this->handleTableReport($idSite, $dataTable, $reportMetadata, isset($reportMetadata['dimension']));
foreach ($columns as $columnId => &$name) {
$name = ucfirst($name);
}
$website = new Piwik_Site($idSite);
// $segment = new Piwik_Segment($segment, $idSite);
if (Piwik_Archive::isMultiplePeriod($date, $period)) {
$period = new Piwik_Period_Range($period, $date);
} else {
if ($period == 'range') {
$period = new Piwik_Period_Range($period, $date);
} else {
$period = Piwik_Period::factory($period, Piwik_Date::factory($date));
}
}
$period = $period->getLocalizedLongString();
$return = array('website' => $website->getName(), 'prettyDate' => $period, 'metadata' => $reportMetadata, 'columns' => $columns, 'reportData' => $newReport, 'reportMetadata' => $rowsMetadata);
if ($showTimer) {
$return['timerMillis'] = $timer->getTimeMs(0);
}
return $return;
}
示例5: setGeneralVariablesView
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$this->setPeriodVariablesView($view);
$period = Piwik_Period::factory(Piwik_Common::getRequestVar('period'), Piwik_Date::factory($this->strDate));
$view->prettyDate = $period->getLocalizedLongString();
$idSite = Piwik_Common::getRequestVar('idSite');
$view->idSite = $idSite;
$site = new Piwik_Site($idSite);
$view->siteName = $site->getName();
$view->siteMainUrl = $site->getMainUrl();
$minDate = $site->getCreationDate();
$view->minDateYear = $minDate->toString('Y');
$view->minDateMonth = $minDate->toString('m');
$view->minDateDay = $minDate->toString('d');
} catch (Exception $e) {
self::redirectToIndex(Piwik::getModule(), Piwik::getAction());
}
}
示例6: setGeneralVariablesView
protected function setGeneralVariablesView($view)
{
$view->date = $this->strDate;
try {
$this->setPeriodVariablesView($view);
$period = Piwik_Period::factory(Piwik_Common::getRequestVar('period'), Piwik_Date::factory($this->strDate));
$view->prettyDate = $period->getLocalizedLongString();
$idSite = Piwik_Common::getRequestVar('idSite');
$view->idSite = $idSite;
$site = new Piwik_Site($idSite);
$view->siteName = $site->getName();
$view->siteMainUrl = $site->getMainUrl();
$minDate = $site->getCreationDate();
$view->minDateYear = $minDate->toString('Y');
$view->minDateMonth = $minDate->toString('m');
$view->minDateDay = $minDate->toString('d');
$maxDate = Piwik_Date::factory('today');
$view->maxDateYear = $maxDate->toString('Y');
$view->maxDateMonth = $maxDate->toString('m');
$view->maxDateDay = $maxDate->toString('d');
$view->debugTrackVisitsInsidePiwikUI = Zend_Registry::get('config')->Debug->track_visits_inside_piwik_ui;
$view->isSuperUser = Zend_Registry::get('access')->isSuperUser();
} catch(Exception $e) {
self::redirectToIndex(Piwik::getModule(), Piwik::getAction());
}
}