plugins/generic/googleAnalytics/GoogleAnalyticsSettingsForm.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00017 import('form.Form');
00018 
00019 class GoogleAnalyticsSettingsForm extends Form {
00020 
00022    var $conferenceId;
00023 
00025    var $plugin;
00026 
00032    function GoogleAnalyticsSettingsForm(&$plugin, $conferenceId) {
00033       $this->conferenceId = $conferenceId;
00034       $this->plugin =& $plugin;
00035 
00036       parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
00037 
00038       $this->addCheck(new FormValidator($this, 'googleAnalyticsSiteId', 'required', 'plugins.generic.googleAnalytics.manager.settings.googleAnalyticsSiteIdRequired'));
00039 
00040       $this->addCheck(new FormValidator($this, 'trackingCode', 'required', 'plugins.generic.googleAnalytics.manager.settings.trackingCodeRequired'));
00041    }
00042 
00046    function initData() {
00047       $conferenceId = $this->conferenceId;
00048       $plugin =& $this->plugin;
00049 
00050       $this->_data = array(
00051          'googleAnalyticsSiteId' => $plugin->getSetting($conferenceId, 0, 'googleAnalyticsSiteId'),
00052          'trackingCode' => $plugin->getSetting($conferenceId, 0, 'trackingCode')
00053       );
00054    }
00055 
00059    function readInputData() {
00060       $this->readUserVars(array('googleAnalyticsSiteId', 'trackingCode'));
00061    }
00062 
00066    function execute() {
00067       $plugin =& $this->plugin;
00068       $conferenceId = $this->conferenceId;
00069 
00070       $plugin->updateSetting($conferenceId, 0, 'googleAnalyticsSiteId', trim($this->getData('googleAnalyticsSiteId'), "\"\';"), 'string');
00071 
00072       $trackingCode = $this->getData('trackingCode');
00073       if (($trackingCode != "urchin") && ($trackingCode != "ga")) {
00074          $trackingCode = "urchin";
00075       }  
00076       $plugin->updateSetting($conferenceId, 0, 'trackingCode', $trackingCode, 'string');
00077    }
00078 }
00079 
00080 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7