Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
32db0d42
Commit
32db0d42
authored
Jan 12, 2007
by
skodak
Browse files
MDL-8166 some forgotten set_defaults converted to set_data
parent
6b65a111
Changes
15
Hide whitespace changes
Inline
Side-by-side
course/import/activities/import_form.php
View file @
32db0d42
...
...
@@ -12,7 +12,7 @@ class course_import_activities_form_1 extends moodleform {
$options
=
$this
->
_customdata
[
'options'
];
$courseid
=
$this
->
_customdata
[
'courseid'
];
$mform
->
addElement
(
'header'
,
'general'
,
''
);
//fill in the data depending on page params
//later using set_d
efaults
//later using set_d
ata
$mform
->
addElement
(
'select'
,
'fromcourse'
,
$text
,
$options
);
// buttons
...
...
@@ -40,7 +40,7 @@ class course_import_activities_form_2 extends moodleform {
$courseid
=
$this
->
_customdata
[
'courseid'
];
$mform
->
addElement
(
'header'
,
'general'
,
''
);
//fill in the data depending on page params
//later using set_d
efaults
//later using set_d
ata
$mform
->
addElement
(
'text'
,
'fromcoursesearch'
,
get_string
(
'searchcourses'
));
// buttons
...
...
course/import/groups/import_form.php
View file @
32db0d42
...
...
@@ -15,7 +15,7 @@ class course_import_groups_form extends moodleform {
//$this->set_max_file_size('', $maxuploadsize);
$mform
->
addElement
(
'header'
,
'general'
,
''
);
//fill in the data depending on page params
//later using set_d
efaults
//later using set_d
ata
// buttons
$mform
->
addElement
(
'hidden'
,
'sesskey'
);
...
...
course/moodleform_mod.php
View file @
32db0d42
...
...
@@ -51,12 +51,12 @@ class moodleform_mod extends moodleform {
*
* @param mixed $default_values object or array of default values
*/
function
set_d
efaults
(
$default_values
)
{
function
set_d
ata
(
$default_values
)
{
if
(
is_object
(
$default_values
))
{
$default_values
=
(
array
)
$default_values
;
}
$this
->
defaults_preprocessing
(
$default_values
);
parent
::
set_d
efaults
(
$default_values
+
$this
->
standard_coursemodule_elements_settings
());
//never slashed for moodleform_mod
parent
::
set_d
ata
(
$default_values
+
$this
->
standard_coursemodule_elements_settings
());
//never slashed for moodleform_mod
}
/**
* Adds all the standard elements to a form to edit the settings for an activity module.
...
...
mod/forum/post_form.php
View file @
32db0d42
...
...
@@ -20,7 +20,7 @@ class mod_forum_post_form extends moodleform {
$this
->
set_upload_manager
(
new
upload_manager
(
'attachment'
,
true
,
false
,
$course
,
false
,
$forum
->
maxbytes
,
true
,
true
));
$mform
->
addElement
(
'header'
,
'general'
,
''
);
//fill in the data depending on page params
//later using set_d
efaults
//later using set_d
ata
$mform
->
addElement
(
'text'
,
'subject'
,
get_string
(
'subject'
,
'forum'
),
'size="64"'
);
$mform
->
setType
(
'subject'
,
PARAM_TEXT
);
$mform
->
addRule
(
'subject'
,
get_string
(
'required'
),
'required'
,
null
,
'client'
);
...
...
question/type/calculated/edit_calculated_form.php
View file @
32db0d42
...
...
@@ -124,7 +124,7 @@ class question_edit_calculated_form extends question_edit_form {
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
isset
(
$question
->
options
)){
$answers
=
$question
->
options
->
answers
;
if
(
count
(
$answers
))
{
...
...
@@ -156,7 +156,7 @@ class question_edit_calculated_form extends question_edit_form {
$question
=
(
object
)((
array
)
$question
+
$default_values
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
qtype
()
{
...
...
question/type/edit_question_form.php
View file @
32db0d42
...
...
@@ -18,7 +18,7 @@ class question_edit_form extends moodleform {
/**
* Question object with options and answers already loaded by get_question_options
* Be careful how you use this it is needed sometimes to set up the structure of the
* form in definition_inner but data is always loaded into the form with set_d
efaults
.
* form in definition_inner but data is always loaded into the form with set_d
ata
.
*
* @var object
*/
...
...
@@ -127,13 +127,13 @@ class question_edit_form extends moodleform {
// By default, do nothing.
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
global
$QTYPES
;
$QTYPES
[
$question
->
qtype
]
->
set_default_options
(
$question
);
if
(
empty
(
$question
->
image
)){
unset
(
$question
->
image
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
/**
...
...
question/type/essay/edit_essay_form.php
View file @
32db0d42
...
...
@@ -24,11 +24,11 @@ class question_edit_essay_form extends question_edit_form {
$mform
->
addElement
(
'hidden'
,
'fraction'
,
0
);
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
isset
(
$question
->
options
)){
$question
->
feedback
=
$question
->
options
->
answer
->
feedback
;
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
qtype
()
{
...
...
question/type/match/edit_match_form.php
View file @
32db0d42
...
...
@@ -45,7 +45,7 @@ class question_edit_match_form extends question_edit_form {
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
isset
(
$question
->
options
)){
$subquestions
=
$question
->
options
->
subquestions
;
if
(
count
(
$subquestions
))
{
...
...
@@ -59,7 +59,7 @@ class question_edit_match_form extends question_edit_form {
$default_values
[
'shuffleanswers'
]
=
$question
->
options
->
shuffleanswers
;
$question
=
(
object
)((
array
)
$question
+
$default_values
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
qtype
()
{
...
...
question/type/multianswer/edit_multianswer_form.php
View file @
32db0d42
...
...
@@ -15,7 +15,7 @@ class question_edit_multianswer_form extends question_edit_form {
// No question-type specific form fields.
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
$question
->
questiontext
and
$question
->
id
and
$question
->
qtype
)
{
foreach
(
$question
->
options
->
questions
as
$key
=>
$wrapped
)
{
...
...
question/type/multichoice/edit_multichoice_form.php
View file @
32db0d42
...
...
@@ -62,7 +62,7 @@ class question_edit_multichoice_form extends question_edit_form {
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
isset
(
$question
->
options
)){
$answers
=
$question
->
options
->
answers
;
if
(
count
(
$answers
))
{
...
...
@@ -81,7 +81,7 @@ class question_edit_multichoice_form extends question_edit_form {
$default_values
[
'incorrectfeedback'
]
=
$question
->
options
->
incorrectfeedback
;
$question
=
(
object
)((
array
)
$question
+
$default_values
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
qtype
()
{
...
...
question/type/numerical/edit_numerical_form.php
View file @
32db0d42
...
...
@@ -74,7 +74,7 @@ class question_edit_numerical_form extends question_edit_form {
$firstunit
->
setPersistantFreeze
(
true
);
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
isset
(
$question
->
options
)){
$answers
=
$question
->
options
->
answers
;
if
(
count
(
$answers
))
{
...
...
@@ -102,7 +102,7 @@ class question_edit_numerical_form extends question_edit_form {
}
$question
=
(
object
)((
array
)
$question
+
$default_values
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
validation
(
$data
){
$errors
=
array
();
...
...
question/type/random/edit_random_form.php
View file @
32db0d42
...
...
@@ -64,11 +64,11 @@ class question_edit_random_form extends question_edit_form {
$mform
->
closeHeaderBefore
(
'buttonar'
);
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
empty
(
$question
->
name
))
{
$question
->
name
=
get_string
(
"random"
,
"quiz"
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
qtype
()
{
...
...
question/type/randomsamatch/edit_randomsamatch_form.php
View file @
32db0d42
...
...
@@ -31,7 +31,7 @@ class question_edit_randomsamatch_form extends question_edit_form {
$mform
->
addElement
(
'hidden'
,
'fraction'
,
0
);
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
empty
(
$question
->
name
))
{
$question
->
name
=
get_string
(
"randomsamatch"
,
"quiz"
);
}
...
...
@@ -39,7 +39,7 @@ class question_edit_randomsamatch_form extends question_edit_form {
if
(
empty
(
$question
->
questiontext
))
{
$question
->
questiontext
=
get_string
(
"randomsamatchintro"
,
"quiz"
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
qtype
()
{
...
...
question/type/shortanswer/edit_shortanswer_form.php
View file @
32db0d42
...
...
@@ -46,7 +46,7 @@ class question_edit_shortanswer_form extends question_edit_form {
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
isset
(
$question
->
options
)){
$answers
=
$question
->
options
->
answers
;
if
(
count
(
$answers
))
{
...
...
@@ -61,7 +61,7 @@ class question_edit_shortanswer_form extends question_edit_form {
$default_values
[
'usecase'
]
=
$question
->
options
->
usecase
;
$question
=
(
object
)((
array
)
$question
+
$default_values
);
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
validation
(
$data
){
$errors
=
array
();
...
...
question/type/truefalse/edit_truefalse_form.php
View file @
32db0d42
...
...
@@ -29,14 +29,14 @@ class question_edit_truefalse_form extends question_edit_form {
$mform
->
setType
(
'feedbackfalse'
,
PARAM_RAW
);
}
function
set_d
efaults
(
$question
)
{
function
set_d
ata
(
$question
)
{
if
(
!
empty
(
$question
->
options
->
trueanswer
))
{
$trueanswer
=
$question
->
options
->
answers
[
$question
->
options
->
trueanswer
];
$question
->
correctanswer
=
(
$trueanswer
->
fraction
!=
0
);
$question
->
feedbacktrue
=
$trueanswer
->
feedback
;
$question
->
feedbackfalse
=
$question
->
options
->
answers
[
$question
->
options
->
falseanswer
]
->
feedback
;
}
parent
::
set_d
efaults
(
$question
);
parent
::
set_d
ata
(
$question
);
}
function
qtype
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment