1 |
<?php |
2 |
/** |
3 |
* |
4 |
* |
5 |
* @package openmairie_exemple |
6 |
* @version SVN : $Id: tab.php 234 2010-11-18 15:00:55Z fmichon $ |
7 |
*/ |
8 |
|
9 |
require_once "../obj/utils.class.php"; |
10 |
$f = new utils("nohtml"); |
11 |
|
12 |
/** |
13 |
* Initialisation des variables |
14 |
*/ |
15 |
// Nom de l'objet metier |
16 |
(isset($_GET['obj']) ? $obj = $_GET['obj'] : $obj = ""); |
17 |
// Premier enregistrement a afficher |
18 |
(isset($_GET['premier']) ? $premier = $_GET['premier'] : $premier = 0); |
19 |
// Colonne choisie pour le tri |
20 |
(isset($_GET['tricol']) ? $tricol = $_GET['tricol'] : $tricol = ""); |
21 |
// Chaine recherchee |
22 |
if (isset($_POST['recherche'])) { |
23 |
$recherche = $_POST['recherche']; |
24 |
if (get_magic_quotes_gpc()) { |
25 |
$recherche1 = StripSlashes($recherche); |
26 |
} else { |
27 |
$recherche1 = $recherche; |
28 |
} |
29 |
} else { |
30 |
if (isset($_GET['recherche'])) { |
31 |
$recherche = $_GET['recherche']; |
32 |
if (get_magic_quotes_gpc()) { |
33 |
$recherche1 = StripSlashes($recherche); |
34 |
} else { |
35 |
$recherche1 = $recherche; |
36 |
} |
37 |
} else { |
38 |
$recherche = ""; |
39 |
$recherche1 = ""; |
40 |
} |
41 |
} |
42 |
// Colonne choisie pour la selection |
43 |
if (isset($_POST['selectioncol'])) { |
44 |
$selectioncol = $_POST['selectioncol']; |
45 |
} else { |
46 |
if (isset($_GET['selectioncol'])) { |
47 |
$selectioncol = $_GET['selectioncol']; |
48 |
} else { |
49 |
$selectioncol = ""; |
50 |
} |
51 |
} |
52 |
// ??? |
53 |
$ico = ""; |
54 |
// ??? |
55 |
$hiddenid = 0; |
56 |
|
57 |
/** |
58 |
* Verification des parametres |
59 |
*/ |
60 |
if (strpos($obj, "/") !== false |
61 |
or !file_exists("../sql/".$f->phptype."/".$obj.".inc")) { |
62 |
$class = "error"; |
63 |
$message = _("L'objet est invalide."); |
64 |
$f->addToMessage($class, $message); |
65 |
$f->setFlag(NULL); |
66 |
$f->display(); |
67 |
die(); |
68 |
} |
69 |
|
70 |
/** |
71 |
* |
72 |
*/ |
73 |
if ($f->isAccredited($obj)) { |
74 |
if (!isset($href) or $href == array()) { |
75 |
$href[0] = array( |
76 |
"lien" => "form.php?obj=".$obj."&tricol=".$tricol, |
77 |
"id" => "", |
78 |
"lib" => "<img src=\"../img/ajouter.png\" alt=\""._("Ajouter")."\" title=\""._("Ajouter")."\" />", |
79 |
); |
80 |
$href[1] = array( |
81 |
"lien" => "form.php?obj=".$obj."&tricol=".$tricol."&idx=", |
82 |
"id" => "&premier=".$premier."&recherche=".$recherche1."&selectioncol=".$selectioncol, |
83 |
"lib" => "<img src=\"../img/modifier.png\" alt=\""._("Modifier")."\" title=\""._("Modifier")."\" />", |
84 |
); |
85 |
$href[2] = array( |
86 |
"lien" => "form.php?obj=".$obj."&tricol=".$tricol."&idx=", |
87 |
"id" => "&ids=1&premier=".$premier."&recherche=".$recherche1."&selectioncol=".$selectioncol, |
88 |
"lib" => "<img src=\"../img/supprimer.png\" alt=\""._("Supprimer")."\" title=\""._("Supprimer")."\" />", |
89 |
); |
90 |
} |
91 |
} else { |
92 |
$href[0] = array("lien" => "#", "id" => "", "lib" => "", ); |
93 |
$href[1] = array("lien" => "", "id" => "", "lib" => "", ); |
94 |
$href[2] = array("lien" => "#", "id" => "", "lib" => "", ); |
95 |
} |
96 |
|
97 |
/** |
98 |
* |
99 |
*/ |
100 |
|
101 |
require_once "../sql/".$f->phptype."/".$obj.".inc"; |
102 |
|
103 |
/** |
104 |
* |
105 |
*/ |
106 |
// |
107 |
$f->setRight($obj."_tab"); |
108 |
$f->isAuthorized(); |
109 |
// |
110 |
$f->setTitle($ent); |
111 |
$f->setIcon($ico); |
112 |
$f->setHelp($obj); |
113 |
// |
114 |
$f->setFlag(NULL); |
115 |
$f->display(); |
116 |
|
117 |
|
118 |
|
119 |
/** |
120 |
* |
121 |
*/ |
122 |
// |
123 |
echo "<div id=\"formulaire\">\n\n"; |
124 |
// |
125 |
require_once PATH_OPENMAIRIE."om_table.class.php"; |
126 |
// |
127 |
echo "<ul>\n"; |
128 |
echo "\t<li><a href=\"#tabs-1\">".ucwords(_($obj))."</a></li>\n"; |
129 |
echo "</ul>\n"; |
130 |
// |
131 |
echo "\n<div id=\"tabs-1\">\n"; |
132 |
// |
133 |
if ($edition != "") { |
134 |
$edition = "../pdf/pdf.php?obj=".$edition; |
135 |
} |
136 |
// |
137 |
if (!isset($options)) { |
138 |
$options = array(); |
139 |
} |
140 |
// |
141 |
$tb = new table("../scr/tab.php", $table, $serie, $champAffiche, $champRecherche, $tri, $selection, $edition, $options); |
142 |
// |
143 |
$params = array( |
144 |
"obj" => $obj, |
145 |
"premier" => $premier, |
146 |
"recherche" => $recherche, |
147 |
"selectioncol" => $selectioncol, |
148 |
"tricol" => $tricol, |
149 |
); |
150 |
// |
151 |
$tb->display($params, $href, $f->db, "tab", false); |
152 |
// |
153 |
echo "</div>\n"; |
154 |
// |
155 |
echo "\n</div>\n"; |
156 |
|
157 |
?> |