ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
103 {
104 return self::getInstance()->repositoryDndUploadEnabled;
105 }
106
113 public static function setConcurrentUploads($newValue)
114 {
115 // is number?
116 if (is_numeric($newValue)) {
117 // don't allow to large numbers
118 $newValue = (int) $newValue;
119 if ($newValue < 1) {
120 $newValue = 1;
121 } elseif ($newValue > self::CONCURRENT_UPLOADS_MAX) {
123 }
124 } else {
126 }
127
129 $instance->concurrentUploads = $newValue;
130 $instance->settings->set("concurrent_upload_count", $instance->concurrentUploads);
131 }
132
138 public static function getConcurrentUploads()
139 {
140 return self::getInstance()->concurrentUploads;
141 }
142
147 private static function getInstance()
148 {
149 if (self::$instance == null) {
150 self::$instance = new ilFileUploadSettings();
151 }
152
153 return self::$instance;
154 }
155}
An exception for terminatinating execution or to throw for unit testing.
static getInstance()
Gets the instance of the ilFileUploadSettings.
static setRepositoryDragAndDropUploadEnabled($newValue)
Sets whether drag and drop file upload in the repository is enabled.
static isRepositoryDragAndDropUploadEnabled()
Gets whether drag and drop file upload in the repository is enabled.
static isDragAndDropUploadEnabled()
Gets whether drag and drop file upload is enabled.
static setConcurrentUploads($newValue)
Sets the number of files that can be uploaded at the same time.
static setDragAndDropUploadEnabled($newValue)
Sets whether drag and drop file upload is enabled.
static getConcurrentUploads()
Gets the number of files that can be uploaded at the same time.
__construct()
Private constructor.
ILIAS Setting Class.
settings()
Definition: settings.php:2