public function showArchive($confirmation_gui = '') { global $ilUser, $tpl, $ilTabs, $ilSetting, $rbacreview; $ilTabs->setSubTabActive('archive'); include_once 'Services/Payment/classes/class.ilShopNewsItemList.php'; include_once 'Services/Table/classes/class.ilTable2GUI.php'; $news_tpl = new ilTemplate('tpl.main_view.html', true, true, 'Services/Payment'); if ((int) strlen($confirmation_gui)) { $news_tpl->setVariable('CONFIRMATION', $confirmation_gui); } $tbl = new ilTable2GUI($this); $tbl->setId('shop_news_archive_tbl'); $tbl->setTitle($this->lng->txt('archive'), 'icon_news.png', $this->lng->txt('news')); $tbl->setRowTemplate('tpl.shop_news_row.html', 'Services/Payment'); $tbl->setFormAction($this->ctrl->getFormAction($this), 'showArchive'); $tbl->addColumn($this->lng->txt('archive'), 'title', '100%'); $oNewsList = ilShopNewsItemList::_getInstance(); $oNewsList->setMode(ilShopNewsItemList::TYPE_ARCHIVE)->setPublicSection($ilUser->getId() == ANONYMOUS_USER_ID)->setArchiveDate(time() - $ilSetting->get('payment_news_archive_period') * 24 * 60 * 60)->read(); $result = array(); if ($oNewsList->hasItems()) { $tbl->setEnableTitle(true); $tbl->setEnableHeader(true); $counter = 0; foreach ($oNewsList as $entry) { if ($entry->getVisibility() != 'public' && $ilUser->getId() == ANONYMOUS_USER_ID) { continue; } if (strtotime($entry->getCreationDate()) > time() - $ilSetting->get('payment_news_archive_period') * 24 * 60 * 60) { continue; } if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID) == true) { $this->ctrl->setParameter($this, 'news_id', $entry->getId()); $result[$counter]['news_id'] = $entry->getId(); $result[$counter]['edit_src'] = $this->ctrl->getLinkTarget($this, 'editArchiveNews'); $result[$counter]['edit_txt'] = $this->lng->txt('edit'); $result[$counter]['delete_src'] = $this->ctrl->getLinkTarget($this, 'confirmDeleteArchiveNews'); $result[$counter]['delete_txt'] = $this->lng->txt('delete'); $this->ctrl->clearParameters($this); } $result[$counter]['creation_date'] = ilDatePresentation::formatDate(new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME)); $result[$counter]['title'] = $entry->getTitle(); $result[$counter]['content'] = $entry->getContent(); $result[$counter]['user_id'] = $entry->getUserId(); $result[$counter]['author'] = $ilUser->getLogin(); $result[$counter]['creation_date'] = ilDatePresentation::formatDate(new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME)); $result[$counter]['update_date'] = ilDatePresentation::formatDate(new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME)); $result[$counter]['txt_author'] = $this->lng->txt('author'); $result[$counter]['txt_creation_date'] = $this->lng->txt('create_date'); $result[$counter]['txt_update_date'] = $this->lng->txt('last_update'); $this->ctrl->clearParameters($this); ++$counter; } } else { $tbl->setNoEntriesText($this->lng->txt('payment_news_no_news_items')); } $tbl->setData($result); $news_tpl->setVariable('TABLE', $tbl->getHTML()); $tpl->setContent($news_tpl->get()); }