File: /home/barbeatleanalyti/www/manage.beatleanalytics.com/site/template 19-3-2018 1_10/users.php
<?php
// Declare new object
$objUsers = object;
// Assing object
$objUsers = $objDB->objController;
// Assign all variable's value
$pg = $objUsers->pg;
$acn = $objUsers->acn;
$v = $objUsers->v;
$State = $objUsers->State;
$ReligionName = $objUsers->ReligionName;
$sort = $objUsers->sort;
$ReligionID = $objUsers->ReligionID;
$field = $objUsers->field;
$error = $objUsers->error;
$msg = $objUsers->msg;
$perpage = $objUsers->perpage;
$start = $objUsers->start;
$limit = $objUsers->limit;
$SearchValue = $objUsers->SearchValue;
$s = $objUsers->s;
$OrgID = $objCustomer->OrgID;
$BranchID = $objCustomer->BranchID;
$IndustryID = $objCustomer->IndustryID;
$rsUserInfo = $objUsers->FetchAllUsersData("All");
if($start == 1)
$limit = 0;
else if($start == 2)
$limit = $perpage;
else
$limit = ($start-1) * $perpage;
$objUsers->limit = $limit;
$nume = count($rsUserInfo);
$totalpage = @ceil(count($rsUserInfo)/$perpage);
$rsUserInfo = $objUsers->FetchAllUsersData();
if($sort == '0'){
$sort = '1';
}
else{
$sort = '0';
}
$link = "";
if( $start != "" && $start != 0 ){
$link .= "&start={$start}";
}
if( $perpage != "" && $perpage != 0 ){
$link .= "&perpage={$perpage}";
}
if(trim($s) != ""){
$link .= "&s={$s}";
}
$Dash = "";
if($_SESSION['UserInfo']['UType'] == 'MasterAdmin'){
$Dash = "dashboardma";
}else if($_SESSION['UserInfo']['UType'] == 'Admin'){
$Dash = "dashboardadmin";
}
?>
<div class="content-wrapper" style="height: 959px">
<?php
if( strtolower($v)=='add'|| strtolower($v)=='edit')
{}
else if($v=='list'){
?>
<section class="content-header">
<?php if(strtolower($v) == 'list'){?>
<h1> List of users </h1>
<ol class="breadcrumb">
<li><a href="index.html"><i class="fa fa-home"></i> Home</a></li>
<li><a href="users.html?v=list"><i class="fa users"></i>Users</a></li>
<li class="active">Users List</li>
</ol>
<?php } ?>
</section>
<?php
// Error or success message display
$objDB->NotificaitonForResult($msg,$error)
?>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header">
<div class="col-md-12 col-xs-12 no-padding">
<div class="row">
<div class="col-md-12">
<form method="post" action="users.html" name="frmSearch" id="frmSearch">
<input type="hidden" name="start" id="start" value="<?php echo $start?>" />
<input type="hidden" name="perpage" id="perpage" value="<?php echo $perpage?>" />
<div class="col-md-1 col-xs-3 col-sm-2 col-lg-1 pull-left form-group no-padding ">
<a class="btn btn-info btn-sm" href="<?php echo $Dash; ?>.html"> <i class="fa fa-long-arrow-left"></i> Back </a>
</div>
<div class="col-md-3 col-xs-12 col-lg-2 form-group">
<?php $rsOrganization = $objUsers->fetchOrganization(); ?>
<!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
<select class="form-control input-md" id="org_list" onchange="javascript: getBranchData(this.value)" name="Organization">
<option value="0">Select Organization</option>
<?php if(count($rsOrganization) > 0) { ?>
<option style="font-weight:bold;" <?php if(!empty($OrgID)) echo 'selected="selected"'; ?> value="<?php echo $rsOrganization[0]['OrgId']?>"><?php echo $rsOrganization[0]['db_Orgname']?></option>
<?php }else{ ?>
<option value="0">No any org. found</option>
<?php } ?>
</select>
<!--</span>-->
</div>
<script>
function getBranchData(orgid){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
document.getElementById("branch_list").innerHTML = xhttp.responseText;
}
};
xhttp.open("GET", "runajax.php?acn=FetchBranchDetails&orgid="+orgid, true);
xhttp.send();
}
function FetchIndustryDetails(branchid){
var xhttpI = new XMLHttpRequest();
xhttpI.onreadystatechange = function() {
if (xhttpI.readyState == 4 && xhttpI.status == 200) {
document.getElementById("industry_list").innerHTML = xhttpI.responseText;
}
};
xhttpI.open("GET", "runajax.php?acn=FetchIndustryDetails&branchid="+branchid, true);
xhttpI.send();
}
</script>
<div class="col-md-3 col-xs-12 col-lg-2 form-group" id="branch_list" >
<?php $rsBranches = $objUsers->fetchBranches(); ?>
<!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
<select class="form-control input-md" name="Branches">
<option value="0"> Select Branch </option>
<?php if(count($rsBranches) > 0) { for($b=0; $b<count($rsBranches); $b++) { ?>
<option <?php if($BranchID === $rsBranches[$b]['branchId']) echo 'selected="selected"'; ?> value="<?php echo $rsBranches[$b]['branchId']?>"><?php echo $rsBranches[$b]['db_branchName']?></option>
<?php }
}else{ ?>
<option value="0">No any branch found</option>
<?php } ?>
</select>
<!--</span>-->
</div>
<div class="col-md-2 col-xs-12 col-lg-2 form-group" id="industry_list">
<!--<span id="span_select" style="width:120px; height:35px; float:right;">-->
<?php $rsIndustrys = $objUsers->fetchIndustrys($OrgID,$BranchID,$IndustryID); ?>
<select class="form-control input-md" id="state_list" name="Industrys">
<option value="0"> Select Industry </option>
<?php if(count($rsIndustrys) > 0) { for($b=0; $b<count($rsIndustrys); $b++) { ?>
<option <?php if($IndustryID === $rsIndustrys[$b]['IndId']) echo 'selected="selected"'; ?> value="<?php echo $rsIndustrys[$b]['IndId']?>"><?php echo $rsIndustrys[$b]['db_industry']?></option>
<?php }
}else{ ?>
<option value="0">No any ind. found</option>
<?php } ?>
</select>
<!--</span>-->
</div>
<div class=" col-xs-6 col-sm-3 col-md-1 col-lg-1 pull-right text-right">
<div class="input-group input-group-sm">
<!--<input type="text" id="s" name="s" placeholder="Search content here .." class="form-control" value=""> -->
<span class="input-group-btn">
<button class="btn btn-block btn-success btn-md " type="submit"><i class="fa fa-search" aria-hidden="true"></i>Search
</button>
</span>
</div>
</div>
<div class=" col-xs-6 col-sm-2 col-md-1 col-lg-1 pull-right text-right form-group no-padding">
<a class="btn btn-sm btn-danger" href="users.html"> <i class="fa fa-refresh"></i> Reset </a> </div>
<!--<div class="col-md-2 col-xs-6 col-sm-4 form-group "><a class="btn btn-sm btn-success col-xs-12" href="users.html?v=add"> <i class="fa fa-plus"></i> Add Religions </a>
</div> -->
<!--<div class="form-group col-md-3 pull-right col-sm-4 col-xs-12 no-padding">
<div class="input-group input-group-sm">
<input type="text" id="s" name="s" placeholder="Search content here .." class="form-control" value="<?php echo $s ?>" >
<span class="input-group-btn">
<button class="btn btn-info btn-flat" type="submit">Search!</button>
</span>
</div>
</div> -->
</form>
</div>
</div>
<div class="row">
<?php
if(count($rsUserInfo) > 0 ) {
?>
<?php echo pagination_log($s,$perpage,$start,$nume,$totalpage,$pg,$v); ?>
<?php
}
?>
<!-------List of users----->
<div class="customers-list">
<div class="">
<div class="col-md-12">
<div class="table-responsive panel-default">
<table class="table table-fixed">
<thead>
<tr class="table-heder">
<th class="col-sm-1 text-center">Sr.No.</th>
<th class="col-sm-1 text-center">User ID</th>
<th class="col-sm-2 text-center"><!--<a href="users.html?sort=<?=$sort?>&field=Religion_Name<?php echo $link?>">Name</a> <span> <a href="users.html?sort=<?=$sort?>&field=Religion_Name" > <?php if($field == 'Religion_Name' ) {
if($sort == 0){
echo '<i class="fa fa-sort-asc"></i>';
}else{
echo '<i class="fa fa-sort-desc"></i>';
}
} else { echo '<i class="fa fa-sort"></i>'; } ?> </a> </span> --> Name </th>
<th class="col-sm-2 text-center">Type</th>
<th class="col-sm-2 text-center">Organization</th>
<th class="col-sm-2 text-center">Branch</th>
<th class="col-sm-2 text-center">Industry</th>
</tr>
</thead>
<?php
if(count($rsUserInfo)>0){
for ($i=0;$i< count($rsUserInfo);$i++)
{
if($i%2)
$bgclass='altrow';
else
$bgclass='oddrow';
?>
<tr class="<?php echo $bgclass;?>" >
<td class="col-sm-1 text-center"><label name="No"><?php echo $i+1; ?></label></td>
<td class="col-sm-1 text-center"><label name="User ID"><?php echo $rsUserInfo[$i]['userId'];?></label></td>
<td class="col-sm-2 text-center"><label name="User name"><?php echo $rsUserInfo[$i]['db_username']; ?></label></td>
<td class="col-sm-2 text-center"><label name="User type"><?php echo $rsUserInfo[$i]['db_usertype']; ?></label></td>
<td class="col-sm-2 text-center"><label name="Organization Name"><?php echo $objUsers->FetchOrganizationName($rsUserInfo[$i]['OrgID']); ?></label></td>
<td class="col-sm-2 text-center"><label name="Branch Name"><?php echo $objUsers->FetchBranchName($rsUserInfo[$i]['BranchID']); ?></label></td>
<td class="col-sm-2 text-center"><label name="Industry Name"><?php echo $objUsers->FetchIndustryName($rsUserInfo[$i]['IndustryID']); ?></label></td>
</tr>
<?php }
}else{
?>
<tr class="altrow" > <td colspan="9" align="center"> </td> </tr>
<tr class="oddrow"> <td colspan="9" align="center"> No any record found. </td> </tr>
<tr class="altrow" > <td colspan="9" align="center"> </td> </tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<style>
.customers-list .table-fixed tr:nth-child(even){background-color: #c7dae5; width: 100%; float: left;}
.customers-list .table-fixed thead { width: 100%;}
.customers-list .table-fixed tbody { max-height: 642px; height:auto; overflow-y: auto; width: 100%;}
.customers-list .table-fixed thead, .table-fixed tbody, .customers-list .table-fixed tr, .table-fixed td, .customers-list .table-fixed th {display: block;}
.customers-list .table-fixed tbody td, .customers-list .table-fixed thead > tr> th { float: left; border-bottom-width: 0;}
.customers-list { width: 100%; float: left;}
.customers-list td.col-xs-2.text-center { font-size: 17px;}
.customers-list tr.table-heder { width: 100%; float: left; background: linear-gradient(#3c8dbc, #f2f2f2);}
.customers-list .panel-default { border: 2px solid #3c8dbc;border-radius: 5px !IMPORTANT;}
.customers-list { margin-bottom: 25px;}
</style>
</div>
<!------//-List of users-------->
<!---- <div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th class="text-center">Sr.No.</th>
<th class="text-center">User ID</th>
<th class="text-center"><!--<a href="users.html?sort=<?=$sort?>&field=Religion_Name<?php echo $link?>">Name</a> <span> <a href="users.html?sort=<?=$sort?>&field=Religion_Name" > <?php if($field == 'Religion_Name' ) {
if($sort == 0){
echo '<i class="fa fa-sort-asc"></i>';
}else{
echo '<i class="fa fa-sort-desc"></i>';
}
} else { echo '<i class="fa fa-sort"></i>'; } ?> </a> </span> --> <!--Name </th>
<th class="text-center">Type</th>
<th class="text-center">Organization</th>
<th class="text-center">Branch</th>
<th class="text-center">Industry</th>
</tr>
<?php
if(count($rsUserInfo)>0){
for ($i=0;$i< count($rsUserInfo);$i++)
{
if($i%2)
$bgclass='altrow';
else
$bgclass='oddrow';
?>
<tr class="<?php echo $bgclass;?>" >
<td class="text-center"><label name="No"><?php echo $i+1; ?></label></td>
<td class="text-center"><label name="User ID"><?php echo $rsUserInfo[$i]['userId'];?></label></td>
<td class="text-center"><label name="User name"><?php echo $rsUserInfo[$i]['db_username']; ?></label></td>
<td class="text-center"><label name="User type"><?php echo $rsUserInfo[$i]['db_usertype']; ?></label></td>
<td class="text-center"><label name="Organization Name"><?php echo $objUsers->FetchOrganizationName($rsUserInfo[$i]['OrgID']); ?></label></td>
<td class="text-center"><label name="Branch Name"><?php echo $objUsers->FetchBranchName($rsUserInfo[$i]['BranchID']); ?></label></td>
<td class="text-center"><label name="Industry Name"><?php echo $objUsers->FetchIndustryName($rsUserInfo[$i]['IndustryID']); ?></label></td>
</tr>
<?php }
}else{
?>
<tr class="altrow" > <td colspan="9" align="center"> </td> </tr>
<tr class="oddrow"> <td colspan="9" align="center"> No any record found. </td> </tr>
<tr class="altrow" > <td colspan="9" align="center"> </td> </tr>
<?php } ?>
</tbody>
</table>
</div>
</div>---->
<?php
if(count($rsUserInfo) > 0 ) {
?>
<?php echo pagination_log($s,$perpage,$start,$nume,$totalpage,$pg,$v); ?>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<? } ?>
</section>
</div>