20230208
Filter Option
This commit is contained in:
parent
f2a40c268b
commit
98681548c9
@ -87,10 +87,10 @@ class Welcome extends CI_Controller {
|
|||||||
{
|
{
|
||||||
$defaultId=$_POST['defaultId'];
|
$defaultId=$_POST['defaultId'];
|
||||||
$data=$_POST['data'];
|
$data=$_POST['data'];
|
||||||
$hidd=$_POST['hidd'];
|
//$hidd=$_POST['hidd'];
|
||||||
|
|
||||||
$this->session->set_userdata('dateYear',$data);
|
$this->session->set_userdata('dateYear',$data);
|
||||||
$this->session->set_userdata('dataId',$hidd);
|
$this->session->set_userdata('dataId',$defaultId);
|
||||||
|
|
||||||
$getDepartment=$this->WelcomeModel->getDepartment($defaultId);
|
$getDepartment=$this->WelcomeModel->getDepartment($defaultId);
|
||||||
//echo $this->db->last_query();
|
//echo $this->db->last_query();
|
||||||
@ -125,15 +125,58 @@ class Welcome extends CI_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function sessionGetDepartment()
|
||||||
|
{
|
||||||
|
$sessionId=$_POST['sessionId'];
|
||||||
|
$sessionNameYear=$_POST['sessionNameYear'];
|
||||||
|
//$hidd=$_POST['hidd'];
|
||||||
|
|
||||||
|
$this->session->set_userdata('dateYear',$sessionNameYear);
|
||||||
|
$this->session->set_userdata('dataId',$sessionId);
|
||||||
|
|
||||||
|
$getDepartment=$this->WelcomeModel->getDepartment($sessionId);
|
||||||
|
//echo $this->db->last_query();
|
||||||
|
if(isset($getDepartment) && $getDepartment->num_rows()>0)
|
||||||
|
{
|
||||||
|
foreach($getDepartment->result() as $list)
|
||||||
|
{
|
||||||
|
$depId=$list->depId;
|
||||||
|
$depName=$list->depName;
|
||||||
|
$depCode=$list->depCode;
|
||||||
|
$depImage=$list->depImage;
|
||||||
|
?>
|
||||||
|
<a href="<?=base_url();?>subject-list/<?=$depId?>">
|
||||||
|
<div class="box-item" style="margin-bottom:15px;">
|
||||||
|
<?php if($depImage!=""){
|
||||||
|
?>
|
||||||
|
<img src="<?=base_url();?>admin/uploads/department/<?=$depImage;?>" class="respimg" alt="">
|
||||||
|
<?php
|
||||||
|
}else{?>
|
||||||
|
<img src="https://ui-avatars.com/api/?name=<?=$depCode?>?background=random&color=random" class="respimg" alt="">
|
||||||
|
<?php }?>
|
||||||
|
<div class="overlay">
|
||||||
|
<h3 style="color: white;font-size: 20px; position: inherit;top: 50%;left: 50%;-webkit-transform: translate(-50%, -50%);-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);text-align: center;">
|
||||||
|
<?=$depCode;?>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h1 style="font-size:20px;padding-top:5px"><?=$depName?></h1>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
function getDepartmentClick()
|
function getDepartmentClick()
|
||||||
{
|
{
|
||||||
$data=$_POST['data'];
|
$clickId=$_POST['clickId'];
|
||||||
$dataId=$_POST['dataId'];
|
$nameYear=$_POST['nameYear'];
|
||||||
|
$sessionId=$_POST['sessionId'];
|
||||||
|
|
||||||
$this->session->set_userdata('dateYear',$data);
|
$this->session->set_userdata('dateYear',$nameYear);
|
||||||
$this->session->set_userdata('dataId',$dataId);
|
$this->session->set_userdata('dataId',$clickId);
|
||||||
|
|
||||||
$getDepartment=$this->WelcomeModel->getDepartment($dataId);
|
$getDepartment=$this->WelcomeModel->getDepartment($sessionId);
|
||||||
//echo $this->db->last_query();
|
//echo $this->db->last_query();
|
||||||
if(isset($getDepartment) && $getDepartment->num_rows()>0)
|
if(isset($getDepartment) && $getDepartment->num_rows()>0)
|
||||||
{
|
{
|
||||||
@ -162,4 +205,12 @@ class Welcome extends CI_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function setSession()
|
||||||
|
{
|
||||||
|
$clickId=$_POST['clickId'];
|
||||||
|
$nameYear=$_POST['nameYear'];
|
||||||
|
|
||||||
|
$this->session->set_userdata('dateYear',$nameYear);
|
||||||
|
$this->session->set_userdata('dataId',$clickId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,14 +37,14 @@ $dataId=$this->session->userdata('dataId');
|
|||||||
<!--================= header ================-->
|
<!--================= header ================-->
|
||||||
<header class="main-header">
|
<header class="main-header">
|
||||||
<!-- logo -->
|
<!-- logo -->
|
||||||
<a class="logo-holder" href="<?=base_url();?>"><img src="<?=base_url();?>images/hlogo.png" alt=""><?=$dateYear.'---'.$dataId;?></a>
|
<a class="logo-holder" href="<?=base_url();?>"><img src="<?=base_url();?>images/hlogo.png" alt=""></a>
|
||||||
<!-- logo end -->
|
<!-- logo end -->
|
||||||
<!-- navigation -->
|
<!-- navigation -->
|
||||||
<div class="sb-menu-button-wrap">
|
<div class="sb-menu-button-wrap">
|
||||||
<div class="sb-menu-button vis-m"><span></span><span></span><span></span></div>
|
<div class="sb-menu-button vis-m"><span></span><span></span><span></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-holder">
|
<div class="nav-holder">
|
||||||
<input class="hidden" type="hidden" data-session="<?=$dateYear;?>" data-hid="<?=$dataId;?>"/>
|
<input class="hidden" id="hiddenSession" type="hidden" data-session="<?=$dateYear;?>" data-hid="<?=$dataId;?>"/>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
@ -42,45 +42,67 @@
|
|||||||
var base_path=$('body').attr('data-path');
|
var base_path=$('body').attr('data-path');
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
var defaultId=$('.setValue').attr('data-defaltId');
|
var sessionId=$('#hiddenSession').attr('data-hid');
|
||||||
var hidd=$('.hidden').attr('data-hid');
|
//console.log("sId",sessionId);
|
||||||
console.log("hiddenId",hidd);
|
if(sessionId==null || sessionId=="")
|
||||||
var defaultName=$('.setValue').attr('data-defaltName');
|
{
|
||||||
var defaultYear=$('.setValue').attr('data-defaltYear');
|
var defaultId=$('.setValue').attr('data-defaltid');
|
||||||
var data=defaultName+' - '+defaultYear;
|
var defaultName=$('.setValue').attr('data-defaltname');
|
||||||
|
var defaultYear=$('.setValue').attr('data-defaltyear');
|
||||||
|
var defaultData=defaultName+' - '+defaultYear;
|
||||||
var url=base_path+"Welcome/getDepartment";
|
|
||||||
$.post(url,{hidd:hidd,data:data,defaultId:defaultId,csrf_test_name:$.cookie('csrf_cookie_name')},function(departmentResult)
|
//get department using defaultId
|
||||||
|
var url=base_path+"Welcome/getDepartment";
|
||||||
|
$.post(url,{data:defaultData,defaultId:defaultId,csrf_test_name:$.cookie('csrf_cookie_name')},function(departmentResult)
|
||||||
{
|
{
|
||||||
console.log(departmentResult)
|
|
||||||
var result=departmentResult;
|
var result=departmentResult;
|
||||||
$('.getDepartment').html(result);
|
$('.getDepartment').html(result);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var sessionId=$('#hiddenSession').attr('data-hid');
|
||||||
|
var sessionNameYear=$('#hiddenSession').attr('data-session');
|
||||||
|
var fields=sessionNameYear.split("-");
|
||||||
|
var sessionName = fields[0];var sessionYear = fields[1];
|
||||||
|
|
||||||
|
var url=base_path+"Welcome/sessionGetDepartment";
|
||||||
|
$.post(url,{sessionId:sessionId,sessionNameYear:sessionNameYear,defaultId:defaultId,csrf_test_name:$.cookie('csrf_cookie_name')},function(departmentResult)
|
||||||
|
{
|
||||||
|
var result=departmentResult;
|
||||||
|
$('.getDepartment').html(result);
|
||||||
|
$('.setValue').attr('data-defaltId' ,sessionId );
|
||||||
|
$('.setValue').attr('data-defaltName' ,sessionName );
|
||||||
|
$('.setValue').attr('data-defaltYear' ,sessionName );
|
||||||
|
$('.setValue').html(sessionNameYear);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
var base_path=$('body').attr('data-path');
|
||||||
$(".semesterEvent").on('click', function() {
|
$(".semesterEvent").on('click', function() {
|
||||||
|
|
||||||
var semesterId=$(this).attr('data-id');
|
var clickId=$(this).attr('data-id');
|
||||||
var semesterName=$(this).attr('data-name');
|
var clickYear=$(this).attr('data-year');
|
||||||
var semesterYear=$(this).attr('data-year');
|
var clickName=$(this).attr('data-name');
|
||||||
//var dataSession=$('.setValue').attr('data-session');
|
var nameYear=clickName+' - '+clickYear;
|
||||||
|
//Static Sem
|
||||||
|
$('.setValue').attr('data-defaltId' ,clickId );
|
||||||
|
$('.setValue').attr('data-defaltName' ,clickName );
|
||||||
|
$('.setValue').attr('data-defaltYear' ,clickYear );
|
||||||
|
$('.setValue').html(nameYear);
|
||||||
|
|
||||||
var data=semesterName+" - "+semesterYear;
|
var sessionId=$('#hiddenSession').attr('data-hid');
|
||||||
var dataId=semesterId;
|
//Get Department
|
||||||
var url=base_path+"Welcome/getDepartmentClick";
|
var url=base_path+"Welcome/getDepartmentClick";
|
||||||
|
//alert(sessionId);
|
||||||
$.post(url,{data:data,dataId:dataId,csrf_test_name:$.cookie('csrf_cookie_name')},function(departmentResult)
|
$.post(url,{sessionId:sessionId,nameYear:nameYear,clickId:clickId,csrf_test_name:$.cookie('csrf_cookie_name')},function(departmentResult)
|
||||||
{
|
{
|
||||||
var result=departmentResult;
|
var result=departmentResult;
|
||||||
alert(result)
|
|
||||||
$('.getDepartment').html(result);
|
$('.getDepartment').html(result);
|
||||||
$('.setValue').html(data);
|
window.location.href=base_path;
|
||||||
$('.setValue').attr('data-defaltId' ,dataId );
|
|
||||||
$('.setValue').attr('data-defaltName' ,semesterName );
|
|
||||||
$('.setValue').attr('data-defaltYear' ,semesterYear );
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
@ -104,41 +104,22 @@ $CI->load->model('WelcomeModel');
|
|||||||
</div>
|
</div>
|
||||||
<!-- wrapper end -->
|
<!-- wrapper end -->
|
||||||
<?php include 'include/footer.php';?>
|
<?php include 'include/footer.php';?>
|
||||||
<script>
|
|
||||||
var base_path=$('body').attr('data-path');
|
|
||||||
$( document ).ready(function() {
|
|
||||||
|
|
||||||
var semesterId1=$('.setValue').attr('data-id');
|
|
||||||
var semesterId=$('.setValue').attr('data-id1');
|
|
||||||
var semesterName=$('.setValue').attr('data-name1');
|
|
||||||
var semesterYear=$('.setValue').attr('data-year1');
|
|
||||||
var dataSession=$('.setValue').attr('data-session');
|
|
||||||
|
|
||||||
var sessionData=semesterName+"-"+semesterYear;
|
|
||||||
|
|
||||||
if(dataSession==""){$('.setValue').html(sessionData);}else{$('.setValue').html(dataSession);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var url=base_path+"Welcome/getDepartment";
|
|
||||||
$.post(url,{sessionData:sessionData,semesterId:semesterId,csrf_test_name:$.cookie('csrf_cookie_name')},function(departmentResult)
|
|
||||||
{
|
|
||||||
var result=departmentResult;
|
|
||||||
$(".getDepartment").show();
|
|
||||||
$('.getDepartment').html(result);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<script>
|
<script>
|
||||||
var base_path=$('body').attr('data-path');
|
var base_path=$('body').attr('data-path');
|
||||||
$(".semesterEvent").on('click', function() {
|
$(".semesterEvent").on('click', function() {
|
||||||
|
var clickId=$(this).attr('data-id');
|
||||||
|
var clickYear=$(this).attr('data-year');
|
||||||
|
var clickName=$(this).attr('data-name');
|
||||||
|
var nameYear=clickName+' - '+clickYear;
|
||||||
|
|
||||||
|
var url=base_path+"Welcome/setSession";
|
||||||
|
$.post(url,{nameYear:nameYear,clickId:clickId,csrf_test_name:$.cookie('csrf_cookie_name')},function(departmentResult)
|
||||||
|
{
|
||||||
|
var result=departmentResult;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var currentPage=window.location.href;
|
var currentPage=window.location.href;
|
||||||
if(currentPage!=base_path){
|
if(currentPage!=base_path){
|
||||||
window.location.href=base_path;
|
window.location.href=base_path;
|
||||||
|
Loading…
Reference in New Issue
Block a user