44 lines
969 B
PHP
44 lines
969 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: lucas
|
|
* Date: 27/02/18
|
|
* Time: 16:19
|
|
*/
|
|
|
|
namespace api\module\Professor;
|
|
|
|
|
|
use database\core\Repo;
|
|
use database\repo\professor;
|
|
|
|
class StatsController{
|
|
public static function get($args){
|
|
$idProf = 0;
|
|
extract($args);
|
|
|
|
//get data from the database
|
|
|
|
/** @var professor $profRepo */
|
|
$profRepo = Repo::getRepo("professor");
|
|
$VH = $profRepo->getVH($idProf);
|
|
|
|
if(in_array($VH["idCat"],[1,3])){
|
|
$VH["equiTD"] = $VH["VHTd"] + $VH["VHTp"] + 1.5*$VH["VHCours"];
|
|
|
|
if($VH["equiTD"] > $VH["du"]){
|
|
$partTP = $VH["VHTp"] / $VH["equiTD"];
|
|
$valReelleTP = $partTP * $VH["du"];
|
|
$VH["equiTD"] = round(1.5*$VH["VHCours"] + $VH["VHTd"] + $valReelleTP + ($VH["VHTp"] - $valReelleTP)*(2/3),2);
|
|
}
|
|
|
|
$VH["VHComp"] = round($VH["equiTD"] - $VH["du"],2);
|
|
$VH["VHComp"] < 0 ? 0 : $VH["VHComp"];
|
|
}else{
|
|
$VH["equiTD"] = $VH["VHTd"] + (2/3)*$VH["VHTp"] + 1.5*$VH["VHCours"];
|
|
}
|
|
|
|
return ["data" => $VH];
|
|
}
|
|
|
|
} |