Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
cab29524
Commit
cab29524
authored
10 months ago
by
Jan-Hendrik Willms
Committed by
David Siegfried
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fixes #3644
Closes #3644 Merge request
studip/studip!2522
parent
e278ef0a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/views/news/admin_news.php
+54
-30
54 additions, 30 deletions
app/views/news/admin_news.php
lib/models/StudipNews.class.php
+12
-5
12 additions, 5 deletions
lib/models/StudipNews.class.php
with
66 additions
and
35 deletions
app/views/news/admin_news.php
+
54
−
30
View file @
cab29524
<?
use
Studip\Button
,
Studip\LinkButton
;
?>
<?php
/**
* @var NewsController $controller
* @var string $area_type
* @var Trails_Flash $flash
* @var string $news_searchterm
* @var string $news_startdate
* @var string $news_enddate
* @var string|null $filter_text
* @var array<string, array<string, array{title: string, object: StudipNews}>> $news_items
* @var array $area_structure
*/
?>
<?
if
(
!
empty
(
$flash
[
'question_text'
]))
:
?>
<?=
QuestionBox
::
create
(
htmlReady
(
$flash
[
'question_text'
]),
$controller
->
url_for
(
'news/admin_news/'
.
$area_type
,
array_merge
(
$flash
[
'question_param'
],
[
<?=
QuestionBox
::
create
(
htmlReady
(
$flash
[
'question_text'
]),
$controller
->
url_for
(
'news/admin_news/'
.
$area_type
,
array_merge
(
$flash
[
'question_param'
],
[
'news_filter_term'
=>
htmlReady
(
$news_searchterm
),
'news_filter_start'
=>
$news_startdate
,
'news_filter_end'
=>
$news_enddate
,
'news_filter'
=>
'set'
]
)),
$controller
->
url_for
(
'news/admin_news/'
.
$area_type
,
[
'news_filter_term'
=>
htmlReady
(
$news_searchterm
),
'news_filter_start'
=>
$news_startdate
,
'news_filter_end'
=>
$news_enddate
,
'news_filter'
=>
'set'
]
)),
$controller
->
url_for
(
'news/admin_news/'
.
$area_type
,
[
'news_filter_term'
=>
htmlReady
(
$news_searchterm
),
'news_filter_start'
=>
$news_startdate
,
'news_filter_end'
=>
$news_enddate
,
'news_filter'
=>
'set'
])
);
?>
])
);
?>
<?
endif
?>
<form
action=
"
<?=
$controller
->
link_for
(
'news/admin_news/'
.
$area_type
)
?>
"
id=
"admin_news_form"
class=
"default"
method=
"post"
>
...
...
@@ -52,9 +64,9 @@
</label>
</fieldset>
<footer>
<?=
Button
::
create
(
_
(
'Filter anwenden'
),
'apply_news_filter'
,
[
'aria-label'
=>
_
(
'Liste mit Suchbegriff und/oder Zeitraum filtern'
)])
?>
<?=
Studip\
Button
::
create
(
_
(
'Filter anwenden'
),
'apply_news_filter'
,
[
'aria-label'
=>
_
(
'Liste mit Suchbegriff und/oder Zeitraum filtern'
)])
?>
<?
if
(
$filter_text
)
:
?>
<?=
Button
::
create
(
_
(
'Filter zurücksetzen'
),
'reset_filter'
)
?>
<?=
Studip\
Button
::
create
(
_
(
'Filter zurücksetzen'
),
'reset_filter'
)
?>
<?
endif
?>
</footer>
<br>
...
...
@@ -74,12 +86,13 @@
</caption>
<?
endif
?>
<colgroup>
<col
width=
"20
"
>
<col
style=
"width: 20px
"
>
<col>
<col
width=
"25%"
>
<col
width=
"10%"
>
<col
width=
"10%"
>
<col
width=
"80"
>
<col
style=
"width: 25%"
>
<col
style=
"width: 10%"
>
<col
style=
"width: 10%"
>
<col
style=
"width: 5%"
>
<col
style=
"width: 80px"
>
</colgroup>
<thead>
<tr>
...
...
@@ -88,6 +101,7 @@
<th>
<?=
_
(
'Autor'
)
?>
</th>
<th>
<?=
_
(
'Einstelldatum'
)
?>
</th>
<th>
<?=
_
(
'Ablaufdatum'
)
?>
</th>
<th>
<?=
_
(
'Aufrufe'
)
?>
</th>
<th
class=
"actions"
>
<?=
_
(
'Aktion'
)
?>
</th>
</tr>
</thead>
...
...
@@ -99,18 +113,18 @@
<tr>
<th>
<input
type=
"checkbox"
data-proxyfor=
".news_
<?=
$news
[
'range_id'
]
?>
"
data-proxyfor=
".news_
<?=
htmlReady
(
$news
[
'range_id'
]
)
?>
"
aria-labelledby=
"
<?=
_
(
'Alle auswählen'
)
?>
"
>
</th>
<th
colspan=
"
5
"
>
<?=
mila
(
htmlReady
(
$news
[
'title'
]
??
''
))
.
' '
.
htmlReady
(
$news
[
'semester'
]
??
''
)
?>
</th>
<th
colspan=
"
6
"
>
<?=
mila
(
htmlReady
(
$news
[
'title'
]
??
''
))
.
' '
.
htmlReady
(
$news
[
'semester'
]
??
''
)
?>
</th>
</tr>
<?
endif
?>
<?
$last_title
=
$title
?>
<?
endif
?>
<tr>
<td>
<input
type=
"checkbox"
class=
"news_
<?=
$news
[
'range_id'
]
?>
"
name=
"mark_news[]"
value=
"
<?=
$news
[
'object'
]
->
news_id
.
'_'
.
$news
[
'range_id'
]
?>
"
<input
type=
"checkbox"
class=
"news_
<?=
htmlReady
(
$news
[
'range_id'
]
)
?>
"
name=
"mark_news[]"
value=
"
<?=
htmlReady
(
$news
[
'object'
]
->
news_id
.
'_'
.
$news
[
'range_id'
]
)
?>
"
aria-label=
"
<?=
_
(
'Diese Ankündigung zum Entfernen vormerken'
)
?>
"
<?=
tooltip
(
_
(
"Diese Ankündigung zum Entfernen vormerken"
),
false
)
?>
>
</td>
<td>
<?=
htmlReady
(
$news
[
'object'
]
->
topic
)
?>
</td>
...
...
@@ -119,9 +133,19 @@
$body
=
$parts
[
0
];
$admin_msg
=
$parts
[
1
]
??
';'
?>
<td>
<?=
htmlReady
(
$news
[
'object'
]
->
author
)
?>
</td>
<td>
<?
if
(
$news
[
'object'
]
->
owner
)
:
?>
<a
href=
"
<?=
URLHelper
::
getLink
(
'dispatch.php/profile'
,
[
'username'
=>
$news
[
'object'
]
->
owner
->
username
])
?>
"
>
<?=
Avatar
::
getAvatar
(
$news
[
'object'
]
->
user_id
)
->
getImageTag
(
Avatar
::
SMALL
)
?>
<?=
htmlReady
(
$news
[
'object'
]
->
owner
->
getFullName
())
?>
</a>
<?
else
:
?>
<?=
htmlReady
(
$news
[
'object'
]
->
author
)
?>
<?
endif
;
?>
</td>
<td>
<?=
strftime
(
"%d.%m.%y"
,
$news
[
'object'
]
->
date
)
?>
</td>
<td>
<?=
strftime
(
"%d.%m.%y"
,
$news
[
'object'
]
->
date
+
$news
[
'object'
]
->
expire
)
?>
</td>
<td>
<?=
$news
[
'object'
]
->
views
?>
</td>
<td
class=
"actions"
>
<?
$menu
=
ActionMenu
::
get
()
->
setContext
(
$news
[
'object'
]
->
topic
);
...
...
@@ -158,8 +182,8 @@
</tbody>
<tfoot>
<tr>
<td
colspan=
"
6
"
>
<?=
Button
::
create
(
_
(
'Alle markierten Ankündigungen entfernen'
),
'remove_marked_news'
)
?>
<td
colspan=
"
7
"
>
<?=
Studip\
Button
::
create
(
_
(
'Alle markierten Ankündigungen entfernen'
),
'remove_marked_news'
)
?>
</td>
</tr>
</tfoot>
...
...
This diff is collapsed.
Click to expand it.
lib/models/StudipNews.class.php
+
12
−
5
View file @
cab29524
...
...
@@ -44,6 +44,7 @@ require_once 'lib/object.inc.php';
* @property SimpleORMapCollection|StudipComment[] $comments has_many StudipComment
* @property SimpleORMapCollection|NewsRoles[] $news_roles has_many NewsRoles
* @property User $owner belongs_to User
* @property int $views additional field
*/
class
StudipNews
extends
SimpleORMap
implements
PrivacyObject
{
...
...
@@ -72,8 +73,15 @@ class StudipNews extends SimpleORMap implements PrivacyObject
'on_delete'
=>
'delete'
];
$config
[
'i18n_fields'
][
'topic'
]
=
true
;
$config
[
'i18n_fields'
][
'body'
]
=
true
;
$config
[
'additional_fields'
]
=
[
'views'
=>
[
'get'
=>
function
(
StudipNews
$news
):
int
{
return
object_return_views
(
$news
->
id
);
},
],
];
$config
[
'i18n_fields'
]
=
[
'topic'
,
'body'
];
// Strip <admin_msg> from news body
$config
[
'registered_callbacks'
][
'after_initialize'
][]
=
function
(
$news
)
{
...
...
@@ -292,7 +300,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
$news_result
=
$statement
->
fetchGrouped
();
$objects
=
[
$area
=>
[]];
foreach
(
$news_result
as
$id
=>
$result
)
{
foreach
(
$news_result
as
$id
=>
$result
)
{
$objects
[
$area
][
$id
]
=
[
'range_id'
=>
$result
[
'range_id'
],
'title'
=>
$result
[
'title'
]
??
''
,
...
...
@@ -307,8 +315,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
}
elseif
(
$area
===
'user'
)
{
if
(
$GLOBALS
[
'user'
]
->
id
===
$result
[
'userid'
])
{
$objects
[
$area
][
$id
][
'title'
]
=
_
(
'Ankündigungen auf Ihrer Profilseite'
);
}
else
{
}
else
{
$objects
[
$area
][
$id
][
'title'
]
=
sprintf
(
_
(
'Ankündigungen auf der Profilseite von %s'
),
get_fullname
(
$result
[
'userid'
]));
}
}
elseif
(
$area
===
'global'
)
{
...
...
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