Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quiz-3218427
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
quiz-3218427
Commits
a9603981
Commit
a9603981
authored
15 years ago
by
Matt Butcher
Browse files
Options
Downloads
Patches
Plain Diff
Fixed numerous uses of unchecked values.
parent
4dafd0ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
multichoice.module
+8
-6
8 additions, 6 deletions
multichoice.module
with
8 additions
and
6 deletions
multichoice.module
+
8
−
6
View file @
a9603981
...
...
@@ -156,8 +156,10 @@ function multichoice_form(&$node) {
// Quiz ID used here to tie creation of a question to a specific quiz.
$quiz_id
=
arg
(
3
);
if
(
$is_personality
&&
!
isset
(
$quiz_id
)
||
intval
(
$quiz_id
)
==
0
)
{
// We have to actually look up the Quiz because personality tests are linked to ONE SINGLE quiz. Not a great
// Second isset is there b/c of hiccups during node preview.
if
(
$is_personality
&&
isset
(
$node
->
answers
[
0
][
'result_option'
])
&&
(
!
isset
(
$quiz_id
)
||
intval
(
$quiz_id
)
==
0
))
{
// We have to actually look up the Quiz because personality tests are linked to ONE SINGLE quiz. Not a great
// design.
$result
=
db_result
(
db_query
(
"SELECT nid FROM
{
quiz_node_result_options
}
WHERE option_id = %d"
,
$node
->
answers
[
0
][
'result_option'
]));
if
(
$result
)
{
...
...
@@ -304,7 +306,7 @@ function multichoice_form(&$node) {
'#value'
=>
''
,
);
}
if
(
$answers
[
$i
][
'answer_id'
])
{
if
(
!
empty
(
$answers
[
$i
][
'answer_id'
])
)
{
$form
[
'answers'
][
$i
][
'delete'
]
=
array
(
'#type'
=>
'checkbox'
,
'#default_value'
=>
0
,
...
...
@@ -697,7 +699,7 @@ function multichoice_view($node, $teaser = FALSE, $page = FALSE) {
* HTML output.
*/
function
multichoice_render_question_form
(
$context
,
$node
)
{
$quiz
=
menu_get_object
();
// Get the quiz object.
$quiz
=
menu_get_object
();
// Get the quiz object.
// Radio buttons for single selection questions, checkboxes for multiselect.
if
(
$node
->
multiple_answers
==
0
)
{
...
...
@@ -731,7 +733,7 @@ function multichoice_render_question_form($context, $node) {
'#options'
=>
$options
,
);
if
(
empty
(
$_SESSION
[
'quiz_'
.
$quiz
->
nid
]))
{
if
(
empty
(
$quiz
)
||
empty
(
$_SESSION
[
'quiz_'
.
$quiz
->
nid
]))
{
drupal_set_message
(
t
(
'You are viewing a question outside of a quiz. This is not scored.'
),
'status'
);
}
else
{
...
...
@@ -1089,7 +1091,7 @@ function _multichoice_is_personality_question($node) {
* Personality questions are bound (via result_option) to the quiz in which they
* were created. This stands in start contrast to other multichoice questions.
*/
return
(
!
empty
(
$node
->
answers
)
&&
$node
->
answers
[
0
][
'result_option'
]
>
0
);
return
(
!
empty
(
$node
->
answers
)
&&
isset
(
$node
->
answers
[
0
][
'result_option'
])
&&
$node
->
answers
[
0
][
'result_option'
]
>
0
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment