Пример #1
0
 /**
  * Constructor.
  *
  * @param string $name The persisted name of the setting.
  * @param mixed $defaultValue  Default value for this setting if no value was specified.
  * @param string $type Eg an array, int, ... see TYPE_* constants
  * @param string $pluginName The name of the plugin the setting belongs to
  * @param int $idSite The idSite this setting belongs to.
  */
 public function __construct($name, $defaultValue, $type, $pluginName, $idSite)
 {
     parent::__construct($name, $defaultValue, $type, $pluginName);
     $this->idSite = $idSite;
     $storageFactory = StaticContainer::get('Piwik\\Settings\\Storage\\Factory');
     $this->storage = $storageFactory->getMeasurableSettingsStorage($idSite, $this->pluginName);
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param string $name The setting's persisted name.
  * @param string $title The setting's display name.
  * @param null|string $userLogin The user this setting applies to. Will default to the current user login.
  */
 public function __construct($name, $title, $userLogin = null)
 {
     parent::__construct($name, $title);
     $this->setUserLogin($userLogin);
     $this->writableByCurrentUser = Piwik::isUserHasSomeViewAccess();
     $this->readableByCurrentUser = Piwik::isUserHasSomeViewAccess();
 }
Пример #3
0
 /**
  * Constructor.
  *
  * @param string $name The setting's persisted name.
  * @param mixed $defaultValue  Default value for this setting if no value was specified.
  * @param string $type Eg an array, int, ... see TYPE_* constants
  * @param string $pluginName The name of the plugin the setting belongs to
  * @param string $userLogin The name of the user the value should be set or get for
  * @throws Exception
  */
 public function __construct($name, $defaultValue, $type, $pluginName, $userLogin)
 {
     parent::__construct($name, $defaultValue, $type, $pluginName);
     if (empty($userLogin)) {
         throw new Exception('No userLogin given to create setting ' . $name);
     }
     $this->userLogin = $userLogin;
     $factory = StaticContainer::get('Piwik\\Settings\\Storage\\Factory');
     $this->storage = $factory->getPluginStorage($this->pluginName, $this->userLogin);
 }
Пример #4
0
 /**
  * Constructor.
  *
  * @param string $name The persisted name of the setting.
  * @param mixed $defaultValue  Default value for this setting if no value was specified.
  * @param string $type Eg an array, int, ... see TYPE_* constants
  * @param string $pluginName The name of the plugin the setting belongs to.
  * @param int $idSite The idSite this property belongs to.
  * @throws Exception
  */
 public function __construct($name, $defaultValue, $type, $pluginName, $idSite)
 {
     if (!in_array($name, $this->allowedNames)) {
         throw new Exception(sprintf('Name "%s" is not allowed to be used with a MeasurableProperty, use a MeasurableSetting instead.', $name));
     }
     parent::__construct($name, $defaultValue, $type, $pluginName);
     $this->idSite = $idSite;
     $storageFactory = StaticContainer::get('Piwik\\Settings\\Storage\\Factory');
     $this->storage = $storageFactory->getSitesTable($idSite);
 }
Пример #5
0
 /**
  * Constructor.
  * 
  * @param string $name The persisted name of the setting.
  * @param string $title The display name of the setting.
  */
 public function __construct($name, $title)
 {
     parent::__construct($name, $title);
     $this->writableByCurrentUser = Piwik::hasUserSuperUserAccess();
     $this->readableByCurrentUser = $this->writableByCurrentUser;
 }
Пример #6
0
 /**
  * Constructor.
  *
  * @param string $name The setting's persisted name.
  * @param mixed $defaultValue  Default value for this setting if no value was specified.
  * @param string $type Eg an array, int, ... see TYPE_* constants
  * @param string $pluginName The name of the plugin the system setting belongs to.
  */
 public function __construct($name, $defaultValue, $type, $pluginName, $configSectionName)
 {
     parent::__construct($name, $defaultValue, $type, $pluginName);
     $factory = StaticContainer::get('Piwik\\Settings\\Storage\\Factory');
     $this->storage = $factory->getConfigStorage($configSectionName);
 }
Пример #7
0
 /**
  * Constructor.
  *
  * @param string $name The persisted name of the setting.
  * @param string $title The display name of the setting.
  */
 public function __construct($name, $title)
 {
     parent::__construct($name, $title);
     $this->writableByCurrentUser = Piwik::isUserHasSomeAdminAccess();
     $this->readableByCurrentUser = Piwik::isUserHasSomeViewAccess();
 }
Пример #8
0
 /**
  * Constructor.
  * 
  * @param string $name The setting's persisted name.
  * @param string $title The setting's display name.
  * @param null|string $userLogin The user this setting applies to. Will default to the current user login.
  */
 public function __construct($name, $title, $userLogin = null)
 {
     parent::__construct($name, $title);
     $this->setUserLogin($userLogin);
     $this->displayedForCurrentUser = Piwik::isUserHasSomeViewAccess();
 }
Пример #9
0
 /**
  * Constructor.
  * 
  * @param string $name The persisted name of the setting.
  * @param string $title The display name of the setting.
  */
 public function __construct($name, $title)
 {
     parent::__construct($name, $title);
     $this->displayedForCurrentUser = Piwik::isUserIsSuperUser();
 }
Пример #10
0
 /**
  * Constructor.
  *
  * @param string $name The setting's persisted name.
  * @param string $title The setting's display name.
  * @param null|string $userLogin The user this setting applies to. Will default to the current user login.
  */
 public function __construct($name, $title, $userLogin = null)
 {
     parent::__construct($name, $title);
     $this->setUserLogin($userLogin);
 }