Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Stundenzettel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Uni Osnabrück
Plugins
Stundenzettel
Commits
cc4b6397
Commit
cc4b6397
authored
8 months ago
by
Elmar Ludwig
Browse files
Options
Downloads
Patches
Plain Diff
sort list of institutes, fixes
#78
parent
9fc01e5d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
controllers/index.php
+22
-21
22 additions, 21 deletions
controllers/index.php
views/index/index.php
+10
-10
10 additions, 10 deletions
views/index/index.php
with
32 additions
and
31 deletions
controllers/index.php
+
22
−
21
View file @
cc4b6397
...
@@ -40,20 +40,22 @@ class IndexController extends PluginController {
...
@@ -40,20 +40,22 @@ class IndexController extends PluginController {
Sidebar
::
get
()
->
addWidget
(
$search_user
);
Sidebar
::
get
()
->
addWidget
(
$search_user
);
//get institutes for the admin-user
//get institutes for the admin-user
$this
->
inst
_ids
=
Stundenzettel
::
getAdminInstIds
();
$this
->
inst
itutes
=
Institute
::
findMany
(
Stundenzettel
::
getAdminInstIds
()
,
'ORDER BY name'
)
;
$widget
=
new
SelectWidget
(
$this
->
_
(
'Einrichtung'
),
$this
->
url_for
(
'index'
),
'inst_id'
);
$widget
=
new
SelectWidget
(
$this
->
_
(
'Einrichtung'
),
$this
->
url_for
(
'index'
),
'inst_id'
);
$element
=
new
SelectElement
(
''
,
$this
->
_
(
'Alle'
),
empty
(
$inst_id
));
$element
=
new
SelectElement
(
''
,
$this
->
_
(
'Alle'
),
empty
(
$inst_id
));
$widget
->
addElement
(
$element
);
$widget
->
addElement
(
$element
);
foreach
(
$this
->
inst
_id
s
as
$i
d
)
{
foreach
(
$this
->
inst
itute
s
as
$i
nstitute
)
{
$element
=
new
SelectElement
(
$i
d
,
I
nstitute
::
find
(
$id
)
->
name
,
$
id
==
$inst_id
);
$element
=
new
SelectElement
(
$institute
->
id
,
$institute
->
name
,
$institute
->
id
==
$inst_id
);
$widget
->
addElement
(
$element
);
$widget
->
addElement
(
$element
);
}
}
Sidebar
::
get
()
->
addWidget
(
$widget
);
Sidebar
::
get
()
->
addWidget
(
$widget
);
if
(
$inst_id
&&
in_array
(
$inst_id
,
$this
->
inst_ids
))
{
if
(
$inst_id
)
{
$this
->
inst_ids
=
[
$inst_id
];
$this
->
institutes
=
array_filter
(
$this
->
institutes
,
function
(
$institute
)
use
(
$inst_id
)
{
return
$institute
->
id
==
$inst_id
;
});
}
}
$options
=
new
OptionsWidget
();
$options
=
new
OptionsWidget
();
...
@@ -64,11 +66,10 @@ class IndexController extends PluginController {
...
@@ -64,11 +66,10 @@ class IndexController extends PluginController {
$this
->
inst_data
=
array
();
$this
->
inst_data
=
array
();
foreach
(
$this
->
inst_ids
as
$inst_id
)
{
foreach
(
$this
->
institutes
as
$institute
)
{
$institute
=
Institute
::
find
(
$inst_id
);
$actions
->
addLink
(
$actions
->
addLink
(
sprintf
(
$this
->
_
(
'Daten für %s exportieren'
),
$institute
->
name
),
sprintf
(
$this
->
_
(
'Daten für %s exportieren'
),
$institute
->
name
),
$this
->
url_for
(
'index/csv_export'
,
$inst
_
id
),
$this
->
url_for
(
'index/csv_export'
,
$inst
itute
->
id
),
Icon
::
create
(
'export'
)
Icon
::
create
(
'export'
)
);
);
}
}
...
@@ -76,37 +77,37 @@ class IndexController extends PluginController {
...
@@ -76,37 +77,37 @@ class IndexController extends PluginController {
//get all stumis and contracts
//get all stumis and contracts
$user_ids
=
[];
//use later to identify former stumis
$user_ids
=
[];
//use later to identify former stumis
foreach
(
$this
->
inst
_id
s
as
$inst
_id
)
{
foreach
(
$this
->
inst
itute
s
as
$inst
itute
)
{
$settings
=
StundenzettelInstituteSetting
::
find
(
$inst
_
id
);
$settings
=
StundenzettelInstituteSetting
::
find
(
$inst
itute
->
id
);
if
(
$settings
)
{
if
(
$settings
)
{
$this
->
groups
[
$inst
_
id
]
=
$settings
->
stumi_statusgroups
;
$this
->
groups
[
$inst
itute
->
id
]
=
$settings
->
stumi_statusgroups
;
}
else
{
}
else
{
$this
->
groups
[
$inst
_
id
]
=
[];
$this
->
groups
[
$inst
itute
->
id
]
=
[];
continue
;
continue
;
}
}
//aktuell eingetragen in Einr
c
ihtungsstatusgruppe
//aktuell eingetragen in Einri
c
htungsstatusgruppe
foreach
(
$this
->
groups
[
$inst
_
id
]
as
$group
)
{
foreach
(
$this
->
groups
[
$inst
itute
->
id
]
as
$group
)
{
foreach
(
$group
->
members
as
$member
)
{
foreach
(
$group
->
members
as
$member
)
{
$stumi
=
User
::
find
(
$member
->
user_id
);
$stumi
=
User
::
find
(
$member
->
user_id
);
if
(
!
$this
->
search
||
stripos
(
$stumi
->
username
.
' '
.
$stumi
->
vorname
.
' '
.
$stumi
->
nachname
,
$this
->
search
))
{
if
(
!
$this
->
search
||
stripos
(
$stumi
->
username
.
' '
.
$stumi
->
vorname
.
' '
.
$stumi
->
nachname
,
$this
->
search
))
{
$this
->
inst_data
[
$inst
_
id
][
$group
->
id
][
'stumis'
][]
=
$stumi
;
$this
->
inst_data
[
$inst
itute
->
id
][
$group
->
id
][
'stumis'
][]
=
$stumi
;
$this
->
inst_data
[
$inst
_
id
][
$group
->
id
][
'stumi_contracts'
][
$member
->
user_id
]
=
StundenzettelContract
::
get_user_inst_contracts
(
$member
->
user_id
,
$inst
_
id
,
$show_all
);
$this
->
inst_data
[
$inst
itute
->
id
][
$group
->
id
][
'stumi_contracts'
][
$member
->
user_id
]
=
StundenzettelContract
::
get_user_inst_contracts
(
$member
->
user_id
,
$inst
itute
->
id
,
$show_all
);
$user_ids
[]
=
$member
->
user_id
;
$user_ids
[]
=
$member
->
user_id
;
}
}
}
}
}
}
//bereits ausgeschieden (nicht in Statusgruppe aber Vertrag vorhanden)
//bereits ausgeschieden (nicht in Statusgruppe aber Vertrag vorhanden)
$old_stumi_contracts
=
StundenzettelContract
::
findByInst_id
(
$inst
_
id
);
$old_stumi_contracts
=
StundenzettelContract
::
findByInst_id
(
$inst
itute
->
id
);
foreach
(
$old_stumi_contracts
as
$old_contract
)
{
foreach
(
$old_stumi_contracts
as
$old_contract
)
{
$former_stumi
=
User
::
find
(
$old_contract
->
user_id
);
$former_stumi
=
User
::
find
(
$old_contract
->
user_id
);
if
(
!
in_array
(
$old_contract
->
user_id
,
$user_ids
)
&&
(
!
$this
->
search
||
stripos
(
$former_stumi
->
username
.
' '
.
$former_stumi
->
vorname
.
' '
.
$former_stumi
->
nachname
,
$this
->
search
)))
{
if
(
!
in_array
(
$old_contract
->
user_id
,
$user_ids
)
&&
(
!
$this
->
search
||
stripos
(
$former_stumi
->
username
.
' '
.
$former_stumi
->
vorname
.
' '
.
$former_stumi
->
nachname
,
$this
->
search
)))
{
$this
->
inst_data
[
$inst
_
id
][
0
][
'stumis'
][]
=
$former_stumi
;
$this
->
inst_data
[
$inst
itute
->
id
][
0
][
'stumis'
][]
=
$former_stumi
;
$this
->
inst_data
[
$inst
_
id
][
0
][
'stumi_contracts'
][
$former_stumi
->
user_id
]
=
StundenzettelContract
::
get_user_inst_contracts
(
$former_stumi
->
user_id
,
$inst
_
id
,
$show_all
);
$this
->
inst_data
[
$inst
itute
->
id
][
0
][
'stumi_contracts'
][
$former_stumi
->
user_id
]
=
StundenzettelContract
::
get_user_inst_contracts
(
$former_stumi
->
user_id
,
$inst
itute
->
id
,
$show_all
);
$user_ids
[]
=
$former_stumi
->
user_id
;
$user_ids
[]
=
$former_stumi
->
user_id
;
}
}
}
}
if
(
isset
(
$this
->
inst_data
[
$inst
_
id
][
0
]))
{
if
(
isset
(
$this
->
inst_data
[
$inst
itute
->
id
][
0
]))
{
array_push
(
$this
->
groups
[
$inst
_
id
],
0
);
array_push
(
$this
->
groups
[
$inst
itute
->
id
],
0
);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
views/index/index.php
+
10
−
10
View file @
cc4b6397
<?
if
(
$adminrole
)
:
?>
<?
if
(
$adminrole
)
:
?>
<?
foreach
(
$inst
_id
s
as
$inst
_id
)
:
?>
<?
foreach
(
$inst
itute
s
as
$inst
itute
)
:
?>
<h2>
<h2>
<a
href=
'
<?=
$controller
->
link_for
(
'index/edit_institute_settings/'
.
$inst
_
id
)
?>
'
title=
'
<?=
$controller
->
_
(
'Konfiguration bearbeiten'
)
?>
'
data-dialog=
'size=auto'
>
<a
href=
'
<?=
$controller
->
link_for
(
'index/edit_institute_settings/'
.
$inst
itute
->
id
)
?>
'
title=
'
<?=
$controller
->
_
(
'Konfiguration bearbeiten'
)
?>
'
data-dialog=
'size=auto'
>
<?=
Icon
::
create
(
'edit'
)
?>
<?=
Icon
::
create
(
'edit'
)
?>
</a>
</a>
<?=
htmlReady
(
I
nstitute
::
find
(
$inst_id
)
->
name
)
?>
<?=
htmlReady
(
$i
nstitute
->
name
)
?>
</h2>
</h2>
<?
foreach
(
$groups
[
$inst
_
id
]
as
$group
)
:
?>
<?
foreach
(
$groups
[
$inst
itute
->
id
]
as
$group
)
:
?>
<?
if
(
$group
->
id
)
:
?>
<?
if
(
$group
->
id
)
:
?>
<?
$group_id
=
$group
->
id
;
?>
<!-- echte Gruppe -->
<?
$group_id
=
$group
->
id
;
?>
<!-- echte Gruppe -->
<?
else
:
?>
<?
else
:
?>
...
@@ -29,10 +29,10 @@
...
@@ -29,10 +29,10 @@
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<?
if
(
!
empty
(
$inst_data
[
$inst
_
id
][
$group_id
][
'stumis'
]))
:
?>
<?
if
(
!
empty
(
$inst_data
[
$inst
itute
->
id
][
$group_id
][
'stumis'
]))
:
?>
<?
foreach
(
$inst_data
[
$inst
_
id
][
$group_id
][
'stumis'
]
as
$stumi
)
:
?>
<?
foreach
(
$inst_data
[
$inst
itute
->
id
][
$group_id
][
'stumis'
]
as
$stumi
)
:
?>
<?
if
(
$inst_data
[
$inst
_
id
][
$group_id
][
'stumi_contracts'
][
$stumi
->
user_id
])
:
?>
<?
if
(
$inst_data
[
$inst
itute
->
id
][
$group_id
][
'stumi_contracts'
][
$stumi
->
user_id
])
:
?>
<?
foreach
(
$inst_data
[
$inst
_
id
][
$group_id
][
'stumi_contracts'
][
$stumi
->
user_id
]
as
$contract
)
:
?>
<?
foreach
(
$inst_data
[
$inst
itute
->
id
][
$group_id
][
'stumi_contracts'
][
$stumi
->
user_id
]
as
$contract
)
:
?>
<tr>
<tr>
<td>
<td>
<a
href=
'
<?=
$controller
->
link_for
(
'timesheet/index/'
.
$contract
->
id
)
?>
'
>
<?=
htmlReady
(
$stumi
->
nachname
)
?>
,
<?=
htmlReady
(
$stumi
->
vorname
)
?>
</a>
<a
href=
'
<?=
$controller
->
link_for
(
'timesheet/index/'
.
$contract
->
id
)
?>
'
>
<?=
htmlReady
(
$stumi
->
nachname
)
?>
,
<?=
htmlReady
(
$stumi
->
vorname
)
?>
</a>
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
<td>
<?=
htmlReady
(
StundenzettelTimesheet
::
stundenzettel_strftimespan
(
$contract
->
getWorktimeBalance
()))
?>
</td>
<td>
<?=
htmlReady
(
StundenzettelTimesheet
::
stundenzettel_strftimespan
(
$contract
->
getWorktimeBalance
()))
?>
</td>
<td>
<?=
htmlReady
(
StundenzettelTimesheet
::
stundenzettel_strftimespan
(
$contract
->
getClaimedVacation
(
date
(
'Y'
))))
?>
</td>
<td>
<?=
htmlReady
(
StundenzettelTimesheet
::
stundenzettel_strftimespan
(
$contract
->
getClaimedVacation
(
date
(
'Y'
))))
?>
</td>
<td>
<?=
htmlReady
(
StundenzettelTimesheet
::
stundenzettel_strftimespan
(
$contract
->
getRemainingVacation
(
date
(
'Y'
))))
?>
</td>
<td>
<?=
htmlReady
(
StundenzettelTimesheet
::
stundenzettel_strftimespan
(
$contract
->
getRemainingVacation
(
date
(
'Y'
))))
?>
</td>
<td>
<?=
Stundenzettel
::
vacationEntitelment
(
$stumi
->
user_id
,
$inst
_
id
,
date
(
'Y'
))
?>
<td>
<?=
Stundenzettel
::
vacationEntitelment
(
$stumi
->
user_id
,
$inst
itute
->
id
,
date
(
'Y'
))
?>
<?=
tooltipIcon
(
$controller
->
_
(
'Davon aus diesem Vertrag erworbener Anspruch'
)
.
': '
.
$contract
->
getVacationEntitlement
(
date
(
'Y'
)))
?>
<?=
tooltipIcon
(
$controller
->
_
(
'Davon aus diesem Vertrag erworbener Anspruch'
)
.
': '
.
$contract
->
getVacationEntitlement
(
date
(
'Y'
)))
?>
</td>
</td>
<td>
<?=
htmlReady
(
$contract
->
supervisor
->
getFullName
(
'no_title_rev'
))
?>
</td>
<td>
<?=
htmlReady
(
$contract
->
supervisor
->
getFullName
(
'no_title_rev'
))
?>
</td>
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
<td>
--
</td>
<td>
--
</td>
<td
class=
"actions"
>
<td
class=
"actions"
>
<?
$menu
=
ActionMenu
::
get
()
?>
<?
$menu
=
ActionMenu
::
get
()
?>
<?
$menu
->
addLink
(
$controller
->
url_for
(
'index/new'
,
$inst
_
id
,
$stumi
->
user_id
),
<?
$menu
->
addLink
(
$controller
->
url_for
(
'index/new'
,
$inst
itute
->
id
,
$stumi
->
user_id
),
$controller
->
_
(
'Vertrag hinzufügen'
),
Icon
::
create
(
'add'
),
[
'data-dialog'
=>
'size=auto'
]
$controller
->
_
(
'Vertrag hinzufügen'
),
Icon
::
create
(
'add'
),
[
'data-dialog'
=>
'size=auto'
]
)
?>
)
?>
<?=
$menu
->
render
()
?>
<?=
$menu
->
render
()
?>
...
...
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