ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilFileUploadSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
16 {
19 
24  private static $instance = null;
25 
30  private $settings = null;
31 
36  private $dndUploadEnabled = true;
37 
43 
48  private $concurrentUploads = self::CONCURRENT_UPLOADS_DEFAULT;
49 
53  private function __construct()
54  {
55  $this->settings = new ilSetting("fileupload");
56  $this->dndUploadEnabled = $this->settings->get("dnd_upload_enabled", true) == true;
57  $this->repositoryDndUploadEnabled = $this->settings->get("repository_dnd_upload_enabled", true) == true;
58  $this->concurrentUploads = $this->settings->get("concurrent_upload_count", self::CONCURRENT_UPLOADS_DEFAULT);
59  }
60 
67  public static function setDragAndDropUploadEnabled($newValue)
68  {
69  $instance = self::getInstance();
70  $instance->dndUploadEnabled = $newValue == true;
71  $instance->settings->set("dnd_upload_enabled", $instance->dndUploadEnabled);
72  }
73 
79  public static function isDragAndDropUploadEnabled()
80  {
81  return self::getInstance()->dndUploadEnabled;
82  }
83 
90  public static function setRepositoryDragAndDropUploadEnabled($newValue)
91  {
92  $instance = self::getInstance();
93  $instance->repositoryDndUploadEnabled = $newValue == true;
94  $instance->settings->set("repository_dnd_upload_enabled", $instance->repositoryDndUploadEnabled);
95  }
96 
102  public static function isRepositoryDragAndDropUploadEnabled()
103  {
104  return self::getInstance()->repositoryDndUploadEnabled;
105  }
106 
113  public static function setConcurrentUploads($newValue)
114  {
115  // is number?
116  if (is_numeric($newValue))
117  {
118  // don't allow to large numbers
119  $newValue = (int)$newValue;
120  if ($newValue < 1)
121  $newValue = 1;
122  else if ($newValue > self::CONCURRENT_UPLOADS_MAX)
123  $newValue = self::CONCURRENT_UPLOADS_MAX;
124  }
125  else
126  {
127  $newValue = self::CONCURRENT_UPLOADS_DEFAULT;
128  }
129 
130  $instance = self::getInstance();
131  $instance->concurrentUploads = $newValue;
132  $instance->settings->set("concurrent_upload_count", $instance->concurrentUploads);
133  }
134 
140  public static function getConcurrentUploads()
141  {
142  return self::getInstance()->concurrentUploads;
143  }
144 
149  private static function getInstance()
150  {
151  if (self::$instance == null)
152  self::$instance = new ilFileUploadSettings();
153 
154  return self::$instance;
155  }
156 }
157 ?>
ILIAS Setting Class.
static setDragAndDropUploadEnabled($newValue)
Sets whether drag and drop file upload is enabled.
static setRepositoryDragAndDropUploadEnabled($newValue)
Sets whether drag and drop file upload in the repository is enabled.
static getConcurrentUploads()
Gets the number of files that can be uploaded at the same time.
static setConcurrentUploads($newValue)
Sets the number of files that can be uploaded at the same time.
static getInstance()
Gets the instance of the ilFileUploadSettings.
static isRepositoryDragAndDropUploadEnabled()
Gets whether drag and drop file upload in the repository is enabled.
__construct()
Private constructor.
settings()
Definition: settings.php:2
static isDragAndDropUploadEnabled()
Gets whether drag and drop file upload is enabled.