4 include_once(
"Services/News/classes/class.ilNewsForContextBlockGUI.php");
29 $this->lng = $DIC->language();
30 $this->
user = $DIC->user();
31 $this->access = $DIC->access();
32 $this->ctrl = $DIC->ctrl();
34 $lng = $DIC->language();
36 $ilAccess = $DIC->access();
41 $lng->loadLanguageModule(
"news");
42 include_once(
"./Services/News/classes/class.ilNewsItem.php");
47 $this->dynamic =
false;
49 include_once(
"./Services/News/classes/class.ilNewsCache.php");
51 $cres = unserialize($this->acache->getEntry(
$ilUser->getId() .
":0"));
52 $this->cache_hit =
false;
53 if ($this->acache->getLastAccessStatus() ==
"hit" && is_array($cres)) {
56 $this->cache_hit =
true;
59 if ($this->
getDynamic() && !$this->cache_hit) {
60 $this->dynamic =
true;
66 if (empty(self::$st_data)) {
68 $data = self::$st_data;
70 $data = self::$st_data;
77 $this->
setRowTemplate(
"tpl.block_row_news_for_context.html",
"Services/News");
84 $ilAccess->setResults($this->acc_results);
94 include_once(
"./Services/News/classes/class.ilNewsCache.php");
105 $this->acache->storeEntry(
120 return self::$block_type;
143 if ($cmd ==
"post" && is_array(
$_POST[
"cmd"])) {
144 $cmd = array_pop(array_keys(
$_POST[
"cmd"]));
151 case "changeFeedSettings":
166 $next_class =
$ilCtrl->getNextClass();
167 $cmd =
$ilCtrl->getCmd(
"getHTML");
169 switch ($next_class) {
171 return $this->$cmd();
180 if ($this->dynamic) {
183 parent::fillDataSection();
186 if (count($this->
getData()) == 0) {
206 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
207 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
208 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
209 $enable_private_feed = $news_set->get(
"enable_private_feed");
212 include_once(
"./Services/News/classes/class.ilNewsSubscription.php");
215 if ($enable_internal_rss) {
216 include_once(
"./Services/News/classes/class.ilRSSButtonGUI.php");
218 $ilCtrl->getLinkTarget($this,
"showFeedUrl"),
219 $lng->txt(
"news_get_feed_url"),
228 if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed) {
230 $ilCtrl->getLinkTarget($this,
"editSettings"),
231 $lng->txt(
"settings")
241 case 5: $per_str = sprintf(
$lng->txt(
"news_period_x_days"), $per);
break;
242 case 7: $per_str =
$lng->txt(
"news_period_1_week");
break;
243 case 14: $per_str = sprintf(
$lng->txt(
"news_period_x_weeks"), 2);
break;
244 case 30: $per_str =
$lng->txt(
"news_period_1_month");
break;
245 case 60: $per_str = sprintf(
$lng->txt(
"news_period_x_months"), 2);
break;
246 case 120: $per_str = sprintf(
$lng->txt(
"news_period_x_months"), 4);
break;
247 case 180: $per_str = sprintf(
$lng->txt(
"news_period_x_months"), 6);
break;
248 case 366: $per_str =
$lng->txt(
"news_period_1_year");
break;
250 if ($per_str !=
"") {
251 $this->
setTitle($this->
getTitle() .
' <span style="font-weight:normal;">- ' . $per_str .
"</span>");
260 if (
$ilUser->getPref(
"il_feed_js") ==
"n") {
281 include_once(
"./Services/News/classes/class.ilNewsItem.php");
283 if ($news_set->get(
"enable_private_feed")) {
284 $tpl =
new ilTemplate(
"tpl.show_priv_feed_url.html",
true,
true,
"Services/News");
286 $tpl->setVariable(
"TXT_PRIV_TITLE",
$lng->txt(
"news_get_priv_feed_title"));
290 $tpl->setVariable(
"TXT_PRIV_INFO",
$lng->txt(
"news_get_priv_feed_info"));
291 $tpl->setVariable(
"TXT_PRIV_FEED_URL",
$lng->txt(
"news_feed_url"));
294 str_replace(
"://",
"://" .
$ilUser->getLogin() .
":-password-@", ILIAS_HTTP_PATH) .
"/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) .
"&user_id=" .
$ilUser->getId() .
298 "VAL_PRIV_FEED_URL_TXT",
299 str_replace(
"://",
"://" .
$ilUser->getLogin() .
":-password-@", ILIAS_HTTP_PATH) .
"/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) .
"&<br />user_id=" .
$ilUser->getId() .
303 $tpl->setVariable(
"TXT_PRIV_INFO",
$lng->txt(
"news_inactive_private_feed_info"));
304 $tpl->setVariable(
"EDIT_SETTINGS_URL",
$ilCtrl->getLinkTarget($this,
"editSettings"));
305 $tpl->setVariable(
"EDIT_SETTINGS_TXT",
$lng->txt(
"news_edit_news_settings"));
308 $tpl =
new ilTemplate(
"tpl.show_feed_url.html",
true,
true,
"Services/News");
310 $tpl->setVariable(
"TXT_TITLE",
$lng->txt(
"news_get_feed_title"));
311 $tpl->setVariable(
"TXT_INFO",
$lng->txt(
"news_get_feed_info"));
312 $tpl->setVariable(
"TXT_FEED_URL",
$lng->txt(
"news_feed_url"));
315 ILIAS_HTTP_PATH .
"/feed.php?client_id=" . rawurlencode(CLIENT_ID) .
"&user_id=" .
$ilUser->getId() .
320 ILIAS_HTTP_PATH .
"/feed.php?client_id=" . rawurlencode(CLIENT_ID) .
"&<br />user_id=" .
$ilUser->getId() .
324 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
326 $content_block->setContent(
$tpl->get());
327 $content_block->setTitle(
$lng->txt(
"news_internal_news"));
328 $content_block->addHeaderCommand(
329 $ilCtrl->getParentReturn($this),
330 $lng->txt(
"selected_items_back")
333 return $content_block->getHTML();
341 $a_content_block->addHeaderCommand(
342 $ilCtrl->getParentReturn($this),
343 $lng->txt(
"selected_items_back")
359 return parent::showNews();
373 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
374 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
375 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
376 $enable_private_feed = $news_set->get(
"enable_private_feed");
378 if (!$a_private_form && ($allow_shorter_periods || $allow_longer_periods)) {
379 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
382 $form->setTitle(
$lng->txt(
"news_settings"));
384 include_once(
"./Services/News/classes/class.ilNewsItem.php");
388 $form->setTableWidth(
"100%");
391 2 =>
"2 " .
$lng->txt(
"days"),
392 3 =>
"3 " .
$lng->txt(
"days"),
393 5 =>
"5 " .
$lng->txt(
"days"),
394 7 =>
"1 " .
$lng->txt(
"week"),
395 14 =>
"2 " .
$lng->txt(
"weeks"),
396 30 =>
"1 " .
$lng->txt(
"month"),
397 60 =>
"2 " .
$lng->txt(
"months"),
398 120 =>
"4 " .
$lng->txt(
"months"),
399 180 =>
"6 " .
$lng->txt(
"months"),
400 366 =>
"1 " .
$lng->txt(
"year"));
403 foreach ($per_opts as $k => $opt) {
404 if (!$allow_shorter_periods && ($k < $default_per)) {
407 if (!$allow_longer_periods && ($k > $default_per)) {
411 foreach ($unset as $k) {
412 unset($per_opts[$k]);
416 $lng->txt(
"news_pd_period"),
421 $per_sel->setValue((
int) $per);
422 $form->addItem($per_sel);
431 $form->addCommandButton(
"saveSettings",
$lng->txt(
"save"));
432 $form->addCommandButton(
"cancelSettings",
$lng->txt(
"cancel"));
434 $returnForm =
$form->getHTML();
437 if ($enable_private_feed) {
438 if (!$a_private_form) {
441 $returnForm .= ($returnForm==
"")
442 ? $a_private_form->getHTML()
443 :
"<br>" . $a_private_form->getHTML();
455 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
457 $feed_form->setFormAction(
$ilCtrl->getFormaction($this));
458 $feed_form->setTitle(
$lng->txt(
"priv_feed_settings"));
460 $feed_form->setTableWidth(
"100%");
462 $enable_private_feed =
new ilCheckboxInputGUI(
$lng->txt(
"news_enable_private_feed"),
"enable_private_feed");
464 $feed_form->addItem($enable_private_feed);
469 $enable_private_feed->addSubItem($passwd);
471 $feed_form->addCommandButton(
"changeFeedSettings",
$lng->txt(
"save"));
472 $feed_form->addCommandButton(
"cancelSettings",
$lng->txt(
"cancel"));
484 $ilCtrl->returnToParent($this);
496 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
506 include_once(
"./Services/News/classes/class.ilNewsCache.php");
508 $cache->deleteEntry(
$ilUser->getId() .
":0");
510 $ilCtrl->returnToParent($this);
523 if (
$form->checkInput()) {
525 if (!
$form->getInput(
"enable_private_feed")) {
529 $ilCtrl->redirect($this,
"showFeedUrl");
531 $passwd =
$form->getInput(
"desired_password");
532 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
534 $form->getItemByPostVar(
"desired_password")->setAlert(
$lng->txt(
"passwd_equals_ilpasswd"));
540 $ilCtrl->redirect($this,
"showFeedUrl");
545 $form->setValuesByPost();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initPrivateSettingsForm()
__construct()
Constructor.
fillDataSection()
Fill data section.
static _getNewsItemsOfUser( $a_user_id, $a_only_public=false, $a_prevent_aggregation=false, $a_per=0, &$a_cnt=null)
Get all news items for a user.
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
getOverview()
Get overview.
handleView()
Handles show/hide notification view and removes notifications if hidden.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setFooterInfo($a_footerinfo, $a_hide_and_icon=false)
Set Footer Info.
static _lookupUserPDPeriod($a_user_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
editSettings()
Show settings screen.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
BlockGUI class for block NewsForContext.
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
editSettings(ilPropertyFormGUI $a_private_form=null)
Show settings screen.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
static getScreenMode()
Get Screen Mode for current command.
showFeedUrl()
Show feed URL.
saveSettings()
Save settings.
if(isset($_POST['submit'])) $form
setTitle($a_title)
Set Title.
setData($a_data)
Set Data.
special template class to simplify handling of ITX/PEAR
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
cancelSettings()
Cancel settings.
Create styles array
The data for the language used.
__construct()
Constructor.
getHTML()
Handle config status.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getNewsData()
Get news for context.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
addCloseCommand($a_content_block)
setLimit($a_limit)
Set Limit.
static isRepositoryObject()
Is block used in repository object?
static getBlockType()
Get block type.
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
BlockGUI class for (centered) Content on Personal Desktop.
changeFeedSettings()
change user password
BlockGUI class for block NewsForContext.
executeCommand()
execute command
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
static getInstance()
Single method to reduce footprint (included files, created instances)
static _lookupDefaultPDPeriod()
getCurrentDetailLevel()
Get Current Detail Level.
getHTML()
Get bloch HTML code.