当前位置: 首页>>代码示例>>PHP>>正文


PHP Time::defaultLocale方法代码示例

本文整理汇总了PHP中Cake\I18n\Time::defaultLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::defaultLocale方法的具体用法?PHP Time::defaultLocale怎么用?PHP Time::defaultLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\I18n\Time的用法示例。


在下文中一共展示了Time::defaultLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeFilter

 public function beforeFilter(Event $event)
 {
     parent::beforeFilter($event);
     Time::$defaultLocale = 'en-CA';
     Time::setToStringFormat('YYYY-MM-dd');
     $this->Session = $this->request->session();
     $this->set('Session', $this->Session);
     $this->_icons = $this->Utilities->setIcons();
     $this->set('icons', $this->_icons);
     $title = $this->Utilities->setDefaultTitle();
     $breadcrumbs = $this->Utilities->setDefaultBreadcrumbs();
     $this->set(compact('title', 'breadcrumbs'));
     if (empty($this->request->params['prefix'])) {
         $this->Auth->allow();
         $this->viewBuilder()->layout('public');
     }
     // Set the user logged in
     if (!is_null($this->Auth->user('id'))) {
         $Users = TableRegistry::get('Users');
         $this->_user = $Users->get($this->Auth->user('id'));
         $this->set('authUser', $this->_user);
     } else {
         $this->set('authUser', false);
     }
     // $this->set(compact($authUser));
     $nav = $this->_setNav();
     $this->set(compact('nav'));
 }
开发者ID:BreakfastMonkey,项目名称:breakfast-combo,代码行数:28,代码来源:AppController.php

示例2: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->View = new View();
     $this->Time = new TimeHelper($this->View);
     Time::$defaultLocale = 'en_US';
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:12,代码来源:TimeHelperTest.php

示例3: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'Pages', 'action' => 'display', 'home'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'display', 'home']]);
     Time::$defaultLocale = 'fr-FR';
 }
开发者ID:rylapse,项目名称:cake_burgerking,代码行数:17,代码来源:AppController.php

示例4: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('Flash');
     $this->loadComponent('Paginator');
     Time::$defaultLocale = 'es-ES';
     Time::setToStringFormat('dd-MM-YYYY HH:mm');
 }
开发者ID:aguiluxo,项目名称:iestrascolar,代码行数:15,代码来源:AppController.php

示例5: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     $this->loadComponent('Flash');
     $this->loadComponent('RequestHandler');
     // added in line to format date correctly
     Time::$defaultLocale = 'en-AU';
     Time::setToStringFormat('dd/MM/YYYY');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password']]], 'loginRedirect' => ['controller' => 'pages', 'action' => 'home'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'display', 'home']]);
 }
开发者ID:kfer10,项目名称:excel,代码行数:18,代码来源:AppController.php

示例6: initialize

 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'Characters', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'login']]);
     $this->loadComponent('Cookie');
     $this->loadComponent('Slack', ['webhook_url' => Configure::read('Slack.webhook_url'), 'enabled' => Configure::read('Slack.enabled')]);
     Time::$defaultLocale = 'en-GB';
 }
开发者ID:Cylindric,项目名称:edge,代码行数:10,代码来源:AppController.php

示例7: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Time::setTestNow($this->now);
     Time::$defaultLocale = $this->locale;
     Time::resetToStringFormat();
     FrozenTime::setTestNow($this->frozenNow);
     FrozenTime::$defaultLocale = $this->locale;
     FrozenTime::resetToStringFormat();
     date_default_timezone_set('UTC');
 }
开发者ID:jdaosavanh,项目名称:clickerwebapp,代码行数:16,代码来源:TimeTest.php

示例8: viewAllInfo

 /**
  * viewAllInfo method
  * 
  * @author Gustavo Marques | Genival Rocha | Caroline Machado
  * @param UUID $idlotebandejas Primary key loteBandejas.
  * @return void
  */
 public function viewAllInfo($idlotebandejas = null)
 {
     Time::$defaultLocale = 'pt-BR';
     $this->loadModel('Alimentacao');
     $alimeQuery = $this->Alimentacao->find('all')->where(['fk_lotebandejas' => $idlotebandejas]);
     $lotebandeja = $this->Lotebandejas->get($idlotebandejas, ['contain' => []]);
     $this->paginate = ['maxLimit' => 11];
     $this->set('alimentacao', $this->paginate($alimeQuery));
     $this->set('lotebandeja', $lotebandeja);
     $this->set('_serialize', ['lotebandeja']);
 }
开发者ID:JohnathanALves,项目名称:Final,代码行数:18,代码来源:LotebandejasController.php

示例9: list_add

 /**
  * list_add method
  * @author Gustavo Marques | Genival Rocha | Caroline Machado
  * @param string|null $idBequer Bequer id, string|null $idBequer Numero do Bequer
  * @return void Redireciona para mesma pagina.
  */
 public function list_add($idBequer = null, $n_bequer = null)
 {
     Time::$defaultLocale = 'pt-BR';
     $ovosQuery = $this->Ovos->find('all')->where(['fk_bequer' => $idBequer]);
     $this->paginate = ['maxLimit' => 3];
     $this->set('ListOvos', $this->paginate($ovosQuery));
     $ovo = $this->Ovos->newEntity();
     $this->set('n_bequer', $n_bequer);
     if ($this->request->is('post')) {
         $ovo = $this->Ovos->patchEntity($ovo, $this->request->data);
         $ovo->set(['fk_bequer' => $idBequer]);
         if ($this->Ovos->save($ovo)) {
             $this->Flash->success('Ovo salvo com sucesso.');
             return $this->redirect(['action' => 'list_add', $idBequer, $n_bequer]);
         } else {
             $this->Flash->error('Não foi possível salvar o ovo. Por favor, tente novamente.');
         }
     }
     $this->set(compact('ovo'));
     $this->set('_serialize', ['ovo']);
 }
开发者ID:JohnathanALves,项目名称:Final,代码行数:27,代码来源:OvosController.php

示例10: list_add

 /**
  * list_add method
  * @author Gustavo Marques | Genival Rocha | Caroline Machado
  * @param UUID|null idAlimentacao Alimentacao id, UUID|null $fk_lotebandejas Foreign key lotebandejas, int|null $n_bandeja Numero da bandeja
  * @return void Redireciona para mesma pagina.
  */
 public function list_add($fk_lotebandejas = null, $n_bandeja = null)
 {
     Time::$defaultLocale = 'pt-BR';
     $alimentacaoQuery = $this->Alimentacao->find('all')->where(['fk_lotebandejas' => $fk_lotebandejas]);
     $this->paginate = ['maxLimit' => 3];
     $this->set('ListAlimentacao', $this->paginate($alimentacaoQuery));
     $alimentacao = $this->Alimentacao->newEntity();
     $this->set('n_bandeja', $n_bandeja);
     if ($this->request->is('post')) {
         $alimentacao = $this->Alimentacao->patchEntity($alimentacao, $this->request->data);
         $alimentacao->set(['fk_lotebandejas' => $fk_lotebandejas]);
         if ($this->Alimentacao->save($alimentacao)) {
             $this->Flash->success('Cadastro de Alimentação adicionado com sucesso.');
             return $this->redirect(['action' => 'list_add', $fk_lotebandejas, $n_bandeja]);
         } else {
             $this->Flash->error('Não foi possível adicionar o cadastro de alimentação. Por favor, tente novamente.');
         }
     }
     $this->set(compact('alimentacao'));
     $this->set('_serialize', ['alimentacao']);
 }
开发者ID:JohnathanALves,项目名称:Final,代码行数:27,代码来源:AlimentacaoController.php

示例11: add

 /**
  * Add method
  *
  * @return void Redirects on successful add, renders view otherwise.
  */
 public function add()
 {
     Time::$defaultLocale = 'pt-BR';
     $this->loadModel('Lotetransporte');
     $lotesDisponiveis = $this->Lotetransporte->find('all');
     $lotesList = $lotesDisponiveis->find('list', ['value' => 'lotetransporteid', 'valueField' => 'n_transporte']);
     $this->set('optionLotes', $lotesList);
     $temperaturatransporte = $this->Temperaturatransporte->newEntity();
     if ($this->request->is('post')) {
         $temperaturatransporte = $this->Temperaturatransporte->patchEntity($temperaturatransporte, $this->request->data);
         $hora_leitura = $this->request->data('hora_leitura');
         $temperaturatransporte->set(['hora_leitura' => $hora_leitura['hour'] . ':' . $hora_leitura['minute']]);
         if ($this->Temperaturatransporte->save($temperaturatransporte)) {
             $this->Flash->success('The temperaturatransporte has been saved.');
             return $this->redirect(['action' => 'index']);
         } else {
             $this->Flash->error('The temperaturatransporte could not be saved. Please, try again.');
         }
     }
     $this->set(compact('temperaturatransporte'));
     $this->set('_serialize', ['temperaturatransporte']);
 }
开发者ID:JohnathanALves,项目名称:Final,代码行数:27,代码来源:TemperaturatransporteController.php

示例12: add

 /**
  * Add method
  *
  * @author Gustavo Marques | Genival Rocha | Caroline Machado
  * @return void Redirects on successful add, renders view otherwise.
  */
 public function add()
 {
     Time::$defaultLocale = 'pt-BR';
     $this->loadModel('Lotebandejas');
     $this->loadModel('Bequer');
     //$lotesRecentes = $this->Lotebandejas->find('all', ['fields' => 'codigo']);
     $lotesDisponiveis = $this->Lotebandejas->find('all')->join(['table' => 'montagem', 'type' => 'LEFT', 'alias' => 'c', 'conditions' => ['c.fk_lotebandejas = lotebandejas.lotebandejasid']])->where(['c.fk_bequer IS NULL']);
     $lotesList = $lotesDisponiveis->find('list', ['value' => 'lotebandejasid', 'valueField' => 'codigo']);
     $this->set('optionLotes', $lotesList);
     $bequerList = $this->Bequer->find('list', ['value' => 'bequerid', 'valueField' => 'n_bequer', 'order' => ['n_bequer' => 'desc']]);
     $this->set('optionBequer', $bequerList);
     $montagem = $this->Montagem->newEntity();
     if ($this->request->is('post')) {
         $arrayBequer = $this->request->data('list_bequer');
         if ($arrayBequer == '') {
             $this->Flash->error('Por favor selecione um béquer.');
         } else {
             $lotebandejasForm = $this->request->data('fk_lotebandejas');
             $lotebandejasQuery = $this->Lotebandejas->get($lotebandejasForm);
             $tipoBandejaConst = $this->request->data('tipo_bandeja') . $lotebandejasQuery->codigo;
             foreach ($arrayBequer as $value) {
                 $montagem = $this->Montagem->newEntity();
                 $montagem = $this->Montagem->patchEntity($montagem, $this->request->data);
                 $montagem->set(['fk_bequer' => $value]);
                 $montagem->set(['tipo_bandeja' => $tipoBandejaConst]);
                 if ($this->Montagem->save($montagem)) {
                     $this->Flash->success('Cadastro de montagem adicionado com sucesso.');
                 } else {
                     $this->Flash->error('Não foi possível adicionar o cadastro de montagem. Por favor, tente novamente.');
                 }
             }
             return $this->redirect(['action' => 'index']);
         }
     }
     $this->set(compact('montagem'));
     $this->set('_serialize', ['montagem']);
 }
开发者ID:JohnathanALves,项目名称:Final,代码行数:43,代码来源:MontagemController.php

示例13: testParseDateDifferentTimezone

 /**
  * Tests that parsing a date respects de default timezone in PHP.
  *
  * @return void
  */
 public function testParseDateDifferentTimezone()
 {
     date_default_timezone_set('Europe/Paris');
     Time::$defaultLocale = 'fr-FR';
     $result = Time::parseDate('12/03/2015');
     $this->assertEquals('2015-03-12', $result->format('Y-m-d'));
     $this->assertEquals(new \DateTimeZone('Europe/Paris'), $result->tz);
 }
开发者ID:RogerSchmeier,项目名称:Webtruck,代码行数:13,代码来源:TimeTest.php

示例14: testFormat

 /**
  * test formatting dates taking in account preferred i18n locale file
  *
  * @return void
  */
 public function testFormat()
 {
     $time = strtotime('Thu Jan 14 13:59:28 2010');
     $result = $this->Time->format($time);
     $expected = '1/14/10, 1:59 PM';
     $this->assertTimeFormat($expected, $result);
     $result = $this->Time->format($time, \IntlDateFormatter::FULL);
     $expected = 'Thursday, January 14, 2010 at 1:59:28 PM GMT';
     $this->assertTimeFormat($expected, $result);
     $result = $this->Time->format('invalid date', null, 'Date invalid');
     $expected = 'Date invalid';
     $this->assertEquals($expected, $result);
     I18n::locale('fr_FR');
     Time::$defaultLocale = 'fr_FR';
     $time = new \Cake\I18n\FrozenTime('Thu Jan 14 13:59:28 2010');
     $result = $this->Time->format($time, \IntlDateFormatter::FULL);
     $expected = 'jeudi 14 janvier 2010 13:59:28 UTC';
     $this->assertTimeFormat($expected, $result);
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:24,代码来源:TimeHelperTest.php

示例15: testToString

 /**
  * Tests that __toString uses the i18n formatter
  *
  * @return void
  */
 public function testToString()
 {
     $time = new Time('2014-04-20 22:10');
     Time::$defaultLocale = 'fr-FR';
     Time::setToStringFormat(\IntlDateFormatter::FULL);
     $this->assertTimeFormat('dimanche 20 avril 2014 22:10:00 UTC', (string) $time);
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:12,代码来源:TimeTest.php


注:本文中的Cake\I18n\Time::defaultLocale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。