BBnepal-Accounts/library/stash.diff

419 lines
20 KiB
Diff
Raw Permalink Normal View History

2024-07-10 12:43:19 +00:00
diff --git a/application/config/constants.php b/application/config/constants.php
index 3406345..aa8b5f9 100644
--- a/application/config/constants.php
+++ b/application/config/constants.php
@@ -90,3 +90,5 @@ define('THE_DELETE_ALERT_MSG', "Are you sure, you want to delete this %s");
define('THE_ADD_ERROR_MSG', "Oops.. Something went wrong while adding the %s");
define('THE_UPDATE_ERROR_MSG', "Oops.. Something went wrong while updating the %s");
+
+define('STUDENT_PROFILE_PATH',"https://ezydemo.com/erisn-classroom/assets_student/application/");
diff --git a/application/config/database.php b/application/config/database.php
index 99a79cf..54dc8b7 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -98,8 +98,8 @@ $query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
- 'username' => 'erisn9_ec_lms',
- 'password' => 'jk}=yafmw@OU',
+ 'username' => 'root',
+ 'password' => '',
'database' => 'erisn9_erisn_classroom_lms',
'dbdriver' => 'mysqli',
'dbprefix' => '',
@@ -120,8 +120,8 @@ $db['default'] = array(
$db['erisnClassroom'] = array(
'dsn' => '',
'hostname' => 'localhost:3306',
- 'username' => 'erisn9_erisnclassroom',
- 'password' => 'Ab=*Ur{]qOSb',
+ 'username' => 'root',
+ 'password' => '',
'database' => 'erisn9_erisnclassroom',
'dbdriver' => 'mysqli',
'dbprefix' => '',
diff --git a/application/config/routes.php b/application/config/routes.php
index 009d6c4..cf16880 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -73,7 +73,7 @@ $route['receive-book'] = 'LmsAdmin/receive_book';
$route['receive-book-detail/(:any)'] = 'LmsAdmin/receive_book_detail/$1';
$route['students'] = 'LmsAdmin/students';
-$route['students-info'] = 'LmsAdmin/students_info';
+$route['students-info/(:num)'] = 'LmsAdmin/students_info/$1';
$route['damaged-books'] = 'LmsAdmin/damaged_books';
$route['damaged-books-details/(:num)'] = 'LmsAdmin/damaged_books_details/$1';
diff --git a/application/controllers/LmsAdmin.php b/application/controllers/LmsAdmin.php
index 8921c12..67a1033 100644
--- a/application/controllers/LmsAdmin.php
+++ b/application/controllers/LmsAdmin.php
@@ -894,9 +894,7 @@ class LmsAdmin extends CI_Controller
{
$id = $_POST['id'];
$tableName = $_POST['tableName'];
- if($tableName == 'lms_end_users'){
- $where = ' unq_id='."'$id'";
- }elseif($tableName == 'lms_books'){
+ if($tableName == 'lms_books'){
$where = ' isbn='."'$id'";
}
$data = $this->LmsAdmin_Model->getData($tableName, $where);
@@ -916,6 +914,13 @@ class LmsAdmin extends CI_Controller
}
print_r(json_encode($data));
}
+
+ public function getStudentDataById()
+ {
+ $stdIs = $_POST['id'];
+ $data = $this->LmsAdmin_Model->getStudentDataById($stdIs);
+ print_r(json_encode($data));
+ }
//end issued book
//start returned book
@@ -1014,7 +1019,8 @@ class LmsAdmin extends CI_Controller
if(count($_POST) > 0)
{
$eu_id = $_POST['eu_unique_id'];
- $euId = $this->db->get_where('lms_end_users', ['unq_id'=> $eu_id])->row_array();
+ $euId = $this->LmsAdmin_Model->getStudentDataById($eu_id);
+
$where = " eu_unique_id="."'$eu_id'";
$existsUser = $this->LmsAdmin_Model->getData('lms_book_transactions', $where);
if(!$existsUser)
@@ -1048,9 +1054,9 @@ class LmsAdmin extends CI_Controller
$data['title'] = 'Receive Book';
$where = " id="."'$euId'";
- $data['userData'] = $this->LmsAdmin_Model->getData('lms_end_users', $where);
+ $data['userData'] = $this->LmsAdmin_Model->getStudentInfo($where);
if($data['userData']){
- $eu_unique_id = $data['userData']['unq_id'];
+ $eu_unique_id = $data['userData']['studentId'];
$userWhere = " eu_unique_id="."'$eu_unique_id'";
$data['bookDetail'] = $this->LmsAdmin_Model->getData('lms_book_transactions', $userWhere);
}
@@ -1139,8 +1145,8 @@ class LmsAdmin extends CI_Controller
$userData = '';
$data['studentData'] = $this->fecthUserData($userData);
- $distinct = $this->db->distinct();
- $data['classData'] = $this->LmsAdmin_Model->get_user_data('lms_end_users', '', $distinct);
+ // $distinct = $this->db->distinct();
+ // $data['classData'] = $this->LmsAdmin_Model->get_user_data('lms_end_users', '', $distinct);
$this->load->view('lms-admin/common/left-menu', $data);
$this->load->view('lms-admin/common/header', $data);
@@ -1153,19 +1159,19 @@ class LmsAdmin extends CI_Controller
public function fecthUserData($userData=array())
{
- if(isset($userData['class']) && !empty($userData['class'])){
- $class = $userData['class'];
- $where = " unq_id LIKE '%ECS%' AND class_name="."'$class'";
- }else{
- $where = " unq_id LIKE '%ECS%'";
- }
- $userLists = $this->LmsAdmin_Model->get_user_data('lms_end_users', $where, '');
+ // if(isset($userData['class']) && !empty($userData['class'])){
+ // $class = $userData['class'];
+ // $where = " unq_id LIKE '%ECS%' AND class_name="."'$class'";
+ // }else{
+ // $where = " unq_id LIKE '%ECS%'";
+ // }
+ $userLists = $this->LmsAdmin_Model->get_user_data('students');
$liData['studentData'] = $userLists;
$returnPage = $this->load->view('lms-admin/students-reload', $liData, true);
return $returnPage;
}
- public function students_info()
+ public function students_info($stdId = '')
{
if (!file_exists(APPPATH.'views/lms-admin/students-info.php'))
show_404();
@@ -1173,6 +1179,8 @@ class LmsAdmin extends CI_Controller
if($_SESSION['lmsAULoginData']['lms_lin_login'] == 1){
$data['title'] = 'Student Info';
+ $where = " id=".$stdId;
+ $data['studentInfo'] = $this->LmsAdmin_Model->getStudentInfo($where);
$this->load->view('lms-admin/common/left-menu', $data);
$this->load->view('lms-admin/common/header', $data);
$this->load->view('lms-admin/students-info', $data);
diff --git a/application/models/LmsAdmin_Model.php b/application/models/LmsAdmin_Model.php
index f665a0e..7d1e463 100644
--- a/application/models/LmsAdmin_Model.php
+++ b/application/models/LmsAdmin_Model.php
@@ -526,19 +526,28 @@ class LmsAdmin_Model extends CI_Model
//end returned book
//start student
- public function get_user_data($table, $where, $distinct)
+ public function get_user_data($table)
{
- if($distinct!='')
- {
- $distinct;
- $this->db->select('class_name');
- return $this->db->get($table)->result_array();
- }else{
- $this->db->order_by('id', 'DESC');
- $this->db->where($where);
- return $this->db->get($table)->result_array();
- }
-
+ $CI = &get_instance();
+ $ecDB = $CI->load->database('erisnClassroom', TRUE);
+ $query = $ecDB->query("SELECT c.id,c.name, c.studentId,c.mobile,(select classroom_name from classroom a join student_batch b on a.id=b.classroom_id WHERE b.student_id=c.id) as class_name FROM students c ORDER BY c.id");
+ return $query->result_array();
+ }
+
+ public function getStudentInfo($where)
+ {
+ $CI = &get_instance();
+ $ecDB = $CI->load->database('erisnClassroom', TRUE);
+ $ecDB->where($where);
+ return $ecDB->get('students')->row_array();
+ }
+
+ public function getStudentDataById($stdIs)
+ {
+ $CI = &get_instance();
+ $ecDB = $CI->load->database('erisnClassroom', TRUE);
+ $query = $ecDB->query("SELECT c.id,c.mobile,c.name,(select classroom_name from classroom a join student_batch b on a.id=b.classroom_id WHERE b.student_id=c.id) as class_name FROM students c WHERE c.studentId='$stdIs'");
+ return $query->row_array();
}
//end student
/*############################################ ENDDD Of Coding By Keerthi ############################################*/
diff --git a/application/views/lms-admin/add-edit-issue-book.php b/application/views/lms-admin/add-edit-issue-book.php
index 4798e8e..1f38d2f 100644
--- a/application/views/lms-admin/add-edit-issue-book.php
+++ b/application/views/lms-admin/add-edit-issue-book.php
@@ -155,17 +155,16 @@
<script>
function getEndUserData(eu_id)
{
- var tableName = 'lms_end_users';
$.ajax({
type: 'post',
- url: '<?= base_url(); ?>LmsAdmin/getDataById',
- data: {'id': eu_id, 'tableName': tableName},
+ url: '<?= base_url(); ?>LmsAdmin/getStudentDataById',
+ data: {'id': eu_id},
success: function (result) {
-
var obj = JSON.parse(result);
+ var stdname = obj.name.split(" ");
$('#student_class').val(obj.class_name);
- $('#fname').val(obj.fname);
- $('#lname').val(obj.lname);
+ $('#fname').val(stdname[0]);
+ $('#lname').val(stdname[1]);
}
});
}
diff --git a/application/views/lms-admin/issued-books-reload.php b/application/views/lms-admin/issued-books-reload.php
index fac66db..d741572 100644
--- a/application/views/lms-admin/issued-books-reload.php
+++ b/application/views/lms-admin/issued-books-reload.php
@@ -13,7 +13,8 @@
<!-- class="due" -->
<?php if(isset($issuedBookData) && !empty($issuedBookData)){ foreach($issuedBookData as $ibData) {
$book_name = $this->db->get_where('lms_books', ['id'=> $ibData['book_id']])->row_array();
- $eu_name = $this->db->get_where('lms_end_users', ['unq_id'=> $ibData['eu_unique_id']])->row_array();
+ $stdIs = $ibData['eu_unique_id'];
+ $eu_name = $this->LmsAdmin_Model->getStudentDataById($stdIs);
//calculating of remaining days
$today = date('Y-m-d');
@@ -35,8 +36,8 @@
?>
<tr>
<td><?= $book_name['title']; ?></td>
- <td><?= $eu_name['fname'].' '.$eu_name['lname']; ?></td>
- <td><?= $eu_name['contact_no']; ?></td>
+ <td><?= $eu_name['name']; ?></td>
+ <td><?= $eu_name['mobile']; ?></td>
<td><?= date('d-m-Y', strtotime($ibData['issued_date'])); ?></td>
<td><?= $remaining_days; ?> Days</td>
<td <?= $class; ?>><?= $oddays; ?> Days</td>
diff --git a/application/views/lms-admin/receive-book-detail.php b/application/views/lms-admin/receive-book-detail.php
index f4bba8e..cd76d79 100644
--- a/application/views/lms-admin/receive-book-detail.php
+++ b/application/views/lms-admin/receive-book-detail.php
@@ -15,22 +15,20 @@
<?php
$eu_id=''; $class=''; $fname=''; $lname=''; $contact='';
if(isset($userData) && !empty($userData)){
- $eu_id = $userData['unq_id'];
- $class = $userData['class_name'];
- $fname = $userData['fname'];
- $lname = $userData['lname'];
- $contact = $userData['contact_no'];
+ $eu_id = $userData['studentId'];
+ // $class = $userData['class_name'];
+ $name = $userData['name'];
+ $contact = $userData['mobile'];
}
?>
<div class="student_details">
<ul>
<li><label>Student ID</label><span><?= $eu_id; ?></span></li>
- <li><label>First Name</label><span><?= $fname; ?></span></li>
- <li><label>Contact</label><span><?= $contact; ?></span></li>
+ <li><label>Name</label><span><?= $name; ?></span></li>
</ul>
<ul>
+ <li><label>Contact</label><span><?= $contact; ?></span></li>
<li><label>Class</label><span><?= $class; ?></span></li>
- <li><label>Last Name</label><span><?= $lname; ?></span></li>
</ul>
</div>
<div class="common-sub-heading">Issued Books</div>
@@ -50,7 +48,7 @@
</tr>
</thead>
<tbody>
- <?php if(isset($bookDetail) && !empty($bookDetail)){$ttl_fee = 0; $i=1; foreach($bookDetail as $bdata){
+ <?php $ttl_fee = 0; if(isset($bookDetail) && !empty($bookDetail)){ $i=1; foreach($bookDetail as $bdata){
$bookData = $this->db->get_where('lms_books', ['id'=> $bdata['book_id']])->row_array();
//calculating over due days
diff --git a/application/views/lms-admin/students-info.php b/application/views/lms-admin/students-info.php
index 4828570..86a3a63 100644
--- a/application/views/lms-admin/students-info.php
+++ b/application/views/lms-admin/students-info.php
@@ -6,7 +6,7 @@
<div class="subject_rsec">
<a href="javascript:history.back()"><button class="btn btn-dark btn-sm">Back</button></a>
- <div class="application-toggle-btn view-student-tab">
+ <!-- <div class="application-toggle-btn view-student-tab">
<ul class="nav nav-pills">
<li >
<a href="#1b" data-toggle="tab" class="active">Student Info</a>
@@ -15,29 +15,45 @@
<a href="#2b" data-toggle="tab">Course Details</a>
</li>
</ul>
- </div>
+ </div> -->
+ <?php
+ $studentId = ''; $name=''; $email=''; $contact_no=''; $dob='';
+ $gender = ''; $emrg_name=''; $emrg_conct=''; $address=''; $photo='';
+ if(isset($studentInfo) && !empty($studentInfo)){
+ $studentId = $studentInfo['studentId'];
+ $name = $studentInfo['name'];
+ $email = $studentInfo['email'];
+ $contact_no = $studentInfo['mobile'];
+ $dob = $studentInfo['dob'];
+ $gender = $studentInfo['gender'];
+ $emrg_name = $studentInfo['emergency_contact_name'];
+ $emrg_conct = $studentInfo['emergency_contact_number'];
+ $address = $studentInfo['address1'].'-'.$studentInfo['zipcode'];
+ $photo = $studentInfo['photo'];
+ }
+ ?>
<div class="tab-content">
<div class="tab-toggle-content active" id="1b">
<div class="student-info-wrap">
- <img src="<?= base_url(); ?>assets-lms/images/student.png" class="student-info-img">
+ <img src="<?= STUDENT_PROFILE_PATH; ?><?= $photo; ?>" class="student-info-img">
<ul>
- <li><label>Student ID:</label><span>SUN-A-50007</span></li>
- <li><label>Name:</label><span>Andrew Flintoff</span></li>
- <li><label>Email:</label><span>andrew1997@email.com</span></li>
- <li><label>Contact number:</label><span>+234-809-5559-9</span></li>
- <li><label>Date of birth:</label><span>01/01/1997</span></li>
- <li><label>Gender:</label><span>Male</span></li>
+ <li><label>Student ID:</label><span><?= $studentId; ?></span></li>
+ <li><label>Name:</label><span><?= $name; ?></span></li>
+ <li><label>Email:</label><span><?= $email; ?></span></li>
+ <li><label>Contact number:</label><span><?= $contact_no; ?></span></li>
+ <li><label>Date of birth:</label><span><?= $dob; ?></span></li>
+ <li><label>Gender:</label><span><?= $gender; ?></span></li>
</ul>
<div class="common-sub-heading">Emergency contacts</div>
<ul>
- <li><label>Name:</label><span>Robert Flintoff</span></li>
- <li><label>Contact number:</label><span>+234-809-5559-9</span></li>
- <li><label>Address:</label><span>21 A Simbiat Abiola Way <br> Off Bank Anthony Way <br> Ikeja, Lagos - Nigeria -100212</span></li>
+ <li><label>Name:</label><span><?= $emrg_name; ?></span></li>
+ <li><label>Contact number:</label><span><?= $emrg_conct; ?></span></li>
+ <li><label>Address:</label><span><?= $address; ?></span></li>
</ul>
</div>
</div>
- <div class="tab-toggle-content" id="2b">
+ <!-- <div class="tab-toggle-content" id="2b">
<div class="student-info-wrap">
<ul>
<li><label>Student ID:</label><span>SUN-A-50007</span></li>
@@ -47,7 +63,7 @@
<li><label>Subjects:</label><span>Subject 01<br>Subject 02<br>Subject 03<br>Subject 04<br>Subject 05</span></li>
</ul>
</div>
- </div>
+ </div> -->
</div>
diff --git a/application/views/lms-admin/students-reload.php b/application/views/lms-admin/students-reload.php
index bec9bfd..b9fa00b 100644
--- a/application/views/lms-admin/students-reload.php
+++ b/application/views/lms-admin/students-reload.php
@@ -1,4 +1,4 @@
-<table id="tbl" class="display dataTable table-responsive">
+<table id="tbl" class="display dataTable table-responsive text-center">
<thead>
<tr>
<th>Student ID</th>
@@ -11,13 +11,13 @@
<tbody>
<?php if(isset($studentData) && !empty($studentData)){ foreach($studentData as $sData) { ?>
<tr>
- <td><?= $sData['unq_id']; ?></td>
- <td><div class="student_name"><?= $sData['fname'].''.$sData['lname']; ?></div></td>
+ <td><?= $sData['studentId']; ?></td>
+ <td><div class="student_name"><?= $sData['name']; ?></div></td>
<td><?= $sData['class_name']; ?></td>
- <td><?= $sData['contact_no']; ?></td>
+ <td><?= $sData['mobile']; ?></td>
<td>
- <div class="sub_tabbtnsec">
- <a href="<?= base_url(); ?>students-info"><div class="sub_editbtn"><i class="fas fa-user"></i></div></a>
+ <div>
+ <a href="<?= base_url(); ?>students-info/<?= $sData['id']; ?>"><div class="sub_editbtn"><i class="fas fa-user"></i></div></a>
</div>
</td>
</tr>
diff --git a/application/views/lms-admin/students.php b/application/views/lms-admin/students.php
index fadd302..4d26e56 100644
--- a/application/views/lms-admin/students.php
+++ b/application/views/lms-admin/students.php
@@ -7,7 +7,7 @@
<div class="common-heading">
<h2>Students</h2>
</div>
- <div class="select_div">
+ <!-- <div class="select_div">
<div class="form-group assign_subject">
<select class="form-control txtData" name="class" id="class" onchange="getStudentData(this.value)">
<option value="" selected disabled>Select Category</option>
@@ -16,7 +16,7 @@
<?php } } ?>
</select>
</div>
- </div>
+ </div> -->
<div class="" id="userLists">
<?php
if(isset($studentData))