Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
archery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
archery
Commits
9cd85a0c
Commit
9cd85a0c
authored
Oct 10, 2014
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Progress graph now handles default discipline properly
parent
d6f6c9c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
routes/user.php
routes/user.php
+13
-9
No files found.
routes/user.php
View file @
9cd85a0c
...
...
@@ -27,7 +27,7 @@ $app->delete('/user/:id', function ($id) {
echo
"delete user
$id
"
;
});
function
plot_filter_form
(
$dbuser
,
$matches
)
{
function
plot_filter_form
(
$dbuser
,
$matches
,
$default_discipline
)
{
global
$db
;
$disciplines
=
array
(
'barebow'
,
'recurve'
,
'compound'
);
...
...
@@ -61,15 +61,9 @@ function plot_filter_form($dbuser, $matches) {
->
setPrompt
(
_
(
'Select a distance'
));
$form
->
addRadioList
(
'discipline'
,
_
(
'Discipline'
),
$disciplines
)
->
setAttribute
(
'data-inline'
,
true
)
->
set
Required
(
);
->
set
DefaultValue
(
$default_discipline
);
$form
->
addSubmit
(
'send'
,
_
(
'Filter'
));
if
(
$matches
->
count
())
{
$last_match
=
$matches
->
fetch
();
$form
[
'discipline'
]
->
setDefaultValue
(
$last_match
->
discipline
);
$matches
->
rewind
();
}
return
$form
;
}
...
...
@@ -81,7 +75,15 @@ $app->get('/user/:id/plot', function ($id) use ($app, $db, $user) {
->
where
(
array
(
'user_id'
=>
$id
))
->
order
(
'created_at DESC'
);
$form
=
plot_filter_form
(
$dbuser
,
$matches
);
if
(
$matches
->
count
())
{
$last_match
=
$matches
->
fetch
();
$default_discipline
=
$last_match
->
discipline
;
$matches
->
rewind
();
}
else
{
$default_discipline
=
'recurve'
;
}
$form
=
plot_filter_form
(
$dbuser
,
$matches
,
$default_discipline
);
if
(
$form
->
isSubmitted
())
{
$v
=
$form
->
getValues
();
...
...
@@ -106,6 +108,8 @@ $app->get('/user/:id/plot', function ($id) use ($app, $db, $user) {
if
(
$v
->
discipline
)
$matches
->
where
(
'discipline'
,
$v
->
discipline
);
}
else
{
$matches
->
where
(
'discipline'
,
$default_discipline
);
}
$app
->
render
(
'user/plot'
,
compact
(
'dbuser'
,
'form'
,
'matches'
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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