-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathget_org_data.php
38 lines (28 loc) · 949 Bytes
/
get_org_data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include "chech_restricted.php";
require "settings/database.class.php";
if(isset($_POST['data_type'])){
$dataType = $_POST["data_type"];
$db_ = new Database("formbuilder");
$conn = $db_->getConnection();
$sql = "SELECT * FROM organization_tree";
if($result = $conn->query($sql)) {
$count = mysqli_num_rows($result);
if($count > 0){
$params_row = array();
while($row = mysqli_fetch_assoc($result)){
$data_obj = new stdClass();
$data_obj->id = $row['id'];
$data_obj->name = $row["name"];
$data_obj->parent = $row["parent_id"];
$data_obj->mngr = $row["dep_mngr_user_id"];
$params_row[] = $data_obj;
}
echo json_encode($params_row);
}
}
}
?>