|
1
|
|
|
<?php |
|
2
|
|
|
namespace core; |
|
3
|
|
|
class Navigation { |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
8
|
|
|
public function __construct() { |
|
9
|
|
|
$dbc = App::getDb(); |
|
10
|
|
|
|
|
11
|
|
|
$query = $dbc->select()->from("navigation")->orderBy("ordre")->get(); |
|
12
|
|
|
|
|
13
|
|
|
if (is_array($query) && (count($query) > 0)) { |
|
14
|
|
|
foreach ($query as $obj) { |
|
15
|
|
|
/*$id_page[] = $obj->ID_page; |
|
|
|
|
|
|
16
|
|
|
$id_module[] = $obj->ID_module;*/ |
|
17
|
|
|
|
|
18
|
|
|
$this->getLienNavigation($obj->ID_page, $obj->ID_module); |
|
19
|
|
|
} |
|
20
|
|
|
} |
|
21
|
|
|
} |
|
22
|
|
|
//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
//-------------------------- GETTER ----------------------------------------------------------------------------// |
|
27
|
|
|
private function getLienNavigation($id_page, $id_module) { |
|
28
|
|
|
$dbc = App::getDb(); |
|
29
|
|
|
|
|
30
|
|
|
//pour un module |
|
31
|
|
|
if ($id_page == "") { |
|
32
|
|
|
$query = $dbc->select() |
|
33
|
|
|
->from("navigation") |
|
34
|
|
|
->from("module") |
|
35
|
|
|
->where("navigation.ID_module", "=", "module.ID_module", "AND") |
|
36
|
|
|
->where("module.ID_module", "=", $id_module) |
|
37
|
|
|
->get(); |
|
38
|
|
|
|
|
39
|
|
View Code Duplication |
if (is_array($query) && (count($query) > 0)) { |
|
|
|
|
|
|
40
|
|
|
foreach ($query as $obj) { |
|
41
|
|
|
echo($obj->nom_module." ++ ".$obj->url."<br>"); |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
} |
|
45
|
|
|
else { |
|
46
|
|
|
$query = $dbc->select() |
|
47
|
|
|
->from("navigation") |
|
48
|
|
|
->from("page") |
|
49
|
|
|
->where("navigation.ID_page", "=", "page.ID_page", "AND") |
|
50
|
|
|
->where("page.ID_page", "=", $id_page) |
|
51
|
|
|
->get(); |
|
52
|
|
|
|
|
53
|
|
View Code Duplication |
if (is_array($query) && (count($query) > 0)) { |
|
|
|
|
|
|
54
|
|
|
foreach ($query as $obj) { |
|
55
|
|
|
echo($obj->titre." ++ ".$obj->url."<br>"); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
//-------------------------- FIN GETTER ----------------------------------------------------------------------------// |
|
61
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
//-------------------------- SETTER ----------------------------------------------------------------------------// |
|
65
|
|
|
//-------------------------- FIN SETTER ----------------------------------------------------------------------------// |
|
66
|
|
|
} |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.