From e71c4c7872d6692bd0cc6ffe3afb67c595675704 Mon Sep 17 00:00:00 2001 From: dotwingssoftware Date: Wed, 11 Jan 2023 12:47:57 +0530 Subject: [PATCH] 20230111 20230111 --- admin/application/config/routes.php | 15 +- admin/application/controllers/Dashboard.php | 27 -- admin/application/controllers/Degree.php | 142 +++++++ admin/application/controllers/Department.php | 38 +- admin/application/controllers/Employee.php | 39 +- admin/application/controllers/Project.php | 33 +- admin/application/controllers/Role.php | 16 +- admin/application/controllers/Welcome.php | 73 ++-- admin/application/models/Degree_model.php | 41 ++ admin/application/models/Department_model.php | 10 + admin/application/models/Employee_model.php | 9 +- admin/application/models/Project_model.php | 10 + .../add_degree.php} | 45 +- .../degree_list.php} | 23 +- .../views/department/add_department.php | 93 +++-- .../views/department/department_list.php | 9 +- .../edit_department.php} | 46 ++- .../views/department/zdepartment_list.php | 310 -------------- .../views/{add_emplayee => employee}/add.php | 55 +-- .../views/{add_emplayee => employee}/edit.php | 2 +- .../views/employee/{employee.php => list.php} | 2 +- admin/application/views/includes/header.php | 36 +- admin/application/views/includes/sidebar.php | 6 + .../application/views/project/add_project.php | 70 ++-- .../views/project/edit_project.php | 53 ++- .../views/project/project_list.php | 1 + admin/application/views/roles/role_list.php | 28 +- admin/assets/jquery.form-validator.min.js | 13 + admin/database.sql | 388 ------------------ css/style.css | 2 +- 30 files changed, 611 insertions(+), 1024 deletions(-) delete mode 100644 admin/application/controllers/Dashboard.php create mode 100644 admin/application/controllers/Degree.php create mode 100644 admin/application/models/Degree_model.php rename admin/application/views/{semester/zadd_semester.php => degree/add_degree.php} (67%) rename admin/application/views/{semester/zsemester_list.php => degree/degree_list.php} (86%) rename admin/application/views/{semester/zedit_semester.php => department/edit_department.php} (66%) delete mode 100644 admin/application/views/department/zdepartment_list.php rename admin/application/views/{add_emplayee => employee}/add.php (63%) rename admin/application/views/{add_emplayee => employee}/edit.php (97%) rename admin/application/views/employee/{employee.php => list.php} (97%) create mode 100644 admin/assets/jquery.form-validator.min.js delete mode 100644 admin/database.sql diff --git a/admin/application/config/routes.php b/admin/application/config/routes.php index 8fb530e..5ee8a33 100644 --- a/admin/application/config/routes.php +++ b/admin/application/config/routes.php @@ -53,6 +53,7 @@ $route['default_controller'] = 'welcome'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; $route['dashboard'] = 'welcome/dashboard'; +$route['logout'] = 'welcome/logout'; //Role// $route['roles'] = 'role/listrole'; @@ -63,16 +64,22 @@ $route['delete_role'] = 'role/deleterole'; //emplayee// $route['employee'] = 'employee/employee_list'; -$route['add'] = 'employee/add_list'; -$route['add_employee'] = 'employee/add_employee'; +$route['add-employee'] = 'employee/add_employee'; $route['edit_employees/(:num)'] = 'employee/editemployee/$1'; $route['deleted_employee'] = 'employee/deleted_employee'; //Department// $route['department'] = 'department/department_list'; $route['add_department'] = 'department/add_department'; -$route['edit_department'] = 'department/edit_department'; -$route['delete_department'] = 'department/delete_department'; +$route['edit_department/(:num)'] = 'department/edit_department/$1'; +$route['deleted_department'] = 'department/deleted_department'; + +//Degree// +$route['degree'] = 'degree/degree_list'; +$route['add_degree'] = 'degree/add_degree'; +$route['edit_degree/(:num)'] = 'department/edit_department/$1'; +$route['deleted_department'] = 'department/deleted_department'; + //Semester// $route['semester'] = 'semester/semester_list'; diff --git a/admin/application/controllers/Dashboard.php b/admin/application/controllers/Dashboard.php deleted file mode 100644 index d0bc3b4..0000000 --- a/admin/application/controllers/Dashboard.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @see https://codeigniter.com/user_guide/general/urls.html - */ - public function add() - { - $this->load->view('welcome/dashboarde'); - } - - -} diff --git a/admin/application/controllers/Degree.php b/admin/application/controllers/Degree.php new file mode 100644 index 0000000..1135d4c --- /dev/null +++ b/admin/application/controllers/Degree.php @@ -0,0 +1,142 @@ +load->model('Degree_model'); + $this->load->model('Commonsql_model'); + + } + + /** + * Index Page for this controller. + * + * Maps to the following URL + * http://example.com/index.php/welcome + * - or - + * http://example.com/index.php/welcome/index + * - or - + * Since this controller is set as the default controller in + * config/routes.php, it's displayed at http://example.com/ + * + * So any other public methods not prefixed with an underscore will + * map to /index.php/welcome/ + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function degree_list() + { + if($this->session->userdata('id')==""){redirect('');} + $data['deg']=$this->Degree_model->deg_list(); + $this->load->view('degree/degree_list',$data); + } + + + + function add_degree() + { + $data['dep']=$this->Degree_model->get_dep(); + $this->load->view('degree/add_degree',$data); + if($this->input->post('submit')) + { + $name=$this->input->post('name'); + $depId=$this->input->post('depId'); + + + $table="degree"; + + $values=array('name'=>$name, + 'departmentId'=>$depId, + 'createdOn'=>date('Y-m-d'), + 'createdBy'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->insert_table($table,$values); + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('degree'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('degree'); + } + + } + } + + + function edit_department($id) + { + + $data['dep']=$this->Department_model->get_dep($id); + //echo $this->db->last_query();exit; + $this->load->view('department/edit_department',$data); + + + if($this->input->post('submit')) + { + $name=$this->input->post('name'); + $code=$this->input->post('code'); + $year=$this->input->post('year'); + $image=$this->input->post('image'); + //$primaryid=$this->input->post('hiddendepid'); + + $table="department"; + $where=array("id"=>$id); + $values=array('name'=>$name, + 'code'=>$code, + 'year'=>$year, + 'image'=>$image, + 'updatedOn'=>date('Y-m-d'), + 'updatedBy'=>1, + 'status'=>1); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + //echo $this->db->last_query();exit; + if($result) + + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('department'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('department'); + } + + } + + } + + + function deleted_department() + { + if($this->input->post('submit')) + { + $id=$this->input->post('hiddenpass'); + //echo $id ; exit; + $table="department"; + $where=array("id"=>$id); + $values=array('status'=>0); + + $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('department'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('department'); + } + + } + } +} diff --git a/admin/application/controllers/Department.php b/admin/application/controllers/Department.php index 8e5c84d..7d1be4d 100644 --- a/admin/application/controllers/Department.php +++ b/admin/application/controllers/Department.php @@ -36,20 +36,21 @@ class Department extends CI_Controller { function add_department() { - $this->load->view('department/add_department'); if($this->input->post('submit')) { $name=$this->input->post('name'); $code=$this->input->post('code'); $year=$this->input->post('year'); + $image=$this->input->post('image'); $table="department"; $values=array('name'=>$name, 'code'=>$code, 'year'=>$year, - //'created_on'=>date('Y-m-d'), + 'image'=>$image, + 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, 'status'=>1); @@ -69,22 +70,29 @@ class Department extends CI_Controller { } - function edit_department() + function edit_department($id) { + + $data['dep']=$this->Department_model->get_dep($id); + //echo $this->db->last_query();exit; + $this->load->view('department/edit_department',$data); + + if($this->input->post('submit')) { - $name=$this->input->post('name'); $code=$this->input->post('code'); $year=$this->input->post('year'); - $primaryid=$this->input->post('hiddendepid'); + $image=$this->input->post('image'); + //$primaryid=$this->input->post('hiddendepid'); $table="department"; - $where=array("dep_id"=>$primaryid); + $where=array("id"=>$id); $values=array('name'=>$name, 'code'=>$code, 'year'=>$year, - //'updated_on'=>date('Y-m-d'), + 'image'=>$image, + 'updatedOn'=>date('Y-m-d'), 'updatedBy'=>1, 'status'=>1); @@ -101,23 +109,21 @@ class Department extends CI_Controller { $this->session->set_userdata('err','Please try again'); redirect('department'); } - //echo $this->db->last_query();exit; + } - //$this->load->view('department/department_list',$data); + } - function delete_department() + function deleted_department() { if($this->input->post('submit')) { - - $primaryid=$this->input->post('hiddengffgdtpid'); - //echo $primaryid ; exit; + $id=$this->input->post('hiddenpass'); + //echo $id ; exit; $table="department"; - $where=array("dep_id"=>$primaryid); - $values=array( - 'status'=>0); + $where=array("id"=>$id); + $values=array('status'=>0); $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 ea7a7c0..b82a7db 100644 --- a/admin/application/controllers/Employee.php +++ b/admin/application/controllers/Employee.php @@ -9,29 +9,24 @@ public function __construct() $this->load->model('Commonsql_model'); } - public function listrole() - { - $this->load->view('roles/role_list'); - } + public function employee_list() { $data['emp']=$this->Employee_model->list_emp(); - $this->load->view('employee/employee',$data); - } - public function add_list() - { - $this->load->view('add_emplayee/add'); + $this->load->view('employee/list',$data); } + function add_employee() { - + $data['role']=$this->Employee_model->list_role(); if($this->input->post('submit')) { $employeename=$this->input->post('employeename'); $mobileNumber=$this->input->post('mobileNumber'); + $roleId=$this->input->post('roleId'); $address=$this->input->post('address'); $email=$this->input->post('email'); $code=$this->input->post('code'); @@ -43,6 +38,7 @@ public function __construct() $table="employee"; $values=array('name'=>$employeename, 'mobileNumber'=>$mobileNumber, + 'roleId'=>$roleId, 'address'=>$address, 'email'=>$email, 'pincode'=>$code, @@ -54,18 +50,19 @@ public function __construct() 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); if($result) - { - $this->session->set_userdata('suc','successfully added'); - redirect('employee'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('employee'); - } + { + $this->session->set_userdata('suc','successfully added'); + redirect('employee'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('employee'); + } } + $this->load->view('employee/add',$data); } function editemployee($empid) { @@ -126,7 +123,7 @@ public function __construct() { if($this->input->post('submit')) { - $empid=$this->input->post('hiddenpass'); + $empid=$this->input->post('hiddenid'); $table="employee"; $where=array("id"=>$empid); diff --git a/admin/application/controllers/Project.php b/admin/application/controllers/Project.php index 597aa7c..911d3aa 100644 --- a/admin/application/controllers/Project.php +++ b/admin/application/controllers/Project.php @@ -38,6 +38,7 @@ class Project extends CI_Controller { $data['dep']=$this->Project_model->get_dep(); $data['stu']=$this->Project_model->get_stu(); $data['fac']=$this->Project_model->get_fac(); + $data['sub']=$this->Project_model->get_sub(); $this->load->view('project/add_project',$data); @@ -47,12 +48,13 @@ class Project extends CI_Controller { $date=$this->input->post('date'); $student=$this->input->post('student'); $semester=$this->input->post('semester'); - $gender=$this->input->post('gender'); + $subject=$this->input->post('subject'); + //$gender=$this->input->post('gender'); $department=$this->input->post('department'); - $designation=$this->input->post('designation'); + $description=$this->input->post('description'); $faculty=$this->input->post('faculty'); - $drivelink=$this->input->post('drive'); - $vedio=$this->input->post('vedio'); + $drivelink=$this->input->post('drivelink'); + $video=$this->input->post('vedio'); $image=$this->input->post('image'); $table="project"; @@ -61,11 +63,12 @@ class Project extends CI_Controller { 'student'=>$student, 'semester'=>$semester, 'department'=>$department, - 'gender'=>$gender, - 'designation'=>$designation, + 'subject'=>$subject, + //'gender'=>$gender, + 'description'=>$description, 'faculty'=>$faculty, 'drivelink'=>$drivelink, - 'vedio'=>$vedio, + 'vedio'=>$video, 'image'=>$image, 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, @@ -98,12 +101,13 @@ class Project extends CI_Controller { $date=$this->input->post('date'); $student=$this->input->post('student'); $semester=$this->input->post('semester'); - $gender=$this->input->post('gender'); + $subject=$this->input->post('subject'); + //$gender=$this->input->post('gender'); $department=$this->input->post('department'); - $designation=$this->input->post('designation'); + $description=$this->input->post('description'); $faculty=$this->input->post('faculty'); - $drivelink=$this->input->post('drive'); - $vedio=$this->input->post('vedio'); + $drivelink=$this->input->post('drivelink'); + $video=$this->input->post('vedio'); $image=$this->input->post('image'); @@ -113,12 +117,13 @@ class Project extends CI_Controller { 'date'=>$date, 'student'=>$student, 'semester'=>$semester, + 'subject'=>$subject, 'department'=>$department, - 'gender'=>$gender, - 'designation'=>$designation, + // 'gender'=>$gender, + 'description'=>$description, 'faculty'=>$faculty, 'drivelink'=>$drivelink, - 'vedio'=>$vedio, + 'vedio'=>$video, 'image'=>$image, 'updatedOn'=>date('Y-m-d'), 'updatedBy'=>1, diff --git a/admin/application/controllers/Role.php b/admin/application/controllers/Role.php index 7016110..bf88459 100644 --- a/admin/application/controllers/Role.php +++ b/admin/application/controllers/Role.php @@ -12,11 +12,13 @@ public function __construct() public function listrole() { + //if($this->session->userdata('id')==""){redirect('');} $data['rol']=$this->Role_model->list_rol(); $this->load->view('roles/role_list',$data); } function addrole() { + //if($this->session->userdata('id')==""){redirect('');} if($this->input->post('submit')) { $role=$this->input->post('rolename'); @@ -44,6 +46,7 @@ public function __construct() } function editrole() { + //if($this->session->userdata('id')==""){redirect('');} if($this->input->post('submit')) { $rolename=$this->input->post('rolename'); @@ -74,6 +77,7 @@ public function __construct() } function deleterole() { + //if($this->session->userdata('id')==""){redirect('');} if($this->input->post('submit')) { @@ -99,15 +103,5 @@ public function __construct() } } - - -//profile start// -public function profile_list() - { - //$data['rol']=$this->Role_model->list_rol(); - $this->load->view('profile'); - } - - - + } diff --git a/admin/application/controllers/Welcome.php b/admin/application/controllers/Welcome.php index 772ffff..eaec606 100644 --- a/admin/application/controllers/Welcome.php +++ b/admin/application/controllers/Welcome.php @@ -2,63 +2,58 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Welcome extends CI_Controller { + public function __construct() { parent::__construct(); $this->load->model('Common_model'); } - /** - * Index Page for this controller. - * - * Maps to the following URL - * http://example.com/index.php/welcome - * - or - - * http://example.com/index.php/welcome/index - * - or - - * Since this controller is set as the default controller in - * config/routes.php, it's displayed at http://example.com/ - * - * So any other public methods not prefixed with an underscore will - * map to /index.php/welcome/ - * @see https://codeigniter.com/user_guide/general/urls.html - */ public function index() { $this->load->view('login'); } + public function dashboard() { + $this->load->view('dashboard'); } + public function admin_login() { - $username=$this->input->post('username'); - $password=$this->input->post('password'); - - $check=$this->Common_model->get_login_detail($username,$password); - - if($check->num_rows()>0) - { - - $ch =$check->row(); - //$usertype=$ch->user_type; - //$this->session->set_userdata('user_type',$ch->user_type); - $this->session->set_userdata('username',$ch->username); - $this->session->set_userdata('id',$ch->id); - $this->session->set_userdata('suc',' Successfully Logged in..!'); - if($usertype!=2){ - redirect('dashboard');} - else{ - redirect('dashboard');} - } - else - { - $this->session->set_userdata('err','The username or password is incorrect.'); - redirect('dashboard'); - } + $username=$this->input->post('username'); + $password=$this->input->post('password'); + + $check=$this->Common_model->get_login_detail($username,$password); + + if($check->num_rows()>0) + { + $ch =$check->row(); + $this->session->set_userdata('username',$ch->username); + $this->session->set_userdata('id',$ch->id); + $this->session->set_userdata('suc',' Successfully Logged in..!'); + if($usertype!=2){ + redirect('dashboard');} + else{ + redirect('dashboard');} + } + else + { + $this->session->set_userdata('err','The username or password is incorrect.'); + redirect('dashboard'); + } } + public function logout() + { + $admin_id=$this->session->userdata('id'); + + $data = array('id' => '', 'username' => ''); + $this->session->unset_userdata($data); + $this->session->sess_destroy(); + redirect(''); + } } diff --git a/admin/application/models/Degree_model.php b/admin/application/models/Degree_model.php new file mode 100644 index 0000000..3763f64 --- /dev/null +++ b/admin/application/models/Degree_model.php @@ -0,0 +1,41 @@ +db->select('*'); + $this->db->from('degree'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + + function get_deg($id) + { + $this->db->select('*'); + $this->db->from('degree'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + + function get_dep() + { + $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; + } + +} diff --git a/admin/application/models/Department_model.php b/admin/application/models/Department_model.php index da3a074..ac35a34 100644 --- a/admin/application/models/Department_model.php +++ b/admin/application/models/Department_model.php @@ -17,5 +17,15 @@ class Department_model extends CI_Model { //echo $this->db->last_query();exit; return $query; } + + function get_dep($id) + { + $this->db->select('*'); + $this->db->from('department'); + $this->db->where(array('status'=>1,'id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } } diff --git a/admin/application/models/Employee_model.php b/admin/application/models/Employee_model.php index cbf9031..66a30d0 100644 --- a/admin/application/models/Employee_model.php +++ b/admin/application/models/Employee_model.php @@ -7,7 +7,14 @@ class Employee_model extends CI_Model { public function __construct() { parent::__construct(); } - + function list_role() + { + $this->db->select('id,name'); + $this->db->from('role'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + return $query; + } function list_emp() { $this->db->select('*'); diff --git a/admin/application/models/Project_model.php b/admin/application/models/Project_model.php index 8d39234..4ac672d 100644 --- a/admin/application/models/Project_model.php +++ b/admin/application/models/Project_model.php @@ -15,6 +15,7 @@ class Project_model extends CI_Model { $this->db->join('department as d','d.id=p.department','left' ); $this->db->join('student as s','s.id=p.student','left' ); $this->db->join('faculty as f','f.id=p.faculty','left' ); + //$this->db->join('subject as b','b.id=p.subject','left' ); $this->db->where(array('p.status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; @@ -59,5 +60,14 @@ class Project_model extends CI_Model { //echo $this->db->last_query();exit; return $query; } + function get_sub() + { + $this->db->select('*'); + $this->db->from('subject'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } } diff --git a/admin/application/views/semester/zadd_semester.php b/admin/application/views/degree/add_degree.php similarity index 67% rename from admin/application/views/semester/zadd_semester.php rename to admin/application/views/degree/add_degree.php index 62473c7..82569c2 100644 --- a/admin/application/views/semester/zadd_semester.php +++ b/admin/application/views/degree/add_degree.php @@ -9,12 +9,12 @@
-
Add Semester
+
Add Degree
@@ -23,33 +23,38 @@
-
Semester
+
Degree
-
+
+
+ +
+ +
+
-
- -
-
-
-
-
+
-
- -
-
-
diff --git a/admin/application/views/semester/zsemester_list.php b/admin/application/views/degree/degree_list.php similarity index 86% rename from admin/application/views/semester/zsemester_list.php rename to admin/application/views/degree/degree_list.php index dfcc53e..fb7ffda 100644 --- a/admin/application/views/semester/zsemester_list.php +++ b/admin/application/views/degree/degree_list.php @@ -11,12 +11,12 @@
-
Semester List
+
Degree List
@@ -29,7 +29,7 @@
+ data-toggle="modal" data-target="#mediumModel" >add
@@ -39,28 +39,29 @@ S.No + Department Name Action num_rows()>0) + if(isset($deg) && $deg->num_rows()>0) { $i=1; - foreach($sem->result() as $s) + foreach($deg->result() as $d) { - $id=$s->id; - $name=$s->name; + $id=$d->id; + $depId=$d->departmentId; + $name=$d->name; ?> + - - - + @@ -95,7 +96,7 @@
+
+
@@ -103,9 +106,6 @@
- - - @@ -118,21 +118,56 @@ load->view('includes/footer');?> - - + + + + \ No newline at end of file diff --git a/admin/application/views/department/department_list.php b/admin/application/views/department/department_list.php index bda7f4b..226d385 100644 --- a/admin/application/views/department/department_list.php +++ b/admin/application/views/department/department_list.php @@ -41,21 +41,22 @@ S.No Name Code - No Of The Year + Total Year Action num_rows()>0) + if(isset($dep) && $dep->num_rows()>0) { $i=1; - foreach($sem->result() as $s) + foreach($dep->result() as $s) { $id=$s->id; $name=$s->name; $code=$s->code; $year=$s->year; + $image=$s->image; ?> @@ -101,7 +102,7 @@
diff --git a/admin/application/views/employee/employee.php b/admin/application/views/employee/list.php similarity index 97% rename from admin/application/views/employee/employee.php rename to admin/application/views/employee/list.php index 61047a0..0b7306a 100644 --- a/admin/application/views/employee/employee.php +++ b/admin/application/views/employee/list.php @@ -29,7 +29,7 @@
+ data-toggle="modal" data-target="#mediumModel" >add
diff --git a/admin/application/views/includes/header.php b/admin/application/views/includes/header.php index 03dbb9d..30cf30b 100644 --- a/admin/application/views/includes/header.php +++ b/admin/application/views/includes/header.php @@ -47,16 +47,7 @@ -
-
- - - - - - -
-
+ @@ -68,7 +59,7 @@ - + - + +
  • - - Settings - -
  • -
  • - - Help - -
  • -
  • -
  • - - Lock - -
  • -
  • - + Log Out
  • diff --git a/admin/application/views/includes/sidebar.php b/admin/application/views/includes/sidebar.php index 2206132..2ee64e3 100644 --- a/admin/application/views/includes/sidebar.php +++ b/admin/application/views/includes/sidebar.php @@ -58,6 +58,12 @@ gamepad Department / Course + +