Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
load->library('session'); $this->load->model('Login_model'); if($this->session->userdata('type')){ if($this->session->userdata('type') == 'officer'){ $this->session->set_flashdata('flash_data', 'You don\'t have access!'); redirect('Officer'); } }else{ redirect('login'); } } /** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/ * @see https://codeigniter.com/userguide3/general/urls.html */ public function index(){ $this->load->view('includes/header'); $this->load->view('pages/dashboard'); $this->load->view('includes/footer'); } public function getDistricts(){ $id = $this->input->post('id'); ?> db->where('region',$id)->get("district")->result() as $d){ ?> input->post('id'); ?> db->where('district',$id)->get("ward")->result() as $d){ ?> db->where('username',$this->input->post('email'))->count_all_results('users'); $count1 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersCommand'); $count2 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersBrigade'); $count3 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersUnit'); $count = $count0 + $count1 + $count2 + $count3; if($count>0){ redirect('admin/commandUsers?exist'); }else{ $data = array( 'commandId'=>$this->input->post('command'), 'fullName'=>$this->input->post('fullName'), 'email'=>$this->input->post('email'), 'password'=>md5('default'), 'password1'=>'default', 'date'=>date('Y-m-d'), ); $this->db->insert('usersCommand',$data); redirect('admin/commandUsers?sent'); } } public function addBrigadeUsers(){ //check Email is used by different users $count0 = $this->db->where('username',$this->input->post('email'))->count_all_results('users'); $count1 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersCommand'); $count2 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersBrigade'); $count3 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersUnit'); $count = $count0 + $count1 + $count2 + $count3; foreach($this->db->where('id',$this->input->post('brigade'))->get('brigades')->result() as $row){ $commandId = $row->commandId; } if($count>0){ redirect('admin/commandUsers?exist'); }else{ $data = array( 'commandId'=>$commandId, 'brigadeId'=>$this->input->post('brigade'), 'fullName'=>$this->input->post('fullName'), 'email'=>$this->input->post('email'), 'password'=>md5('default'), 'password1'=>'default', 'date'=>date('Y-m-d'), ); $this->db->insert('usersBrigade',$data); redirect('admin/brigadeUsers?sent'); } } public function addUnitUsers(){ //check Email is used by different users $count0 = $this->db->where('username',$this->input->post('email'))->count_all_results('users'); $count1 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersCommand'); $count2 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersBrigade'); $count3 = $this->db->where('email',$this->input->post('email'))->count_all_results('usersUnit'); $count = $count0 + $count1 + $count2 + $count3; foreach($this->db->where('id',$this->input->post('unit'))->get('militaryUnits')->result() as $row){ $brigadeId = $row->brigadeId; $commandId = $row->commandId; } if($count>0){ redirect('admin/commandUsers?exist'); }else{ $data = array( 'commandId'=>$commandId, 'brigadeId'=>$brigadeId, 'unitId'=>$this->input->post('unit'), 'fullName'=>$this->input->post('fullName'), 'email'=>$this->input->post('email'), 'password'=>md5('default'), 'password1'=>'default', 'date'=>date('Y-m-d'), ); $this->db->insert('usersUnit',$data); redirect('admin/unitUsers?sent'); } } public function disableCommandUser(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>1, ); $this->db->where('id',$id); $this->db->update('usersCommand',$data); redirect('admin/commandUsers'); } public function enableCommandUser(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>0, ); $this->db->where('id',$id); $this->db->update('usersCommand',$data); redirect('admin/commandUsers'); } public function disableBrigadeUser(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>1, ); $this->db->where('id',$id); $this->db->update('usersBrigade',$data); redirect('admin/brigadeUsers'); } public function enableBrigadeUser(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>0, ); $this->db->where('id',$id); $this->db->update('usersBrigade',$data); redirect('admin/brigadeUsers'); } public function disableUnitUser(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>1, ); $this->db->where('id',$id); $this->db->update('usersUnit',$data); redirect('admin/unitUsers'); } public function enableUnitUser(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>0, ); $this->db->where('id',$id); $this->db->update('usersUnit',$data); redirect('admin/unitUsers'); } public function promoteOfficer(){ $userId = $this->input->post('userId'); $currentRankId = $this->input->post('currentRankId'); $rankId =$this->input->post('rankId'); $rankLevel =$this->input->post('rankLevel'); $promotionDate = $this->input->post('promotionDate'); $data = array( 'userId'=>$userId, 'rankId'=>$rankId, 'rankLevel'=>$rankLevel, 'promotionDate'=>$promotionDate, 'date'=>date('Y-m-d'), ); $updatedata = array( 'currentRankId'=>$rankId, ); $this->db->insert('officerRanks',$data); $this->db->where('id',$userId); $this->db->update('personalDetails',$updatedata); redirect('admin/promotion'); } public function promoteOfficerProfile(){ $userId = $this->input->post('userId'); $currentRankId = $this->input->post('currentRankId'); $rankId =$this->input->post('rankId'); $rankLevel =$this->input->post('rankLevel'); $promotionDate = $this->input->post('promotionDate'); $data = array( 'userId'=>$userId, 'rankId'=>$rankId, 'rankLevel'=>$rankLevel, 'promotionDate'=>$promotionDate, 'date'=>date('Y-m-d'), ); $updatedata = array( 'currentRankId'=>$rankId, ); $this->db->insert('officerRanks',$data); $this->db->where('id',$userId); $this->db->update('personalDetails',$updatedata); redirect($_SERVER['HTTP_REFERER']); } public function promoteAllOfficers(){ $currentRankId = $this->input->post('currentRankId'); $rankId =$this->input->post('rankId'); $rankLevel =$this->input->post('rankLevel'); $promotionDate = $this->input->post('promotionDate'); foreach($this->db->where('id', $currentRankId)->get('ranksType')->result() as $row){ //list of requirements // 1.Course, 2.Exam, 3.Duration, 4.Despline $thisRankName= $row->name; $thisRankId = $row->id; $course = $this->UserModel->getNumberOfCourse($thisRankId); $exam = $this->UserModel->getNumberOfExam($thisRankId); $duration = $row->duration; $discipline = 0; $qualified = $notqualified = 0; $totalOfficerToPromote = $totalOfficerToPromote = 0; $i=0; foreach($this->db->get('personalDetails')->result() as $allOfficer){ //get course of the current rank //find current rank for user and check if it match with this rank $currentRank =0; $findRank = $this->db->order_by('rankLevel','desc')->where('userId',$allOfficer->id)->limit(1)->get('officerRanks'); foreach($findRank->result() as $currentRankRow){ $currentRank = $currentRankRow->rankId; } //check if is rank match; $thisLevel = $thisRankId; $currentRank = $currentRank; if($currentRank == $thisLevel){ $qualified=$notqualified=0; //check if course attempted match $getCourse = $this->UserModel->getCourse($allOfficer->id,$thisRankId); $getExam = $this->UserModel->getExam($allOfficer->id,$thisRankId); $getDuration = explode('|',$this->UserModel->getDuration($allOfficer->id,$thisRankId)); $officerRankDuration = $getDuration[0]; $timePassed = $getDuration[1]; $getDiscipline = $this->UserModel->getDescipline($allOfficer->id); //echo 'UserId '.$allOfficer->id.' User level '.$currentRank.' Rank Level '.$thisLevel.'
'; // echo 'Course Required '.$course.'='.$getCourse.' duration '.$duration.' = '.$officerRankDuration.' Exam Required' // .$exam.' = '.$getExam.' decipline '.$getDiscipline; if($course==$getCourse && $exam == $getExam && $officerRankDuration>=$duration && $getDiscipline==0){ //Qualified, Promote $id = $allOfficer->id; $data = array( 'userId'=>$id, 'rankId'=>$rankId, 'rankLevel'=>$rankLevel, 'promotionDate'=>$promotionDate, 'date'=>date('Y-m-d'), ); $updatedata = array( 'currentRankId'=>$rankId, ); $this->db->insert('officerRanks',$data); $this->db->where('id',$id); $this->db->update('personalDetails',$updatedata); }else{ // echo "Do not promote"; //$notqualified++; } }else{ //Level does not meet this level/rank } } } redirect($_SERVER['HTTP_REFERER']); } public function addRankType(){ $data = array( 'name'=>$this->input->post('name'), 'level'=>$this->input->post('level'), 'course'=>$this->input->post('course'), 'exam'=>$this->input->post('exam'), 'duration'=>$this->input->post('duration'), 'date'=>date('Y-m-d'), ); $this->db->insert('ranksType',$data); redirect('admin/addRanksType?sent'); } public function editRankType(){ $id = $this->input->post('id'); $data = array( 'name'=>$this->input->post('name'), 'level'=>$this->input->post('level'), 'course'=>$this->input->post('course'), 'exam'=>$this->input->post('exam'), 'duration'=>$this->input->post('duration'), ); $this->db->where('id',$id); $this->db->update('ranksType',$data); redirect('admin/editRankType?id='.base64_encode($id).'&sent=1'); } public function disableRank(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>1, ); $this->db->where('id',$id); $this->db->update('ranksType',$data); redirect('admin/viewRanksTypes'); } public function enableRank(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>0, ); $this->db->where('id',$id); $this->db->update('ranksType',$data); redirect('admin/viewRanksTypes'); } public function addCourse(){ $data = array( 'name'=>$this->input->post('name'), 'duration'=>$this->input->post('duration'), 'allowedRank'=>$this->input->post('allowedrank'), 'date'=>date('Y-m-d'), ); $this->db->insert('militaryCourses',$data); redirect('admin/addCourse?sent'); } public function editCourse(){ $id = $this->input->post('id'); $data = array( 'name'=>$this->input->post('name'), 'duration'=>$this->input->post('duration'), 'allowedRank'=>$this->input->post('allowedrank'), ); $this->db->where('id',$id); $this->db->update('militaryCourses',$data); redirect('admin/editCourse?id='.base64_encode($id).'&sent=1'); } public function addCommand(){ $data = array( 'name'=>$this->input->post('name'), ); $this->db->insert('commands',$data); redirect('admin/registerCommand?sent'); } public function addBrigade(){ $data = array( 'name'=>$this->input->post('name'), 'commandId'=>$this->input->post('command'), 'date'=>date('Y-m-d'), ); $this->db->insert('brigades',$data); redirect('admin/registerBrigade?id='.base64_encode($this->input->post('command'))); } public function addUnit(){ $data = array( 'name'=>$this->input->post('name'), 'commandId'=>$this->input->post('command'), 'brigadeId'=>$this->input->post('brigade'), 'date'=>date('Y-m-d'), ); $this->db->insert('militaryUnits',$data); redirect('admin/registerUnit?id='.base64_encode($this->input->post('brigade'))); } public function editUnit(){ $id = base64_decode($_REQUEST['id']); $data = array( 'name'=>$this->input->post('name'), 'commandId'=>$this->input->post('command'), 'brigadeId'=>$this->input->post('brigade'), 'date'=>date('Y-m-d'), ); $this->db->where('id',$id); $this->db->update('militaryUnits',$data); redirect('admin/registerUnit?id='.base64_encode($this->input->post('brigade'))); } public function editBrigade(){ $id = base64_decode($_REQUEST['id']); $data = array( 'name'=>$this->input->post('name'), 'commandId'=>$this->input->post('command'), 'date'=>date('Y-m-d'), ); $this->db->where('id',$id); $this->db->update('brigades',$data); redirect('admin/registerBrigade?id='.base64_encode($this->input->post('command'))); } public function addExam(){ $data = array( 'name'=>$this->input->post('name'), 'rank'=>$this->input->post('rank'), ); $this->db->insert('exams',$data); redirect('admin/addExam?sent'); } public function editExam(){ $id = $this->input->post('id'); $data = array( 'name'=>$this->input->post('name'), 'rank'=>$this->input->post('rank'), ); $this->db->where('id',$id); $this->db->update('exams',$data); redirect('admin/editExam?id='.base64_encode($id).'&sent=1'); } public function disableCourse(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>1, ); $this->db->where('id',$id); $this->db->update('militaryCourses',$data); redirect('admin/viewCourses'); } public function enableCourse(){ $id = base64_decode($_REQUEST['id']); $data = array( 'status'=>0, ); $this->db->where('id',$id); $this->db->update('militaryCourses',$data); redirect('admin/viewCourses'); } public function addPersonalDetails(){ //get unit brigade command ids $exp = explode('-',$this->UserModel->getUnitIds($this->input->post('unit'))); $data = array( 'firstName'=>$this->input->post('firstName'), 'middleName'=>$this->input->post('middleName'), 'lastName'=>$this->input->post('lastName'), 'gender'=>$this->input->post('gender'), 'phoneNumber'=>$this->input->post('mobileNumber'), 'nida'=>$this->input->post('nida'), 'email'=>$this->input->post('email'), 'dateOfBirth'=>$this->input->post('dateOfBirth'), 'currentRankId'=>$this->input->post('currentRankId'), 'uniqueNumber'=>$this->input->post('uniqueNumber'), 'commandId'=>$exp[2], 'brigadeId'=>$exp[1], 'unit'=>$exp[0], 'password'=>md5($this->input->post('uniqueNumber')), 'password1'=>$this->input->post('uniqueNumber'), 'date'=>date('Y-m-d'), 'registeredBy'=>$this->session->userdata('id'), ); $this->db->insert('personalDetails',$data); //insert initial rank $data2 = array( 'userId'=>$this->db->insert_id(), 'rankId'=>$this->input->post('currentRankId'), 'rankLevel'=>$this->Login_model->getRankLevel($this->input->post('currentRankId')), 'promotionDate'=>$this->input->post('promotionDate'), 'date'=>date('Y-m-d'), ); $this->db->insert('officerRanks',$data2); redirect('admin/addPersonalDetails?saved'); } public function editPersonalDetails(){ $id = $_REQUEST['id']; //get unit brigade command ids $exp = explode('-',$this->UserModel->getUnitIds($this->input->post('unit'))); $data = array( 'firstName'=>$this->input->post('firstName'), 'middleName'=>$this->input->post('middleName'), 'lastName'=>$this->input->post('lastName'), 'gender'=>$this->input->post('gender'), 'phoneNumber'=>$this->input->post('mobileNumber'), 'nida'=>$this->input->post('nida'), 'email'=>$this->input->post('email'), 'dateOfBirth'=>$this->input->post('dateOfBirth'), 'currentRankId'=>$this->input->post('currentRankId'), 'uniqueNumber'=>$this->input->post('uniqueNumber'), 'commandId'=>$exp[2], 'brigadeId'=>$exp[1], 'unit'=>$exp[0], 'password'=>md5($this->input->post('uniqueNumber')), 'password1'=>$this->input->post('uniqueNumber'), ); $this->db->where('id',base64_decode($id))->update('personalDetails',$data); //update initial rank $data2 = array( 'rankId'=>$this->input->post('currentRankId'), 'rankLevel'=>$this->Login_model->getRankLevel($this->input->post('currentRankId')), 'promotionDate'=>$this->input->post('promotionDate'), ); $this->db->where('userId',base64_decode($id)); $this->db->where('rankId',$this->input->post('previousRank')); $this->db->update('officerRanks',$data2); redirect('admin/editPersonalDetails?id='.$id); } public function editPromotionDate(){ $data = array( 'promotionDate'=>$this->input->post('promotionDate'), ); $this->db->where('id',base64_decode($_REQUEST['id']))->update('officerRanks',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function updateDescipline(){ $data = array( 'dateReported'=>$this->input->post('dateReported'), 'descipline'=>$this->input->post('descipline'), ); $this->db->where('id',base64_decode($_REQUEST['id']))->update('personalDetails',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function clearDescipline(){ $data = array( 'dateReported'=>null, 'descipline'=>null, ); $this->db->where('id',base64_decode($_REQUEST['id']))->update('personalDetails',$data); redirect($_SERVER['HTTP_REFERER']); } public function addCourseDetails(){ $exp = explode('|',$this->input->post('courseId')); $data = array( 'userId'=>$this->input->post('userId'), 'institution'=>$this->input->post('institution'), 'courseId'=>$exp[0], 'rankId'=>$exp[1], 'intakeNumber'=>$this->input->post('intakeNumber'), 'examScore'=>$this->input->post('examScore'), 'date'=>date('Y-m-d'), ); $this->db->insert('coursesAttended',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function editCourseDetails(){ $exp = explode('|',$this->input->post('courseId')); $data = array( 'institution'=>$this->input->post('institution'), 'courseId'=>$exp[0], 'rankId'=>$exp[1], 'intakeNumber'=>$this->input->post('intakeNumber'), 'examScore'=>$this->input->post('examScore'), ); $this->db->where('id',base64_decode($_REQUEST['id']))->update('coursesAttended',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function addExamDetails(){ $exp = explode('|',$this->input->post('examId')); $data = array( 'userId'=>$this->input->post('userId'), 'examId'=>$exp[0], 'rankId'=>$exp[1], 'examNumber'=>$this->input->post('examNumber'), 'results'=>$this->input->post('results'), 'date'=>date('Y-m-d'), ); $this->db->insert('officerExams',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function editExamDetails(){ $exp = explode('|',$this->input->post('examId')); $data = array( 'examId'=>$exp[0], 'rankId'=>$exp[1], 'examNumber'=>$this->input->post('examNumber'), 'results'=>$this->input->post('results'), ); $this->db->where('id',base64_decode($_REQUEST['id']))->update('officerExams',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function addEducationDetails(){ $data = array( 'userId'=>$this->input->post('userId'), 'level'=>$this->input->post('level'), 'institution'=>$this->input->post('institution'), 'programme'=>$this->input->post('programme'), 'startDate'=>$this->input->post('startDate'), 'endDate'=>$this->input->post('endDate'), 'country'=>$this->input->post('country'), 'date'=>date('Y-m-d'), ); $this->db->insert('education',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function editEducationDetails(){ $data = array( 'level'=>$this->input->post('level'), 'institution'=>$this->input->post('institution'), 'programme'=>$this->input->post('programme'), 'startDate'=>$this->input->post('startDate'), 'endDate'=>$this->input->post('endDate'), 'country'=>$this->input->post('country'), ); $this->db->where('id',base64_decode($_REQUEST['id']))->update('education',$data); redirect('admin/officerProfile?id='.base64_encode($this->input->post('userId'))); } public function deleteEmploymentDetails(){ $this->db->where('id',base64_decode($_REQUEST['id']))->delete('employmentDetails'); redirect($_SERVER['HTTP_REFERER']); } public function deleteCourseDetails(){ $this->db->where('id',base64_decode($_REQUEST['id']))->delete('coursesAttended'); redirect($_SERVER['HTTP_REFERER']); } public function deleteExamDetails(){ $this->db->where('id',base64_decode($_REQUEST['id']))->delete('officerExams'); redirect($_SERVER['HTTP_REFERER']); } public function deleteEducationDetails(){ $this->db->where('id',base64_decode($_REQUEST['id']))->delete('education'); redirect($_SERVER['HTTP_REFERER']); } }