ILIAS  Release_4_2_x_branch Revision 61807
 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  {
19  global $lng;
21  }
22 
23  public function insert($a_tpl)
24  {
25  global $lng;
26 
27  $subtpl = new ilTemplate("tpl.billingmail_new_placeholders.html", false, false, "Services/Payment");
28  $subtpl->setVariable('TXT_USE_PLACEHOLDERS', $lng->txt('mail_nacc_use_placeholder'));
29  $subtpl->setVariable('TXT_PLACEHOLDERS_ADVISE', sprintf($lng->txt('placeholders_advise'), '<br />'));
30  $subtpl->setVariable('TXT_MAIL_SALUTATION', $lng->txt('mail_nacc_salutation'));
31  $subtpl->setVariable('TXT_FIRST_NAME', $lng->txt('firstname'));
32  $subtpl->setVariable('TXT_LAST_NAME', $lng->txt('lastname'));
33  $subtpl->setVariable('TXT_LOGIN', $lng->txt('mail_nacc_login'));
34  $subtpl->setVariable('TXT_ILIAS_URL', $lng->txt('mail_nacc_ilias_url'));
35  $subtpl->setVariable('TXT_CLIENT_NAME', $lng->txt('mail_nacc_client_name'));
36 
37  #$subtpl->setVariable('TXT_TRANSACTION', $lng->txt('transaction'));
38  #$subtpl->setVariable('TXT_TRANSACTION_EXTERN', $lng->txt('transaction_extern'));
39  #$subtpl->setVariable('TXT_ORDER_DATE', $lng->txt('order_date'));
40 
41  $a_tpl->setCurrentBlock("prop_generic");
42  $a_tpl->setVariable("PROP_GENERIC", $subtpl->get());
43  $a_tpl->parseCurrentBlock();
44  }
45 
46 
47  public static function replaceBillingMailPlaceholders($a_message, $a_user_id)
48  {
49  global $lng;
50 
51  $user = new ilObjUser($a_user_id);
52 
53  // determine salutation
54  switch ($user->getGender())
55  {
56  case 'f': $gender_salut = $lng->txt('salutation_f');
57  break;
58  case 'm': $gender_salut = $lng->txt('salutation_m');
59  break;
60  }
61 
62  $a_message = str_replace('[MAIL_SALUTATION]', $gender_salut, $a_message);
63  $a_message = str_replace('[LOGIN]', $user->getLogin(), $a_message);
64  $a_message = str_replace('[FIRST_NAME]', $user->getFirstname(), $a_message);
65  $a_message = str_replace('[LAST_NAME]', $user->getLastname(), $a_message);
66  $a_message = str_replace('[ILIAS_URL]', ILIAS_HTTP_PATH.'/login.php?client_id='.CLIENT_ID, $a_message);
67  $a_message = str_replace('[CLIENT_NAME]', CLIENT_NAME, $a_message);
68 
69 
70  include_once './Services/Payment/classes/class.ilShopLinkBuilder.php';
71  $shopLB = new ilShopLinkBuilder();
72  $bought_objects_url = $shopLB->buildLink('ilShopBoughtObjectsGUI');
73  $shop_url = $shopLB->buildLink('ilShopGUI');
74 
75  $a_message = str_replace('[SHOP_BOUGHT_OBJECTS_URL]', $bought_objects_url, $a_message);
76  $a_message = str_replace('[SHOP_URL]', $shop_url, $a_message);
77 
78  unset($user);
79 
80  return $a_message;
81  }
82 }
83 
84 ?>