ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilPaymentTrusteeGUI Class Reference
+ Inheritance diagram for ilPaymentTrusteeGUI:
+ Collaboration diagram for ilPaymentTrusteeGUI:

Public Member Functions

 __construct ($user_obj)
 
 executeCommand ()
 
 cancelDelete ()
 
 showTrustees ($a_show_delete=false)
 
 deleteTrustee ()
 
 performDeleteTrustee ()
 
 update ()
 
 performSearch ()
 
 addTrustee ()
 
 addUser ()
 
 __search ($a_search_string)
 
 __showSearchUserTable ($a_result_set)
 
 __showTrusteesTable ($a_result_set)
 
- Public Member Functions inherited from ilShopBaseGUI
 __construct ()
 

Data Fields

 $trustee_obj = null
 
 $user_obj
 
 $ctrl
 

Protected Member Functions

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

Additional Inherited Members

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilPaymentTrusteeGUI::__construct (   $user_obj)

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

References $user_obj.

24  {
25  parent::__construct();
26 
27  $this->user_obj = $user_obj;
28  $this->trustee_obj = new ilPaymentTrustees($this->user_obj);
29  $this->lng->loadLanguageModule('crs');
30 
31  $this->ctrl->saveParameter($this, 'baseClass');
32  }

Member Function Documentation

◆ __search()

ilPaymentTrusteeGUI::__search (   $a_search_string)

Definition at line 352 of file class.ilPaymentTrusteeGUI.php.

References ilUtil\sendInfo(), ilSearch\setPerformUpdate(), and ilUtil\stripSlashes().

Referenced by performSearch().

353  {
354  include_once("./Services/Search/classes/class.ilSearch.php");
355 
356  $this->lng->loadLanguageModule("content");
357 
358  $search = new ilSearch($this->user_obj->getId());
359  $search->setPerformUpdate(false);
360  $search->setSearchString(ilUtil::stripSlashes($a_search_string));
361  $search->setCombination("and");
362  $search->setSearchFor(array(0 => 'usr'));
363  $search->setSearchType('new');
364 
365  if($search->validate($message))
366  {
367  $search->performSearch();
368  }
369  else
370  {
371  ilUtil::sendInfo($message,true);
372  $this->ctrl->redirect($this,"searchUser");
373  }
374  return $search->getResultByType('usr');
375  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setPerformUpdate($a_value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __showSearchUserTable()

ilPaymentTrusteeGUI::__showSearchUserTable (   $a_result_set)

Definition at line 376 of file class.ilPaymentTrusteeGUI.php.

Referenced by performSearch().

377  {
378  $tbl = new ilShopTableGUI($this);
379 
380  $tbl->setTitle($this->lng->txt("paya_trustee_table"));
381  $tbl->setId('tbl_search_user_trustee');
382  $tbl->setRowTemplate("tpl.shop_users_row.html", "Services/Payment");
383 
384  $tbl->addColumn(' ', 'trustee_id', '1%', true);
385  $tbl->addColumn($this->lng->txt('login'), 'login', '10%');
386  $tbl->addColumn($this->lng->txt('firstname'),'firstname','20%');
387  $tbl->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
388 
389  $tbl->setSelectAllCheckbox('user');
390  $tbl->addMultiCommand("addTrustee", $this->lng->txt("add"));
391  $tbl->addCommandButton('showTrustees',$this->lng->txt('cancel'));
392 
393  $tbl->fillFooter();
394  $tbl->setData($a_result_set);
395  $this->tpl->setVariable('TABLE', $tbl->getHTML());
396 
397  return true;
398  }
Class ilShopTableGUI.
+ Here is the caller graph for this function:

◆ __showTrusteesTable()

ilPaymentTrusteeGUI::__showTrusteesTable (   $a_result_set)

Definition at line 400 of file class.ilPaymentTrusteeGUI.php.

Referenced by showTrustees().

401  {
402  $tbl = new ilShopTableGUI($this);
403 
404  $tbl->setTitle($this->lng->txt("paya_trustee_table"));
405  $tbl->setId('tbl_show_trustee');
406  $tbl->setRowTemplate("tpl.shop_users_row.html", "Services/Payment");
407 
408  $tbl->addColumn(' ', 'trustee_id', '1%', true);
409  $tbl->addColumn($this->lng->txt('login'), 'login', '10%');
410  $tbl->addColumn($this->lng->txt('firstname'),'firstname','20%');
411  $tbl->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
412  $tbl->addColumn($this->lng->txt('paya_perm_stat'), 'perm_stat', '15%');
413  $tbl->addColumn($this->lng->txt('paya_perm_obj'), 'perm_obj', '15%');
414  $tbl->addColumn($this->lng->txt('paya_perm_coupons'), 'perm_coupons', '15%');
415  $tbl->addColumn('', 'options', '5%');
416 
417  $tbl->setSelectAllCheckbox('trustee_id');
418  $tbl->addMultiCommand("deleteTrustee", $this->lng->txt("delete"));
419 
420  $tbl->addCommandButton('update',$this->lng->txt('apply'));
421  $tbl->setData($a_result_set);
422  $this->tpl->setVariable('TABLE', $tbl->getHTML());
423 
424  return true;
425  }
Class ilShopTableGUI.
+ Here is the caller graph for this function:

◆ addTrustee()

ilPaymentTrusteeGUI::addTrustee ( )

Definition at line 257 of file class.ilPaymentTrusteeGUI.php.

References $_POST, performSearch(), ilUtil\sendInfo(), and showTrustees().

258  {
259  if(!is_array($_POST["user"]))
260  {
261  ilUtil::sendInfo($this->lng->txt("crs_no_users_selected"));
262  $this->performSearch();
263 
264  return false;
265  }
266  if(in_array($this->user_obj->getId(),$_POST['user']))
267  {
268  ilUtil::sendInfo($this->lng->txt('paya_not_assign_yourself'));
269  $this->showTrustees();
270 
271  return false;
272  }
273 
274  // add them
275  $counter = 0;
276  foreach($_POST['user'] as $user_id)
277  {
278  if($this->trustee_obj->isTrustee($user_id))
279  {
280  continue;
281  }
282  $this->trustee_obj->setTrusteeId($user_id);
283  $this->trustee_obj->toggleStatisticPermission(false);
284  $this->trustee_obj->toggleObjectPermission(true);
285  $this->trustee_obj->toggleCouponsPermission(true);
286  $this->trustee_obj->add();
287  ++$counter;
288  }
289 
290  if($counter)
291  {
292  ilUtil::sendInfo($this->lng->txt('paya_added_trustee'));
293  $this->showTrustees();
294 
295  return true;
296  }
297  else
298  {
299  ilUtil::sendInfo($this->lng->txt('paya_user_already_assigned'));
300  $this->performSearch();
301 
302  return false;
303  }
304 
305  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showTrustees($a_show_delete=false)
+ Here is the call graph for this function:

◆ addUser()

ilPaymentTrusteeGUI::addUser ( )

Definition at line 306 of file class.ilPaymentTrusteeGUI.php.

References $_POST, ilObjUser\getUserIdByLogin(), ilUtil\sendInfo(), and showTrustees().

307  {
308  if(!$_POST['trustee_login'])
309  {
310  ilUtil::sendInfo($this->lng->txt('paya_enter_login'));
311  $this->showTrustees();
312 
313  return false;
314  }
315  if(!$user_id = ilObjUser::getUserIdByLogin($_POST['trustee_login']))
316  {
317  ilUtil::sendInfo($this->lng->txt('paya_no_valid_login'));
318  $this->showTrustees();
319 
320  return false;
321  }
322  if($this->trustee_obj->isTrustee($user_id))
323  {
324  ilUtil::sendInfo($this->lng->txt('paya_user_already_assigned'));
325  $this->showTrustees();
326 
327  return false;
328  }
329  if($user_id == $this->user_obj->getId())
330  {
331  ilUtil::sendInfo($this->lng->txt('paya_not_assign_yourself'));
332  $this->showTrustees();
333 
334  return false;
335  }
336 
337  // checks passed => add trustee
338  $this->trustee_obj->setTrusteeId($user_id);
339  $this->trustee_obj->toggleObjectPermission(true);
340  $this->trustee_obj->toggleStatisticPermission(true);
341  $this->trustee_obj->toggleCouponsPermission(true);
342  $this->trustee_obj->add();
343 
344  ilUtil::sendInfo($this->lng->txt('paya_added_trustee'));
345  $this->showTrustees();
346 
347  return true;
348  }
$_POST['username']
Definition: cron.php:12
getUserIdByLogin($a_login)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showTrustees($a_show_delete=false)
+ Here is the call graph for this function:

◆ cancelDelete()

ilPaymentTrusteeGUI::cancelDelete ( )

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

References $_SESSION, and showTrustees().

61  {
62  unset($_SESSION['paya_delete_trustee']);
63  $this->showTrustees();
64 
65  return true;
66  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
showTrustees($a_show_delete=false)
+ Here is the call graph for this function:

◆ deleteTrustee()

ilPaymentTrusteeGUI::deleteTrustee ( )

Definition at line 171 of file class.ilPaymentTrusteeGUI.php.

References $_POST, $_SESSION, ilUtil\sendInfo(), and showTrustees().

172  {
173  if(!is_array($_POST['trustee']))
174  {
175  ilUtil::sendInfo($this->lng->txt('crs_no_users_selected'));
176  $this->showTrustees();
177 
178  return true;
179  }
180  $_SESSION['paya_delete_trustee'] = $_POST['trustee'];
181  $this->showTrustees(true);
182 
183  return true;
184  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showTrustees($a_show_delete=false)
+ Here is the call graph for this function:

◆ executeCommand()

ilPaymentTrusteeGUI::executeCommand ( )

Definition at line 44 of file class.ilPaymentTrusteeGUI.php.

References $cmd, and prepareOutput().

45  {
46  $cmd = $this->ctrl->getCmd();
47  switch ($this->ctrl->getNextClass($this))
48  {
49  default:
50  if(!$cmd = $this->ctrl->getCmd())
51  {
52  $cmd = 'showTrustees';
53  }
54  $this->prepareOutput();
55  $this->$cmd();
56  break;
57  }
58  }
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ performDeleteTrustee()

ilPaymentTrusteeGUI::performDeleteTrustee ( )

Definition at line 186 of file class.ilPaymentTrusteeGUI.php.

References $_SESSION, ilUtil\sendInfo(), and showTrustees().

187  {
188  if(is_array($_SESSION['paya_delete_trustee']))
189  {
190  foreach($_SESSION['paya_delete_trustee'] as $id)
191  {
192  $this->trustee_obj->setTrusteeId($id);
193  $this->trustee_obj->delete();
194  }
195  }
196  unset($_SESSION['paya_delete_trustee']);
197  ilUtil::sendInfo($this->lng->txt('paya_delete_trustee_msg'));
198  $this->showTrustees();
199 
200  return true;
201  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showTrustees($a_show_delete=false)
+ Here is the call graph for this function:

◆ performSearch()

ilPaymentTrusteeGUI::performSearch ( )

Definition at line 219 of file class.ilPaymentTrusteeGUI.php.

References $_POST, $result, __search(), __showSearchUserTable(), ilUtil\formCheckbox(), ilObjectFactory\getInstanceByObjId(), ilUtil\sendInfo(), showTrustees(), and ilUtil\stripSlashes().

Referenced by addTrustee().

220  {
221  if(!$_POST["search_str"])
222  {
223  ilUtil::sendInfo($this->lng->txt("crs_search_enter_search_string"));
224  $this->showTrustees();
225 
226  return false;
227  }
228  if(!count($result = $this->__search(ilUtil::stripSlashes($_POST["search_str"]))))
229  {
230  ilUtil::sendInfo($this->lng->txt("crs_no_results_found"));
231  $this->showTrustees();
232 
233  return false;
234  }
235 
236  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html",'Services/Payment');
237  $counter = 0;
238  $f_result = array();
239  foreach($result as $user)
240  {
241  if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"],false))
242  {
243  continue;
244  }
245  $f_result[$counter]['trustee_id'] = ilUtil::formCheckbox(0,"user[]",$user["id"]);
246  $f_result[$counter]['login'] = $tmp_obj->getLogin();
247  $f_result[$counter]['firstname'] = $tmp_obj->getFirstname();
248  $f_result[$counter]['lastname'] = $tmp_obj->getLastname();
249 
250  unset($tmp_obj);
251  ++$counter;
252  }
253  $this->__showSearchUserTable($f_result);
254  return true;
255  }
$_POST['username']
Definition: cron.php:12
$result
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
showTrustees($a_show_delete=false)
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilPaymentTrusteeGUI::prepareOutput ( )
protected

Definition at line 34 of file class.ilPaymentTrusteeGUI.php.

Referenced by executeCommand().

35  {
36  global $ilTabs;
37 
38  parent::prepareOutput();
39 
40  $ilTabs->setTabActive('paya_header');
41  $ilTabs->setSubTabActive('paya_trustees');
42  }
+ Here is the caller graph for this function:

◆ showTrustees()

ilPaymentTrusteeGUI::showTrustees (   $a_show_delete = false)

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

References $_POST, $_SESSION, __showTrusteesTable(), ilUtil\formCheckbox(), ilUtil\formSelect(), ilObjectFactory\getInstanceByObjId(), ilMailFormCall\getLinkTarget(), ilUtil\sendInfo(), and ilTextInputGUI\setDataSource().

Referenced by addTrustee(), addUser(), cancelDelete(), deleteTrustee(), performDeleteTrustee(), performSearch(), and update().

70  {
71  global $ilToolbar;
72 
73  $_SESSION['paya_delete_trustee'] = $_SESSION['paya_delete_trustee'] ? $_SESSION['paya_delete_trustee'] : array();
74 
75  $actions = array(0 => $this->lng->txt("paya_disabled"),
76  1 => $this->lng->txt("paya_enabled"));
77 
78  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
79  $ul = new ilTextInputGUI($this->lng->txt("user"), "search_str");
80  $ul->setDataSource($this->ctrl->getLinkTarget($this, "performSearch", "", true));
81  $ul->setSize(20);
82  $ilToolbar->addInputItem($ul, true);
83  $ilToolbar->addFormButton($this->lng->txt("add"), "performSearch");
84  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
85 
86  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
87 
88  if($a_show_delete)
89  {
90  $oConfirmationGUI = new ilConfirmationGUI();
91 
92  // set confirm/cancel commands
93  $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,"performDeleteTrustee"));
94  $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_selected_trustees"));
95  $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "cancelDelete");
96  $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDeleteTrustee");
97 
98  foreach($this->trustee_obj->getTrustees() as $trustee)
99  {
100  $delete_row = '';
101  if(in_array($trustee['trustee_id'],$_POST['trustee']))
102  {
103  if($tmp_obj = ilObjectFactory::getInstanceByObjId($trustee['trustee_id'],false))
104  {
105  $delete_row = $tmp_obj->getLogin().' -> '.$tmp_obj->getFirstname().' '.$tmp_obj->getLastname();
106  }
107  }
108 
109  $oConfirmationGUI->addItem('',$delete_row, $delete_row);
110  }
111 
112  $this->tpl->setVariable("CONFIRMATION",$oConfirmationGUI->getHTML());
113 
114  }
115 
116  if(!count($this->trustee_obj->getTrustees()))
117  {
118  ilUtil::sendInfo($this->lng->txt('paya_no_trustees'));
119  return true;
120  }
121 
122  $counter = 0;
123  $f_result = array();
124 
125  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
126  foreach($this->trustee_obj->getTrustees() as $trustee)
127  {
128  // GET USER OBJ
129  if($tmp_obj = ilObjectFactory::getInstanceByObjId($trustee['trustee_id'],false))
130  {
131  $f_result[$counter]['trustee_id'] = ilUtil::formCheckbox(in_array($trustee['trustee_id'],$_SESSION['paya_delete_trustee']) ? 1 : 0,
132  "trustee[]",
133  $trustee['trustee_id']);
134  $f_result[$counter]['login'] = $tmp_obj->getLogin();
135  $f_result[$counter]['firstname'] = $tmp_obj->getFirstname();
136  $f_result[$counter]['lastname'] = $tmp_obj->getLastname();
137 
138  $f_result[$counter]['perm_stat'] = ilUtil::formSelect((int) $trustee['perm_stat'],
139  'perm_stat['.$trustee['trustee_id'].']',
140  $actions,
141  false,
142  true);
143 
144  $f_result[$counter]['perm_obj'] = ilUtil::formSelect((int) $trustee['perm_obj'],
145  'perm_obj['.$trustee['trustee_id'].']',
146  $actions,
147  false,
148  true);
149 
150  $f_result[$counter]['perm_coupons'] = ilUtil::formSelect((int) $trustee['perm_coupons'],
151  'perm_coupons['.$trustee['trustee_id'].']',
152  $actions,
153  false,
154  true);
155 
156 # $link_mail = "<a target=\"_blank\" href=\"./ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".
157 # $tmp_obj->getLogin()."\"".$img_mail."</a>";
158  $url_mail = ilMailFormCall::getLinkTarget($this, '', array(), array('type' => 'new', 'rcp_to' => $tmp_obj->getLogin()));
159  $link_mail = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".
160  $url_mail."\">".$this->lng->txt("mail")."</a></div>";
161 
162  $f_result[$counter]['options'] = $link_mail;
163 
164  unset($tmp_obj);
165  ++$counter;
166  }
167  }
168  return $this->__showTrusteesTable($f_result);
169  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
setDataSource($href, $a_delimiter=null)
set datasource link for js autocomplete
$_POST['username']
Definition: cron.php:12
static getLinkTarget($gui, $cmd, Array $gui_params=array(), Array $mail_params=array())
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
This class represents a text property in a property form.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPaymentTrusteeGUI::update ( )

Definition at line 203 of file class.ilPaymentTrusteeGUI.php.

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

204  {
205  foreach($this->trustee_obj->getTrustees() as $trustee)
206  {
207  $this->trustee_obj->setTrusteeId($trustee['trustee_id']);
208  $this->trustee_obj->toggleStatisticPermission($_POST['perm_stat']["$trustee[trustee_id]"]);
209  $this->trustee_obj->toggleObjectPermission($_POST['perm_obj']["$trustee[trustee_id]"]);
210  $this->trustee_obj->toggleCouponsPermission($_POST['perm_coupons']["$trustee[trustee_id]"]);
211  $this->trustee_obj->modify();
212  }
213  ilUtil::sendInfo($this->lng->txt('paya_updated_trustees'));
214  $this->showTrustees();
215 
216  return true;
217  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showTrustees($a_show_delete=false)
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilPaymentTrusteeGUI::$ctrl

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

◆ $trustee_obj

ilPaymentTrusteeGUI::$trustee_obj = null

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

◆ $user_obj

ilPaymentTrusteeGUI::$user_obj

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

Referenced by __construct().


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