| Current Path : /home2/wtmwscom/www/member/ |
| Current File : /home2/wtmwscom/www/member/tree_view1.php |
<?php
$title = "Tree View";
include 'header.php';
$plan_package = array(0 => "Free", 1 => "Rs. 5,750", 2 => "Rs. 11,500", 3 => "Rs. 28,750", 4 => "Rs. 57,500", 5 => "Rs. 1,15,500",);
if (isset($_GET['login_id'])) {
$user_id = mysqli_fetch_object(mysqli_query($connection, "SELECT uid FROM user WHERE login_id='" . $_GET['login_id'] . "'"))->uid;
if ($user_id) {
redirect('tree_view.php?no=' . $user_id);
} else {
redirect('tree_view.php');
die();
}
}
$child_ids = get_child_ids($_SESSION['userid']);
$uids = '';
foreach ($child_ids as $key => $level) {
foreach ($level as $key => $value) {
$uids[] = $value;
}
}
if (isset($_GET['no'])) {
$down = array_search($_GET['no'], $uids);
if (!$down) {
redirect('tree_view.php');
die();
}
}
$uid = !empty($_GET['no']) ? $_GET['no'] : $_SESSION['userid'];
$row1 = mysqli_fetch_object(mysqli_query($connection, "SELECT uid, login_id, name, reg_date, position, type, status, plan_type, is_paid FROM user WHERE uid = '$uid'"));
$result = mysqli_query($connection, "SELECT uid, login_id, name, reg_date, mobile, position, type, status, plan_type, is_paid FROM user WHERE placement_id = '$uid'");
?>
<script>
$(function() {
$(document).tooltip({
position: {
my: "center bottom-20",
at: "center top",
using: function(position, feedback) {
$(this).css(position);
$("<div>")
.addClass("arrow")
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});
});
</script>
<style>
.ui-tooltip, .arrow:after {
background: #45aed6;
border: 2px solid white;
}
.ui-tooltip {
padding: 10px 20px;
color: white;
border-radius: 20px;
font: bold 14px "Helvetica Neue", Sans-Serif;
text-transform: uppercase;
box-shadow: 0 0 7px black;
}
.arrow {
width: 70px;
height: 16px;
overflow: hidden;
position: absolute;
left: 50%;
margin-left: -35px;
bottom: -16px;
}
.arrow.top {
top: -16px;
bottom: auto;
}
.arrow.left {
left: 20%;
}
.arrow:after {
content: "";
position: absolute;
left: 20px;
top: -20px;
width: 25px;
height: 25px;
box-shadow: 6px 5px 9px -9px black;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.arrow.top:after {
bottom: -20px;
top: auto;
}
</style>
<style type="text/css">
.child{
}
.child span {
text-align: center;
margin-top: -26px;
width: 450px;
}
.user {
margin-bottom: 10px;
margin-top: 10px;
}
</style>
<h1>Team View</h1>
<section id="comments" style="float: left; width: 50%;">
<form action="" method="get">
<p>
<input type="text" name="login_id" placeholder="Search by User Id" style="text-align: left;" /><input style="position: relative; left: 20px;" type="submit" id="submit" value="Search">
</p>
</form>
</section>
<section style="float: right; width: 50%;">
<table>
<thead>
<tr>
<th>Register</th>
<th>Org 1</th>
<th>Org 2</th>
</tr>
</thead>
<tbody>
<?php
$left_count_array = get_count_child_ids_by_paid($uid, 'L');
$right_count_array = get_count_child_ids_by_paid($uid, 'R');
$child_ids_left = get_child_ids_2($uid, "L");
$child_ids_right = get_child_ids_2($uid, "R");
$uids_left = '';
$uids_right = '';
foreach ($child_ids_left as $key => $level) {
foreach ($level as $key => $value) {
if ($uids_left == '') {
$uids_left = $value;
} else {
$uids_left .= ', ' . $value;
}
}
}
foreach ($child_ids_right as $key => $level) {
foreach ($level as $key => $value) {
if ($uids_right == '') {
$uids_right = $value;
} else {
$uids_right .= ', ' . $value;
}
}
}
?>
<!-- <tr class="light">
<td>Green</td>
<td><?php echo $left_count_array['count_paid'] . ' Members'; ?></td>
<td><?php echo $right_count_array['count_paid'] . ' Members'; ?></td>
</tr>
<tr class="dark">
<td>Red</td>
<td><?php echo $left_count_array['count_unpaid'] . ' Members'; ?></td>
<td><?php echo $right_count_array['count_unpaid'] . ' Members'; ?></td>
</tr>-->
<tr class="light">
<td>Total</td>
<td><?php echo $left_count_array['count_paid'] + $left_count_array['count_unpaid'] . ' Members'; ?></td>
<td><?php echo $right_count_array['count_paid'] + $right_count_array['count_unpaid'] . ' Members'; ?></td>
</tr>
<!-- <tr class="dark">
<td>Current B.V.</td>
<td><?php
//$current_bv = mysqli_fetch_object(mysqli_query($connection, "SELECT SUM(pv_amount) as amount_left, SUM(amount_right) as amount_right FROM `product_sale` WHERE uid='$uid' AND date >= (SELECT closing_date FROM closing_date WHERE status=1 ORDER BY closing_date DESC LIMIT 1)"));
//echo get_current_bv_income($uids_left);
?></td>
<td><?php //echo get_current_bv_income($uids_right); ?></td>
</tr>-->
<tr class="dark">
<td>Total B.V.</td>
<td><?php
// $total_bv = mysqli_fetch_object(mysqli_query($connection, "SELECT SUM(pv_amount) as amount_left, SUM(amount_right) as amount_right FROM `product_sale` WHERE uid='$uid' AND date < (SELECT closing_date FROM closing_date WHERE status=1 ORDER BY closing_date DESC LIMIT 1)"));
echo get_total_bv_income($uids_left);
?></td>
<td><?php echo get_total_bv_income($uids_right); ?></td>
</tr>
<tr class="light">
<td>Current B.V.</td>
<td><?php
// $total_bv = mysqli_fetch_object(mysqli_query($connection, "SELECT SUM(pv_amount) as amount_left, SUM(amount_right) as amount_right FROM `product_sale` WHERE uid='$uid' AND date < (SELECT closing_date FROM closing_date WHERE status=1 ORDER BY closing_date DESC LIMIT 1)"));
echo get_current_bv_income($uids_left);
?></td>
<td><?php echo get_current_bv_income($uids_right); ?></td>
</tr>
</tbody>
</table>
</section>
<section style="clear: both;"></section>
<section>
<div align="center">
<div class="user">
<a href="tree_view.php?no=<?php echo $uid; ?>" title="<?php echo $plan_package[$row1->plan_type] ?>, User Id: <?php echo $row1->login_id; ?>, <?php //echo $row1->name; ?>, DOJ: <?php echo date("d-m-Y H:i A", strtotime($row1->reg_date)) ?> , Left:<?php echo get_count_child_ids($uid, 'L'); ?>, Org2: <?php echo get_count_child_ids($uid, 'R'); ?>"><br />
<?php echo $row1->login_id; ?><br />
<img src="images/<?php echo $row1->is_paid == 1 ? "user_2.png" : "user_4.png" ?>" />
</a>
</div>
<img src="images/line.png" width="450" />
</div>
<?php
function getTree($id) {
$result2 = mysqli_query($connection, "SELECT uid, login_id, name, reg_date, mobile, position, status, plan_type, is_paid FROM user WHERE placement_id = '$id'");
global $plan_package;
?>
<div><img src="images/line.png" width="228" /></div>
<?php
if (mysqli_num_rows($result2) == 2) {
while ($row2 = mysqli_fetch_object($result2)) {
if ($row2->position == 'L') {
$style2 = "float: left; width: 225px;";
} elseif ($row2->position == 'R') {
$style2 = "float: right; width: 225px;";
}
?>
<span style="<?php echo $style2; ?>">
<div class="user">
<a href="tree_view.php?no=<?php echo $row2->uid; ?>" title="<?php echo $plan_package[$row2->plan_type] ?>, User Id: <?php echo $row2->login_id; ?>, <?php //echo $row2->name ?>, DOJ: <?php echo date("d-m-Y H:i A", strtotime($row2->reg_date)) ?> , Org1:<?php echo get_count_child_ids($row2->uid, 'L'); ?>, Org2: <?php echo get_count_child_ids($row2->uid, 'R'); ?>"><br />
<?php echo $row2->login_id ; ?><br />
<img src="images/<?php echo $row2->is_paid == 1 ? "user_2.png" : "user_4.png" ?>" />
</a>
</div>
</span>
<?php
}
} elseif (mysqli_num_rows($result2) == 1) {
while ($row2 = mysqli_fetch_object($result2)) {
if ($row2->position == 'L') {
$style2 = "float: left; width: 225px;";
$style4 = "float: right; width: 225px;";
$position = 'R';
} elseif ($row2->position == 'R') {
$style2 = "float: right; width: 225px;";
$style4 = "float: left; width: 225px;";
$position = 'L';
}
?>
<span style="<?php echo $style2; ?>">
<div class="user">
<a href="tree_view.php?no=<?php echo $row2->uid; ?>" title="<?php echo $plan_package[$row2->plan_type] ?>, User Id: <?php echo $row2->login_id; ?>, <?php //echo $row2->name ?>, DOJ: <?php echo date("d-m-Y H:i A", strtotime($row2->reg_date)) ?> , Org1:<?php echo get_count_child_ids($row2->uid, 'L'); ?>, Org2: <?php echo get_count_child_ids($row2->uid, 'R'); ?>"><br />
<?php echo $row2->login_id ; ?><br />
<img src="images/<?php echo $row2->is_paid == 1 ? "user_2.png" : "user_4.png" ?>" />
</a>
</div>
</span>
<span style="<?php echo $style4; ?>">
<div class="user">
<a href="tree_register.php?placement_id=<?php echo $id; ?>&&position=<?php echo $position; ?>" target="_blank" title="Add Member"><br />
Add New Member<br />
<img src="images/new_user.png" />
</a>
</div>
</span>
<?php
}
} else {
?>
<span style="float: left; width: 225px;">
<div class="user">
<a href="tree_register.php?placement_id=<?php echo $id; ?>&&position=L" target="_blank" title="Add Member"><br />
Add New Member<br />
<img src="images/new_user.png" />
</a>
</div>
</span>
<span style="float: right; width: 225px;">
<div class="user">
<a href="tree_register.php?placement_id=<?php echo $id; ?>&&position=R" target="_blank" title="Add Member"><br />
Add New Member<br />
<img src="images/new_user.png" />
</a>
</div>
</span>
<?php
}
}
?>
<div class="child">
<?php
if (mysqli_num_rows($result) == 2) {
$i = 1;
while ($row = mysqli_fetch_object($result)) {
if ($row->position == 'L') {
$style = "float: left;";
} elseif ($row->position == 'R') {
$style = "float: right;";
}
?>
<span style="<?php echo $style; ?>">
<div class="user">
<a href="tree_view.php?no=<?php echo $row->uid; ?>" title="<?php echo $plan_package[$row->plan_type] ?>, User Id: <?php echo $row->login_id; ?>, <?php //echo $row->name ?>, DOJ: <?php echo date("d-m-Y H:i A", strtotime($row->reg_date)) ?> , Org1:<?php echo get_count_child_ids($row->uid, 'L'); ?>, Org2: <?php echo get_count_child_ids($row->uid, 'R'); ?>"><br />
<?php echo $row->login_id ; ?><br />
<img src="images/<?php echo $row->is_paid == 1 ? "user_2.png" : "user_4.png" ?>" />
</a>
</div>
<?php if ($i <= 2) {
getTree($row->uid);
} ?>
<div style="clear: both;"></div>
</span>
<?php
$i++;
}
} elseif (mysqli_num_rows($result) == 1) {
$i = 1;
while ($row = mysqli_fetch_object($result)) {
if ($row->position == 'L') {
$style = "float: left;";
$style3 = "float: right;";
$position = 'R';
} elseif ($row->position == 'R') {
$style = "float: right;";
$style3 = "float: left;";
$position = 'L';
}
?>
<span style="<?php echo $style; ?>">
<div class="user">
<a href="tree_view.php?no=<?php echo $row->uid; ?>" title="<?php echo $plan_package[$row->plan_type] ?>, User Id: <?php echo $row->login_id; ?>, <?php //echo $row->name ?>, DOJ: <?php echo date("d-m-Y H:i A", strtotime($row->reg_date)) ?> , Org1:<?php echo get_count_child_ids($row->uid, 'L'); ?>, Org2: <?php echo get_count_child_ids($row->uid, 'R'); ?>"><br />
<?php echo $row->login_id ; ?><br />
<img src="images/<?php echo $row->is_paid == 1 ? "user_2.png" : "user_4.png" ?>" />
</a>
</div>
<?php if ($i <= 2) {
getTree($row->uid);
} ?>
<div style="clear: both;"></div>
</span>
<span style="<?php echo $style3; ?>">
<div class="user">
<a href="tree_register.php?placement_id=<?php echo $uid; ?>&&position=<?php echo $position; ?>" target="_blank" title="Add Member"><br />
Add New Member<br />
<img src="images/new_user.png" />
</a>
</div>
<div style="clear: both;"></div>
</span>
<?php
$i++;
}
} else {
?>
<span style="float: left;">
<div class="user">
<a href="tree_register.php?placement_id=<?php echo $uid; ?>&&position=L" target="_blank" title="Add Member"><br />
Add New Member<br />
<img src="images/new_user.png" />
</a>
</div>
<div style="clear: both;"></div>
</span>
<span style="float: right;">
<div class="user">
<a href="tree_register.php?placement_id=<?php echo $uid; ?>&&position=R" target="_blank" title="Add Member"><br />
Add New Member<br />
<img src="images/new_user.png" />
</a>
</div>
<div style="clear: both;"></div>
</span>
<?php
}
?>
</div>
</section>
<?php include 'footer.php'; ?>