Skip to content

Commit

Permalink
Ajout des notes aux commentaires
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2choiz committed Apr 12, 2015
1 parent 1269b8d commit d94fecc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
30 changes: 25 additions & 5 deletions Application/Controllers/ViewRecette.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,35 @@ public function getAllViewRecettes($param) { // obtenir toutes les recettes
//recupere les commentaires
$modelVC = new \Application\Models\ViewCommentaire();

//$modelNote = new \Application\Models\Note();

//$notes=$modelNote->convEnTab($modelNote->fetchAll(" "));


$modelNote = new \Application\Models\Note();

// $this->setMode("brut");
foreach ($viewAllRecettes as $key => $viewRecette) {

$viewC = $modelVC->convEnTab( $modelVC->fetchAll(" `id_recette`={$viewRecette['id_recette']}")) ;
var_dump("viewComme",$viewC);

foreach ($viewC as $key2 => $value) {
if (isset($param['id_user'] ) ) {
echo " `id_user`={$param['id_user']} AND `id_recette`={$viewRecette['id_recette']} ";
$note = $modelNote->convEnTab($modelNote->fetchAll(" `id_user`={$param['id_user']} AND `id_recette`={$viewRecette['id_recette']} "));
$note=$note[0];
var_dump("note",$note);
if(!empty($note)){
$viewC[$key2]['note']=$note['value'];
}else{ //pas de note ou aucune
$viewC[$key2]['note']="rien";
}
}else{
$viewC[$key2]['note']="rien"; //rien demandé
}

}
$viewAllRecettes[$key]['commentaires'] = $viewC;

//ajoute la note

//$viewAllRecettes[$key][''] = $viewLP;
}

}
Expand Down
2 changes: 1 addition & 1 deletion Library/Core/RestServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function __destruct(){ //envoi
by Samyn, Naïla
</div>";
//$this->json->page="<iframe>@@@>>>".$body."<<<@@@</iframe>";
//$this->json->page="<hr>@@@>>".$body."<<<@@@<hr>";
$this->json->page="<hr>@@@>>".$body."<<<@@@<hr>";
ob_clean();

//$this->sendMode='brut';
Expand Down

0 comments on commit d94fecc

Please sign in to comment.