ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilBillingMailPlaceholdersPropertyGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 include_once 'Services/Form/classes/class.ilFormPropertyGUI.php';
13 
15 {
16 
17  public function __construct()
18  {
20  }
21 
22  public function insert($a_tpl)
23  {
24  global $lng;
25 
26  $subtpl = new ilTemplate("tpl.billingmail_new_placeholders.html", false, false, "Services/Payment");
27  $subtpl->setVariable('TXT_USE_PLACEHOLDERS', $lng->txt('mail_nacc_use_placeholder'));
28  $subtpl->setVariable('TXT_PLACEHOLDERS_ADVISE', sprintf($lng->txt('placeholders_advise'), '<br />'));
29  $subtpl->setVariable('TXT_MAIL_SALUTATION', $lng->txt('mail_nacc_salutation'));
30  $subtpl->setVariable('TXT_FIRST_NAME', $lng->txt('firstname'));
31  $subtpl->setVariable('TXT_LAST_NAME', $lng->txt('lastname'));
32  $subtpl->setVariable('TXT_LOGIN', $lng->txt('mail_nacc_login'));
33  $subtpl->setVariable('TXT_ILIAS_URL', $lng->txt('mail_nacc_ilias_url'));
34  $subtpl->setVariable('TXT_CLIENT_NAME', $lng->txt('mail_nacc_client_name'));
35 
36  #$subtpl->setVariable('TXT_TRANSACTION', $lng->txt('transaction'));
37  #$subtpl->setVariable('TXT_TRANSACTION_EXTERN', $lng->txt('transaction_extern'));
38  #$subtpl->setVariable('TXT_ORDER_DATE', $lng->txt('order_date'));
39 
40  $a_tpl->setCurrentBlock("prop_generic");
41  $a_tpl->setVariable("PROP_GENERIC", $subtpl->get());
42  $a_tpl->parseCurrentBlock();
43  }
44 
45 
46  public static function replaceBillingMailPlaceholders($a_message, $a_user_id)
47  {
48  global $lng;
49 
50  $user = new ilObjUser($a_user_id);
51 
52  // determine salutation
53  switch ($user->getGender())
54  {
55  case 'f': $gender_salut = $lng->txt('salutation_f');
56  break;
57  case 'm': $gender_salut = $lng->txt('salutation_m');
58  break;
59  }
60 
61  $a_message = str_replace('[MAIL_SALUTATION]', $gender_salut, $a_message);
62  $a_message = str_replace('[LOGIN]', $user->getLogin(), $a_message);
63  $a_message = str_replace('[FIRST_NAME]', $user->getFirstname(), $a_message);
64  $a_message = str_replace('[LAST_NAME]', $user->getLastname(), $a_message);
65  $a_message = str_replace('[ILIAS_URL]', ILIAS_HTTP_PATH.'/login.php?client_id='.CLIENT_ID, $a_message);
66  $a_message = str_replace('[CLIENT_NAME]', CLIENT_NAME, $a_message);
67 
68 
69  include_once './Services/Payment/classes/class.ilShopLinkBuilder.php';
70  $shopLB = new ilShopLinkBuilder();
71  $bought_objects_url = $shopLB->buildLink('ilShopBoughtObjectsGUI');
72  $shop_url = $shopLB->buildLink('ilShopGUI');
73 
74  $a_message = str_replace('[SHOP_BOUGHT_OBJECTS_URL]', $bought_objects_url, $a_message);
75  $a_message = str_replace('[SHOP_URL]', $shop_url, $a_message);
76 
77  unset($user);
78 
79  return $a_message;
80  }
81 }
82 
83 ?>