65
65
$ nb_recy = $ db ->sql_numrows ($ recyclages );
66
66
67
67
//On récupère la date au bon format
68
- $ pub_date_from = date (" d M Y " , $ pub_date_from );
69
- $ pub_date_to = date (" d M Y " , $ pub_date_to );
68
+ $ pub_date_from = date (' d M Y ' , $ pub_date_from );
69
+ $ pub_date_to = date (' d M Y ' , $ pub_date_to );
70
70
71
71
//Création du field pour choisir l'affichage (attaque du jour, de la semaine ou du mois
72
72
echo "<fieldset><legend><b><font color='#0080FF'>Date d'affichage des attaques et des recyclages en BBCode " ;
97
97
$ bbcode .= "du " . $ pub_date_from . " au " . $ pub_date_to . "\n\n" ;
98
98
99
99
//Résultat requete
100
- while (list ($ attack_coord , $ attack_date , $ attack_metal , $ attack_cristal , $ attack_deut , $ attack_pertes ) = $ db ->sql_fetch_row ($ attaques )) {
101
- $ attack_date = date ("d M Y H:i " , $ attack_date );
102
- $ attack_metal = number_format ($ attack_metal , 0 , ', ' , ' ' );
103
- $ attack_cristal = number_format ($ attack_cristal , 0 , ', ' , ' ' );
104
- $ attack_deut = number_format ($ attack_deut , 0 , ', ' , ' ' );
105
- $ attack_pertes = number_format ($ attack_pertes , 0 , ', ' , ' ' );
106
- $ bbcode .= "Le " . $ attack_date . " victoire en " . $ attack_coord . ". \n" ;
107
- $ bbcode .= "[color= " . $ bbcolor ['m_g ' ] . "] " . $ attack_metal . "[/color] de métal, [color= " . $ bbcolor ['c_g ' ] . "] " . $ attack_cristal . "[/color] de cristal et [color= " . $ bbcolor ['d_g ' ] . "] " . $ attack_deut . "[/color] de deuterium ont été rapportés. \n" ;
108
- $ bbcode .= "Les pertes s'élèvent à [color= " . $ bbcolor ['perte ' ] . "] " . $ attack_pertes . "[/color]. \n\n" ;
100
+ if ($ nb_attack > 0 ) {
101
+ while (list ($ attack_coord , $ attack_date , $ attack_metal , $ attack_cristal , $ attack_deut , $ attack_pertes ) = $ db ->sql_fetch_row ($ attaques )) {
102
+ $ attack_date = date ('d M Y H:i ' , $ attack_date );
103
+ $ attack_metal = number_format ($ attack_metal , 0 , ', ' , ' ' );
104
+ $ attack_cristal = number_format ($ attack_cristal , 0 , ', ' , ' ' );
105
+ $ attack_deut = number_format ($ attack_deut , 0 , ', ' , ' ' );
106
+ $ attack_pertes = number_format ($ attack_pertes , 0 , ', ' , ' ' );
107
+ $ bbcode .= "Le " . $ attack_date . " victoire en " . $ attack_coord . ". \n" ;
108
+ $ bbcode .= "[color= " . $ bbcolor ['m_g ' ] . "] " . $ attack_metal . "[/color] de métal, [color= " . $ bbcolor ['c_g ' ] . "] " . $ attack_cristal . "[/color] de cristal et [color= " . $ bbcolor ['d_g ' ] . "] " . $ attack_deut . "[/color] de deuterium ont été rapportés. \n" ;
109
+ $ bbcode .= "Les pertes s'élèvent à [color= " . $ bbcolor ['perte ' ] . "] " . $ attack_pertes . "[/color]. \n\n" ;
110
+ }
111
+ } else {
112
+ $ bbcode = "Aucune Attaque enregistrée sur la période \n" ;
109
113
}
110
114
$ bbcode .= "[url=http://www.ogsteam.eu/]Généré par OGSpy et le module de gestion des attaques[/url] " ;
111
115
124
128
$ bbcode .= "du " . $ pub_date_from . " au " . $ pub_date_to . "\n\n" ;
125
129
126
130
//Résultat requete
127
- while (list ($ recy_coord , $ recy_date , $ recy_metal , $ recy_cristal ,) = $ db ->sql_fetch_row ($ recyclages )) {
128
- $ recy_date = date ("d M Y H:i " , $ recy_date );
129
- $ recy_metal = number_format ($ recy_metal , 0 , ', ' , ' ' );
130
- $ recy_cristal = number_format ($ recy_cristal , 0 , ', ' , ' ' );
131
- $ bbcode .= "Le " . $ recy_date . " recyclage en " . $ recy_coord . ". \n" ;
132
- $ bbcode .= "[color= " . $ bbcolor ['m_r ' ] . "] " . $ recy_metal . "[/color] de métal, [color= " . $ bbcolor ['c_r ' ] . "] " . $ recy_cristal . "[/color] de cristal ont été recyclés. \n\n" ;
131
+ if ($ nb_recy > 0 ) {
132
+ while (list ($ recy_coord , $ recy_date , $ recy_metal , $ recy_cristal ,) = $ db ->sql_fetch_row ($ recyclages )) {
133
+ $ recy_date = date ('d M Y H:i ' , $ recy_date );
134
+ $ recy_metal = number_format ($ recy_metal , 0 , ', ' , ' ' );
135
+ $ recy_cristal = number_format ($ recy_cristal , 0 , ', ' , ' ' );
136
+ $ bbcode .= "Le " . $ recy_date . " recyclage en " . $ recy_coord . ". \n" ;
137
+ $ bbcode .= "[color= " . $ bbcolor ['m_r ' ] . "] " . $ recy_metal . "[/color] de métal, [color= " . $ bbcolor ['c_r ' ] . "] " . $ recy_cristal . "[/color] de cristal ont été recyclés. \n\n" ;
138
+ }
139
+ } else {
140
+ $ bbcode = "Aucun Recyclage enregistré sur la période \n" ;
133
141
}
134
142
$ bbcode .= "[url=http://www.ogsteam.eu/]Généré par OGSpy et le module de gestion des attaques[/url] " ;
135
143
148
156
list ($ attack_metal , $ attack_cristal , $ attack_deut , $ attack_pertes ) = $ db ->sql_fetch_row ($ resultgains );
149
157
list ($ recy_metal , $ recy_cristal ) = $ db ->sql_fetch_row ($ resultgains_recy );
150
158
159
+ // Valeurs par Défaut si retour = null
160
+ $ attack_metal = $ attack_metal ?? 0 ;
161
+ $ attack_cristal = $ attack_cristal ?? 0 ;
162
+ $ attack_deut = $ attack_deut ?? 0 ;
163
+ $ attack_pertes = $ attack_pertes ?? 0 ;
164
+ $ recy_metal = $ attack_cristal ?? 0 ;
165
+ $ recy_cristal = $ attack_cristal ?? 0 ;
166
+
151
167
//Calcul des gains totaux
152
168
$ totalgains = $ attack_metal + $ attack_cristal + $ attack_deut + $ recy_metal + $ recy_cristal ;
153
169
176
192
$ bbcode .= "Nombre de recyclages durant cette periode : " . $ nb_recy . "\n\n" ;
177
193
$ bbcode .= "Metal recyclé : [color= " . $ bbcolor ['m_r ' ] . "] " . $ recy_metal . "[/color] \n" ;
178
194
$ bbcode .= "Cristal recyclé : [color= " . $ bbcolor ['c_r ' ] . "] " . $ recy_cristal . "[/color] \n\n" ;
179
- if ($ renta > 0 ) $ bbcode .= "Rentabilité : [color= " . $ bbcolor ['renta ' ] . "] " . $ renta . "[/color] \n\n" ;
180
- else $ bbcode .= "Rentabilité : [color= " . $ bbcolor ['perte ' ] . "] " . $ renta . "[/color] \n\n" ;
195
+ if ($ renta > 0 ) {
196
+ $ bbcode .= "Rentabilité : [color= " . $ bbcolor ['renta ' ] . "] " . $ renta . "[/color] \n\n" ;
197
+ }else {
198
+ $ bbcode .= "Rentabilité : [color= " . $ bbcolor ['perte ' ] . "] " . $ renta . "[/color] \n\n" ;
199
+ }
200
+
181
201
$ bbcode .= "[url=http://www.ogsteam.eu/]Généré par OGSpy et le module de gestion des attaques[/url] " ;
182
202
183
203
191
211
echo "<br> " ;
192
212
echo "</fieldset> " ;
193
213
echo "<br/> " ;
194
- ?>
214
+ ?>
0 commit comments