f34f7c5bdb
Correction in Semester
240 lines
8.9 KiB
PHP
240 lines
8.9 KiB
PHP
<?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');?>
|
|
<!-- start page content -->
|
|
<div class="page-content-wrapper">
|
|
<div class="page-content">
|
|
<div class="page-bar">
|
|
<div class="page-title-breadcrumb">
|
|
<div class=" pull-left">
|
|
<div class="page-title">Edit Semester</div>
|
|
</div>
|
|
<ol class="breadcrumb page-breadcrumb pull-right">
|
|
<li><i class="fa fa-home"></i> <a class="parent-item" href="<?=base_url();?>/dashboard">Home</a> <i class="fa fa-angle-right"></i>
|
|
</li>
|
|
<li> <a class="parent-item" href="<?=base_url();?>/semester">Semester</a> <i class="fa fa-angle-right"></i>
|
|
</li>
|
|
<li class="active">Edit Semester</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
<!-- Midium Model -->
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12">
|
|
<div class="card card-box">
|
|
<div class="card-head">
|
|
<header>Edit Semester</header>
|
|
</div>
|
|
<?php
|
|
if(isset($getData) && $getData->num_rows()>0)
|
|
{
|
|
$e=$getData->row();
|
|
$id =$e->id;
|
|
$name=$e->name;
|
|
$year=$e->year;
|
|
|
|
} ?>
|
|
<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">
|
|
<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">
|
|
<label class="control-label">Year
|
|
<span class="required"> * </span>
|
|
</label>
|
|
<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">
|
|
<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>
|
|
<!--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
|
|
}
|
|
}
|
|
?>
|
|
|
|
</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>
|
|
<?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">
|
|
<div class="offset-md-3 col-md-9">
|
|
<input type="submit" name="submit" class="btn btn-info m-r-20" value="Submit">
|
|
<button type="button" class="btn btn-default">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php $this->load->view('includes/footer');?>
|
|
<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>
|