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
0da03607
Commit
0da03607
authored
2 years ago
by
David Siegfried
Committed by
Jan-Hendrik Willms
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
prevent php-warnings, closes
#2351
Closes
#2351
Merge request
!1538
parent
a7d2447b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/views/news/admin_news.php
+6
-2
6 additions, 2 deletions
app/views/news/admin_news.php
lib/classes/Button.class.php
+4
-1
4 additions, 1 deletion
lib/classes/Button.class.php
lib/models/StudipNews.class.php
+15
-12
15 additions, 12 deletions
lib/models/StudipNews.class.php
with
25 additions
and
15 deletions
app/views/news/admin_news.php
+
6
−
2
View file @
0da03607
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
data-proxyfor=
".news_
<?=
$news
[
'range_id'
]
?>
"
data-proxyfor=
".news_
<?=
$news
[
'range_id'
]
?>
"
aria-labelledby=
"
<?=
_
(
'Alle auswählen'
)
?>
"
>
aria-labelledby=
"
<?=
_
(
'Alle auswählen'
)
?>
"
>
</th>
</th>
<th
colspan=
"5"
>
<?=
mila
(
htmlReady
(
$news
[
'title'
]))
.
' '
.
htmlReady
(
$news
[
'semester'
])
?>
</th>
<th
colspan=
"5"
>
<?=
mila
(
htmlReady
(
$news
[
'title'
]
??
''
))
.
' '
.
htmlReady
(
$news
[
'semester'
]
??
''
)
?>
</th>
</tr>
</tr>
<?
endif
?>
<?
endif
?>
<?
$last_title
=
$title
?>
<?
$last_title
=
$title
?>
...
@@ -114,7 +114,11 @@
...
@@ -114,7 +114,11 @@
aria-label=
"
<?=
_
(
'Diese Ankündigung zum Entfernen vormerken'
)
?>
"
<?=
tooltip
(
_
(
"Diese Ankündigung zum Entfernen vormerken"
),
false
)
?>
>
aria-label=
"
<?=
_
(
'Diese Ankündigung zum Entfernen vormerken'
)
?>
"
<?=
tooltip
(
_
(
"Diese Ankündigung zum Entfernen vormerken"
),
false
)
?>
>
</td>
</td>
<td>
<?=
htmlReady
(
$news
[
'object'
]
->
topic
)
?>
</td>
<td>
<?=
htmlReady
(
$news
[
'object'
]
->
topic
)
?>
</td>
<?
list
(
$body
,
$admin_msg
)
=
explode
(
'<admin_msg>'
,
$news
[
'object'
]
->
body
);
?>
<?
$parts
=
explode
(
'<admin_msg>'
,
$news
[
'object'
]
->
body
);
$body
=
$parts
[
0
];
$admin_msg
=
$parts
[
1
]
??
';'
?>
<td>
<?=
htmlReady
(
$news
[
'object'
]
->
author
)
?>
</td>
<td>
<?=
htmlReady
(
$news
[
'object'
]
->
author
)
?>
</td>
<td>
<?=
strftime
(
"%d.%m.%y"
,
$news
[
'object'
]
->
date
)
?>
</td>
<td>
<?=
strftime
(
"%d.%m.%y"
,
$news
[
'object'
]
->
date
)
?>
</td>
<td>
<?=
strftime
(
"%d.%m.%y"
,
$news
[
'object'
]
->
date
+
$news
[
'object'
]
->
expire
)
?>
</td>
<td>
<?=
strftime
(
"%d.%m.%y"
,
$news
[
'object'
]
->
date
+
$news
[
'object'
]
->
expire
)
?>
</td>
...
...
This diff is collapsed.
Click to expand it.
lib/classes/Button.class.php
+
4
−
1
View file @
0da03607
...
@@ -38,7 +38,10 @@ class Button extends Interactable
...
@@ -38,7 +38,10 @@ class Button extends Interactable
public
function
__toString
()
public
function
__toString
()
{
{
// add "button" to attribute @class
// add "button" to attribute @class
@
$this
->
attributes
[
'class'
]
.
=
' button'
;
if
(
!
isset
(
$this
->
attributes
[
'class'
]))
{
$this
->
attributes
[
'class'
]
=
''
;
}
$this
->
attributes
[
'class'
]
.
=
' button'
;
$attributes
=
[];
$attributes
=
[];
ksort
(
$this
->
attributes
);
ksort
(
$this
->
attributes
);
...
...
This diff is collapsed.
Click to expand it.
lib/models/StudipNews.class.php
+
15
−
12
View file @
0da03607
...
@@ -143,7 +143,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
...
@@ -143,7 +143,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
unset
(
$ret
[
$news_id
]);
unset
(
$ret
[
$news_id
]);
}
}
}
}
return
(
int
)
count
(
$ret
);
return
count
(
$ret
);
}
}
public
static
function
GetNewsByAuthor
(
$user_id
,
$as_objects
=
false
)
public
static
function
GetNewsByAuthor
(
$user_id
,
$as_objects
=
false
)
...
@@ -206,13 +206,13 @@ class StudipNews extends SimpleORMap implements PrivacyObject
...
@@ -206,13 +206,13 @@ class StudipNews extends SimpleORMap implements PrivacyObject
if
(
$limit
<=
0
)
{
if
(
$limit
<=
0
)
{
return
$news_result
;
return
$news_result
;
}
}
$where_querypart
=
[];
if
(
isset
(
$startdate
))
{
if
(
isset
(
$startdate
))
{
$where_querypart
[]
=
"
(date+expire) > ?
"
;
$where_querypart
[]
=
'
(date+expire) > ?
'
;
$query_vars
[]
=
$startdate
;
$query_vars
[]
=
$startdate
;
}
}
if
(
isset
(
$enddate
))
{
if
(
isset
(
$enddate
))
{
$where_querypart
[]
=
"
date < ?
"
;
$where_querypart
[]
=
'
date < ?
'
;
$query_vars
[]
=
$enddate
;
$query_vars
[]
=
$enddate
;
}
}
...
@@ -291,20 +291,23 @@ class StudipNews extends SimpleORMap implements PrivacyObject
...
@@ -291,20 +291,23 @@ class StudipNews extends SimpleORMap implements PrivacyObject
foreach
(
$news_result
as
$id
=>
$result
)
{
foreach
(
$news_result
as
$id
=>
$result
)
{
$objects
[
$area
][
$id
]
=
[
$objects
[
$area
][
$id
]
=
[
'range_id'
=>
$result
[
'range_id'
],
'range_id'
=>
$result
[
'range_id'
],
'title'
=>
$result
[
'title'
],
'title'
=>
$result
[
'title'
]
??
''
,
];
];
if
(
$area
==
'sem'
)
{
if
(
$area
===
'sem'
)
{
if
(
!
isset
(
$objects
[
$area
][
$id
][
'semester'
]))
{
$objects
[
$area
][
$id
][
'semester'
]
=
''
;
}
$objects
[
$area
][
$id
][
'semester'
]
.
=
sprintf
(
'(%s%s)'
,
$objects
[
$area
][
$id
][
'semester'
]
.
=
sprintf
(
'(%s%s)'
,
$result
[
'startsem'
],
$result
[
'startsem'
],
$result
[
'startsem'
]
!=
$result
[
'endsem'
]
?
' - '
.
$result
[
'endsem'
]
:
''
);
$result
[
'startsem'
]
!=
$result
[
'endsem'
]
?
' - '
.
$result
[
'endsem'
]
:
''
);
}
elseif
(
$area
==
'user'
)
{
}
elseif
(
$area
==
=
'user'
)
{
if
(
$GLOBALS
[
'user'
]
->
id
==
$result
[
'userid'
])
{
if
(
$GLOBALS
[
'user'
]
->
id
==
=
$result
[
'userid'
])
{
$objects
[
$area
][
$id
][
'title'
]
=
_
(
'Ankündigungen auf Ihrer Profilseite'
);
$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'
]));
$objects
[
$area
][
$id
][
'title'
]
=
sprintf
(
_
(
'Ankündigungen auf der Profilseite von %s'
),
get_fullname
(
$result
[
'userid'
]));
}
}
}
elseif
(
$area
==
'global'
)
{
}
elseif
(
$area
==
=
'global'
)
{
$objects
[
$area
][
$id
][
'title'
]
=
_
(
'Ankündigungen auf der Stud.IP Startseite'
);
$objects
[
$area
][
$id
][
'title'
]
=
_
(
'Ankündigungen auf der Stud.IP Startseite'
);
}
}
if
(
$as_objects
)
{
if
(
$as_objects
)
{
...
@@ -422,7 +425,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
...
@@ -422,7 +425,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
$stm
=
$db
->
prepare
(
$query
);
$stm
=
$db
->
prepare
(
$query
);
$stm
->
execute
(
$parameters
);
$stm
->
execute
(
$parameters
);
$result
=
$stm
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
$result
=
$stm
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
$killed
=
0
;
if
(
count
(
$result
)
>
0
)
{
if
(
count
(
$result
)
>
0
)
{
$query
=
"DELETE FROM news WHERE news_id IN (?)"
;
$query
=
"DELETE FROM news WHERE news_id IN (?)"
;
$statement
=
$db
->
prepare
(
$query
);
$statement
=
$db
->
prepare
(
$query
);
...
@@ -454,6 +457,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
...
@@ -454,6 +457,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
public
static
function
DeleteNewsByAuthor
(
$user_id
)
public
static
function
DeleteNewsByAuthor
(
$user_id
)
{
{
$deleted
=
0
;
foreach
(
static
::
GetNewsByAuthor
(
$user_id
,
true
)
as
$news
)
{
foreach
(
static
::
GetNewsByAuthor
(
$user_id
,
true
)
as
$news
)
{
$deleted
+=
$news
->
delete
();
$deleted
+=
$news
->
delete
();
}
}
...
@@ -516,8 +520,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
...
@@ -516,8 +520,7 @@ class StudipNews extends SimpleORMap implements PrivacyObject
public
function
getRanges
()
public
function
getRanges
()
{
{
$ranges
=
$this
->
news_ranges
->
pluck
(
'range_id'
);
return
$this
->
news_ranges
->
pluck
(
'range_id'
);
return
$ranges
;
}
}
public
function
issetRange
(
$range_id
)
public
function
issetRange
(
$range_id
)
...
...
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