private function createUsersOptOutSetting()
 {
     $this->userTrackingEnabled = new UserSetting('userTrackingEnabled', 'Piwik usage tracking enabled');
     $this->userTrackingEnabled->type = static::TYPE_BOOL;
     $this->userTrackingEnabled->uiControlType = static::CONTROL_CHECKBOX;
     $this->userTrackingEnabled->defaultValue = true;
     $this->userTrackingEnabled->description = 'If enabled, anonymous usage data will be tracked. For example which pages are viewed and which reports are used most often. For more information contact your system administrator.';
     if ($this->canUserOptOut->getValue()) {
         // we show this setting only when a user can actually opt out
         $this->addSetting($this->userTrackingEnabled);
     }
 }
Ejemplo n.º 2
0
 private function createGenerateKeysSetting()
 {
     $this->generateKeys = new SystemSetting('generateKeys', Piwik::translate('LoginEncrypted_SettingsGenerateKeysTitle'));
     $this->generateKeys->readableByCurrentUser = true;
     $this->generateKeys->type = static::TYPE_BOOL;
     $this->generateKeys->uiControlType = static::CONTROL_CHECKBOX;
     $this->generateKeys->description = Piwik::translate('LoginEncrypted_SettingsGenerateKeysDescription');
     $this->generateKeys->defaultValue = false;
     $this->generateKeys->transform = function ($value, $setting) {
         // check if check box got activated, and generate keys if so
         if ($value != $setting->defaultValue) {
             $publickey = Crypto::generateKeys($this->keyLength->getValue());
             $this->publicKey->setValue($publickey['e'] . ', ' . $publickey['n']);
         }
         return $setting->defaultValue;
         // reset checkbox
     };
     $this->addSetting($this->generateKeys);
 }
 private function createStartTrackingSetting()
 {
     $goals = \Piwik\API\Request::processRequest('Goals.getGoals', array('idSite' => $this->matching_site->getValue()));
     $options = array();
     foreach ($goals as $goal) {
         $options[$goal['idgoal']] = $goal['name'];
     }
     $this->matching_goals = new SystemSetting('matching_goals', 'Goals to start scoring');
     //$this->matching_goals->readableByCurrentUser = true;
     $this->matching_goals->type = static::TYPE_ARRAY;
     $this->matching_goals->uiControlType = static::CONTROL_MULTI_SELECT;
     $this->matching_goals->description = 'Goals that match our visitor.';
     $this->matching_goals->availableValues = array('0' => 'None') + $options;
     $this->addSetting($this->matching_goals);
 }