<?php
include('nav.php'); ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css">
</head>
<body>
<div class="container">
<div class="card card-containerAdminpage" >
<h3 style="font-weight:700; background:#127185;font-size:21px;color:#fff;padding-top: 4px;padding-bottom: 4px;padding-left: 20px;padding-right: 20px;">Gallery Admin</h3><br/>
<?php
//print_r($user_list); //this print assosiative array ?>
<div class="row">
<div class="col-md-2">
<h4>Select User :</h4>
</div>
<div class="col-md-4">
<?php
// $js = 'id="Ultra" onChange="run();"';
$js = 'id="userdropdown" class="form-control"';
//echo form_dropdown('username', $user_list,'',$js);
echo form_dropdown('username',array('0' => 'Please select User') + $user_list,'',$js);
//echo form_dropdown('username', $user_list,'id="username"');
?>
</div>
<div class="col-md-2">
</div>
<div class="col-md-2">
<!-- in use
<input type="button" class="btn btn-primary" value="Display Gallery" name="dispalygallery"
id="displaygallery" />
-->
<!-- not use
<input type="button" class="btn btn-primary" value="Display Gallery" name="dispalygallery"
onClick="getData()" id="dispalygallery" />
-->
</div>
<div class="col-md-2">
<a href="<?php echo site_url('admin_cont/gallery_controller/createGallery'); ?>"><input class="btn btn-primary" type="button" value="Create Gallery" name="addUser" /></a>
</div>
</div>
<br>
<?php echo $ui="<input type='hidden' name='userid' id='texthide' />" ; //this is imporatant pass userid to controller
?>
<div id="divjsondata" class="table-responsive"></div>
<div class="row" id="divcreategallery">
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
// Ajax post for Display Gallery
$(document).ready(function() {
$("#userdropdown").on('change',function(event) {
//var user_id = document.getElementById("userdropdown").value;
//alert(user_id);
event.preventDefault();
var user_id = document.getElementById("userdropdown").value;
jQuery.ajax({
type: "POST",
url: "<?php echo base_url(); ?>" + "admin_cont/gallery_controller/user_userdata",
dataType: 'json',
data: {userid: user_id},
success: function(res) {
//console.log( res );
var html = "<table class='table table-striped table-bordered table-hover' id='example'>";
html += "<thead>";
html += "<tr style='color:#127185;'>";
html += "<th>#</th>";
html += "<th>Gallery Name</th>";
html += "<th>Event Date</th>";
html += "<th>Total Photo</th>";
html += "<th>Selected Photo</th>";
html += "<th>Gallery lock</th>";
html += "<th>Edit</th>";
html += "<th>Manage</th>";
html += "<tr>";
html += "</thead>";
html += "<tfoot>";
html += "<tr style='color:#127185;'>";
html += "<th>#</th>";
html += "<th>Gallery Name</th>";
html += "<th>Event Date</th>";
html += "<th>Total Photo</th>";
html += "<th>Selected Photo</th>";
html += "<th>Gallery lock</th>";
html += "<th>Edit</th>";
html += "<th>Manage</th>";
html += "<tr>";
html += "</tfoot>";
html += "<tbody>";
if(user_id == 0){
"<br/>";
html += "<tr>";
html += "<td colspan='7' align='center' ><span style='color:blue'><b>" + "Oops.... Please Select User First.....!!" + "</b></span></td>";
html += "<tr>";
html += "</tbody>";
html += "</table>";
$("#divjsondata").html(html);
}
else if(res.r.length >= 1) {
for (i = 0; i <= res.r.length - 1; i++) {
html += "<tr align='center'>";
html += "<td style='color:#127185;'>" + res.r[i].galleryid + "</td>";
html += "<td align='left'>" + res.r[i].gname + "</td>";
html += "<td>" + res.r[i].eventdate + "</td>";
html += "<td>" + res.r[i].totalphoto + "</td>";
html += "<td>" + res.r[i].selectedphoto + "</td>";
html += "<td>" + res.r[i].glock + "</td>";
html += "<td>" +
"<a href='<?php echo base_url(); ?>" +'admin_cont/gallery_controller/EditGallery/' + res.r[i].galleryid +"'><img src='<?php echo base_url(); ?>" +'images/edit2.png'+ "'/>";"</a>"
+ "</td>";
html += "<td>" +
"<a href='<?php echo base_url(); ?>" +'admin_cont/gallery_controller/galleryphotos/' + res.r[i].galleryid +"'><img src='<?php echo base_url(); ?>" +'images/edit.png'+ "'/>";
"</a>"
+ "</td>";
/*
for userid getting code
html += "<td>" +
"<a href='http://localhost/studio/admin_cont/gallery_controller/EditGallery/"+res.r[i].userid+"'>Edit";"</a>"
+ "</td>";
*/
html += "<tr>";
}
html += "</tbody>";
html += "</table>";
$("#divjsondata").html(html);
}
else{
"<br/>";
html += "<tr>";
html += "<td colspan='7' align='center' >" + "Sorry No Gallery information is available..!!" + "</td>";
html += "<tr>";
html += "</tbody>";
html += "</table>";
$("#divjsondata").html(html);
}
}
});
});
});
</script>
include('nav.php'); ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css">
</head>
<body>
<div class="container">
<div class="card card-containerAdminpage" >
<h3 style="font-weight:700; background:#127185;font-size:21px;color:#fff;padding-top: 4px;padding-bottom: 4px;padding-left: 20px;padding-right: 20px;">Gallery Admin</h3><br/>
<?php
//print_r($user_list); //this print assosiative array ?>
<div class="row">
<div class="col-md-2">
<h4>Select User :</h4>
</div>
<div class="col-md-4">
<?php
// $js = 'id="Ultra" onChange="run();"';
$js = 'id="userdropdown" class="form-control"';
//echo form_dropdown('username', $user_list,'',$js);
echo form_dropdown('username',array('0' => 'Please select User') + $user_list,'',$js);
//echo form_dropdown('username', $user_list,'id="username"');
?>
</div>
<div class="col-md-2">
</div>
<div class="col-md-2">
<!-- in use
<input type="button" class="btn btn-primary" value="Display Gallery" name="dispalygallery"
id="displaygallery" />
-->
<!-- not use
<input type="button" class="btn btn-primary" value="Display Gallery" name="dispalygallery"
onClick="getData()" id="dispalygallery" />
-->
</div>
<div class="col-md-2">
<a href="<?php echo site_url('admin_cont/gallery_controller/createGallery'); ?>"><input class="btn btn-primary" type="button" value="Create Gallery" name="addUser" /></a>
</div>
</div>
<br>
<?php echo $ui="<input type='hidden' name='userid' id='texthide' />" ; //this is imporatant pass userid to controller
?>
<div id="divjsondata" class="table-responsive"></div>
<div class="row" id="divcreategallery">
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
// Ajax post for Display Gallery
$(document).ready(function() {
$("#userdropdown").on('change',function(event) {
//var user_id = document.getElementById("userdropdown").value;
//alert(user_id);
event.preventDefault();
var user_id = document.getElementById("userdropdown").value;
jQuery.ajax({
type: "POST",
url: "<?php echo base_url(); ?>" + "admin_cont/gallery_controller/user_userdata",
dataType: 'json',
data: {userid: user_id},
success: function(res) {
//console.log( res );
var html = "<table class='table table-striped table-bordered table-hover' id='example'>";
html += "<thead>";
html += "<tr style='color:#127185;'>";
html += "<th>#</th>";
html += "<th>Gallery Name</th>";
html += "<th>Event Date</th>";
html += "<th>Total Photo</th>";
html += "<th>Selected Photo</th>";
html += "<th>Gallery lock</th>";
html += "<th>Edit</th>";
html += "<th>Manage</th>";
html += "<tr>";
html += "</thead>";
html += "<tfoot>";
html += "<tr style='color:#127185;'>";
html += "<th>#</th>";
html += "<th>Gallery Name</th>";
html += "<th>Event Date</th>";
html += "<th>Total Photo</th>";
html += "<th>Selected Photo</th>";
html += "<th>Gallery lock</th>";
html += "<th>Edit</th>";
html += "<th>Manage</th>";
html += "<tr>";
html += "</tfoot>";
html += "<tbody>";
if(user_id == 0){
"<br/>";
html += "<tr>";
html += "<td colspan='7' align='center' ><span style='color:blue'><b>" + "Oops.... Please Select User First.....!!" + "</b></span></td>";
html += "<tr>";
html += "</tbody>";
html += "</table>";
$("#divjsondata").html(html);
}
else if(res.r.length >= 1) {
for (i = 0; i <= res.r.length - 1; i++) {
html += "<tr align='center'>";
html += "<td style='color:#127185;'>" + res.r[i].galleryid + "</td>";
html += "<td align='left'>" + res.r[i].gname + "</td>";
html += "<td>" + res.r[i].eventdate + "</td>";
html += "<td>" + res.r[i].totalphoto + "</td>";
html += "<td>" + res.r[i].selectedphoto + "</td>";
html += "<td>" + res.r[i].glock + "</td>";
html += "<td>" +
"<a href='<?php echo base_url(); ?>" +'admin_cont/gallery_controller/EditGallery/' + res.r[i].galleryid +"'><img src='<?php echo base_url(); ?>" +'images/edit2.png'+ "'/>";"</a>"
+ "</td>";
html += "<td>" +
"<a href='<?php echo base_url(); ?>" +'admin_cont/gallery_controller/galleryphotos/' + res.r[i].galleryid +"'><img src='<?php echo base_url(); ?>" +'images/edit.png'+ "'/>";
"</a>"
+ "</td>";
/*
for userid getting code
html += "<td>" +
"<a href='http://localhost/studio/admin_cont/gallery_controller/EditGallery/"+res.r[i].userid+"'>Edit";"</a>"
+ "</td>";
*/
html += "<tr>";
}
html += "</tbody>";
html += "</table>";
$("#divjsondata").html(html);
}
else{
"<br/>";
html += "<tr>";
html += "<td colspan='7' align='center' >" + "Sorry No Gallery information is available..!!" + "</td>";
html += "<tr>";
html += "</tbody>";
html += "</table>";
$("#divjsondata").html(html);
}
}
});
});
});
</script>