4include_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();
 
   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)) {
 
   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(
 
  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");
 
  411        $enable_private_feed->setChecked(
$ilUser->_getFeedPass(
$ilUser->getId()));
 
  412        $feed_form->addItem($enable_private_feed);
 
  415        $passwd->setRequired(
true);
 
  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();
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
setData($a_data)
Set Data.
setPresentation(int $type)
Set presentation.
__construct()
Constructor.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
setTitle($a_title)
Set Title.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
BlockGUI class for (centered) Content on Personal Desktop.
BlockGUI class for block NewsForContext.
editSettings()
Show settings screen.
handleView()
Handles show/hide notification view and removes notifications if hidden.
getOverview()
Get overview.
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
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 _lookupUserPDPeriod($a_user_id)
static _lookupDefaultPDPeriod()
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
BlockGUI class for block NewsForContext.
executeCommand()
execute command
getNewsData()
Get news for context.
cancelSettings()
Cancel settings.
changeFeedSettings()
change user password
getHTML()
Get bloch HTML code.
saveSettings()
Save settings.
fillDataSection()
Fill data section.
showFeedUrl()
Show feed URL.
isRepositoryObject()
Returns whether block has a corresponding repository object.bool
__construct()
Constructor.
static getScreenMode()
Get Screen Mode for current command.
editSettings(ilPropertyFormGUI $a_private_form=null)
Show settings screen.
initPrivateSettingsForm()
special template class to simplify handling of ITX/PEAR
static getInstance()
Single method to reduce footprint (included files, created instances)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()