getSetting('name'); $title = null; foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) { if (isset($titleArray[$locale])) return $titleArray[$locale]; } return null; } /** * Get "localized" journal page logo (if applicable). * @return string */ function getLocalizedPageHeaderLogo() { $logoArray = $this->getSetting('pageHeaderLogoImage'); foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) { if (isset($logoArray[$locale])) return $logoArray[$locale]; } return null; } /** * Get localized favicon * @return string */ function getLocalizedFavicon() { $faviconArray = $this->getSetting('favicon'); foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) { if (isset($faviconArray[$locale])) return $faviconArray[$locale]; } return null; } // // Get/set methods // /** * Get the association type for this context. * @return int */ function getAssocType() { return ASSOC_TYPE_JOURNAL; } /** * Get the settings DAO for this context object. * @return DAO */ static function getSettingsDAO() { return DAORegistry::getDAO('JournalSettingsDAO'); } /** * @copydoc DataObject::getDAO() */ function getDAO() { return DAORegistry::getDAO('JournalDAO'); } // // Statistics API // /** * Return all metric types supported by this journal. * * @return array An array of strings of supported metric type identifiers. */ function getMetricTypes($withDisplayNames = false) { // Retrieve report plugins enabled for this journal. $reportPlugins =& PluginRegistry::loadCategory('reports', true, $this->getId()); if (!is_array($reportPlugins)) return array(); // Run through all report plugins and retrieve all supported metrics. $metricTypes = array(); foreach ($reportPlugins as $reportPlugin) { $pluginMetricTypes = $reportPlugin->getMetricTypes(); if ($withDisplayNames) { foreach ($pluginMetricTypes as $metricType) { $metricTypes[$metricType] = $reportPlugin->getMetricDisplayType($metricType); } } else { $metricTypes = array_merge($metricTypes, $pluginMetricTypes); } } return $metricTypes; } /** * Returns the currently configured default metric type for this journal. * If no specific metric type has been set for this journal then the * site-wide default metric type will be returned. * * @return null|string A metric type identifier or null if no default metric * type could be identified. */ function getDefaultMetricType() { $defaultMetricType = $this->getSetting('defaultMetricType'); // Check whether the selected metric type is valid. $availableMetrics = $this->getMetricTypes(); if (empty($defaultMetricType)) { if (count($availableMetrics) === 1) { // If there is only a single available metric then use it. $defaultMetricType = $availableMetrics[0]; } else { // Use the site-wide default metric. $application = PKPApplication::getApplication(); $defaultMetricType = $application->getDefaultMetricType(); } } else { if (!in_array($defaultMetricType, $availableMetrics)) return null; } return $defaultMetricType; } /** * Retrieve a statistics report pre-filtered on this journal. * * @see * for a full specification of the input and output format of this method. * * @param $metricType null|integer|array metrics selection * @param $columns integer|array column (aggregation level) selection * @param $filters array report-level filter selection * @param $orderBy array order criteria * @param $range null|DBResultRange paging specification * * @return null|array The selected data as a simple tabular * result set or null if metrics are not supported by this journal. */ function getMetrics($metricType = null, $columns = array(), $filter = array(), $orderBy = array(), $range = null) { // Add a journal filter and run the report. $filter[STATISTICS_DIMENSION_CONTEXT_ID] = $this->getId(); $application = PKPApplication::getApplication(); return $application->getMetrics($metricType, $columns, $filter, $orderBy, $range); } } ?>