ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilShopNewsGUI Class Reference

Class ilShopNewsGUI. More...

+ Inheritance diagram for ilShopNewsGUI:
+ Collaboration diagram for ilShopNewsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 saveSettings ()
 
 initSettingsForm ($a_mode='edit')
 
 showSettings ()
 
 saveNews ()
 
 updateArchiveNews ()
 
 updateNews ()
 
 update ($view)
 
 performDeleteNews ()
 
 performDeleteArchiveNews ()
 
 performDelete ($view)
 
 confirmDeleteNews ()
 
 confirmDeleteArchiveNews ()
 
 confirmDelete ($view)
 
 initNewsForm ($a_mode='create', $view='news')
 
 addNewsForm ()
 
 editNews ()
 
 editArchiveNews ()
 
 editNewsForm ($view)
 
 getPropertiesValues ()
 
 getSettingsValues ()
 
 showNews ($confirmation_gui='')
 
 showArchive ($confirmation_gui='')
 
 __construct ()
 

Data Fields

 $ilErr = null
 

Protected Member Functions

 buildSubTabs ()
 
 prepareOutput ()
 
- Protected Member Functions inherited from ilShopBaseGUI
 prepareOutput ()
 
 addPager ($result)
 

Private Attributes

 $form_gui = null
 
 $settings_form = null
 
 $oCurrentNewsItem = null
 

Additional Inherited Members

- Protected Attributes inherited from ilShopBaseGUI
 $ctrl = null
 
 $lng = null
 
 $tpl = null
 
 $settings = null
 

Detailed Description

Class ilShopNewsGUI.

Author
Nadia Ahmad nahma.nosp@m.d@da.nosp@m.tabay.nosp@m..de

Definition at line 17 of file class.ilShopNewsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopNewsGUI::__construct ( )

Reimplemented from ilShopBaseGUI.

Definition at line 25 of file class.ilShopNewsGUI.php.

26 {
27 global $ilErr;
28 parent::__construct();
29
30 $this->oCurrentNewsItem = new ilShopNewsItem((int)$_GET['news_id']);
31
32 $this->lng->loadLanguageModule('news');
33 $this->ilErr = $ilErr;
34 }
$_GET["client_id"]

References $_GET, and $ilErr.

Member Function Documentation

◆ addNewsForm()

ilShopNewsGUI::addNewsForm ( )

Definition at line 409 of file class.ilShopNewsGUI.php.

410 {
411 $this->initNewsForm('create');
412 $this->tpl->setVariable('ADM_CONTENT', $this->form_gui->getHtml());
413 }
initNewsForm($a_mode='create', $view='news')

References initNewsForm().

+ Here is the call graph for this function:

◆ buildSubTabs()

ilShopNewsGUI::buildSubTabs ( )
protected

Definition at line 56 of file class.ilShopNewsGUI.php.

57 {
58 global $ilTabs, $ilUser, $rbacreview;
59
60 $ilTabs->addSubTabTarget('news', $this->ctrl->getLinkTarget($this, 'showNews'), '', '', '','showNews');
61 $ilTabs->addSubTabTarget('archive', $this->ctrl->getLinkTarget($this, 'showArchive'), '', '', '','archive');
62
63 if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
64 {
65 $ilTabs->addSubTabTarget('settings', $this->ctrl->getLinkTarget($this, 'showSettings'), '', '', '','settings');
66 }
67 }
global $ilUser
Definition: imgupload.php:15

References $ilUser.

◆ confirmDelete()

ilShopNewsGUI::confirmDelete (   $view)

Definition at line 275 of file class.ilShopNewsGUI.php.

276 {
277 global $ilUser, $rbacreview;
278
279 if(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
280 {
281 $this->ilErr->raiseError($this->lng->txt('permission_denied'),$this->ilErr->MESSAGE);
282 }
283
284 if(!isset($_GET['news_id']))
285 {
286 ilUtil::sendInfo($this->lng->txt('payment_news_missing_id'));
287 switch($view)
288 {
289 case 'archive':
290 return $this->showArchive();
291 break;
292
293 case 'news':
294 default:
295 return $this->showNews();
296 break;
297 }
298 }
299
300 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
301 $c_gui = new ilConfirmationGUI();
302 $c_gui->setHeaderText($this->lng->txt('payment_news_delete_sure'));
303 $c_gui->addHiddenItem('news_id', (int)$_GET['news_id']);
304
305 $oNewsItem = new ilShopNewsItem($_GET['news_id']);
306 $title=$oNewsItem->getTitle();
307 $c_gui->addItem($title, $_GET['news_id'],$title);
308
309
310 switch($view)
311 {
312 case 'archive':
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');
316 $this->showArchive($c_gui->getHTML());
317 break;
318
319 case 'news':
320 default:
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');
324 $this->showNews($c_gui->getHTML());
325 break;
326 }
327
328 return true;
329 }
Confirmation screen class.
showNews($confirmation_gui='')
showArchive($confirmation_gui='')
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, $ilUser, ilUtil\sendInfo(), showArchive(), and showNews().

Referenced by confirmDeleteArchiveNews(), and confirmDeleteNews().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteArchiveNews()

ilShopNewsGUI::confirmDeleteArchiveNews ( )

Definition at line 270 of file class.ilShopNewsGUI.php.

271 {
272 $this->confirmDelete('archive');
273 }

References confirmDelete().

+ Here is the call graph for this function:

◆ confirmDeleteNews()

ilShopNewsGUI::confirmDeleteNews ( )

Definition at line 265 of file class.ilShopNewsGUI.php.

266 {
267 $this->confirmDelete('news');
268 }

References confirmDelete().

+ Here is the call graph for this function:

◆ editArchiveNews()

ilShopNewsGUI::editArchiveNews ( )

Definition at line 420 of file class.ilShopNewsGUI.php.

421 {
422 return $this->editNewsForm('archive');
423 }

References editNewsForm().

+ Here is the call graph for this function:

◆ editNews()

ilShopNewsGUI::editNews ( )

Definition at line 415 of file class.ilShopNewsGUI.php.

416 {
417 return $this->editNewsForm('news');
418 }

References editNewsForm().

+ Here is the call graph for this function:

◆ editNewsForm()

ilShopNewsGUI::editNewsForm (   $view)

Definition at line 425 of file class.ilShopNewsGUI.php.

426 {
427 $this->initNewsForm('edit', $view);
428 $this->getPropertiesValues();
429 $this->tpl->setVariable('ADM_CONTENT', $this->form_gui->getHtml());
430 }

References getPropertiesValues(), and initNewsForm().

Referenced by editArchiveNews(), and editNews().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilShopNewsGUI::executeCommand ( )

Definition at line 36 of file class.ilShopNewsGUI.php.

37 {
38// $next_class = $this->ctrl->getNextClass($this);
39 $cmd = $this->ctrl->getCmd();
40
41 switch($cmd)
42 {
43 default:
44 if(!$cmd)
45 {
46 $cmd = 'showNews';
47 }
48 $this->prepareOutput();
49 $this->$cmd();
50 break;
51 }
52
53 return true;
54 }
$cmd
Definition: sahs_server.php:35

References $cmd, and prepareOutput().

+ Here is the call graph for this function:

◆ getPropertiesValues()

ilShopNewsGUI::getPropertiesValues ( )

Definition at line 432 of file class.ilShopNewsGUI.php.

433 {
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()
439 ));
440 }

Referenced by editNewsForm().

+ Here is the caller graph for this function:

◆ getSettingsValues()

ilShopNewsGUI::getSettingsValues ( )

Definition at line 442 of file class.ilShopNewsGUI.php.

443 {
444 global $ilSetting;
445
446 $this->settings_form->setValuesByArray(array(
447 'archive_period' => $ilSetting->get('payment_news_archive_period')
448 ));
449 }
global $ilSetting
Definition: privfeed.php:40

References $ilSetting.

Referenced by saveSettings(), and showSettings().

+ Here is the caller graph for this function:

◆ initNewsForm()

ilShopNewsGUI::initNewsForm (   $a_mode = 'create',
  $view = 'news' 
)

Definition at line 331 of file class.ilShopNewsGUI.php.

332 {
333 global $ilTabs, $rbacreview, $ilUser;
334
335 if(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
336 {
337 $this->ilErr->raiseError($this->lng->txt('permission_denied'),$this->ilErr->MESSAGE);
338 }
339
340 if($view == 'archive')
341 {
342 $ilTabs->setSubTabActive('archive');
343 }
344 else
345 {
346 $ilTabs->setSubTabActive('news');
347 }
348
349 $this->form_gui = new ilPropertyFormGUI();
350 $this->form_gui->setTitle($this->lng->txt('shopnews_settings'));
351
352 // Property Title
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);
358
359 $this->form_gui->addItem($text_input);
360
361 // Property Content
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);
368
369 // Property Visibility
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);
379
380 // save and cancel commands
381 if($a_mode == 'create')
382 {
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'));
386 }
387 else
388 {
389 $this->ctrl->setParameter($this, 'news_id', $this->oCurrentNewsItem->getId());
390
391 if($view == 'archive')
392 {
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'));
396 }
397 else
398 {
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'));
402 }
403 }
404
405 $this->form_gui->setTitle($this->lng->txt('news_news_item_head'));
406 $this->tpl->setVariable('ADM_CONTENT', $this->form_gui->getHtml());
407 }
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $ilUser.

Referenced by addNewsForm(), editNewsForm(), saveNews(), and update().

+ Here is the caller graph for this function:

◆ initSettingsForm()

ilShopNewsGUI::initSettingsForm (   $a_mode = 'edit')

Definition at line 96 of file class.ilShopNewsGUI.php.

97 {
98
99 $this->settings_form = new ilPropertyFormGUI();
100 $this->settings_form->setTitle($this->lng->txt('payment_news_settings'));
101
102 $oSelectBox = new ilSelectInputGUI($this->lng->txt('payment_news_archive_period'), 'archive_period');
103 $oSelectBox->setInfo($this->lng->txt('payment_news_archive_period_info'));
104 $options = array();
105 for($i = 5; $i <= 100; $i += 5)
106 {
107 $options[$i] = $i;
108 }
109 $oSelectBox->setOptions($options);
110 $this->settings_form->addItem($oSelectBox);
111
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'));
115 }
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

References $options.

Referenced by saveSettings(), and showSettings().

+ Here is the caller graph for this function:

◆ performDelete()

ilShopNewsGUI::performDelete (   $view)

Definition at line 221 of file class.ilShopNewsGUI.php.

222 {
223 global $ilUser, $rbacreview;
224
225 if(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
226 {
227 $this->ilErr->raiseError($this->lng->txt('permission_denied'),$this->ilErr->MESSAGE);
228 }
229
230 if(!(int)$_POST['news_id'])
231 {
232 ilUtil::sendInfo($this->lng->txt('payment_news_missing_id'));
233 switch($view)
234 {
235 case 'archive':
236 return $this->showArchive();
237 break;
238
239 case 'news':
240 default:
241 return $this->showNews();
242 break;
243 }
244 }
245 else
246 {
247 $this->oCurrentNewsItem->setId($_POST['news_id']);
248 $this->oCurrentNewsItem->delete();
249 ilUtil::sendInfo($this->lng->txt('payment_news_deleted'));
250 }
251
252 switch($view)
253 {
254 case 'archive':
255 return $this->showArchive();
256 break;
257
258 case 'news':
259 default:
260 return $this->showNews();
261 break;
262 }
263 }
$_POST['username']
Definition: cron.php:12

References $_POST, $ilUser, ilUtil\sendInfo(), showArchive(), and showNews().

Referenced by performDeleteArchiveNews(), and performDeleteNews().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performDeleteArchiveNews()

ilShopNewsGUI::performDeleteArchiveNews ( )

Definition at line 216 of file class.ilShopNewsGUI.php.

217 {
218 return $this->performDelete('archive');
219 }

References performDelete().

+ Here is the call graph for this function:

◆ performDeleteNews()

ilShopNewsGUI::performDeleteNews ( )

Definition at line 211 of file class.ilShopNewsGUI.php.

212 {
213 return $this->performDelete('news');
214 }

References performDelete().

+ Here is the call graph for this function:

◆ prepareOutput()

ilShopNewsGUI::prepareOutput ( )
protected

Reimplemented from ilShopBaseGUI.

Definition at line 623 of file class.ilShopNewsGUI.php.

624 {
625 global $ilTabs;
626
627 parent::prepareOutput();
628
629 $ilTabs->setTabActive('payment_news');
630
631 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ saveNews()

ilShopNewsGUI::saveNews ( )

Definition at line 134 of file class.ilShopNewsGUI.php.

135 {
136 global $ilUser, $rbacreview;
137
138 if(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
139 {
140 $this->ilErr->raiseError($this->lng->txt('permission_denied'),$this->ilErr->MESSAGE);
141 }
142
143 $this->initNewsForm('create');
144 if ($this->form_gui->checkInput())
145 {
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();
151
152 ilUtil::sendInfo($this->lng->txt('payment_news_created'));
153 return $this->showNews();
154 }
155 else
156 {
157 $this->form_gui->setValuesByPost();
158 return $this->tpl->setVariable('ADM_CONTENT', $this->form_gui->getHtml());
159 }
160 }

References $ilUser, initNewsForm(), ilUtil\sendInfo(), and showNews().

+ Here is the call graph for this function:

◆ saveSettings()

ilShopNewsGUI::saveSettings ( )

Definition at line 69 of file class.ilShopNewsGUI.php.

70 {
71 global $ilTabs, $ilSetting, $rbacreview, $ilUser;
72
73 if(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
74 {
75 $this->ilErr->raiseError($this->lng->txt('permission_denied'), $this->ilErr->MESSAGE);
76 }
77
78 $ilTabs->setSubTabActive('settings');
79
80 $this->initSettingsForm('edit');
81 if($this->settings_form->checkInput())
82 {
83 $ilSetting->set('payment_news_archive_period', $this->settings_form->getInput('archive_period'));
84 $this->getSettingsValues();
85 ilUtil::sendInfo($this->lng->txt('payment_news_settings_saved'));
86
87 return $this->tpl->setVariable('ADM_CONTENT', $this->settings_form->getHtml());
88 }
89 else
90 {
91 $this->form_gui->setValuesByPost();
92 return $this->tpl->setVariable('ADM_CONTENT', $this->settings_form->getHtml());
93 }
94 }
initSettingsForm($a_mode='edit')

References $ilSetting, $ilUser, getSettingsValues(), initSettingsForm(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ showArchive()

ilShopNewsGUI::showArchive (   $confirmation_gui = '')

Definition at line 539 of file class.ilShopNewsGUI.php.

540 {
541 global $ilUser, $tpl, $ilTabs, $ilSetting, $rbacreview;
542
543 $ilTabs->setSubTabActive('archive');
544
545 include_once 'Services/Payment/classes/class.ilShopNewsItemList.php';
546 include_once 'Services/Table/classes/class.ilTable2GUI.php';
547
548 $news_tpl = new ilTemplate('tpl.main_view.html', true, true, 'Services/Payment');
549
550 if((int)strlen($confirmation_gui))
551 {
552 $news_tpl->setVariable('CONFIRMATION', $confirmation_gui);
553 }
554
555 $tbl = new ilTable2GUI($this);
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%');
561
563 $oNewsList->setMode(ilShopNewsItemList::TYPE_ARCHIVE)
564 ->setPublicSection($ilUser->getId() == ANONYMOUS_USER_ID)
565 ->setArchiveDate(time() - ($ilSetting->get('payment_news_archive_period') * 24 * 60 * 60))
566 ->read();
567 $result = array();
568 if($oNewsList->hasItems())
569 {
570 $tbl->setEnableTitle(true);
571 $tbl->setEnableHeader(true);
572
573 $counter = 0;
574 foreach($oNewsList as $entry)
575 {
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;
578
579 if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID) == true)
580 {
581 $this->ctrl->setParameter($this, 'news_id', $entry->getId());
582
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');
588
589 $this->ctrl->clearParameters($this);
590 }
591
592 $result[$counter]['creation_date'] = ilDatePresentation::formatDate(
593 new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME));
594 $result[$counter]['title'] = $entry->getTitle();
595 $result[$counter]['content'] = $entry->getContent();
596 $result[$counter]['user_id'] = $entry->getUserId();
597
598 $result[$counter]['author'] = $ilUser->getLogin();
599 $result[$counter]['creation_date'] = ilDatePresentation::formatDate(
600 new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME));
601
602 $result[$counter]['update_date'] = ilDatePresentation::formatDate(
603 new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME));
604
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');
608
609 $this->ctrl->clearParameters($this);
610
611 ++$counter;
612 }
613 }
614 else
615 {
616 $tbl->setNoEntriesText($this->lng->txt('payment_news_no_news_items'));
617 }
618 $tbl->setData($result);
619 $news_tpl->setVariable('TABLE', $tbl->getHTML());
620 $tpl->setContent($news_tpl->get());
621 }
$result
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Class ilTable2GUI.
special template class to simplify handling of ITX/PEAR
$tbl
Definition: example_048.php:81

References $ilSetting, $ilUser, $result, $tbl, ilShopBaseGUI\$tpl, ilShopNewsItemList\_getInstance(), ilDatePresentation\formatDate(), IL_CAL_DATETIME, and ilShopNewsItemList\TYPE_ARCHIVE.

Referenced by confirmDelete(), performDelete(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showNews()

ilShopNewsGUI::showNews (   $confirmation_gui = '')

Definition at line 451 of file class.ilShopNewsGUI.php.

452 {
453 global $ilUser, $tpl, $ilTabs, $ilSetting, $rbacreview, $ilToolbar;
454
455 $ilTabs->setSubTabActive('news');
456
457 include_once 'Services/Payment/classes/class.ilShopNewsItemList.php';
458 include_once 'Services/Table/classes/class.ilTable2GUI.php';
459
460 if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID) == true)
461 {
462 $ilToolbar->addButton($this->lng->txt('payment_news_add_news'), $this->ctrl->getLinkTarget($this, 'addNewsForm'));
463 }
464
465 $news_tpl = new ilTemplate('tpl.main_view.html', true, true, 'Services/Payment');
466
467 if((int)strlen($confirmation_gui))
468 {
469 $news_tpl->setVariable('CONFIRMATION', $confirmation_gui);
470 }
471
472 $tbl = new ilTable2GUI($this);
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%');
478
480 $oNewsList->setMode(ilShopNewsItemList::TYPE_NEWS)
481 ->setPublicSection($ilUser->getId() == ANONYMOUS_USER_ID)
482 ->setArchiveDate(time() - ($ilSetting->get('payment_news_archive_period') * 24 * 60 * 60))
483 ->read();
484
485 $result = array();
486 if($oNewsList->hasItems())
487 {
488 $tbl->setEnableHeader(true);
489 $tbl->setEnableTitle(true);
490
491 $counter = 0;
492 foreach($oNewsList as $entry)
493 {
494 if($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID) == true)
495 {
496 $this->ctrl->setParameter($this, 'news_id', $entry->getId());
497
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');
503
504 $this->ctrl->clearParameters($this);
505 }
506
507 $result[$counter]['title'] = $entry->getTitle();
508 $result[$counter]['content'] = $entry->getContent();
509 $result[$counter]['user_id'] = $entry->getUserId();
510
511 $result[$counter]['txt_author'] = $this->lng->txt('author');
512 $result[$counter]['author'] = $ilUser->getLogin();
513
514 $result[$counter]['txt_creation_date'] = $this->lng->txt('create_date');
515 $result[$counter]['creation_date'] = ilDatePresentation::formatDate(
516 new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME));
517
518 $result[$counter]['txt_update_date'] = $this->lng->txt('last_update');
519 $result[$counter]['update_date'] = ilDatePresentation::formatDate(
520 new ilDateTime($entry->getUpdateDate(), IL_CAL_DATETIME));
521
522 $result[$counter]['txt_access'] = $this->lng->txt('access');
523 $result[$counter]['access'] = $entry->getVisibility();
524
525 ++$counter;
526 }
527 }
528 else
529 {
530
531 $tbl->setNoEntriesText($this->lng->txt('payment_news_no_news_items'));
532 }
533
534 $tbl->setData($result);
535 $news_tpl->setVariable('TABLE', $tbl->getHTML());
536 $tpl->setContent($news_tpl->get());
537 }

References $ilSetting, $ilUser, $result, $tbl, ilShopBaseGUI\$tpl, ilShopNewsItemList\_getInstance(), ilDatePresentation\formatDate(), IL_CAL_DATETIME, and ilShopNewsItemList\TYPE_NEWS.

Referenced by confirmDelete(), performDelete(), saveNews(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSettings()

ilShopNewsGUI::showSettings ( )

Definition at line 117 of file class.ilShopNewsGUI.php.

118 {
119 global $ilTabs, $ilUser, $rbacreview;
120
121 if(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
122 {
123 $this->ilErr->raiseError($this->lng->txt('permission_denied'),$this->ilErr->MESSAGE);
124 }
125
126 $ilTabs->setSubTabActive('settings');
127
128 $this->initSettingsForm('edit');
129 $this->getSettingsValues();
130
131 return $this->tpl->setVariable('ADM_CONTENT', $this->settings_form->getHtml());
132 }

References $ilUser, getSettingsValues(), and initSettingsForm().

+ Here is the call graph for this function:

◆ update()

ilShopNewsGUI::update (   $view)

Definition at line 172 of file class.ilShopNewsGUI.php.

173 {
174 global $ilUser, $rbacreview;
175
176 if(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID))
177 {
178 $this->ilErr->raiseError($this->lng->txt('permission_denied'),$this->ilErr->MESSAGE);
179 }
180
181 $this->initNewsForm('edit', $view);
182
183 if ($this->form_gui->checkInput())
184 {
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());
189
190 $this->oCurrentNewsItem->update();
191
192 ilUtil::sendInfo($this->lng->txt('payment_news_updated'));
193
194 if($view == 'archive')
195 {
196 return $this->showArchive();
197 }
198 else
199 {
200 return $this->showNews();
201 }
202
203 }
204 else
205 {
206 $this->form_gui->setValuesByPost();
207 return $this->tpl->setVariable('ADM_CONTENT', $this->form_gui->getHtml());
208 }
209 }

References $ilUser, initNewsForm(), ilUtil\sendInfo(), showArchive(), and showNews().

Referenced by updateArchiveNews(), and updateNews().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateArchiveNews()

ilShopNewsGUI::updateArchiveNews ( )

Definition at line 162 of file class.ilShopNewsGUI.php.

163 {
164 return $this->update('archive');
165 }

References update().

+ Here is the call graph for this function:

◆ updateNews()

ilShopNewsGUI::updateNews ( )

Definition at line 167 of file class.ilShopNewsGUI.php.

168 {
169 return $this->update('news');
170 }

References update().

+ Here is the call graph for this function:

Field Documentation

◆ $form_gui

ilShopNewsGUI::$form_gui = null
private

Definition at line 19 of file class.ilShopNewsGUI.php.

◆ $ilErr

ilShopNewsGUI::$ilErr = null

Definition at line 23 of file class.ilShopNewsGUI.php.

Referenced by __construct().

◆ $oCurrentNewsItem

ilShopNewsGUI::$oCurrentNewsItem = null
private

Definition at line 21 of file class.ilShopNewsGUI.php.

◆ $settings_form

ilShopNewsGUI::$settings_form = null
private

Definition at line 20 of file class.ilShopNewsGUI.php.


The documentation for this class was generated from the following file: