Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TestsController extends AppController {
- ....
- public $myConverter;
- public $myLocale = '';
- public $myTimezone = '';
- public $myCurr = '';
- ...
- }
- public function converterUtil() {
- $this->myConverter = new ConverterUtil();
- if (!empty($this->params['pass'][0])) {
- switch ($this->params['pass'][0]) {
- case 'jpn':
- Configure::write('Config.language','jpn');
- $this->myLocale = 'ja_jp';
- $this->myTimezone = 'Asia/Tokyo';
- $this->myCurr = 'JPY';
- break;
- case 'idn':
- Configure::write('Config.language','idn');
- $this->myLocale = 'id_ID';
- $this->myTimezone = 'Asia/Jakarta';
- $this->myCurr = 'IDR';
- break;
- case 'eng':
- Configure::write('Config.language','eng');
- $this->myLocale = 'en_US';
- $this->myTimezone = 'America/New_York';
- $this->myCurr = 'USD';
- break;
- default:
- Configure::write('Config.language','eng');
- $this->myLocale = 'en_US';
- $this->myTimezone = 'America/New_York';
- $this->myCurr = 'USD';
- break;
- }
- $this->myConverter->init($this->myLocale, $this->myTimezone, $this->myCurr);
- }else {
- // debug('empty');
- }
- $testData = $this->Test->find('all');
- // debug($this->myLocale);
- $this->set('test_data', $testData);
- $this->set('locale', $this->myLocale);
- $this->set('timezone', $this->myTimezone);
- $this->set('curr', $this->myCurr);
- }
- public function saveTests() {
- $msg = [];
- $this->Test->set($this->request->data('content'));
- $this->log('isi data content');
- $this->log($this->myLocale);
- $this->log($this->myTimezone);
- $this->log($this->myCurr);
- ....
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement