ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\News\NewsPeriodInfo Class Reference
+ Collaboration diagram for ILIAS\News\NewsPeriodInfo:

Public Member Functions

 __construct (private readonly ilLanguage $lng, private readonly ilSetting $news_settings,)
 
 getPeriodInfo ()
 

Private Member Functions

 getPeriodInfoLines ()
 
 getDashboardNewsPeriodLabel ()
 
 getContainerObjectNewsPeriodLabel ()
 
 formatPeriodLabel (int $days)
 

Detailed Description

Definition at line 27 of file NewsPeriodInfo.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\News\NewsPeriodInfo::__construct ( private readonly ilLanguage  $lng,
private readonly ilSetting  $news_settings 
)

Definition at line 29 of file NewsPeriodInfo.php.

32 {
33 }

Member Function Documentation

◆ formatPeriodLabel()

ILIAS\News\NewsPeriodInfo::formatPeriodLabel ( int  $days)
private

Definition at line 75 of file NewsPeriodInfo.php.

75 : string
76 {
77 return match ($days) {
78 -1 => $this->lng->txt('no_limit'),
79 7 => "1 {$this->lng->txt('week')}",
80 30 => "1 {$this->lng->txt('month')}",
81 365, 366 => "1 {$this->lng->txt('year')}",
82 default => sprintf($this->lng->txt('news_period_x_days'), $days),
83 };
84 }

References ILIAS\Repository\lng().

Referenced by ILIAS\News\NewsPeriodInfo\getContainerObjectNewsPeriodLabel(), and ILIAS\News\NewsPeriodInfo\getDashboardNewsPeriodLabel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContainerObjectNewsPeriodLabel()

ILIAS\News\NewsPeriodInfo::getContainerObjectNewsPeriodLabel ( )
private

Definition at line 66 of file NewsPeriodInfo.php.

66 : string
67 {
68 $default_co_period = ilNewsItem::_lookupDefaultCOPeriod();
69
70 return $this->formatPeriodLabel(
71 (int) ($this->news_settings->get('news_co_period', (string) $default_co_period) ?? $default_co_period)
72 );
73 }
static _lookupDefaultCOPeriod()

References ilNewsItem\_lookupDefaultCOPeriod(), and ILIAS\News\NewsPeriodInfo\formatPeriodLabel().

+ Here is the call graph for this function:

◆ getDashboardNewsPeriodLabel()

ILIAS\News\NewsPeriodInfo::getDashboardNewsPeriodLabel ( )
private

Definition at line 61 of file NewsPeriodInfo.php.

61 : string
62 {
64 }
static _lookupDefaultPDPeriod()

References ilNewsItem\_lookupDefaultPDPeriod(), and ILIAS\News\NewsPeriodInfo\formatPeriodLabel().

+ Here is the call graph for this function:

◆ getPeriodInfo()

ILIAS\News\NewsPeriodInfo::getPeriodInfo ( )

Definition at line 35 of file NewsPeriodInfo.php.

35 : string
36 {
37 return implode('<br />', $this->getPeriodInfoLines());
38 }

References ILIAS\News\NewsPeriodInfo\getPeriodInfoLines().

+ Here is the call graph for this function:

◆ getPeriodInfoLines()

ILIAS\News\NewsPeriodInfo::getPeriodInfoLines ( )
private
Returns
list<string>

Definition at line 43 of file NewsPeriodInfo.php.

43 : array
44 {
45 $period_info = $this->lng->txt('news_old_period');
46
47 return [
48 sprintf(
49 $period_info,
50 $this->lng->txt('news_pd_period'),
51 $this->getDashboardNewsPeriodLabel()
52 ),
53 sprintf(
54 $period_info,
55 $this->lng->txt('news_co_period'),
56 $this->getContainerObjectNewsPeriodLabel()
57 ),
58 ];
59 }

References ILIAS\Repository\lng().

Referenced by ILIAS\News\NewsPeriodInfo\getPeriodInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: