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();
37 $this->obj_definition = $DIC[
"objDefinition"];
42 $lng->loadLanguageModule(
"news");
43 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;
75 $this->
setRowTemplate(
"tpl.block_row_news_for_context.html",
"Services/News");
82 $ilAccess->setResults($this->acc_results);
94 include_once(
"./Services/News/classes/class.ilNewsCache.php");
105 $this->acache->storeEntry(
118 return self::$block_type;
136 $ilCtrl = $DIC->ctrl();
139 if ($cmd ==
"post" && is_array(
$_POST[
"cmd"])) {
140 $cmd = array_pop(array_keys(
$_POST[
"cmd"]));
147 case "changeFeedSettings":
162 $next_class = $ilCtrl->getNextClass();
163 $cmd = $ilCtrl->getCmd(
"getHTML");
165 switch ($next_class) {
167 return $this->$cmd();
176 if ($this->dynamic) {
178 } elseif (count($this->
getData()) > 0) {
179 parent::fillDataSection();
199 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
200 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
201 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
202 $enable_private_feed = $news_set->get(
"enable_private_feed");
205 include_once(
"./Services/News/classes/class.ilNewsSubscription.php");
208 if ($enable_internal_rss) {
209 include_once(
"./Services/News/classes/class.ilRSSButtonGUI.php");
212 $ilCtrl->getLinkTarget($this,
"showFeedUrl"),
213 $lng->txt(
"news_get_feed_url")
217 if ($allow_shorter_periods || $allow_longer_periods || $enable_private_feed) {
219 $ilCtrl->getLinkTarget($this,
"editSettings"),
220 $lng->txt(
"settings")
225 if (
$ilUser->getPref(
"il_feed_js") ==
"n") {
246 include_once(
"./Services/News/classes/class.ilNewsItem.php");
248 if ($news_set->get(
"enable_private_feed")) {
249 $tpl =
new ilTemplate(
"tpl.show_priv_feed_url.html",
true,
true,
"Services/News");
251 $tpl->setVariable(
"TXT_PRIV_TITLE",
$lng->txt(
"news_get_priv_feed_title"));
255 $tpl->setVariable(
"TXT_PRIV_INFO",
$lng->txt(
"news_get_priv_feed_info"));
256 $tpl->setVariable(
"TXT_PRIV_FEED_URL",
$lng->txt(
"news_feed_url"));
259 str_replace(
"://",
"://" .
$ilUser->getLogin() .
":-password-@", ILIAS_HTTP_PATH) .
"/privfeed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&user_id=" .
$ilUser->getId() .
263 "VAL_PRIV_FEED_URL_TXT",
264 str_replace(
"://",
"://" .
$ilUser->getLogin() .
":-password-@", ILIAS_HTTP_PATH) .
"/privfeed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&<br />user_id=" .
$ilUser->getId() .
268 $tpl->setVariable(
"TXT_PRIV_INFO",
$lng->txt(
"news_inactive_private_feed_info"));
269 $tpl->setVariable(
"EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this,
"editSettings"));
270 $tpl->setVariable(
"EDIT_SETTINGS_TXT",
$lng->txt(
"news_edit_news_settings"));
273 $tpl =
new ilTemplate(
"tpl.show_feed_url.html",
true,
true,
"Services/News");
275 $tpl->setVariable(
"TXT_TITLE",
$lng->txt(
"news_get_feed_title"));
276 $tpl->setVariable(
"TXT_INFO",
$lng->txt(
"news_get_feed_info"));
277 $tpl->setVariable(
"TXT_FEED_URL",
$lng->txt(
"news_feed_url"));
280 ILIAS_HTTP_PATH .
"/feed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&user_id=" .
$ilUser->getId() .
285 ILIAS_HTTP_PATH .
"/feed.php?client_id=" . rawurlencode(
CLIENT_ID) .
"&<br />user_id=" .
$ilUser->getId() .
290 $content_block->setContent(
$tpl->get());
291 $content_block->setTitle(
$lng->txt(
"news_internal_news"));
293 return $content_block->getHTML();
307 return parent::showNews();
321 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
322 $allow_shorter_periods = $news_set->get(
"allow_shorter_periods");
323 $allow_longer_periods = $news_set->get(
"allow_longer_periods");
324 $enable_private_feed = $news_set->get(
"enable_private_feed");
326 if (!$a_private_form && ($allow_shorter_periods || $allow_longer_periods)) {
327 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
329 $form->setFormAction($ilCtrl->getFormaction($this));
330 $form->setTitle(
$lng->txt(
"news_settings"));
332 include_once(
"./Services/News/classes/class.ilNewsItem.php");
336 $form->setTableWidth(
"100%");
339 2 =>
"2 " .
$lng->txt(
"days"),
340 3 =>
"3 " .
$lng->txt(
"days"),
341 5 =>
"5 " .
$lng->txt(
"days"),
342 7 =>
"1 " .
$lng->txt(
"week"),
343 14 =>
"2 " .
$lng->txt(
"weeks"),
344 30 =>
"1 " .
$lng->txt(
"month"),
345 60 =>
"2 " .
$lng->txt(
"months"),
346 120 =>
"4 " .
$lng->txt(
"months"),
347 180 =>
"6 " .
$lng->txt(
"months"),
348 366 =>
"1 " .
$lng->txt(
"year"));
351 foreach ($per_opts as $k => $opt) {
352 if (!$allow_shorter_periods && ($k < $default_per)) {
355 if (!$allow_longer_periods && ($k > $default_per)) {
359 foreach ($unset as $k) {
360 unset($per_opts[$k]);
364 $lng->txt(
"news_pd_period"),
368 $per_sel->setOptions($per_opts);
369 $per_sel->setValue((
int) $per);
370 $form->addItem($per_sel);
379 $form->addCommandButton(
"saveSettings",
$lng->txt(
"save"));
380 $form->addCommandButton(
"cancelSettings",
$lng->txt(
"cancel"));
382 $returnForm = $form->getHTML();
385 if ($enable_private_feed) {
386 if (!$a_private_form) {
389 $returnForm .= ($returnForm ==
"")
390 ? $a_private_form->getHTML()
391 :
"<br>" . $a_private_form->getHTML();
403 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
405 $feed_form->setFormAction($ilCtrl->getFormaction($this));
406 $feed_form->setTitle(
$lng->txt(
"priv_feed_settings"));
408 $feed_form->setTableWidth(
"100%");
410 $enable_private_feed =
new ilCheckboxInputGUI(
$lng->txt(
"news_enable_private_feed"),
"enable_private_feed");
412 $feed_form->addItem($enable_private_feed);
417 $enable_private_feed->addSubItem($passwd);
419 $feed_form->addCommandButton(
"changeFeedSettings",
$lng->txt(
"save"));
420 $feed_form->addCommandButton(
"cancelSettings",
$lng->txt(
"cancel"));
432 $ilCtrl->returnToParent($this);
444 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
454 include_once(
"./Services/News/classes/class.ilNewsCache.php");
456 $cache->deleteEntry(
$ilUser->getId() .
":0");
458 $ilCtrl->returnToParent($this);
471 if ($form->checkInput()) {
473 if (!$form->getInput(
"enable_private_feed")) {
475 ilUtil::sendSuccess(
$lng->txt(
"priv_feed_disabled"),
true);
477 $ilCtrl->redirect($this,
"showFeedUrl");
479 $passwd = $form->getInput(
"desired_password");
480 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
482 $form->getItemByPostVar(
"desired_password")->setAlert(
$lng->txt(
"passwd_equals_ilpasswd"));
486 ilUtil::sendSuccess(
$lng->txt(
"saved_successfully"),
true);
488 $ilCtrl->redirect($this,
"showFeedUrl");
493 $form->setValuesByPost();
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.
static _lookupUserPDPeriod($a_user_id)
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.
setTitle($a_title)
Set Title.
setData($a_data)
Set Data.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
cancelSettings()
Cancel settings.
__construct()
Constructor.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getNewsData()
Get news for context.
setLimit($a_limit)
Set Limit.
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.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
executeCommand()
execute command
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
static getInstance()
Single method to reduce footprint (included files, created instances)
setPresentation(int $type)
Set presentation.
static _lookupDefaultPDPeriod()
getHTML()
Get bloch HTML code.