5include_once 
'Services/Payment/classes/class.ilShopBaseGUI.php';
 
    6include_once 
'Services/Payment/classes/class.ilShopNewsItem.php';
 
    7include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
   28                parent::__construct();
 
   32                $this->lng->loadLanguageModule(
'news');
 
   39                $cmd = $this->ctrl->getCmd();
 
   58                global $ilTabs, 
$ilUser, $rbacreview;
 
   60                $ilTabs->addSubTabTarget(
'news', $this->ctrl->getLinkTarget($this, 
'showNews'), 
'', 
'', 
'',
'showNews');
 
   61                $ilTabs->addSubTabTarget(
'archive', $this->ctrl->getLinkTarget($this, 
'showArchive'), 
'', 
'', 
'',
'archive');
 
   63                if($rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
   65                        $ilTabs->addSubTabTarget(
'settings', $this->ctrl->getLinkTarget($this, 
'showSettings'), 
'', 
'', 
'',
'settings');
 
   73                if(!$rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
   75                        $this->ilErr->raiseError($this->lng->txt(
'permission_denied'), $this->ilErr->MESSAGE);
 
   78                $ilTabs->setSubTabActive(
'settings');
 
   81                if($this->settings_form->checkInput())
 
   83                        $ilSetting->set(
'payment_news_archive_period', $this->settings_form->getInput(
'archive_period'));
 
   87                        return $this->tpl->setVariable(
'ADM_CONTENT', $this->settings_form->getHtml());
 
   91                        $this->form_gui->setValuesByPost();
 
   92                        return $this->tpl->setVariable(
'ADM_CONTENT', $this->settings_form->getHtml());
 
  100                $this->settings_form->setTitle($this->lng->txt(
'payment_news_settings'));
 
  102                $oSelectBox = 
new ilSelectInputGUI($this->lng->txt(
'payment_news_archive_period'), 
'archive_period');
 
  103                $oSelectBox->setInfo($this->lng->txt(
'payment_news_archive_period_info'));
 
  105                for($i = 5; $i <= 100; $i += 5)
 
  110                $this->settings_form->addItem($oSelectBox);
 
  112                $this->settings_form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
 
  113                $this->settings_form->addCommandButton(
'showNews', $this->lng->txt(
'cancel'));
 
  114                $this->settings_form->setFormAction($this->ctrl->getFormaction($this, 
'saveSettings'));
 
  119                global $ilTabs, 
$ilUser, $rbacreview;
 
  121                if(!$rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
  123                        $this->ilErr->raiseError($this->lng->txt(
'permission_denied'),$this->ilErr->MESSAGE);
 
  126                $ilTabs->setSubTabActive(
'settings');
 
  131                return $this->tpl->setVariable(
'ADM_CONTENT', $this->settings_form->getHtml());
 
  138                if(!$rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
  140                        $this->ilErr->raiseError($this->lng->txt(
'permission_denied'),$this->ilErr->MESSAGE);
 
  144                if ($this->form_gui->checkInput())
 
  146                        $this->oCurrentNewsItem->setTitle($this->form_gui->getInput(
'news_title'));
 
  147                        $this->oCurrentNewsItem->setContent($this->form_gui->getInput(
'news_content'));
 
  148                        $this->oCurrentNewsItem->setVisibility($this->form_gui->getInput(
'news_visibility'));
 
  149                        $this->oCurrentNewsItem->setUserId(
$ilUser->getId());
 
  150                        $this->oCurrentNewsItem->create();
 
  157                        $this->form_gui->setValuesByPost();
 
  158                        return $this->tpl->setVariable(
'ADM_CONTENT', $this->form_gui->getHtml());
 
  164                return $this->
update(
'archive');
 
  169                return $this->
update(
'news');
 
  176                if(!$rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
  178                        $this->ilErr->raiseError($this->lng->txt(
'permission_denied'),$this->ilErr->MESSAGE);
 
  183                if ($this->form_gui->checkInput())
 
  185                        $this->oCurrentNewsItem->setTitle($this->form_gui->getInput(
'news_title'));
 
  186                        $this->oCurrentNewsItem->setContent($this->form_gui->getInput(
'news_content'));
 
  187                        $this->oCurrentNewsItem->setVisibility($this->form_gui->getInput(
'news_visibility'));
 
  188                        $this->oCurrentNewsItem->setUserId(
$ilUser->getId());
 
  190                        $this->oCurrentNewsItem->update();
 
  194                        if($view == 
'archive')
 
  206                        $this->form_gui->setValuesByPost();
 
  207                        return $this->tpl->setVariable(
'ADM_CONTENT', $this->form_gui->getHtml());
 
  225                if(!$rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
  227                        $this->ilErr->raiseError($this->lng->txt(
'permission_denied'),$this->ilErr->MESSAGE);
 
  230                if(!(
int)
$_POST[
'news_id'])
 
  247                        $this->oCurrentNewsItem->setId(
$_POST[
'news_id']);
 
  248                        $this->oCurrentNewsItem->delete();
 
  279                if(!$rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
  281                        $this->ilErr->raiseError($this->lng->txt(
'permission_denied'),$this->ilErr->MESSAGE);
 
  284                if(!isset(
$_GET[
'news_id']))
 
  300                include_once 
'Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  302                $c_gui->setHeaderText($this->lng->txt(
'payment_news_delete_sure'));             
 
  303                $c_gui->addHiddenItem(
'news_id', (
int)
$_GET[
'news_id']);                
 
  306                $title=$oNewsItem->getTitle();
 
  307                $c_gui->addItem($title, 
$_GET[
'news_id'],$title);
 
  313                                $c_gui->setFormAction($this->ctrl->getFormAction($this, 
'performDeleteArchiveNews'));
 
  314                                $c_gui->setConfirm($this->lng->txt(
'confirm'), 
'performDeleteArchiveNews');
 
  315                                $c_gui->setCancel($this->lng->txt(
'cancel'), 
'showArchive');
 
  321                                $c_gui->setFormAction($this->ctrl->getFormAction($this, 
'performDeleteNews'));
 
  322                                $c_gui->setConfirm($this->lng->txt(
'confirm'), 
'performDeleteNews');
 
  323                                $c_gui->setCancel($this->lng->txt(
'cancel'), 
'showNews');
 
  333                global $ilTabs, $rbacreview, 
$ilUser;
 
  335                if(!$rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID))
 
  337                        $this->ilErr->raiseError($this->lng->txt(
'permission_denied'),$this->ilErr->MESSAGE);
 
  340                if($view == 
'archive')
 
  342                        $ilTabs->setSubTabActive(
'archive');
 
  346                        $ilTabs->setSubTabActive(
'news');       
 
  350                $this->form_gui->setTitle($this->lng->txt(
'shopnews_settings'));
 
  353                $text_input = 
new ilTextInputGUI($this->lng->txt(
'news_news_item_title'), 
'news_title');
 
  354                $text_input->setInfo(
'');
 
  355                $text_input->setRequired(
true);
 
  356                $text_input->setMaxLength(200);
 
  357                $text_input->setSize(93);
 
  359                $this->form_gui->addItem($text_input);
 
  362                $text_area = 
new ilTextAreaInputGUI($this->lng->txt(
'news_news_item_content'), 
'news_content');
 
  363                $text_area->setInfo(
'');
 
  364                $text_area->setRequired(
false);
 
  365                $text_area->setCols(90);
 
  366                $text_area->setRows(10);
 
  367                $this->form_gui->addItem($text_area);
 
  370                $radio_group = 
new ilRadioGroupInputGUI($this->lng->txt(
'news_news_item_visibility'), 
'news_visibility');
 
  371                $radio_option = 
new ilRadioOption($this->lng->txt(
'news_visibility_users'), 
'users');
 
  372                $radio_group->addOption($radio_option);
 
  373                $radio_option = 
new ilRadioOption($this->lng->txt(
'news_visibility_public'), 
'public');
 
  374                $radio_group->addOption($radio_option);
 
  375                $radio_group->setInfo($this->lng->txt(
'news_news_item_visibility_info'));
 
  376                $radio_group->setRequired(
false);
 
  377                $radio_group->setValue(
'users');
 
  378                $this->form_gui->addItem($radio_group);
 
  381                if($a_mode == 
'create')
 
  383                        $this->form_gui->addCommandButton(
'saveNews', $this->lng->txt(
'save'));
 
  384                        $this->form_gui->addCommandButton(
'showNews', $this->lng->txt(
'cancel'));
 
  385                        $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'saveNews'));
 
  389                        $this->ctrl->setParameter($this, 
'news_id', $this->oCurrentNewsItem->getId());
 
  391                        if($view == 
'archive')
 
  393                                $this->form_gui->addCommandButton(
'updateArchiveNews', $this->lng->txt(
'save'));
 
  394                                $this->form_gui->addCommandButton(
'showArchive', $this->lng->txt(
'cancel'));
 
  395                                $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'updateArchiveNews'));
 
  399                                $this->form_gui->addCommandButton(
'updateNews', $this->lng->txt(
'save'));
 
  400                                $this->form_gui->addCommandButton(
'showNews', $this->lng->txt(
'cancel'));
 
  401                                $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 
'updateNews'));                                        
 
  405                $this->form_gui->setTitle($this->lng->txt(
'news_news_item_head'));              
 
  406                $this->tpl->setVariable(
'ADM_CONTENT', $this->form_gui->getHtml());
 
  412                $this->tpl->setVariable(
'ADM_CONTENT', $this->form_gui->getHtml());
 
  429                $this->tpl->setVariable(
'ADM_CONTENT', $this->form_gui->getHtml());
 
  434                $this->form_gui->setValuesByArray(array(
 
  435                        'news_creation_date' => $this->oCurrentNewsItem->getCreationDate(),
 
  436                        'news_title' => $this->oCurrentNewsItem->getTitle(),
 
  437                        'news_content' => $this->oCurrentNewsItem->getContent(), 
 
  438                        'news_visibility' =>$this->oCurrentNewsItem->getVisibility()
 
  446                $this->settings_form->setValuesByArray(array(
 
  447                        'archive_period' => 
$ilSetting->get(
'payment_news_archive_period')
 
  455                $ilTabs->setSubTabActive(
'news');
 
  457                include_once 
'Services/Payment/classes/class.ilShopNewsItemList.php';
 
  458                include_once 
'Services/Table/classes/class.ilTable2GUI.php';    
 
  460                if($rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID) == 
true)
 
  462                        $ilToolbar->addButton($this->lng->txt(
'payment_news_add_news'), $this->ctrl->getLinkTarget($this, 
'addNewsForm'));
 
  465                $news_tpl = 
new ilTemplate(
'tpl.main_view.html', 
true, 
true, 
'Services/Payment');
 
  467                if((
int)strlen($confirmation_gui))
 
  469                        $news_tpl->setVariable(
'CONFIRMATION', $confirmation_gui);
 
  473                $tbl->setId(
'shop_news_tbl');
 
  474                $tbl->setTitle($this->lng->txt(
'news'), 0, $this->lng->txt(
'news'));            
 
  475                $tbl->setRowTemplate(
'tpl.shop_news_row.html', 
'Services/Payment'); 
 
  476                $tbl->setFormAction($this->ctrl->getFormAction($this), 
'showNews');
 
  477                $tbl->addColumn($this->lng->txt(
'news'), 
'title', 
'100%');
 
  481                                  ->setPublicSection(
$ilUser->getId() == ANONYMOUS_USER_ID)
 
  482                                  ->setArchiveDate(time() - (
$ilSetting->get(
'payment_news_archive_period') * 24 * 60 * 60))
 
  486                if($oNewsList->hasItems())
 
  488                        $tbl->setEnableHeader(
true);
 
  489                        $tbl->setEnableTitle(
true);
 
  492                        foreach($oNewsList as $entry)
 
  494                                if($rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID) == 
true)
 
  496                                        $this->ctrl->setParameter($this, 
'news_id', $entry->getId());
 
  498                                        $result[$counter][
'news_id'] = $entry->getId();
 
  499                                        $result[$counter][
'edit_src'] = $this->ctrl->getLinkTarget($this, 
'editNews');
 
  500                                        $result[$counter][
'edit_txt'] = $this->lng->txt(
'edit');
 
  501                                        $result[$counter][
'delete_src'] = $this->ctrl->getLinkTarget($this, 
'confirmDeleteNews');
 
  502                                        $result[$counter][
'delete_txt'] = $this->lng->txt(
'delete');
 
  504                                        $this->ctrl->clearParameters($this);
 
  507                                $result[$counter][
'title'] = $entry->getTitle();
 
  508                                $result[$counter][
'content'] = $entry->getContent();
 
  509                                $result[$counter][
'user_id'] = $entry->getUserId();
 
  511                                $result[$counter][
'txt_author'] =  $this->lng->txt(
'author');
 
  514                                $result[$counter][
'txt_creation_date'] = $this->lng->txt(
'create_date'); 
 
  518                                $result[$counter][
'txt_update_date'] = $this->lng->txt(
'last_update');
 
  522                                $result[$counter][
'txt_access'] = $this->lng->txt(
'access');                                                    
 
  523                                $result[$counter][
'access'] = $entry->getVisibility();                                  
 
  531                        $tbl->setNoEntriesText($this->lng->txt(
'payment_news_no_news_items'));
 
  535                $news_tpl->setVariable(
'TABLE', $tbl->getHTML());
 
  536                $tpl->setContent($news_tpl->get());                     
 
  543                $ilTabs->setSubTabActive(
'archive');
 
  545                include_once 
'Services/Payment/classes/class.ilShopNewsItemList.php';
 
  546                include_once 
'Services/Table/classes/class.ilTable2GUI.php';
 
  548                $news_tpl = 
new ilTemplate(
'tpl.main_view.html', 
true, 
true, 
'Services/Payment');
 
  550                if((
int)strlen($confirmation_gui))
 
  552                        $news_tpl->setVariable(
'CONFIRMATION', $confirmation_gui);
 
  556                $tbl->setId(
'shop_news_archive_tbl');
 
  557                $tbl->setTitle($this->lng->txt(
'archive'), 0 ,$this->lng->txt(
'news')); 
 
  558                $tbl->setRowTemplate(
'tpl.shop_news_row.html', 
'Services/Payment'); 
 
  559                $tbl->setFormAction($this->ctrl->getFormAction($this), 
'showArchive');
 
  560                $tbl->addColumn($this->lng->txt(
'archive'), 
'title', 
'100%');           
 
  564                                  ->setPublicSection(
$ilUser->getId() == ANONYMOUS_USER_ID)
 
  565                                  ->setArchiveDate(time() - (
$ilSetting->get(
'payment_news_archive_period') * 24 * 60 * 60))
 
  568                if($oNewsList->hasItems())
 
  570                        $tbl->setEnableTitle(
true);
 
  571                        $tbl->setEnableHeader(
true);    
 
  574                        foreach($oNewsList as $entry)
 
  576                                if($entry->getVisibility() != 
'public' && 
$ilUser->getId() == ANONYMOUS_USER_ID) 
continue;
 
  577                                if(strtotime($entry->getCreationDate()) > time() - (
$ilSetting->get(
'payment_news_archive_period') * 24 * 60 * 60)) 
continue;
 
  579                                if($rbacreview->isAssigned(
$ilUser->getId(), SYSTEM_ROLE_ID) == 
true)
 
  581                                        $this->ctrl->setParameter($this, 
'news_id', $entry->getId());
 
  583                                        $result[$counter][
'news_id']= $entry->getId();
 
  584                                        $result[$counter][
'edit_src'] = $this->ctrl->getLinkTarget($this, 
'editArchiveNews');
 
  585                                        $result[$counter][
'edit_txt'] = $this->lng->txt(
'edit');
 
  586                                        $result[$counter][
'delete_src'] = $this->ctrl->getLinkTarget($this, 
'confirmDeleteArchiveNews');
 
  587                                        $result[$counter][
'delete_txt'] = $this->lng->txt(
'delete');
 
  589                                        $this->ctrl->clearParameters($this);
 
  594                                $result[$counter][
'title'] = $entry->getTitle();
 
  595                                $result[$counter][
'content'] = $entry->getContent();
 
  596                                $result[$counter][
'user_id'] = $entry->getUserId();
 
  605                                $result[$counter][
'txt_author'] =  $this->lng->txt(
'author');
 
  606                                $result[$counter][
'txt_creation_date'] = $this->lng->txt(
'create_date'); 
 
  607                                $result[$counter][
'txt_update_date'] = $this->lng->txt(
'last_update');
 
  609                                $this->ctrl->clearParameters($this);
 
  616                        $tbl->setNoEntriesText($this->lng->txt(
'payment_news_no_news_items'));
 
  619                $news_tpl->setVariable(
'TABLE', $tbl->getHTML());
 
  620                $tpl->setContent($news_tpl->get());                     
 
  627                parent::prepareOutput();
 
  629                $ilTabs->setTabActive(
'payment_news');
 
Confirmation screen class.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
This class represents an option in a radio group.
showNews($confirmation_gui='')
performDeleteArchiveNews()
initSettingsForm($a_mode='edit')
confirmDeleteArchiveNews()
initNewsForm($a_mode='create', $view='news')
showArchive($confirmation_gui='')
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options