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


PHP Text::uuid方法代码示例

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


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

示例1: ajaxSendCall

 public function ajaxSendCall()
 {
     try {
         $numberListTable = TableRegistry::get('NumberLists');
         $sendQueueTable = TableRegistry::get('SendQueues');
         $numberTable = TableRegistry::get('Numbers');
         // Check if list exists
         $numberList = $numberListTable->find('all', ['conditions' => ['number_list_id' => $this->request->data['call']['number_list_id']]]);
         if (!$numberList->count()) {
             throw new \Exception('Cannot locate list.');
         }
         $number = $numberTable->find('all', ['conditions' => ['number_list_id' => $this->request->data['call']['number_list_id']]]);
         $numberCount = $number->count();
         if (!$numberCount) {
             throw new \Exception('No numbers in the list');
         }
         $data = ['unique_id' => Text::uuid(), 'type' => 2, 'number_list_id' => $this->request->data['call']['number_list_id'], 'status' => 0, 'message' => $this->request->data['call']['message'], 'audio_id' => $this->request->data['call']['audio_id'], 'request_by' => null, 'total' => $numberCount, 'create_datetime' => new \DateTime('now', new \DateTimeZone('UTC'))];
         $sendQueue = $sendQueueTable->newEntity($data);
         $sendQueueTable->save($sendQueue);
         // Hit the cron
         shell_exec(ROOT . DS . 'bin' . DS . 'cake SendCall ' . $sendQueue->send_queue_id . ' > /dev/null 2>/dev/null &');
         $response['status'] = 1;
         $response['sendQueueId'] = $sendQueue->send_queue_id;
         $response['numberCount'] = $numberCount;
     } catch (\Exception $ex) {
         $response['status'] = 0;
         $response['message'] = $ex->getMessage();
     }
     $this->set(compact('response'));
     $this->set('_serialize', ['response']);
 }
开发者ID:Ytel-Inc,项目名称:ENS,代码行数:31,代码来源:CallController.php

示例2: add

 public function add()
 {
     $clientInfo = $this->ClientInfos->newEntity();
     if ($this->request->is('post')) {
         $userid = Text::uuid();
         $contactid = Text::uuid();
         $clientid = Text::uuid();
         $this->loadModel('Users');
         $users = $this->Users->newEntity();
         $users = $this->Users->patchEntity($users, $this->request->data['Users']);
         $this->Users->save($users);
         $this->loadModel('ClientInfos');
         $clientInfos = $this->ClientInfos->newEntity();
         $clientInfos = $this->ClientInfos->patchEntity($clientInfos, $this->request->data['ClientInfos']);
         $this->ClientInfos->save($clientInfos);
         $this->loadModel('ClientContacts');
         $clientContacts = $this->ClientContacts->newEntity();
         $clientContacts = $this->ClientContacts->patchEntity($clientContacts, $this->request->data['ClientContacts']);
         $this->ClientContacts->save($clientContacts);
         return $this->redirect(['controller' => 'ClientDevices', 'action' => 'add']);
     }
     $clientTypes = $this->ClientInfos->ClientTypes->find('list', ['limit' => 200]);
     $companyTypes = $this->ClientInfos->CompanyTypes->find('list', ['limit' => 200]);
     $this->set(compact('clientInfo', 'clientTypes', 'companyTypes'));
     $this->set('_serialize', ['clientInfo']);
 }
开发者ID:julkar9,项目名称:ntrack,代码行数:26,代码来源:ClientInfosController.php

示例3: request_id

 private static function request_id()
 {
     if (empty(self::$_request_id)) {
         self::$_request_id = Text::uuid();
     }
     return self::$_request_id;
 }
开发者ID:snelg,项目名称:cakephp-audit-log,代码行数:7,代码来源:AuditableBehavior.php

示例4: send

 public function send($data, $old_data = null)
 {
     if (!empty($data)) {
         $filename = $data['name'];
         $file_tmp_name = $data['tmp_name'];
         $dir_root = WWW_ROOT . 'img' . DS . 'uploads';
         $dir = 'uploads';
         $allowed = array('png', 'jpg', 'jpeg');
         if (!in_array(substr(strrchr($filename, '.'), 1), $allowed)) {
             return false;
         } elseif (is_uploaded_file($file_tmp_name)) {
             if ($old_data != null) {
                 $old_file = substr(strrchr($old_data, DS), 1);
                 if (file_exists($dir_root . DS . $old_file)) {
                     unlink($dir_root . DS . $old_file);
                 }
             }
             $file = Text::uuid() . '-' . $filename;
             // enregistrement du nom du fichier
             $file_root = $dir_root . DS . $file;
             // definition du chemin ou sera stocker le fichier
             move_uploaded_file($file_tmp_name, $file_root);
             // deplacement du fichier
             $filedb = $dir . DS . $file;
             // definition du chemin qui sera utilise dans la base de donnee
             return $filedb;
         }
     }
 }
开发者ID:wilrona,项目名称:ApplicationDT,代码行数:29,代码来源:UploadComponent.php

示例5: groupLink

 /**
  * group link function
  * @param string $title title for menu link
  * @param array $urls force array
  * @param array $options configure for link
  * @return string inside <li> tag
  */
 public function groupLink($title, array $urls = [], array $options = [])
 {
     $result = '<li class="panel panel-default dropdown">';
     $controller = $this->Html->request->controller;
     foreach ($urls as $k => $v) {
         if (isset($v[1]) && $controller === $v[1]['controller']) {
             $result = '<li class="active panel panel-default dropdown">';
             break;
         }
     }
     $collapseId = Text::uuid();
     $result .= $this->Html->link($title, '#' . $collapseId, ['data-toggle' => 'collapse', 'escape' => false]);
     $result .= '<div id="' . $collapseId . '" class="panel-collapse collapse">';
     $result .= '<div class="panel-body">';
     $result .= '<ul class="nav navbar-nav">';
     foreach ($urls as $k => $v) {
         if (empty($v[0]) || empty($v[1])) {
             continue;
         }
         $result .= '<li>' . $this->Html->link($v[0], $v[1]) . '</li>';
     }
     $result .= '</ul>';
     $result .= '</div>';
     $result .= '</div>';
     $result .= '</li>';
     return $result;
 }
开发者ID:crabstudio,项目名称:app,代码行数:34,代码来源:MenuHelper.php

示例6: add

 /**
  * Add method
  *
  * @return void Redirects on successful add, renders view otherwise.
  */
 public function add()
 {
     $municipios = $this->Locais->Municipios->find('all')->toArray();
     $array;
     $op;
     $i = 0;
     foreach ($municipios as $x) {
         $op[$i] = $x['cnm_municipio'] . ' (' . $x['ccd_municipio'] . ')';
         $array[$i] = $x['id'];
         $i++;
     }
     $local = $this->Locais->newEntity();
     if ($this->request->is('post')) {
         $local = $this->Locais->patchEntity($local, $this->request->data);
         $local->id = Text::uuid();
         $local->municipio_id = $array[$local->municipio_id];
         if ($this->Locais->save($local)) {
             $this->Flash->success(__('O local foi salvo.'));
             return $this->redirect(['action' => 'index']);
         } else {
             $this->Flash->error(__('O local não pôde ser salvo. Tente novamente.'));
         }
     }
     $this->set(compact('local', 'op'));
     $this->set('_serialize', ['local']);
 }
开发者ID:eversonjjo,项目名称:sce,代码行数:31,代码来源:LocaisController.php

示例7: render

 /**
  * Render a text widget or other simple widget like email/tel/number.
  *
  * This method accepts a number of keys:
  *
  * - `name` The name attribute.
  * - `val` The value attribute.
  * - `escape` Set to false to disable escaping on all attributes.
  *
  * Any other keys provided in $data will be converted into HTML attributes.
  *
  * @param array $data The data to build an input with.
  * @param \Cake\View\Form\ContextInterface $context The current form context.
  * @return string
  */
 public function render(array $data, ContextInterface $context)
 {
     $data += ['name' => '', 'val' => null, 'type' => 'text', 'mode' => 'datetime', 'escape' => true, 'readonly' => true, 'templateVars' => []];
     // mode value and class
     $mode = $data['mode'];
     $hval = $data['value'] = $data['val'];
     $data['class'] = $data['type'];
     unset($data['val'], $data['mode']);
     // transform into frozen time if not already
     if (!($data['value'] instanceof FrozenTime || $data['value'] instanceof FrozenDate)) {
         $data['value'] = new FrozenTime($data['value']);
     }
     // transform values
     if ($mode == 'datetime') {
         $hval = $data['value']->format('Y-m-d H:i:s');
         $data['value'] = $data['value']->format('d-M-Y H:i:s');
     }
     if ($mode == 'date') {
         $hval = $data['value']->format('Y-m-d');
         $data['value'] = $data['value']->format('d-M-Y');
     }
     if ($mode == 'time') {
         $hval = $data['value'] = $data['value']->format('H:i:s');
     }
     // render
     $rand = Text::uuid();
     return "<div id='{$rand}' style='position: relative;'>" . $this->_templates->format('input', ['name' => $data['name'], 'type' => 'hidden', 'attrs' => $this->_templates->formatAttributes(['value' => $hval])]) . $this->_templates->format('input', ['name' => $data['name'] . '-' . $rand, 'type' => $mode, 'templateVars' => $data['templateVars'], 'attrs' => $this->_templates->formatAttributes($data, ['name', 'type'])]) . "<div id='dtpicker-{$rand}'></div><scriptend>\$(document).ready(Backend.DTPicker('{$rand}', '{$mode}'));</scriptend></div>";
 }
开发者ID:unimatrix,项目名称:cakephp-utility,代码行数:43,代码来源:DTPickerWidget.php

示例8: add

 /**
  * Add method
  *
  * @return void Redirects on successful add, renders view otherwise.
  */
 public function add()
 {
     $boletos = $this->Boletoxretornos->Boletos->find('all')->toArray();
     $arrayBoletos;
     $opBoletos;
     $i = 0;
     foreach ($boletos as $x) {
         $arrayBoletos[$i] = $x->id;
         $opBoletos[$i] = $x->inr_boleto;
         $i++;
     }
     $boletoxretorno = $this->Boletoxretornos->newEntity();
     if ($this->request->is('post')) {
         $boletoxretorno = $this->Boletoxretornos->patchEntity($boletoxretorno, $this->request->data);
         $boletoxretorno->id = Text::uuid();
         $boletoxretorno->boleto_id = $arrayBoletos[$boletoxretorno->boleto_id];
         if ($this->Boletoxretornos->save($boletoxretorno)) {
             $this->Flash->success(__('O retorno foi salvo.'));
             return $this->redirect(['action' => 'index']);
         } else {
             $this->Flash->error(__('O retorno não pôde ser salvo. Tente novamente.'));
         }
     }
     $this->set(compact('boletoxretorno', 'opBoletos'));
     $this->set('_serialize', ['boletoxretorno']);
 }
开发者ID:eversonjjo,项目名称:sce,代码行数:31,代码来源:BoletoxretornosController.php

示例9: add

 /**
  * Add method
  *
  * @return void Redirects on successful add, renders view otherwise.
  */
 public function add()
 {
     $participantes = $this->Boletos->Participantes->find('all')->toArray();
     $arrayParticipantes;
     $opParticipantes;
     $i = 0;
     foreach ($participantes as $x) {
         $opParticipantes[$i] = $x['cnm_participante'];
         $arrayParticipantes[$i] = $x['id'];
         $i++;
     }
     $boleto = $this->Boletos->newEntity();
     if ($this->request->is('post')) {
         $boleto = $this->Boletos->patchEntity($boleto, $this->request->data);
         $boleto->id = Text::uuid();
         $boleto->participante_id = $arrayParticipantes[$boleto->participante_id];
         if ($this->Boletos->save($boleto)) {
             $this->Flash->success(__('O boleto foi salvo.'));
             return $this->redirect(['action' => 'index']);
         } else {
             $this->Flash->error(__('O boleto não pôde ser salvo. Tente novamente.'));
         }
     }
     $this->set(compact('boleto', 'opParticipantes'));
     $this->set('_serialize', ['boleto']);
 }
开发者ID:eversonjjo,项目名称:sce,代码行数:31,代码来源:BoletosController.php

示例10: add

 /**
  * Add method
  *
  * @return void Redirects on successful add, renders view otherwise.
  */
 public function add($idSub)
 {
     $submissoes = $this->Submissaoxcoautores->Submissoes->find('all')->toArray();
     $i = 0;
     $arraySubmissoes;
     $opSubmissoes;
     foreach ($submissoes as $x) {
         $arraySubmissoes[$i] = $x->id;
         $opSubmissoes[$i] = $x->ctl_submissao;
         $i++;
     }
     $submissaoxcoautore = $this->Submissaoxcoautores->newEntity();
     if ($this->request->is('post')) {
         $submissaoxcoautore = $this->Submissaoxcoautores->patchEntity($submissaoxcoautore, $this->request->data);
         $submissaoxcoautore->id = Text::uuid();
         $submissaoxcoautore->submissao_id = $idSub;
         //$arraySubmissoes[$submissaoxcoautore->submissao_id];
         if ($this->Submissaoxcoautores->save($submissaoxcoautore)) {
             $this->Flash->success(__('O coautor foi salvo.'));
             return $this->redirect(['controller' => 'Submissoes', 'action' => 'index']);
         } else {
             $this->Flash->error(__('O coautor não pôde ser salvo. Tente novamente.'));
         }
     }
     $this->set(compact('submissaoxcoautore', 'opSubmissoes'));
     $this->set('_serialize', ['submissaoxcoautore']);
 }
开发者ID:eversonjjo,项目名称:sce,代码行数:32,代码来源:SubmissaoxcoautoresController.php

示例11: run

 /**
  * Run Method.
  *
  * Write your database seeder using this method.
  *
  * More information on writing seeders is available here:
  * http://docs.phinx.org/en/latest/seeding.html
  *
  * @return void
  */
 public function run()
 {
     $time = date("Y-m-d H:i:s");
     $data = [['id' => Text::uuid(), 'email' => 'admin@example.com', 'username' => 'administrator', 'realname' => 'Administrator', 'password' => (new DefaultPasswordHasher())->hash('adminadmin'), 'created' => $time, 'modified' => $time, 'role' => 'admin', 'status' => '1', 'preferences' => json_encode(Cake\Core\Configure::read('cms.defaultUserPreferences'))]];
     $table = $this->table('users');
     $table->insert($data)->save();
 }
开发者ID:el-cms,项目名称:elabs,代码行数:17,代码来源:UsersSeed.php

示例12: getName

 /**
  * @return string
  */
 public function getName()
 {
     if (empty($this->name)) {
         $this->name = Text::uuid();
     }
     return $this->name;
 }
开发者ID:slince,项目名称:mechanic,代码行数:10,代码来源:TestSuite.php

示例13: upload

 public function upload()
 {
     try {
         $audioTable = TableRegistry::get('Audios');
         $dateTimeUtc = new \DateTimeZone('UTC');
         $now = new \DateTime('now', $dateTimeUtc);
         // Generate file name
         $serverDir = TMP . 'files' . DS;
         $serverFileName = Text::uuid() . '.wav';
         $uploadFullPath = $serverDir . $serverFileName;
         // Move file to temp location
         if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploadFullPath)) {
             throw new \Exception('Cannot copy file to tmp location: ' . $uploadFullPath);
         }
         $uploadFullPath = $this->__convertToPhoneAudio($uploadFullPath);
         $data = ['file_name' => $_FILES['file']['name'], 'server_dir' => $serverDir, 'server_name' => $serverFileName, 'create_datetime' => $now];
         $audio = $audioTable->newEntity($data);
         $audioTable->save($audio);
         $response['status'] = 1;
         $response['audioId'] = $audio->audio_id;
     } catch (\Excaption $ex) {
         $response['status'] = 0;
         $response['message'] = $ex->getMessage();
     }
     $this->set(compact('response'));
     $this->set('_serialize', ['response']);
 }
开发者ID:Ytel-Inc,项目名称:ENS,代码行数:27,代码来源:AudioController.php

示例14: beforeSave

 public function beforeSave(Event $event)
 {
     $entity = $event->data['entity'];
     if ($entity->isNew()) {
         $entity->api_key = Security::hash(Text::uuid());
     }
     return true;
 }
开发者ID:uedatakeshi,项目名称:myApp,代码行数:8,代码来源:UsersTable.php

示例15: injectTracking

 /**
  * Conditionally adds the `_auditTransaction` and `_auditQueue` keys to $options. They are
  * used to track all changes done inside the same transaction.
  *
  * @param Cake\Event\Event The Model event that is enclosed inside a transaction
  * @param Cake\Datasource\EntityInterface $entity The entity that is to be saved
  * @param ArrayObject $options The options to be passed to the save or delete operation
  * @return void
  */
 public function injectTracking(Event $event, EntityInterface $entity, ArrayObject $options)
 {
     if (!isset($options['_auditTransaction'])) {
         $options['_auditTransaction'] = Text::uuid();
     }
     if (!isset($options['_auditQueue'])) {
         $options['_auditQueue'] = new SplObjectStorage();
     }
 }
开发者ID:lorenzo,项目名称:audit-stash,代码行数:18,代码来源:AuditLogBehavior.php


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