Advertisement
Guest User

Untitled

a guest
May 24th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('BASEPATH'))
  4. exit('No direct script access allowed');
  5.  
  6. class Secretary_controller extends A_Controller
  7. {
  8. function __construct()
  9. {
  10. parent::__construct();
  11. $this->load->model('Contracts_model');
  12. $this->load->library('form_validation');
  13. }
  14.  
  15. public function index()
  16. {
  17. $studyLevels = $this->User_model->get_all_study_levels();
  18. $faculties = $this->User_model->get_all_faculties();
  19. $roles = $this->User_model->get_all_roles();
  20. $data = array(
  21. 'studyLevels'=>$studyLevels,
  22. 'roles'->$roles,
  23. 'faculties'->$faculties
  24. );
  25. load_page('Secretary_controller/propose_list', $data, $this->data);
  26. }
  27.  
  28. public function addUser(){
  29. $username = $this->input->post("username");
  30. $password = $this->input->post("password");
  31. $first_name = $this->input->post("first_name");
  32. $last_name= $this->input->post("last_name");
  33. $birth_date = $this->input->post("birth_date");
  34. $email = $this->input->post("email");
  35. $phone_number = $this->input->post("phone_number");
  36. $cnp = $this->input->post("cnp");
  37. $idStudyLevel = $this->input->post("idStudyLevel");
  38. $idRole = $this->input->post("idRole");
  39. $idFaculty = $this->input->post("idFaculty");
  40. $id_personal_data = $this->User_model->add_personal_data($first_name,$last_name,$birth_date,$email,$phone_number,$cnp);
  41. $res = $this->User_model->add_user($username,$password,$id_faculty,$id_role,'NULL',$id_personal_data,"NULL",$idStudyLevel);
  42. if($res>0){
  43. $this->session->set_flashdata('message', 'Record added');
  44. redirect(site_url('Secretary_controller'));
  45. }
  46. else {
  47. $this->session->set_flashdata('message', 'Error adding record');
  48. redirect(site_url('Secretary_controller'));
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement