Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quiz-3157376
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-3157376
Commits
0687d561
Commit
0687d561
authored
14 years ago
by
falcon
Browse files
Options
Downloads
Patches
Plain Diff
Fixed missing question types issues
parent
6d81dd8e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
quiz.module
+8
-0
8 additions, 0 deletions
quiz.module
quiz.pages.inc
+1
-0
1 addition, 0 deletions
quiz.pages.inc
with
9 additions
and
0 deletions
quiz.module
+
8
−
0
View file @
0687d561
...
...
@@ -1587,6 +1587,7 @@ function quiz_take_quiz($quiz) {
// Call hook_skip_question().
$module
=
quiz_question_module_for_type
(
$former_question
->
type
);
if
(
!
$module
)
return
array
();
$result
=
module_invoke
(
$module
,
'skip_question'
,
$former_question
,
$_SESSION
[
'quiz_'
.
$quiz
->
nid
][
'result_id'
]);
// Store that the question was skipped:
...
...
@@ -1634,6 +1635,7 @@ function quiz_take_quiz($quiz) {
// Call hook_skip_question().
$module
=
quiz_question_module_for_type
(
$former_question
->
type
);
if
(
!
$module
)
return
array
();
$result
=
module_invoke
(
$module
,
'skip_question'
,
$former_question
,
$_SESSION
[
'quiz_'
.
$quiz
->
nid
][
'result_id'
]);
quiz_store_question_result
(
$quiz
,
$result
,
array
(
'set_mesg'
=>
FALSE
));
...
...
@@ -2195,6 +2197,7 @@ function quiz_calculate_score($quiz, $rid) {
// We don't use module_invoke() because (1) we don't necessarily want to wed
// quiz type to module, and (2) this is more efficient (no NULL checks).
$mod
=
quiz_question_module_for_type
(
$question
->
type
);
if
(
!
$mod
)
continue
;
$function
=
$mod
.
'_quiz_question_score'
;
if
(
function_exists
(
$function
))
{
...
...
@@ -2246,6 +2249,10 @@ function quiz_calculate_score($quiz, $rid) {
*/
function
quiz_question_module_for_type
(
$type
)
{
$types
=
_quiz_get_question_types
();
if
(
!
isset
(
$types
[
$type
]))
{
drupal_set_message
(
t
(
'The module for the questiontype %type is not enabled'
,
array
(
'%type'
=>
$type
)),
'warning'
);
return
FALSE
;
}
return
$types
[
$type
][
'module'
];
}
...
...
@@ -2999,6 +3006,7 @@ function _quiz_get_answers($rid) {
ORDER BY answer_timestamp"
,
$rid
);
while
(
$line
=
db_fetch_object
(
$ids
))
{
$module
=
quiz_question_module_for_type
(
$line
->
type
);
if
(
!
$module
)
continue
;
// Invoke hook_get_report().
$questions
[
$line
->
question_nid
]
=
module_invoke
(
$module
,
'get_report'
,
$line
->
question_nid
,
$line
->
question_vid
,
$rid
);
// Add max score info to the question.
...
...
This diff is collapsed.
Click to expand it.
quiz.pages.inc
+
1
−
0
View file @
0687d561
...
...
@@ -62,6 +62,7 @@ function quiz_report_form($form_state, $questions, $showpoints = TRUE, $showfeed
$show_submit
=
FALSE
;
foreach
(
$questions
as
$question
)
{
$module
=
quiz_question_module_for_type
(
$question
->
type
);
if
(
!
$module
)
return
array
();
$function
=
$module
.
'_report_form'
;
$form_to_add
=
$function
(
$question
,
$showpoints
,
$showfeedback
,
$allow_scoring
);
if
(
isset
(
$form_to_add
[
'submit'
]))
...
...
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