BBnepal-Accounts/application/views/admin/classroom.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

196 lines
12 KiB
PHP

<style>
.action_subject_addbtn {
background: #032DA4;
border-radius: 35px;
color: #fff;
padding: 5px 15px;
border: none;
font-size: 12px;
cursor: pointer;
text-decoration: none;
}
</style>
<div class="wraper responsive-width">
<main class="long-tbl-main" id="main">
<div class="from-group adding-class form-group_lng">
<a href="<?= base_url(); ?>admin/ae-classroom/0"><button type="button" class="btn btn-success btn-sm">Add Classroom</button></a>
</div>
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<div class="subsec_sec">
<div class="subject_r subject_r_lng">
<div class="subject_lsec">
<div class="subject_lhead"><?php echo $title; ?> <p id="success" style="color:green;"></p>
</div>
<?php
if (!empty($this->session->flashdata('success_msg'))) { ?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> <?php echo $this->session->flashdata('success_msg'); ?>
</div>
<?php
}
if (!empty($this->session->flashdata('error_msg'))) {
?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Failed!</strong> <?php echo $this->session->flashdata('error_msg'); ?>
</div>
<?php } ?>
<!--<div class="view_del-subjects"><a href="<?= base_url(); ?>admin/classroom_deleted">View Deleted Items</a></div>-->
<table id="tbl" class="display table-responsive">
<thead>
<tr>
<th>Sl.No</th>
<th>Classroom</th>
<th>Course</th>
<th>Subjects</th>
<th>Teachers</th>
<th>Class Teacher</th>
<th class="textCenter">Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1;
//echo "<pre>";
//print_r($final_details);
// print_r($classroom);
foreach ($classroomlist as $classrm) {
$classroomId = $classrm['id'];
?>
<tr>
<td><?= $i; ?></td>
<td>
<div class="ellipsis" title="<?= $classrm['classroom_name']; ?>"><?= $classrm['classroom_name']; ?></div>
</td>
<td><?= $classrm['course_name']; ?></td>
<?php $subject_query = "SELECT cts.*,s.subject_name FROM classroom cl JOIN course_subjects cs ON cl.course_id=cs.course_id LEFT JOIN `classroom_teacher_subject` cts ON cs.subject_id=cts.subject_id AND cl.id=cts.classroom_id LEFT JOIN subject s ON s.id=cts.subject_id WHERE cts.classroom_id=$classroomId ORDER BY cts.id ASC";
$subject_list = $this->Admin_model->get_query_result($subject_query);
// foreach ($subject_list as $sub_value) {
?>
<td>
<?php
// $subject_query = "SELECT s.subject_name FROM classroom_teacher_subject cts LEFT JOIN subject s ON s.id=cts.subject_id WHERE cts.classroom_id=$classroomId ORDER BY cts.id ASC";
// $subject_query = "SELECT cts.*,s.subject_name FROM classroom cl JOIN course_subjects cs ON cl.course_id=cs.course_id LEFT JOIN `classroom_teacher_subject` cts ON cs.subject_id=cts.subject_id AND cl.id=cts.classroom_id LEFT JOIN subject s ON s.id=cts.subject_id WHERE cts.classroom_id=$classroomId ORDER BY cts.id ASC";
//SELECT cts.*,s.subject_name FROM `classroom_teacher_subject` cts LEFT JOIN subject s ON s.id=cts.subject_id WHERE cts.classroom_id=$classroomId ORDER BY cts.id ASC
// $subject_list = $this->Admin_model->get_query_result($subject_query);
foreach ($subject_list as $sub_value) {
echo $subject_name = ($sub_value['subject_name'] != '') ? $sub_value['subject_name'] . "<br>" : '-';
}
?>
</td>
<td>
<?php
$classTeacher = '';
// $teacher_query = "SELECT cts.*,t.teacher_name FROM `classroom_teacher_subject` cts LEFT JOIN teacher t ON t.id=cts.teacher_id WHERE cts.classroom_id=$classroomId ORDER BY cts.id ASC";
// $teacher_list = $this->Admin_model->get_query_result($teacher_query);
// foreach ($teacher_list as $teacher_value) {
// echo $subject_name = ($teacher_value['teacher_id'] != 0) ? $teacher_value['teacher_name'] . "<br>" : '-<br>';
foreach ($subject_list as $sub_value) {
$teacher_query = "SELECT cts.*,t.teacher_name FROM `classroom_teacher_subject` cts LEFT JOIN teacher t ON t.id=cts.teacher_id WHERE cts.id=" . $sub_value['id'] . " ORDER BY cts.id ASC";
$teacher_list = $this->Admin_model->get_query_result($teacher_query);
foreach ($teacher_list as $teacher_value) {
if ($teacher_value['is_class_teacher'] == 'yes') {
$classTeacher = $teacher_value['teacher_name'];
}
echo $subject_name = ($teacher_value['teacher_id'] != 0) ? $teacher_value['teacher_name'] . "<br>" : '-<br>';
}
}
?>
</td>
<td>
<?= $classTeacher ?>
</td>
<td>
<div class="sub_tabbtnsec">
<div><a href="<?php echo base_url(); ?>admin/assign-students/<?= $classrm['id']; ?>" class="action_subject_addbtn" style=" width: 122px !important;display: block;padding: 5px 5px;">Manage Students</a></div>
<a href="<?php echo base_url(); ?>admin/ae-classroom/<?php echo $classrm['id']; ?>">
<div class="sub_editbtn"><i class="fas fa-pencil-alt"></i></div>
</a>
<a data-toggle="modal" onclick="classdel('<?php echo $classrm['id']; ?>')" href="#deleteModal">
<div class="sub_delbtn">
<i class="fa fa-trash" aria-hidden="true"></i>
</div>
</a>
<!--<div><a href="<?php //echo base_url();
?>admin/assign-students/<?php //echo $classrm['id'];
?>" data-toggle="tooltip" title="View Assigned Students"><i class="fa fa-eye"></i></a></div>-->
</div>
</td>
</tr>
<?php $i++; ?>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<div class="viewDoc delete-modal-wrap">
<div class="modal fade" id="deleteModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<div class="delete-modal">
<i class="far fa-times-circle"></i>
<input type="hidden" id="clsid" />
<h4>Are you sure?</h4>
<p>Are you sure you want to delete this Classroom ?</p>
<div class="delete-modal-btn">
<button type="button" class="subject_addbtn subject_addbtn_red" onclick="deletedata($('#clsid').val());">Delete</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
//table js
$('#tbl').DataTable({
"lengthMenu": [
[25, 50, 100, 150, -1],
[25, 50, 100, 150, "All"]
]
});
//table js end
});
</script>
<script type="text/javascript">
function classdel(icn) {
// alert(icn);
$('#clsid').val(icn);
}
function deletedata(id) {
// alert(id);
window.location.replace('<?php echo base_url() ?>' + 'admin/delete_classroom/' + id);
}
$(document).ready(function() {
// show the alert
setTimeout(function() {
$(".alert").alert('close');
<?php unset($_SESSION['success_msg']); ?>
<?php unset($_SESSION['error_msg']); ?>
}, 15000);
});
</script>