2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
include "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2013-04-11 18:56:30 +02:00
|
|
|
if (permission_exists('schema_data_add') || permission_exists('schema_data_edit')) {
|
2012-06-04 16:58:40 +02:00
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-21 18:02:05 +02:00
|
|
|
//add multi-lingual support
|
2015-01-18 11:06:08 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2013-06-21 18:02:05 +02:00
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//set http get variables to php variables
|
2013-07-09 22:34:44 +02:00
|
|
|
$search_all = strtolower(check_str($_GET["search_all"]));
|
2013-04-11 18:56:30 +02:00
|
|
|
$schema_uuid = check_str($_GET["schema_uuid"]);
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($_GET["data_row_uuid"])>0) { //update
|
|
|
|
|
$data_row_uuid = check_str($_GET["data_row_uuid"]);
|
2012-06-04 16:58:40 +02:00
|
|
|
$action = "update";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (strlen($search_all) > 0) {
|
|
|
|
|
$action = "update";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$action = "add";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (strlen($_GET["id"]) > 0) {
|
2013-04-11 18:56:30 +02:00
|
|
|
$schema_uuid = check_str($_GET["id"]);
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($_GET["data_parent_row_uuid"])>0) {
|
|
|
|
|
$data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]);
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
//get schema information
|
|
|
|
|
$sql = "select * from v_schemas ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
foreach ($result as &$row) {
|
2013-04-11 18:56:30 +02:00
|
|
|
$schema_category = $row["schema_category"];
|
|
|
|
|
$schema_label = $row["schema_label"];
|
|
|
|
|
$schema_name = $row["schema_name"];
|
|
|
|
|
$schema_auth = $row["schema_auth"];
|
|
|
|
|
$schema_captcha = $row["schema_captcha"];
|
|
|
|
|
$schema_parent_id = $row["schema_parent_id"];
|
|
|
|
|
$schema_description = $row["schema_description"];
|
2012-06-04 16:58:40 +02:00
|
|
|
break; //limit to 1 row
|
|
|
|
|
}
|
|
|
|
|
unset ($prep_statement);
|
|
|
|
|
|
|
|
|
|
//process the data submitted to by the html form
|
|
|
|
|
if (count($_POST)>0) { //add
|
2013-04-11 18:56:30 +02:00
|
|
|
$schema_uuid = check_str($_POST["schema_uuid"]);
|
|
|
|
|
$schema_name = check_str($_POST["schema_name"]);
|
2012-06-04 16:58:40 +02:00
|
|
|
$rcount = check_str($_POST["rcount"]);
|
|
|
|
|
|
|
|
|
|
//get the field information
|
|
|
|
|
$db_field_name_array = array();
|
|
|
|
|
$db_value_array = array();
|
|
|
|
|
$db_names .= "<tr>\n";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql = "select * from v_schema_fields ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid' ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "order by field_order asc ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare($sql);
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result_names = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
|
$result_count = count($result);
|
|
|
|
|
foreach($result_names as $row) {
|
2013-03-25 20:15:27 +01:00
|
|
|
$field_label = $row["field_label"];
|
|
|
|
|
$field_name = $row["field_name"];
|
|
|
|
|
$field_type = $row["field_type"];
|
|
|
|
|
$field_value = $row["field_value"];
|
|
|
|
|
$field_list_hidden = $row["field_list_hidden"];
|
|
|
|
|
$field_column = $row["field_column"];
|
|
|
|
|
$field_required = $row["field_required"];
|
|
|
|
|
$field_order = $row["field_order"];
|
|
|
|
|
$field_order_tab = $row["field_order_tab"];
|
|
|
|
|
$field_description = $row["field_description"];
|
|
|
|
|
|
|
|
|
|
$name_array[$field_name]['field_label'] = $row["field_label"];
|
|
|
|
|
$name_array[$field_name]['field_type'] = $row["field_type"];
|
|
|
|
|
$name_array[$field_name]['field_list_hidden'] = $row["field_list_hidden"];
|
|
|
|
|
$name_array[$field_name]['field_column'] = $row["field_column"];
|
|
|
|
|
$name_array[$field_name]['field_required'] = $row["field_required"];
|
|
|
|
|
$name_array[$field_name]['field_order'] = $row["field_order"];
|
|
|
|
|
$name_array[$field_name]['field_order_tab'] = $row["field_order_tab"];
|
|
|
|
|
$name_array[$field_name]['field_description'] = $row["field_description"];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
unset($sql, $prep_statement, $row);
|
|
|
|
|
$fieldcount = count($name_array);
|
|
|
|
|
|
|
|
|
|
$i = 1;
|
|
|
|
|
while($i <= $rcount){
|
2013-03-25 20:15:27 +01:00
|
|
|
$field_name = check_str($_POST[$i."field_name"]);
|
|
|
|
|
$data_field_value = check_str($_POST[$i."field_value"]);
|
2012-06-04 16:58:40 +02:00
|
|
|
if ($i==1) {
|
|
|
|
|
$unique_temp_id = md5('7k3j2m'.date('r')); //used to find the first item
|
2013-03-25 20:15:27 +01:00
|
|
|
$data_row_uuid = $unique_temp_id;
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql = "select field_type, field_name from v_schema_fields ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid' ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "and field_name = '$field_name' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare($sql);
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
while($row = $prep_statement->fetch()){
|
2013-03-25 20:15:27 +01:00
|
|
|
$field_type = $row['field_type'];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($field_type == "upload_file" || $field_type == "uploadimage") {
|
2012-06-04 16:58:40 +02:00
|
|
|
//print_r($_FILES);
|
|
|
|
|
$upload_temp_dir = $_ENV["TEMP"]."\\";
|
|
|
|
|
ini_set('upload_tmp_dir', $upload_temp_dir);
|
|
|
|
|
//$uploaddir = "";
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($field_type == "upload_file") {
|
2012-06-04 16:58:40 +02:00
|
|
|
$upload_file = $filedir . $_FILES[$i.'field_value']['name'];
|
|
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($field_type == "uploadimage") {
|
2012-06-04 16:58:40 +02:00
|
|
|
$upload_file = $imagedir . $_FILES[$i.'field_value']['name'];
|
|
|
|
|
}
|
|
|
|
|
// $_POST[$i."field_name"]
|
|
|
|
|
//print_r($_FILES);
|
|
|
|
|
//echo "upload_file $upload_file<br>\n";
|
|
|
|
|
//echo "upload_temp_dir $upload_temp_dir<br>\n";
|
|
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
$data_field_value = $_FILES[$i.'field_value']['name'];
|
|
|
|
|
//echo "name $data_field_value<br>\n";
|
|
|
|
|
//echo "field_name $field_name<br>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//$i."field_value"
|
|
|
|
|
//echo "if (move_uploaded_file(\$_FILES[$i.'field_value']['tmp_name'], $upload_file)) ";
|
|
|
|
|
//if (strlen($_FILES[$i.'field_value']['name'])>0) { //only do the following if there is a file name
|
|
|
|
|
//foreach($_FILES as $file)
|
|
|
|
|
//{
|
|
|
|
|
//[$i.'field_value']
|
|
|
|
|
//print_r($file);
|
|
|
|
|
if($_FILES[$i.'field_value']['error'] == 0 && $_FILES[$i.'field_value']['size'] > 0) {
|
|
|
|
|
if (move_uploaded_file($_FILES[$i.'field_value']['tmp_name'], $upload_file)) {
|
|
|
|
|
//echo $_FILES['userfile']['name'] ." <br>";
|
|
|
|
|
//echo "was successfully uploaded. ";
|
|
|
|
|
//echo "<br><br>";
|
|
|
|
|
//print "<pre>";
|
|
|
|
|
//print_r($_FILES);
|
|
|
|
|
//print "</pre>";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//echo "Upload Error. Here's some debugging info:\n";
|
|
|
|
|
//print "<pre>\n";
|
|
|
|
|
//print_r($_FILES);
|
|
|
|
|
//print "</pre>\n";
|
|
|
|
|
//exit;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//}
|
|
|
|
|
//}
|
|
|
|
|
} //end if file or image
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($action == "add" && permission_exists('schema_data_add')) {
|
2013-03-25 20:15:27 +01:00
|
|
|
//get a unique id for the data_row_uuid
|
2012-06-04 16:58:40 +02:00
|
|
|
if ($i==1) {
|
2013-03-25 20:15:27 +01:00
|
|
|
$data_row_uuid = uuid();
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//insert the field data
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql = "insert into v_schema_data ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "(";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "schema_data_uuid, ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "domain_uuid, ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "data_row_uuid, ";
|
|
|
|
|
if(strlen($data_parent_row_uuid)>0) {
|
|
|
|
|
$sql .= "data_parent_row_uuid, ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "schema_uuid, ";
|
|
|
|
|
if (strlen($schema_parent_id) > 0) {
|
|
|
|
|
$sql .= "schema_parent_id, ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "field_name, ";
|
|
|
|
|
$sql .= "data_field_value, ";
|
|
|
|
|
$sql .= "data_add_user, ";
|
|
|
|
|
$sql .= "data_add_date ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= ")";
|
|
|
|
|
$sql .= "values ";
|
|
|
|
|
$sql .= "(";
|
|
|
|
|
$sql .= "'".uuid()."', ";
|
|
|
|
|
$sql .= "'$domain_uuid', ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "'$data_row_uuid', ";
|
|
|
|
|
if(strlen($data_parent_row_uuid)>0) {
|
|
|
|
|
$sql .= "'$data_parent_row_uuid', ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "'$schema_uuid', ";
|
|
|
|
|
if (strlen($schema_parent_id) > 0) {
|
|
|
|
|
$sql .= "'$schema_parent_id', ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "'$field_name', ";
|
|
|
|
|
switch ($name_array[$field_name]['field_type']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
case "phone":
|
2013-03-25 20:15:27 +01:00
|
|
|
$tmp_phone = preg_replace('{\D}', '', $data_field_value);
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "'$tmp_phone', ";
|
|
|
|
|
break;
|
|
|
|
|
case "add_user":
|
|
|
|
|
$sql .= "'".$_SESSION["username"]."', ";
|
|
|
|
|
break;
|
|
|
|
|
case "add_date":
|
|
|
|
|
$sql .= "now(), ";
|
|
|
|
|
break;
|
|
|
|
|
case "mod_user":
|
|
|
|
|
$sql .= "'".$_SESSION["username"]."', ";
|
|
|
|
|
break;
|
|
|
|
|
case "mod_date":
|
|
|
|
|
$sql .= "now(), ";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "'$data_field_value', ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
$sql .= "'".$_SESSION["username"]."', ";
|
|
|
|
|
$sql .= "now() ";
|
|
|
|
|
$sql .= ")";
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
$lastinsertid = $db->lastInsertId($id);
|
|
|
|
|
unset($sql);
|
|
|
|
|
} //end action add
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($action == "update" && permission_exists('schema_data_edit')) {
|
2013-03-25 20:15:27 +01:00
|
|
|
$data_row_uuid = $_POST["data_row_uuid"];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql_update = "update v_schema_data set ";
|
2013-03-25 20:15:27 +01:00
|
|
|
switch ($name_array[$field_name]['field_type']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
case "phone":
|
2013-03-25 20:15:27 +01:00
|
|
|
$tmp_phone = preg_replace('{\D}', '', $data_field_value);
|
|
|
|
|
$sql_update .= "data_field_value = '$tmp_phone' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
case "add_user":
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql_update .= "data_field_value = '".$_SESSION["username"]."' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
case "add_date":
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql_update .= "data_field_value = now() ";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
case "mod_user":
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql_update .= "data_field_value = '".$_SESSION["username"]."' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
case "mod_date":
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql_update .= "data_field_value = now() ";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql_update .= "data_field_value = '$data_field_value' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
$sql_update .= "where domain_uuid = '$domain_uuid' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql_update .= "and schema_uuid = '$schema_uuid' ";
|
|
|
|
|
if (strlen($schema_parent_id) > 0) {
|
|
|
|
|
$sql_update .= "and schema_parent_id = '$schema_parent_id' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql_update .= "and data_row_uuid = '$data_row_uuid' ";
|
|
|
|
|
if(strlen($data_parent_row_uuid)>0) {
|
|
|
|
|
$sql_update .= "and data_parent_row_uuid = '$data_parent_row_uuid' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql_update .= "and field_name = '$field_name' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$count = $db->exec(check_sql($sql_update));
|
|
|
|
|
unset ($sql_update);
|
|
|
|
|
if ($count > 0) {
|
|
|
|
|
//do nothing the update was successfull
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//no value to update so insert new value
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql = "insert into v_schema_data ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "(";
|
|
|
|
|
$sql .= "domain_uuid, ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "data_row_uuid, ";
|
|
|
|
|
if(strlen($data_parent_row_uuid)>0) {
|
|
|
|
|
$sql .= "data_parent_row_uuid, ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "schema_uuid, ";
|
|
|
|
|
$sql .= "schema_parent_id, ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "field_name, ";
|
|
|
|
|
$sql .= "data_field_value, ";
|
|
|
|
|
$sql .= "data_add_user, ";
|
|
|
|
|
$sql .= "data_add_date ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= ")";
|
|
|
|
|
$sql .= "values ";
|
|
|
|
|
$sql .= "(";
|
|
|
|
|
$sql .= "'$domain_uuid', ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "'$data_row_uuid', ";
|
|
|
|
|
if(strlen($data_parent_row_uuid)>0) {
|
|
|
|
|
$sql .= "'$data_parent_row_uuid', ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "'$schema_uuid', ";
|
|
|
|
|
$sql .= "'$schema_parent_id', ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "'$field_name', ";
|
|
|
|
|
switch ($name_array[$field_name]['field_type']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
case "phone":
|
2013-03-25 20:15:27 +01:00
|
|
|
$tmp_phone = preg_replace('{\D}', '', $data_field_value);
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "'$tmp_phone', ";
|
|
|
|
|
break;
|
|
|
|
|
case "add_user":
|
|
|
|
|
$sql .= "'".$_SESSION["username"]."', ";
|
|
|
|
|
break;
|
|
|
|
|
case "add_date":
|
|
|
|
|
$sql .= "now(), ";
|
|
|
|
|
break;
|
|
|
|
|
case "mod_user":
|
|
|
|
|
$sql .= "'".$_SESSION["username"]."', ";
|
|
|
|
|
break;
|
|
|
|
|
case "mod_date":
|
|
|
|
|
$sql .= "now(), ";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "'$data_field_value', ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
$sql .= "'".$_SESSION["username"]."', ";
|
|
|
|
|
$sql .= "now() ";
|
|
|
|
|
$sql .= ")";
|
|
|
|
|
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
$lastinsertid = $db->lastInsertId($id);
|
|
|
|
|
unset($sql);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-23 09:07:37 +01:00
|
|
|
//redirect user
|
|
|
|
|
if ($action == "add") {
|
|
|
|
|
$_SESSION["message"] = $text['message-add'];
|
2014-02-26 06:49:39 +01:00
|
|
|
}
|
2014-02-23 09:07:37 +01:00
|
|
|
else if ($action == "update") {
|
|
|
|
|
$_SESSION["message"] = $text['message-update'];
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($data_parent_row_uuid) == 0) {
|
2014-02-23 09:07:37 +01:00
|
|
|
header("Location: schema_data_edit.php?id=".$schema_uuid."&data_row_uuid=".$data_row_uuid);
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2014-02-23 09:07:37 +01:00
|
|
|
header("Location: schema_data_edit.php?schema_uuid=".$schema_parent_id."&data_row_uuid=".$data_parent_row_uuid);
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//show the header
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2014-07-10 02:32:50 +02:00
|
|
|
$document['title'] = $text['title-data'];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//pre-populate the form
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
//get the field values
|
|
|
|
|
$sql = "";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "select * from v_schema_data ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
|
|
|
|
if (strlen($search_all) == 0) {
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid' ";
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($data_parent_row_uuid) > 0) {
|
|
|
|
|
$sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "and data_row_uuid in (";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "select data_row_uuid from v_schema_data \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid' ";
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($data_parent_row_uuid) > 0) {
|
|
|
|
|
$sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-25 20:15:27 +01:00
|
|
|
//$sql .= "and data_field_value like '%$search_all%' )\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
$tmp_digits = preg_replace('{\D}', '', $search_all);
|
|
|
|
|
if (is_numeric($tmp_digits) && strlen($tmp_digits) > 5) {
|
|
|
|
|
if (strlen($tmp_digits) == '11' ) {
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "and data_field_value like '%".substr($tmp_digits, -10)."%' )\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "and data_field_value like '%$tmp_digits%' )\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-07-09 22:34:44 +02:00
|
|
|
$sql .= "and lower(data_field_value) like '%$search_all%' )\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "order by data_row_uuid asc ";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
$row_id = '';
|
|
|
|
|
$row_id_found = false;
|
|
|
|
|
$next_row_id_found = false;
|
|
|
|
|
$prep_statement = $db->prepare($sql);
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$x=0;
|
|
|
|
|
while($row = $prep_statement->fetch()) {
|
|
|
|
|
//set the last last row id
|
|
|
|
|
if ($x==0) {
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($data_row_uuid) == 0) {
|
|
|
|
|
$data_row_uuid = $row['data_row_uuid'];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
$first_data_row_uuid = $row['data_row_uuid'];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
//get the data for the specific row id
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($data_row_uuid == $row['data_row_uuid']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
//set the data and save it to an array
|
2013-03-25 20:15:27 +01:00
|
|
|
$data_row[$row['field_name']] = $row['data_field_value'];
|
2012-06-04 16:58:40 +02:00
|
|
|
//set the previous row id
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($previous_row_id != $row['data_row_uuid']) {
|
|
|
|
|
$previous_data_row_uuid = $previous_row_id;
|
2012-06-04 16:58:40 +02:00
|
|
|
$row_id_found = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//detect a new row id
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($previous_row_id != $row['data_row_uuid']) {
|
2013-06-21 18:02:05 +02:00
|
|
|
if ($row_id_found) {
|
2012-06-04 16:58:40 +02:00
|
|
|
if (!$next_row_id_found) {
|
|
|
|
|
//make sure it is not the current row id
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($data_row_uuid != $row['data_row_uuid']) {
|
|
|
|
|
$next_data_row_uuid = $row['data_row_uuid'];
|
2012-06-04 16:58:40 +02:00
|
|
|
$next_row_id_found = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//set the last last row id
|
2013-03-25 20:15:27 +01:00
|
|
|
$last_data_row_uuid = $row['data_row_uuid'];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//set the temporary previous row id
|
2013-03-25 20:15:27 +01:00
|
|
|
$previous_row_id = $row['data_row_uuid'];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//set the record number array
|
2013-03-25 20:15:27 +01:00
|
|
|
$record_number_array[$row['data_row_uuid']] = $x+1;
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//save the total number of records
|
|
|
|
|
$total_records = $x;
|
|
|
|
|
|
|
|
|
|
//set record number
|
2013-06-21 18:02:05 +02:00
|
|
|
if (strlen($_GET["n"]) == 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
$n = 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$n = $_GET["n"];
|
|
|
|
|
}
|
|
|
|
|
unset($sql, $prep_statement, $row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//use this when the calendar is needed
|
2013-07-06 08:21:12 +02:00
|
|
|
//echo "<script language='javascript' src=\"/resources/calendar_popcalendar.js\"></script>\n";
|
|
|
|
|
//echo "<script language=\"javascript\" src=\"/resources/calendar_lw_layers.js\"></script>\n";
|
|
|
|
|
//echo "<script language=\"javascript\" src=\"/resources/calendar_lw_menu.js\"></script>";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-06-21 18:02:05 +02:00
|
|
|
//begin creating the content
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<br />";
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
//get the title and description of the schema
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td width='50%' valign='top' nowrap='nowrap'>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <b>$schema_label ";
|
2012-06-04 16:58:40 +02:00
|
|
|
if ($action == "add") {
|
2013-06-21 18:02:05 +02:00
|
|
|
echo $text['button-add']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-06-21 18:02:05 +02:00
|
|
|
echo $text['button-edit']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </b>\n";
|
|
|
|
|
echo " \n";
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($action == "update" && permission_exists('schema_data_edit')) {
|
2013-06-21 18:02:05 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " <br />\n";
|
2013-04-11 18:56:30 +02:00
|
|
|
echo " $schema_description\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($data_parent_row_uuid) == 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<td align='center' valign='top' nowrap='nowrap'>\n";
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($action == "update" && permission_exists('schema_data_edit')) {
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($previous_data_row_uuid) == 0) {
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-prev']."' disabled='disabled' value='".$text['button-prev']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-06-21 18:02:05 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-prev']."' value='".$record_number_array[$data_row_uuid]." (".$total_records.")'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($next_data_row_uuid) == 0) {
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-next']."' disabled='disabled' value='".$text['button-next']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-06-21 18:02:05 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo " ";
|
|
|
|
|
echo " ";
|
|
|
|
|
echo " ";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
|
|
echo "<td width='45%' align='right' valign='top' nowrap='nowrap'>\n";
|
2014-02-26 06:49:39 +01:00
|
|
|
echo " <form method='GET' name='frm_search' action='schema_data_edit.php'>\n";
|
2013-04-11 18:56:30 +02:00
|
|
|
echo " <input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
|
|
|
|
|
//echo " <input type='hidden' name='id' value='$schema_uuid'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
//echo " <input type='hidden' name='data_parent_row_uuid' value='$data_parent_row_uuid'>\n";
|
|
|
|
|
//echo " <input type='hidden' name='data_row_uuid' value='$first_data_row_uuid'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " <input class='formfld' type='text' name='search_all' value='$search_all'>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <input class='btn' type='submit' name='submit' value='".$text['button-search_all']."'>\n";
|
2014-02-26 06:49:39 +01:00
|
|
|
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";
|
|
|
|
|
echo " </form>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <td width='50%' align='right'>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
//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";
|
|
|
|
|
//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";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
2015-02-15 09:46:20 +01:00
|
|
|
//begin the table that will hold the html form
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='10'>\n";
|
|
|
|
|
|
|
|
|
|
//determine if a file should be uploaded
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql = "SELECT * FROM v_schema_fields ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid ' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid ' ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "and field_type = 'uploadimage' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "or domain_uuid = '$domain_uuid ' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid ' ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "and field_type = 'upload_file' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare($sql);
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) > 0) {
|
|
|
|
|
echo "<form method='post' name='frm' enctype='multipart/form-data' action=''>\n";
|
|
|
|
|
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"104857600\" />\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "<form method='post' name='frm' action=''>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
//get the fields and then display them
|
|
|
|
|
$sql = "select * from v_schema_fields ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid' ";
|
2013-03-25 20:15:27 +01:00
|
|
|
$sql .= "order by field_column asc, field_order asc ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare($sql);
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
$result_count = count($result);
|
|
|
|
|
|
|
|
|
|
echo "<input type='hidden' name='rcount' value='$result_count'>\n";
|
2013-04-11 18:56:30 +02:00
|
|
|
echo "<input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
if ($result_count == 0) { //no results
|
|
|
|
|
echo "<tr><td class='vncell'> </td></tr>\n";
|
|
|
|
|
}
|
|
|
|
|
else { //received results
|
|
|
|
|
$x=1;
|
2013-03-25 20:15:27 +01:00
|
|
|
$field_column_previous = '';
|
2013-04-11 18:56:30 +02:00
|
|
|
$column_schema_cell_status = '';
|
2012-06-04 16:58:40 +02:00
|
|
|
foreach($result as $row) {
|
|
|
|
|
//handle more than one column
|
2013-03-25 20:15:27 +01:00
|
|
|
$field_column = $row[field_column];
|
|
|
|
|
//echo "<!--[column: $field_column]-->\n";
|
|
|
|
|
if ($field_column != $field_column_previous) {
|
2013-04-11 18:56:30 +02:00
|
|
|
$column_schema_cell_status = 'open';
|
2012-06-04 16:58:40 +02:00
|
|
|
//do the following except for the first time through the loop
|
|
|
|
|
if ($x != 1) {
|
|
|
|
|
//close the table
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
//close the row
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
//open a new row
|
|
|
|
|
echo "<td valign='top'>\n";
|
|
|
|
|
//start a table in the new row
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//display the fields
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($row['field_type'] != "hidden"){
|
|
|
|
|
switch ($row['field_type']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
case "add_user":
|
|
|
|
|
break;
|
|
|
|
|
case "add_date":
|
|
|
|
|
break;
|
|
|
|
|
case "mod_user":
|
|
|
|
|
break;
|
|
|
|
|
case "mod_date":
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
echo "<tr>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($row['field_type'] == "label") {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<td valign='bottom' align='left' class='' style='padding-top:10px;padding-bottom:7px;padding-right:5px;padding-left:0px;' nowrap='nowrap'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo " <strong>".$row['field_label']."</strong>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($row['field_required'] == "yes") {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<td valign='top' align='left' class='vncellreq' style='padding-top:3px;' nowrap='nowrap'>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "<td valign='top' align='left' class='vncell' style='padding-top:3px;' nowrap='nowrap'>\n";
|
|
|
|
|
}
|
2015-02-15 07:50:00 +01:00
|
|
|
echo "".$row['field_label']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
switch ($row['field_type']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
case "checkbox":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
if (strlen($data_row[$row['field_name']])>0) {
|
|
|
|
|
echo "<input tabindex='".$row['field_order_tab']."' class='' type='checkbox' name='".$x."field_value' maxlength='50' value=\"".$row['field_value']."\" checked='checked'/>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input tabindex='".$row['field_order_tab']."' class='' type='checkbox' name='".$x."field_value' maxlength='50' value=\"".$row['field_value']."\" />\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "text":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "email":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "label":
|
|
|
|
|
break;
|
|
|
|
|
case "password":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
2014-03-07 03:59:20 +01:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "pin_number":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
|
2014-03-07 03:59:20 +01:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "hidden":
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
|
|
|
|
|
echo "<input type='hidden' name='".$x."field_value' value=\"".$data_row[$row['field_name']]."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
case "url":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "date":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
//echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
|
|
|
|
|
//echo "<tr>";
|
2013-03-25 20:15:27 +01:00
|
|
|
//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";
|
2012-06-04 16:58:40 +02:00
|
|
|
//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";
|
|
|
|
|
//echo "</tr>";
|
|
|
|
|
//echo "</table>";
|
2013-03-25 20:15:27 +01:00
|
|
|
//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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "truefalse":
|
|
|
|
|
//checkbox
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value=\"".$row['field_name']."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table border='0'>\n";
|
|
|
|
|
echo "<tr>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
switch ($row['field_name']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
case "true":
|
2013-06-21 18:02:05 +02:00
|
|
|
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";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
case "false":
|
2013-06-21 18:02:05 +02:00
|
|
|
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";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
2013-06-21 18:02:05 +02:00
|
|
|
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";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "textarea":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "radiobutton":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name=\"".$x."field_name\" value=\"".$row['field_name']."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
$sqlselect = "SELECT data_types_name, data_types_value ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sqlselect .= "FROM v_schema_name_values ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sqlselect .= "where domain_uuid = '".$domain_uuid."' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement_2 = $db->prepare($sqlselect);
|
|
|
|
|
$prep_statement_2->execute();
|
|
|
|
|
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
$result_count2 = count($result2);
|
|
|
|
|
|
|
|
|
|
echo "<table>";
|
|
|
|
|
if ($result_count > 0) {
|
|
|
|
|
foreach($result2 as $row2) {
|
2013-03-25 20:15:27 +01:00
|
|
|
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"]."'";
|
|
|
|
|
if ($row2["data_types_value"] == $data_row[$row['field_name']]) { echo " checked>"; } else { echo ">"; }
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td></tr>";
|
|
|
|
|
} //end foreach
|
|
|
|
|
} //end if results
|
|
|
|
|
unset($sqlselect, $result2, $result_count2);
|
|
|
|
|
echo "</table>";
|
|
|
|
|
//echo "</select>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "select":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
$sqlselect = "SELECT data_types_name, data_types_value ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sqlselect .= "FROM v_schema_name_values ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sqlselect .= "where domain_uuid = '".$domain_uuid."' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement_2 = $db->prepare($sqlselect);
|
|
|
|
|
$prep_statement_2->execute();
|
|
|
|
|
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
$result_count2 = count($result2);
|
|
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<select tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' name='".$x."field_value'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<option value=''></option>\n";
|
|
|
|
|
if ($result_count > 0) {
|
|
|
|
|
foreach($result2 as $row2) {
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<option value=\"" . $row2["data_types_value"] . "\"";
|
|
|
|
|
if (strtolower($row2["data_types_value"]) == strtolower($data_row[$row['field_name']])) { echo " selected='selected' "; }
|
|
|
|
|
echo ">" . $row2["data_types_name"] . "</option>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
} //end foreach
|
|
|
|
|
} //end if results
|
|
|
|
|
unset($sqlselect, $result2, $result_count2);
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "ipv4":
|
|
|
|
|
//max 15
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "ipv6":
|
|
|
|
|
//maximum number of characters 39
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "phone":
|
2013-03-25 20:15:27 +01:00
|
|
|
$tmp_phone = $data_row[$row['field_name']];
|
2012-06-04 16:58:40 +02:00
|
|
|
$tmp_phone = format_phone($tmp_phone);
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
echo "<input tabindex='".$row['field_order_tab']."' class='formfld' style='width:90%' type='text' name='".$x."field_value' maxlength='20' value=\"".$tmp_phone."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "money":
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "add_user":
|
|
|
|
|
//echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "add_date":
|
|
|
|
|
//echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "mod_user":
|
|
|
|
|
//echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "mod_date":
|
|
|
|
|
//echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
echo "<input type='hidden' name='".$x."field_value' maxlength='255' value=\"".$data_row[$row['field_name']]."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
//echo "</td>\n";
|
|
|
|
|
break;
|
|
|
|
|
case "uploadimage":
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($data_row[$row['field_name']]) > 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
|
|
|
|
echo "<script type=\"text/javascript\">\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo $row['field_name']." = \"\<input type=\'hidden\' name=\'".$x."field_name\' value=\'".$row['field_name']."\'>\\n\";\n";
|
2014-08-16 20:24:41 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</script>\n";
|
|
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<div id='".$row['field_name']."id'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table border='0' width='100%'>";
|
|
|
|
|
echo "<tr>";
|
|
|
|
|
echo "<td align='left'>";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "".$data_row[$row['field_name']]."";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>";
|
|
|
|
|
echo "<td align='right'>";
|
2013-03-25 20:15:27 +01:00
|
|
|
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";
|
|
|
|
|
//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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>";
|
|
|
|
|
echo "</tr>";
|
|
|
|
|
echo "<tr>";
|
|
|
|
|
echo "<td colspan='2' align='center'>";
|
2013-03-25 20:15:27 +01:00
|
|
|
if (file_exists($imagetempdir.$data_row[$row['field_name']])) {
|
|
|
|
|
echo "<img src='/images/cache/".$data_row[$row['field_name']]."'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<img src='imagelo.php?max=125&img=".$data_row[$row['field_name']]."'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo "</td>";
|
|
|
|
|
echo "</tr>";
|
|
|
|
|
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "<div>";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
2014-08-16 20:24:41 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "upload_file":
|
2013-03-25 20:15:27 +01:00
|
|
|
if (strlen($data_row[$row['field_name']]) > 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
|
|
|
|
echo "<script type=\"text/javascript\">\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo $row['field_name']." = \"<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\";\n";
|
2014-08-16 20:24:41 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</script>\n";
|
|
|
|
|
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<span id='".$row['field_name']."'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width='100%'>";
|
|
|
|
|
echo "<tr>";
|
|
|
|
|
echo "<td>";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<a href='download.php?f=".$data_row[$row['field_name']]."'>".$data_row[$row['field_name']]."</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>";
|
|
|
|
|
echo "<td align='right'>";
|
2013-06-21 18:02:05 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>";
|
|
|
|
|
echo "</tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "<span>";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
2014-08-16 20:24:41 +02:00
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
echo "<td valign='top' align='left' class='vtable'>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
|
|
|
|
|
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";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
}
|
2013-03-25 20:15:27 +01:00
|
|
|
if ($row['field_type'] != "hidden"){
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//set the current value to the previous value
|
2013-03-25 20:15:27 +01:00
|
|
|
$field_column_previous = $field_column;
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
$x++;
|
|
|
|
|
|
|
|
|
|
} //end foreach
|
|
|
|
|
unset($sql, $result, $row_count);
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($column_schema_cell_status == 'open') {
|
|
|
|
|
$column_schema_cell_status = 'closed';
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
} //end if results
|
|
|
|
|
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td colspan='999' align='right'>\n";
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($action == "add" && permission_exists('schema_data_add')) {
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <input type='submit' class='btn' name='submit' value='".$text['button-save']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($action == "update" && permission_exists('schema_data_edit')) {
|
2013-03-25 20:15:27 +01:00
|
|
|
echo " <input type='hidden' name='data_row_uuid' value='$data_row_uuid'>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <input type='submit' tabindex='9999999' class='btn' name='submit' value='".$text['button-save']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo "</form>\n";
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
if ($action == "update" && permission_exists('schema_data_edit')) {
|
|
|
|
|
//get the child schema_uuid and use it to show the list of data
|
|
|
|
|
$sql = "select * from v_schemas ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
2013-06-28 02:14:14 +02:00
|
|
|
$sql .= "and schema_parent_uuid = '$schema_uuid' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare($sql);
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
foreach ($result as &$row) {
|
|
|
|
|
echo "<tr class='border'>\n";
|
|
|
|
|
echo " <td colspan='999' align=\"left\">\n";
|
|
|
|
|
echo " <br>";
|
2013-04-11 18:56:30 +02:00
|
|
|
$_GET["id"] = $row["schema_uuid"];
|
|
|
|
|
$schema_label = $row["schema_label"];
|
2013-03-25 20:15:27 +01:00
|
|
|
$_GET["data_parent_row_uuid"] = $data_row_uuid;
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//show button
|
2013-04-11 18:56:30 +02:00
|
|
|
//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";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//show list
|
2013-04-11 18:56:30 +02:00
|
|
|
require_once "schema_data_view.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
?>
|