Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. class TestsController extends AppController {
  2.  
  3. ....
  4. public $myConverter;
  5. public $myLocale = '';
  6. public $myTimezone = '';
  7. public $myCurr = '';
  8. ...
  9. }
  10.  
  11. public function converterUtil() {
  12. $this->myConverter = new ConverterUtil();
  13. if (!empty($this->params['pass'][0])) {
  14. switch ($this->params['pass'][0]) {
  15. case 'jpn':
  16. Configure::write('Config.language','jpn');
  17. $this->myLocale = 'ja_jp';
  18. $this->myTimezone = 'Asia/Tokyo';
  19. $this->myCurr = 'JPY';
  20. break;
  21. case 'idn':
  22. Configure::write('Config.language','idn');
  23. $this->myLocale = 'id_ID';
  24. $this->myTimezone = 'Asia/Jakarta';
  25. $this->myCurr = 'IDR';
  26. break;
  27. case 'eng':
  28. Configure::write('Config.language','eng');
  29. $this->myLocale = 'en_US';
  30. $this->myTimezone = 'America/New_York';
  31. $this->myCurr = 'USD';
  32. break;
  33. default:
  34. Configure::write('Config.language','eng');
  35. $this->myLocale = 'en_US';
  36. $this->myTimezone = 'America/New_York';
  37. $this->myCurr = 'USD';
  38. break;
  39. }
  40. $this->myConverter->init($this->myLocale, $this->myTimezone, $this->myCurr);
  41.  
  42. }else {
  43. // debug('empty');
  44. }
  45. $testData = $this->Test->find('all');
  46. // debug($this->myLocale);
  47.  
  48. $this->set('test_data', $testData);
  49. $this->set('locale', $this->myLocale);
  50. $this->set('timezone', $this->myTimezone);
  51. $this->set('curr', $this->myCurr);
  52. }
  53.  
  54. public function saveTests() {
  55. $msg = [];
  56. $this->Test->set($this->request->data('content'));
  57. $this->log('isi data content');
  58. $this->log($this->myLocale);
  59. $this->log($this->myTimezone);
  60. $this->log($this->myCurr);
  61. ....
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement