ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilShopTopicsGUI Class Reference

Class ilShopTopicsGUI. More...

+ Collaboration diagram for ilShopTopicsGUI:

Public Member Functions

 __construct ($a_gui_object)
 
 executeCommand ()
 
 saveTopic ()
 
 showTopicForm ()
 
 confirmDeleteTopic ()
 
 saveSorting ()
 
 performDeleteTopic ()
 
 showTopicsList ()
 

Private Attributes

 $objCurrentTopic = null
 
 $ctrl = null
 
 $tpl = null
 
 $lng = null
 
 $ask_for_deletion = false
 

Detailed Description

Class ilShopTopicsGUI.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 15 of file class.ilShopTopicsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopTopicsGUI::__construct (   $a_gui_object)

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

References $_GET, $ilCtrl, $lng, $tpl, and ilUtil\stripSlashes().

24  {
25  global $tpl, $ilCtrl, $lng;
26 
27  $this->ctrl = $ilCtrl;
28  $this->lng = $lng;
29  $this->tpl = $tpl;
30 
31  $a_gui_object->tabs_gui->setTabActive('topics');
32 
33  $this->objCurrentTopic = new ilShopTopic(ilUtil::stripSlashes($_GET['topic_id']));
34  }
$_GET["client_id"]
Class ilShopTopic.
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteTopic()

ilShopTopicsGUI::confirmDeleteTopic ( )

Definition at line 114 of file class.ilShopTopicsGUI.php.

References $_POST, ilUtil\sendInfo(), and showTopicsList().

115  {
116  if(!count($_POST['topic_id']))
117  {
118  ilUtil::sendInfo($this->lng->txt('select_one_topic'));
119  }
120  else
121  {
122  $this->ask_for_deletion = true;
123  }
124 
125  $this->showTopicsList();
126 
127  return true;
128  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ executeCommand()

ilShopTopicsGUI::executeCommand ( )

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

References $cmd.

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

◆ performDeleteTopic()

ilShopTopicsGUI::performDeleteTopic ( )

Definition at line 150 of file class.ilShopTopicsGUI.php.

References $_POST, ilUtil\sendInfo(), and showTopicsList().

151  {
152  if(!count($_POST['topic_id']))
153  {
154  ilUtil::sendInfo($this->lng->txt('select_one_topic'));
155  }
156  else
157  {
158  foreach($_POST['topic_id'] as $topic_id)
159  {
160  $oTopic = new ilShopTopic($topic_id);
161  $oTopic->delete();
162  unset($oTopic);
163  }
164 
165  ilUtil::sendInfo($this->lng->txt('topics_deleted'));
166  }
167 
168  $this->showTopicsList();
169 
170  return true;
171  }
$_POST['username']
Definition: cron.php:12
Class ilShopTopic.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ saveSorting()

ilShopTopicsGUI::saveSorting ( )

Definition at line 130 of file class.ilShopTopicsGUI.php.

References $_POST, ilUtil\sendSuccess(), and showTopicsList().

131  {
132  if(count($_POST['sorting']))
133  {
134  foreach($_POST['sorting'] as $topic_id => $sorting_value)
135  {
136  $oTopic = new ilShopTopic($topic_id);
137  $oTopic->setSorting($sorting_value);
138  $oTopic->save();
139  unset($oTopic);
140  }
141  }
142 
143  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
144 
145  $this->showTopicsList();
146 
147  return true;
148  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
Class ilShopTopic.
+ Here is the call graph for this function:

◆ saveTopic()

ilShopTopicsGUI::saveTopic ( )

Definition at line 53 of file class.ilShopTopicsGUI.php.

References $_POST, ilUtil\sendFailure(), ilUtil\sendSuccess(), showTopicForm(), showTopicsList(), and ilUtil\stripSlashes().

54  {
55  $this->objCurrentTopic->setTitle(ilUtil::stripSlashes(trim($_POST['title'])));
56  $this->objCurrentTopic->setSorting((int)ilUtil::stripSlashes(trim($_POST['sorting'])));
57 
58  if($_POST['title'] == '')
59  {
60  ilUtil::sendFailure($this->lng->txt('fill_out_all_required_fields'));
61 
62  $this->showTopicForm();
63  }
64  else
65  {
66  $mode = $this->objCurrentTopic->getId() ? 'edit' : 'create';
67 
68  if($this->objCurrentTopic->save())
69  {
70  ilUtil::sendSuccess($this->lng->txt($mode == 'create' ? 'topic_saved' : 'topic_edited'));
71  }
72 
73  $this->showTopicsList();
74  }
75 
76  return true;
77  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ showTopicForm()

ilShopTopicsGUI::showTopicForm ( )

Definition at line 79 of file class.ilShopTopicsGUI.php.

References ilTextInputGUI\setValue().

Referenced by saveTopic().

80  {
81  $this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.main_view.html', 'Services/Payment');
82 
83  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
84 
85  $form = new ilPropertyFormGUI();
86 
87  if($this->objCurrentTopic->getId())
88  {
89  $this->ctrl->setParameter($this, 'topic_id', $this->objCurrentTopic->getId());
90  }
91  $form->setFormAction($this->ctrl->getFormAction($this, 'saveTopic'));
92 
93  $form->setTitle($this->lng->txt($this->objCurrentTopic->getId() ? 'edit_topic' : 'new_topic'));
94 
95  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
96  $title->setValue($this->objCurrentTopic->getTitle());
97  $title->setRequired(true);
98  $form->addItem($title);
99 
100  $sorting = new ilTextInputGUI($this->lng->txt('pay_sorting_value'), 'sorting');
101  $sorting->setValue($this->objCurrentTopic->getSorting());
102  $sorting->setMaxLength(11);
103  $sorting->setSize(11);
104  $form->addItem($sorting);
105 
106  $form->addCommandButton('saveTopic', $this->lng->txt('save'));
107  $form->addCommandButton('showTopicsList', $this->lng->txt('cancel'));
108 
109  $this->tpl->setVariable('FORM', $form->getHTML());
110 
111  return true;
112  }
This class represents a property form user interface.
This class represents a text property in a property form.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showTopicsList()

ilShopTopicsGUI::showTopicsList ( )

Definition at line 173 of file class.ilShopTopicsGUI.php.

References $_POST, ilShopTopics\_getInstance(), ilShopTopic\_lookupTitle(), and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by confirmDeleteTopic(), performDeleteTopic(), saveSorting(), and saveTopic().

174  {
175  $this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.main_view.html', 'Services/Payment');
176 
177  if($this->ask_for_deletion)
178  {
179  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
180  $c_gui = new ilConfirmationGUI();
181 
182  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteTopic'));
183  $c_gui->setHeaderText($this->lng->txt('sure_delete_topics'));
184  $c_gui->setCancel($this->lng->txt('cancel'), 'showTopicsList');
185  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteTopic');
186 
187  foreach($_POST['topic_id'] as $topic_id)
188  {
189  $c_gui->addItem('topic_id[]', $topic_id, ilShopTopic::_lookupTitle($topic_id));
190  }
191 
192  $this->tpl->setVariable('CONFIRMATION', $c_gui->getHTML());
193 
194  return true;
195  }
196 
197  include_once 'Services/Payment/classes/class.ilShopTopicsTableGUI.php';
198  $table_gui = new ilShopTopicsTableGUI($this, 'showTopicsList');
199  $table_gui->setTitle($this->lng->txt('topics'));
201  ilShopTopics::_getInstance()->setSortingDirection('ASC');
202  ilShopTopics::_getInstance()->read();
203  $table_gui->parseRecords(ilShopTopics::_getInstance()->getTopics());
204  $table_gui->addCommandButton('showTopicForm', $this->lng->txt('add'));
205  $table_gui->addCommandButton('saveSorting', $this->lng->txt('pay_save_sorting'));
206 
207  $this->tpl->setVariable('TABLE', $table_gui->getHTML());
208 
209  return true;
210  }
$_POST['username']
Definition: cron.php:12
static _lookupTitle($a_id)
Class ilShopTopicsTableGUI.
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ask_for_deletion

ilShopTopicsGUI::$ask_for_deletion = false
private

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

◆ $ctrl

ilShopTopicsGUI::$ctrl = null
private

Definition at line 18 of file class.ilShopTopicsGUI.php.

◆ $lng

ilShopTopicsGUI::$lng = null
private

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

Referenced by __construct().

◆ $objCurrentTopic

ilShopTopicsGUI::$objCurrentTopic = null
private

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

◆ $tpl

ilShopTopicsGUI::$tpl = null
private

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

Referenced by __construct().


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