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
1dc85617
Commit
1dc85617
authored
15 years ago
by
Sam Boyer
Browse files
Options
Downloads
Patches
Plain Diff
Filled out the filter so it actually does something. Not optimal maybe, but it works.
Still needs UI love.
parent
e76c063d
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
includes/views/handlers/quiz_views_handler_filter_user_quiz_state.inc
+32
-0
32 additions, 0 deletions
...ws/handlers/quiz_views_handler_filter_user_quiz_state.inc
with
32 additions
and
0 deletions
includes/views/handlers/quiz_views_handler_filter_user_quiz_state.inc
+
32
−
0
View file @
1dc85617
...
...
@@ -3,4 +3,36 @@
class
quiz_views_handler_filter_user_quiz_state
extends
views_handler_filter
{
function
options_definition
()
{
$options
=
parent
::
option_definition
();
$options
[
'quiz_state'
]
=
array
(
'default'
=>
'finished'
);
return
$options
;
}
function
options_form
(
&
$form
,
&
$form_state
)
{
$form
[
'quiz_state'
]
=
array
(
'#type'
=>
'radios'
,
'#description'
=>
t
(
'The final result set will only include quiz results in the state you select here.'
),
'#title'
=>
t
(
'Quiz State'
),
'#options'
=>
array
(
'not_started'
=>
t
(
'Not Started'
),
'in_progress'
=>
t
(
'In Progress'
),
'finished'
=>
t
(
'Finished'
),
),
'#default_value'
=>
$this
->
options
[
'quiz_state'
],
);
}
function
query
()
{
$this
->
ensure_my_table
();
if
(
$this
->
options
[
'quiz_state'
]
==
'not_started'
)
{
$this
->
query
->
add_where
(
0
,
"
$this->table_alias
.time_end IS NULL"
);
}
else
{
// $field = $this->query->add_field($table_alias, "time_end");
$operator
=
$this
->
options
[
'quiz_state'
]
==
'in_progress'
?
'='
:
'>'
;
// $this->query->add_where(0, "$table_alias.$field $operator 0");
$this
->
query
->
add_where
(
0
,
"
$this->table_alias
.time_end
$operator
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