Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.96.2  /  Your IP : 104.23.243.201
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/git/sms.edl.codes.solutions/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/git/sms.edl.codes.solutions/application/models/Accounting_model.php
<?php
/*********************
 *********************

 Wallet Model
 Creation 22 august 2019
 Aernout Guillaume
 http://Codes.Solutions

 *********************
 *********************/
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Accounting_model extends CI_Model {

  function __construct() {
      parent::__construct(array('no_cache'=>1));
      //$this->_ci =& get_instance();
      $this->load->model('crud_model');
      $this->load->database();
  }
  function get_transfers(){
    $query = $this->db->get('transfer');
    return $query->result_array();
  }
/*  function get_transfer($id){
    $this->db->get_where('transfer',array())
    $query = $this->db->get('transfer');
    return $query->result_array();
  }*/
  function get_data($start,$end,$origin){
    /*============================================
     =============================================
    //function pattern
     course { courseArray[0]
        teacher1: { totalhour, contract,hours, bill, interaction }, teacherArray[0]
        teacher2: { totalhour, contract,hour, bill, interaction } teacherArray[1]
      }
      course2 { courseArray[1]
      ...
      =============================================
      ============================================*/
    $coursesArray = $this->crud_model->get_courses_on_period($start,$end);
    $lessonArray = $this->crud_model->get_lessons_on_period($start,$end);
    $accountingArray = array();
    //return $coursesArray;
    foreach($coursesArray as $course){
        $teachers = $this->crud_model->get_teachers_list($course);

        foreach($teachers as $teacher){
          //lessons in period

          $teacherPrice = $this->crud_model->get_teacher_contract($course,$teacher);
          $teacherLessons =  $this->filtre_teacher($lessonArray,$course,$teacher);
          $teacherHours = $this->get_teacher_hours($teacherLessons);
          $teacherHoursTotal = $this->crud_model->get_teacher_hours($course,$teacher);
          $teacherActivity = $this->get_teacher_acitvity($teacherLessons);
          //return   $teacherActivity;

          if($origin == "js"){
            $courseName = $this->crud_model->get_course_name($course);
            $teacherName = $this->crud_model->get_teacher_name($teacher);

            if($teacherPrice == ""){
              $class = "btn-default";
            }else{
              $class = "btn-success";
            }

            $currentArray = array(
              'courseID'=> $course,
              'course' => $courseName,
              'teacherID' => $teacher,
              'teacher' => $teacherName,
              'class' => $class,
              'teacher_contract' =>  $teacherPrice,
              'teacher_lesson_nb' => count($teacherLessons),
              'teacher_hours' => $teacherHours,
              'teacher_hours_total' => $teacherHoursTotal,
              'teacher_bill' => ($teacherPrice*$teacherHours),
              'teacher_activity' => $teacherActivity
            );
          }else{
            $currentArray = array(
              'course_id' => $course,
              'teacher_id' => $teacher,
              'teacher_contract' =>  $teacherPrice,
              'teacher_lesson_nb' => count($teacherLessons),
              'teacher_hours' => $teacherHours,
              'teacher_hours_total' => $teacherHoursTotal,
              'teacher_bill' => ($teacherPrice*$teacherHours),
              'teacher_activity' => $teacherActivity
            );
          }


          array_push($accountingArray,$currentArray);
        }
    }
    return $accountingArray;
  }

  function get_teacher_acitvity($array){
    $activity = array();
    foreach ($array as $row) {
      $currentNumber = "0";
      $currentActive = "0";
      $currentActivity = "0";
      $students = $this->crud_model->get_lesson_students($row['lesson']);
      foreach ($students as $student) {
        $currentNumber ++;
        if($student['status_id'] != "0"){
          $currentActive ++;
        }
      }
      $currentActivity = (($currentActive * 100)/$currentNumber);
      array_push($activity,$currentActivity);
    }
    return (array_sum($activity)/count($activity));
  }

  function get_teacher_hours($array){
    $hours = "";
    foreach ($array as $row) {
      $hours = $hours + $this->crud_model->get_lesson_duration($row['lesson']);
    }
    return $hours;
  }

  function filtre_teacher($array,$course,$teacher){
    $teacherData = array();
    foreach ($array as $row) {
        if($row['CourseID'] == $course){
            $lessonTeachers =  $this->crud_model->get_lesson_teacher($row['ID']);
            //return "in".$lessonTeachers;
            if(in_array($teacher,$lessonTeachers)){
              $data =  array(
                'course' => $row['CourseID'],
                'lesson' => $row['ID'],
                'teacher' => $teacher
              );
              array_push($teacherData,$data);
            }
        }
    }
    return $teacherData;
  }
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit