Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
fb12286c
Verified
Commit
fb12286c
authored
4 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #16063 TIME 0:30 Chart + fixes
parent
a6689489
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/home/controllers/TileController.php
+28
-10
28 additions, 10 deletions
src/app/home/controllers/TileController.php
with
28 additions
and
10 deletions
src/app/home/controllers/TileController.php
+
28
−
10
View file @
fb12286c
...
@@ -24,6 +24,7 @@ use Respect\Validation\Validator;
...
@@ -24,6 +24,7 @@ use Respect\Validation\Validator;
use
Slim\Http\Request
;
use
Slim\Http\Request
;
use
Slim\Http\Response
;
use
Slim\Http\Response
;
use
SrcCore\controllers\PreparedClauseController
;
use
SrcCore\controllers\PreparedClauseController
;
use
Status\models\StatusModel
;
use
User\models\UserModel
;
use
User\models\UserModel
;
class
TileController
class
TileController
...
@@ -214,9 +215,13 @@ class TileController
...
@@ -214,9 +215,13 @@ class TileController
}
elseif
(
!
Validator
::
intVal
()
->
validate
(
$args
[
'parameters'
][
'groupId'
]
??
null
))
{
}
elseif
(
!
Validator
::
intVal
()
->
validate
(
$args
[
'parameters'
][
'groupId'
]
??
null
))
{
return
[
'errors'
=>
'Body[parameters] groupId is empty or not an integer'
];
return
[
'errors'
=>
'Body[parameters] groupId is empty or not an integer'
];
}
}
if
(
!
BasketModel
::
hasGroup
([
'id'
=>
$args
[
'parameters'
][
'basketId'
],
'groupId'
=>
$args
[
'parameters'
][
'groupId'
]]))
{
$basket
=
BasketModel
::
getById
([
'select'
=>
[
'basket_id'
],
'id'
=>
$args
[
'parameters'
][
'basketId'
]]);
$group
=
GroupModel
::
getById
([
'select'
=>
[
'group_id'
],
'id'
=>
$args
[
'parameters'
][
'groupId'
]]);
if
(
empty
(
$basket
)
||
empty
(
$group
))
{
return
[
'errors'
=>
'Basket or group do not exist'
];
}
elseif
(
!
BasketModel
::
hasGroup
([
'id'
=>
$basket
[
'basket_id'
],
'groupId'
=>
$group
[
'group_id'
]]))
{
return
[
'errors'
=>
'Basket is not linked to this group'
];
return
[
'errors'
=>
'Basket is not linked to this group'
];
}
elseif
(
!
UserModel
::
hasGroup
([
'id'
=>
$GLOBALS
[
'id'
],
'groupId'
=>
$
args
[
'parameters'
]
[
'group
I
d'
]]))
{
}
elseif
(
!
UserModel
::
hasGroup
([
'id'
=>
$GLOBALS
[
'id'
],
'groupId'
=>
$
group
[
'group
_i
d'
]]))
{
return
[
'errors'
=>
'User is not linked to this group'
];
return
[
'errors'
=>
'User is not linked to this group'
];
}
}
}
}
...
@@ -227,14 +232,14 @@ class TileController
...
@@ -227,14 +232,14 @@ class TileController
private
static
function
getDetails
(
array
&
$tile
)
private
static
function
getDetails
(
array
&
$tile
)
{
{
if
(
$tile
[
'type'
]
==
'basket'
)
{
if
(
$tile
[
'type'
]
==
'basket'
)
{
if
(
!
BasketModel
::
hasGroup
([
'id'
=>
$tile
[
'parameters'
][
'basketId'
],
'groupId'
=>
$tile
[
'parameters'
][
'groupId'
]]))
{
$basket
=
BasketModel
::
getById
([
'select'
=>
[
'basket_clause'
,
'basket_name'
,
'basket_id'
],
'id'
=>
$tile
[
'parameters'
][
'basketId'
]]);
$group
=
GroupModel
::
getById
([
'select'
=>
[
'group_desc'
,
'group_id'
],
'id'
=>
$tile
[
'parameters'
][
'groupId'
]]);
if
(
!
BasketModel
::
hasGroup
([
'id'
=>
$basket
[
'basket_id'
],
'groupId'
=>
$group
[
'group_id'
]]))
{
return
[
'errors'
=>
'Basket is not linked to this group'
];
return
[
'errors'
=>
'Basket is not linked to this group'
];
}
elseif
(
!
UserModel
::
hasGroup
([
'id'
=>
$GLOBALS
[
'id'
],
'groupId'
=>
$
tile
[
'parameters'
]
[
'group
I
d'
]]))
{
}
elseif
(
!
UserModel
::
hasGroup
([
'id'
=>
$GLOBALS
[
'id'
],
'groupId'
=>
$
group
[
'group
_i
d'
]]))
{
return
[
'errors'
=>
'User is not linked to this group'
];
return
[
'errors'
=>
'User is not linked to this group'
];
}
}
$basket
=
BasketModel
::
getById
([
'select'
=>
[
'basket_clause'
,
'basket_name'
],
'id'
=>
$tile
[
'parameters'
][
'basketId'
]]);
$group
=
GroupModel
::
getById
([
'select'
=>
[
'group_desc'
],
'id'
=>
$tile
[
'parameters'
][
'groupId'
]]);
$tile
[
'basketName'
]
=
$basket
[
'basket_name'
];
$tile
[
'basketName'
]
=
$basket
[
'basket_name'
];
$tile
[
'groupName'
]
=
$group
[
'group_desc'
];
$tile
[
'groupName'
]
=
$group
[
'group_desc'
];
if
(
$tile
[
'view'
]
==
'resume'
)
{
if
(
$tile
[
'view'
]
==
'resume'
)
{
...
@@ -242,15 +247,28 @@ class TileController
...
@@ -242,15 +247,28 @@ class TileController
}
elseif
(
$tile
[
'view'
]
==
'list'
)
{
}
elseif
(
$tile
[
'view'
]
==
'list'
)
{
//TODO WIP
//TODO WIP
}
elseif
(
$tile
[
'view'
]
==
'chart'
)
{
}
elseif
(
$tile
[
'view'
]
==
'chart'
)
{
if
(
!
empty
(
$tile
[
'parameters'
][
'chartMode'
])
&&
$tile
[
'parameters'
][
'chartMode'
]
==
'status'
)
{
$type
=
'status'
;
}
else
{
$type
=
'type_id'
;
}
$resources
=
ResModel
::
getOnView
([
$resources
=
ResModel
::
getOnView
([
'select'
=>
[
'
COUNT(type
_id)'
],
'select'
=>
[
"
COUNT(
{
$
type
}
),
{
$type
}
"
],
'where'
=>
[
PreparedClauseController
::
getPreparedClause
([
'userId'
=>
$GLOBALS
[
'id'
],
'clause'
=>
$basket
[
'basket_clause'
]])],
'where'
=>
[
PreparedClauseController
::
getPreparedClause
([
'userId'
=>
$GLOBALS
[
'id'
],
'clause'
=>
$basket
[
'basket_clause'
]])],
'groupBy'
=>
[
'
type
_id'
]
'groupBy'
=>
[
$
type
]
]);
]);
$tile
[
'resources'
]
=
[];
$tile
[
'resources'
]
=
[];
foreach
(
$resources
as
$resource
)
{
foreach
(
$resources
as
$resource
)
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$resource
[
'type_id'
]]);
if
(
$type
==
'status'
)
{
$tile
[
'resources'
][]
=
[
'name'
=>
$doctype
[
'description'
],
'value'
=>
$resource
[
'count'
]];
$status
[
'label_status'
]
=
null
;
if
(
!
empty
(
$resource
[
'status'
]))
{
$status
=
StatusModel
::
getById
([
'select'
=>
[
'label_status'
],
'id'
=>
$resource
[
'status'
]]);
}
$tile
[
'resources'
][]
=
[
'name'
=>
$status
[
'label_status'
],
'value'
=>
$resource
[
'count'
]];
}
else
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$resource
[
'type_id'
]]);
$tile
[
'resources'
][]
=
[
'name'
=>
$doctype
[
'description'
],
'value'
=>
$resource
[
'count'
]];
}
}
}
}
}
}
}
...
...
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