schema_data_edit.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. include "root.php";
  22. require_once "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. if (permission_exists('schema_data_add') || permission_exists('schema_data_edit')) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. //add multi-lingual support
  32. $language = new text;
  33. $text = $language->get();
  34. //set http get variables to php variables
  35. $search_all = strtolower(check_str($_GET["search_all"]));
  36. $schema_uuid = check_str($_GET["schema_uuid"]);
  37. if (strlen($_GET["data_row_uuid"])>0) { //update
  38. $data_row_uuid = check_str($_GET["data_row_uuid"]);
  39. $action = "update";
  40. }
  41. else {
  42. if (strlen($search_all) > 0) {
  43. $action = "update";
  44. }
  45. else {
  46. $action = "add";
  47. }
  48. }
  49. if (strlen($_GET["id"]) > 0) {
  50. $schema_uuid = check_str($_GET["id"]);
  51. }
  52. if (strlen($_GET["data_parent_row_uuid"])>0) {
  53. $data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]);
  54. }
  55. //get schema information
  56. $sql = "select * from v_schemas ";
  57. $sql .= "where domain_uuid = '$domain_uuid' ";
  58. $sql .= "and schema_uuid = '$schema_uuid' ";
  59. $prep_statement = $db->prepare(check_sql($sql));
  60. $prep_statement->execute();
  61. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  62. foreach ($result as &$row) {
  63. $schema_category = $row["schema_category"];
  64. $schema_label = $row["schema_label"];
  65. $schema_name = $row["schema_name"];
  66. $schema_auth = $row["schema_auth"];
  67. $schema_captcha = $row["schema_captcha"];
  68. $schema_parent_id = $row["schema_parent_id"];
  69. $schema_description = $row["schema_description"];
  70. break; //limit to 1 row
  71. }
  72. unset ($prep_statement);
  73. //process the data submitted to by the html form
  74. if (count($_POST)>0) { //add
  75. $schema_uuid = check_str($_POST["schema_uuid"]);
  76. $schema_name = check_str($_POST["schema_name"]);
  77. $rcount = check_str($_POST["rcount"]);
  78. //get the field information
  79. $db_field_name_array = array();
  80. $db_value_array = array();
  81. $db_names .= "<tr>\n";
  82. $sql = "select * from v_schema_fields ";
  83. $sql .= "where domain_uuid = '$domain_uuid' ";
  84. $sql .= "and schema_uuid = '$schema_uuid' ";
  85. $sql .= "order by field_order asc ";
  86. $prep_statement = $db->prepare($sql);
  87. $prep_statement->execute();
  88. $result_names = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
  89. $result_count = count($result);
  90. foreach($result_names as $row) {
  91. $field_label = $row["field_label"];
  92. $field_name = $row["field_name"];
  93. $field_type = $row["field_type"];
  94. $field_value = $row["field_value"];
  95. $field_list_hidden = $row["field_list_hidden"];
  96. $field_column = $row["field_column"];
  97. $field_required = $row["field_required"];
  98. $field_order = $row["field_order"];
  99. $field_order_tab = $row["field_order_tab"];
  100. $field_description = $row["field_description"];
  101. $name_array[$field_name]['field_label'] = $row["field_label"];
  102. $name_array[$field_name]['field_type'] = $row["field_type"];
  103. $name_array[$field_name]['field_list_hidden'] = $row["field_list_hidden"];
  104. $name_array[$field_name]['field_column'] = $row["field_column"];
  105. $name_array[$field_name]['field_required'] = $row["field_required"];
  106. $name_array[$field_name]['field_order'] = $row["field_order"];
  107. $name_array[$field_name]['field_order_tab'] = $row["field_order_tab"];
  108. $name_array[$field_name]['field_description'] = $row["field_description"];
  109. }
  110. unset($sql, $prep_statement, $row);
  111. $fieldcount = count($name_array);
  112. $i = 1;
  113. while($i <= $rcount){
  114. $field_name = check_str($_POST[$i."field_name"]);
  115. $data_field_value = check_str($_POST[$i."field_value"]);
  116. if ($i==1) {
  117. $unique_temp_id = md5('7k3j2m'.date('r')); //used to find the first item
  118. $data_row_uuid = $unique_temp_id;
  119. }
  120. $sql = "select field_type, field_name from v_schema_fields ";
  121. $sql .= "where domain_uuid = '$domain_uuid' ";
  122. $sql .= "and schema_uuid = '$schema_uuid' ";
  123. $sql .= "and field_name = '$field_name' ";
  124. $prep_statement = $db->prepare($sql);
  125. $prep_statement->execute();
  126. while($row = $prep_statement->fetch()){
  127. $field_type = $row['field_type'];
  128. }
  129. if ($field_type == "upload_file" || $field_type == "uploadimage") {
  130. //print_r($_FILES);
  131. $upload_temp_dir = $_ENV["TEMP"]."\\";
  132. ini_set('upload_tmp_dir', $upload_temp_dir);
  133. //$uploaddir = "";
  134. if ($field_type == "upload_file") {
  135. $upload_file = $filedir . $_FILES[$i.'field_value']['name'];
  136. }
  137. if ($field_type == "uploadimage") {
  138. $upload_file = $imagedir . $_FILES[$i.'field_value']['name'];
  139. }
  140. // $_POST[$i."field_name"]
  141. //print_r($_FILES);
  142. //echo "upload_file $upload_file<br>\n";
  143. //echo "upload_temp_dir $upload_temp_dir<br>\n";
  144. $data_field_value = $_FILES[$i.'field_value']['name'];
  145. //echo "name $data_field_value<br>\n";
  146. //echo "field_name $field_name<br>\n";
  147. //$i."field_value"
  148. //echo "if (move_uploaded_file(\$_FILES[$i.'field_value']['tmp_name'], $upload_file)) ";
  149. //if (strlen($_FILES[$i.'field_value']['name'])>0) { //only do the following if there is a file name
  150. //foreach($_FILES as $file)
  151. //{
  152. //[$i.'field_value']
  153. //print_r($file);
  154. if($_FILES[$i.'field_value']['error'] == 0 && $_FILES[$i.'field_value']['size'] > 0) {
  155. if (move_uploaded_file($_FILES[$i.'field_value']['tmp_name'], $upload_file)) {
  156. //echo $_FILES['userfile']['name'] ." <br>";
  157. //echo "was successfully uploaded. ";
  158. //echo "<br><br>";
  159. //print "<pre>";
  160. //print_r($_FILES);
  161. //print "</pre>";
  162. }
  163. else {
  164. //echo "Upload Error. Here's some debugging info:\n";
  165. //print "<pre>\n";
  166. //print_r($_FILES);
  167. //print "</pre>\n";
  168. //exit;
  169. }
  170. }
  171. //}
  172. //}
  173. } //end if file or image
  174. if ($action == "add" && permission_exists('schema_data_add')) {
  175. //get a unique id for the data_row_uuid
  176. if ($i==1) {
  177. $data_row_uuid = uuid();
  178. }
  179. //insert the field data
  180. $sql = "insert into v_schema_data ";
  181. $sql .= "(";
  182. $sql .= "schema_data_uuid, ";
  183. $sql .= "domain_uuid, ";
  184. $sql .= "data_row_uuid, ";
  185. if(strlen($data_parent_row_uuid)>0) {
  186. $sql .= "data_parent_row_uuid, ";
  187. }
  188. $sql .= "schema_uuid, ";
  189. if (strlen($schema_parent_id) > 0) {
  190. $sql .= "schema_parent_id, ";
  191. }
  192. $sql .= "field_name, ";
  193. $sql .= "data_field_value, ";
  194. $sql .= "data_add_user, ";
  195. $sql .= "data_add_date ";
  196. $sql .= ")";
  197. $sql .= "values ";
  198. $sql .= "(";
  199. $sql .= "'".uuid()."', ";
  200. $sql .= "'$domain_uuid', ";
  201. $sql .= "'$data_row_uuid', ";
  202. if(strlen($data_parent_row_uuid)>0) {
  203. $sql .= "'$data_parent_row_uuid', ";
  204. }
  205. $sql .= "'$schema_uuid', ";
  206. if (strlen($schema_parent_id) > 0) {
  207. $sql .= "'$schema_parent_id', ";
  208. }
  209. $sql .= "'$field_name', ";
  210. switch ($name_array[$field_name]['field_type']) {
  211. case "phone":
  212. $tmp_phone = preg_replace('{\D}', '', $data_field_value);
  213. $sql .= "'$tmp_phone', ";
  214. break;
  215. case "add_user":
  216. $sql .= "'".$_SESSION["username"]."', ";
  217. break;
  218. case "add_date":
  219. $sql .= "now(), ";
  220. break;
  221. case "mod_user":
  222. $sql .= "'".$_SESSION["username"]."', ";
  223. break;
  224. case "mod_date":
  225. $sql .= "now(), ";
  226. break;
  227. default:
  228. $sql .= "'$data_field_value', ";
  229. }
  230. $sql .= "'".$_SESSION["username"]."', ";
  231. $sql .= "now() ";
  232. $sql .= ")";
  233. $db->exec(check_sql($sql));
  234. $lastinsertid = $db->lastInsertId($id);
  235. unset($sql);
  236. } //end action add
  237. if ($action == "update" && permission_exists('schema_data_edit')) {
  238. $data_row_uuid = $_POST["data_row_uuid"];
  239. $sql_update = "update v_schema_data set ";
  240. switch ($name_array[$field_name]['field_type']) {
  241. case "phone":
  242. $tmp_phone = preg_replace('{\D}', '', $data_field_value);
  243. $sql_update .= "data_field_value = '$tmp_phone' ";
  244. break;
  245. case "add_user":
  246. $sql_update .= "data_field_value = '".$_SESSION["username"]."' ";
  247. break;
  248. case "add_date":
  249. $sql_update .= "data_field_value = now() ";
  250. break;
  251. case "mod_user":
  252. $sql_update .= "data_field_value = '".$_SESSION["username"]."' ";
  253. break;
  254. case "mod_date":
  255. $sql_update .= "data_field_value = now() ";
  256. break;
  257. default:
  258. $sql_update .= "data_field_value = '$data_field_value' ";
  259. }
  260. $sql_update .= "where domain_uuid = '$domain_uuid' ";
  261. $sql_update .= "and schema_uuid = '$schema_uuid' ";
  262. if (strlen($schema_parent_id) > 0) {
  263. $sql_update .= "and schema_parent_id = '$schema_parent_id' ";
  264. }
  265. $sql_update .= "and data_row_uuid = '$data_row_uuid' ";
  266. if(strlen($data_parent_row_uuid)>0) {
  267. $sql_update .= "and data_parent_row_uuid = '$data_parent_row_uuid' ";
  268. }
  269. $sql_update .= "and field_name = '$field_name' ";
  270. $count = $db->exec(check_sql($sql_update));
  271. unset ($sql_update);
  272. if ($count > 0) {
  273. //do nothing the update was successfull
  274. }
  275. else {
  276. //no value to update so insert new value
  277. $sql = "insert into v_schema_data ";
  278. $sql .= "(";
  279. $sql .= "domain_uuid, ";
  280. $sql .= "data_row_uuid, ";
  281. if(strlen($data_parent_row_uuid)>0) {
  282. $sql .= "data_parent_row_uuid, ";
  283. }
  284. $sql .= "schema_uuid, ";
  285. $sql .= "schema_parent_id, ";
  286. $sql .= "field_name, ";
  287. $sql .= "data_field_value, ";
  288. $sql .= "data_add_user, ";
  289. $sql .= "data_add_date ";
  290. $sql .= ")";
  291. $sql .= "values ";
  292. $sql .= "(";
  293. $sql .= "'$domain_uuid', ";
  294. $sql .= "'$data_row_uuid', ";
  295. if(strlen($data_parent_row_uuid)>0) {
  296. $sql .= "'$data_parent_row_uuid', ";
  297. }
  298. $sql .= "'$schema_uuid', ";
  299. $sql .= "'$schema_parent_id', ";
  300. $sql .= "'$field_name', ";
  301. switch ($name_array[$field_name]['field_type']) {
  302. case "phone":
  303. $tmp_phone = preg_replace('{\D}', '', $data_field_value);
  304. $sql .= "'$tmp_phone', ";
  305. break;
  306. case "add_user":
  307. $sql .= "'".$_SESSION["username"]."', ";
  308. break;
  309. case "add_date":
  310. $sql .= "now(), ";
  311. break;
  312. case "mod_user":
  313. $sql .= "'".$_SESSION["username"]."', ";
  314. break;
  315. case "mod_date":
  316. $sql .= "now(), ";
  317. break;
  318. default:
  319. $sql .= "'$data_field_value', ";
  320. }
  321. $sql .= "'".$_SESSION["username"]."', ";
  322. $sql .= "now() ";
  323. $sql .= ")";
  324. $db->exec(check_sql($sql));
  325. $lastinsertid = $db->lastInsertId($id);
  326. unset($sql);
  327. }
  328. }
  329. $i++;
  330. }
  331. //redirect user
  332. if ($action == "add") {
  333. $_SESSION["message"] = $text['message-add'];
  334. }
  335. else if ($action == "update") {
  336. $_SESSION["message"] = $text['message-update'];
  337. }
  338. if (strlen($data_parent_row_uuid) == 0) {
  339. header("Location: schema_data_edit.php?id=".$schema_uuid."&data_row_uuid=".$data_row_uuid);
  340. }
  341. else {
  342. header("Location: schema_data_edit.php?schema_uuid=".$schema_parent_id."&data_row_uuid=".$data_parent_row_uuid);
  343. }
  344. return;
  345. }
  346. //show the header
  347. require_once "resources/header.php";
  348. $document['title'] = $text['title-data'];
  349. //pre-populate the form
  350. if ($action == "update") {
  351. //get the field values
  352. $sql = "";
  353. $sql .= "select * from v_schema_data ";
  354. $sql .= "where domain_uuid = '".$domain_uuid."' ";
  355. if (strlen($search_all) == 0) {
  356. $sql .= "and schema_uuid = '$schema_uuid' ";
  357. if (strlen($data_parent_row_uuid) > 0) {
  358. $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
  359. }
  360. }
  361. else {
  362. $sql .= "and data_row_uuid in (";
  363. $sql .= "select data_row_uuid from v_schema_data \n";
  364. $sql .= "where domain_uuid = '".$domain_uuid."' ";
  365. $sql .= "and schema_uuid = '$schema_uuid' ";
  366. if (strlen($data_parent_row_uuid) > 0) {
  367. $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
  368. }
  369. else {
  370. //$sql .= "and data_field_value like '%$search_all%' )\n";
  371. $tmp_digits = preg_replace('{\D}', '', $search_all);
  372. if (is_numeric($tmp_digits) && strlen($tmp_digits) > 5) {
  373. if (strlen($tmp_digits) == '11' ) {
  374. $sql .= "and data_field_value like '%".substr($tmp_digits, -10)."%' )\n";
  375. }
  376. else {
  377. $sql .= "and data_field_value like '%$tmp_digits%' )\n";
  378. }
  379. }
  380. else {
  381. $sql .= "and lower(data_field_value) like '%$search_all%' )\n";
  382. }
  383. }
  384. }
  385. $sql .= "order by data_row_uuid asc ";
  386. $row_id = '';
  387. $row_id_found = false;
  388. $next_row_id_found = false;
  389. $prep_statement = $db->prepare($sql);
  390. $prep_statement->execute();
  391. $x=0;
  392. while($row = $prep_statement->fetch()) {
  393. //set the last last row id
  394. if ($x==0) {
  395. if (strlen($data_row_uuid) == 0) {
  396. $data_row_uuid = $row['data_row_uuid'];
  397. }
  398. $first_data_row_uuid = $row['data_row_uuid'];
  399. }
  400. //get the data for the specific row id
  401. if ($data_row_uuid == $row['data_row_uuid']) {
  402. //set the data and save it to an array
  403. $data_row[$row['field_name']] = $row['data_field_value'];
  404. //set the previous row id
  405. if ($previous_row_id != $row['data_row_uuid']) {
  406. $previous_data_row_uuid = $previous_row_id;
  407. $row_id_found = true;
  408. }
  409. }
  410. //detect a new row id
  411. if ($previous_row_id != $row['data_row_uuid']) {
  412. if ($row_id_found) {
  413. if (!$next_row_id_found) {
  414. //make sure it is not the current row id
  415. if ($data_row_uuid != $row['data_row_uuid']) {
  416. $next_data_row_uuid = $row['data_row_uuid'];
  417. $next_row_id_found = true;
  418. }
  419. }
  420. }
  421. //set the last last row id
  422. $last_data_row_uuid = $row['data_row_uuid'];
  423. //set the temporary previous row id
  424. $previous_row_id = $row['data_row_uuid'];
  425. //set the record number array
  426. $record_number_array[$row['data_row_uuid']] = $x+1;
  427. $x++;
  428. }
  429. }
  430. //save the total number of records
  431. $total_records = $x;
  432. //set record number
  433. if (strlen($_GET["n"]) == 0) {
  434. $n = 1;
  435. }
  436. else {
  437. $n = $_GET["n"];
  438. }
  439. unset($sql, $prep_statement, $row);
  440. }
  441. //use this when the calendar is needed
  442. //echo "<script language='javascript' src=\"/resources/calendar_popcalendar.js\"></script>\n";
  443. //echo "<script language=\"javascript\" src=\"/resources/calendar_lw_layers.js\"></script>\n";
  444. //echo "<script language=\"javascript\" src=\"/resources/calendar_lw_menu.js\"></script>";
  445. //begin creating the content
  446. echo "<br />";
  447. //get the title and description of the schema
  448. echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
  449. echo " <tr>\n";
  450. echo " <td width='50%' valign='top' nowrap='nowrap'>\n";
  451. echo " <b>$schema_label ";
  452. if ($action == "add") {
  453. echo $text['button-add']."\n";
  454. }
  455. else {
  456. echo $text['button-edit']."\n";
  457. }
  458. echo " </b>\n";
  459. echo " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n";
  460. if ($action == "update" && permission_exists('schema_data_edit')) {
  461. echo " <input type='button' class='btn' name='' alt='".$text['button-add']."' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid'\" value='".$text['button-add']."'>\n";
  462. }
  463. echo " <br />\n";
  464. echo " $schema_description\n";
  465. echo " <br />\n";
  466. echo " <br />\n";
  467. echo " </td>\n";
  468. if (strlen($data_parent_row_uuid) == 0) {
  469. echo "<td align='center' valign='top' nowrap='nowrap'>\n";
  470. if ($action == "update" && permission_exists('schema_data_edit')) {
  471. if (strlen($previous_data_row_uuid) == 0) {
  472. echo " <input type='button' class='btn' name='' alt='".$text['button-prev']."' disabled='disabled' value='".$text['button-prev']."'>\n";
  473. }
  474. else {
  475. echo " <input type='button' class='btn' name='' alt='".$text['button-prev']."' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid&data_row_uuid=".$previous_data_row_uuid."&search_all=$search_all&n=".($n-1)."'\" value='".$text['button-prev']." ".$previous_record_id."'>\n";
  476. }
  477. echo " <input type='button' class='btn' name='' alt='".$text['button-prev']."' value='".$record_number_array[$data_row_uuid]." (".$total_records.")'>\n";
  478. if (strlen($next_data_row_uuid) == 0) {
  479. echo " <input type='button' class='btn' name='' alt='".$text['button-next']."' disabled='disabled' value='".$text['button-next']."'>\n";
  480. }
  481. else {
  482. echo " <input type='button' class='btn' name='' alt='".$text['button-next']."' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid&data_row_uuid=".$next_data_row_uuid."&search_all=$search_all&n=".($n+1)."'\" value='".$text['button-next']." ".$next_record_id."'>\n";
  483. }
  484. }
  485. echo " &nbsp;&nbsp;&nbsp;";
  486. echo " &nbsp;&nbsp;&nbsp;";
  487. echo " &nbsp;&nbsp;&nbsp;";
  488. echo "</td>\n";
  489. echo "<td width='45%' align='right' valign='top' nowrap='nowrap'>\n";
  490. echo " <form method='GET' name='frm_search' action='schema_data_edit.php'>\n";
  491. echo " <input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
  492. //echo " <input type='hidden' name='id' value='$schema_uuid'>\n";
  493. //echo " <input type='hidden' name='data_parent_row_uuid' value='$data_parent_row_uuid'>\n";
  494. //echo " <input type='hidden' name='data_row_uuid' value='$first_data_row_uuid'>\n";
  495. echo " <input class='formfld' type='text' name='search_all' value='$search_all'>\n";
  496. echo " <input class='btn' type='submit' name='submit' value='".$text['button-search_all']."'>\n";
  497. echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='schema_data_view.php?id=$schema_uuid'\" value='".$text['button-back']."'>\n";
  498. echo " </form>\n";
  499. echo "</td>\n";
  500. }
  501. else {
  502. echo " <td width='50%' align='right'>\n";
  503. //echo " <input type='button' class='btn' name='' alt='".$text['button-prev']."' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='".$text['button-prev']."'>\n";
  504. //echo " <input type='button' class='btn' name='' alt='".$text['button-next']."' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='".$text['button-next']."'>\n";
  505. echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='".$text['button-back']."'>\n";
  506. echo " </td>\n";
  507. }
  508. echo " </tr>\n";
  509. echo "</table>\n";
  510. //begin the table that will hold the html form
  511. echo "<table width='100%' border='0' cellpadding='0' cellspacing='10'>\n";
  512. //determine if a file should be uploaded
  513. $sql = "SELECT * FROM v_schema_fields ";
  514. $sql .= "where domain_uuid = '$domain_uuid ' ";
  515. $sql .= "and schema_uuid = '$schema_uuid ' ";
  516. $sql .= "and field_type = 'uploadimage' ";
  517. $sql .= "or domain_uuid = '$domain_uuid ' ";
  518. $sql .= "and schema_uuid = '$schema_uuid ' ";
  519. $sql .= "and field_type = 'upload_file' ";
  520. $prep_statement = $db->prepare($sql);
  521. $prep_statement->execute();
  522. if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) > 0) {
  523. echo "<form method='post' name='frm' enctype='multipart/form-data' action=''>\n";
  524. echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"104857600\" />\n";
  525. }
  526. else {
  527. echo "<form method='post' name='frm' action=''>\n";
  528. }
  529. //get the fields and then display them
  530. $sql = "select * from v_schema_fields ";
  531. $sql .= "where domain_uuid = '$domain_uuid' ";
  532. $sql .= "and schema_uuid = '$schema_uuid' ";
  533. $sql .= "order by field_column asc, field_order asc ";
  534. $prep_statement = $db->prepare($sql);
  535. $prep_statement->execute();
  536. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  537. $result_count = count($result);
  538. echo "<input type='hidden' name='rcount' value='$result_count'>\n";
  539. echo "<input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
  540. if ($result_count == 0) { //no results
  541. echo "<tr><td class='vncell'>&nbsp;</td></tr>\n";
  542. }
  543. else { //received results
  544. $x=1;
  545. $field_column_previous = '';
  546. $column_schema_cell_status = '';
  547. foreach($result as $row) {
  548. //handle more than one column
  549. $field_column = $row[field_column];
  550. //echo "<!--[column: $field_column]-->\n";
  551. if ($field_column != $field_column_previous) {
  552. $column_schema_cell_status = 'open';
  553. //do the following except for the first time through the loop
  554. if ($x != 1) {
  555. //close the table
  556. echo "</td>\n";
  557. echo "</tr>\n";
  558. echo "</table>\n";
  559. //close the row
  560. echo "</td>\n";
  561. }
  562. //open a new row
  563. echo "<td valign='top'>\n";
  564. //start a table in the new row
  565. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  566. }
  567. //display the fields
  568. if ($row['field_type'] != "hidden"){
  569. switch ($row['field_type']) {
  570. case "add_user":
  571. break;
  572. case "add_date":
  573. break;
  574. case "mod_user":
  575. break;
  576. case "mod_date":
  577. break;
  578. default:
  579. echo "<tr>\n";
  580. if ($row['field_type'] == "label") {
  581. echo "<td valign='bottom' align='left' class='' style='padding-top:10px;padding-bottom:7px;padding-right:5px;padding-left:0px;' nowrap='nowrap'>\n";
  582. echo " <strong>".$row['field_label']."</strong>\n";
  583. echo "</td>\n";
  584. }
  585. else {
  586. if ($row['field_required'] == "yes") {
  587. echo "<td valign='top' align='left' class='vncellreq' style='padding-top:3px;' nowrap='nowrap'>\n";
  588. }
  589. else {
  590. echo "<td valign='top' align='left' class='vncell' style='padding-top:3px;' nowrap='nowrap'>\n";
  591. }
  592. echo "".$row['field_label']."\n";
  593. echo "</td>\n";
  594. }
  595. }
  596. }
  597. switch ($row['field_type']) {
  598. case "checkbox":
  599. echo "<td valign='top' align='left' class='vtable'>\n";
  600. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  601. if (strlen($data_row[$row['field_name']])>0) {
  602. echo "<input tabindex='".$row['field_order_tab']."' class='' type='checkbox' name='".$x."field_value' maxlength='50' value=\"".$row['field_value']."\" checked='checked'/>\n";
  603. }
  604. else {
  605. echo "<input tabindex='".$row['field_order_tab']."' class='' type='checkbox' name='".$x."field_value' maxlength='50' value=\"".$row['field_value']."\" />\n";
  606. }
  607. echo "</td>\n";
  608. break;
  609. case "text":
  610. echo "<td valign='top' align='left' class='vtable'>\n";
  611. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  612. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='50' value=\"".$data_row[$row['field_name']]."\">\n";
  613. echo "</td>\n";
  614. break;
  615. case "email":
  616. echo "<td valign='top' align='left' class='vtable'>\n";
  617. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  618. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='50' value=\"".$data_row[$row['field_name']]."\">\n";
  619. echo "</td>\n";
  620. break;
  621. case "label":
  622. break;
  623. case "password":
  624. echo "<td valign='top' align='left' class='vtable'>\n";
  625. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  626. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='password' name='".$x."field_value' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='50' value=\"".$data_row[$row['field_name']]."\">\n";
  627. echo "</td>\n";
  628. break;
  629. case "pin_number":
  630. echo "<td valign='top' align='left' class='vtable'>\n";
  631. echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
  632. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='password' name='".$x."field_value' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" maxlength='50' value=\"".$data_row[$row['field_name']]."\">\n";
  633. echo "</td>\n";
  634. break;
  635. case "hidden":
  636. echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
  637. echo "<input type='hidden' name='".$x."field_value' value=\"".$data_row[$row['field_name']]."\">\n";
  638. break;
  639. case "url":
  640. echo "<td valign='top' align='left' class='vtable'>\n";
  641. echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
  642. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='50' value='".$data_row[$row['field_name']]."'>\n";
  643. echo "</td>\n";
  644. break;
  645. case "date":
  646. echo "<td valign='top' align='left' class='vtable'>\n";
  647. echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
  648. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='50' value='".$data_row[$row['field_name']]."'>\n";
  649. //echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  650. //echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
  651. //echo "<tr>";
  652. //echo "<td valign='top'><input tabindex='".$row['field_order_tab']."' name='".$x."field_value' readonly class='formfld' style='width:90%' value='".$data_row[$row['field_name']]."' type='text' class='frm' onclick='popUpCalendar(this, this, \"mm/dd/yyyy\");'></td>\n";
  653. //echo "<td valign='middle' width='20' align='right'><img src='/images/icon_calendar.gif' onclick='popUpCalendar(this, frm.".$x."field_value, \"mm/dd/yyyy\");'></td> \n";
  654. //echo "</tr>";
  655. //echo "</table>";
  656. //echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='50' value='".$data_row[$row['field_name']]."'>\n";
  657. echo "</td>\n";
  658. break;
  659. case "truefalse":
  660. //checkbox
  661. echo "<td valign='top' align='left' class='vtable'>\n";
  662. echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
  663. echo "<table border='0'>\n";
  664. echo "<tr>\n";
  665. switch ($row['field_name']) {
  666. case "true":
  667. echo "<td>".$text['option-true']."</td><td width='50'><input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='checkbox' name='".$x."field_value' checked='checked' value='true' /></td>\n";
  668. echo "<td>".$text['option-false']."</td><td><input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='checkbox' name='".$x."field_value' value='false'></td>\n";
  669. break;
  670. case "false":
  671. echo "<td>".$text['option-true']."</td><td width='50'><input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='checkbox' name='".$x."field_value' value='true' /></td>\n";
  672. echo "<td>".$text['option-false']."</td><td><input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='checkbox' name='".$x."field_value' checked='checked' value='false' /></td>\n";
  673. break;
  674. default:
  675. echo "<td>".$text['option-true']."</td><td width='50'><input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='checkbox' name='".$x."field_value' value='true' /></td>\n";
  676. echo "<td>".$text['option-false']."</td><td><input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='checkbox' name='".$x."field_value' value='false' /></td>\n";
  677. }
  678. echo "</tr>\n";
  679. echo "</table>\n";
  680. echo "</td>\n";
  681. break;
  682. case "textarea":
  683. echo "<td valign='top' align='left' class='vtable'>\n";
  684. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  685. echo "<textarea tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' name='".$x."field_value' rows='4'>".$data_row[$row['field_name']]."</textarea>\n";
  686. echo "</td>\n";
  687. break;
  688. case "radiobutton":
  689. echo "<td valign='top' align='left' class='vtable'>\n";
  690. echo "<input type='hidden' name=\"".$x."field_name\" value=\"".$row['field_name']."\">\n";
  691. $sqlselect = "SELECT data_types_name, data_types_value ";
  692. $sqlselect .= "FROM v_schema_name_values ";
  693. $sqlselect .= "where domain_uuid = '".$domain_uuid."' ";
  694. $sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' ";
  695. $prep_statement_2 = $db->prepare($sqlselect);
  696. $prep_statement_2->execute();
  697. $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
  698. $result_count2 = count($result2);
  699. echo "<table>";
  700. if ($result_count > 0) {
  701. foreach($result2 as $row2) {
  702. echo "<tr><td>".$row2["data_types_name"]."</td><td><input tabindex='".$row['field_order_tab']."' type='radio' name='".$x."field_value' value='".$row2["data_types_select_value"]."'";
  703. if ($row2["data_types_value"] == $data_row[$row['field_name']]) { echo " checked>"; } else { echo ">"; }
  704. echo "</td></tr>";
  705. } //end foreach
  706. } //end if results
  707. unset($sqlselect, $result2, $result_count2);
  708. echo "</table>";
  709. //echo "</select>\n";
  710. echo "</td>\n";
  711. break;
  712. case "select":
  713. echo "<td valign='top' align='left' class='vtable'>\n";
  714. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  715. $sqlselect = "SELECT data_types_name, data_types_value ";
  716. $sqlselect .= "FROM v_schema_name_values ";
  717. $sqlselect .= "where domain_uuid = '".$domain_uuid."' ";
  718. $sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' ";
  719. $prep_statement_2 = $db->prepare($sqlselect);
  720. $prep_statement_2->execute();
  721. $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
  722. $result_count2 = count($result2);
  723. echo "<select tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' name='".$x."field_value'>\n";
  724. echo "<option value=''></option>\n";
  725. if ($result_count > 0) {
  726. foreach($result2 as $row2) {
  727. echo "<option value=\"" . $row2["data_types_value"] . "\"";
  728. if (strtolower($row2["data_types_value"]) == strtolower($data_row[$row['field_name']])) { echo " selected='selected' "; }
  729. echo ">" . $row2["data_types_name"] . "</option>\n";
  730. } //end foreach
  731. } //end if results
  732. unset($sqlselect, $result2, $result_count2);
  733. echo "</select>\n";
  734. echo "</td>\n";
  735. break;
  736. case "ipv4":
  737. //max 15
  738. echo "<td valign='top' align='left' class='vtable'>\n";
  739. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  740. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='15' value=\"".$data_row[$row['field_name']]."\">\n";
  741. echo "</td>\n";
  742. break;
  743. case "ipv6":
  744. //maximum number of characters 39
  745. echo "<td valign='top' align='left' class='vtable'>\n";
  746. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  747. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='39' value=\"".$data_row[$row['field_name']]."\">\n";
  748. echo "</td>\n";
  749. break;
  750. case "phone":
  751. $tmp_phone = $data_row[$row['field_name']];
  752. $tmp_phone = format_phone($tmp_phone);
  753. echo "<td valign='top' align='left' class='vtable'>\n";
  754. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  755. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='20' value=\"".$tmp_phone."\">\n";
  756. echo "</td>\n";
  757. break;
  758. case "money":
  759. echo "<td valign='top' align='left' class='vtable'>\n";
  760. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  761. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name=".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
  762. echo "</td>\n";
  763. break;
  764. case "add_user":
  765. //echo "<td valign='top' align='left' class='vtable'>\n";
  766. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  767. echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
  768. //echo "</td>\n";
  769. break;
  770. case "add_date":
  771. //echo "<td valign='top' align='left' class='vtable'>\n";
  772. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  773. echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
  774. //echo "</td>\n";
  775. break;
  776. case "mod_user":
  777. //echo "<td valign='top' align='left' class='vtable'>\n";
  778. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  779. echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
  780. //echo "</td>\n";
  781. break;
  782. case "mod_date":
  783. //echo "<td valign='top' align='left' class='vtable'>\n";
  784. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  785. echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
  786. //echo "</td>\n";
  787. break;
  788. case "uploadimage":
  789. if (strlen($data_row[$row['field_name']]) > 0) {
  790. echo "<td valign='top' align='left' class='vtable'>\n";
  791. echo "<script type=\"text/javascript\">\n";
  792. echo $row['field_name']." = \"\<input type=\'hidden\' name=\'".$x."field_name\' value=\'".$row['field_name']."\'>\\n\";\n";
  793. echo $row['field_name']." += \"\<input tabindex='".$row['field_order_tab']."' class=\'formfld fileinput\' type=\'file\' name='".$x."field_value\' value=\'".$data_row[$row['field_name']]."\'>\\n\";\n";
  794. echo "</script>\n";
  795. echo "<div id='".$row['field_name']."id'>";
  796. echo "<table border='0' width='100%'>";
  797. echo "<tr>";
  798. echo "<td align='left'>";
  799. echo "".$data_row[$row['field_name']]."";
  800. echo "</td>";
  801. echo "<td align='right'>";
  802. echo "<input tabindex='".$row['field_order_tab']."' type='button' class='btn' title='delete' onclick=\"document.getElementById('".$row['field_name']."id').innerHTML=".$row['field_name']."\" value='x'>\n";
  803. //echo "<input type='button' class='btn' title='delete' onclick=\"addField('".$row['field_name']."id','".$x."field_name', 'hidden', '".$row['field_name']."',1);addField('".$row['field_name']."id','".$x."field_value', 'file', '',1);//'".$row['field_name']."'\" value='x'>\n";
  804. echo "</td>";
  805. echo "</tr>";
  806. echo "<tr>";
  807. echo "<td colspan='2' align='center'>";
  808. if (file_exists($imagetempdir.$data_row[$row['field_name']])) {
  809. echo "<img src='/images/cache/".$data_row[$row['field_name']]."'>";
  810. }
  811. else {
  812. echo "<img src='imagelo.php?max=125&img=".$data_row[$row['field_name']]."'>";
  813. }
  814. echo "</td>";
  815. echo "</tr>";
  816. echo "</table>";
  817. echo "<div>";
  818. echo "</td>\n";
  819. }
  820. else {
  821. echo "<td valign='top' align='left' class='vtable'>\n";
  822. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  823. echo "<input tabindex='".$row['field_order_tab']."' class='formfld fileinput' style='width:90%' type='file' name='".$x."field_value' value=\"".$data_row[$row['field_name']]."\">\n";
  824. echo "</td>\n";
  825. }
  826. break;
  827. case "upload_file":
  828. if (strlen($data_row[$row['field_name']]) > 0) {
  829. echo "<td valign='top' align='left' class='vtable'>\n";
  830. echo "<script type=\"text/javascript\">\n";
  831. echo $row['field_name']." = \"<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\";\n";
  832. echo $row['field_name']." += \"<input tabindex='".$row['field_order_tab']."' class='formfld fileinput' style='width:90%' type='file' name='".$x."field_value' value='".$data_row[$row['field_name']]."'>\";\n";
  833. echo "</script>\n";
  834. echo "<span id='".$row['field_name']."'>";
  835. echo "<table width='100%'>";
  836. echo "<tr>";
  837. echo "<td>";
  838. echo "<a href='download.php?f=".$data_row[$row['field_name']]."'>".$data_row[$row['field_name']]."</a>";
  839. echo "</td>";
  840. echo "<td align='right'>";
  841. echo "<input tabindex='".$row['field_order_tab']."' type='button' class='btn' title='".$text['button-delete']."' onclick=\"document.getElementById('".$row['field_name']."').innerHTML=".$row['field_name']."\" value='x'>\n";
  842. echo "</td>";
  843. echo "</tr>";
  844. echo "</table>";
  845. echo "<span>";
  846. echo "</td>\n";
  847. }
  848. else {
  849. echo "<td valign='top' align='left' class='vtable'>\n";
  850. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  851. echo "<input tabindex='".$row['field_order_tab']."' class='formfld fileinput' style='width:90%' type='file' name='".$x."field_value' value=\"".$data_row[$row['field_name']]."\">\n";
  852. echo "</td>\n";
  853. }
  854. break;
  855. default:
  856. echo "<td valign='top' align='left' class='vtable'>\n";
  857. echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
  858. echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' style='' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
  859. echo "</td>\n";
  860. }
  861. if ($row['field_type'] != "hidden"){
  862. echo "</tr>\n";
  863. }
  864. //set the current value to the previous value
  865. $field_column_previous = $field_column;
  866. $x++;
  867. } //end foreach
  868. unset($sql, $result, $row_count);
  869. if ($column_schema_cell_status == 'open') {
  870. $column_schema_cell_status = 'closed';
  871. }
  872. } //end if results
  873. echo " <tr>\n";
  874. echo " <td colspan='999' align='right'>\n";
  875. if ($action == "add" && permission_exists('schema_data_add')) {
  876. echo " <input type='submit' class='btn' name='submit' value='".$text['button-save']."'>\n";
  877. }
  878. if ($action == "update" && permission_exists('schema_data_edit')) {
  879. echo " <input type='hidden' name='data_row_uuid' value='$data_row_uuid'>\n";
  880. echo " <input type='submit' tabindex='9999999' class='btn' name='submit' value='".$text['button-save']."'>\n";
  881. }
  882. echo " </td>\n";
  883. echo " </tr>\n";
  884. echo "</table>\n";
  885. echo " </td>\n";
  886. echo " </tr>\n";
  887. echo "</form>\n";
  888. if ($action == "update" && permission_exists('schema_data_edit')) {
  889. //get the child schema_uuid and use it to show the list of data
  890. $sql = "select * from v_schemas ";
  891. $sql .= "where domain_uuid = '$domain_uuid' ";
  892. $sql .= "and schema_parent_uuid = '$schema_uuid' ";
  893. $prep_statement = $db->prepare($sql);
  894. $prep_statement->execute();
  895. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  896. foreach ($result as &$row) {
  897. echo "<tr class='border'>\n";
  898. echo " <td colspan='999' align=\"left\">\n";
  899. echo " <br>";
  900. $_GET["id"] = $row["schema_uuid"];
  901. $schema_label = $row["schema_label"];
  902. $_GET["data_parent_row_uuid"] = $data_row_uuid;
  903. //show button
  904. //echo "<input type='button' class='btn' name='' alt='".$schema_label."' onclick=\"window.location='schema_data_view.php?id=".$row["schema_uuid"]."&data_parent_row_uuid=".$data_row_uuid."'\" value='".$schema_label."'>\n";
  905. //show list
  906. require_once "schema_data_view.php";
  907. echo " </td>";
  908. echo " </tr>";
  909. }
  910. }
  911. echo "</table>\n";
  912. require_once "resources/footer.php";
  913. ?>