*/
public $totalPhotos = 0;
+ /**
+ * totalFiles
+ *
+ * @var float
+ * @access public
+ */
+ public $totalFiles = 0;
+
/**
* photosProcessed
*
}
break;
+ case 'filesProcess':
+ // Setup the file processing
+ require_once GLM_MEMBERS_PLUGIN_PATH . '/models/admin/ajax/fileUpload.php';
+ $FileUpload = new GlmMembersAdmin_ajax_imageUpload($this->wpdb, $this->config);
+
+ // Setup the member_info class
+ require_once GLM_MEMBERS_PLUGIN_PATH . '/classes/data/dataMemberInfo.php';
+ $memberInfoObj = new GlmDataMemberInfo( $this->wpdb, $this->config );
+
+ if ( is_file( $uploadPath . '/filesData.csv' ) ) {
+ // Get the entire files file data
+ $filesData = $this->readCSVFile( $uploadPath . '/filesData.csv' );
+ //echo '<pre>$filesData: ' . print_r( $filesData, true ) . '</pre>';
+ $this->totalFiles = count( $filesData );
+ $this->filesProcessed = count( $filesData );
+
+ $refType = $this->config['ref_type_numb']['MemberInfo'];
+ $refTable = $this->config['ref_type_table'][$refType];
+
+ // Loop through the filesData array
+ foreach ( $filesData as $file ) {
+ echo '<pre>$file: ' . print_r( $file, true ) . '</pre>';
+ // If there's no url or the url is not valid then skip it.
+ if ( $fileUrl = filter_var( $file['image'], FILTER_VALIDATE_URL ) ) {
+ echo '<pre>$fileUrl: ' . print_r( $fileUrl, true ) . '</pre>';
+ // Need to first get the member id from the database
+ // It will match from the old_member_id field
+ $memberId = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT id
+ FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
+ WHERE old_member_id = %d",
+ $file['member_id']
+ )
+ );
+ if ( !$memberId ) {
+ continue;
+ }
+ echo '<pre>$memberId: ' . print_r( $memberId, true ) . '</pre>';
+ // Now that we have the member id we need to get the
+ // id for the active member info record
+ $memberInfoId = $memberInfoObj->getActiveInfoIdForMember( $memberId );
+ if ( !$memberInfoId ) {
+ continue;
+ }
+ echo '<pre>$memberInfoId: ' . print_r( $memberInfoId, true ) . '</pre>';
+ $res = $FileUpload->storeFile(
+ $fileUrl,
+ $refType,
+ $refTable,
+ $memberInfoId,
+ $file['caption']
+ );
+ }
+
+ }
+
+ // Set the view file
+ $view= 'filesProcess.html';
+ } else {
+ // Set the view file
+ $view= 'filesValidate.html';
+ }
+ $view= 'filesValidate.html';
+ break;
+
case 'photos':
// Set the view file
$view= 'photos.html';
'numberProcessed' => $this->numberProcessed,
'totalMembers' => $this->totalMembers,
'totalPhotos' => $this->totalPhotos,
+ 'totalFiles' => $this->totalFiles,
'photosProcessed' => $this->photosProcessed,
'completed' => $this->processingComplete,
'data' => false,