Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Admin extends CI_Controller {
- public function __construct() {
- parent::__construct();
- $this->data['user'] = array(
- 'username' => $_SESSION['userData']['username'],
- 'dateAdded' => $_SESSION['userData']['dateAdded'],
- 'fullname' => $_SESSION['userData']['fullname']
- );
- }
- public function admin_home() {
- $this->load->view('admin/admin_view', $this->data);
- }
- public function admin_profile(){
- $this->load->view('admin/admin_profile', $this->data);
- }
- public function admin_manage_accounts(){
- $query = $this->model->get_userdata();
- $data1 = array(
- 'get_position' => $this->model->get_position(),
- 'get_status' => $this->model->get_status()
- );
- $specialData = array('data' => $this->data, 'header_info' => header_info($data1));
- $this->load->view('admin/admin_manage_accounts',$specialData);
- }
- //for user searching
- public function loadDataTable($page = 0) {
- $searchFullname = $this->input->post('searchFullname');
- $searchStatus = $this->input->post('searchStatus');
- $searchPosition = $this->input->post('searchPosition');
- $itemPerPage = 10;
- $query = $this->model->get_userdata($page, $itemPerPage, $searchFullname, $searchStatus, $searchPosition);
- if($query->num_rows() > 0){
- $data = array(
- 'result' => $query->result(),
- 'success' => 1,
- 'page' => $page
- );
- }else {
- $data = array(
- 'success' => 0,
- 'message' => 'No Results'
- );
- }
- generate_json($data);
- }
- public function inactiveUser($id = 0) {
- $this->model->inactiveUser($id);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- public function activeUser($id = 0) {
- $this->model->activeUser($id);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- public function addNewUser() {
- $fname = $this->input->post('txtfname');
- $mname = $this->input->post('txtmname');
- $lname = $this->input->post('txtlname');
- $user = $this->input->post('txtuser');
- $pass = $this->input->post('txtpass');
- $position = $this->input->post('txtposition');
- $this->model->addNewUser($fname, $mname, $lname, $user, $pass, $position);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- //for instructor searching
- public function loadInstructorInfoTable($page = 0) {
- $searchinsFullname = $this->input->post('searchinsFullname');
- $searchinsPosition = $this->input->post('searchinsPosition');
- $searchinsStatus = $this->input->post('searchinsStatus');
- $itemPerPage = 10;
- $query = $this->model->get_instructorinfodata($page, $itemPerPage, $searchinsFullname, $searchinsPosition, $searchinsStatus);
- if($query->num_rows() > 0){
- $data = array(
- 'result' => $query->result(),
- 'success' => 1,
- 'page' => $page
- );
- }else {
- $data = array(
- 'success' => 0,
- 'message' => 'No Results'
- );
- }
- generate_json($data);
- }
- // for add instructor info
- public function addNewInstructorInfo() {
- $classID = $this->input->post('txtclassID');
- $fname = $this->input->post('txtfname');
- $mname = $this->input->post('txtmname');
- $lname = $this->input->post('txtlname');
- $datereg = $this->input->post('txtdateReg');
- $insposition = $this->input->post('txtinsPosition');
- $sex = $this->input->post('txtSex');
- $address = $this->input->post('txtAddress');
- $contact = $this->input->post('txtContact');
- $bday = $this->input->post('txtBday');
- $rate = $this->input->post('txtRate');
- $insstatus = $this->input->post('txtinsStatus');
- $this->model->addNewInstructorInfo($classID, $fname, $mname, $lname, $datereg, $insposition, $sex, $address, $contact, $bday, $rate, $insstatus);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- public function editInstructorInfo(){
- // if (!empty($this->session->userdata('isLogin'))) {
- $instructorID = $this->input->post('txtinstructorID');
- $classID1 = $this->input->post('txtclassID1');
- $fname1 = $this->input->post('txtfname1');
- $mname1 = $this->input->post('txtmname1');
- $lname1 = $this->input->post('txtlname1');
- $datereg1 = $this->input->post('txtdateReg1');
- $insposition1 = $this->input->post('txtinsPosition1');
- $sex1 = $this->input->post('txtSex1');
- $address1 = $this->input->post('txtAddress1');
- $contact1 = $this->input->post('txtContact1');
- $bday1 = $this->input->post('txtBday1');
- $rate1 = $this->input->post('txtRate1');
- $insstatus1 = $this->input->post('txtinsStatus1');
- if($insposition1 > 0) {
- $this->model->get_editInstructorInfo($instructorID, $classID1, $fname1, $mname1, $lname1, $datereg1, $insposition1, $sex1, $address1, $contact1, $bday1, $rate1, $insstatus1);
- $data = array(
- 'success' => 1
- );
- }else {
- $data = array(
- 'success' => 0
- );
- }
- generate_json($data);
- // }else {
- // redirect(base_url());
- // }
- }
- //for student search
- public function loadStudentInfoTable($page = 0) {
- $searchstudschoolID = $this->input->post('searchstudschoolID');
- $searchstudFullname = $this->input->post('searchstudFullname');
- $searchstudCourse = $this->input->post('searchstudCourse');
- $itemPerPage = 10;
- $query = $this->model->get_studentinfodata($page, $itemPerPage, $searchstudschoolID, $searchstudFullname, $searchstudCourse);
- if($query->num_rows() > 0){
- $data = array(
- 'result' => $query->result(),
- 'success' => 1,
- 'page' => $page
- );
- }else {
- $data = array(
- 'success' => 0,
- 'message' => 'No Results'
- );
- }
- generate_json($data);
- }
- // for add student info
- public function addNewStudentInfo() {
- $schoolID = $this->input->post('txtschoolID');
- $stud_lname = $this->input->post('txtfname');
- $stud_fname = $this->input->post('txtmname');
- $stud_mname = $this->input->post('txtlname');
- $stud_address = $this->input->post('txtaddress');
- $sex = $this->input->post('txtsex');
- $stud_bdate = $this->input->post('txtbday');
- $stud_bplace = $this->input->post('txtbplace');
- $stud_contact = $this->input->post('txtcontact');
- $district = $this->input->post('txtdistrict');
- $bloodtype = $this->input->post('txtbloodtype');
- $stud_nationality = $this->input->post('txtnationality');
- $stud_guardian = $this->input->post('txtguardian');
- $guard_contact = $this->input->post('txtguardianNo');
- $course = $this->input->post('txtcourse');
- $prevCourse = $this->input->post('txtprevcourse');
- $dateEnrolled = $this->input->post('txtdateenroll');
- $dateGraduated = $this->input->post('txtdategrad');
- $schoolLastAttended = $this->input->post('txtlastschoolattended');
- $yearGradHS = $this->input->post('txtyrgradHS');
- $schoolHS = $this->input->post('txtgradHS');
- $this->model->addNewStudentInfo($schoolID, $stud_lname, $stud_fname, $stud_mname, $stud_address, $sex,
- $stud_bdate, $stud_bplace, $stud_contact, $district, $bloodtype, $stud_nationality,
- $stud_guardian, $guard_contact, $course, $prevCourse, $dateEnrolled, $dateGraduated, $schoolLastAttended,
- $yearGradHS, $schoolHS);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- //for add course
- public function addNewCourse(){
- $ccode = $this->input->post('txtcoursecode');
- $cname = $this->input->post('txtcoursename');
- $cmajor = $this->input->post('txtcoursemajor');
- $college = $this->input->post('txtcollege');
- $this->model->addNewCourse($ccode, $cname, $cmajor, $college);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- //for edit course
- public function editCourseRecord() {
- // if(!empty($this->session->userdata('isLogin'))){
- $courseID = $this->input->post('courseID');
- $txtcoursecode1 = $this->input->post('txtcoursecode1');
- $txtcoursename1 = $this->input->post('txtcoursename1');
- $txtcoursemajor1 = $this->input->post('txtcoursemajor1');
- $txtcollege1 = $this->input->post('txtcollege1');
- if($txtcollege1 > 0) {
- $this->model->get_editCourseRecord($courseID, $txtcoursecode1, $txtcoursename1, $txtcoursemajor1, $txtcollege1);
- $data = array(
- 'success' => 1
- );
- }else {
- $data = array(
- 'success' => 0
- );
- }
- generate_json($data);
- }
- // else {
- // redirect(base_url());
- // }
- // }
- //for add college
- public function addNewCollege(){
- $addcollege = $this->input->post('txtAddcollege');
- $this->model->addNewCollege($addcollege);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- //for add major
- public function addNewMajor(){
- $addmajor = $this->input->post('txtAddmajor');
- $this->model->addNewMajor($addmajor);
- $data = array(
- 'success' => 1
- );
- generate_json($data);
- }
- //for course searching
- public function loadCourseDataTable($page = 0) {
- $searchCoursecode= $this->input->post('searchCoursecode');
- $searchCollege = $this->input->post('searchCollege');
- $itemPerPage = 10;
- $query = $this->model->get_coursedata($page, $itemPerPage, $searchCoursecode, $searchCollege);
- if($query->num_rows() > 0){
- $data = array(
- 'result' => $query->result(),
- 'success' => 1,
- 'page' => $page
- );
- }else {
- $data = array(
- 'success' => 0,
- 'message' => 'No Results'
- );
- }
- generate_json($data);
- }
- public function admin_manage_students(){
- $query = $this->model->get_studentinfodata();
- $data1 = array(
- 'get_sex' => $this->model->get_sex(),
- 'get_district' => $this->model->get_district(),
- 'get_bloodtype' => $this->model->get_bloodtype(),
- 'get_course' => $this->model->get_course(),
- 'get_prevCourse' => $this->model->get_prevCourse()
- );
- $header_info = header_info($data1);
- $specialData = array('data' => $this->data, 'header_info' => $header_info);
- $this->load->view('admin/admin_manage_students', $specialData);
- }
- public function admin_manage_instructors(){
- $query = $this->model->get_instructorinfodata();
- $data1 = array(
- 'get_insposition' => $this->model->get_insposition(),
- 'get_sex' => $this->model->get_sex(),
- 'get_insstatus' => $this->model->get_insstatus()
- );
- $specialData = array('data' => $this->data, 'header_info' => header_info($data1));
- $this->load->view('admin/admin_manage_instructors', $specialData);
- }
- public function admin_manage_courses(){
- $query = $this->model->get_coursedata();
- $data1 = array(
- 'get_college' => $this->model->get_college(),
- 'get_cmajor' => $this->model->get_cmajor()
- );
- $specialData = array('data' => $this->data, 'header_info' => header_info($data1));
- $this->load->view('admin/admin_manage_courses' , $specialData);
- }
- public function admin_manage_departments(){
- $this->load->view('admin/admin_manage_departments' , $this->data);
- }
- public function admin_manage_schedules(){
- $this->load->view('admin/admin_manage_schedules', $this->data);
- }
- public function admin_manage_grades(){
- $this->load->view('admin/admin_manage_grades', $this->data);
- }
- public function admin_calendar(){
- $this->load->view('admin/admin_calendar', $this->data);
- }
- public function admin_changepass(){
- $this->load->view('admin/admin_changepass', $this->data);
- }
- // public function logout(){
- // $this->load->view('admin/index');
- // }
- public function getDataOfFields() {
- $id = $this->input->post('id');
- $sql = $this->model->getDataOfFields($id);
- }
- public function getCourseDataField(){
- $courseid =$this->input->post('courseid');
- $query = $this->model->getCourseDataField($courseid);
- if($query->num_rows() > 0){
- $data = array(
- 'result' => $query->result(),
- 'success' => 1
- );
- }else {
- $data = array(
- 'success' => 0,
- 'message' => 'No Results'
- );
- }
- generate_json($data);
- }
- //delete course
- public function getCourseID(){
- $courseid = $this->input->post('courseid');
- $query = $this->model->getCourseID($courseid);
- }
- //delete student
- public function getstud_id(){
- $stud_id = $this->input->post('stud_id');
- $query = $this->model->getstud_id($stud_id);
- }
- //delete instructor
- public function getInstructorID(){
- $instructorid = $this->input->post('instructorid');
- $query = $this->model->getInstructorID($instructorid);
- }
- public function getInstructorInfoeditIDfield(){
- $instructorID = $this->input->post('instructorID');
- $query = $this->model->getInstructorInfoeditIDfield($instructorID);
- if($query->num_rows() > 0){
- $data = array(
- 'result'=> $query->result(),
- 'success'=> 1
- );
- }else{
- $data = array(
- 'success' => 0,
- 'message' =>'No Result'
- );
- }
- generate_json($data);
- }
- public function getStudentDataField(){
- $stud_id = $this->input->post('stud_id');
- $query = $this->model->getStudentDataField($stud_id);
- if($query->num_rows() > 0){
- $data = array(
- 'result'=> $query->result(),
- 'success'=> 1
- );
- }else{
- $data = array(
- 'success' => 0,
- 'message' => 'No Result'
- );
- }
- generate_json($data);
- }
- //for edit course
- public function editStudentRecord() {
- // if(!empty($this->session->userdata('isLogin'))){
- $txtstud_id1 = $this->input->post('txtstud_id1');
- $txtschoolID1 = $this->input->post('txtschoolID1');
- $txtfname1 = $this->input->post('txtfname1');
- $txtmname1 = $this->input->post('txtmname1');
- $txtlname1 = $this->input->post('txtlname1');
- $txtaddress1 = $this->input->post('txtaddress1');
- $txtsex1 = $this->input->post('txtsex1');
- $txtbday1 = $this->input->post('txtbday1');
- $txtbplace1 = $this->input->post('txtbplace1');
- $txtcontact1 = $this->input->post('txtcontact1');
- $txtdistrict1 = $this->input->post('txtdistrict1');
- $txtbloodtype1 = $this->input->post('txtbloodtype1');
- $txtnationality1 = $this->input->post('txtnationality1');
- $txtguardian1 = $this->input->post('txtguardian1');
- $txtguardianNo1 = $this->input->post('txtguardianNo1');
- $txtcourse1 = $this->input->post('txtcourse1');
- $txtprevcourse1 = $this->input->post('txtprevcourse1');
- $txtdateenroll1 = $this->input->post('txtdateenroll1');
- $txtdategrad1 = $this->input->post('txtdategrad1');
- $txtlastschoolattended1 = $this->input->post('txtlastschoolattended1');
- $txtyrgradHS1 = $this->input->post('txtyrgradHS1');
- $txtgradHS1 = $this->input->post('txtgradHS1');
- if($txtsex1 > 0) {
- $this->model->get_editStudentRecord($txtstud_id1, $txtschoolID1, $txtfname1 ,$txtmname1 ,$txtlname1 ,$txtaddress1 ,$txtsex1 ,$txtbday1 ,$txtbplace1 ,$txtcontact1 ,$txtdistrict1 ,$txtbloodtype1 ,$txtnationality1 ,$txtguardian1 ,$txtguardianNo1 ,$txtcourse1 ,$txtprevcourse1 ,$txtdateenroll1 ,$txtdategrad1 ,$txtlastschoolattended1 ,$txtyrgradHS1 ,$txtgradHS1);
- $data = array(
- 'success' => 1
- );
- }else {
- $data = array(
- 'success' => 0
- );
- }
- generate_json($data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement