Minor - format code, remove unused code

pull/3924/head
Julio Montoya 4 years ago
parent 829d55e6c3
commit 4980bd1530
  1. 38
      public/main/inc/lib/system_announcements.lib.php
  2. 2
      src/CoreBundle/Entity/Career.php
  3. 2
      src/CoreBundle/Entity/Session.php
  4. 2
      src/CoreBundle/Traits/ControllerTrait.php

@ -472,42 +472,4 @@ class SystemAnnouncementManager
return $message_sent; //true if at least one e-mail was sent
}
/**
* Get the HTML code for an announcement.
*
* @param int $announcementId The announcement ID
*/
public static function getAnnouncement($announcementId, ?User $user = null): array
{
$selectedUserLanguage = api_get_language_isocode();
$announcementTable = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
$now = api_get_utc_datetime();
$announcementId = (int) $announcementId;
$whereConditions = [
"(lang = ? OR lang IS NULL OR lang = '') " => $selectedUserLanguage,
"AND (? >= date_start AND ? <= date_end) " => [$now, $now],
"AND id = ? " => $announcementId,
];
$condition = self::getVisibilityCondition($visibility);
$whereConditions[$condition] = 1;
if (api_is_multiple_url_enabled()) {
$whereConditions["AND access_url_id IN (1, ?) "] = api_get_current_access_url_id();
}
$announcement = Database::select(
'*',
$announcementTable,
[
'where' => $whereConditions,
'order' => 'date_start',
],
'first'
);
return $announcement;
}
}

@ -114,7 +114,7 @@ class Career
return $this->promotions;
}
public function setPromotions(array | ArrayCollection | Collection $promotions): self
public function setPromotions(Collection $promotions): self
{
$this->promotions = $promotions;

@ -309,7 +309,7 @@ class Session implements ResourceWithAccessUrlInterface
public function __toString(): string
{
return (string) $this->getName();
return $this->getName();
}
public function getDuration(): int

@ -125,7 +125,7 @@ trait ControllerTrait
{
$urlId = $this->getRequest()->getSession()->get('access_url_id');
return $this->getDoctrine()->getRepository(AccessUrl::class)->find($urlId);
return $this->container->get('doctrine')->getRepository(AccessUrl::class)->find($urlId);
}
/**

Loading…
Cancel
Save