$page = $_GET['page']; $count = $start + 1; } else { $page = 1; $start = 0; $count = 1; } $query .= " LIMIT {$start}, {$limit}"; // echo $query; $persons = mysql_query($query); $count = 1; while ($person = mysql_fetch_assoc($persons)) { // print_r($person); if ($_GET['type'] == 'province') { // print_r($person); $prints = get_person_detial($person['ADDRESSLIST_OWNER_ID']); $print = mysql_fetch_assoc($prints); ?> <tr> <td><h3><?php echo $print['ID']; ?> </h3></td> <td><h3><?php echo get_person_title_string($print['TITLE_ID']) . ' ' . get_person_name_string($print['ID']) . ' ' . get_person_surname_string($print['ID']); ?> </h3></td> <td><h3><?php echo get_person_china_full_name($print['ID'], 0); ?> </h3></td>
// } // if (obj_l >= pattern.length) { // obj.value = obj.value.substr(0, pattern.length); // } // } </script> </head> <body class="btn-danger"> <!--<div class="container">--> <div class=" col-sm-10"> <center> <?php include '../../helper/db_connect.php'; include '../../helper/helper.php'; connect_database(); $persons = get_person_detial($id); $person = mysql_fetch_assoc($persons); // print_r($person); ?> <div class="row"> <h1>เพิ่มข้อมูลติดต่อ <?php //if($person['TITLE_ID'] != 0) // echo get_person_title_string($person['TITLE_ID']) . ' ' . $person['NAME'] . ' ' . $person['SURNAME']; // else // echo $person['NAME'] . ' ' . $person['SURNAME']; ?> </h1> </div> </center> <div class="well">
<?php error_reporting(E_ERROR | E_PARSE); include '../../helper/db_connect.php'; connect_database(); $id = $_GET['id']; $brother_id = $_GET['b_id']; $brothers = get_person_detial($brother_id); $brother = mysql_fetch_assoc($brothers); if ($brother['PARENT_ID'] != 0) { del_parent($brother_id); } else { del_brother($id, $brother_id); } //del_parent($id); echo "<script type='text/javascript'>"; echo "window.history.back();"; echo "</script>";
$org_fax_string = ''; $org_web = array("CONTACT_STRING" => ''); $org_mail = array("CONTACT_STRING" => ''); } if ($person['PARENT_ID'] != 0) { $parent_string = get_person_name_string($person['PARENT_ID']) . " " . get_person_surname_string($person['PARENT_ID']); $parents = get_person_detial($person['PARENT_ID']); $parent = mysql_fetch_assoc($parents); $parent_status = $parent['STATUS']; } else { $parent_string = ''; $parent_status = 0; } if ($person['MOTHER_ID'] != 0) { $mother_string = get_person_name_string($person['MOTHER_ID']) . " " . get_person_surname_string($person['MOTHER_ID']); $mothers = get_person_detial($person['MOTHER_ID']); $mother = mysql_fetch_assoc($mothers); $mother_status = $mother['STATUS']; } else { $mother_string = ''; $mother_status = 0; } if ($person['CHINAHOUSE_ID'] != 0) { $chinahouses = get_chinahouse_data($person['CHINAHOUSE_ID']); $chinahouse = mysql_fetch_assoc($chinahouses); // print_r($chinahouse); $chinahouse_name = $chinahouse['CHINAHOUSE_NAME']; $chinahouse_tel = $chinahouse['CHINAHOUSE_TEL']; $chinahouse_link = $chinahouse['CHINAHOUSE_LINK']; if ($chinahouse['CHINAHOUSE_VILLAGE_ID'] == 0) { $chinahouse_village_string = '';
<?php error_reporting(E_ERROR | E_PARSE); include '../../helper/db_connect.php'; connect_database(); $id = $_GET['id']; $parent_id = $_GET['p_id']; $childs = get_person_detial($parent_id); $child = mysql_fetch_assoc($childs); print_r($child); if ($child['MOTHER_ID'] == $id) { $type = "MOTHER_ID"; } else { if ($child['PARENT_ID'] == $id) { $type = "PARENT_ID"; } } del_child($parent_id, $type); echo "<script type='text/javascript'>"; echo "window.history.back();"; echo "</script>";
?> <?php if ($person['PARENT_ID'] == 0) { ?> <div class="col-xs-6 col-xs-offset-2"> <h5 class="text-danger">ไม่พบข้อมูลบิดา กรุณากดปุ่มเพิ่มข้อมูลบิดา</h5> </div> <div class="col-xs-4 "> <a class="btn btn-material-orange" role="button" style="margin-top: 0px" onClick="javascript:window.open('add_parent_form.php?id=<?php echo $id; ?> ', '', 'nenuber=no,toorlbar=no,location=no,scrollbars=no, status=no,resizable=no,width=800,height=225,top=200,left=200 ')">เพิ่มข้อมูลบิดา</a> </div> <?php } else { $parents = get_person_detial($person['PARENT_ID']); $parent = mysql_fetch_assoc($parents); ?> <div class="col-xs-2"> <h5>ชื่อ-นามสกุล บิดา</h5> </div> <div class="col-xs-4"> <h5> <?php echo get_person_title_string($parent['TITLE_ID']) . ' ' . get_person_name_string($person['PARENT_ID']) . ' ' . get_person_surname_string($person['PARENT_ID']); ?> </h5> </div> <div class="col-xs-4 col-xs-offset-2"> <h5>
include '../../helper/helper.php'; connect_database(); $persons = get_person_detial($id); $person = mysql_fetch_assoc($persons); // print_r($person); if ($person["GENERATION_ID"] == 0) { if ($person["PARENT_ID"] != 0) { $parents = get_person_detial($person["PARENT_ID"]); $parent = mysql_fetch_assoc($parents); if ($parent["GENERATION_ID"] != 0) { $person["GENERATION_ID"] = $parent["GENERATION_ID"] + 1; // echo $person["GENERATION_ID"]; } } else { if ($person["MOTHER_ID"] != 0) { $mothers = get_person_detial($person["MOTHER_ID"]); $mother = mysql_fetch_assoc($mothers); if ($mother["GENERATION_ID"] != 0) { $person["GENERATION_ID"] = $mother["GENERATION_ID"] + 1; // echo $person["GENERATION_ID"]; } } } } ?> <div class="row"> <h1>แก้ไขข้อมูลส่วนตัว <?php //if($person['TITLE_ID'] != 0) // echo get_person_title_string($person['TITLE_ID']) . ' ' . $person['NAME'] . ' ' . $person['SURNAME']; // else
function check_chinahouse($person) { if ($person['CHINAHOUSE_ID'] != 0) { return $person['CHINAHOUSE_ID']; } else { if ($person['PARENT_ID'] == 0 && $person['BROTHER_LIST'] == '') { return 0; } else { if ($person['PARENT_ID'] != 0) { $parent_id = $person['PARENT_ID']; $parents = get_person_detial($parent_id); $parent = mysql_fetch_assoc($parents); if ($parent['CHINAHOUSE_ID'] == 0) { $brothers = get_person_brother($person['PARENT_ID'], $person['BROTHER_LIST'], $person['ID']); while ($brother = mysql_fetch_assoc($brothers)) { if ($brother['CHINAHOUSE_ID'] != 0) { return $brother['CHINAHOUSE_ID']; } } if ($parent['PARENT_ID'] == 0 && $parent['BROTHER_LIST'] == '') { return 0; } else { return 1; } } else { return $parent['CHINAHOUSE_ID']; } } else { $has_parent = false; $brothers = get_person_brother($person['PARENT_ID'], $person['BROTHER_LIST'], $person['ID']); while ($brother = mysql_fetch_assoc($brothers)) { if ($brother['PARENT_ID'] != 0) { $has_parent = true; add_parent_id($person['ID'], $brother['PARENT_ID']); } if ($brother['CHINAHOUSE_ID'] != 0) { return $brother['CHINAHOUSE_ID']; } } if ($has_parent) { return 1; } else { return 0; } } } } }
$brother_list .= "{$namebro3_id},"; array_push($brother_array, $namebro3_id); $has_brother = true; } if (isset($_POST["namebro4"]) && !empty($_POST["namebro4"])) { $iparr = split("\\ ", $_POST["namebro4"]); $namebro4_name = $iparr[0]; $namebro4_surname = $iparr[1]; $bro4_bday = $_POST["bro4_bday"]; $bro4_status = $_POST["bro4_status"]; $namebro4_id = add_person($namebro4_name, $namebro4_surname, $bro4_bday, $bro4_status, '', '', ''); $brother_list .= "{$namebro4_id},"; array_push($brother_array, $namebro4_id); $has_brother = true; } $parents = get_person_detial($parent_id); $parent = mysql_fetch_array($parents); // echo $parent_id;s if ($has_brother) { if ($parent_id != 0) { echo "123"; foreach ($brother_array as $brother_id) { add_parent($brother_id, $parent_id, $parent['STATUS']); } } else { echo "qwe"; add_brother_array($brother_array); // add_brother_list($brother_list); } } //-------------------------------------add chlid--------------------------------------------//
echo "window.location.assign('../view/chinaaddr.php?id={$id}')"; echo "</script>"; } } $index = 1; $gen_id = 0; $loop_id = $parent['ID']; while (1) { $loop_parents = get_person_detial($loop_id); $loop_parent = mysql_fetch_assoc($loop_parents); $chinahouse_id = check_chinahouse($loop_parent); if ($chinahouse_id == 0) { break; } else { if ($chinahouse_id == 1) { $loop_parents = get_person_detial($loop_id); $loop_parent = mysql_fetch_assoc($loop_parents); $loop_id = $loop_parent['PARENT_ID']; } else { add_chinahouse($chinahouse_id, $brother['CHINAHOUSE_ID']); echo "<script type='text/javascript'>"; echo "window.location.assign('../view/chinaaddr.php?id={$id}')"; echo "</script>"; } } } echo "<script type='text/javascript'>"; echo '$(document).ready(function() {' . 'swal({title: "ข้อมูลไม่เพียงพอ บิดาไม่ได้ระบุที่อยู่บรรพบุรุษที่ประเทศจีน",' . 'type: "warning",' . 'showCancelButton: true,' . 'confirmButtonColor: "#DD6B55",' . 'confirmButtonText: "เพื่มข้อมูลที่อยู่บรรพบุรุษที่ประเทศจีนด้วยมือ",' . 'closeOnConfirm: false, closeOnCancel: false},' . 'function(isConfirm) {' . 'if (isConfirm) {' . 'window.location.assign("../view/add_chinahouse.php?id=' . $id . '&gen_id=");' . '}else {window.location.assign("../view/ancestorsaddr.php");}' . '});});'; echo "</script>"; } else { add_chinahouse($id, $parent['CHINAHOUSE_ID']);
function del_brother($id, $brother_id) { $persons = get_person_detial($id); $person = mysql_fetch_assoc($persons); $brother_array = explode(",", $person['BROTHER_LIST']); array_pop($brother_array); $key = array_search($brother_id, $brother_array); if ($key !== false) { unset($brother_array[$key]); } $brother_list = implode(",", $brother_array); $brother_list .= ","; foreach ($brother_array as $value) { $sql = "UPDATE person SET BROTHER_LIST = '{$brother_list}' WHERE ID = {$value}"; // echo $sql; mysql_query($sql); set_updatetime($value); } clear_brother_list($brother_id); }