Exemple #1
0
 protected function addToolBar()
 {
     $canDo = GAnalyticsHelper::getActions();
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('dashboard.reset', 'purge.png', 'purge.png', JText::_('COM_GANALYTICS_PROFILES_VIEW_DASHBOARD_RESET_BUTTON'), false);
     }
     parent::addToolbar();
 }
Exemple #2
0
 public function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $canDo = GAnalyticsHelper::getActions();
     if ($canDo->get('core.edit')) {
         JToolBarHelper::apply('profile.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('profile.save', 'JTOOLBAR_SAVE');
     }
     JToolBarHelper::cancel('profile.cancel', 'JTOOLBAR_CLOSE');
     parent::addToolbar();
 }
Exemple #3
0
 protected function addToolbar()
 {
     if ($this->items !== null) {
         $canDo = GAnalyticsHelper::getActions();
         if ($canDo->get('core.create')) {
             JToolBarHelper::custom('import.save', 'new.png', 'new.png', 'add', false);
         }
         JToolBarHelper::cancel('import.cancel', 'JTOOLBAR_CANCEL');
     }
     parent::addToolbar();
 }
 protected function addToolBar()
 {
     $canDo = GAnalyticsHelper::getActions();
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('import.import', 'upload.png', 'upload.png', JText::_('COM_GANALYTICS_PROFILES_VIEW_IMPORT_BUTTON'), false);
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('profile.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'profiles.delete', 'JTOOLBAR_DELETE');
     }
     parent::addToolbar();
 }
Exemple #5
0
 protected function addToolbar()
 {
     $canDo = GAnalyticsHelper::getActions();
     if (empty($this->title)) {
         $this->title = 'COM_GANALYTICS_' . strtoupper($this->getName()) . '_VIEW_TITLE';
     }
     if (empty($this->icon)) {
         $this->icon = strtolower($this->getName());
     }
     JToolBarHelper::title(JText::_($this->title), $this->icon);
     // 		JFactory::getDocument()->addStyleDeclaration('.icon-48-'.$this->icon.' {background-image: url(../media/com_ganalytics/images/admin/48-'.$this->icon.'.png);background-repeat: no-repeat;}');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_ganalytics', 500);
         JToolBarHelper::divider();
     }
 }
Exemple #6
0
 public function display($cachable = false, $urlparams = array())
 {
     JRequest::setVar('view', JRequest::getCmd('view', 'dashboard'));
     parent::display($cachable, $urlparams);
     $view = JRequest::getVar('view', 'dashboard');
     JSubMenuHelper::addEntry(JText::_('COM_GANALYTICS_SUBMENU_DASHBOARD'), 'index.php?option=com_ganalytics', $view == 'dashboard');
     JSubMenuHelper::addEntry(JText::_('COM_GANALYTICS_SUBMENU_PAGES'), 'index.php?option=com_ganalytics&view=pages', $view == 'pages');
     JSubMenuHelper::addEntry(JText::_('COM_GANALYTICS_SUBMENU_PROFILES'), 'index.php?option=com_ganalytics&view=profiles', $view == 'profiles');
     JSubMenuHelper::addEntry(JText::_('COM_GANALYTICS_SUBMENU_TOOLS'), 'index.php?option=com_ganalytics&view=tools', $view == 'tools');
     JSubMenuHelper::addEntry(JText::_('COM_GANALYTICS_SUBMENU_HELP'), 'index.php?option=com_ganalytics&view=help', $view == 'help');
     // set some global property
     $document = JFactory::getDocument();
     $document->addStyleDeclaration('.icon-48-analytics {background-image: url(../media/com_ganalytics/images/48-analytics.png);background-repeat: no-repeat;}');
     if (GAnalyticsHelper::getComponentParameter('client-id') == null || GAnalyticsHelper::getComponentParameter('client-secret') == null) {
         JError::raiseNotice(0, JText::_('COM_GANALYTICS_WARNING_NO_CLIENT_ID'));
     }
 }
Exemple #7
0
 protected function getInput()
 {
     $params = '';
     if (isset($this->element['params-field'])) {
         $params = 'params_';
     }
     $prefix = $this->form->getFormControl();
     if (!empty($prefix)) {
         $prefix .= '_';
     }
     $id = $prefix . $params . $this->element['name'];
     GAnalyticsHelper::loadjQuery();
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . 'components/com_ganalytics/libraries/jquery/multiselect/jquery.multiselect2side.js');
     $document->addStyleSheet(JURI::base() . 'components/com_ganalytics/libraries/jquery/multiselect/jquery.multiselect2side.css');
     $document->addScript(JURI::base() . 'components/com_ganalytics/models/fields/sortcombo.js');
     return parent::getInput();
 }
Exemple #8
0
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $access = 0;
     $params = null;
     if (JRequest::getVar('source', 'component') == 'component') {
         $menu = JFactory::getApplication()->getMenu()->getItem(JRequest::getInt('Itemid'));
         $params = $menu->params;
         $params->set('mode', $menu->query['layout'] == 'image' ? 'image' : 'list');
         $params->set('filterType', 'advanced');
         $access = $menu->access;
     }
     if (JRequest::getVar('source', 'component') == 'module') {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('m.*');
         $query->from('#__modules AS m');
         $query->where('id = ' . JRequest::getInt('moduleid'));
         $db->setQuery($query);
         $module = $db->loadObject();
         if ($module != null) {
             $params = new JRegistry($module->params);
             $params->set('mode', $params->get('mode', GAnalyticsHelper::isPROMode() ? 'image' : 'list'));
             if ($module->module == 'mod_ganalytics_admin_stats') {
                 //default it to a different
                 $params->set('type', $params->get('type', 'visits'));
             }
             $access = $module->access;
         }
     }
     if ($user->authorise('core.admin') || in_array((int) $access, $user->getAuthorisedViewLevels())) {
         $this->getModel()->setState('params', $params);
         $this->params = $params;
         $this->data = $this->get('StatsData');
         $this->profile = $this->get('Profile');
     } else {
         $this->params = $params;
         $this->data = null;
         $this->profile = null;
         JError::raiseWarning(0, 'JERROR_ALERTNOAUTHOR');
     }
     parent::display($tpl);
 }
 protected function getGroups()
 {
     JFactory::getLanguage()->load('com_ganalytics');
     if ($this->notLoad) {
         return array(array(JHtml::_('select.option', $this->value)));
     }
     if ($this->value == null) {
         $this->value = array();
     }
     if (!is_array($this->value)) {
         $this->value = array($this->value);
     }
     GAnalyticsHelper::loadjQuery();
     JFactory::getDocument()->addScript(JURI::base() . 'components/com_ganalytics/libraries/jquery/multiselect/jquery.multiselect2side.js');
     JFactory::getDocument()->addStyleSheet(JURI::base() . 'components/com_ganalytics/libraries/jquery/multiselect/jquery.multiselect2side.css');
     JFactory::getDocument()->addScriptDeclaration("gajQuery(document).ready(function(){createMultiSelectCombo(gajQuery('#" . $this->id . "'));});");
     $groups = array('' => array());
     foreach ($this->value as $value) {
         $groups[''][] = JHtml::_('select.option', $value, GAnalyticsHelper::translate($value), 'value', 'text');
     }
     $xml = new SimpleXMLElement(JFile::read(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ganalytics' . DS . 'helper' . DS . 'metrics.xml'));
     foreach ($xml->div as $group) {
         $label = GAnalyticsHelper::translate($group->div);
         if (!isset($groups[$label])) {
             $groups[$label] = array();
         }
         foreach ($group->label as $value) {
             $v = (string) $value->attributes()->for;
             if (in_array($v, $this->value)) {
                 continue;
             }
             $groups[$label][] = JHtml::_('select.option', $v, GAnalyticsHelper::translate($v), 'value', 'text');
         }
     }
     return $groups;
 }
Exemple #10
0
function checkPROMode()
{
    $desc = "Cool you use the PRO mode!!";
    $status = 'ok';
    $solution = '';
    if (!GAnalyticsHelper::isPROMode()) {
        $desc = "You are using the FREE version which doesn't have all the features the PRO version has. <a href=\"http://joomla.digital-peak.com/content/docu/doku.php/id,docu;ganalytics;pro/\" target=\"_blank\">Consider buying</a> the PRO version and get some cool graphical stuff and more.";
        $status = 'warning';
        $solution = '.';
    }
    return array('name' => 'GAnalytics Mode Check', 'description' => $desc, 'status' => $status, 'solution' => $solution);
}
        ?>
	<td valign="top">
<?php 
        foreach ($this->statsViews as $view) {
            if ($view->group_id != $group->id || $view->column != $i) {
                continue;
            }
            ?>
		<div class="portlet">
			<div class="portlet-header"><div class="portlet-title"><?php 
            echo $view->name;
            ?>
</div></div>
			<div class="portlet-content">
		<?php 
            $scriptCode .= "gajQuery('#widgetForm-" . $view->id . "').gaChart({\n\t\t\tchartDivID: 'gaChartDiv" . $view->id . "',\n\t\t\tgaid: gajQuery('#profiles').val(),\n\t\t\turl: 'index.php?option=com_ganalytics&view=dashboard&format=raw&layout=data&id=" . $view->id . "',\n\t\t\tstart: gajQuery('#date_from').val(),\n\t\t\tend: gajQuery('#date_to').val(),\n\t\t\tcolorStart: '" . GAnalyticsHelper::getFadedColor('EB8F33', 0.2) . "',\n\t\t\tcolorEnd: 'EB8F33',\n\t\t\tpathPrefix: '" . JURI::root() . "'\n\t\t});\n";
            ?>
		<form method="post" name="adminForm" class="adminForm" id="widgetForm-<?php 
            echo $view->id;
            ?>
">
			<?php 
            JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
            JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
            $form = JForm::getInstance('com_ganalytics.statsview', 'statsview');
            $form->bind($view);
            ?>
			<fieldset class="adminform">
			<table class="adminformlist">
				<?php 
            foreach ($form->getFieldset('details') as $field) {
Exemple #12
0
		<p>GAnalytics connects the googla analytics service with your joomla
		powered web site. Easy to use and flexibility are the main targets of
		GAnalytics.<br />
		<br />
		<b>How Google advertises his analytics service:</b><br />
		<i> Google Analytics is the enterprise-class web analytics solution
		that gives you rich insights into your website traffic and marketing
		effectiveness. Powerful, flexible and easy-to-use features now let you
		see and analyze your traffic data in an entirely new way. With Google
		Analytics, you're more prepared to write better-targeted ads,
		strengthen your marketing initiatives and create higher converting
		websites.</i></p>

		<?php 
if (!GAnalyticsHelper::isProMode()) {
    ?>
		<h2>Donation</h2>
		There is more effort behind GAnalytics than you think... <br>
		<br>
		You get this extensions for free but the project depends on donations
		to support further releases and new features!! Please make a small
		donation with paypal.....<br>
		<br>
		<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input
			type="hidden" name="cmd" value="_s-xclick"> <input type="hidden"
			name="hosted_button_id" value="302238"> <input type="image"
			src="https://www.paypal.com/en_US/CH/i/btn/btn_donateCC_LG.gif"
			border="0" name="submit" alt=""> <img alt="" border="0"
			src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1"
			height="1"></form>
Exemple #13
0
</button></td>
	</tr>
</table>
<?php 
}
$scriptCode = "gajQuery(document).ready(function(){\n";
?>
<fieldset class="mod-date-range-container">
<legend><?php 
$dims = array();
foreach ($dimensions as $dim) {
    $dims[] = GAnalyticsHelper::translate($dim);
}
$metrs = array();
foreach ($metrics as $metr) {
    $metrs[] = GAnalyticsHelper::translate($metr);
}
echo implode(' | ', $dims) . ' -- ' . implode(' | ', $metrs);
?>
	</legend>
	<?php 
if (in_array('ga:date', $dimensions) !== false) {
    ?>
	<div class="mod-date-range-toolbar">
		<img src="media/com_ganalytics/images/dayrange/month-disabled-32.png" class="date-range-button date-range-month"
			alt="<?php 
    echo JText::_('MOD_GANALYTICS_STATS_CHART_VIEW_IMAGE_DATE_RANGE_MONTH');
    ?>
"
			title="<?php 
    echo JText::_('MOD_GANALYTICS_STATS_CHART_VIEW_IMAGE_DATE_RANGE_MONTH');
Exemple #14
0
 public function getStatsData()
 {
     $params = $this->getState('params');
     $startDate = JFactory::getDate();
     $startDate->modify('-1 day');
     $endDate = JFactory::getDate();
     $endDate->modify('-1 day');
     if ($params->get('daterange', 'month') == 'advanced') {
         $tmp = $params->get('advancedDateRange', null);
         if (!empty($tmp)) {
             $startDate = JFactory::getDate(strtotime($tmp));
         } else {
             $tmp = $params->get('startdate', null);
             if (!empty($tmp)) {
                 $startDate = JFactory::getDate($tmp);
             }
             $tmp = $params->get('enddate', null);
             if (!empty($tmp)) {
                 $endDate = JFactory::getDate($tmp);
             }
         }
     } else {
         $range = '';
         switch ($params->get('daterange', 'month')) {
             case 'day':
                 $range = '-1 day';
                 break;
             case 'week':
                 $range = '-1 week';
                 break;
             case 'month':
                 $range = '-1 month';
                 break;
             case 'year':
                 $range = '-1 year';
                 break;
         }
         $startDate = JFactory::getDate(strtotime($range));
     }
     $dimensions = array();
     $metrics = array();
     $sort = array();
     if ($params->get('type', 'visitsbytraffic') == 'advanced') {
         $dimensions = $params->get('dimensions', array('ga:date'));
         $metrics = $params->get('metrics', array('ga:visits'));
         $sort = $params->get('sort', array());
     } else {
         switch ($params->get('type', 'visitsbytraffic')) {
             case 'visits':
                 $dimensions[] = 'ga:date';
                 $metrics[] = 'ga:visits';
                 $metrics[] = 'ga:newVisits';
                 $sort[] = 'ga:date';
                 break;
             case 'visitsbytraffic':
                 $dimensions[] = 'ga:source';
                 $metrics[] = 'ga:visits';
                 $metrics[] = 'ga:newVisits';
                 $sort[] = '-ga:visits';
                 break;
             case 'visitsbybrowser':
                 $dimensions[] = 'ga:browser';
                 $metrics[] = 'ga:visits';
                 $metrics[] = 'ga:newVisits';
                 $sort[] = '-ga:visits';
                 break;
             case 'visitsbycountry':
                 $dimensions[] = 'ga:country';
                 $metrics[] = 'ga:visits';
                 $sort[] = '-ga:visits';
                 break;
             case 'timeonsite':
                 $dimensions[] = 'ga:region';
                 $metrics[] = 'ga:timeOnSite';
                 $sort[] = '-ga:timeOnSite';
                 break;
             case 'toppages':
                 $dimensions[] = 'ga:pagePath';
                 $metrics[] = 'ga:pageviews';
                 $sort[] = '-ga:pageviews';
                 break;
         }
     }
     $max = $params->get('max', 1000);
     if (JRequest::getVar('type', null) == 'visitor') {
         $dimensions = array('ga:date');
         $metrics = array('ga:newVisits', 'ga:visits');
         $sort = array('ga:date');
         $max = 1000;
     }
     if (JRequest::getVar('start-date', null) != null) {
         $startDate = JFactory::getDate(JRequest::getVar('start-date', null));
         $startDate->setTime(0, 0);
     }
     if (JRequest::getVar('end-date', null) != null) {
         $endDate = JFactory::getDate(JRequest::getVar('end-date', null));
         $endDate->setTime(0, 0);
     }
     $filter = null;
     if ($params->get('filterType', '') == 'page') {
         $uri = JFactory::getURI();
         $filter = 'ga:pagePath==' . $uri->getPath() . '?' . $uri->getQuery();
     }
     if ($params->get('filterType', '') == 'advanced') {
         $filter = GAnalyticsHelper::render($params->get('filter', null), array('userId' => JFactory::getUser()->id, 'username' => strtolower(JFactory::getUser()->username)));
     }
     return GAnalyticsDataHelper::getData($this->getProfile(), $dimensions, $metrics, $startDate, $endDate, $sort, $filter, $max);
 }
 public function reset()
 {
     if (!GAnalyticsHelper::getActions()->get('core.create')) {
         $this->setRedirect('index.php?option=com_ganalytics', JText::_('COM_GANALYTICS_DASHBOARD_NO_PERMISSION'));
         return;
     }
     $this->getModel()->reset();
     $this->setRedirect('index.php?option=com_ganalytics');
 }
echo JHtml::_('calendar', $this->escape($this->state->get('filter.search_end')), 'filter_search_end', 'filter_search_end', '%Y-%m-%d', array('class' => 'inputbox', 'maxlength' => '10', 'size' => '10'));
?>

			<button type="submit"><?php 
echo JText::_('JSEARCH_FILTER_SUBMIT');
?>
</button>
			<button type="button" onclick="document.id('filter_search').value='';document.id('filter_search_start').value='';document.id('filter_search_end').value='';this.form.submit();"><?php 
echo JText::_('JSEARCH_FILTER_CLEAR');
?>
</button>
		</div>
	</fieldset>
	<?php 
if (GAnalyticsHelper::isPROMode()) {
    echo '<h4>' . GAnalyticsHelper::translate('ga:uniquePageViews') . ' -- ' . GAnalyticsHelper::translate('ga:pageViews') . '</h4>';
    ?>
		<table id="charts-table">
			<tr>
				<td rowspan="2" id="date-chart-cell"><div id="ga-date-chart"></div></td>
				<td><div id="ga-browser-chart"></div></td>
			</tr>
			<tr>
				<td><div id="ga-country-chart"></div></td>
			</tr>
		</table>
		<hr/><br>
	<?php 
}
?>
	<div class="clr"> </div>
			</tr>
			<tr>
				<td class="nowrap has-context"><?php 
echo JText::_('COM_GANALYTICS_PAGE_VIEW_SPEED');
?>
: </td>
				<td class="nowrap has-context"><?php 
echo round($entry[9], 2) . ' s';
?>
</td>
			</tr>
		</tbody>
	</table>
		<table id="charts-table" class="table table-striped">
	<?php 
if (GAnalyticsHelper::isPROMode()) {
    ?>
			<thead><tr>
				<th><?php 
    echo JText::_('COM_GANALYTICS_PAGE_VIEW_SOURCE');
    ?>
</th>
				<th><?php 
    echo JText::_('COM_GANALYTICS_PAGE_VIEW_MOBILE');
    ?>
</th>
				<th><?php 
    echo JText::_('COM_GANALYTICS_PAGE_VIEW_LANGUAGE');
    ?>
</th>
			</tr></thead>
Exemple #18
0
 public static function getClient()
 {
     $client = new apiClient();
     $client->setApplicationName('GAnalytics joomla extension');
     $client->setClientId(GAnalyticsHelper::getComponentParameter('client-id'));
     $client->setClientSecret(GAnalyticsHelper::getComponentParameter('client-secret'));
     $uri = JFactory::getURI();
     if (filter_var($uri->getHost(), FILTER_VALIDATE_IP)) {
         $uri->setHost('localhost');
     }
     $client->setRedirectUri($uri->toString(array('scheme', 'host', 'port', 'path')) . '?option=com_ganalytics&view=import');
     $client->setUseObjects(true);
     $service = new apiAnalyticsService($client);
     return $client;
 }
Exemple #19
0
 public function refreshUpdateSite()
 {
     if (!GAnalyticsHelper::isPROMode()) {
         return;
     }
     JLoader::import('joomla.application.component.helper');
     $params = JComponentHelper::getParams('com_ganalytics');
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $dlid = $params->get('downloadid', '');
     } else {
         $dlid = $params->getValue('downloadid', '');
     }
     $dlid = trim($dlid);
     $extra_query = null;
     // If I have a valid Download ID I will need to use a non-blank
     // extra_query in Joomla! 3.2+
     if (preg_match('/^([0-9]{1,}:)?[0-9a-f]{32}$/i', $dlid)) {
         $extra_query = 'dlid=' . $dlid;
     }
     // Create the update site definition we want to store to the database
     $update_site = array('enabled' => 1, 'last_check_timestamp' => 0, 'extra_query' => $extra_query);
     if (version_compare(JVERSION, '3.0.0', 'lt')) {
         unset($update_site['extra_query']);
     }
     $db = $this->getDbo();
     // Get the extension ID to ourselves
     $query = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('package'))->where($db->qn('element') . ' = ' . $db->q('pkg_ganalytics'));
     $db->setQuery($query);
     $extension_id = $db->loadResult();
     if (empty($extension_id)) {
         return;
     }
     // Get the update sites for our extension
     $query = $db->getQuery(true)->select($db->qn('update_site_id'))->from($db->qn('#__update_sites_extensions'))->where($db->qn('extension_id') . ' = ' . $db->q($extension_id));
     $db->setQuery($query);
     $updateSiteIDs = $db->loadColumn(0);
     if (count($updateSiteIDs)) {
         // Loop through all update sites
         foreach ($updateSiteIDs as $id) {
             $query = $db->getQuery(true)->select('*')->from($db->qn('#__update_sites'))->where($db->qn('update_site_id') . ' = ' . $db->q($id));
             $db->setQuery($query);
             $aSite = $db->loadObject();
             // Do we have the extra_query property (J 3.2+) and does it
             // match?
             if (property_exists($aSite, 'extra_query')) {
                 if ($aSite->extra_query == $update_site['extra_query']) {
                     continue;
                 }
             } else {
                 // Joomla! 3.1 or earlier. Updates may or may not work.
                 continue;
             }
             $update_site['update_site_id'] = $id;
             $newSite = (object) $update_site;
             $db->updateObject('#__update_sites', $newSite, 'update_site_id', true);
         }
     }
 }