/** * Name : AssignTestCase * Description : assign test cases for members * * @param $pid - project ID * @param $ts_id - Test suite ID * @param $tcID - Test case ID * @throws Some_Exception_Class If can not assign test cases */ public function AssignTestCase($pid, $tcID, $ts_id) { $this->load->model('project_model'); $nSubject = new Notification_m(); $nSubject->insertNotification($this->input->post('user'), $pid, "Assign Test Case To Execute", "You have assigned for new test case to execute", "Assigned", site_url() . "engineer/assignedToMe_controller/LoadAssignedTestCase/{$pid}"); $nSubject->insertNotification($this->session->userdata('uid'), $pid, "Assign Test Case To Execute", "You have assign a new test case to execute", "Assigned", site_url() . "manager/assignTestCases_controller"); $data = array('member_id' => $this->input->post('user'), 'psb_status' => 'Assign To Excecution'); $this->project_model->updateTCAssign($data, $tcID); redirect("manager/assignTestCases_controller/LoadTestCase/{$pid}/{$ts_id}"); }
/** * Name : AddnewTestSuite * Description : add new test suite * * @param $pid - project ID * @throws Some_Exception_Class If can not assign test cases */ public function AddnewTestSuite($pid) { try { $this->load->model('project_model'); $this->data['load_ts'] = 1; $this->data['load_tc'] = -1; $this->data['ppid'] = $pid; $this->data['priority'] = $this->project_model->getPriority(); $this->data['users'] = $this->project_model->getUserList($pid); $this->data['projects'] = $this->project_model->get_projectDetails($pid); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); $this->form_validation->set_rules('ts_code', 'Test Suite Code ', 'required'); $this->form_validation->set_rules('title', 'Test Suite Title ', 'required'); $this->form_validation->set_rules('priority', 'Priority ', 'required'); $this->form_validation->set_rules('users', 'Assigned To Review ', 'required'); if ($this->form_validation->run()) { $ts_id = $this->input->post('ts_code'); $data = array('testsuites_code' => $this->input->post('ts_code'), 'project_id' => $pid, 'name' => $this->input->post('title'), 'Priority' => $this->input->post('priority'), 'assignedToReview' => $this->input->post('users')); $this->project_model->addTestSuite($data); $nSubject = new Notification_m(); $nSubject->insertNotification($this->input->post('users'), $pid, "Assign Test Case To Review", "You have assigned for new test suite to review", "Assigned", site_url() . "engineer/assignedToMe_controller"); redirect("engineer/projectManagement_controller/createTestCase/{$pid}/{$ts_id}"); } $this->load->model('project_model'); $this->data['priority'] = $this->project_model->getPriority(); $this->data['subview'] = 'engineer/user/testSuit_view'; $this->load->view("engineer/_layout_main", $this->data); } catch (Exception $exc) { echo $exc->getTraceAsString(); } }
/** * Name : createProject * Description : create new test project * * @throws Some_Exception_Class If can not create a nw project cases */ public function createProject() { try { $this->load->model('project_model'); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); $this->form_validation->set_rules('projectid', 'Project ID ', 'required'); $this->form_validation->set_rules('projectname', 'Project Name ', 'required'); $this->form_validation->set_rules('description', 'Description ', 'required'); $this->form_validation->set_rules('startingdate', 'Starting Date ', 'required'); $this->form_validation->set_rules('endingDate', 'Ending Date', 'required'); $this->form_validation->set_rules('priority', 'Priority ', 'required'); $this->form_validation->set_rules('status', 'Status', 'required'); //run the validating if ($this->form_validation->run()) { $orStartdate = $this->input->post('startingdate'); $newStaDate = date("Y-m-d", strtotime($orStartdate)); $orEnddate = $this->input->post('endingDate'); $newEndDate = date("Y-m-d", strtotime($orEnddate)); $data = array('project_id' => $this->input->post('projectid'), 'name' => $this->input->post('projectname'), 'description' => $this->input->post('description'), 'starting_date' => $newStaDate, 'ending_date' => $newEndDate, 'prority_id' => $this->input->post('priority'), 'status' => $this->input->post('status')); $this->project_model->addProject($data); $pid = $this->input->post('projectid'); $nSubject = new Notification_m(); $nSubject->insertNotification($this->session->userdata('uid'), $pid, "Create New Project", "You have created a new project", "Created", site_url() . "manager/projectManagement_controller/LoadProject/{$pid}"); redirect("manager/projectManagement_controller/LoadProject/{$pid}"); } $this->load->model('project_model'); $this->data['priority'] = $this->project_model->getPriority(); $this->data['subview'] = 'manager/user/projectManagement_view'; $this->load->view("manager/_layout_main", $this->data); } catch (Exception $exc) { echo $exc->getTraceAsString(); } }
/** * @author : Roledene * Type : method * Name : login * Description : This method validate the username and password with database values and create the session */ public function login() { // get the user with given email and password $user = $this->get_by(array('email' => $this->input->post('email'), 'password' => $this->hash($this->input->post('password'))), TRUE); //if user found do the following, otherwise do nothing if (count($user)) { //log in user $data = array('uid' => $user->users_id, 'fname' => $user->firstName, 'lname' => $user->lastName, 'username' => $user->uername, 'email' => $user->email, 'id' => $user->users_id, 'role' => $user->role, 'password' => $user->password, 'loggedin' => TRUE); // create the login session with above details $this->session->set_userdata($data); $nSubject = new Notification_m(); $nSubject->insertNotification($user->users_id, 0, "Logged in", "You have been logged in to the QADashboard", "loggin", site_url() . "engineer/users/showProfile"); } }
/** * Name : addMembers * Description : add members to the project * @throws Exception if the memebers can't add to the project */ public function addMembers() { try { $pid = $this->session->userdata('project_id'); $this->load->model('member_model'); $data = array('project_id' => $pid, 'member_id' => $this->input->post('member')); $this->member_model->addMember($data); $nSubject = new Notification_m(); $nSubject->insertNotification($this->input->post('member'), $pid, "Assigned For the Project", "You have assigned to a new Project", "Assigned", site_url() . "engineer/base_controller"); $this->data['flag'] = 1; $this->data['mem'] = $this->member_model->getMembersForTable($pid); $this->data['members'] = $this->member_model->getMembers($pid); $this->data['projMem'] = $this->member_model->get_projectmembers($pid); $this->data['subview'] = 'admin/user/allocateMember_view'; $this->load->view("admin/_layout_main", $this->data); } catch (Exception $exc) { echo $exc->getTraceAsString(); } }
/** * @author : Roledene * Type : method * Name : update * Description : This function update the user profile */ public function update() { try { $this->user_m->rules = array('first-name' => array('field' => 'fname', 'label' => 'First Name', 'rules' => 'trim|required'), 'last-name' => array('field' => 'lname', 'label' => 'Last Name', 'rules' => 'trim|required'), 'email' => array('field' => 'email', 'label' => 'Email', 'rules' => 'trim|required|valid_email'), 'password' => array('field' => 'password', 'label' => 'Password', 'rules' => 'trim|required'), 'confirmpassword' => array('field' => 'confirmpassword', 'label' => 'Confirm Password', 'rules' => 'trim|required')); $rules = $this->user_m->rules; //validate the form $this->form_validation->set_rules($rules); //run the validating if ($this->form_validation->run($rules) == TRUE) { $id = $this->user_m->update("users", "users_id"); $nSubject = new Notification_m(); $nSubject->insertNotification($id, 0, "Profile Updated", "Your profile details has been updated", "updated", site_url() . "engineer/users/showProfile"); redirect("admin/users/showUsers"); } // redirect("admin/users/showProfile"); $this->data['subview'] = 'engineer/user/profile'; $this->load->view('admin/_layout_main', $this->data); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } }
/** * @author : Roledene * Type : method * Name : changeRole * Description : This function update the user role */ public function changeRole() { $id = $this->user_m->update("users", "users_id"); if (isset($id)) { $nSubject = new Notification_m(); $nSubject->insertNotification($id, 0, "User role changed", "Your user role has been updated as " . $this->input->post('role'), "RoleChanged", site_url() . "engineer/users/showProfile"); redirect("admin/users/showUsers"); } }
/** * @author : Roledene * Type : method * Name : setNotification * Description : this function add a notification to database */ public function setNotification() { $nSubject = new Notification_m(); $nSubject->insertNotification($this->session->userdata('uid'), 1, "new modification", "Has been done", "created", site_url() . "engineer/notification/getUnreadNotifications"); }