Esempio n. 1
0
 public function document()
 {
     $allDepartments = Department_Model::getAllDepartments();
     $data = array('pageTitle' => 'Document Builder', 'bodyClass' => 'edit', 'builder' => 'document', 'headerModules' => json_decode($this->builder->getModules('header')), 'bodyModules' => json_decode($this->builder->getModules('body')), 'footerModules' => json_decode($this->builder->getModules('footer')), 'draftModules' => json_decode($this->builder->getDraftModules()), 'unpublishedModules' => json_decode($this->builder->getUnpublishedModules()), 'allCategories' => Category_Model::getAllCategories(), 'allDepartments' => Department_Model::getAllDepartments());
     $this->load->view('templates/header', $data);
     $this->load->view('builder/inner_navbar_view');
     $this->load->view('builder/document_builder_view');
     $this->load->view('templates/footer');
 }
Esempio n. 2
0
 public function editFileDetails()
 {
     $this->load->model('Department_Model');
     $this->requestId = $this->uri->segment(3);
     $results = $this->details->getFileDetails();
     $departmentList = Department_Model::getAllDepartments();
     $data = array('pageTitle' => 'File Details', 'fileDetail' => json_decode($results), 'departmentList' => $departmentList);
     $this->load->view('templates/header', $data);
     $this->load->view('details/edit_file_details_view', $data);
     $this->load->view('templates/footer');
 }
Esempio n. 3
0
 public function loadData()
 {
     $currentUserDept = $this->session->department;
     //CHM - Pull in the sub-select values
     if (!($tName = $this->cache->get('udfFields'))) {
         $query = $this->db->select('table_name')->where('field_type', 4)->get('udf');
         $tName = array();
         foreach ($query->result() as $data) {
             $explodeV = explode('_', $data->table_name);
             $tName[] = $explodeV[2];
             $i++;
         }
         $this->cache->save('udfFields', $tName, 600);
     }
     // We need to set a form value for the current user so that
     // they can be pre-selected on the form
     $availUsers = User_Model::getAllUsers();
     $usersArray = array();
     foreach ($availUsers as $availUser) {
         if ($availUser->id == $this->session->id) {
             $availUser->selected = 'checked';
         } else {
             $availUser->selected = '';
         }
         array_push($usersArray, $availUser);
     }
     // We need to set a form value for the current department so that
     // it can be pre-selected on the form
     $availDepartments = Department_Model::getAllDepartments();
     $departmentsArray = array();
     foreach ($availDepartments as $availDepartment) {
         if ($availDepartment->id == $currentUserDept) {
             $availDepartment->selected = 'checked';
         } else {
             $availDepartment->selected = '';
         }
         array_push($departmentsArray, $availDepartment);
     }
     $availCategories = Category_Model::getAllCategories();
     $catsArray = array();
     foreach ($availCategories as $availCategory) {
         array_push($catsArray, $availCategory);
     }
     //////Populate department perm list/////////////////
     $deptPermsArray = array();
     foreach ($departmentsArray as $dept) {
         $availDeptPerms = new stdClass();
         $availDeptPerms->name = $dept->name;
         $availDeptPerms->id = $dept->id;
         array_push($deptPermsArray, $availDeptPerms);
     }
     $data = array('tName' => $tName, 'availUsers' => $usersArray, 'allDepartments' => $availDepartments, 'deptPerms' => $departmentsArray, 'availCategories' => $catsArray);
     return json_encode($data);
 }
Esempio n. 4
0
 public function index()
 {
     if ($this->session->admin) {
         $data = array('allDepartments' => Department_Model::getAllDepartments());
         $this->load->view('templates/header', array('pageTitle' => 'Department Settings'));
         $this->load->view('department/department_view', $data);
         $this->load->view('templates/footer');
     } else {
         $this->session->set_flashdata('error', 'You do not have permission to view the departments admin page');
         redirect('home');
     }
 }
Esempio n. 5
0
 public function modifyUser()
 {
     $post = $this->input->post();
     if (isset($post['id']) && $post['id'] !== null) {
         if ($this->session->admin == true) {
             $mode = 'enabled';
         } else {
             $mode = 'disabled';
         }
         if ($mode == 'disabled' && $post['id'] != $this->uid) {
             $error = array('status' => 'error', 'msg' => 'You do not have permission to edit this user.');
             echo json_encode($error);
             exit;
         }
         $userForm = array('name' => 'update', 'id' => 'modifyUserForm', 'enctype' => 'multipart/form-data', 'class' => 'form-horizontal');
         $data = array('userDetails' => User_Model::getAllUserDetails($post['id']), 'allDepts' => Department_Model::getAllDepartments(), 'userReviewDepts' => Reviewer_Model::getDepartmentsForReviewer($post['id']), 'newUserObj' => new User_Model($post['id']), 'mode' => $mode, 'formDetails' => $userForm);
         $this->load->view('user/modify_user_view', $data);
     } else {
         $this->session->set_flashdata('error', 'You attempted to access the profile page in an unauthorized manner.');
         redirect($_SERVER['HTTP_REFERER']);
     }
 }