function generate() { global $upload_dir, $db, $current_user, $main_smarty, $the_template; // the file name that should be uploaded $file_tmp = $_FILES['upload_file']['tmp_name']; $file_name = $_FILES['upload_file']['name']; $unique_file_name = "tingtest1.ktr"; $upload_dir = get_misc_data('upload_directory'); $upload_path = mnmpath . $upload_dir . $unique_file_name; $upload = move_uploaded_file($file_tmp, $upload_path); /*create new ktr file*/ $tmpDir = 'excel-to-target_schema.ktr'; $newDir = '0.ktr'; copy($tmpDir, $newDir); $a1 = $_POST["sheet"]; $b1 = $_POST["row"]; $c1 = $_POST["col"]; $a = array($a1, "", ""); $b = array($b1, "", ""); $c = array($c1, "", ""); $sheets = array($a, $b, $c); $spd = $_POST["spd"]; $drd = $_POST["drd"]; $start = $_POST["start"]; $end = $_POST["end"]; $start2 = $_POST["start2"]; $end2 = $_POST["end2"]; $location = $_POST["location"]; $aggrtype = $_POST["aggrtype"]; $location2 = $_POST["location2"]; $aggrtype2 = $_POST["aggrtype2"]; $process = new Process_excel(); $arr_Sheet_name = $process->getSheetName('census.xls'); $arr_Header = $process->getHeader('dataverse_census.xls', 0, 11, 'A'); //print_r ($process->getHeader('tradestatistics.xls', 1, 23, 'A')); echo $start; /* adding url*/ add_url(0, 'http://colfusion.exp.sis.pitt.edu/colfusion/upload_raw_data/irule_dataverse_census.xls'); echo "hello"; //add_sheets(0, $sheets); addSheets(0, "Table HH-1", 10, 0); addConstants('Spd', $spd, 'Date', 'yyyyMMdd'); addConstants('Drd', $drd, 'Date', 'yyyyMMdd'); add_excel_input_fields($arr_Header); add_sample_target(); //$arr_Header - $array_no_need_normalize $no_need_Array = array($start, $end, $location, $aggrtype); //print_r ($no_need_Array); //print_r($arr_Header); $result = array_diff($arr_Header, $no_need_Array); // print_r($result); /*--------------------the second $result are from user , the first $result need to use AJAX to present to user------*/ add_normalizer($result, $result); //for variable of star if ($start != "") { //$start from excel update_target('Start', $start); } else { //$start from user input addConstants('Start_from_input', $start2, 'Date', 'yyyyMMdd'); update_target('Start', 'Start_from_input'); } //for variable of end if ($end != "") { //$start from excel update_target('End', $end); } else { //$start from user input addConstants('End_from_input', $end2, 'Date', 'yyyyMMdd'); update_target('End', 'End_from_input'); } //for variable of location if ($location != "") { echo $location; //$start from excel update_target('Location', $location); } else { //$start from user input echo $location2; addConstants('Location_from_input', $location2, 'String', ''); update_target('Location', 'Location_from_input'); } //for variable of aggrType if ($aggrtype != "") { //$start from excel update_target('AggrType', $aggrtype); } else { //$start from user input addConstants('AggrType_from_input', $aggrtype2, 'String', ''); update_target('AggrType', 'AggrType_from_input'); } //add_normalize($ArrayKey,$ArrayValue); echo $start; echo "........1<br/>"; echo $start2; echo ".......2<br/>"; echo $end; echo "..........3<br/>"; echo $end2; echo "...........4<br/>"; echo $location; echo "............5<br/>"; echo $location2; echo "..........6<br/>"; echo $aggrtype; echo "..........7<br/>"; echo $aggrtype2; echo "............8<br/>"; echo $spd; echo ".........9<br/>"; echo $drd; echo "..........10<br/>"; }
case 1: // when jump to step 3, this function is called. addSheetsSettings($sid, $dataSource_dirPath); match_schema($sid); break; case 2: break; case 3: // Step 2 - get sheet name. printSheet($sid, $dataSource_dir, $dataSource_dirPath); break; case 4: break; case 5: // When submit btn in step4 is clicked, this is called. add_normalizer($sid, $dataSource_dir, $dataSource_dirPath); unsetFileResources($sid, $dataSource_dir, $dataSource_dirPath); break; case 6: display_excel_table($sid, $dataSource_dir, $dataSource_dirPath); break; case 7: get_sid(); break; case 8: getFileSources($sid, $dataSource_dir, $dataSource_dirPath); break; case 9: $filenames = $_SESSION["ktrArguments_{$sid}"]["filenames"]; $totalSeconds = 0; foreach ($filenames as $filename) {