ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
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  {
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  {
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  {
128  }
129 
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 ?>