Merge pull request 'Replace deprecated functions to support php 8.3' (#68) from php83-fixes-fr-fr into master

Reviewed-on: #68
Reviewed-by: Oystein Kristoffer Tveit <oysteikt@pvv.ntnu.no>
This commit is contained in:
Felix Albrigtsen 2024-08-17 20:45:08 +02:00
commit 8bcadd1d2d
6 changed files with 24 additions and 23 deletions

View File

@ -6,6 +6,8 @@ use \DateInterval;
class Agenda { class Agenda {
private $activities;
const TODAY = 0; const TODAY = 0;
const TOMORROW = 1; const TOMORROW = 1;
const THIS_WEEK = 2; const THIS_WEEK = 2;
@ -18,7 +20,7 @@ class Agenda {
} }
public static function getFormattedDate($date) { public static function getFormattedDate($date) {
return trim(strftime('%A %e. %b %H.%M', $date->getTimeStamp())); return $date->format("l j. M H.i");
} }
public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) { public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) {

View File

@ -5,6 +5,7 @@ use \DateTimeImmutable;
use \PDO; use \PDO;
class DBActivity implements Activity { class DBActivity implements Activity {
private $pdo;
public function __construct(PDO $pdo) { public function __construct(PDO $pdo) {
$this->pdo = $pdo; $this->pdo = $pdo;

View File

@ -24,7 +24,7 @@ abstract class Event {
return 'i morgen'; return 'i morgen';
} }
if (Agenda::isThisWeek($this->getStart()) || $this->getStart()->sub(new DateInterval('P4D'))->getTimestamp() < time()) { if (Agenda::isThisWeek($this->getStart()) || $this->getStart()->sub(new DateInterval('P4D'))->getTimestamp() < time()) {
return strftime('%A', $this->getStart()->getTimestamp()); return $this->getStart()->format("l");
} }
if (Agenda::isNextWeek($this->getStart())) { if (Agenda::isNextWeek($this->getStart())) {
return 'neste uke'; return 'neste uke';
@ -32,7 +32,7 @@ abstract class Event {
if (Agenda::isThisMonth($this->getStart())) { if (Agenda::isThisMonth($this->getStart())) {
return 'denne måneden'; return 'denne måneden';
} }
return trim(strftime('%e. %B', $this->getStart()->getTimestamp())); return $this->getStart()->format("j. F");
} }
public abstract function getStop(); /* : DateTimeImmutable */ public abstract function getStop(); /* : DateTimeImmutable */

View File

@ -5,7 +5,7 @@ class SimpleEvent extends Event {
private $id, $name, $descr, $start, $end, $org, $loc; private $id, $name, $descr, $start, $end, $org, $loc;
public function __construct($id, $name,\DateTimeImmutable $start,\DateTimeImmutable $end,$org, $loc, $descr, $isDBEvent = false){ public function __construct($id, $name,\DateTimeImmutable $start,\DateTimeImmutable $end,$org, $loc, $descr, $_isDBEvent = false){
$this->id = $id; $this->id = $id;
$this->name = $name; $this->name = $name;
$this->start = $start; $this->start = $start;
@ -13,7 +13,6 @@ class SimpleEvent extends Event {
$this->org = $org; $this->org = $org;
$this->loc = $loc; $this->loc = $loc;
$this->descr = explode("\n", $descr); $this->descr = explode("\n", $descr);
$this->isDBEvent = $isDBEvent;
} }
public function getID(){ public function getID(){
@ -52,10 +51,6 @@ class SimpleEvent extends Event {
return $this->descr; return $this->descr;
} }
public function isDBEvent() {
return $this->isDBEvent;
}
public function getColor() { public function getColor() {
return "#3b7"; return "#3b7";
} }

View File

@ -72,6 +72,7 @@ img.float-right {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.calendar-events ul .date { .calendar-events ul .date {
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.5);
font-size: 0.8em; font-size: 0.8em;
@ -87,11 +88,14 @@ img.float-right {
padding: 0; padding: 0;
} }
.calendar-events a, .calendar-events a {
color: rgba(0,0,0, 0.85);
}
.calendar-events ul .time { .calendar-events ul .time {
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.5);
float: right; float: right;
margin-left: 0.2em;
} }
.calendar-events ul .icon, .calendar-events ul .icon,

View File

@ -77,13 +77,12 @@ $doorTime = date("H:i", $doorEntry->time);
<?php } else { ?> <?php } else { ?>
<strong><?= $event->getName(); ?></strong> <strong><?= $event->getName(); ?></strong>
<?php } ?> <?php } ?>
<?php /* <a class="icon subscribe">+</a> */ ?>
<?php if ($period !== \pvv\side\Agenda::TODAY) { <?php if ($period !== \pvv\side\Agenda::TODAY) {
echo '<span class="time">' . $event->getStart()->format('H:i') . ' </span>'; echo '<span class="time">' . $event->getStart()->format('H:i') . ' </span>';
if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) { if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
echo '<span class="date">' . strftime('%a', $event->getStart()->getTimestamp()) . '</span>'; echo '<span class="time">' . $event->getStart()->format('D') . '</span>';
} else { } else {
echo '<span class="date">' . strftime('%e. %b', $event->getStart()->getTimestamp()) . '</span>'; echo '<span class="time">' . $event->getStart()->format('j. F') . '</span>';
} }
} else { } else {
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>'; echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';