| 1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Form for adding a file instance.
|
|
|
19 |
*
|
|
|
20 |
* @copyright 2012 Sam Hemelryk
|
|
|
21 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
22 |
*/
|
|
|
23 |
class cachestore_file_addinstance_form extends cachestore_addinstance_form {
|
|
|
24 |
|
|
|
25 |
/**
|
|
|
26 |
* Adds the desired form elements.
|
|
|
27 |
*/
|
|
|
28 |
protected function configuration_definition() {
|
|
|
29 |
$form = $this->_form;
|
|
|
30 |
|
|
|
31 |
$form->addElement('text', 'path', get_string('path', 'cachestore_file'));
|
|
|
32 |
$form->setType('path', PARAM_RAW);
|
|
|
33 |
$form->addHelpButton('path', 'path', 'cachestore_file');
|
|
|
34 |
|
|
|
35 |
$form->addElement('checkbox', 'autocreate', get_string('autocreate', 'cachestore_file'));
|
|
|
36 |
$form->setType('autocreate', PARAM_BOOL);
|
|
|
37 |
$form->addHelpButton('autocreate', 'autocreate', 'cachestore_file');
|
|
|
38 |
$form->disabledIf('autocreate', 'path', 'eq', '');
|
|
|
39 |
|
|
|
40 |
$form->addElement('checkbox', 'singledirectory', get_string('singledirectory', 'cachestore_file'));
|
|
|
41 |
$form->setType('singledirectory', PARAM_BOOL);
|
|
|
42 |
$form->addHelpButton('singledirectory', 'singledirectory', 'cachestore_file');
|
|
|
43 |
|
|
|
44 |
$form->addElement('checkbox', 'prescan', get_string('prescan', 'cachestore_file'));
|
|
|
45 |
$form->setType('prescan', PARAM_BOOL);
|
|
|
46 |
$form->addHelpButton('prescan', 'prescan', 'cachestore_file');
|
|
|
47 |
|
|
|
48 |
$form->addElement('checkbox', 'asyncpurge', get_string('asyncpurge', 'cachestore_file'));
|
|
|
49 |
$form->setType('asyncpurge', PARAM_BOOL);
|
|
|
50 |
$form->addHelpButton('asyncpurge', 'asyncpurge', 'cachestore_file');
|
|
|
51 |
|
|
|
52 |
$form->addElement('text', 'lockwait', get_string('lockwait', 'cachestore_file'));
|
|
|
53 |
$form->setDefault('lockwait', 60);
|
|
|
54 |
$form->setType('lockwait', PARAM_INT);
|
|
|
55 |
$form->addHelpButton('lockwait', 'lockwait', 'cachestore_file');
|
| 1441 |
ariadna |
56 |
|
|
|
57 |
$serializeroptions = cachestore_file::config_get_serializer_options();
|
|
|
58 |
$form->addElement('select', 'serializer', get_string('useserializer', 'cachestore_file'), $serializeroptions);
|
|
|
59 |
$form->setDefault('serializer', cachestore_file::SERIALIZER_PHP);
|
|
|
60 |
$form->setType('serializer', PARAM_ALPHA);
|
|
|
61 |
$form->addHelpButton('serializer', 'useserializer', 'cachestore_file');
|
| 1 |
efrain |
62 |
}
|
| 1441 |
ariadna |
63 |
}
|