Correction in Semester
This commit is contained in:
dotwingssoftware 2023-01-25 18:17:55 +05:30
parent 1018e82089
commit f34f7c5bdb
12 changed files with 641 additions and 334 deletions

View File

@ -245,64 +245,64 @@ class Project extends CI_Controller {
//echo $this->db->last_query();
}
}
//Remove Existing One
$existingRow=$this->Project_model->getMultipleImage($id);
//echo $this->db->last_query();
if($existingRow->num_rows()>0)
{
//echo "test";exit;
$primaryId=array();
foreach($existingRow->result() as $list)
//Remove Existing One
$existingRow=$this->Project_model->getMultipleImage($id);
//echo $this->db->last_query();
if($existingRow->num_rows()>0)
{
$primaryId[]=$list->id ;
//echo "test";exit;
$primaryId=array();
foreach($existingRow->result() as $list)
{
$primaryId[]=$list->id ;
}
}
//Remove Row
$diff=array_diff($primaryId,$projectDetailId);
//print_r ($diff);exit;
if($diff>0)
{
//echo "sdsds";exit;
foreach($diff as $value)
{
$where=array('id'=>$value);
$tablename="projectdetail";
$values=array('status'=>0);
if($projectDetailId[$key]!=""){
$result=$this->Commonsql_model->updateTable($tablename,$where,$values);}
//echo $this->db->last_query();
}
}
//New Row Insertion
if($projectDetailId[$key]=="")
{
if($_FILES['profileimage']['tmp_name'])
{
$tempDocument=$_FILES['profileimage']['tmp_name'][$key];
$getImage=str_replace(' ', '_', $_FILES["profileimage"]["name"][$key]);
$extension1 = pathinfo($getImage, PATHINFO_EXTENSION);
$image=$id.'.'.$getImage;
//$document='uploads/subject/'.$business_document;
$targetPath = './uploads/project/';
$targetFile=$targetPath.$image;
if(move_uploaded_file($tempDocument, $targetFile))
{
$tablename='projectdetail';
$data=array('projectId'=>$id,
'title'=>$title[$key],
'image'=>$image,
'status'=>1);
$result=$this->Commonsql_model->insert_table($tablename,$data);
}
}
}
}
//Remove Row
$diff=array_diff($primaryId,$projectDetailId);
//print_r ($diff);exit;
if($diff>0)
{
//echo "sdsds";exit;
foreach($diff as $value)
{
$where=array('id'=>$value);
$tablename="projectdetail";
$values=array('status'=>0);
if($projectDetailId[$key]!=""){
$result=$this->Commonsql_model->updateTable($tablename,$where,$values);}
//echo $this->db->last_query();
}
}
//New Row Insertion
if($projectDetailId[$key]=="")
{
if($_FILES['profileimage']['tmp_name'])
{
$tempDocument=$_FILES['profileimage']['tmp_name'][$key];
$getImage=str_replace(' ', '_', $_FILES["profileimage"]["name"][$key]);
$extension1 = pathinfo($getImage, PATHINFO_EXTENSION);
$image=$id.'.'.$getImage;
//$document='uploads/subject/'.$business_document;
$targetPath = './uploads/project/';
$targetFile=$targetPath.$image;
if(move_uploaded_file($tempDocument, $targetFile))
{
$tablename='projectdetail';
$data=array('projectId'=>$id,
'title'=>$title[$key],
'image'=>$image,
'status'=>1);
$result=$this->Commonsql_model->insert_table($tablename,$data);
}
}
}
if($result)
{
@ -329,7 +329,8 @@ class Project extends CI_Controller {
$table="project";
$where=array("id"=>$projectId);
$values=array('status'=>0);
$result=$this->Commonsql_model->updateTable($table,$where,$values);
$dTable="projectdetail";
$dWhere=array("projectId"=>$projectId);
$dValue=array('status'=>0);

View File

@ -53,35 +53,50 @@ class Semester extends CI_Controller {
{
$name=$this->input->post('name');
$year=$this->input->post('year');
$subjectId=$this->input->post('subjectId');
$departmentId=$this->input->post('departmentId');
$degreeId=$this->input->post('degreeId');
$subjectIdd = implode(",", (array)$subjectId);
//echo $subjectIdd;exit;
//echo $degreeId;
$table="semester";
$values=array('name'=>$name,
'year'=>$year,
'subjectId'=>$subjectIdd,
'departmentId'=>$departmentId,
'degreeId'=>$degreeId,
'createdOn'=>date('Y-m-d'),
'createdBy'=>1,
'status'=>1);
$values=array( 'name'=>$name,
'year'=>$year,
'createdOn'=>date('Y-m-d'),
'createdBy'=>1,
'status'=>1);
$result=$this->Commonsql_model->insert_table($table,$values);
$semesterId=$this->db->insert_id();
//echo $this->db->last_query();exit;
$subjectId=$this->input->post('subjectId');
$degreeId=$this->input->post('degreeId');
foreach($subjectId as $key=>$value)
{
$SUBJECTID=$subjectId[$key];
$DEGREEID=$degreeId[$key];
$SUBID = implode(",", (array)$SUBJECTID);
//echo $SUBID;
$tablename='semesterdetail';
$data=array('semesterId'=>$semesterId,
'degreeId'=>$DEGREEID,
'subjectId'=>$SUBID,
'status'=>1);
$result=$this->Commonsql_model->insert_table($tablename,$data);
}
//exit;
if($result)
{
$this->session->set_userdata('suc','successfully added');
redirect('semester');
}
else
{
$this->session->set_userdata('err','Please try again');
redirect('semester');
}
{
$this->session->set_userdata('suc','successfully added');
redirect('semester');
}
else
{
$this->session->set_userdata('err','Please try again');
redirect('semester');
}
}
$this->load->view('semester/add_semester',$data);
@ -90,28 +105,92 @@ class Semester extends CI_Controller {
function editSemester($id)
{
$data['subject']=$this->Semester_model->listSubject();
$data['degree']=$this->Semester_model->listDegree();
$data['getData']=$this->Semester_model->getSemester($id);
$data['getSemesterDetail']=$this->Semester_model->getSemesterDetail($id);
//echo $this->db->last_query();exit;
if($this->input->post('submit'))
{
$name=$this->input->post('name');
$year=$this->input->post('year');
$subjectId=$this->input->post('subjectId');
$departmentId=$this->input->post('departmentId');
$degreeId=$this->input->post('degreeId');
$subjectIdd = implode(",", (array)$subjectId);
$table="semester";
$where=array("id"=>$id);
$values=array( 'name'=>$name,
'year'=>$year,
'subjectId'=>$subjectIdd,
'departmentId'=>$departmentId,
'degreeId'=>$degreeId,
'updatedOn'=>date('Y-m-d'),
'updatedby'=>1);
$result=$this->Commonsql_model->updateTable($table,$where,$values);
//echo $this->db->last_query();exit;
//Update Old One
$degreeId=$this->input->post('degreeId');
$subjectId=$this->input->post('subjectId');
$semesterDetailId=$this->input->post('semesterDetailName');
foreach($subjectId as $key=>$value)
{
$DEGREEID=$degreeId[$key];
$SEMESTERDETAILID=$semesterDetailId[$key];
$SUBJECTID=$subjectId[$key];
$SUBID = implode(",", (array)$SUBJECTID);
//echo $SUBID;
$tablename='semesterdetail';
$data=array('degreeId'=>$DEGREEID,
'subjectId'=>$SUBID);
$where=array('id'=>$SEMESTERDETAILID);
$result=$this->Commonsql_model->updateTable($tablename,$where,$data);
//Remove Existing One
$existingRow=$this->Semester_model->getSemesterDetail($id);
//echo $this->db->last_query();exit;
if($existingRow->num_rows()>0)
{
//echo "test";exit;
$primaryId=array();
foreach($existingRow->result() as $list)
{
$primaryId[]=$list->id ;
}
}
//Remove Row
$diff=array_diff($primaryId,$semesterDetailId);
//print_r ($diff);exit;
if($diff>0)
{
//echo "sdsds";exit;
foreach($diff as $value)
{
$where=array('id'=>$value);
$tablename="semesterdetail";
$values=array('status'=>0);
if($SEMESTERDETAILID!=""){
$result=$this->Commonsql_model->updateTable($tablename,$where,$values);}
//echo $this->db->last_query();
}
}
//New Row Insertion
if($SEMESTERDETAILID=="")
{
$tablename='semesterdetail';
$data=array('semesterId'=>$id,
'degreeId'=>$DEGREEID,
'subjectId'=>$SUBID,
'status'=>1);
$result=$this->Commonsql_model->insert_table($tablename,$data);
}
}
if($result)
{
$this->session->set_userdata('suc','successfully Updated');
@ -125,10 +204,7 @@ class Semester extends CI_Controller {
}
}
$data['subject']=$this->Semester_model->listSubject();
$data['department']=$this->Semester_model->listDepartment();
$data['degree']=$this->Semester_model->listDegree();
$data['getData']=$this->Semester_model->getSemester($id);
$this->load->view('semester/edit_semester',$data);
}
@ -141,8 +217,14 @@ class Semester extends CI_Controller {
$table="semester";
$where=array("id"=>$semesterId);
$values=array('status'=>0);
$result=$this->Commonsql_model->updateTable($table,$where,$values);
$table="semesterdetail";
$where=array("semesterId"=>$semesterId);
$values=array('status'=>0);
$result=$this->Commonsql_model->updateTable($table,$where,$values);
//echo $this->db->last_query();exit;
if($result)
{
$this->session->set_userdata('suc','successfully deleted');

View File

@ -236,63 +236,65 @@ class Subject extends CI_Controller {
//echo $this->db->last_query();
}
}
//Remove Existing One
$existingRow=$this->Subject_model->getMultipleImage($id);
//echo $this->db->last_query();
if($existingRow->num_rows()>0)
{
//echo "test";exit;
$primaryId=array();
foreach($existingRow->result() as $list)
//Remove Existing One
$existingRow=$this->Subject_model->getMultipleImage($id);
//echo $this->db->last_query();
if($existingRow->num_rows()>0)
{
$primaryId[]=$list->id ;
//echo "test";exit;
$primaryId=array();
foreach($existingRow->result() as $list)
{
$primaryId[]=$list->id ;
}
}
//Remove Row
$diff=array_diff($primaryId,$subjectDetailId);
//print_r ($diff);exit;
if($diff>0)
{
//echo "sdsds";exit;
foreach($diff as $value)
{
$where=array('id'=>$value);
$tablename="subjectdetail";
$values=array('status'=>0);
if($subjectDetailId[$key]!=""){
$result=$this->Commonsql_model->updateTable($tablename,$where,$values);}
//echo $this->db->last_query();
}
}
//New Row Insertion
if($subjectDetailId[$key]=="")
{
if($_FILES['profileimage']['tmp_name'])
{
$tempDocument=$_FILES['profileimage']['tmp_name'][$key];
$getImage=str_replace(' ', '_', $_FILES["profileimage"]["name"][$key]);
$extension1 = pathinfo($getImage, PATHINFO_EXTENSION);
$image=$id.'.'.$getImage;
//$document='uploads/subject/'.$business_document;
$targetPath = './uploads/subject/';
$targetFile=$targetPath.$image;
if(move_uploaded_file($tempDocument, $targetFile))
{
$tablename='subjectdetail';
$data=array('subjectId'=>$id,
'title'=>$title[$key],
'image'=>$image,
'status'=>1);
$result=$this->Commonsql_model->insert_table($tablename,$data);
}
}
}
}
//Remove Row
$diff=array_diff($primaryId,$subjectDetailId);
//print_r ($diff);exit;
if($diff>0)
{
//echo "sdsds";exit;
foreach($diff as $value)
{
$where=array('id'=>$value);
$tablename="subjectdetail";
$values=array('status'=>0);
if($subjectDetailId[$key]!=""){
$result=$this->Commonsql_model->updateTable($tablename,$where,$values);}
//echo $this->db->last_query();
}
}
//New Row Insertion
if($subjectDetailId[$key]=="")
{
if($_FILES['profileimage']['tmp_name'])
{
$tempDocument=$_FILES['profileimage']['tmp_name'][$key];
$getImage=str_replace(' ', '_', $_FILES["profileimage"]["name"][$key]);
$extension1 = pathinfo($getImage, PATHINFO_EXTENSION);
$image=$id.'.'.$getImage;
//$document='uploads/subject/'.$business_document;
$targetPath = './uploads/subject/';
$targetFile=$targetPath.$image;
if(move_uploaded_file($tempDocument, $targetFile))
{
$tablename='subjectdetail';
$data=array('subjectId'=>$id,
'title'=>$title[$key],
'image'=>$image,
'status'=>1);
$result=$this->Commonsql_model->insert_table($tablename,$data);
}
}
}
if($result)
{
$this->session->set_userdata('suc','successfully Updated');
@ -320,7 +322,8 @@ class Subject extends CI_Controller {
$table="subject";
$where=array("id"=>$subjectId);
$values=array('status'=>0);
$result=$this->Commonsql_model->updateTable($table,$where,$values);
$dTable="subjectdetail";
$dWhere=array("subjectId"=>$subjectId);
$dValue=array('status'=>0);

View File

@ -0,0 +1,39 @@
//Remove Existing One
$existingRow=$this->Semester_model->getSemesterDetail($id);
//echo $this->db->last_query();
if($existingRow->num_rows()>0)
{
//echo "test";exit;
$primaryId=array();
foreach($existingRow->result() as $list)
{
$primaryId[]=$list->id ;
}
}
//Remove Row
$diff=array_diff($primaryId,$semesterDetailId);
//print_r ($diff);exit;
if($diff>0)
{
//echo "sdsds";exit;
foreach($diff as $value)
{
$where=array('id'=>$value);
$tablename="semesterdetail";
$values=array('status'=>0);
if($SEMESTERDETAILID!=""){
$result=$this->Commonsql_model->updateTable($tablename,$where,$values);}
//echo $this->db->last_query();
}
}
//New Row Insertion
if($subjectDetailId[$key]=="")
{
$tablename='semesterdetail';
$data=array('semesterId'=>$id,
'degreeId'=>$DEGREEID,
'subjectId'=>$SUBID,
'status'=>1);
$result=$this->Commonsql_model->insert_table($tablename,$data);
}

View File

@ -10,72 +10,74 @@ class Semester_model extends CI_Model {
function list_semester()
{
$this->db->select('s.id,s.name,s.year,sub.id as subId,sub.name as subName,dep.id as depId,dep.name as depName,deg.id as degId,deg.name as degName');
$this->db->select('s.id,s.name,s.year');
$this->db->from('semester as s');
$this->db->join('subject as sub','sub.id=s.subjectId','INNER');
$this->db->join('department as dep','dep.id=s.departmentId','INNER');
$this->db->join('degree as deg','deg.id=s.degreeId','INNER');
$this->db->where(array('s.status'=>1,));
$query = $this->db->get();
//'sub.status'=>1,'dep.status'=>1,'deg.status'=>1
//echo $this->db->last_query();exit;
//echo $this->db->last_query();exit;
return $query;
}
function listSubject()
function listSubject()
{
$this->db->select('id,name');
$this->db->from('subject');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
//echo $this->db->last_query();exit;
return $query;
}
function listDepartment()
function listDepartment()
{
$this->db->select('id,name');
$this->db->from('department');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
} function listDegree()
}
function listDegree()
{
$this->db->select('id,name');
$this->db->from('degree');
$this->db->where(array('status'=>1));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function viewSemester($id)
{
$this->db->select('s.id,s.name,s.year,s.subjectId,dep.id as depId,dep.name as depName,deg.id as degId,deg.name as degName');
$this->db->select('s.id,s.name,s.year');
$this->db->from('semester as s');
$this->db->join('department as dep','dep.id=s.departmentId','INNER');
$this->db->join('degree as deg','deg.id=s.degreeId','INNER');
$this->db->where(array('s.status'=>1,'s.id'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function getSemester($id)
function getSemester($id)
{
$this->db->select('*');
$this->db->from('semester');
$this->db->where(array('status'=>1,'id'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_subject($id)
function getSemesterDetail($id)
{
$this->db->select('*');
$this->db->from('semesterdetail');
$this->db->where(array('status'=>1,'semesterId'=>$id));
$query = $this->db->get();
return $query;
}
function get_subject($id)
{
$this->db->select('*');
$this->db->from('subject');
$this->db->where(array('status'=>1,'id'=>$id));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
}

View File

@ -176,7 +176,7 @@
<div class="col-md-2 compose-editor">
<input name="profileimage[0]" id="projectImage_0" type="file" class="form-control default">
</div>
<div class="col-md-1">
<div class="col-md-1">
<div class="add-new-button-blue addMore"><span class="btn btn-primary">Add <i class="fa fa-plus"></i></span></div>
</div>
</div>

View File

@ -34,66 +34,24 @@
<form class="form-horizontal" action="<?=base_url();?>add-semester" method="post">
<div class="form-body">
<div class="form-group row">
<label class="control-label col-md-3">Name
<div class="col-md-5">
<label class="control-label">Name
<span class="required"> * </span>
</label>
<input name="name" type="text" data-validation="required" placeholder="Enter Degree Name" class="form-control input-height" />
</div>
<div class="col-md-5">
<input name="name" type="text" data-validation="required" placeholder="Enter Degree Name" class="form-control input-height" /> </div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Year
<label class="control-label">Year
<span class="required"> * </span>
</label>
<div class="col-md-5">
</label>
<input name="year" type="number" data-validation="required" placeholder="Enter Semester Year" class="form-control input-height" />
</div>
</div>
<!--Multiple Row-->
<div class="form-group row">
<label class="control-label col-md-3">Subject
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select id="multiple" multiple class="form-control select2" name="subjectId[]" data-validation="required">
<option value="">Select..</option>
<?php
if(isset($subject) && $subject->num_rows()>0)
{
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Department
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select class="form-control select2" name="departmentId" data-validation="required">
<option value="" selected="selected" id="departentId" >Select</option>
<?php
if(isset($department) && $department->num_rows()>0)
{
foreach($department->result() as $list1)
{
?> <option value="<?=$list1->id;?>"><?=$list1->name;?></option><?php
}
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Degree
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select class="form-control select2" name="degreeId" data-validation="required">
<div class="col-md-5">
<label class="control-label">Degree<span class="required"> * </span></label>
<select class="form-control select2" name="degreeId[0]" id="degreeId_0" data-validation="required">
<option value="" selected="selected" id="degreeId" >Select</option>
<?php
if(isset($degree) && $degree->num_rows()>0)
@ -107,7 +65,69 @@
</select>
</div>
<div class="col-md-5">
<label class="control-label">Subject<span class="required"> * </span></label>
<select multiple class="form-control select2" id="subjectId_0" name="subjectId[0][]" data-validation="required">
<option value="">Select..</option>
<?php
if(isset($subject) && $subject->num_rows()>0)
{
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-1">
<label class="control-label"></label>
<div class="add-new-button-blue addMore"><span class="btn btn-primary">Add <i class="fa fa-plus"></i></span></div>
</div>
</div>
<!--Duplicate-->
<div class="form-group row duplicate1 hide" id="addMoreTemplate">
<div class="col-md-5">
<label class="control-label">Degree<span class="required"> * </span></label>
<select class="form-control" id="degreeId" name="degreeIds[]" data-validation="required">
<option value="" selected="selected">Select</option>
<?php
if(isset($degree) && $degree->num_rows()>0)
{
foreach($degree->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-5">
<label class="control-label">Subject<span class="required"> * </span></label>
<select multiple class="form-control" id="subjectId" name="subjectIds[][]" data-validation="required">
<option value="">Select..</option>
<?php
if(isset($subject) && $subject->num_rows()>0)
{
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-1">
<label class="control-label"></label>
<div class="add-new-button-blue removeButton" id="cat_add_id"><span class="btn btn-danger">Remove <i class="fa fa-minus"></i></span></div>
</div>
</div>
<!--Duplicate-->
<!--Multiple Row-->
</div>
</div>
<div class="form-actions">
@ -133,3 +153,50 @@
<script src="<?=base_url();?>assets/select2/js/select2.js"></script>
<script src="<?=base_url();?>assets/select2/js/select2-init.js"></script>
<script src="<?=base_url();?>assets/jquery.form-validator.min.js"></script>
<script>
//multiple add more
invIndex = 0;
$('body').on('click','.addMore', function() {
invIndex++;
var $template = $('#addMoreTemplate'),
$clone = $template
.clone(true)
.removeClass('hide')
.removeAttr('id')
.attr('data-book-index', invIndex)
.insertBefore($template);
// Update the name attributes
$clone
.find('[id="degreeId"]').attr('id', 'degreeId_'+invIndex).end()
.find('[id="subjectId"]').attr('id', 'subjectId_'+invIndex).end()
.find('[name="degreeIds[]"]').attr('name', 'degreeId['+invIndex+']').end()
.find('[name="subjectIds[][]"]').attr('name', 'subjectId['+invIndex+'][]').end()
function initializeSelect2(selectElementObj)
{
selectElementObj.select2({
width: "100%",
tags: true
});
}
$("#degreeId_"+invIndex).each(function() {
initializeSelect2($(this));
});
//product
$("#subjectId_"+invIndex).each(function() {
initializeSelect2($(this));
});
})
.on('click', '.removeButton', function(){
var $row = $(this).parents('.duplicate1'),
index = $row.attr('data-book-index');
$row.remove();
});
</script>

View File

@ -1,8 +1,11 @@
<?php $this->load->view('includes/header');?>
<?php $this->load->view('includes/header');?>
<link href="<?=base_url();?>/assets/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!--select2-->
<link href="<?=base_url();?>assets/select2/css/select2.css" rel="stylesheet" type="text/css" />
<link href="<?=base_url();?>assets/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
<?php
$CI=& get_instance();
$CI->load->model('Semester_model');?>
<div class="page-container">
<!-- start sidebar menu -->
<?php $this->load->view('includes/sidebar');?>
@ -37,91 +40,131 @@
$id =$e->id;
$name=$e->name;
$year=$e->year;
$subjectId=$e->subjectId;
$departmentId=$e->departmentId;
$degreeId =$e->degreeId;
$subId = explode(",", $subjectId);
//print_r($subId);
} ?>
<div class="card-body" id="bar-parent">
<form class="form-horizontal" action="<?=base_url();?>edit-semester/<?=$id;?>" method="post">
<div class="form-body">
<div class="form-group row">
<label class="control-label col-md-3">Name
<div class="col-md-5">
<label class="control-label">Name
<span class="required"> * </span>
</label>
<input name="name" value="<?=$name;?>" type="text" data-validation="required" placeholder="Enter Degree Name" class="form-control input-height" />
</div>
<div class="col-md-5">
<input name="name" value="<?=$name;?>" type="text" data-validation="required" placeholder="Enter Degree Name" class="form-control input-height" /> </div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Year
<label class="control-label">Year
<span class="required"> * </span>
</label>
<div class="col-md-5">
<input name="year" value="<?=$year;?>" type="number" data-validation="required" placeholder="Enter Semester Year" class="form-control input-height" />
</div>
</div>
<hr>
<div class="form-group row">
<label class="control-label col-md-3">Subject
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select id="multiple" multiple class="form-control select2" name="subjectId[]" data-validation="required">
<option value="" id="subjectId" >Select</option>
<?php
if(isset($subject) && $subject->num_rows()>0)
{
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>" <?php if (in_array($list->id,$subId)){ echo "selected";}?>><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-5"></div>
<div class="col-md-5"></div>
<div class="col-md-1" style="margin-left: -12px;">
<div class="add-new-button-blue addMore"><span class="btn btn-primary">Add More<i class="fa fa-plus"></i></span></div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Department
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select class="form-control select2" name="departmentId" data-validation="required">
<option value="" selected="selected" id="departentId" >Select</option>
<?php
if(isset($department) && $department->num_rows()>0)
{
foreach($department->result() as $list1)
{
?> <option value="<?=$list1->id;?>" <?php if($list1->id==$departmentId){ echo "selected";}?>><?=$list1->name;?></option><?php
}
}
?>
</select>
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-3">Degree
<span class="required"> * </span>
</label>
<div class="col-md-5">
<select class="form-control select2" name="degreeId" data-validation="required">
<option value="" selected="selected" id="degreeId" >Select</option>
<!--Multiple Row-->
<?php if(isset($getSemesterDetail) && $getSemesterDetail->num_rows()>0){$totalCount=$getSemesterDetail->num_rows();} ?>
<input type="hidden" value="<?=$totalCount;?>" id="hiddenCount"/>
<?php
if(isset($getSemesterDetail) && $getSemesterDetail->num_rows()>0)
{
$i=0;
foreach($getSemesterDetail->result() as $d)
{
$id=$d->id;
$degreeId=$d->degreeId;
$subjectId=$d->subjectId;
$subId = explode(",", $subjectId);
?>
<div class="form-group row duplicate1">
<input type="hidden" value="<?=$id;?>" id="semesterDetailId_<?=$i;?>" name="semesterDetailName[<?=$i;?>]"/>
<div class="col-md-5">
<label class="control-label">Degree<span class="required"> * </span></label>
<select class="form-control select2" name="degreeId[<?=$i;?>]" id="degreeId_<?=$i;?>" data-validation="required">
<option value="" >Select</option>
<?php
if(isset($degree) && $degree->num_rows()>0)
{
foreach($degree->result() as $list)
{
?> <option value="<?=$list->id;?>" <?php if($list->id==$degreeId){ echo "selected";}?>><?=$list->name;?></option><?php
?> <option value="<?=$list->id;?>" <?php if($list->id==$degreeId){ echo "selected"; }?>><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-5">
<label class="control-label">Subject<span class="required"> * </span></label>
<select multiple class="form-control select2" id="subjectId_<?=$i;?>" name="subjectId[<?=$i;?>][]" data-validation="required">
<option value="">Select..</option>
<?php
if(isset($subject) && $subject->num_rows()>0)
{
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>" <?php if (in_array($list->id, $subId)){ echo "selected";}?>><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-1">
<label></label>
<div class="add-new-button-blue removeButton" style="padding-top: 7px;"><span class="btn btn-danger">Remove <i class="fa fa-minus"></i></span></div>
</div>
</div>
</div>
<?php $i++; } } ?>
<!--Duplicate-->
<div class="form-group row duplicate1 hide" id="addMoreTemplate">
<input type="hidden" value="" id="semesterDetailId" name="semesterDetailNames[]"/>
<div class="col-md-5">
<label class="control-label">Degree<span class="required"> * </span></label>
<select class="form-control" id="degreeId" name="degreeIds[]" data-validation="required">
<option value="" selected="selected">Select</option>
<?php
if(isset($degree) && $degree->num_rows()>0)
{
foreach($degree->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-5">
<label class="control-label">Subject<span class="required"> * </span></label>
<select multiple class="form-control" id="subjectId" name="subjectIds[][]" data-validation="required">
<option value="">Select..</option>
<?php
if(isset($subject) && $subject->num_rows()>0)
{
foreach($subject->result() as $list)
{
?> <option value="<?=$list->id;?>"><?=$list->name;?></option><?php
}
}
?>
</select>
</div>
<div class="col-md-1">
<label></label>
<div class="add-new-button-blue removeButton" style="padding-top: 7px;"><span class="btn btn-danger">Remove <i class="fa fa-minus"></i></span></div>
</div>
</div>
<!--Duplicate-->
<!--Multiple Row-->
</div>
</div>
<div class="form-actions">
<div class="row">
@ -135,10 +178,11 @@
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
</div>
</div>
</div>
@ -146,3 +190,51 @@
<script src="<?=base_url();?>assets/select2/js/select2.js"></script>
<script src="<?=base_url();?>assets/select2/js/select2-init.js"></script>
<script src="<?=base_url();?>assets/jquery.form-validator.min.js"></script>
<script>
//multiple add more
invIndex = $('#hiddenCount').val();
$('body').on('click','.addMore', function() {
invIndex++;
var $template = $('#addMoreTemplate'),
$clone = $template
.clone(true)
.removeClass('hide')
.removeAttr('id')
.attr('data-book-index', invIndex)
.insertBefore($template);
// Update the name attributes
$clone
.find('[id="degreeId"]').attr('id', 'degreeId_'+invIndex).end()
.find('[id="subjectId"]').attr('id', 'subjectId_'+invIndex).end()
.find('[id="semesterDetailId"]').attr('id', 'semesterDetailId_'+invIndex).end()
.find('[name="degreeIds[]"]').attr('name', 'degreeId['+invIndex+']').end()
.find('[name="subjectIds[][]"]').attr('name', 'subjectId['+invIndex+'][]').end()
.find('[name="semesterDetailNames[]"]').attr('name', 'semesterDetailName['+invIndex+']').end()
function initializeSelect2(selectElementObj)
{
selectElementObj.select2({
width: "100%",
tags: true
});
}
$("#degreeId_"+invIndex).each(function() {
initializeSelect2($(this));
});
//product
$("#subjectId_"+invIndex).each(function() {
initializeSelect2($(this));
});
})
.on('click', '.removeButton', function(){
var $row = $(this).parents('.duplicate1'),
index = $row.attr('data-book-index');
$row.remove();
});
</script>

View File

@ -22,7 +22,7 @@
</div>
<?php $this->load->view('includes/msg');?>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<div class="card card-topline-red">
<div class="card-body ">
<div class="row">
@ -42,34 +42,26 @@
<th> S.No</th>
<th> Name</th>
<th> Year </th>
<th> Department </th>
<th> Degree </th>
<th> Action </th>
</tr>
</thead>
<tbody>
<?php
if(isset($semester) && $semester->num_rows()>0)
<?php
if(isset($semester) && $semester->num_rows()>0)
{
$i=1;
foreach($semester->result() as $d)
{
$i=1;
foreach($semester->result() as $d)
{
$id=$d->id;
$name=$d->name;
$year=$d->year;
$depId=$d->depId;
$depName=$d->depName;
$subId=$d->subId;
$subName=$d->subName;
$degId=$d->degId;
$degName=$d->degName;
?>
$id=$d->id;
$name=$d->name;
$year=$d->year;
?>
<tr class="odd gradeX">
<td><?=$i;?></td>
<td><?=$name;?></td>
<td><?=$year;?></td>
<td><?=$depName;?></td>
<td><?=$degName;?></td>
<td>
<a href="<?=base_url();?>view-semester/<?=$id;?>" class="btn btn-success btn-xs">
<i class="fa fa-eye"></i>

View File

@ -37,13 +37,7 @@ $CI->load->model('Semester_model');?>
$id=$view->id;
$name=$view->name;
$year=$view->year;
$subjectId=$view->subjectId;
$depId=$view->depId;
$depName=$view->depName;
$degId=$view->degId;
$degName=$view->degName;
$subId = explode(",", $subjectId);
//print_r ($facIdd);
$get_degree=$CI->Semester_model->getDegree($id);
}
@ -59,21 +53,26 @@ $CI->load->model('Semester_model');?>
<div class="profile-usertitle-name"><?=$year;?></div>
</div>
<hr>
<?php
if($get_degree->num_rows()>0){
foreach($get_degree->result() as $d)
{
$id=$d->id;
$degId=$d->degId;
$degName=$d->degName;
$subjectId=$d->subjectId;
$subId = explode(",", $subjectId);
?>
<div class="row">
<div class="col-md-6 col-xs-6 b-r"> <strong>Department</strong>
<br>
<p class="text-muted"><?=$depName;?></p>
</div>
<div class="col-md-6 col-xs-6 b-r"> <strong>Degree</strong>
<br>
<p class="text-muted"><?=$degName;?></p>
</div>
<div class="col-md-12 col-xs-6 b-r"> <strong>Subject</strong>
<div class="col-md-6 col-xs-6 b-r"> <strong>Subject</strong>
<br>
<?php
$i=1;
foreach($subId as $subIdd)
{
$getSub=$CI->Semester_model->get_subject($subIdd);
@ -82,18 +81,14 @@ $CI->load->model('Semester_model');?>
{
$list=$getSub->row();
$subName=$list->name;
}
?>
<div style="margin-top: 30px;" ><span class="label label-success"><?=$subName;?></span></div>
<?php
}
?>
<p class="text-muted"><?=$i;?>.<?=$subName;?></p>
<?php $i++;} ?>
</div>
</div>
<?php } } ?>
<!-- END SIDEBAR USER TITLE -->
<!-- SIDEBAR BUTTONS -->

View File

@ -68,7 +68,7 @@
$year=$list->year;
$departmentId=$list->departmentId;
?> <li id="<?=$id;?>"><a class="semesterEvent" data-id="<?=$id;?>" href="javascript:"><?=$name." - ".$year?></a></li><?php
?> <li id="<?=$id;?>"><a class="semesterEvent" data-id="<?=$year;?>" data-id="<?=$id;?>" href="javascript:"><?=$name." - ".$year?></a></li><?php
}
}
?>
@ -76,20 +76,19 @@
<!--second level end-->
</li>
<li id="showDepartment">
<a href="about.html" >Department</a>
<!--second level end-->
<!--<a href="about.html" >Department</a>
<ul>
<?php
if(isset($dep) && $dep->num_rows()>0)
{
foreach($dep->result() as $deparment)
{
?> <li><a href="about-personal.html"><?=$deparment->code?></a></li><?php
?> <li><?=$deparment->code?></li><?php
}
}
?>
</ul>
<!--second level end-->
</ul>-->
</li>
<li></li>

View File

@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 24, 2023 at 11:03 AM
-- Generation Time: Jan 25, 2023 at 01:46 PM
-- Server version: 10.4.24-MariaDB
-- PHP Version: 7.4.29
@ -43,7 +43,8 @@ CREATE TABLE `degree` (
--
INSERT INTO `degree` (`id`, `departmentId`, `name`, `createdBy`, `createdOn`, `upadatedOn`, `updatedBy`, `status`) VALUES
(1, 1, 'Bachelors in Architecture', 1, '2023-01-23', '0000-00-00', 0, 1);
(1, 1, 'Bachelors in Architecture', 1, '2023-01-23', '0000-00-00', 0, 1),
(2, 1, 'Test', 1, '2023-01-25', '0000-00-00', 0, 1);
-- --------------------------------------------------------
@ -226,9 +227,6 @@ CREATE TABLE `semester` (
`id` int(11) NOT NULL,
`name` varchar(225) NOT NULL,
`year` int(11) NOT NULL,
`subjectId` varchar(225) NOT NULL,
`departmentId` int(11) NOT NULL,
`degreeId` int(11) NOT NULL,
`createdBy` int(11) NOT NULL,
`createdOn` date NOT NULL,
`updatedOn` date NOT NULL,
@ -240,8 +238,33 @@ CREATE TABLE `semester` (
-- Dumping data for table `semester`
--
INSERT INTO `semester` (`id`, `name`, `year`, `subjectId`, `departmentId`, `degreeId`, `createdBy`, `createdOn`, `updatedOn`, `updatedBy`, `status`) VALUES
(3, 'EVEN', 2023, '1,2,3,4,5', 1, 1, 1, '2023-01-23', '2023-01-23', 1, 1);
INSERT INTO `semester` (`id`, `name`, `year`, `createdBy`, `createdOn`, `updatedOn`, `updatedBy`, `status`) VALUES
(1, 'ODD', 2024, 1, '2023-01-25', '2023-01-25', 1, 1);
-- --------------------------------------------------------
--
-- Table structure for table `semesterdetail`
--
CREATE TABLE `semesterdetail` (
`id` int(11) NOT NULL,
`semesterId` int(11) NOT NULL,
`degreeId` int(11) NOT NULL,
`subjectId` varchar(225) NOT NULL,
`status` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `semesterdetail`
--
INSERT INTO `semesterdetail` (`id`, `semesterId`, `degreeId`, `subjectId`, `status`) VALUES
(1, 1, 1, '1,2', 1),
(2, 1, 2, '1,2,3,4,5', 0),
(3, 1, 2, '1', 0),
(4, 1, 2, '2', 0),
(5, 1, 2, '1', 1);
-- --------------------------------------------------------
@ -383,6 +406,12 @@ ALTER TABLE `role`
ALTER TABLE `semester`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `semesterdetail`
--
ALTER TABLE `semesterdetail`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `student`
--
@ -409,7 +438,7 @@ ALTER TABLE `subjectdetail`
-- AUTO_INCREMENT for table `degree`
--
ALTER TABLE `degree`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `department`
@ -451,7 +480,13 @@ ALTER TABLE `role`
-- AUTO_INCREMENT for table `semester`
--
ALTER TABLE `semester`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `semesterdetail`
--
ALTER TABLE `semesterdetail`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `student`