Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('BASEPATH'))
- exit('No direct script access allowed');
- class Secretary_controller extends A_Controller
- {
- function __construct()
- {
- parent::__construct();
- $this->load->model('Contracts_model');
- $this->load->library('form_validation');
- }
- public function index()
- {
- $studyLevels = $this->User_model->get_all_study_levels();
- $faculties = $this->User_model->get_all_faculties();
- $roles = $this->User_model->get_all_roles();
- $data = array(
- 'studyLevels'=>$studyLevels,
- 'roles'->$roles,
- 'faculties'->$faculties
- );
- load_page('Secretary_controller/propose_list', $data, $this->data);
- }
- public function addUser(){
- $username = $this->input->post("username");
- $password = $this->input->post("password");
- $first_name = $this->input->post("first_name");
- $last_name= $this->input->post("last_name");
- $birth_date = $this->input->post("birth_date");
- $email = $this->input->post("email");
- $phone_number = $this->input->post("phone_number");
- $cnp = $this->input->post("cnp");
- $idStudyLevel = $this->input->post("idStudyLevel");
- $idRole = $this->input->post("idRole");
- $idFaculty = $this->input->post("idFaculty");
- $id_personal_data = $this->User_model->add_personal_data($first_name,$last_name,$birth_date,$email,$phone_number,$cnp);
- $res = $this->User_model->add_user($username,$password,$id_faculty,$id_role,'NULL',$id_personal_data,"NULL",$idStudyLevel);
- if($res>0){
- $this->session->set_flashdata('message', 'Record added');
- redirect(site_url('Secretary_controller'));
- }
- else {
- $this->session->set_flashdata('message', 'Error adding record');
- redirect(site_url('Secretary_controller'));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement