Пример #1
0
                        //$col['xtype'] = 'checkcolumn';
                        break;
                }
                // finally, add the column to the columns list
                array_push($columns, $col);
            }
            // every row/col pass, load up some data
            $row['field-' . ($j + 1)] = $j == 0 ? $i + 1 : getDataValue($types[$j]);
        }
        // flip this flag after the first column pass since the fields are defined
        $defineFields = false;
        // add the row of generated data to the top-level data object
        // that will be returned in the response
        array_push($data['data'], $row);
    }
    // assemble the metadata
    $meta = array();
    $meta['fields'] = $fields;
    $meta['columns'] = $columns;
    $meta['root'] = 'data';
    $meta['idProperty'] = 'field-1';
    $meta['messageProperty'] = 'msg';
    // assemble the top-level data object being returned.
    // the data is already in $data['data'] at this point.
    $data['metaData'] = $meta;
    $data['total'] = $row_count;
    $data['msg'] = 'Success!';
    return $data;
}
echo json_encode(generateData());
}
function generateData()
{
    global $inputDim, $numDataPoints, $regionType, $numIterations, $sessionID;
    $cmd = "cd tmp/{$sessionID}; octave --eval 'addpath ../../ ; generateData(" . $inputDim . "," . $numDataPoints . "," . $regionType . ", " . $numIterations . ");cd ../../ ; quit;' 1> log.txt 2>&1 ";
    $out = exec($cmd, $results, $status);
}
function nextIteration()
{
    global $NIstep, $sessionID;
    $cmd = "cd tmp/{$sessionID}; octave --eval 'addpath ../../ ; clnnMappingCore(" . $NIstep . ");cd ../../ ; quit;' 1> log.txt 2>&1 ";
    $out = exec($cmd, $results, $status);
}
if ($genflag == 1) {
    exec("mkdir -p tmp/{$sessionID}");
    generateData();
}
if ($iternflag == 1) {
    nextIteration();
}
?>

<script type="text/javascript">
function jssetgenflag(){
	document.myform.genflag.value=1;
}
function jssetiternflag(){
	document.myform.iternflag.value=1;
}