Guide du développeur
Apparence
Les unités algorithmiques
L'unité va retourner deux résultats. Le premier est basé sur la somme des items, le second sur un complément d'information. "N/R" siginifie non renseigné, et "N/A" Non applicable. Ces unités sont compilées de manières dunamique.
Les deux fonctions sont modifiables, et enregistrées sous l'unité associée au composant (ex u45.h
<?php
/*
* Unité de traitement générique
* @author Hugues GENVRIN
*/
class unite{
public $calcul=0;
public $tableau=array();
public function donnees($tab) {
$i=0;
while($i<count($tab))
{
$this->tableau[$i]=$tab[$i];
$this->calcul+=$this->tableau[$i];
$i++;
}
}
public function output_1($input){
$this->donnees($input);
$output_1 = $this->calcul;
return $output_1;
}
public function output_0(){
$output_0 = "N/R";
return $output_0;
}Exemple d'application :
<?php
/*
* Adapté du questionnaire de Sheldon
* @author Hugues GENVRIN
*/
class unite{
public $calcul=0;
public $tableau=array();
public function donnees($tab) {
$i=0;
while($i<48)
{
$this->tableau[$i]=$tab[$i];
$this->calcul+=$this->tableau[$i];
$i++;
}
}
public function output_0(){
$output_0 ="N/A";
$output_0=-$this->dimension[0]-$this->dimension[1]+$this->dimension[2]-$this->dimension[3]+$this->dimension[4]+$this->dimension[5];
return $output_0;
}
public function output_1($input) {
$this->donnees($input);
$output_1=$this->output_2()."/PB-".$this->output_3()."/BP-".$this->output_4()."/PA-".$this->output_5()."/AP-".$this->output_6()."/BG-".$this->output_7()."/AG"."/BG-".$this->output_8()."/EA";
return $output_1;
}
//dimension naturelle
private function output_2(){
$i=0;
while($i<48)
{
if(($i+1==1) OR ($i+1==4) OR ($i+1==11) OR ($i+1==12) OR ($i==23+1) OR ($i+1==27) OR ($i+1==36) OR ($i+1==45))
$this->dimension[0]+=$this->tableau[$i];
$i++;
}
$output_2=$this->dimension[0];
return $output_2;
}
//dimension plaisir
public function output_3(){
$i=0;
while($i<48)
{
if(($i+1==2) OR ($i+1==10) OR ($i+1==14) OR ($i+1==15) OR ($i+1==24) OR ($i+1==26) OR ($i+1==38) OR ($i==40))
$this->dimension[1]+=$this->tableau[$i];
$i++;
}
$output_3=$this->dimension[1];
return $output_3;
}
//dimension de la valeur
public function output_4(){
$i=0;
while($i<48)
{
if(($i+1==3) OR ($i+1==9) OR ($i+1==19) OR ($i+1==25) OR ($i+1==30) OR ($i+1==39) OR ($i+1==41) OR ($i+1==47))
$this->dimension[2]+=$this->tableau[$i];
$i++;
}
$output_4=$this->dimension[2];
return $output_4;
}
//dimension de la culpabilité
public function output_5(){
$i=0;
while($i<48)
{
if(($i+1==5) OR ($i+1==13) OR ($i+1==20) OR ($i+1==21) OR ($i+1==29) OR ($i+1==36) OR ($i+1==42) OR ($i+1==46))
$this->dimension[3]+=$this->tableau[$i];
$i++;
}
$output_5=$this->dimension[3];
return $output_5;
}
// dimension de la situation
public function output_6(){
$i=0;
while($i<48)
{
if(($i+1==6) OR ($i+1==7) OR ($i+1==28) OR ($i+1==31) OR ($i+1==35) OR ($i+1==37) OR ($i+1==43) OR ($i==44))
$this->dimension[4]+=$this->tableau[$i];
$i++;
}
$output_6=$this->dimension[4];
return $output_6;
}
public function output_7(){
$i=0;
while($i<48)
{
if(($i+1==8) OR ($i+1==16) OR ($i+1==17) OR ($i+1==18) OR ($i+1==22) OR ($i+1==32) OR ($i+1==48) OR ($i+1==44) )
$this->dimension[5]+=$this->tableau[$i];
$i++;
}
$output_7=$this->dimension[5];
return $output_7;
}
public function output_8(){
$output_7=$this->dimension[3]+$this->dimension[5];
return $output_7;
}
}
?>