31 include_once
'./payment/classes/class.ilPaymentTrustees.php';
45 $this->lng->loadLanguageModule(
'crs');
47 $this->ctrl->saveParameter($this,
'baseClass');
58 $ilTabs->setTabActive(
'paya_header');
59 $ilTabs->setSubTabActive(
'paya_trustees');
66 $cmd = $this->ctrl->getCmd();
67 switch ($this->ctrl->getNextClass($this))
70 if(!
$cmd = $this->ctrl->getCmd())
72 $cmd =
'showTrustees';
93 $actions = array(0 => $this->lng->txt(
"paya_disabled"),
94 1 => $this->lng->txt(
"paya_enabled"));
97 $this->
showButton(
'searchUser',$this->lng->txt(
'search_user'));
99 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_trustees.html',
'payment');
104 $this->tpl->setCurrentBlock(
"confirm_delete");
105 $this->tpl->setVariable(
"CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
106 $this->tpl->setVariable(
"TXT_CANCEL",$this->lng->txt(
'cancel'));
107 $this->tpl->setVariable(
"TXT_CONFIRM",$this->lng->txt(
'delete'));
108 $this->tpl->parseCurrentBlock();
111 if(!count($this->trustee_obj->getTrustees()))
121 $img_mail =
"<img src=\"".ilUtil::getImagePath(
"icon_pencil_b.gif").
"\" alt=\"".
122 $this->lng->txt(
"crs_mem_send_mail").
123 "\" title=\"".$this->lng->txt(
"crs_mem_send_mail").
"\" border=\"0\" vspace=\"0\"/>";
126 foreach($this->trustee_obj->getTrustees() as $trustee)
133 $trustee[
'trustee_id']);
134 $f_result[$counter][] = $tmp_obj->getLogin();
135 $f_result[$counter][] = $tmp_obj->getFirstname();
136 $f_result[$counter][] = $tmp_obj->getLastname();
139 'perm_stat['.$trustee[
'trustee_id'].
']',
145 'perm_obj['.$trustee[
'trustee_id'].
']',
151 'perm_coupons['.$trustee[
'trustee_id'].
']',
156 # $link_mail = "<a target=\"_blank\" href=\"./ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".
157 # $tmp_obj->getLogin()."\"".$img_mail."</a>";
158 $link_mail =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"./ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".
159 $tmp_obj->getLogin().
"\">".$this->lng->txt(
"mail").
"</a></div>";
161 $f_result[$counter][] = $link_mail;
172 if(!is_array($_POST[
'trustee']))
179 $_SESSION[
'paya_delete_trustee'] = $_POST[
'trustee'];
187 if(is_array(
$_SESSION[
'paya_delete_trustee']))
189 foreach(
$_SESSION[
'paya_delete_trustee'] as $id)
191 $this->trustee_obj->setTrusteeId($id);
192 $this->trustee_obj->delete();
204 foreach($this->trustee_obj->getTrustees() as $trustee)
206 $this->trustee_obj->setTrusteeId($trustee[
'trustee_id']);
207 $this->trustee_obj->toggleStatisticPermission($_POST[
'perm_stat'][
"$trustee[trustee_id]"]);
208 $this->trustee_obj->toggleObjectPermission($_POST[
'perm_obj'][
"$trustee[trustee_id]"]);
209 $this->trustee_obj->toggleCouponsPermission($_POST[
'perm_coupons'][
"$trustee[trustee_id]"]);
210 $this->trustee_obj->modify();
220 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_user_search.html",
'payment');
221 $this->
showButton(
'showTrustees',$this->lng->txt(
'back'));
223 $this->lng->loadLanguageModule(
'search');
225 $this->tpl->setVariable(
"F_ACTION",$this->ctrl->getFormAction($this));
226 $this->tpl->setVariable(
"SEARCH_ASSIGN_USR",$this->lng->txt(
"crs_search_members"));
227 $this->tpl->setVariable(
"SEARCH_SEARCH_TERM",$this->lng->txt(
"search_search_term"));
228 $this->tpl->setVariable(
"SEARCH_VALUE",
$_SESSION[
"pays_search_str_trustee"] ?
$_SESSION[
"pays_search_str_trustee"] :
"");
229 $this->tpl->setVariable(
"BTN2_VALUE",$this->lng->txt(
"cancel"));
230 $this->tpl->setVariable(
"BTN1_VALUE",$this->lng->txt(
"search"));
231 $this->tpl->setVariable(
"SEARCH",
"performSearch");
232 $this->tpl->setVariable(
"CANCEL",
"showTrustees");
239 $_SESSION[
"paya_search_str"] = $_POST[
"search_str"];
246 $_SESSION[
"pays_search_str_trustee"] = $_POST[
"search_str"] = $_POST[
"search_str"] ? $_POST[
"search_str"] :
$_SESSION[
"pays_search_str_trustee"];
249 if(!$_POST[
"search_str"])
252 # $this->searchUser();
260 # $this->searchUser();
266 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_usr_selection.html",
'payment');
267 $this->
showButton(
"searchUser",$this->lng->txt(
"back"));
278 $f_result[$counter][] = $tmp_obj->getLogin();
279 $f_result[$counter][] = $tmp_obj->getFirstname();
280 $f_result[$counter][] = $tmp_obj->getLastname();
290 if(!is_array($_POST[
"user"]))
294 # $this->showTrustees();
298 if(in_array($this->user_obj->getId(),$_POST[
'user']))
301 # $this->performSearch();
310 foreach($_POST[
'user'] as $user_id)
312 if($this->trustee_obj->isTrustee($user_id))
316 $this->trustee_obj->setTrusteeId($user_id);
317 $this->trustee_obj->toggleStatisticPermission(
false);
318 $this->trustee_obj->toggleObjectPermission(
true);
319 $this->trustee_obj->toggleCouponsPermission(
true);
320 $this->trustee_obj->add();
342 if(!$_POST[
'trustee_login'])
356 if($this->trustee_obj->isTrustee($user_id))
363 if($user_id == $this->user_obj->getId())
372 $this->trustee_obj->setTrusteeId($user_id);
373 $this->trustee_obj->toggleObjectPermission(
false);
374 $this->trustee_obj->toggleStatisticPermission(
true);
375 $this->trustee_obj->toggleCouponsPermission(
true);
376 $this->trustee_obj->add();
388 include_once(
"./classes/class.ilSearch.php");
390 $this->lng->loadLanguageModule(
"content");
392 $search =&
new ilSearch($this->user_obj->getId());
395 $search->setCombination(
"and");
396 $search->setSearchFor(array(0 =>
'usr'));
397 $search->setSearchType(
'new');
399 if($search->validate($message))
401 $search->performSearch();
406 $this->ctrl->redirect($this,
"searchUser");
408 return $search->getResultByType(
'usr');
413 $tpl =& $tbl->getTemplateObject();
417 $tpl->setCurrentBlock(
"tbl_form_header");
418 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
419 $tpl->parseCurrentBlock();
421 $tpl->setCurrentBlock(
"tbl_action_btn");
422 $tpl->setVariable(
"BTN_NAME",
"addTrustee");
423 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"add"));
424 $tpl->parseCurrentBlock();
426 $tpl->setCurrentBlock(
"tbl_action_btn");
427 $tpl->setVariable(
"BTN_NAME",
"showTrustees");
428 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"cancel"));
429 $tpl->parseCurrentBlock();
431 $tpl->setCurrentBlock(
"tbl_action_row");
432 $tpl->setVariable(
"COLUMN_COUNTS",5);
434 $tpl->parseCurrentBlock();
436 $tbl->setTitle($this->lng->txt(
"paya_trustee_table"),
"icon_usr.gif",$this->lng->txt(
"crs_header_edit_members"));
437 $tbl->setHeaderNames(array(
"",
438 $this->lng->txt(
"login"),
439 $this->lng->txt(
"firstname"),
440 $this->lng->txt(
"lastname")));
441 $tbl->setHeaderVars(array(
"",
445 array(
"cmd" =>
'performSearch',
446 "cmdClass" =>
"ilpaymenttrusteegui",
447 "cmdNode" =>
$_GET[
"cmdNode"],
448 'baseClass' =>
'ilShopController'));
450 $tbl->setColumnWidth(array(
"3%",
"32%",
"32%",
"32%"));
455 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());
463 $tpl =& $tbl->getTemplateObject();
466 $tpl->setCurrentBlock(
"tbl_form_header");
468 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
469 $tpl->parseCurrentBlock();
471 $tpl->setCurrentBlock(
"tbl_action_row");
482 $tpl->setCurrentBlock(
"input_text");
483 $tpl->setVariable(
"PB_TXT_NAME",
'search_str');
484 $tpl->setVariable(
"PB_TXT_VALUE",
$_SESSION[
"paya_search_str"]);
485 $tpl->parseCurrentBlock();
487 $tpl->setCurrentBlock(
"plain_button");
488 $tpl->setVariable(
"PBTN_NAME",
"newSearch");
489 $tpl->setVariable(
"PBTN_VALUE",$this->lng->txt(
"crs_add_member"));
490 $tpl->parseCurrentBlock();
492 $tpl->setCurrentBlock(
"plain_button");
493 $tpl->setVariable(
"PBTN_NAME",
"update");
494 $tpl->setVariable(
"PBTN_VALUE",$this->lng->txt(
"apply"));
495 $tpl->parseCurrentBlock();
497 $tpl->setCurrentBlock(
"plain_buttons");
498 $tpl->parseCurrentBlock();
500 $tpl->setVariable(
"COLUMN_COUNTS",8);
503 $tpl->setCurrentBlock(
"tbl_action_button");
504 $tpl->setVariable(
"BTN_NAME",
"deleteTrustee");
505 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"delete"));
506 $tpl->parseCurrentBlock();
507 $tpl->setCurrentBlock(
"tbl_action_row");
508 $tpl->setVariable(
"TPLPATH",$this->tpl->tplPath);
509 $tpl->parseCurrentBlock();
511 $tbl->setTitle($this->lng->txt(
"paya_trustee_table"),
"icon_usr.gif",$this->lng->txt(
"paya_trustee_table"));
512 $tbl->setHeaderNames(array(
'',
513 $this->lng->txt(
"login"),
514 $this->lng->txt(
"firstname"),
515 $this->lng->txt(
"lastname"),
516 $this->lng->txt(
"paya_perm_stat"),
517 $this->lng->txt(
"paya_perm_obj"),
518 $this->lng->txt(
"paya_perm_coupons"),
520 $tbl->setHeaderVars(array(
"",
528 array(
"cmd" =>
"showTrustees",
529 "cmdClass" =>
"ilpaymenttrusteegui",
530 "cmdNode" =>
$_GET[
"cmdNode"],
531 'baseClass' =>
'ilShopController'));
532 $tbl->setColumnWidth(array(
"4%",
"15%",
"15%",
"15%",
"15%",
"15%",
"15%",
"15%"));
538 $this->tpl->setVariable(
"TRUSTEE_TABLE",$tbl->tpl->get());