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->database();
}
public function getPromotionData() {
foreach($this->db->order_by('level', 'desc')->get('ranksType')->result() as $row){
}
}
public function getPersonalDetails() {
if($this->session->userdata('role') == 'admin'){
$getDetails = $this->db->get("personalDetails");
}elseif($this->session->userdata('role') == 'command'){
$getDetails = $this->db->where('commandId', $this->session->userdata('commandId'))->get("personalDetails");
}elseif($this->session->userdata('role') == 'brigade'){
$getDetails = $this->db->where('brigadeId', $this->session->userdata('brigadeId'))->get("personalDetails");
}elseif($this->session->userdata('role') == 'unit'){
$getDetails = $this->db->where('unit', $this->session->userdata('unitId'))->get("personalDetails");
}
return $getDetails;
}
public function getCourse($userId,$rankId) {
$getCourse = 0;
$this->db->where('examScore','pass');
$this->db->where('userId',$userId);
$this->db->where('rankId',$rankId);
$getCourse = $this->db->count_all_results('coursesAttended');
return $getCourse;
}
public function convDate($date) {
$dateString = $date; // Assuming the date is in this format
// Convert the date to the desired format
$formattedDate = date('d F Y', strtotime($dateString));
//echo $formattedDate; // Output: 30 June 2023
return $formattedDate;
}
public function getNumberOfExam($rankId) {
$noExam = 0;
$this->db->where('rank',$rankId);
$noExam = $this->db->count_all_results('exams');
return $noExam;
}
public function getNumberOfCourse($rankId) {
$noCourse = 0;
$this->db->where('allowedRank',$rankId);
$noCourse = $this->db->count_all_results('militaryCourses');
return $noCourse;
}
public function getExam($userId,$rankId) {
$this->db->where('results','pass');
$this->db->where('userId',$userId);
$this->db->where('rankId',$rankId);
$getExam = $this->db->count_all_results('officerExams');
return $getExam;
}
public function getCourseExamFailed($userId,$rankId) {
//count number idadi
$getCourseNo = $this->UserModel->getNumberOfCourse($rankId);
$getExamNo = $this->UserModel->getNumberOfExam($rankId);
//Passed
$getCoursePass = $this->UserModel->getCourse($userId,$rankId);
$getExamPass = $this->UserModel->getExam($userId,$rankId);
//Failed
$getExam = 0;
$this->db->where('results!=','pass');
$this->db->where('userId',$userId);
$this->db->where('rankId',$rankId);
$getExam = $this->db->count_all_results('officerExams');
$getCourse = 0;
$this->db->where('examScore!=','pass');
$this->db->where('userId',$userId);
$this->db->where('rankId',$rankId);
$getCourse = $this->db->count_all_results('coursesAttended');
//get course status
$cStatus = '';
if($getCourseNo>0){
if($getCourse>0 && $getCoursePass<$getCourseNo){
$cStatus = "Attended: ".$getCourse." Failed";
}elseif($getCoursePass==$getCourseNo){
$cStatus = "Attended";
}elseif($getCoursePass==0 && $getCourse==0){
$cStatus = "Not Attended";
}elseif($getCoursePass>0 && $getCoursePass<$getCourseNo){
$cStatus = "Incomplete: ".$getCoursePass." Attended";
}
}else{
$cStatus = "Not Required";
}
//get exam status
$eStatus = '';
if($getExamNo>0){
if($getExam>0 && $getExamPass<$getExamNo){
$eStatus = "Attended: ".$getExam." Failed";
}elseif($getExamPass==$getExamNo){
$eStatus = "Attended";
}elseif($getExamPass==0 && $getExam==0){
$eStatus = "Not Attended";
}elseif($getExamPass>0 && $getExamPass<$getExamNo){
$eStatus = "Incomplete: ".$getExamPass." Attended";
}
}else{
$eStatus = "Not Required";
}
return $cStatus.'-'.$eStatus;
}
public function getDesciplineDate($date) {
$d=0;
if($date!=""){
$current = date('Y-m-d');
$date1 = new DateTime($date);
$date2 = new DateTime($current);
$interval = $date1->diff($date2);
$days = $interval->format('%a');
$numberOfYears = $days/365;
if($numberOfYears<1){
$d=1;
}
}
return $d;
}
public function getDuration($userId,$rankId) {
$numberOfDays = 0;
$this->db->where('userId',$userId);
$this->db->where('rankId',$rankId);
foreach($this->db->get('officerRanks')->result() as $row){
//get duration from promotion date to current date
$current = date('Y-m-d');
$date1 = new DateTime($row->promotionDate);
$date2 = new DateTime($current);
$interval = $date1->diff($date2);
$days = $interval->format('%a');
$numberOfYears = $days/365;
$years = floor($days / 365);
$months = floor(($days % 365) / 30);
$remainingDays = $days % 30;
if($years>0){
$time = "$years years, $months months, and $remainingDays days";
}elseif($years<1 && $months>0){
$time = "$months months, and $remainingDays days";
}else{
$time = "$remainingDays days";
}
}
return $numberOfYears.'|'.$time;
}
public function getDescipline($userId) {
$descipline = 0;
$this->db->where('id',$userId);
foreach($this->db->get('personalDetails')->result() as $row){
//get duration from promotion date to current date
if($row->dateReported!=NULL){
$current = date('Y-m-d');
$date1 = new DateTime($row->dateReported);
$date2 = new DateTime($current);
$interval = $date1->diff($date2);
$days = $interval->format('%a');
$numberOfYears = $days/365;
if($numberOfYears>1){
$descipline = 0;
}else{
$descipline = 1;
}
}else{
$descipline = 0;
}
}
return $descipline;
}
public function getUnit($unitId) {
foreach($this->db->where('id',$unitId)->get("militaryUnits")->result() as $u){
$unit = $u->name;
$b = $u->brigadeId;
$c = $u->commandId;
}
foreach($this->db->where('id',$b)->get("brigades")->result() as $d){
$brigade = $d->name;
}
foreach($this->db->where('id',$c)->get("commands")->result() as $w){
$command = $w->name;
}
return $unit.', '.$brigade.', '.$command;
}
public function getUnitIds($unitId) {
foreach($this->db->where('id',$unitId)->get("militaryUnits")->result() as $u){
$unit = $u->id;
$b = $u->brigadeId;
$c = $u->commandId;
}
foreach($this->db->where('id',$b)->get("brigades")->result() as $d){
$brigade = $d->id;
}
foreach($this->db->where('id',$c)->get("commands")->result() as $w){
$command = $w->id;
}
return $unit.'-'.$brigade.'-'.$command;
}
public function getQualification(){
$totalOfficerToPromote = $totalOfficerToPromote = 0;
$qualified = $notqualified = 0;
foreach($this->db->order_by('level', 'desc')->get('ranksType')->result() as $row){
//list of requirements
// 1.Course, 2.Exam, 3.Duration, 4.Despline
$thisRankId = $row->id;
$course = $this->UserModel->getNumberOfCourse($thisRankId);
$exam = $this->UserModel->getNumberOfExam($thisRankId);
$duration = $row->duration;
$discipline = 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){
//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){
// echo 'Promote';
$qualified++;
}else{
// echo "Do not promote";
$notqualified++;
}
}else{
//Level does not meet this level/rank
}
}
}
return $qualified;
}
}