S.No | -Department | -Name | -Action | -
---|---|---|---|
=$i;?> | -=$depId;?> | -=$name;?> | -- - - - - - - - - | -
Do You Wante Delete?
- ++
+
=$mobileNumber;?>
++
=$address;?>
++
=$email;?>
++
+
=$pincode;?>
++
=$username;?>
+diff --git a/admin/application/config/autoload.php b/admin/application/config/autoload.php index b960eab..3291ed4 100644 --- a/admin/application/config/autoload.php +++ b/admin/application/config/autoload.php @@ -132,4 +132,4 @@ $autoload['language'] = array(); | | $autoload['model'] = array('first_model' => 'first'); */ -$autoload['model'] = array(); +$autoload['model'] = array(''); diff --git a/admin/application/config/routes.php b/admin/application/config/routes.php index 5ee8a33..ba431a0 100644 --- a/admin/application/config/routes.php +++ b/admin/application/config/routes.php @@ -52,6 +52,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $route['default_controller'] = 'welcome'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; +$route['login'] = 'welcome/login'; $route['dashboard'] = 'welcome/dashboard'; $route['logout'] = 'welcome/logout'; @@ -65,47 +66,42 @@ $route['delete_role'] = 'role/deleterole'; //emplayee// $route['employee'] = 'employee/employee_list'; $route['add-employee'] = 'employee/add_employee'; -$route['edit_employees/(:num)'] = 'employee/editemployee/$1'; -$route['deleted_employee'] = 'employee/deleted_employee'; +$route['view-employee/(:num)'] = 'employee/viewEmployee/$1'; +$route['edit-employee/(:num)'] = 'employee/editEmployee/$1'; + //Department// $route['department'] = 'department/department_list'; $route['add_department'] = 'department/add_department'; -$route['edit_department/(:num)'] = 'department/edit_department/$1'; -$route['deleted_department'] = 'department/deleted_department'; +$route['edit-department/(:num)'] = 'department/editDepartment/$1'; //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'; - +$route['edit-degree/(:num)'] = 'degree/editDegree/$1'; //Semester// $route['semester'] = 'semester/semester_list'; -$route['add_semester'] = 'semester/add_semester'; -$route['edit_semester'] = 'semester/edit_semester'; -$route['deleted_semester'] = 'semester/deleted_semester'; - +$route['add-semester'] = 'semester/add_semester'; +$route['edit-semester/(:num)'] = 'semester/editSemester/$1'; //subject// $route['subject'] = 'subject/subject_list'; -$route['add_subject'] = 'subject/add_subject'; -$route['edit_subject/(:num)'] = 'subject/edit_subject/$1'; -$route['deleted_subject'] = 'subject/deleted_subject'; - +$route['add-subject'] = 'subject/add_subject'; +$route['view-subject/(:num)'] = 'subject/viewSubject/$1'; +$route['edit-subject/(:num)'] = 'subject/editSubject/$1'; //faculty// $route['faculty'] = 'faculty/faculty_list'; $route['add_faculty'] = 'faculty/add_faculty'; -$route['edit_faculty/(:num)'] = 'faculty/edit_faculty/$1'; -$route['deleted_faculty'] = 'faculty/deleted_faculty'; - +$route['view-faculty/(:num)'] = 'faculty/viewFaculty/$1'; +$route['edit-faculty/(:num)'] = 'faculty/editFaculty/$1'; //student// $route['student'] = 'student/student_list'; $route['add_student'] = 'student/add_student'; +$route['view-student/(:num)'] = 'student/viewStudent/$1'; $route['edit_student/(:num)'] = 'student/edit_student/$1'; $route['deleted_student'] = 'student/deleted_student'; @@ -113,5 +109,6 @@ $route['deleted_student'] = 'student/deleted_student'; //project// $route['project'] = 'project/project_list'; $route['add_project'] = 'project/add_project'; +$route['view-project/(:num)'] = 'project/viewProject/$1'; $route['edit_project/(:num)'] = 'project/edit_project/$1'; $route['deleted_project'] = 'project/deleted_project'; \ No newline at end of file diff --git a/admin/application/controllers/Degree.php b/admin/application/controllers/Degree.php index 1135d4c..410da0b 100644 --- a/admin/application/controllers/Degree.php +++ b/admin/application/controllers/Degree.php @@ -28,15 +28,14 @@ class Degree extends CI_Controller { */ public function degree_list() { - if($this->session->userdata('id')==""){redirect('');} $data['deg']=$this->Degree_model->deg_list(); - $this->load->view('degree/degree_list',$data); + $data['dep']=$this->Degree_model->get_dep(); + $this->load->view('degree/degree_list',$data); } - - - function add_degree() + function add_degree() { + if($this->session->userdata('id')==""){redirect('');} $data['dep']=$this->Degree_model->get_dep(); $this->load->view('degree/add_degree',$data); if($this->input->post('submit')) @@ -68,32 +67,36 @@ class Degree extends CI_Controller { } } - - function edit_department($id) + function getDegree() + { + if($this->session->userdata('id')==""){redirect('');} + $id=$_POST['id']; + $tableName="degree"; + $select=array('id','name','departmentId'); + $where=array('id'=>$id); + $degree=$this->Commonsql_model->selectTable($tableName,$where,$select); + if($degree->num_rows()>0){ + $list1=$degree->row(); + $id=$list1->id; + $name=$list1->name; + $departmentId=$list1->departmentId; + } + echo $id.'-'.$name.'-'.$departmentId; + } + function editDegree($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'); + $degName=$this->input->post('degreeName'); + $depId=$this->input->post('depId'); - $table="department"; + $table="degree"; $where=array("id"=>$id); - $values=array('name'=>$name, - 'code'=>$code, - 'year'=>$year, - 'image'=>$image, - 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1, - 'status'=>1); + $values=array('name'=>$degName, + 'departmentId'=>$depId, + 'upadatedOn'=>date('Y-m-d'), + 'updatedBy'=>1); $result=$this->Commonsql_model->updateTable($table,$where,$values); //echo $this->db->last_query();exit; @@ -101,12 +104,12 @@ class Degree extends CI_Controller { { $this->session->set_userdata('suc','successfully Updated'); - redirect('department'); + redirect('degree'); } else { $this->session->set_userdata('err','Please try again'); - redirect('department'); + redirect('degree'); } } @@ -114,28 +117,29 @@ class Degree extends CI_Controller { } - function deleted_department() + function deleteDegree() { if($this->input->post('submit')) { - $id=$this->input->post('hiddenpass'); - //echo $id ; exit; - $table="department"; - $where=array("id"=>$id); + + $degreeId=$this->input->post('degreeId'); + //echo $degreeId;exit; + $table="degree"; + $where=array("id"=>$degreeId); $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'); - } + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('degree'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('degree'); + } } } diff --git a/admin/application/controllers/Department.php b/admin/application/controllers/Department.php index 7d1be4d..72477d9 100644 --- a/admin/application/controllers/Department.php +++ b/admin/application/controllers/Department.php @@ -28,6 +28,7 @@ class Department extends CI_Controller { */ public function department_list() { + if($this->session->userdata('id')==""){redirect('');} $data['dep']=$this->Department_model->dep_list(); $this->load->view('department/department_list',$data); } @@ -36,20 +37,37 @@ class Department extends CI_Controller { function add_department() { + if($this->session->userdata('id')==""){redirect('');} $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'); + + if (!is_dir('uploads/department')) { + mkdir('./uploads/department', 0777, TRUE); + } + + + if(file_exists($_FILES['depImage']['tmp_name'])) + { + $temp_user_img=$_FILES['depImage']['tmp_name']; + $user_img=str_replace(' ', '_', $_FILES["depImage"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($user_img, PATHINFO_EXTENSION); + $user_img=date('ymdhis').'.'.$extension1; + $targetPath='./uploads/department/'; + $targetFile=$targetPath.$user_img; + move_uploaded_file($temp_user_img, $targetFile); + } $table="department"; $values=array('name'=>$name, 'code'=>$code, 'year'=>$year, - 'image'=>$image, + 'image'=>$user_img, 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, 'status'=>1); @@ -70,28 +88,38 @@ class Department extends CI_Controller { } - function edit_department($id) + function editDepartment($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'); + $hiddenImage=$this->input->post('hiddenImage'); //$primaryid=$this->input->post('hiddendepid'); + if($image=="") + { + $newImage=$hiddenImage; + } + if(file_exists($_FILES['image']['tmp_name'])) + { + $temp_user_img=$_FILES['image']['tmp_name']; + $newImage=str_replace(' ', '_', $_FILES["image"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($newImage, PATHINFO_EXTENSION); + $newImage=date('ymdhis').'.'.$extension1; + $targetPath='./uploads/department/'; + $targetFile=$targetPath.$newImage; + move_uploaded_file($temp_user_img, $targetFile); + } $table="department"; $where=array("id"=>$id); $values=array('name'=>$name, 'code'=>$code, 'year'=>$year, - 'image'=>$image, + 'image'=>$newImage, 'updatedOn'=>date('Y-m-d'), 'updatedBy'=>1, 'status'=>1); @@ -111,18 +139,20 @@ class Department extends CI_Controller { } } - + $data['dep']=$this->Department_model->get_dep($id); + //echo $this->db->last_query();exit; + $this->load->view('department/edit_department',$data); } - function deleted_department() + function deleteDepartment() { if($this->input->post('submit')) { - $id=$this->input->post('hiddenpass'); + $departmentId=$this->input->post('departmentId'); //echo $id ; exit; $table="department"; - $where=array("id"=>$id); + $where=array("id"=>$departmentId); $values=array('status'=>0); $result=$this->Commonsql_model->updateTable($table,$where,$values); diff --git a/admin/application/controllers/Employee.php b/admin/application/controllers/Employee.php index b82a7db..7c1b6a6 100644 --- a/admin/application/controllers/Employee.php +++ b/admin/application/controllers/Employee.php @@ -13,28 +13,53 @@ public function __construct() public function employee_list() { + if($this->session->userdata('id')==""){redirect('');} $data['emp']=$this->Employee_model->list_emp(); $this->load->view('employee/list',$data); } - + public function viewEmployee($id) + { + if($this->session->userdata('id')==""){redirect('');} + + $data['viewEmployee']=$this->Employee_model->viewEmployee($id); + //echo $this->db->last_query();exit; + $this->load->view('employee/viewemployee',$data); + } function add_employee() { + if($this->session->userdata('id')==""){redirect('');} + $data['role']=$this->Employee_model->list_role(); + if($this->input->post('submit')) { + //echo "dsdsd";exit; $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'); - $img=$this->input->post('img'); $user=$this->input->post('User'); $password=$this->input->post('Password'); - + if (!is_dir('uploads/employee')) { + mkdir('./uploads/employee', 0777, TRUE); + + } + if(file_exists($_FILES['employeeImg']['tmp_name'])) + { + $temp_user_img=$_FILES['employeeImg']['tmp_name']; + $eImage=str_replace(' ', '_', $_FILES["employeeImg"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($eImage, PATHINFO_EXTENSION); + $eImage=date('ymdhi').'.'.$extension1; + $targetPath='./uploads/employee/'; + $targetFile=$targetPath.$eImage; + move_uploaded_file($temp_user_img, $targetFile); + } $table="employee"; $values=array('name'=>$employeename, 'mobileNumber'=>$mobileNumber, @@ -42,13 +67,14 @@ public function __construct() 'address'=>$address, 'email'=>$email, 'pincode'=>$code, - 'image'=>$img, + 'image'=>$eImage, 'username'=>$user, - 'password'=>$password, + 'password'=>md5($password), 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); + //echo $this->db->last_query();exit; if($result) { $this->session->set_userdata('suc','successfully added'); @@ -64,84 +90,104 @@ public function __construct() } $this->load->view('employee/add',$data); } - function editemployee($empid) + function editEmployee($empid) { + if($this->session->userdata('id')==""){redirect('');} if($this->input->post('submit')) { $employeename=$this->input->post('employeename'); + $roleId=$this->input->post('roleId'); $mobileNumber=$this->input->post('mobileNumber'); $address=$this->input->post('address'); $email=$this->input->post('email'); $code=$this->input->post('code'); - $img=$this->input->post('img'); - $user=$this->input->post('User'); - $password=$this->input->post('Password'); - $hiddenpass=$this->input->post('hiddenpass'); + $image=$this->input->post('image'); + $hiddenImage=$this->input->post('hiddenImage'); + $username=$this->input->post('username'); + $password=$this->input->post('password'); + $hiddenPassword=$this->input->post('hiddenPassword'); if($password=="") { - $newpassword=$hiddenpass; + $newpassword=$hiddenPassword; } else { $newpassword=md5($password); } + if($image==""){ + $newImage=$hiddenImage; + } + + if(file_exists($_FILES['image']['tmp_name'])) + { + $temp_user_img=$_FILES['image']['tmp_name']; + $newImage=str_replace(' ', '_', $_FILES["image"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($newImage, PATHINFO_EXTENSION); + $newImage=date('ymdhi').'.'.$extension1; + $targetPath='./uploads/employee/'; + $targetFile=$targetPath.$newImage; + move_uploaded_file($temp_user_img, $targetFile); + } $table="employee"; $where=array("id"=>$empid); $values=array('name'=>$employeename, + 'roleId'=>$roleId, 'mobileNumber'=>$mobileNumber, 'address'=>$address, 'email'=>$email, 'pincode'=>$code, - 'username'=>$user, - 'image'=>$img, + 'username'=>$username, + 'image'=>$newImage, 'password'=>$newpassword, '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('employee'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('employee'); - } + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('employee'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('employee'); + } } - //echo "sdsd";exit; - $data['emp']=$this->Employee_model->get_emp($empid); - //echo $this->db->last_query();exit; - $this->load->view('add_emplayee/edit',$data); + $data['role']=$this->Employee_model->list_role(); + $data['emp']=$this->Employee_model->viewEmployee($empid); + $this->load->view('employee/edit',$data); } - function deleted_employee() + function deleteEmployee() { + if($this->session->userdata('id')==""){redirect('');} if($this->input->post('submit')) { - $empid=$this->input->post('hiddenid'); - + //echo "test";exit; + $employeeId=$this->input->post('employeeId'); + //echo $employeeId;exit; $table="employee"; - $where=array("id"=>$empid); - $values=array( - 'status'=>0); - + $where=array("id"=>$employeeId); + $values=array('status'=>0); $result=$this->Commonsql_model->updateTable($table,$where,$values); + if($result) - { - $this->session->set_userdata('suc','successfully deleted'); - redirect('employee'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('employee'); - } + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('employee'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('employee'); + } } } } diff --git a/admin/application/controllers/Faculty.php b/admin/application/controllers/Faculty.php index e607f54..75e697e 100644 --- a/admin/application/controllers/Faculty.php +++ b/admin/application/controllers/Faculty.php @@ -32,7 +32,14 @@ class Faculty extends CI_Controller { $this->load->view('faculty/faculty_list',$data); } - + public function viewFaculty($id) + { + if($this->session->userdata('id')==""){redirect('');} + + $data['viewFaculty']=$this->Faculty_model->viewFaculty($id); + //echo $this->db->last_query();exit; + $this->load->view('faculty/view_faculty',$data); + } function add_faculty() { @@ -41,23 +48,43 @@ class Faculty extends CI_Controller { if($this->input->post('submit')) { - $faculty=$this->input->post('code'); + $faculty=$this->input->post('facultyId'); $name=$this->input->post('name'); $email=$this->input->post('email'); - //$dob=$this->input->post('dob'); + $date=$this->input->post('date'); $gender=$this->input->post('gender'); - $number=$this->input->post('mobile'); + $number=$this->input->post('mobileNumber'); $address=$this->input->post('address'); $desi=$this->input->post('designation'); $f_img=$this->input->post('image'); + //echo $date.'-------'.$dateofbirth;exit; + //$banner_image=$this->input->post('banner_image'); + + + if (!is_dir('uploads/faculty')) { + mkdir('./uploads/faculty', 0777, TRUE); + + } + if(file_exists($_FILES['image']['tmp_name'])) + { + $temp_user_img=$_FILES['image']['tmp_name']; + $f_img=str_replace(' ', '_', $_FILES["image"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($f_img, PATHINFO_EXTENSION); + $f_img=date('ymdhi').'.'.$extension1; + $targetPath='./uploads/faculty/'; + $targetFile=$targetPath.$f_img; + move_uploaded_file($temp_user_img, $targetFile); + } + $table="faculty"; - $values=array('code'=>$faculty, + $values=array('facultyId'=>$faculty, 'name'=>$name, 'email'=>$email, - //'dob'=>$dob, + 'dob'=>$date, 'gender'=>$gender, - 'mobile'=>$number, + 'mobileNumber'=>$number, 'address'=>$address, 'designation'=>$desi, 'image'=>$f_img, @@ -81,7 +108,7 @@ class Faculty extends CI_Controller { } - function edit_faculty($id) + function editFaculty($id) { $data['fac']=$this->Faculty_model->get_fac($id); @@ -89,44 +116,59 @@ class Faculty extends CI_Controller { if($this->input->post('submit')) { - $faculty=$this->input->post('code'); + $facultyId=$this->input->post('facultyId'); $name=$this->input->post('name'); $email=$this->input->post('email'); - //$dob=$this->input->post('dob'); $gender=$this->input->post('gender'); - $number=$this->input->post('number'); + $number=$this->input->post('mobileNumber'); + $dob=$this->input->post('dob'); $address=$this->input->post('address'); $desi=$this->input->post('designation'); - $f_img=$this->input->post('image'); + $image=$this->input->post('image'); + $hiddenImage=$this->input->post('hiddenImage'); - + if($image==""){$newImage=$hiddenImage;} + + if(file_exists($_FILES['image']['tmp_name'])) + { + $temp_user_img=$_FILES['image']['tmp_name']; + $newImage=str_replace(' ', '_', $_FILES["image"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($newImage, PATHINFO_EXTENSION); + $newImage=date('ymdhi').'.'.$extension1; + $targetPath='./uploads/faculty/'; + $targetFile=$targetPath.$newImage; + move_uploaded_file($temp_user_img, $targetFile); + } + + $table="faculty"; $where=array("id"=>$id); - $values=array('code'=>$faculty, + $values=array('facultyId'=>$facultyId, 'name'=>$name, 'email'=>$email, - //'dob'=>$dob, + 'dob'=>$dob, 'gender'=>$gender, - 'mobile'=>$number, + 'mobileNumber'=>$number, 'address'=>$address, 'designation'=>$desi, - 'image'=>$f_img, + 'image'=>$newImage, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1, - 'status'=>1); + 'updatedBy'=>1); $result=$this->Commonsql_model->updateTable($table,$where,$values); + //echo $this->last_query();exit; if($result) - { - $this->session->set_userdata('suc','successfully Updated'); - redirect('faculty'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('faculty'); - } + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('faculty'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('faculty'); + } } //echo "sdsd";exit; @@ -135,29 +177,28 @@ class Faculty extends CI_Controller { } - function deleted_faculty() + function deleteFaculty() { if($this->input->post('submit')) { - $id=$this->input->post('hiddenpass'); + $facultyId=$this->input->post('facultyId'); $table="faculty"; - $where=array("id"=>$id); - $values=array( - 'status'=>0); + $where=array("id"=>$facultyId); + $values=array('status'=>0); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) - { - $this->session->set_userdata('suc','successfully deleted'); - redirect('faculty'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('faculty'); - } + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('faculty'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('faculty'); + } } } diff --git a/admin/application/controllers/Project.php b/admin/application/controllers/Project.php index 911d3aa..a4f4696 100644 --- a/admin/application/controllers/Project.php +++ b/admin/application/controllers/Project.php @@ -29,64 +29,122 @@ class Project extends CI_Controller { public function project_list() { $data['pro']=$this->Project_model->list_pro(); - $this->load->view('project/project_list',$data); + $this->load->view('project/project_list',$data); + } + public function viewProject($id) + { + if($this->session->userdata('id')==""){redirect('');} + + $data['viewProject']=$this->Project_model->viewProject($id); + //echo $this->db->last_query();exit; + $this->load->view('project/view_project',$data); } - - function add_project() { - $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); - + $data['dep']=$this->Project_model->get_dep(); + $data['stu']=$this->Project_model->get_stu(); + $data['sub']=$this->Project_model->get_sub(); + $data['semester']=$this->Project_model->get_semester(); if($this->input->post('submit')) { + $name=$this->input->post('projectName'); $date=$this->input->post('date'); + //$pDate= implode("-", array_reverse(explode("-", $date))); $student=$this->input->post('student'); - $semester=$this->input->post('semester'); + $code=$this->input->post('code'); + $semesterId=$this->input->post('semesterId'); $subject=$this->input->post('subject'); - //$gender=$this->input->post('gender'); $department=$this->input->post('department'); $description=$this->input->post('description'); - $faculty=$this->input->post('faculty'); $drivelink=$this->input->post('drivelink'); $video=$this->input->post('vedio'); - $image=$this->input->post('image'); + + + if (!is_dir('uploads/project')) { + mkdir('./uploads/project', 0777, TRUE); + } + + + if(file_exists($_FILES['titleImage']['tmp_name'])) + { + $temp_user_img=$_FILES['titleImage']['tmp_name']; + $user_img=str_replace(' ', '_', $_FILES["titleImage"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($user_img, PATHINFO_EXTENSION); + $user_img='title'.date('ymdhis').'.'.$extension1; + $targetPath='./uploads/project/'; + $targetFile=$targetPath.$user_img; + move_uploaded_file($temp_user_img, $targetFile); + } $table="project"; $values=array('projectName'=>$name, 'date'=>$date, - 'student'=>$student, - 'semester'=>$semester, - 'department'=>$department, - 'subject'=>$subject, - //'gender'=>$gender, + 'studentId'=>$student, + 'semesterId'=>$semesterId, + 'departmentId'=>$department, + 'subjectId'=>$subject, + 'code'=>$code, + 'image'=>$user_img, 'description'=>$description, - 'faculty'=>$faculty, + //'faculty'=>$faculty, 'drivelink'=>$drivelink, 'vedio'=>$video, - 'image'=>$image, '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('project'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('project'); - } + $projectId=$this->db->insert_id(); + //Image table insert + $title = $this->input->post('title'); + + foreach($title as $key=>$value) + { + if($_FILES['profileimage']['tmp_name']) + { + if (!is_dir('uploads/project')) { + mkdir('./uploads/project', 0777, TRUE); + } + $temp_vehicle_doc=$_FILES['profileimage']['tmp_name'][$key]; + $projectImage=str_replace(' ', '_', $_FILES["profileimage"]["name"][$key]); + $extension1 = pathinfo($projectImage, PATHINFO_EXTENSION); + $pImage=$projectId.'.'.$projectImage; + $document='uploads/project/'.$pImage; + + $targetPath = './uploads/project/'; + $targetFile=$targetPath.$pImage; + + + if(move_uploaded_file($temp_vehicle_doc, $targetFile)) + { + $tablename='projectdetail'; + $data=array('projectId'=>$projectId, + 'title'=>$title[$key], + 'image'=>$pImage, + 'status'=>1); + + $product=$this->Commonsql_model->insert_table($tablename,$data); + //echo $this->db->last_query(); + + } + } + } + //exit; + if($result) + { + $this->session->set_userdata('suc','successfully added'); + redirect('project'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('project'); + } } + $this->load->view('project/add_project',$data); } @@ -105,7 +163,7 @@ class Project extends CI_Controller { //$gender=$this->input->post('gender'); $department=$this->input->post('department'); $description=$this->input->post('description'); - $faculty=$this->input->post('faculty'); + //$faculty=$this->input->post('faculty'); $drivelink=$this->input->post('drivelink'); $video=$this->input->post('vedio'); $image=$this->input->post('image'); @@ -115,13 +173,13 @@ class Project extends CI_Controller { $where=array("id"=>$id); $values=array('projectName'=>$name, 'date'=>$date, - 'student'=>$student, - 'semester'=>$semester, - 'subject'=>$subject, - 'department'=>$department, + 'studentId'=>$student, + 'semesterId'=>$semester, + 'subjectId'=>$subject, + 'departmentId'=>$department, // 'gender'=>$gender, 'description'=>$description, - 'faculty'=>$faculty, + //'faculty'=>$faculty, 'drivelink'=>$drivelink, 'vedio'=>$video, 'image'=>$image, @@ -146,29 +204,35 @@ class Project extends CI_Controller { } - function deleted_project() + function deleteProject() { if($this->input->post('submit')) { - $id=$this->input->post('hiddenpass'); + $projectId=$this->input->post('projectId'); $table="project"; - $where=array("id"=>$id); - $values=array( - 'status'=>0); + $where=array("id"=>$projectId); + $values=array('status'=>0); + $dTable="projectdetail"; + $dWhere=array("projectId"=>$projectId); + $dValue=array('status'=>0); + $result=$this->Commonsql_model->updateTable($table,$where,$values); - if($result) - { - $this->session->set_userdata('suc','successfully deleted'); - redirect('project'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('project'); - } + + $dResult=$this->Commonsql_model->updateTable($dTable,$dWhere,$dValue); + //echo $this->db->last_query();exit; + if($result && $dResult) + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('project'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('project'); + } } } diff --git a/admin/application/controllers/Role.php b/admin/application/controllers/Role.php index bf88459..7d1bb96 100644 --- a/admin/application/controllers/Role.php +++ b/admin/application/controllers/Role.php @@ -12,13 +12,13 @@ public function __construct() public function listrole() { - //if($this->session->userdata('id')==""){redirect('');} + 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->session->userdata('id')==""){redirect('');} if($this->input->post('submit')) { $role=$this->input->post('rolename'); diff --git a/admin/application/controllers/Semester.php b/admin/application/controllers/Semester.php index c0bd604..18c35e0 100644 --- a/admin/application/controllers/Semester.php +++ b/admin/application/controllers/Semester.php @@ -28,28 +28,39 @@ class Semester extends CI_Controller { */ public function semester_list() { - $data['sem']=$this->Semester_model->list_sem(); - $this->load->view('semester/semester_list',$data); + $data['semester']=$this->Semester_model->list_semester(); + $this->load->view('semester/semester_list',$data); } function add_semester() { + $data['subject']=$this->Semester_model->listSubject(); + $data['department']=$this->Semester_model->listDepartment(); + $data['degree']=$this->Semester_model->listDegree(); //$this->load->view('semester/add_semester'); if($this->input->post('submit')) { $name=$this->input->post('name'); - - + $year=$this->input->post('year'); + $subjectId=$this->input->post('subjectId'); + $departmentId=$this->input->post('departmentId'); + $degreeId=$this->input->post('degreeId'); + ///echo $departmentId; + //echo $degreeId; $table="semester"; $values=array('name'=>$name, - - 'createdOn'=>date('Y-m-d'), + 'year'=>$year, + 'subjectId'=>$subjectId, + 'departmentId'=>$departmentId, + 'degreeId'=>$degreeId, + 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); + //echo $this->db->last_query();exit; if($result) { $this->session->set_userdata('suc','successfully added'); @@ -62,70 +73,75 @@ class Semester extends CI_Controller { redirect('semester'); } - } + } + $this->load->view('semester/add_semester',$data); } - function edit_semester() + function editSemester($id) { if($this->input->post('submit')) { $name=$this->input->post('name'); - $id=$this->input->post('hiddendepid'); + $year=$this->input->post('year'); + $subjectId=$this->input->post('subjectId'); + $departmentId=$this->input->post('departmentId'); + $degreeId=$this->input->post('degreeId'); - - $table="semester"; $where=array("id"=>$id); - $values=array('name'=>$name, - - 'updatedOn'=>date('Y-m-d'), - 'updatedby'=>1, - 'status'=>1); + $values=array( 'name'=>$name, + 'year'=>$year, + 'subjectId'=>$subjectId, + 'departmentId'=>$departmentId, + 'degreeId'=>$degreeId, + 'updatedOn'=>date('Y-m-d'), + 'updatedby'=>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('semester'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('semester'); - } + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('semester'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('semester'); + } } - //echo "sdsd";exit; - - //echo $this->db->last_query();exit; - + $data['subject']=$this->Semester_model->listSubject(); + $data['department']=$this->Semester_model->listDepartment(); + $data['degree']=$this->Semester_model->listDegree(); + $data['getData']=$this->Semester_model->getSemester($id); + $this->load->view('semester/edit_semester',$data); } - function deleted_semester() + function deleteSemester() { if($this->input->post('submit')) { - $id=$this->input->post('hiddengffgdtpid'); + $semesterId=$this->input->post('semesterId'); $table="semester"; - $where=array("id"=>$id); - $values=array( - 'status'=>0); + $where=array("id"=>$semesterId); + $values=array('status'=>0); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) - { - $this->session->set_userdata('suc','successfully deleted'); - redirect('semester'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('semester'); - } + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('semester'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('semester'); + } } } diff --git a/admin/application/controllers/Student.php b/admin/application/controllers/Student.php index 9fe744c..331c9c5 100644 --- a/admin/application/controllers/Student.php +++ b/admin/application/controllers/Student.php @@ -29,10 +29,17 @@ class Student extends CI_Controller { public function Student_list() { $data['stu']=$this->Student_model->list_stu(); - $this->load->view('student/Student_list',$data); + $this->load->view('student/student_list',$data); } - + public function viewStudent($id) + { + 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(); @@ -42,19 +49,42 @@ class Student extends CI_Controller { if($this->input->post('submit')) { $name=$this->input->post('name'); - $number=$this->input->post('number'); + $email=$this->input->post('email'); + $number=$this->input->post('mobileNumber'); $address=$this->input->post('address'); $department=$this->input->post('department'); + $student=$this->input->post('student'); $gender=$this->input->post('gender'); $s_img=$this->input->post('image'); + $date=$this->input->post('date'); + //$dob= implode("-", array_reverse(explode("-", $date))); + if (!is_dir('uploads/student')) { + mkdir('./uploads/student', 0777, TRUE); + + } + if(file_exists($_FILES['image']['tmp_name'])) + { + $temp_user_img=$_FILES['image']['tmp_name']; + $s_img=str_replace(' ', '_', $_FILES["image"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($s_img, PATHINFO_EXTENSION); + $s_img=date('ymdhi').'.'.$extension1; + $targetPath='./uploads/student/'; + $targetFile=$targetPath.$s_img; + move_uploaded_file($temp_user_img, $targetFile); + } + $table="student"; $values=array('name'=>$name, - 'number'=>$number, + 'mobileNumber'=>$number, + 'email'=>$email, 'address'=>$address, 'department'=>$department, + 'studentId'=>$student, 'gender'=>$gender, 'image'=>$s_img, + 'dob'=>$date, 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, 'status'=>1); @@ -84,9 +114,10 @@ class Student extends CI_Controller { if($this->input->post('submit')) { $name=$this->input->post('name'); - $number=$this->input->post('number'); + $number=$this->input->post('mobileNumber'); $address=$this->input->post('address'); $department=$this->input->post('department'); + $student=$this->input->post('student'); $gender=$this->input->post('gender'); $s_img=$this->input->post('image'); @@ -94,7 +125,8 @@ class Student extends CI_Controller { $table="student"; $where=array("id"=>$id); $values=array('name'=>$name, - 'number'=>$number, + 'mobileNumber'=>$number, + 'studentId'=>$student, 'address'=>$address, 'department'=>$department, 'gender'=>$gender, @@ -123,29 +155,28 @@ class Student extends CI_Controller { } - function deleted_student() + function deleteStudent() { if($this->input->post('submit')) { - $id=$this->input->post('hiddenpass'); + $studentId=$this->input->post('studentId'); $table="student"; - $where=array("id"=>$id); - $values=array( - 'status'=>0); + $where=array("id"=>$studentId); + $values=array('status'=>0); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) - { - $this->session->set_userdata('suc','successfully deleted'); - redirect('student'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('student'); - } + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('student'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('student'); + } } } diff --git a/admin/application/controllers/Subject.php b/admin/application/controllers/Subject.php index 710f327..00c7b6a 100644 --- a/admin/application/controllers/Subject.php +++ b/admin/application/controllers/Subject.php @@ -28,27 +28,60 @@ class Subject extends CI_Controller { */ public function subject_list() { - $data['sub']=$this->Subject_model->list_sub(); - $this->load->view('subject/subject_list',$data); + $data['subject']=$this->Subject_model->list_subject(); + $this->load->view('subject/subject_list',$data); } -function add_subject() + public function viewSubject($id) { + if($this->session->userdata('id')==""){redirect('');} + + $data['viewSubject']=$this->Subject_model->viewSubject($id); + //echo $this->db->last_query();exit; + $this->load->view('subject/view_subject',$data); + } + + function add_subject() + { + $data['degree']=$this->Subject_model->degreeList(); + $data['faculty']=$this->Subject_model->facultyList(); - $this->load->view('subject/add_subject'); if($this->input->post('submit')) { - $code=$this->input->post('code'); - $sub=$this->input->post('subject'); - $dep=$this->input->post('department'); - $semester=$this->input->post('semester'); + $code=$this->input->post('subjectCode'); + $subject=$this->input->post('subject'); + $degree=$this->input->post('degree'); + //$target['tar'] = $this->input->post('tar'); + $faculty=$this->input->post('faculty'); + $description=$this->input->post('description'); + + $faculties = implode(",", (array)$faculty); + //echo $faculties;exit; + if (!is_dir('uploads/subject')) { + mkdir('./uploads/subject', 0777, TRUE); + } + + if(file_exists($_FILES['profileImage']['tmp_name'])) + { + $temp_user_img=$_FILES['profileImage']['tmp_name']; + $user_img=str_replace(' ', '_', $_FILES["profileImage"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($user_img, PATHINFO_EXTENSION); + $user_img=date('ymdhis').'.'.$extension1; + $targetPath='./uploads/subject/'; + $targetFile=$targetPath.$user_img; + move_uploaded_file($temp_user_img, $targetFile); + } + $table="subject"; $values=array('code'=>$code, - 'subject'=>$sub, - 'department'=>$dep, - 'semester'=>$semester, + 'name'=>$subject, + 'degreeId'=>$degree, + 'facultyId'=>$faculties, + 'image'=>$user_img, + 'description'=>$description, 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, 'status'=>1); @@ -66,78 +99,104 @@ function add_subject() } } + $this->load->view('subject/add_subject',$data); } - function edit_subject($id) + function editSubject($id) { - $data['sub']=$this->Subject_model->get_sub($id); - //echo $this->db->last_query();exit; - $this->load->view('subject/edit_subject',$data); + $data['degree']=$this->Subject_model->degreeList(); + $data['faculty']=$this->Subject_model->facultyList(); + if($this->input->post('submit')) { $code=$this->input->post('code'); $sub=$this->input->post('subject'); - $dep=$this->input->post('department'); + $degreeId=$this->input->post('degree'); $semester=$this->input->post('semester'); + $faculty=$this->input->post('faculty'); + $description=$this->input->post('description'); + $image=$this->input->post('image'); + $hiddenImage=$this->input->post('hiddenImage'); + + //print_r ($faculty); + $faculties = implode(",", (array)$faculty); + //echo $faculties;exit; + + if($image==""){$newImage=$hiddenImage;} + + + if(file_exists($_FILES['image']['tmp_name'])) + { + $temp_user_img=$_FILES['image']['tmp_name']; + $newImage=str_replace(' ', '_', $_FILES["image"]["name"]); + $allowed = array('png,jpeg,jpg'); + $extension1 = pathinfo($newImage, PATHINFO_EXTENSION); + $newImage=date('ymdhis').'.'.$extension1; + $targetPath='./uploads/subject/'; + $targetFile=$targetPath.$newImage; + move_uploaded_file($temp_user_img, $targetFile); + } $table="subject"; $where=array("id"=>$id); $values=array('code'=>$code, - 'subject'=>$sub, - 'department'=>$dep, - 'semester'=>$semester, + 'name'=>$sub, + 'degreeId'=>$degreeId, + 'facultyId'=>$faculties, + 'description'=>$description, + 'image'=>$newImage, 'updatedOn'=>date('Y-m-d'), - 'updatedBy'=>1, - 'status'=>1); + 'updatedBy'=>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('subject'); - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('subject'); - } + { + $this->session->set_userdata('suc','successfully Updated'); + redirect('subject'); + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('subject'); + } } + + $this->load->view('subject/edit_subject',$data); } - function deleted_subject() + function deleteSubject() { if($this->input->post('submit')) { - $id=$this->input->post('hiddenpass'); + $subjectId=$this->input->post('subjectId'); $table="subject"; - $where=array("id"=>$id); - $values=array( - 'status'=>0); + $where=array("id"=>$subjectId); + $values=array('status'=>0); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) - { - $this->session->set_userdata('suc','successfully deleted'); - redirect('subject'); - - } - else - { - $this->session->set_userdata('err','Please try again'); - redirect('subject'); - } + { + $this->session->set_userdata('suc','successfully deleted'); + redirect('subject'); + + } + else + { + $this->session->set_userdata('err','Please try again'); + redirect('subject'); + } } } diff --git a/admin/application/controllers/Welcome.php b/admin/application/controllers/Welcome.php index eaec606..f207aed 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('Project_model'); } public function index() @@ -17,32 +18,35 @@ class Welcome extends CI_Controller { public function dashboard() { - $this->load->view('dashboard'); + $data['project']=$this->Project_model->totalProjects(); + $data['student']=$this->Project_model->totalStudents(); + $data['subject']=$this->Project_model->totalSubject(); + $data['faculty']=$this->Project_model->totalFaculties(); + $data['projectList']=$this->Project_model->recentlyAddedProject(); + $this->load->view('dashboard',$data); } - public function admin_login() + public function login() { - + //echo "dsds";exit; $username=$this->input->post('username'); $password=$this->input->post('password'); $check=$this->Common_model->get_login_detail($username,$password); - + //echo $this->db->last_query();exit; 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');} + $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..!'); + redirect('dashboard'); + } else { - $this->session->set_userdata('err','The username or password is incorrect.'); - redirect('dashboard'); + $this->session->set_userdata('err','The username or password is incorrect.'); + redirect(''); } } @@ -55,5 +59,5 @@ class Welcome extends CI_Controller { $this->session->sess_destroy(); redirect(''); } - + } diff --git a/admin/application/models/Common_model.php b/admin/application/models/Common_model.php index 0ddf672..d654672 100644 --- a/admin/application/models/Common_model.php +++ b/admin/application/models/Common_model.php @@ -103,8 +103,8 @@ class Common_model extends CI_Model { public function get_login_detail($username,$password) { - $this->db->select('*'); - $this->db->from('user'); + $this->db->select('*'); + $this->db->from('employee'); $this->db->where('username',$username); $this->db->where(array('password'=>md5($password),'status'=>1)); $query = $this->db->get(); diff --git a/admin/application/models/Degree_model.php b/admin/application/models/Degree_model.php index 3763f64..0fe7c0c 100644 --- a/admin/application/models/Degree_model.php +++ b/admin/application/models/Degree_model.php @@ -10,9 +10,10 @@ class Degree_model extends CI_Model { function deg_list() { - $this->db->select('*'); - $this->db->from('degree'); - $this->db->where(array('status'=>1)); + $this->db->select('deg.*,d.id as departmentId,d.name as departmentName'); + $this->db->from('degree as deg'); + $this->db->join('department as d','d.id=deg.departmentId','INNER'); + $this->db->where(array('deg.status'=>1)); $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 66a30d0..05168f2 100644 --- a/admin/application/models/Employee_model.php +++ b/admin/application/models/Employee_model.php @@ -24,6 +24,16 @@ class Employee_model extends CI_Model { //echo $this->db->last_query();exit; return $query; } + function viewEmployee($id) + { + $this->db->select('e.*,r.id as roleId,r.name as roleName'); + $this->db->from('employee as e'); + $this->db->join('role as r','r.id=e.roleId','INNER'); + $this->db->where(array('e.status'=>1,'e.id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } function get_emp($id) { $this->db->select('*'); diff --git a/admin/application/models/Faculty_model.php b/admin/application/models/Faculty_model.php index 1de75b8..14420b8 100644 --- a/admin/application/models/Faculty_model.php +++ b/admin/application/models/Faculty_model.php @@ -18,7 +18,7 @@ class Faculty_model extends CI_Model { return $query; } - function get_fac($id) + function get_fac($id) { $this->db->select('*'); $this->db->from('faculty'); @@ -27,5 +27,15 @@ class Faculty_model extends CI_Model { //echo $this->db->last_query();exit; return $query; } + + function viewFaculty($id) + { + $this->db->select('*'); + $this->db->from('faculty'); + $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/Project_model.php b/admin/application/models/Project_model.php index 4ac672d..5367984 100644 --- a/admin/application/models/Project_model.php +++ b/admin/application/models/Project_model.php @@ -10,12 +10,12 @@ class Project_model extends CI_Model { function list_pro() { - $this->db->select('p.*,d.name as deptname,s.name as studentName,f.name as facultyName'); + $this->db->select('p.*,d.name as depName,s.name as studentName,sem.name as semName,sub.name as subName'); $this->db->from('project as p'); - $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->join('student as s','s.id=p.studentId','INNER'); + $this->db->join('semester as sem','sem.id=p.semesterId','INNER'); + $this->db->join('department as d','d.id=p.departmentId','INNER'); + $this->db->join('subject as sub','sub.id=p.subjectId','INNER'); $this->db->where(array('p.status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; @@ -62,12 +62,88 @@ class Project_model extends CI_Model { } function get_sub() { - $this->db->select('*'); + $this->db->select('id,name'); $this->db->from('subject'); $this->db->where(array('status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } - + function get_semester() + { + $this->db->select('id,name'); + $this->db->from('semester'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + function viewProject($id) + { + $this->db->select('p.projectName,p.date as pDate,p.studentId,p.code,p.description,p.image, + p.vedio,p.driveLink,s.name as studentName,sem.name as semName,d.name as depName,sub.name as subName'); + $this->db->from('project as p'); + $this->db->join('student as s','s.id=p.studentId','INNER'); + $this->db->join('semester as sem','sem.id=p.semesterId','INNER'); + $this->db->join('department as d','d.id=p.departmentId','INNER'); + $this->db->join('subject as sub','sub.id=p.subjectId','INNER'); + $this->db->where(array('p.status'=>1,'p.id'=>$id)); + $query = $this->db->get(); + return $query; + } + function recentlyAddedProject() + { + $this->db->select('p.*,d.name as depName,s.name as studentName,sem.name as semName,sub.name as subName'); + $this->db->from('project as p'); + $this->db->order_by("p.id", "desc"); + $this->db->limit(10); + $this->db->join('student as s','s.id=p.studentId','INNER'); + $this->db->join('semester as sem','sem.id=p.semesterId','INNER'); + $this->db->join('department as d','d.id=p.departmentId','INNER'); + $this->db->join('subject as sub','sub.id=p.subjectId','INNER'); + $this->db->where(array('p.status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + function totalProjects() + { + //orders + $this->db->select('count(id) as tProjects'); + $this->db->from('project'); + $this->db->where(array('status'=>1)); + $result = $this->db->get(); + //echo $this->db->last_query(); exit; + return $result; + } + function totalStudents() + { + //orders + $this->db->select('count(id) as tStudents'); + $this->db->from('student'); + $this->db->where(array('status'=>1)); + $result = $this->db->get(); + //echo $this->db->last_query(); exit; + return $result; + } + function totalSubject() + { + //orders + $this->db->select('count(id) as tSubjects'); + $this->db->from('subject'); + $this->db->where(array('status'=>1)); + $result = $this->db->get(); + //echo $this->db->last_query(); exit; + return $result; + } + function totalFaculties() + { + //orders + $this->db->select('count(id) as tFaculties'); + $this->db->from('faculty'); + $this->db->where(array('status'=>1)); + $result = $this->db->get(); + //echo $this->db->last_query(); exit; + return $result; + } } diff --git a/admin/application/models/Semester_model.php b/admin/application/models/Semester_model.php index 4e548ef..0116fda 100644 --- a/admin/application/models/Semester_model.php +++ b/admin/application/models/Semester_model.php @@ -8,24 +8,54 @@ class Semester_model extends CI_Model { parent::__construct(); } - function list_sem() + function list_semester() { - $this->db->select('*'); - $this->db->from('Semester'); + $this->db->select('s.id,s.name,s.year,sub.id as subId,sub.name as subName,dep.id as depId,dep.name as depName,deg.id as degId,deg.name as degName'); + $this->db->from('Semester as s'); + $this->db->join('subject as sub','sub.id=s.subjectId','INNER'); + $this->db->join('department as dep','dep.id=s.departmentId','INNER'); + $this->db->join('degree as deg','deg.id=s.degreeId','INNER'); + $this->db->where(array('s.status'=>1,)); + $query = $this->db->get(); + //'sub.status'=>1,'dep.status'=>1,'deg.status'=>1 + //echo $this->db->last_query();exit; + return $query; + } + + function listSubject() + { + $this->db->select('id,name'); + $this->db->from('subject'); $this->db->where(array('status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } - - function get_sem($id) + function listDepartment() { - $this->db->select('*'); - $this->db->from('semester'); - $this->db->where(array('status'=>1,'id'=>$id)); + $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; + } function listDegree() + { + $this->db->select('id,name'); + $this->db->from('degree'); + $this->db->where(array('status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } + function getSemester($id) + { + $this->db->select('*'); + $this->db->from('semester'); + $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/Student_model.php b/admin/application/models/Student_model.php index ad6ebff..b0b4e75 100644 --- a/admin/application/models/Student_model.php +++ b/admin/application/models/Student_model.php @@ -37,6 +37,16 @@ class Student_model extends CI_Model { $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; + } - + function viewStudent($id) + { + $this->db->select('s.*,d.name as depName'); + $this->db->from('student as s'); + $this->db->join('department as d','d.id=s.department','INNER'); + $this->db->where(array('s.status'=>1,'s.id'=>$id)); + $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 55c8d63..fe78a4f 100644 --- a/admin/application/models/Subject_model.php +++ b/admin/application/models/Subject_model.php @@ -7,16 +7,33 @@ class Subject_model extends CI_Model { public function __construct() { parent::__construct(); } - - function list_sub() + function degreeList() { - $this->db->select('*'); - $this->db->from('subject'); + $this->db->select('id, name'); + $this->db->from('degree'); $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'); + $this->db->from('faculty'); + $this->db->where(array('status'=>1)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + function list_subject() + { + $this->db->select('s.id ,s.name,s.code,d.name as depName'); + $this->db->from('subject as s'); + $this->db->join('degree as d','d.id=s.degreeId','INNER'); + $this->db->where(array('s.status'=>1,'d.status'=>1)); + $query = $this->db->get(); + return $query; + } function get_sub($id) { @@ -27,5 +44,24 @@ class Subject_model extends CI_Model { //echo $this->db->last_query();exit; return $query; } - + function viewSubject($id) + { + $this->db->select('sub.*,deg.name as degName,f.id as facId,f.name as facName'); + $this->db->from('subject as sub'); + $this->db->join('degree as deg','deg.id=sub.degreeId','INNER'); + $this->db->join('faculty as f','f.id=sub.facultyId','INNER'); + $this->db->where(array('sub.status'=>1,'sub.id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query();exit; + return $query; + } + function get_faculty($id) + { + $this->db->select('*'); + $this->db->from('faculty'); + $this->db->where(array('id'=>$id)); + $query = $this->db->get(); + //echo $this->db->last_query(); + return $query; + } } diff --git a/admin/application/views/dashboard.php b/admin/application/views/dashboard.php index c8b2900..604278c 100644 --- a/admin/application/views/dashboard.php +++ b/admin/application/views/dashboard.php @@ -25,9 +25,15 @@
S.No | -Date | -Project Name | -Subject | -Student Name | -Actions | +S.No | +Date | +Project Code | +Student | +Semester | +Subject | +Department | +Action |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- 1 - | -12/05/2016 | -- Test 1 - | -English | -- Dr.Rajesh - | +=$i;?> | +=$date;?> | +=$code;?> | +=$studentName;?> | +=$semName;?> | +=$subName;?> | +=$depName;?> |
-
-
-
- |
- |
- 2 - | - -12/05/2016 | -Test 2 | -English | -- Dr.Sarah Smith - | -
-
-
-
-
- |
- ||||||||
- 3 - | - -12/05/2016 | -Test 3 | - -English | -- Dr.Rajesh - | -
-
-
-
-
- |
- ||||||||
- 4 - | -12/05/2016 | - -Test 3 | -English | -- Dr.Megha Trivedi - | -
-
-
-
-
- |
- ||||||||
- 5 - | -12/05/2016 | -Test 4 | - -English | -- Dr.Sarah Smith - | -
-
-
-
-
- |
- ||||||||
- 6 - | -12/05/2016 | - -Test 5 | -English | -- Dr.Megha Trivedi - | -
-
-
-
+
+ View
+
|
S.No | -Department | -Name | -Action | -
---|---|---|---|
=$i;?> | -=$depId;?> | -=$name;?> | -- - - - - - - - - | -
Do You Wante Delete?
- +=$mobileNumber;?>
+=$address;?>
+=$email;?>
+=$pincode;?>
+=$username;?>
+