1
|
|
|
<?php |
2
|
|
|
namespace modules\comment\app\controller; |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
use core\App; |
6
|
|
|
|
7
|
|
|
class Comment { |
8
|
|
|
//-------------------------- BUILDER ----------------------------------------------------------------------------// |
9
|
|
|
//-------------------------- END BUILDER ----------------------------------------------------------------------------// |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
|
13
|
|
|
//-------------------------- GETTER ----------------------------------------------------------------------------// |
14
|
|
|
private function getRender($values) { |
|
|
|
|
15
|
|
|
|
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @param $table |
20
|
|
|
* @param $nom_id_table |
21
|
|
|
* @param $id_in_table |
22
|
|
|
* function wich get all comments of an other module like a article of a blog |
23
|
|
|
* after all coments was getted it will call getRender to use twig to render them |
24
|
|
|
*/ |
25
|
|
|
public function getComments($table, $nom_id_table, $id_in_table) { |
26
|
|
|
$dbc = App::getDb(); |
27
|
|
|
|
28
|
|
|
$query = $dbc->select()->from("_comment_all")->where("nom_table", "=", $table, "AND") |
29
|
|
|
->where("nom_id_table", "=", $nom_id_table, "AND")->where("ID_in_table", "=", $id_in_table)->get(); |
30
|
|
|
|
31
|
|
|
if (count($query) > 0) { |
32
|
|
|
$values = []; |
33
|
|
|
|
34
|
|
|
foreach ($query as $obj) { |
35
|
|
|
$values[] = [ |
36
|
|
|
"comment" => $obj->comment, |
37
|
|
|
"date" => $obj->date, |
38
|
|
|
"first_name" => $obj->first_name, |
39
|
|
|
"last_name" => $obj->last_name, |
40
|
|
|
"ID_identite" => $obj->ID_identite, |
41
|
|
|
]; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
$this->getRender($values); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
//-------------------------- END GETTER ----------------------------------------------------------------------------// |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
|
51
|
|
|
//-------------------------- SETTER ----------------------------------------------------------------------------// |
52
|
|
|
//-------------------------- END SETTER ----------------------------------------------------------------------------// |
53
|
|
|
|
54
|
|
|
} |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.