function makeLists($dataArray) { // will return this array. $lensArray[id][n], where id is the lens id and n is each row of power variations it comes in $lensArray = array(); $currentN = 0; //this will count the rows for each lens id $currentLensID = 0; //powerRow will be one table row of lens powers foreach ($dataArray as $powerRow) { $lensID = $powerRow['lensID']; //echo "$lensID : $currentN <br/>"; if ($lensID != $currentLensID) { $currentN = 0; $currentLensID = $lensID; } if ($powerRow['baseCurve']) { $powerRow['baseCurve'] = parseMMData($powerRow['baseCurve']); } if ($powerRow['diameter']) { $powerRow['diameter'] = parseMMData($powerRow['diameter']); } if ($powerRow['sphere']) { $powerRow['sphere'] = parsePowerData($powerRow['sphere']); } if ($powerRow['cylinder']) { $powerRow['cylinder'] = parsePowerData($powerRow['cylinder']); } if ($powerRow['axis']) { $powerRow['axis'] = parseIntegerData($powerRow['axis']); } if ($powerRow['addPwr']) { $powerRow['addPwr'] = parsePowerData($powerRow['addPwr']); } if ($powerRow['colors_enh']) { $powerRow['colors_enh'] = explode(",", $powerRow['colors_enh']); } if ($powerRow['colors_opq']) { $powerRow['colors_opq'] = explode(",", $powerRow['colors_opq']); } $lensArray[$powerRow['lensID']][$currentN] = $powerRow; $currentN++; } //echo "<p> </p>"; //print_r($lensArray); return $lensArray; }
//remember - the cyl values will be minus powers! $arr['maxcylpower'] = min($cylArray); } if ($data['cylAxisData']) { $string = $data['cylAxisData']; $increment = 90; if (preg_match_all("/[0-9]*\\s*steps/", $data['cylAxisData'], $matches)) { foreach ($matches[0] as $steps) { $int = parseInt($steps); if ($int < $increment) { $increment = $int; } } } $arr['cylaxissteps'] = $increment; $dataArray = parseIntegerData($data['cylAxisData']); $arr['oblique'] = mostObliqueAxis($dataArray); } if ($data['addData']) { $addArray = parsePowerData($data['addData']); $arr['maxadd'] = max($addArray); //if (! is_numeric($arr['maxadd']) ) $arr['maxadd'] = null; } if (count($arr) > 0) { $response = makeArray($arr); } if (!is_array($response)) { $response = array('head' => array('status' => '0', 'error_number' => '404', 'error_message' => 'No data found - Please check the format of your data request. '), 'body' => array()); } if ($format == '') { $format = 'json';