Guest User

Untitled

a guest
May 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. // Read the spreadsheet via a relative path to the document
  2. $this->php_excel_reader->read($raw_file_path);
  3. $this->php_excel_reader->setOutputEncoding('CP1251');
  4.  
  5. // Get the contents of the second worksheet
  6. $sheets = $this->php_excel_reader->sheets;
  7.  
  8. if (!is_array($sheets))
  9. {
  10. log_message('error', 'Rawdata/import: Spreadsheet does not contain two sheet');
  11. return false;
  12. }
  13.  
  14. $member_data = $sheets[0]['cells']; // this is member data only
  15. $communication_data = $sheets[1]['cells']; // all the communication data for all the members
  16.  
  17. // Get the headings
  18. $member_data_headings = $member_data[1];
  19. $communication_data_headings = $communication_data[1];
  20. // remove headings from the data
  21. // as we are not looking to insert them
  22. unset( $member_data[1] );
  23. unset( $communication_data[1] );
  24. // make headings lower case
  25. if (!is_array($member_data_headings) || !is_array($communication_data_headings)) return false;
  26. array_walk($member_data_headings, create_function('&$item, $key', '$item = strtolower($item); '));
  27. array_walk($communication_data_headings, create_function('&$item, $key', '$item = strtolower($item); '));
  28.  
  29. // Create check array
  30. $member_check_array = array('REGISTRATION_ID','MEMBER_ID','Contract_Start_Date','Renewal_Date','Title','GIVEN_NAME',
  31. 'FAMILY_NAME','Birth_Date','email','Address','Members');
  32. $communication_check_array = array('MEMBER_ID','CELLREF');
Add Comment
Please, Sign In to add comment