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
87831813
Commit
87831813
authored
15 years ago
by
Sivaji Ganesh Jojodae
Browse files
Options
Downloads
Patches
Plain Diff
patch
#443482
fixed by sivaji: hook_cron to remove incomplete quiz results
parent
8e7c6874
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.admin.inc
+19
-2
19 additions, 2 deletions
quiz.admin.inc
quiz.module
+12
-1
12 additions, 1 deletion
quiz.module
with
31 additions
and
3 deletions
quiz.admin.inc
+
19
−
2
View file @
87831813
...
...
@@ -551,7 +551,13 @@ function quiz_admin_settings() {
'#description'
=>
t
(
'Filter the actions dropdown by a specific type.'
),
);
$form
[
'quiz_remove_partial_quiz_record'
]
=
array
(
'#type'
=>
'select'
,
'#title'
=>
t
(
'Remove Incomplete Quiz Records (older than)'
),
'#options'
=>
quiz_remove_partial_quiz_record_value
(),
'#description'
=>
t
(
'Number of days that you like to keep the incomplete quiz records'
),
);
$form
[
'quiz_look_feel'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'Look and Feel Settings'
),
...
...
@@ -785,4 +791,15 @@ function theme_question_selection_table($form) {
$table
=
theme
(
'table'
,
$headers
,
$rows
,
array
(
'id'
=>
'questions-order-'
.
$table_counter
));
return
$table
.
drupal_render
(
$form
);
}
\ No newline at end of file
function
quiz_remove_partial_quiz_record_value
()
{
$list
=
array
();
$list
[
0
]
=
t
(
'Never'
);
for
(
$i
=
1
;
$i
<
31
;
$i
++
)
{
$list
[
$i
*
86400
]
=
$i
.
' '
.
t
(
'Day(s)'
);
}
for
(
$i
=
35
;
$i
<
125
;
$i
+=
5
)
{
$list
[
$i
*
86400
]
=
$i
.
' '
.
t
(
'Day(s)'
);
}
return
$list
;
}
This diff is collapsed.
Click to expand it.
quiz.module
+
12
−
1
View file @
87831813
...
...
@@ -192,7 +192,7 @@ function quiz_menu() {
$items
[
'admin/quiz/%/view'
]
=
array
(
'title'
=>
t
(
'View @quiz'
,
array
(
'@quiz'
=>
QUIZ_NAME
)),
'page callback'
=>
'quiz_admin'
,
'page arguments'
=>
array
(
2
),
'page arguments'
=>
array
(
2
),
'access arguments'
=>
array
(
'administer quiz'
),
'type'
=>
MENU_CALLBACK
,
'file'
=>
'quiz.admin.inc'
,
...
...
@@ -2556,3 +2556,14 @@ function quiz_action_options($type = 'all') {
return
$options
[
$type
];
}
}
/*
* Implementation of hook_cron()
*/
function
quiz_cron
()
{
$rm_time
=
variable_get
(
'quiz_remove_partial_quiz_record'
,
'0'
);
if
(
$rm_time
)
{
// $time = 0 for never
db_query
(
'DELETE FROM {quiz_node_results} WHERE !time_end AND (%d - time_start) > %d'
,
time
(),
$rm_time
);
}
}
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