27 protected \ILIAS\News\InternalGUIService
$gui;
40 string $a_selected_context
44 $this->
ctrl = $DIC->ctrl();
45 $this->
lng = $DIC->language();
46 $this->
user = $DIC->user();
47 $ilCtrl = $DIC->ctrl();
48 $this->std_request = $DIC->news()
55 $this->contexts = $a_contexts;
56 $this->selected_context = $a_selected_context;
60 "tpl.table_row_pd_news.html",
61 "components/ILIAS/News" 69 $this->gui = $DIC->news()->internal()->gui();
82 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
83 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
87 2 => sprintf(
$lng->
txt(
"news_period_x_days"), 2),
88 3 => sprintf(
$lng->
txt(
"news_period_x_days"), 3),
89 5 => sprintf(
$lng->
txt(
"news_period_x_days"), 5),
90 7 =>
$lng->
txt(
"news_period_1_week"),
91 14 => sprintf(
$lng->
txt(
"news_period_x_weeks"), 2),
92 30 =>
$lng->
txt(
"news_period_1_month"),
93 60 => sprintf(
$lng->
txt(
"news_period_x_months"), 2),
94 120 => sprintf(
$lng->
txt(
"news_period_x_months"), 4),
95 180 => sprintf(
$lng->
txt(
"news_period_x_months"), 6),
96 366 =>
$lng->
txt(
"news_period_1_year")
100 foreach ($options as $k => $opt) {
101 if (!$allow_shorter_periods && ($k < $default_per)) {
104 if (!$allow_longer_periods && ($k > $default_per)) {
108 foreach ($unset as $k) {
114 $si->setValue((
string) $per);
120 $si->setValue($this->selected_context);
124 protected function fillRow(array $a_set): void
130 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
138 if ($a_set[
"user_id"] > 0) {
139 $this->tpl->setCurrentBlock(
"user_info");
140 if ($obj_type ===
"frm") {
142 if ($a_set[
"context_sub_obj_type"] ===
"pos" &&
143 $a_set[
"context_sub_obj_id"] > 0) {
145 if (is_string(
$post->getUserAlias()) &&
$post->getUserAlias() !==
'') {
148 $this->tpl->setVariable(
"VAL_AUTHOR",
$lng->
txt(
"forums_anonymous"));
151 $this->tpl->setVariable(
"VAL_AUTHOR",
$lng->
txt(
"forums_anonymous"));
154 $user_obj =
new ilObjUser((
int) $a_set[
"user_id"]);
155 $this->tpl->setVariable(
"VAL_AUTHOR", $user_obj->getLogin());
160 $this->tpl->setVariable(
"TXT_AUTHOR",
$lng->
txt(
"author"));
161 $this->tpl->parseCurrentBlock();
168 $med = $mob->getMediaItem(
"Standard");
172 if ($enable_internal_rss) {
173 $this->tpl->setCurrentBlock(
"access");
174 $this->tpl->setVariable(
"TXT_ACCESS",
$lng->
txt(
"news_news_item_visibility"));
176 ((
int) $a_set[
"priority"] === 0 &&
179 "public_notifications",
183 $this->tpl->setVariable(
"VAL_ACCESS",
$lng->
txt(
"news_visibility_public"));
185 $this->tpl->setVariable(
"VAL_ACCESS",
$lng->
txt(
"news_visibility_users"));
187 $this->tpl->parseCurrentBlock();
191 if ($a_set[
"content"] !=
"") {
192 $this->tpl->setCurrentBlock(
"content");
193 $this->tpl->setVariable(
197 $a_set[
"context_obj_type"],
199 (
bool) $a_set[
"content_text_is_lang_var"]
203 $this->tpl->parseCurrentBlock();
205 if ($a_set[
"content_long"] !=
"") {
206 $this->tpl->setCurrentBlock(
"long");
208 $this->tpl->parseCurrentBlock();
210 if ($a_set[
"update_date"] != $a_set[
"creation_date"]) {
211 $this->tpl->setCurrentBlock(
"ni_update");
212 $this->tpl->setVariable(
"TXT_LAST_UPDATE",
$lng->
txt(
"last_update"));
213 $this->tpl->setVariable(
217 $this->tpl->parseCurrentBlock();
222 if ($obj_type ===
"frm" && $a_set[
"context_sub_obj_type"] ===
"pos" 223 && $a_set[
"context_sub_obj_id"] > 0) {
224 $pos = $a_set[
"context_sub_obj_id"];
227 $add =
"_" . $thread .
"_" . $pos;
232 if ($obj_type ===
"file") {
233 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $a_set[
"ref_id"]);
234 $url = $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
"sendfile");
235 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->std_request->getRefId());
237 $button = $this->gui->button(
238 $this->
lng->txt(
"download"),
242 $this->tpl->setCurrentBlock(
"download");
243 $this->tpl->setVariable(
"BUTTON_DOWNLOAD", $button->render());
244 $this->tpl->parseCurrentBlock();
248 if ($obj_type ===
"wiki" && $a_set[
"context_sub_obj_type"] ===
"wpg" 249 && $a_set[
"context_sub_obj_id"] > 0) {
251 if ($wptitle !=
"") {
257 $url_target =
"./goto.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&target=" .
258 $obj_type .
"_" . $a_set[
"ref_id"] . $add;
261 if ($a_set[
"context_sub_obj_type"] ===
"pg" &&
262 $a_set[
"context_sub_obj_id"] > 0 &&
263 in_array($obj_type, [
"dbk",
"lm"],
true)) {
264 $url_target =
"./goto.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&target=" .
265 "pg_" . $a_set[
"context_sub_obj_id"] .
"_" . $a_set[
"ref_id"];
269 $this->tpl->setCurrentBlock(
"context");
271 $cont_loc->addContextItems($a_set[
"ref_id"],
true);
272 $this->tpl->setVariable(
276 $this->tpl->setVariable(
"HREF_CONTEXT_TITLE", $url_target);
277 $this->tpl->setVariable(
"CONTEXT_TITLE", $obj_title);
278 $this->tpl->setVariable(
282 $this->tpl->setVariable(
286 $this->tpl->parseCurrentBlock();
288 $this->tpl->setVariable(
"HREF_TITLE", $url_target);
291 $this->tpl->setVariable(
297 $this->tpl->setVariable(
301 $this->tpl->setVariable(
"TXT_CREATED",
$lng->
txt(
"created"));
303 $this->tpl->parseCurrentBlock();
310 if (is_int(strpos($a_str,
">")) && is_int(strpos($a_str,
"<"))) {
static get(string $a_var)
static determineNewsContent(string $a_context_obj_type, string $a_content, bool $a_is_lang_var, ?ilLanguage $lng=null)
Determine new content.
static _lookupUserPDPeriod(int $a_user_id)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
ILIAS News InternalGUIService $gui
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setEnableTitle(bool $a_enabletitle)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static lookupTitle(int $a_page_id, string $lang="-")
makeClickable(string $a_str)
Personal desktop news table.
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _isAnonymized(int $a_obj_id)
setIsDataTable(bool $a_val)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
__construct(ilPDNewsGUI $a_parent_obj, string $a_parent_cmd, array $a_contexts, string $a_selected_context)
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
static _lookupTitle(int $obj_id)
setDefaultOrderField(string $a_defaultorderfield)
StandardGUIRequest $std_request
static determineNewsTitle(string $a_context_obj_type, string $a_title, bool $a_content_is_lang_var, int $a_agg_ref_id=0, array $a_aggregation=[], ?ilLanguage $lng=null)
Determine title for news item entry.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
static _getThreadForPosting(int $a_pos_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeUrlTitle(string $a_par)
__construct(Container $dic, ilPlugin $plugin)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
static _lookupType(int $id, bool $reference=false)
static makeClickable(string $a_text, bool $detectGotoLinks=false)
setEnableHeader(bool $a_enableheader)
static _lookupDefaultPDPeriod()
static _lookupLogin(int $a_user_id)