// "data" => DT_Example, // "order" => int // // "type" => "dir", // "files" => array() // "name" => "..." $examples = array(); // Read the files into the examples array read_structure($examples, $dir_input, $file_index_template, $file_example_template, $additional_libs); // Remove any directories without examples tidy_structure($examples, $dir_order); toc_structure($examples); process_structure($examples); if ($create_data_files) { json_files($dir_input); sql_files($dir_input); } //dump_structure( $examples ); // Create the SQL files needed for the Ajax examples - need to create files for // all of the database types supported by Editor function sql_files($out_dir) { $out_dir = $out_dir . '/server_side/scripts'; $json = json_decode(file_get_contents(dirname(__FILE__) . '/data.json'), true); $out = []; for ($i = 0, $ien = count($json); $i < $ien; $i++) { $out[] = "( " . $json[$i]['id'] . ", " . "'" . $json[$i]['first_name'] . "', " . "'" . $json[$i]['last_name'] . "', " . $json[$i]['age'] . ", " . "'" . $json[$i]['position'] . "', " . $json[$i]['salary'] . ", " . "'" . $json[$i]['start_date'] . "', " . $json[$i]['extn'] . ", " . "'" . $json[$i]['email'] . "', " . "'" . $json[$i]['office'] . "', " . $json[$i]['sequence'] . " " . ")"; } $values = join(",\n\t\t", $out); // MySQL style $str = <<<EOD
<h1><a class=blue style="<?php echo $db_name_style; ?> " href="<?php echo $_SERVER['PHP_SELF']; ?> "><?php echo $db_name_h1 ? $db_name_h1 : $db_name; ?> </a> > Import</h1> <?php conn_info(); ?> <?php $files = sql_files(); ?> <?php if (count($files)) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> <table class="none" cellspacing="0" cellpadding="0"> <tr> <td>SQL file:</th> <td><select name="sqlfile"><option value="" selected="selected"></option><?php echo options($files); ?>