19declare(strict_types=1);
35 protected bool $is_repository
49 bool $show_inactive =
false,
52 $ctrl = $this->gui->
ctrl();
53 $lng = $this->domain->lng();
54 if ($this->is_repository) {
57 $obj_id = $this->domain->getObjectIdForWspId($this->gui->standardRequest()->getWspId());
59 $settings = $this->domain->blogSettings()->getByObjId($obj_id);
61 if (!$show_inactive) {
62 $items = $this->domain->postingList($obj_id,
false)->getPostingsGroupedByMonth();
68 $max_months =
$settings->getNavModeListMonths();
70 $wtpl = new \ilTemplate(
"tpl.blog_list_navigation_by_date.html",
true,
true,
"components/ILIAS/Blog");
72 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"blpg",
"");
74 $counter = $mon_counter = $last_year = 0;
75 foreach ($items as $month => $postings) {
76 if (!$this->
isExport() && $max_months && $mon_counter >= $max_months) {
81 $year = substr((
string) $month, 0, 4);
82 if (!$last_year || $year != $last_year) {
90 $month_url = $this->link_builder->forMonth($month);
92 if ($mon_counter <= $settings->getNavModeListMonthsWithPostings()) {
94 $wtpl->setCurrentBlock(
"navigation_year_details");
95 $wtpl->setVariable(
"YEAR", $year);
96 $wtpl->parseCurrentBlock();
99 foreach ($postings as
$id => $posting) {
100 $caption = $posting->getTitle();
101 $url = $this->link_builder->forPosting($posting->getId());
102 if (!$posting->isActive()) {
103 $wtpl->setVariable(
"NAV_ITEM_DRAFT",
$lng->txt(
"blog_draft"));
104 } elseif (
$settings->getApproval() && !$posting->isApproved()) {
105 $wtpl->setVariable(
"NAV_ITEM_APPROVAL",
$lng->txt(
"blog_needs_approval"));
108 $wtpl->setCurrentBlock(
"navigation_item");
109 $wtpl->setVariable(
"NAV_ITEM_URL", $url);
110 $wtpl->setVariable(
"NAV_ITEM_CAPTION", $caption);
111 $wtpl->parseCurrentBlock();
114 $wtpl->setCurrentBlock(
"navigation_month_details");
115 $wtpl->setVariable(
"NAV_MONTH", $month_name);
116 $wtpl->setVariable(
"URL_MONTH", $month_url);
117 $wtpl->parseCurrentBlock();
122 $wtpl->setCurrentBlock(
"navigation_year");
123 $wtpl->setVariable(
"YEAR", $year);
124 $wtpl->parseCurrentBlock();
127 $wtpl->setCurrentBlock(
"navigation_month");
128 $wtpl->setVariable(
"MONTH_NAME", $month_name);
129 $wtpl->setVariable(
"URL_MONTH", $month_url);
130 $wtpl->setVariable(
"MONTH_COUNT", (
string) count($postings));
131 $wtpl->parseCurrentBlock();
134 $url = $this->link_builder->forMainList();
138 $this->gui->ui()->renderer()->render(
139 $this->gui->ui()->factory()->link()->standard(
140 $lng->txt(
"blog_starting_page"),
145 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"bmn", $this->gui->standardRequest()->getMonth());
146 $ctrl->setParameterByClass(\ilBlogPostingGUI::class,
"bmn",
"");
151 $wtpl = new \ilTemplate(
"tpl.blog_list_navigation_month.html",
true,
true,
"components/ILIAS/Blog");
153 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"blpg",
"");
155 $month_options = array();
156 foreach ($items as $month => $postings) {
157 $month_name = $this->gui->presentation()->util()->getMonthPresentation((
string) $month);
159 $month_options[(string) $month] = $month_name;
161 if ($month == $this->gui->standardRequest()->getMonth()) {
162 $month_url = $this->link_builder->forMonth($month);
164 foreach ($postings as
$id => $posting) {
165 $caption = $posting->getTitle();
166 $url = $this->link_builder->forPosting(
$id);
168 if (!$posting->isActive()) {
169 $wtpl->setVariable(
"NAV_ITEM_DRAFT",
$lng->txt(
"blog_draft"));
170 } elseif (
$settings->getApproval() && !$posting->isApproved()) {
171 $wtpl->setVariable(
"NAV_ITEM_APPROVAL",
$lng->txt(
"blog_needs_approval"));
174 $wtpl->setCurrentBlock(
"navigation_item");
175 $wtpl->setVariable(
"NAV_ITEM_URL", $url);
176 $wtpl->setVariable(
"NAV_ITEM_CAPTION", $caption);
177 $wtpl->parseCurrentBlock();
180 $wtpl->setCurrentBlock(
"navigation_month_details");
182 $wtpl->setVariable(
"NAV_MONTH", $month_name);
183 $wtpl->setVariable(
"URL_MONTH", $month_url);
185 $wtpl->parseCurrentBlock();
205 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"bmn", $this->gui->standardRequest()->getMonth());
206 $ctrl->setParameterByClass(\ilBlogPostingGUI::class,
"bmn",
"");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Link builder for static HTML export.
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected LinkBuilder $link_builder, protected bool $is_repository)
render(array $items, bool $show_inactive=false, int $blpg=0)
static _numericMonthToString(int $a_month, bool $a_long=true, ?ilLanguage $lng=null)
numeric month to string
static _lookupObjId(int $ref_id)
Interface for building links within the Blog component.