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


PHP Formatter::make方法代码示例

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


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

示例1: getPendingGames

 public function getPendingGames($sport = 'NFL', $period = '')
 {
     $games = [];
     $url = "http://scores.nbcsports.com/ticker/data/gamesNEW.js.asp?jsonp=true&sport={$sport}&period={$period}";
     $jsonp = file_get_contents($url);
     $json_str = str_replace(');', '', str_replace('shsMSNBCTicker.loadGamesData(', '', $jsonp));
     $json_parsed = json_decode($json_str);
     foreach ($json_parsed->games as $game) {
         $game_xml = simplexml_load_string($game);
         $game_array = Formatter::make($game_xml, 'xml')->to_array();
         $games[$game_array['@attributes']['gamecode']] = $game_array;
     }
     return $games;
 }
开发者ID:aaronfrey,项目名称:BetTracker,代码行数:14,代码来源:GameRepository.php

示例2: postImportCsv

 public function postImportCsv()
 {
     $pid = Session::get('pid');
     $data = Input::all();
     $csv = File::get($data['file_path']);
     $delimiter = $this->getCSVDelimiter($data['file_path']);
     $csv_line = explode("\n", $csv);
     $csv_headers = explode($delimiter, $csv_line[0]);
     $new_header_array = array();
     foreach ($csv_headers as $header) {
         $new_header_array[] = $data[$header];
     }
     $csv_line[0] = implode($delimiter, $new_header_array);
     $csv_final = implode("\n", $csv_line);
     Config::set('formatter::formatter.csv.delimiter', $delimiter);
     Config::set('formatter::formatter.csv.enclosure', '');
     Config::set('formatter::formatter.csv.newline', "\n");
     Config::set('formatter::formatter.csv.regex_newline', '\\n');
     Config::set('formatter::formatter.csv.escape', '\\');
     $result = Formatter::make($csv_final, 'csv')->to_array();
     $i = 0;
     $message = '';
     $allergies_array = array('allergies_date_active', 'allergies_med', 'allergies_reaction');
     $billing_array = array('dos_f', 'dos_t', 'payment_date', 'payment', 'payment_type');
     $demographics_array = array('lastname', 'firstname', 'middle', 'nickname', 'title', 'sex', 'DOB', 'ss', 'race', 'ethnicity', 'language', 'address', 'city', 'state', 'zip', 'phone_home', 'phone_work', 'phone_cell', 'email', 'marital_status', 'partner_name', 'employer', 'emergency_contact', 'emergency_phone', 'caregiver', 'guardian_firstname', 'guardian_lastname', 'guardian_code', 'guardian_address', 'guardian_city', 'guardian_state', 'guardian_zip', 'guardian_phone_home', 'guardian_phone_work', 'guardian_phone_cell', 'guardian_email', 'guardian_relationship');
     $immunizations_array = array('imm_date', 'imm_immunization', 'imm_sequence', 'imm_body_site', 'imm_dosage', 'imm_dosage_unit', 'imm_route', 'imm_lot', 'imm_manufacturer', 'imm_expiration', 'imm_brand');
     $insurance_array = array('insurance_plan_name', 'insurance_id_num', 'insurance_group', 'insurance_relationship', 'insurance_copay', 'insurance_deductible', 'insurance_insu_lastname', 'insurance_insu_firstname', 'insurance_insu_address', 'insurance_insu_city', 'insurance_insu_state', 'insurance_insu_zip', 'insurance_insu_phone', 'insurance_insu_dob', 'insurance_insu_gender', 'street_address1', 'street_address2', 'insurance_city', 'insurance_state', 'insurance_zip');
     $issues_array = array('issue', 'issue_date_active');
     $medications_array = array('rxl_date_active', 'rxl_date_prescribed', 'rxl_medication', 'rxl_dosage', 'rxl_dosage_unit', 'rxl_sig', 'rxl_route', 'rxl_frequency', 'rxl_instructions', 'rxl_quantity', 'rxl_refill', 'rxl_reason');
     $supplements_array = array('sup_date_active', 'sup_date_prescribed', 'sup_supplement', 'sup_dosage', 'sup_dosage_unit', 'sup_sig', 'sup_route', 'sup_frequency', 'sup_instructions', 'sup_quantity', 'sup_reason');
     $tests_array = array('test_name', 'test_datetime', 'test_result', 'test_units', 'test_reference', 'test_flags', 'test_type');
     foreach ($result as $field) {
         $allergies = array();
         $billing = array();
         $demographics = array();
         $immunizations = array();
         $insurance = array();
         $issues = array();
         $medications = array();
         $supplements = array();
         $tests = array();
         while ($value = current($field)) {
             $key = key($field);
             if (in_array($key, $allergies_array)) {
                 $allergies[$key] = $value;
             }
             if (in_array($key, $billing_array)) {
                 $billing[$key] = $value;
             }
             if (in_array($key, $demographics_array)) {
                 $demographics[$key] = $value;
             }
             if (in_array($key, $immunizations_array)) {
                 $immunizations[$key] = $value;
             }
             if (in_array($key, $insurance_array)) {
                 $insurance[$key] = $value;
             }
             if (in_array($key, $issues_array)) {
                 $issues[$key] = $value;
             }
             if (in_array($key, $medications_array)) {
                 $medications[$key] = $value;
             }
             if (in_array($key, $supplements_array)) {
                 $supplements[$key] = $value;
             }
             if (in_array($key, $tests_array)) {
                 $tests[$key] = $value;
             }
             next($field);
         }
         if (!empty($allergies)) {
             if (!empty($allergies['allergies_date_active'])) {
                 $allergies['allergies_date_active'] = date('Y-m-d H:i:s', strtotime($allergies['allergies_date_active']));
             } else {
                 $allergies['allergies_date_active'] = date('Y-m-d H:i:s', time());
             }
             $allergies['pid'] = $pid;
             $allergies['allergies_date_inactive'] = '';
             $allergies['rcopia_sync'] = 'n';
             DB::table('allergies')->insert($allergies);
             $this->audit('Add');
             $message .= 'Added ' . $allergies['allergies_med'] . 'to allergies list.<br>';
         }
         if (!empty($billing)) {
             if (!empty($billing['dos_f'])) {
                 $billing['dos_f'] = date('m/d/Y', strtotime($billing['dos_f']));
                 $billing_query_enc = DB::table('billing_core')->where('pid', '=', $pid)->where('practice_id', '=', Session::get('practice_id'))->where('eid', '!=', '0')->where('dos_f', '=', $billing['dos_f'])->first();
                 $billing_query_oth = DB::table('billing_core')->where('pid', '=', $pid)->where('practice_id', '=', Session::get('practice_id'))->where('eid', '=', '0')->where('dos_f', '=', $billing['dos_f'])->first();
                 $billing['practice_id'] = Session::get('practice_id');
                 $billing['pid'] = $pid;
                 if ($billing_query_enc) {
                     $billing['eid'] = $billing_query_enc->eid;
                     $dos = $billing['dos_f'];
                     $billing['dos_f'] = date('m/d/Y', strtotime($billing['payment_date']));
                     unset($billing['payment_date']);
                     DB::table('billing_core')->insert($billing);
                     $this->audit('Add');
                     $message .= 'Added payment information to encounter with date of service of ' . $dos . '.</br>';
//.........这里部分代码省略.........
开发者ID:carlosqueiroz,项目名称:nosh-core,代码行数:101,代码来源:AjaxChartController.php

示例3: import_contact

 public function import_contact()
 {
     $directory = __DIR__ . '/../../public/import/';
     foreach (Input::file('file') as $file) {
         if ($file) {
             $file->move($directory, $file->getClientOriginalName());
             $file_path = $directory . $file->getClientOriginalName();
             while (!file_exists($file_path)) {
                 sleep(2);
             }
             $csv = File::get($file_path);
             $result = Formatter::make($csv, 'csv')->to_array();
             if (empty(Formatter::$errors)) {
                 $i = 0;
                 foreach ($result as $field) {
                     if ($field['firstname'] == '' or $field['lastname'] == '') {
                         $field['displayname'] = $field['facility'];
                     } else {
                         if ($this->input->post('suffix') == '') {
                             $field['displayname'] = $field['firstname'] . ' ' . $field['lastname'];
                         } else {
                             $field['displayname'] = $field['firstname'] . ' ' . $field['lastname'] . ', ' . $field['suffix'];
                         }
                     }
                     DB::table('addressbook')->insert($field);
                     $this->audit('Add');
                     $i++;
                 }
                 echo "Imported " . $i . " records!";
             } else {
                 echo print_r(Formatter::$errors);
             }
         }
     }
 }
开发者ID:carlosqueiroz,项目名称:nosh-core,代码行数:35,代码来源:AjaxMessagingController.php


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