diff --git a/admin/application/config/routes.php b/admin/application/config/routes.php index cdc2cb6..0c32486 100644 --- a/admin/application/config/routes.php +++ b/admin/application/config/routes.php @@ -55,6 +55,7 @@ $route['translate_uri_dashes'] = FALSE; $route['login'] = 'welcome/login'; $route['dashboard'] = 'welcome/dashboard'; $route['logout'] = 'welcome/logout'; +$route['change-password'] = 'welcome/changePassword'; //Role// $route['roles'] = 'role/listrole'; diff --git a/admin/application/controllers/Degree.php b/admin/application/controllers/Degree.php index 410da0b..13619f1 100644 --- a/admin/application/controllers/Degree.php +++ b/admin/application/controllers/Degree.php @@ -28,6 +28,8 @@ class Degree extends CI_Controller { */ public function degree_list() { + if($this->session->userdata('id')==""){redirect('');} + $data['deg']=$this->Degree_model->deg_list(); $data['dep']=$this->Degree_model->get_dep(); $this->load->view('degree/degree_list',$data); @@ -36,6 +38,8 @@ class Degree extends CI_Controller { function add_degree() { if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['dep']=$this->Degree_model->get_dep(); $this->load->view('degree/add_degree',$data); if($this->input->post('submit')) @@ -49,7 +53,7 @@ class Degree extends CI_Controller { $values=array('name'=>$name, 'departmentId'=>$depId, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); @@ -85,6 +89,8 @@ class Degree extends CI_Controller { } function editDegree($id) { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); if($this->input->post('submit')) { @@ -96,7 +102,7 @@ class Degree extends CI_Controller { $values=array('name'=>$degName, 'departmentId'=>$depId, 'upadatedOn'=>date('Y-m-d'), - 'updatedBy'=>1); + 'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); //echo $this->db->last_query();exit; @@ -119,6 +125,9 @@ class Degree extends CI_Controller { function deleteDegree() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { @@ -126,7 +135,7 @@ class Degree extends CI_Controller { //echo $degreeId;exit; $table="degree"; $where=array("id"=>$degreeId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) diff --git a/admin/application/controllers/Department.php b/admin/application/controllers/Department.php index 72477d9..0a7529b 100644 --- a/admin/application/controllers/Department.php +++ b/admin/application/controllers/Department.php @@ -35,9 +35,11 @@ class Department extends CI_Controller { - function add_department() + function add_department() { if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $this->load->view('department/add_department'); if($this->input->post('submit')) { @@ -69,7 +71,7 @@ class Department extends CI_Controller { 'year'=>$year, 'image'=>$user_img, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); @@ -90,6 +92,9 @@ class Department extends CI_Controller { function editDepartment($id) { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $name=$this->input->post('name'); @@ -121,7 +126,7 @@ class Department extends CI_Controller { 'year'=>$year, 'image'=>$newImage, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1, + 'updatedBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->updateTable($table,$where,$values); @@ -147,13 +152,16 @@ class Department extends CI_Controller { function deleteDepartment() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $departmentId=$this->input->post('departmentId'); //echo $id ; exit; $table="department"; $where=array("id"=>$departmentId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) diff --git a/admin/application/controllers/Employee.php b/admin/application/controllers/Employee.php index 7c1b6a6..701e873 100644 --- a/admin/application/controllers/Employee.php +++ b/admin/application/controllers/Employee.php @@ -9,8 +9,6 @@ public function __construct() $this->load->model('Commonsql_model'); } - - public function employee_list() { if($this->session->userdata('id')==""){redirect('');} @@ -30,6 +28,7 @@ public function __construct() function add_employee() { if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); $data['role']=$this->Employee_model->list_role(); @@ -41,7 +40,6 @@ public function __construct() $roleId=$this->input->post('roleId'); $address=$this->input->post('address'); $email=$this->input->post('email'); - $code=$this->input->post('code'); $user=$this->input->post('User'); $password=$this->input->post('Password'); @@ -66,12 +64,11 @@ public function __construct() 'roleId'=>$roleId, 'address'=>$address, 'email'=>$email, - 'pincode'=>$code, 'image'=>$eImage, 'username'=>$user, 'password'=>md5($password), 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); //echo $this->db->last_query();exit; @@ -93,6 +90,8 @@ public function __construct() function editEmployee($empid) { if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $employeename=$this->input->post('employeename'); @@ -100,7 +99,6 @@ public function __construct() $mobileNumber=$this->input->post('mobileNumber'); $address=$this->input->post('address'); $email=$this->input->post('email'); - $code=$this->input->post('code'); $image=$this->input->post('image'); $hiddenImage=$this->input->post('hiddenImage'); $username=$this->input->post('username'); @@ -136,12 +134,11 @@ public function __construct() 'mobileNumber'=>$mobileNumber, 'address'=>$address, 'email'=>$email, - 'pincode'=>$code, 'username'=>$username, 'image'=>$newImage, 'password'=>$newpassword, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1, + 'updatedBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->updateTable($table,$where,$values); @@ -167,6 +164,8 @@ public function __construct() function deleteEmployee() { if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { //echo "test";exit; @@ -174,7 +173,7 @@ public function __construct() //echo $employeeId;exit; $table="employee"; $where=array("id"=>$employeeId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) diff --git a/admin/application/controllers/Faculty.php b/admin/application/controllers/Faculty.php index 75e697e..1f1975e 100644 --- a/admin/application/controllers/Faculty.php +++ b/admin/application/controllers/Faculty.php @@ -28,8 +28,10 @@ class Faculty extends CI_Controller { */ public function faculty_list() { - $data['fac']=$this->Faculty_model->list_fa(); - $this->load->view('faculty/faculty_list',$data); + if($this->session->userdata('id')==""){redirect('');} + + $data['fac']=$this->Faculty_model->list_fa(); + $this->load->view('faculty/faculty_list',$data); } public function viewFaculty($id) @@ -43,6 +45,8 @@ class Faculty extends CI_Controller { function add_faculty() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); $this->load->view('faculty/add_faculty'); @@ -89,9 +93,26 @@ class Faculty extends CI_Controller { 'designation'=>$desi, 'image'=>$f_img, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); + $facultyId=$this->db->insert_id(); + + $table="employee"; + $values=array('roleId'=>3, + 'typeId'=>$facultyId, + 'name'=>$name, + 'email'=>$email, + 'mobileNumber'=>$number, + 'address'=>$address, + 'image'=>$f_img, + 'username'=>$name, + 'password'=>md5($number), + 'createdOn'=>date('Y-m-d'), + 'createdBy'=>$currentUser, + 'status'=>1); + + $result=$this->Commonsql_model->insert_table($table,$values); if($result) { $this->session->set_userdata('suc','successfully added'); @@ -110,8 +131,11 @@ class Faculty extends CI_Controller { function editFaculty($id) { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); $data['fac']=$this->Faculty_model->get_fac($id); + $data['employee']=$this->Faculty_model->get_employee($id); $this->load->view('faculty/edit_faculty',$data); if($this->input->post('submit')) @@ -126,6 +150,7 @@ class Faculty extends CI_Controller { $desi=$this->input->post('designation'); $image=$this->input->post('image'); $hiddenImage=$this->input->post('hiddenImage'); + $employeeId=$this->input->post('employeeId'); if($image==""){$newImage=$hiddenImage;} @@ -154,10 +179,23 @@ class Faculty extends CI_Controller { 'designation'=>$desi, 'image'=>$newImage, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1); + 'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); - //echo $this->last_query();exit; + + $table="employee"; + $where=array("id"=>$employeeId); + $values=array('name'=>$name, + 'email'=>$email, + 'mobileNumber'=>$number, + 'address'=>$address, + 'image'=>$newImage, + 'username'=>$name, + 'password'=>md5($number), + 'createdOn'=>date('Y-m-d'), + 'updatedOn'=>date('Y-m-d'), + 'updatedBy'=>$currentUser); + $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) { $this->session->set_userdata('suc','successfully Updated'); @@ -171,21 +209,20 @@ class Faculty extends CI_Controller { } } - //echo "sdsd";exit; - - //echo $this->db->last_query();exit; - } function deleteFaculty() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $facultyId=$this->input->post('facultyId'); $table="faculty"; $where=array("id"=>$facultyId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) diff --git a/admin/application/controllers/Project.php b/admin/application/controllers/Project.php index f41ea99..9af02af 100644 --- a/admin/application/controllers/Project.php +++ b/admin/application/controllers/Project.php @@ -28,6 +28,8 @@ class Project extends CI_Controller { */ public function project_list() { + if($this->session->userdata('id')==""){redirect('');} + $data['pro']=$this->Project_model->list_pro(); $this->load->view('project/project_list',$data); } @@ -41,6 +43,9 @@ class Project extends CI_Controller { } function add_project() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['dep']=$this->Project_model->get_dep(); $data['stu']=$this->Project_model->get_stu(); $data['sub']=$this->Project_model->get_sub(); @@ -93,13 +98,14 @@ class Project extends CI_Controller { 'drivelink'=>$drivelink, 'vedio'=>$video, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); $projectId=$this->db->insert_id(); //Image table insert $title = $this->input->post('title'); + $muldescription = $this->input->post('muldescription'); foreach($title as $key=>$value) { @@ -123,6 +129,7 @@ class Project extends CI_Controller { $tablename='projectdetail'; $data=array('projectId'=>$projectId, 'title'=>$title[$key], + 'description'=>$muldescription[$key], 'image'=>$pImage, 'status'=>1); @@ -149,7 +156,10 @@ class Project extends CI_Controller { function editProject($id) - { + { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['dep']=$this->Project_model->get_dep(); $data['stu']=$this->Project_model->get_stu(); $data['sub']=$this->Project_model->get_sub(); @@ -201,16 +211,17 @@ class Project extends CI_Controller { 'drivelink'=>$drivelink, 'vedio'=>$video, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1); + 'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); //Image Multiple $title = $this->input->post('title'); + $muldescription = $this->input->post('muldescription'); $profileimage = $this->input->post('profileimage'); $projectDetailId = $this->input->post('projectDetailName'); $oldImage = $this->input->post('profileimageOld'); - //print_r ($projectDetailId);exit; + //print_r ($muldescription);exit; //Update old datas foreach($title as $key=>$value) @@ -239,6 +250,7 @@ class Project extends CI_Controller { } $tablename='projectdetail'; $data=array('title'=>$title[$key], + 'description'=>$muldescription[$key], 'image'=>$newImage); $where=array('id'=>$projectDetailId[$key]); $result=$this->Commonsql_model->updateTable($tablename,$where,$data); @@ -294,6 +306,7 @@ class Project extends CI_Controller { $tablename='projectdetail'; $data=array('projectId'=>$id, 'title'=>$title[$key], + 'description'=>$muldescription[$key], 'image'=>$image, 'status'=>1); @@ -322,13 +335,16 @@ class Project extends CI_Controller { function deleteProject() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $projectId=$this->input->post('projectId'); $table="project"; $where=array("id"=>$projectId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); $dTable="projectdetail"; diff --git a/admin/application/controllers/Role.php b/admin/application/controllers/Role.php index 7d1bb96..43ef704 100644 --- a/admin/application/controllers/Role.php +++ b/admin/application/controllers/Role.php @@ -19,6 +19,8 @@ public function __construct() function addrole() { if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $role=$this->input->post('rolename'); @@ -27,7 +29,7 @@ public function __construct() $values=array('name'=>$role, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); @@ -46,7 +48,9 @@ public function __construct() } function editrole() { - //if($this->session->userdata('id')==""){redirect('');} + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $rolename=$this->input->post('rolename'); @@ -56,7 +60,7 @@ public function __construct() $where=array("id"=>$primaryid); $values=array('name'=>$rolename, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1, + 'updatedBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->updateTable($table,$where,$values); @@ -77,7 +81,9 @@ public function __construct() } function deleterole() { - //if($this->session->userdata('id')==""){redirect('');} + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { @@ -86,7 +92,7 @@ public function __construct() $table="role"; $where=array("id"=>$primaryid); $values=array( - 'status'=>0); + 'status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) diff --git a/admin/application/controllers/Semester.php b/admin/application/controllers/Semester.php index 2a73ce5..d269dc2 100644 --- a/admin/application/controllers/Semester.php +++ b/admin/application/controllers/Semester.php @@ -28,6 +28,8 @@ class Semester extends CI_Controller { */ public function semester_list() { + if($this->session->userdata('id')==""){redirect('');} + $data['semester']=$this->Semester_model->list_semester(); $this->load->view('semester/semester_list',$data); } @@ -43,6 +45,9 @@ class Semester extends CI_Controller { function add_semester() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['subject']=$this->Semester_model->listSubject(); $data['department']=$this->Semester_model->listDepartment(); $data['degree']=$this->Semester_model->listDegree(); @@ -61,7 +66,7 @@ class Semester extends CI_Controller { $values=array( 'name'=>$name, 'year'=>$year, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); $semesterId=$this->db->insert_id(); @@ -105,6 +110,9 @@ class Semester extends CI_Controller { function editSemester($id) { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['subject']=$this->Semester_model->listSubject(); $data['degree']=$this->Semester_model->listDegree(); $data['getData']=$this->Semester_model->getSemester($id); @@ -122,7 +130,7 @@ class Semester extends CI_Controller { $values=array( 'name'=>$name, 'year'=>$year, 'updatedOn'=>date('Y-m-d'), - 'updatedby'=>1); + 'updatedby'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); //echo $this->db->last_query();exit; @@ -210,13 +218,16 @@ class Semester extends CI_Controller { function deleteSemester() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $semesterId=$this->input->post('semesterId'); $table="semester"; $where=array("id"=>$semesterId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); $table="semesterdetail"; diff --git a/admin/application/controllers/Student.php b/admin/application/controllers/Student.php index f4001c7..08964da 100644 --- a/admin/application/controllers/Student.php +++ b/admin/application/controllers/Student.php @@ -28,6 +28,7 @@ class Student extends CI_Controller { */ public function Student_list() { + if($this->session->userdata('id')==""){redirect('');} $data['stu']=$this->Student_model->list_stu(); $this->load->view('student/student_list',$data); } @@ -37,13 +38,15 @@ class Student extends CI_Controller { if($this->session->userdata('id')==""){redirect('');} $data['viewStudent']=$this->Student_model->viewStudent($id); - //echo $this->db->last_query();exit; $this->load->view('student/view_student',$data); } function add_student() { - $data['dep']=$this->Student_model->get_dep(); - $this->load->view('student/add_student',$data); + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + + $data['dep']=$this->Student_model->get_dep(); + $this->load->view('student/add_student',$data); if($this->input->post('submit')) @@ -86,7 +89,7 @@ class Student extends CI_Controller { 'image'=>$s_img, 'dob'=>$date, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); if($result) @@ -107,6 +110,9 @@ class Student extends CI_Controller { function editStudent($id) { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['dep']=$this->Student_model->get_dep(); $data['stu']=$this->Student_model->get_stu($id); @@ -146,8 +152,8 @@ class Student extends CI_Controller { 'dob'=>$date, 'gender'=>$gender, 'image'=>$s_img, - //'update_on'=>date('Y-m-d'), - // 'update_by'=>1, + 'update_on'=>date('Y-m-d'), + 'update_by'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->updateTable($table,$where,$values); @@ -170,13 +176,16 @@ class Student extends CI_Controller { function deleteStudent() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $studentId=$this->input->post('studentId'); $table="student"; $where=array("id"=>$studentId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) diff --git a/admin/application/controllers/Subject.php b/admin/application/controllers/Subject.php index e60b472..39207d7 100644 --- a/admin/application/controllers/Subject.php +++ b/admin/application/controllers/Subject.php @@ -26,8 +26,11 @@ class Subject extends CI_Controller { * map to /index.php/welcome/ * @see https://codeigniter.com/user_guide/general/urls.html */ + + public function subject_list() { + if($this->session->userdata('id')==""){redirect('');} $data['subject']=$this->Subject_model->list_subject(); $this->load->view('subject/subject_list',$data); } @@ -43,20 +46,25 @@ class Subject extends CI_Controller { function add_subject() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['degree']=$this->Subject_model->degreeList(); $data['faculty']=$this->Subject_model->facultyList(); - + //$data['semester']=$this->Subject_model->semesterList(); if($this->input->post('submit')) { $code=$this->input->post('subjectCode'); + $subtitle=$this->input->post('subtitle'); $subject=$this->input->post('subject'); $degree=$this->input->post('degree'); - //$target['tar'] = $this->input->post('tar'); - $faculty=$this->input->post('faculty'); + $faculty=$this->input->post('faculty'); + $teachingAssistant=$this->input->post('assistant'); $description=$this->input->post('description'); $faculties = implode(",", (array)$faculty); + $assistant = implode(",", (array)$teachingAssistant); //echo $faculties;exit; if (!is_dir('uploads/subject')) { mkdir('./uploads/subject', 0777, TRUE); @@ -78,12 +86,15 @@ class Subject extends CI_Controller { $table="subject"; $values=array('code'=>$code, 'name'=>$subject, + 'subtitle'=>$subtitle, 'degreeId'=>$degree, + //'semesterId'=>$semesterId, 'facultyId'=>$faculties, + 'teachingAssistant'=>$assistant, 'image'=>$user_img, 'description'=>$description, 'createdOn'=>date('Y-m-d'), - 'createdBy'=>1, + 'createdBy'=>$currentUser, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); @@ -144,27 +155,34 @@ class Subject extends CI_Controller { function editSubject($id) { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + $data['sub']=$this->Subject_model->get_sub($id); $data['degree']=$this->Subject_model->degreeList(); $data['faculty']=$this->Subject_model->facultyList(); $data['getMultipleImage']=$this->Subject_model->getMultipleImage($id); - ///echo $this->db->last_query();exit; + //echo $this->db->last_query();exit; if($this->input->post('submit')) { $code=$this->input->post('code'); $sub=$this->input->post('subject'); + $subtitle=$this->input->post('subtitle'); $degreeId=$this->input->post('degree'); - $semester=$this->input->post('semester'); + //$semester=$this->input->post('semester'); $faculty=$this->input->post('faculty'); + $teachingAssistant=$this->input->post('assistant'); + $description=$this->input->post('description'); $image=$this->input->post('image'); $hiddenImage=$this->input->post('hiddenImage'); - + //print_r ($faculty); $faculties = implode(",", (array)$faculty); + $assistant = implode(",", (array)$teachingAssistant); //echo $faculties;exit; if($image==""){$newImage=$hiddenImage;} @@ -186,12 +204,14 @@ class Subject extends CI_Controller { $where=array("id"=>$id); $values=array('code'=>$code, 'name'=>$sub, + 'subtitle'=>$subtitle, 'degreeId'=>$degreeId, 'facultyId'=>$faculties, + 'teachingAssistant'=>$assistant, 'description'=>$description, 'image'=>$newImage, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1); + 'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); //echo $this->db->last_query();exit; @@ -315,13 +335,16 @@ class Subject extends CI_Controller { function deleteSubject() { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + if($this->input->post('submit')) { $subjectId=$this->input->post('subjectId'); $table="subject"; $where=array("id"=>$subjectId); - $values=array('status'=>0); + $values=array('status'=>0,'updatedOn'=>date('Y-m-d'),'updatedBy'=>$currentUser); $result=$this->Commonsql_model->updateTable($table,$where,$values); $dTable="subjectdetail"; diff --git a/admin/application/controllers/Welcome.php b/admin/application/controllers/Welcome.php index f207aed..e2426ae 100644 --- a/admin/application/controllers/Welcome.php +++ b/admin/application/controllers/Welcome.php @@ -7,6 +7,7 @@ class Welcome extends CI_Controller { { parent::__construct(); $this->load->model('Common_model'); + $this->load->model('Commonsql_model'); $this->load->model('Project_model'); } @@ -36,8 +37,9 @@ class Welcome extends CI_Controller { //echo $this->db->last_query();exit; if($check->num_rows()>0) { - $ch =$check->row(); + $ch=$check->row(); $this->session->set_userdata('username',$ch->username); + $this->session->set_userdata('role',$ch->roleId); $this->session->set_userdata('id',$ch->id); $this->session->set_userdata('suc',' Successfully Logged in..!'); redirect('dashboard'); @@ -59,5 +61,56 @@ class Welcome extends CI_Controller { $this->session->sess_destroy(); redirect(''); } - + public function getOldPassword() + { + $id=$_POST['employeeId']; + $oldpassword=$_POST['oldPassword']; + $currentPassword=md5($oldpassword); + + $password=$this->Project_model->getOldPassword($id); + if(isset($password) && $password->num_rows()>0) + { + $li=$password->row(); + $dbpassword=$li->password; + } + if($currentPassword==$dbpassword) + { + echo "true"; + }else + { + echo "false"; + } + + } + public function changePassword() + { + if($this->session->userdata('id')==""){redirect('');} + $currentUser=$this->session->userdata('id'); + + if($this->input->post('submit')) + { + + $newpassword=$this->input->post('newpassword'); + $employeeId=$this->input->post('employeeId'); + + $table="employee"; + $where=array("id"=>$employeeId); + $values=array('password'=>md5($newpassword), + 'updatedBy'=>$currentUser); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('change-password'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('change-password'); + } + + } + $this->load->view('changepassword'); + } } diff --git a/admin/application/models/Faculty_model.php b/admin/application/models/Faculty_model.php index 14420b8..f60297e 100644 --- a/admin/application/models/Faculty_model.php +++ b/admin/application/models/Faculty_model.php @@ -20,9 +20,10 @@ class Faculty_model extends CI_Model { function get_fac($id) { - $this->db->select('*'); - $this->db->from('faculty'); - $this->db->where(array('status'=>1,'id'=>$id)); + $this->db->select('f.*,e.id as employeeId'); + $this->db->from('faculty as f'); + $this->db->join('employee as e','e.typeId=f.id','INNER'); + $this->db->where(array('f.status'=>1,'f.id'=>$id,'e.roleId'=>3)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; diff --git a/admin/application/models/Project_model.php b/admin/application/models/Project_model.php index ae6fcb7..ec82230 100644 --- a/admin/application/models/Project_model.php +++ b/admin/application/models/Project_model.php @@ -71,7 +71,7 @@ class Project_model extends CI_Model { } function get_semester() { - $this->db->select('id,name'); + $this->db->select('id,name,year'); $this->db->from('semester'); $this->db->where(array('status'=>1)); $query = $this->db->get(); @@ -148,11 +148,19 @@ class Project_model extends CI_Model { } function getMultipleImage($id) { - $this->db->select('id,title,image,projectId'); + $this->db->select('id,title,image,projectId,description as muldescription'); $this->db->from('projectdetail'); $this->db->where(array('status'=>1,'projectId'=>$id)); $query = $this->db->get(); //echo $this->db->last_query(); return $query; } + function getOldPassword($id) + { + $this->db->select('password'); + $this->db->from('employee'); + $this->db->where(array('status'=>1,'id'=>$id)); + $result = $this->db->get(); + return $result; + } } diff --git a/admin/application/models/Semester_model.php b/admin/application/models/Semester_model.php index edaa0a0..00f54f0 100644 --- a/admin/application/models/Semester_model.php +++ b/admin/application/models/Semester_model.php @@ -17,7 +17,7 @@ class Semester_model extends CI_Model { //echo $this->db->last_query();exit; return $query; } - + function listSubject() { $this->db->select('id,name'); @@ -80,4 +80,15 @@ class Semester_model extends CI_Model { $query = $this->db->get(); return $query; } + function getDegree($semesterId) + { + $this->db->select('deg.id as degId,deg.name as degName,sub.id as subjectId'); + $this->db->from('semesterdetail as sd'); + $this->db->join('degree as deg','deg.id=sd.degreeId','INNER'); + $this->db->join('subject as sub ','sub.id=sd.subjectId','INNER'); + $this->db->where(array('sd.status'=>1,'sd.semesterId'=>$semesterId)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } } diff --git a/admin/application/models/Subject_model.php b/admin/application/models/Subject_model.php index cb7ea2c..e4e0289 100644 --- a/admin/application/models/Subject_model.php +++ b/admin/application/models/Subject_model.php @@ -16,6 +16,15 @@ class Subject_model extends CI_Model { //echo $this->db->last_query();exit; return $query; } + function semesterList() + { + $this->db->select('id,name,year'); + $this->db->from('semester'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } function facultyList() { $this->db->select('id,name'); diff --git a/admin/application/views/changepassword.php b/admin/application/views/changepassword.php new file mode 100644 index 0000000..5a2abe9 --- /dev/null +++ b/admin/application/views/changepassword.php @@ -0,0 +1,111 @@ + +load->view('includes/header');?> +session->userdata('id'); +?> +
+ + load->view('includes/sidebar');?> + +
+
+
+
+
+
My Profile
+
+ +
+
+ + load->view('includes/msg');?> +
+
+
+
+
+
+
+ +
+ + + + + + +
+ +
+
+ +
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+ +
+ + +load->view('includes/footer');?> + + + \ No newline at end of file diff --git a/admin/application/views/dashboard.php b/admin/application/views/dashboard.php index 604278c..607a9e9 100644 --- a/admin/application/views/dashboard.php +++ b/admin/application/views/dashboard.php @@ -107,7 +107,7 @@
diff --git a/admin/application/views/employee/add.php b/admin/application/views/employee/add.php index 0006a86..e855302 100644 --- a/admin/application/views/employee/add.php +++ b/admin/application/views/employee/add.php @@ -90,16 +90,6 @@
-
- -
- -
-
- -
-
- -
- -
-
+

-
Pincode -
-

-
+
Username

diff --git a/admin/application/views/faculty/edit_faculty.php b/admin/application/views/faculty/edit_faculty.php index 4aec9cb..e74dd08 100644 --- a/admin/application/views/faculty/edit_faculty.php +++ b/admin/application/views/faculty/edit_faculty.php @@ -57,7 +57,9 @@ $gender=$f->gender; $mobileNumber=$f->mobileNumber; $designation=$f->designation; - $image=$f->image; + $image=$f->image; + + $employeeId=$f->employeeId; if($gender==1){$genType="Male";}else{$genType="Female";} } ?>
@@ -84,6 +86,7 @@
+
+
+load->view('includes/footer');?> \ No newline at end of file diff --git a/admin/application/views/profile.php b/admin/application/views/profile.php deleted file mode 100644 index 707617c..0000000 --- a/admin/application/views/profile.php +++ /dev/null @@ -1,68 +0,0 @@ - -load->view('includes/header');?> -
- - load->view('includes/sidebar');?> - -
-
-
-
-
-
My Profile
-
- -
-
- -
-
-
-
-
My Profile
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
- - -
-
-
-
-
-
-
-
-
-
- -
-
- - - - - load->view('includes/footer');?> \ No newline at end of file diff --git a/admin/application/views/project/add_project.php b/admin/application/views/project/add_project.php index 81a5c9e..4da2f68 100644 --- a/admin/application/views/project/add_project.php +++ b/admin/application/views/project/add_project.php @@ -87,7 +87,7 @@ { foreach($semester->result() as $sem) { - ?> @@ -148,31 +148,32 @@ *
- +
-
+
-
+
-
- +
@@ -206,17 +204,21 @@ { $id =$list->id ; $title=$list->title; + $muldescription=$list->muldescription; $image=$list->image; $projectId=$list->projectId; ?>
-