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

Class ilShopTopicsGUI. More...

+ Collaboration diagram for ilShopTopicsGUI:

Public Member Functions

 __construct ($a_gui_object)
 
 executeCommand ()
 
 showTopicsSettings ()
 
 saveTopicsSettings ()
 
 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.

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteTopic()

ilShopTopicsGUI::confirmDeleteTopic ( )

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

195 {
196 if(!count($_POST['topic_id']))
197 {
198 ilUtil::sendInfo($this->lng->txt('select_one_topic'));
199 }
200 else
201 {
202 $this->ask_for_deletion = true;
203 }
204
205 $this->showTopicsList();
206
207 return true;
208 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ executeCommand()

ilShopTopicsGUI::executeCommand ( )

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

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

References $cmd.

◆ performDeleteTopic()

ilShopTopicsGUI::performDeleteTopic ( )

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

231 {
232 if(!count($_POST['topic_id']))
233 {
234 ilUtil::sendInfo($this->lng->txt('select_one_topic'));
235 }
236 else
237 {
238 foreach($_POST['topic_id'] as $topic_id)
239 {
240 $oTopic = new ilShopTopic($topic_id);
241 $oTopic->delete();
242 unset($oTopic);
243 }
244
245 ilUtil::sendInfo($this->lng->txt('topics_deleted'));
246 }
247
248 $this->showTopicsList();
249
250 return true;
251 }

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

+ Here is the call graph for this function:

◆ saveSorting()

ilShopTopicsGUI::saveSorting ( )

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

211 {
212 if(count($_POST['sorting']))
213 {
214 foreach($_POST['sorting'] as $topic_id => $sorting_value)
215 {
216 $oTopic = new ilShopTopic($topic_id);
217 $oTopic->setSorting($sorting_value);
218 $oTopic->save();
219 unset($oTopic);
220 }
221 }
222
223 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
224
225 $this->showTopicsList();
226
227 return true;
228 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ saveTopic()

ilShopTopicsGUI::saveTopic ( )

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

134 {
135 $this->objCurrentTopic->setTitle(ilUtil::stripSlashes(trim($_POST['title'])));
136 $this->objCurrentTopic->setSorting((int)ilUtil::stripSlashes(trim($_POST['sorting'])));
137
138 if($_POST['title'] == '')
139 {
140 ilUtil::sendFailure($this->lng->txt('fill_out_all_required_fields'));
141
142 $this->showTopicForm();
143 }
144 else
145 {
146 $mode = $this->objCurrentTopic->getId() ? 'edit' : 'create';
147
148 if($this->objCurrentTopic->save())
149 {
150 ilUtil::sendSuccess($this->lng->txt($mode == 'create' ? 'topic_saved' : 'topic_edited'));
151 }
152
153 $this->showTopicsList();
154 }
155
156 return true;
157 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

+ Here is the call graph for this function:

◆ saveTopicsSettings()

ilShopTopicsGUI::saveTopicsSettings ( )

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

120 {
122 $genSet->set('enable_topics', $_POST['enable_topics'], 'gui');
123 $genSet->set('topics_allow_custom_sorting', $_POST['topics_allow_custom_sorting'], 'gui');
124 $genSet->set('topics_sorting_type', $_POST['topics_sorting_type'], 'gui');
125 $genSet->set('topics_sorting_direction', $_POST['topics_sorting_direction'], 'gui');
126 $genSet->set('show_topics_filter', $_POST['show_topics_filter'], 'gui');
127 ilUtil::sendSuccess($this->lng->txt('pays_updated_general_settings'));
128 $this->showTopicsSettings();
129 return true;
130 }

References $_POST, ilPaymentSettings\_getInstance(), ilUtil\sendSuccess(), and showTopicsSettings().

+ Here is the call graph for this function:

◆ showTopicForm()

ilShopTopicsGUI::showTopicForm ( )

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

160 {
161 $this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.main_view.html', 'Services/Payment');
162
163 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
164
165 $form = new ilPropertyFormGUI();
166
167 if($this->objCurrentTopic->getId())
168 {
169 $this->ctrl->setParameter($this, 'topic_id', $this->objCurrentTopic->getId());
170 }
171 $form->setFormAction($this->ctrl->getFormAction($this, 'saveTopic'));
172
173 $form->setTitle($this->lng->txt($this->objCurrentTopic->getId() ? 'edit_topic' : 'new_topic'));
174
175 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
176 $title->setValue($this->objCurrentTopic->getTitle());
177 $title->setRequired(true);
178 $form->addItem($title);
179
180 $sorting = new ilTextInputGUI($this->lng->txt('pay_sorting_value'), 'sorting');
181 $sorting->setValue($this->objCurrentTopic->getSorting());
182 $sorting->setMaxLength(11);
183 $sorting->setSize(11);
184 $form->addItem($sorting);
185
186 $form->addCommandButton('saveTopic', $this->lng->txt('save'));
187 $form->addCommandButton('showTopicsList', $this->lng->txt('cancel'));
188
189 $this->tpl->setVariable('FORM', $form->getHTML());
190
191 return true;
192 }
This class represents a property form user interface.
This class represents a text property in a property form.

Referenced by saveTopic().

+ Here is the caller graph for this function:

◆ showTopicsList()

ilShopTopicsGUI::showTopicsList ( )

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

254 {
255 $this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.main_view.html', 'Services/Payment');
256
257 if($this->ask_for_deletion)
258 {
259 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
260 $c_gui = new ilConfirmationGUI();
261
262 $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteTopic'));
263 $c_gui->setHeaderText($this->lng->txt('sure_delete_topics'));
264 $c_gui->setCancel($this->lng->txt('cancel'), 'showTopicsList');
265 $c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteTopic');
266
267 foreach($_POST['topic_id'] as $topic_id)
268 {
269 $c_gui->addItem('topic_id[]', $topic_id, ilShopTopic::_lookupTitle($topic_id));
270 }
271
272 $this->tpl->setVariable('CONFIRMATION', $c_gui->getHTML());
273
274 return true;
275 }
276
277 include_once 'Services/Payment/classes/class.ilShopTopicsTableGUI.php';
278 $table_gui = new ilShopTopicsTableGUI($this, 'showTopicsList');
279 $table_gui->setTitle($this->lng->txt('topics'));
281 ilShopTopics::_getInstance()->setSortingDirection('ASC');
283 $table_gui->parseRecords(ilShopTopics::_getInstance()->getTopics());
284 $table_gui->addCommandButton('showTopicForm', $this->lng->txt('add'));
285 $table_gui->addCommandButton('saveSorting', $this->lng->txt('pay_save_sorting'));
286
287 $this->tpl->setVariable('TABLE', $table_gui->getHTML());
288
289 return true;
290 }
Confirmation screen class.
static _lookupTitle($a_id)
Class ilShopTopicsTableGUI.

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

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

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

◆ showTopicsSettings()

ilShopTopicsGUI::showTopicsSettings ( )

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

61 {
62 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html','Services/Payment');
63
65 $genSetData = $genSet->getAll();
66
67 $form = new ilPropertyFormGUI();
68 $form->setFormAction($this->ctrl->getFormAction($this, 'saveTopicsSettings'));
69 $form->setTitle($this->lng->txt('pays_general_settings'));
70
71 $form->addCommandButton('saveTopicsSettings',$this->lng->txt('save'));
72
73 // use topics
74 $formItem = new ilCheckboxInputGUI($this->lng->txt('enable_topics'), 'enable_topics');
75 $formItem->setChecked((int)$genSetData['enable_topics']);
76 $formItem->setInfo($this->lng->txt('enable_topics_info'));
77 $form->addItem($formItem);
78
79
80 // default sorting type
81 $formItem = new ilSelectInputGUI($this->lng->txt('pay_topics_default_sorting_type'), 'topics_sorting_type');
82 $formItem->setValue($genSetData['topics_sorting_type']);
83 $options = array(
84 1 => $this->lng->txt('pay_topics_sort_by_title'),
85 2 => $this->lng->txt('pay_topics_sort_by_date'),
86 3 => $this->lng->txt('pay_topics_sort_manually')
87 );
88 $formItem->setOptions($options);
89 $form->addItem($formItem);
90
91 // default sorting direction
92 $formItem = new ilSelectInputGUI($this->lng->txt('pay_topics_default_sorting_direction'), 'topics_sorting_direction');
93 $formItem->setValue($genSetData['topics_sorting_direction']);
94 $options = array(
95 'asc' => $this->lng->txt('sort_asc'),
96 'desc' => $this->lng->txt('sort_desc'),
97 );
98 $formItem->setOptions($options);
99 $form->addItem($formItem);
100
101 // topics custom sorting
102 $formItem = new ilCheckboxInputGUI($this->lng->txt('pay_topics_allow_custom_sorting'), 'topics_allow_custom_sorting');
103 $formItem->setChecked((int)$genSetData['topics_allow_custom_sorting']);
104 $formItem->setInfo($this->lng->txt('pay_topics_allow_custom_sorting_info'));
105 $form->addItem($formItem);
106
107 // show topics filter
108 $formItem = new ilCheckboxInputGUI($this->lng->txt('show_topics_filter'), 'show_topics_filter');
109 $formItem->setChecked((int)$genSetData['show_topics_filter']);
110 $formItem->setInfo($this->lng->txt('show_topics_filter_info'));
111 $form->addItem($formItem);
112
113 $this->tpl->setVariable('FORM',$form->getHTML());
114 return true;
115
116 }
This class represents a checkbox property in a property form.
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

References $options, and ilPaymentSettings\_getInstance().

Referenced by saveTopicsSettings().

+ 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: