Ejemplo n.º 1
0
    case 'ga:visits':
        $title = JText16::_('COM_SH404SEF_ANALYTICS_DATA_VISITS_DESC_RAW');
        break;
    case 'ga:visitors':
        $title = JText16::_('COM_SH404SEF_ANALYTICS_DATA_VISITORS_DESC_RAW');
        break;
    case 'ga:pageviews':
        $title = JText16::_('COM_SH404SEF_ANALYTICS_GLOBAL_PAGEVIEWS_DESC_RAW');
        break;
    default:
        $title = '';
        break;
}
$title = Sh404sefHelperAnalytics::getDataTypeTitle() . (empty($title) ? '' : '::' . $title);
?>


  <div  class="hasAnalyticsTip" title="<?php 
echo $title;
?>
" >

  	<fieldset>
            <?php 
echo '<legend>' . Sh404sefHelperAnalytics::getDataTypeTitle() . '</legend>';
echo '<div class="analytics-report-image"><img src="' . $this->analytics->analyticsData->images['visits'] . '" /></div>';
?>
    </fieldset>

  </div>
Ejemplo n.º 2
0
 */
// Security check to ensure this file is being included by a parent file.
if (!defined('_JEXEC')) {
    die('Direct Access to this location is not allowed.');
}
$title = JText::_('COM_SH404SEF_ANALYTICS_REPORT_SOURCES') . '::' . JText::_('COM_SH404SEF_ANALYTICS_DATA_SOURCES_DESC_RAW');
?>

  <div class="hasAnalyticsTip width-100" title="<?php 
echo $title;
?>
">
       
       <fieldset class="adminform">
					<legend>
						<?php 
echo JText::_('COM_SH404SEF_ANALYTICS_REPORT_SOURCES') . JText::_('COM_SH404SEF_ANALYTICS_REPORT_BY_LABEL') . Sh404sefHelperAnalytics::getDataTypeTitle();
?>
					</legend>
        
          <ul class="adminformlist">
            <li>
              <div class="analytics-report-image"><img src="<?php 
echo $this->analytics->analyticsData->images['sources'];
?>
" /></div>
            </li>
          </ul>
        </fieldset>
	
	</div>
 protected function _createSourcesGraph()
 {
     // load pChart graphic library
     $this->_loadLibs();
     // définition des données à afficher
     $dataSet = new pData();
     // need config, to know which data user wants to display : visits, unique visitors, pageviews
     $sefConfig = Sh404sefFactory::getConfig();
     // Google does not allow combining dimension=ga:medium with metric = unique visitors
     $dataType = $sefConfig->analyticsDashboardDataType == 'ga:visitors' ? 'ga:visits' : $sefConfig->analyticsDashboardDataType;
     $dataTypeString = str_replace('ga:', '', $dataType);
     // sort data for proper display
     usort($this->_rawData['sources'], array($this, '_sortSourcesDataCompareFunction'));
     // we walk the array, pulling out alternatively
     // the first and last items
     // making the new array having the largest item
     // followed by the smallest, then second largest
     // then second smallest, ...
     // which makes drawing labels much easier
     $tmpArray = array();
     $even = false;
     $max = count($this->_rawData['sources']);
     for ($i = 0; $i < $max; $i++) {
         if ($even) {
             // pull last item in sorted array
             $tmpArray[] = array_pop($this->_rawData['sources']);
         } else {
             // pull array first item
             $tmpArray[] = array_shift($this->_rawData['sources']);
         }
         // flag inversion
         $even = !$even;
     }
     // get data from response
     $data = array();
     $types = array();
     foreach ($tmpArray as $entry) {
         $value = $entry->{$dataTypeString};
         // do not add empty values, as pChart would choke on that and display a warning
         if (!empty($value)) {
             $data[] = $value;
             $types[] = Sh404sefHelperAnalytics::getReferralLabel($entry->dimension['medium']);
         }
     }
     $dataSet->AddPoint($data, "visits");
     $dataSet->AddPoint($types, "types");
     $dataSet->addSerie('visits');
     $dataSet->SetAbsciseLabelSerie("types");
     $label = JText::_('COM_SH404SEF_ANALYTICS_REPORT_SOURCES') . JText::_('COM_SH404SEF_ANALYTICS_REPORT_BY_LABEL') . Sh404sefHelperAnalytics::getDataTypeTitle();
     $dataSet->SetSerieName($label, "visits");
     // Initialise the graph
     $w = intval(0.45 * $this->_options['cpWidth']);
     $w = empty($w) ? 160 : $w;
     $radius = intval($w * 0.22);
     $margin = 5;
     $h = intval($w * 0.8);
     $centreX = intval(0.5 * $w);
     $centreY = intval(0.5 * $h);
     $chart = new pChart($w, $h);
     $fontSize = 8;
     // prepare graph
     $chart->setFontProperties($this->_baseChartPath . DS . 'Fonts/arial.ttf', $fontSize);
     $chart->loadColorPalette($this->_baseChartPath . DS . 'palettes' . DS . 'tones-2-green-soft.php');
     $chart->setGraphArea($margin, $margin, $w - $margin, $h - $margin);
     // This will draw a shadow under the pie chart
     $chart->drawFilledCircle($centreX + 4, $centreY + 4, $radius, 200, 200, 200);
     // Draw the pie chart
     $d = $dataSet->GetData();
     if (!empty($d)) {
         $chart->drawBasicPieGraph($d, $dataSet->GetDataDescription(), $centreX, $centreY, $radius, PIE_PERCENTAGE_LABEL_VALUE, 255, 255, 218);
     }
     // create a temporary file for
     $user =& JFactory::getUser();
     // make sure the root tmp dir exists
     $rootDir = 'tmp' . DS . 'sh404sef_analytics';
     Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $rootDir);
     // file name is variable to avoid browser cache
     $basePath = $rootDir . DS . md5('useless_' . $user->id . '_hashing') . DS;
     // create path and make sure there's an index.html file in it
     Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $basePath);
     $imageFileName = Sh404sefHelperAnalytics::createTempFile($basePath, $this->_options['report'] . '.' . $this->_options['accountId'] . '.sources.' . $dataTypeString);
     $chart->Render(JPATH_ROOT . DS . $imageFileName);
     // need cleaning up, so let's remove all report files for that user older than an hour or so
     Sh404sefHelperAnalytics::cleanReportsImageFiles(JPATH_ROOT . DS . $basePath, $age = 4000);
     return JURI::root() . $imageFileName;
 }
Ejemplo n.º 4
0
<?php

/**
 * SEF module for Joomla!
 *
 * @author      $Author: shumisha $
 * @copyright   Yannick Gaultier - 2007-2010
 * @package     sh404SEF-15
 * @license     http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @version     $Id: default_sources.php 1600 2010-09-03 10:55:18Z silianacom-svn $
 */
// Security check to ensure this file is being included by a parent file.
if (!defined('_JEXEC')) {
    die('Direct Access to this location is not allowed.');
}
$title = JText16::_('COM_SH404SEF_ANALYTICS_REPORT_SOURCES') . '::' . JText16::_('COM_SH404SEF_ANALYTICS_DATA_SOURCES_DESC_RAW');
?>

  <div class="hasAnalyticsTip" title="<?php 
echo $title;
?>
">
       
       <fieldset >
        <?php 
echo '<legend>' . JText16::_('COM_SH404SEF_ANALYTICS_REPORT_SOURCES') . JText16::_('COM_SH404SEF_ANALYTICS_REPORT_BY_LABEL') . Sh404sefHelperAnalytics::getDataTypeTitle() . '</legend>';
echo '<div class="analytics-report-image"><img src="' . $this->analytics->analyticsData->images['sources'] . '" /></div>';
?>
        </fieldset>
	
	</div>
Ejemplo n.º 5
0
    die('Direct Access to this location is not allowed.');
}
switch ($this->sefConfig->analyticsDashboardDataType) {
    case 'ga:visits':
        $title = JText::_('COM_SH404SEF_ANALYTICS_DATA_VISITS_DESC_RAW');
        break;
    case 'ga:visitors':
        $title = JText::_('COM_SH404SEF_ANALYTICS_DATA_VISITORS_DESC_RAW');
        break;
    case 'ga:pageviews':
        $title = JText::_('COM_SH404SEF_ANALYTICS_GLOBAL_PAGEVIEWS_DESC_RAW');
        break;
    default:
        $title = '';
        break;
}
?>
    <h2><?php 
echo Sh404sefHelperAnalytics::getDataTypeTitle();
?>
</h2>
    <div class="analytics-report-image">
    	<img rel="tooltip" <?php 
echo Sh404sefHelperHtml::wrapBootstrapTipTitle(Sh404sefHelperAnalytics::getDataTypeTitle(), $title);
?>
 src="<?php 
echo $this->analytics->analyticsData->images['visits'];
?>
" />
    </div>