ptut-vhost/build/api/module/professor/statsController.php

44 lines
969 B
PHP
Raw Permalink Normal View History

<?php
/**
* Created by PhpStorm.
* User: lucas
* Date: 27/02/18
* Time: 16:19
*/
namespace api\module\professor;
use database\core\Repo;
2018-02-27 19:41:36 +00:00
use database\repo\professor;
class statsController{
public static function get($args){
$idProf = 0;
extract($args);
//get data from the database
2018-02-27 19:41:36 +00:00
/** @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];
}
}