@@ -166,13 +166,19 @@ |
||
166 | 166 | |
167 | 167 | <select name="id_coach[]" class="form-control" multiple> |
168 | 168 | <option value="0">----- <?php echo get_lang("Choose") ?> -----</option> |
169 | - <option value="0" <?php if(count($arr_infos) == 0) echo 'selected="selected"'; ?>> |
|
169 | + <option value="0" <?php if(count($arr_infos) == 0) { |
|
170 | + echo 'selected="selected"'; |
|
171 | +} |
|
172 | +?>> |
|
170 | 173 | <?php echo get_lang('None') ?> |
171 | 174 | </option> |
172 | 175 | <?php |
173 | 176 | foreach ($coaches as $enreg) { |
174 | 177 | ?> |
175 | - <option value="<?php echo $enreg['user_id']; ?>" <?php if(((is_array($arr_infos) && in_array($enreg['user_id'], $arr_infos)))) echo 'selected="selected"'; ?>> |
|
178 | + <option value="<?php echo $enreg['user_id']; ?>" <?php if(((is_array($arr_infos) && in_array($enreg['user_id'], $arr_infos)))) { |
|
179 | + echo 'selected="selected"'; |
|
180 | +} |
|
181 | +?>> |
|
176 | 182 | <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?> |
177 | 183 | </option> |
178 | 184 | <?php |
@@ -196,10 +196,11 @@ discard block |
||
196 | 196 | <?php |
197 | 197 | if (!empty($rows_session_category)) { |
198 | 198 | foreach($rows_session_category as $category) { |
199 | - if($category['id'] == $categoryId) |
|
200 | - echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>'; |
|
201 | - else |
|
202 | - echo '<option value="'.$category['id'].'">'.$category['name'].'</option>'; |
|
199 | + if($category['id'] == $categoryId) { |
|
200 | + echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>'; |
|
201 | + } else { |
|
202 | + echo '<option value="'.$category['id'].'">'.$category['name'].'</option>'; |
|
203 | + } |
|
203 | 204 | } |
204 | 205 | } |
205 | 206 | ?> |
@@ -223,7 +224,10 @@ discard block |
||
223 | 224 | <?php |
224 | 225 | foreach($rows_session as $enreg) { |
225 | 226 | ?> |
226 | - <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option> |
|
227 | + <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) { |
|
228 | + echo 'selected="selected"'; |
|
229 | +} |
|
230 | +?>><?php echo $enreg['name']; ?></option> |
|
227 | 231 | <?php } ?> |
228 | 232 | </select></div> |
229 | 233 | <?php unset($nosessionCourses); ?> |
@@ -245,7 +249,10 @@ discard block |
||
245 | 249 | <select id='destination' name="SessionCategoryList[]" multiple="multiple" size="20" style="width:320px;"> |
246 | 250 | <?php |
247 | 251 | foreach($rows_category_session as $enreg) { ?> |
248 | - <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option> |
|
252 | + <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) { |
|
253 | + echo 'selected="selected"'; |
|
254 | +} |
|
255 | +?>><?php echo $enreg['name']; ?></option> |
|
249 | 256 | <?php } ?> |
250 | 257 | </select></td> |
251 | 258 | </tr> |
@@ -72,7 +72,10 @@ discard block |
||
72 | 72 | <div class="form-group"> |
73 | 73 | <label class="col-sm-3 control-label"><?php echo get_lang('SessionCategoryName') ?></label> |
74 | 74 | <div class="col-sm-6"> |
75 | - <input type="text" class="form-control" name="name" placeholder="<?php echo get_lang('Category') ?>" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); ?>"> |
|
75 | + <input type="text" class="form-control" name="name" placeholder="<?php echo get_lang('Category') ?>" size="50" maxlength="50" value="<?php if($formSent) { |
|
76 | + echo api_htmlentities($name,ENT_QUOTES,$charset); |
|
77 | +} |
|
78 | +?>"> |
|
76 | 79 | </div> |
77 | 80 | <div class="col-md-3"></div> |
78 | 81 | </div> |
@@ -90,58 +93,184 @@ discard block |
||
90 | 93 | <div class="col-sm-6"> |
91 | 94 | <select name="day_start"> |
92 | 95 | <option value="1">01</option> |
93 | - <option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_start == 2)) echo 'selected="selected"'; ?> >02</option> |
|
94 | - <option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_start == 3)) echo 'selected="selected"'; ?> >03</option> |
|
95 | - <option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_start == 4)) echo 'selected="selected"'; ?> >04</option> |
|
96 | - <option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_start == 5)) echo 'selected="selected"'; ?> >05</option> |
|
97 | - <option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_start == 6)) echo 'selected="selected"'; ?> >06</option> |
|
98 | - <option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_start == 7)) echo 'selected="selected"'; ?> >07</option> |
|
99 | - <option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_start == 8)) echo 'selected="selected"'; ?> >08</option> |
|
100 | - <option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_start == 9)) echo 'selected="selected"'; ?> >09</option> |
|
101 | - <option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_start == 10)) echo 'selected="selected"'; ?> >10</option> |
|
102 | - <option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_start == 11)) echo 'selected="selected"'; ?> >11</option> |
|
103 | - <option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_start == 12)) echo 'selected="selected"'; ?> >12</option> |
|
104 | - <option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_start == 13)) echo 'selected="selected"'; ?> >13</option> |
|
105 | - <option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_start == 14)) echo 'selected="selected"'; ?> >14</option> |
|
106 | - <option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_start == 15)) echo 'selected="selected"'; ?> >15</option> |
|
107 | - <option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_start == 16)) echo 'selected="selected"'; ?> >16</option> |
|
108 | - <option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_start == 17)) echo 'selected="selected"'; ?> >17</option> |
|
109 | - <option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_start == 18)) echo 'selected="selected"'; ?> >18</option> |
|
110 | - <option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_start == 19)) echo 'selected="selected"'; ?> >19</option> |
|
111 | - <option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_start == 20)) echo 'selected="selected"'; ?> >20</option> |
|
112 | - <option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_start == 21)) echo 'selected="selected"'; ?> >21</option> |
|
113 | - <option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_start == 22)) echo 'selected="selected"'; ?> >22</option> |
|
114 | - <option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_start == 23)) echo 'selected="selected"'; ?> >23</option> |
|
115 | - <option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_start == 24)) echo 'selected="selected"'; ?> >24</option> |
|
116 | - <option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_start == 25)) echo 'selected="selected"'; ?> >25</option> |
|
117 | - <option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_start == 26)) echo 'selected="selected"'; ?> >26</option> |
|
118 | - <option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_start == 27)) echo 'selected="selected"'; ?> >27</option> |
|
119 | - <option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_start == 28)) echo 'selected="selected"'; ?> >28</option> |
|
120 | - <option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_start == 29)) echo 'selected="selected"'; ?> >29</option> |
|
121 | - <option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_start == 30)) echo 'selected="selected"'; ?> >30</option> |
|
122 | - <option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_start == 31)) echo 'selected="selected"'; ?> >31</option> |
|
96 | + <option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_start == 2)) { |
|
97 | + echo 'selected="selected"'; |
|
98 | +} |
|
99 | +?> >02</option> |
|
100 | + <option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_start == 3)) { |
|
101 | + echo 'selected="selected"'; |
|
102 | +} |
|
103 | +?> >03</option> |
|
104 | + <option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_start == 4)) { |
|
105 | + echo 'selected="selected"'; |
|
106 | +} |
|
107 | +?> >04</option> |
|
108 | + <option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_start == 5)) { |
|
109 | + echo 'selected="selected"'; |
|
110 | +} |
|
111 | +?> >05</option> |
|
112 | + <option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_start == 6)) { |
|
113 | + echo 'selected="selected"'; |
|
114 | +} |
|
115 | +?> >06</option> |
|
116 | + <option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_start == 7)) { |
|
117 | + echo 'selected="selected"'; |
|
118 | +} |
|
119 | +?> >07</option> |
|
120 | + <option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_start == 8)) { |
|
121 | + echo 'selected="selected"'; |
|
122 | +} |
|
123 | +?> >08</option> |
|
124 | + <option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_start == 9)) { |
|
125 | + echo 'selected="selected"'; |
|
126 | +} |
|
127 | +?> >09</option> |
|
128 | + <option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_start == 10)) { |
|
129 | + echo 'selected="selected"'; |
|
130 | +} |
|
131 | +?> >10</option> |
|
132 | + <option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_start == 11)) { |
|
133 | + echo 'selected="selected"'; |
|
134 | +} |
|
135 | +?> >11</option> |
|
136 | + <option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_start == 12)) { |
|
137 | + echo 'selected="selected"'; |
|
138 | +} |
|
139 | +?> >12</option> |
|
140 | + <option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_start == 13)) { |
|
141 | + echo 'selected="selected"'; |
|
142 | +} |
|
143 | +?> >13</option> |
|
144 | + <option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_start == 14)) { |
|
145 | + echo 'selected="selected"'; |
|
146 | +} |
|
147 | +?> >14</option> |
|
148 | + <option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_start == 15)) { |
|
149 | + echo 'selected="selected"'; |
|
150 | +} |
|
151 | +?> >15</option> |
|
152 | + <option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_start == 16)) { |
|
153 | + echo 'selected="selected"'; |
|
154 | +} |
|
155 | +?> >16</option> |
|
156 | + <option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_start == 17)) { |
|
157 | + echo 'selected="selected"'; |
|
158 | +} |
|
159 | +?> >17</option> |
|
160 | + <option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_start == 18)) { |
|
161 | + echo 'selected="selected"'; |
|
162 | +} |
|
163 | +?> >18</option> |
|
164 | + <option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_start == 19)) { |
|
165 | + echo 'selected="selected"'; |
|
166 | +} |
|
167 | +?> >19</option> |
|
168 | + <option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_start == 20)) { |
|
169 | + echo 'selected="selected"'; |
|
170 | +} |
|
171 | +?> >20</option> |
|
172 | + <option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_start == 21)) { |
|
173 | + echo 'selected="selected"'; |
|
174 | +} |
|
175 | +?> >21</option> |
|
176 | + <option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_start == 22)) { |
|
177 | + echo 'selected="selected"'; |
|
178 | +} |
|
179 | +?> >22</option> |
|
180 | + <option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_start == 23)) { |
|
181 | + echo 'selected="selected"'; |
|
182 | +} |
|
183 | +?> >23</option> |
|
184 | + <option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_start == 24)) { |
|
185 | + echo 'selected="selected"'; |
|
186 | +} |
|
187 | +?> >24</option> |
|
188 | + <option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_start == 25)) { |
|
189 | + echo 'selected="selected"'; |
|
190 | +} |
|
191 | +?> >25</option> |
|
192 | + <option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_start == 26)) { |
|
193 | + echo 'selected="selected"'; |
|
194 | +} |
|
195 | +?> >26</option> |
|
196 | + <option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_start == 27)) { |
|
197 | + echo 'selected="selected"'; |
|
198 | +} |
|
199 | +?> >27</option> |
|
200 | + <option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_start == 28)) { |
|
201 | + echo 'selected="selected"'; |
|
202 | +} |
|
203 | +?> >28</option> |
|
204 | + <option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_start == 29)) { |
|
205 | + echo 'selected="selected"'; |
|
206 | +} |
|
207 | +?> >29</option> |
|
208 | + <option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_start == 30)) { |
|
209 | + echo 'selected="selected"'; |
|
210 | +} |
|
211 | +?> >30</option> |
|
212 | + <option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_start == 31)) { |
|
213 | + echo 'selected="selected"'; |
|
214 | +} |
|
215 | +?> >31</option> |
|
123 | 216 | </select> |
124 | 217 | / |
125 | 218 | <select name="month_start"> |
126 | 219 | <option value="1">01</option> |
127 | - <option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_start == 2)) echo 'selected="selected"'; ?> >02</option> |
|
128 | - <option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_start == 3)) echo 'selected="selected"'; ?> >03</option> |
|
129 | - <option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_start == 4)) echo 'selected="selected"'; ?> >04</option> |
|
130 | - <option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_start == 5)) echo 'selected="selected"'; ?> >05</option> |
|
131 | - <option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_start == 6)) echo 'selected="selected"'; ?> >06</option> |
|
132 | - <option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_start == 7)) echo 'selected="selected"'; ?> >07</option> |
|
133 | - <option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_start == 8)) echo 'selected="selected"'; ?> >08</option> |
|
134 | - <option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_start == 9)) echo 'selected="selected"'; ?> >09</option> |
|
135 | - <option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_start == 10)) echo 'selected="selected"'; ?> >10</option> |
|
136 | - <option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_start == 11)) echo 'selected="selected"'; ?> >11</option> |
|
137 | - <option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_start == 12)) echo 'selected="selected"'; ?> >12</option> |
|
220 | + <option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_start == 2)) { |
|
221 | + echo 'selected="selected"'; |
|
222 | +} |
|
223 | +?> >02</option> |
|
224 | + <option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_start == 3)) { |
|
225 | + echo 'selected="selected"'; |
|
226 | +} |
|
227 | +?> >03</option> |
|
228 | + <option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_start == 4)) { |
|
229 | + echo 'selected="selected"'; |
|
230 | +} |
|
231 | +?> >04</option> |
|
232 | + <option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_start == 5)) { |
|
233 | + echo 'selected="selected"'; |
|
234 | +} |
|
235 | +?> >05</option> |
|
236 | + <option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_start == 6)) { |
|
237 | + echo 'selected="selected"'; |
|
238 | +} |
|
239 | +?> >06</option> |
|
240 | + <option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_start == 7)) { |
|
241 | + echo 'selected="selected"'; |
|
242 | +} |
|
243 | +?> >07</option> |
|
244 | + <option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_start == 8)) { |
|
245 | + echo 'selected="selected"'; |
|
246 | +} |
|
247 | +?> >08</option> |
|
248 | + <option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_start == 9)) { |
|
249 | + echo 'selected="selected"'; |
|
250 | +} |
|
251 | +?> >09</option> |
|
252 | + <option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_start == 10)) { |
|
253 | + echo 'selected="selected"'; |
|
254 | +} |
|
255 | +?> >10</option> |
|
256 | + <option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_start == 11)) { |
|
257 | + echo 'selected="selected"'; |
|
258 | +} |
|
259 | +?> >11</option> |
|
260 | + <option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_start == 12)) { |
|
261 | + echo 'selected="selected"'; |
|
262 | +} |
|
263 | +?> >12</option> |
|
138 | 264 | </select> |
139 | 265 | / |
140 | 266 | <select name="year_start"> |
141 | 267 | <?php |
142 | 268 | for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) { |
143 | 269 | ?> |
144 | - <option value="<?php echo $i; ?>" <?php if((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
270 | + <option value="<?php echo $i; ?>" <?php if((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) { |
|
271 | + echo 'selected="selected"'; |
|
272 | +} |
|
273 | +?> ><?php echo $i; ?></option> |
|
145 | 274 | <?php |
146 | 275 | } |
147 | 276 | ?> |
@@ -529,10 +529,11 @@ |
||
529 | 529 | $result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']); |
530 | 530 | foreach ($data_array['attendant_calendar'] as $class_day) { |
531 | 531 | if ($class_day['done_attendance'] == 1) { |
532 | - if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) |
|
533 | - $result[$class_day['id']] = get_lang('UserAttendedSymbol'); |
|
534 | - else |
|
535 | - $result[$class_day['id']] = '<span style="color:red">'.get_lang('UserNotAttendedSymbol').'</span>'; |
|
532 | + if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) { |
|
533 | + $result[$class_day['id']] = get_lang('UserAttendedSymbol'); |
|
534 | + } else { |
|
535 | + $result[$class_day['id']] = '<span style="color:red">'.get_lang('UserNotAttendedSymbol').'</span>'; |
|
536 | + } |
|
536 | 537 | } else { |
537 | 538 | $result[$class_day['id']] = " "; |
538 | 539 | } |
@@ -34,8 +34,9 @@ discard block |
||
34 | 34 | Event::event_access_tool(TOOL_GLOSSARY); |
35 | 35 | |
36 | 36 | function sorter($item1, $item2) { |
37 | - if ($item1[2] == $item2[2]) |
|
38 | - return 0; |
|
37 | + if ($item1[2] == $item2[2]) { |
|
38 | + return 0; |
|
39 | + } |
|
39 | 40 | return $item1[2] < $item2[2] ? -1 : 1; |
40 | 41 | } |
41 | 42 | |
@@ -242,10 +243,11 @@ discard block |
||
242 | 243 | false |
243 | 244 | ); |
244 | 245 | |
245 | - if ($result) |
|
246 | - $good++; |
|
247 | - else |
|
248 | - $bad++; |
|
246 | + if ($result) { |
|
247 | + $good++; |
|
248 | + } else { |
|
249 | + $bad++; |
|
250 | + } |
|
249 | 251 | } |
250 | 252 | |
251 | 253 | Display::display_confirmation_message(get_lang ("TermsImported") . ':' . $good); |
@@ -121,8 +121,9 @@ discard block |
||
121 | 121 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
122 | 122 | $my_session_list = array(); |
123 | 123 | foreach($new_session_list as $item) { |
124 | - if (!empty($item['id_session'])) |
|
125 | - $my_session_list[] = $item['id_session']; |
|
124 | + if (!empty($item['id_session'])) { |
|
125 | + $my_session_list[] = $item['id_session']; |
|
126 | + } |
|
126 | 127 | } |
127 | 128 | if (!in_array($session_id, $my_session_list)) { |
128 | 129 | break; |
@@ -254,8 +255,9 @@ discard block |
||
254 | 255 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
255 | 256 | $my_session_list = array(); |
256 | 257 | foreach($new_session_list as $item) { |
257 | - if (!empty($item['id_session'])) |
|
258 | - $my_session_list[] = $item['id_session']; |
|
258 | + if (!empty($item['id_session'])) { |
|
259 | + $my_session_list[] = $item['id_session']; |
|
260 | + } |
|
259 | 261 | } |
260 | 262 | if (!in_array($session_id, $my_session_list)) { |
261 | 263 | break; |
@@ -384,8 +386,9 @@ discard block |
||
384 | 386 | $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id()); |
385 | 387 | $my_session_list = array(); |
386 | 388 | foreach($new_session_list as $item) { |
387 | - if (!empty($item['id_session'])) |
|
388 | - $my_session_list[] = $item['id_session']; |
|
389 | + if (!empty($item['id_session'])) { |
|
390 | + $my_session_list[] = $item['id_session']; |
|
391 | + } |
|
389 | 392 | } |
390 | 393 | if (!in_array($session_id, $my_session_list)) { |
391 | 394 | break; |
@@ -774,10 +774,12 @@ discard block |
||
774 | 774 | public static function update_openid($user_id, $openid) |
775 | 775 | { |
776 | 776 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
777 | - if ($user_id != strval(intval($user_id))) |
|
778 | - return false; |
|
779 | - if ($user_id === false) |
|
780 | - return false; |
|
777 | + if ($user_id != strval(intval($user_id))) { |
|
778 | + return false; |
|
779 | + } |
|
780 | + if ($user_id === false) { |
|
781 | + return false; |
|
782 | + } |
|
781 | 783 | $sql = "UPDATE $table_user SET |
782 | 784 | openid='".Database::escape_string($openid)."'"; |
783 | 785 | $sql .= " WHERE id= $user_id"; |
@@ -2069,8 +2071,9 @@ discard block |
||
2069 | 2071 | if (empty($user_id)) { |
2070 | 2072 | $user_id = 0; |
2071 | 2073 | } else { |
2072 | - if ($user_id != strval(intval($user_id))) |
|
2073 | - return array(); |
|
2074 | + if ($user_id != strval(intval($user_id))) { |
|
2075 | + return array(); |
|
2076 | + } |
|
2074 | 2077 | } |
2075 | 2078 | $extra_data = array(); |
2076 | 2079 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2162,8 +2165,9 @@ discard block |
||
2162 | 2165 | if (empty($user_id)) { |
2163 | 2166 | $user_id = 0; |
2164 | 2167 | } else { |
2165 | - if ($user_id != strval(intval($user_id))) |
|
2166 | - return array(); |
|
2168 | + if ($user_id != strval(intval($user_id))) { |
|
2169 | + return array(); |
|
2170 | + } |
|
2167 | 2171 | } |
2168 | 2172 | $extra_data = array(); |
2169 | 2173 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2880,13 +2884,15 @@ discard block |
||
2880 | 2884 | */ |
2881 | 2885 | public static function get_api_keys($user_id = null, $api_service = 'dokeos') |
2882 | 2886 | { |
2883 | - if ($user_id != strval(intval($user_id))) |
|
2884 | - return false; |
|
2887 | + if ($user_id != strval(intval($user_id))) { |
|
2888 | + return false; |
|
2889 | + } |
|
2885 | 2890 | if (empty($user_id)) { |
2886 | 2891 | $user_id = api_get_user_id(); |
2887 | 2892 | } |
2888 | - if ($user_id === false) |
|
2889 | - return false; |
|
2893 | + if ($user_id === false) { |
|
2894 | + return false; |
|
2895 | + } |
|
2890 | 2896 | $service_name = Database::escape_string($api_service); |
2891 | 2897 | if (is_string($service_name) === false) { |
2892 | 2898 | return false; |
@@ -2894,11 +2900,14 @@ discard block |
||
2894 | 2900 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
2895 | 2901 | $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';"; |
2896 | 2902 | $res = Database::query($sql); |
2897 | - if ($res === false) |
|
2898 | - return false; //error during query |
|
2903 | + if ($res === false) { |
|
2904 | + return false; |
|
2905 | + } |
|
2906 | + //error during query |
|
2899 | 2907 | $num = Database::num_rows($res); |
2900 | - if ($num == 0) |
|
2901 | - return false; |
|
2908 | + if ($num == 0) { |
|
2909 | + return false; |
|
2910 | + } |
|
2902 | 2911 | $list = array(); |
2903 | 2912 | while ($row = Database::fetch_array($res)) { |
2904 | 2913 | $list[$row['id']] = $row['api_key']; |
@@ -2913,13 +2922,15 @@ discard block |
||
2913 | 2922 | */ |
2914 | 2923 | public static function add_api_key($user_id = null, $api_service = 'dokeos') |
2915 | 2924 | { |
2916 | - if ($user_id != strval(intval($user_id))) |
|
2917 | - return false; |
|
2925 | + if ($user_id != strval(intval($user_id))) { |
|
2926 | + return false; |
|
2927 | + } |
|
2918 | 2928 | if (empty($user_id)) { |
2919 | 2929 | $user_id = api_get_user_id(); |
2920 | 2930 | } |
2921 | - if ($user_id === false) |
|
2922 | - return false; |
|
2931 | + if ($user_id === false) { |
|
2932 | + return false; |
|
2933 | + } |
|
2923 | 2934 | $service_name = Database::escape_string($api_service); |
2924 | 2935 | if (is_string($service_name) === false) { |
2925 | 2936 | return false; |
@@ -2928,8 +2939,10 @@ discard block |
||
2928 | 2939 | $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key |
2929 | 2940 | $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')"; |
2930 | 2941 | $res = Database::query($sql); |
2931 | - if ($res === false) |
|
2932 | - return false; //error during query |
|
2942 | + if ($res === false) { |
|
2943 | + return false; |
|
2944 | + } |
|
2945 | + //error during query |
|
2933 | 2946 | $num = Database::insert_id(); |
2934 | 2947 | return ($num == 0) ? false : $num; |
2935 | 2948 | } |
@@ -2941,22 +2954,29 @@ discard block |
||
2941 | 2954 | */ |
2942 | 2955 | public static function delete_api_key($key_id) |
2943 | 2956 | { |
2944 | - if ($key_id != strval(intval($key_id))) |
|
2945 | - return false; |
|
2946 | - if ($key_id === false) |
|
2947 | - return false; |
|
2957 | + if ($key_id != strval(intval($key_id))) { |
|
2958 | + return false; |
|
2959 | + } |
|
2960 | + if ($key_id === false) { |
|
2961 | + return false; |
|
2962 | + } |
|
2948 | 2963 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
2949 | 2964 | $sql = "SELECT * FROM $t_api WHERE id = ".$key_id; |
2950 | 2965 | $res = Database::query($sql); |
2951 | - if ($res === false) |
|
2952 | - return false; //error during query |
|
2966 | + if ($res === false) { |
|
2967 | + return false; |
|
2968 | + } |
|
2969 | + //error during query |
|
2953 | 2970 | $num = Database::num_rows($res); |
2954 | - if ($num !== 1) |
|
2955 | - return false; |
|
2971 | + if ($num !== 1) { |
|
2972 | + return false; |
|
2973 | + } |
|
2956 | 2974 | $sql = "DELETE FROM $t_api WHERE id = ".$key_id; |
2957 | 2975 | $res = Database::query($sql); |
2958 | - if ($res === false) |
|
2959 | - return false; //error during query |
|
2976 | + if ($res === false) { |
|
2977 | + return false; |
|
2978 | + } |
|
2979 | + //error during query |
|
2960 | 2980 | return true; |
2961 | 2981 | } |
2962 | 2982 | |
@@ -2968,10 +2988,12 @@ discard block |
||
2968 | 2988 | */ |
2969 | 2989 | public static function update_api_key($user_id, $api_service) |
2970 | 2990 | { |
2971 | - if ($user_id != strval(intval($user_id))) |
|
2972 | - return false; |
|
2973 | - if ($user_id === false) |
|
2974 | - return false; |
|
2991 | + if ($user_id != strval(intval($user_id))) { |
|
2992 | + return false; |
|
2993 | + } |
|
2994 | + if ($user_id === false) { |
|
2995 | + return false; |
|
2996 | + } |
|
2975 | 2997 | $service_name = Database::escape_string($api_service); |
2976 | 2998 | if (is_string($service_name) === false) { |
2977 | 2999 | return false; |
@@ -2997,12 +3019,15 @@ discard block |
||
2997 | 3019 | */ |
2998 | 3020 | public static function get_api_key_id($user_id, $api_service) |
2999 | 3021 | { |
3000 | - if ($user_id != strval(intval($user_id))) |
|
3001 | - return false; |
|
3002 | - if ($user_id === false) |
|
3003 | - return false; |
|
3004 | - if (empty($api_service)) |
|
3005 | - return false; |
|
3022 | + if ($user_id != strval(intval($user_id))) { |
|
3023 | + return false; |
|
3024 | + } |
|
3025 | + if ($user_id === false) { |
|
3026 | + return false; |
|
3027 | + } |
|
3028 | + if (empty($api_service)) { |
|
3029 | + return false; |
|
3030 | + } |
|
3006 | 3031 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3007 | 3032 | $api_service = Database::escape_string($api_service); |
3008 | 3033 | $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'"; |
@@ -4473,8 +4498,9 @@ discard block |
||
4473 | 4498 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4474 | 4499 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4475 | 4500 | if (!$admin_permissions) { |
4476 | - if ($field_details[7] == 0) |
|
4477 | - $form->freeze('extra_'.$field_details[1]); |
|
4501 | + if ($field_details[7] == 0) { |
|
4502 | + $form->freeze('extra_'.$field_details[1]); |
|
4503 | + } |
|
4478 | 4504 | } |
4479 | 4505 | break; |
4480 | 4506 | case ExtraField::FIELD_TYPE_RADIO: |
@@ -4491,8 +4517,9 @@ discard block |
||
4491 | 4517 | } |
4492 | 4518 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], ''); |
4493 | 4519 | if (!$admin_permissions) { |
4494 | - if ($field_details[7] == 0) |
|
4495 | - $form->freeze('extra_'.$field_details[1]); |
|
4520 | + if ($field_details[7] == 0) { |
|
4521 | + $form->freeze('extra_'.$field_details[1]); |
|
4522 | + } |
|
4496 | 4523 | } |
4497 | 4524 | break; |
4498 | 4525 | case ExtraField::FIELD_TYPE_SELECT: |
@@ -4530,8 +4557,9 @@ discard block |
||
4530 | 4557 | ); |
4531 | 4558 | |
4532 | 4559 | if (!$admin_permissions) { |
4533 | - if ($field_details[7] == 0) |
|
4534 | - $form->freeze('extra_'.$field_details[1]); |
|
4560 | + if ($field_details[7] == 0) { |
|
4561 | + $form->freeze('extra_'.$field_details[1]); |
|
4562 | + } |
|
4535 | 4563 | } |
4536 | 4564 | break; |
4537 | 4565 | case ExtraField::FIELD_TYPE_SELECT_MULTIPLE: |
@@ -4547,8 +4575,9 @@ discard block |
||
4547 | 4575 | array('multiple' => 'multiple') |
4548 | 4576 | ); |
4549 | 4577 | if (!$admin_permissions) { |
4550 | - if ($field_details[7] == 0) |
|
4551 | - $form->freeze('extra_'.$field_details[1]); |
|
4578 | + if ($field_details[7] == 0) { |
|
4579 | + $form->freeze('extra_'.$field_details[1]); |
|
4580 | + } |
|
4552 | 4581 | } |
4553 | 4582 | break; |
4554 | 4583 | case ExtraField::FIELD_TYPE_DATE: |
@@ -4556,8 +4585,9 @@ discard block |
||
4556 | 4585 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4557 | 4586 | $form->setDefaults($defaults); |
4558 | 4587 | if (!$admin_permissions) { |
4559 | - if ($field_details[7] == 0) |
|
4560 | - $form->freeze('extra_'.$field_details[1]); |
|
4588 | + if ($field_details[7] == 0) { |
|
4589 | + $form->freeze('extra_'.$field_details[1]); |
|
4590 | + } |
|
4561 | 4591 | } |
4562 | 4592 | $form->applyFilter('theme', 'trim'); |
4563 | 4593 | break; |
@@ -4566,8 +4596,9 @@ discard block |
||
4566 | 4596 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4567 | 4597 | $form->setDefaults($defaults); |
4568 | 4598 | if (!$admin_permissions) { |
4569 | - if ($field_details[7] == 0) |
|
4570 | - $form->freeze('extra_'.$field_details[1]); |
|
4599 | + if ($field_details[7] == 0) { |
|
4600 | + $form->freeze('extra_'.$field_details[1]); |
|
4601 | + } |
|
4571 | 4602 | } |
4572 | 4603 | $form->applyFilter('theme', 'trim'); |
4573 | 4604 | break; |
@@ -4586,8 +4617,9 @@ discard block |
||
4586 | 4617 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], ' '); |
4587 | 4618 | |
4588 | 4619 | if (!$admin_permissions) { |
4589 | - if ($field_details[7] == 0) |
|
4590 | - $form->freeze('extra_'.$field_details[1]); |
|
4620 | + if ($field_details[7] == 0) { |
|
4621 | + $form->freeze('extra_'.$field_details[1]); |
|
4622 | + } |
|
4591 | 4623 | } |
4592 | 4624 | |
4593 | 4625 | /* Recoding the selected values for double : if the user has |
@@ -4647,8 +4679,9 @@ discard block |
||
4647 | 4679 | break; |
4648 | 4680 | case ExtraField::FIELD_TYPE_TIMEZONE: |
4649 | 4681 | $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), ''); |
4650 | - if ($field_details[7] == 0) |
|
4651 | - $form->freeze('extra_'.$field_details[1]); |
|
4682 | + if ($field_details[7] == 0) { |
|
4683 | + $form->freeze('extra_'.$field_details[1]); |
|
4684 | + } |
|
4652 | 4685 | break; |
4653 | 4686 | case ExtraField::FIELD_TYPE_SOCIAL_PROFILE: |
4654 | 4687 | // get the social network's favicon |
@@ -4673,8 +4706,9 @@ discard block |
||
4673 | 4706 | ); |
4674 | 4707 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4675 | 4708 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4676 | - if ($field_details[7] == 0) |
|
4677 | - $form->freeze('extra_'.$field_details[1]); |
|
4709 | + if ($field_details[7] == 0) { |
|
4710 | + $form->freeze('extra_'.$field_details[1]); |
|
4711 | + } |
|
4678 | 4712 | break; |
4679 | 4713 | case ExtraField::FIELD_TYPE_FILE: |
4680 | 4714 | $extra_field = 'extra_'.$field_details[1]; |
@@ -4991,8 +5025,9 @@ discard block |
||
4991 | 5025 | $url .= "?s=$s&d=$d&r=$r"; |
4992 | 5026 | if ( $img ) { |
4993 | 5027 | $url = '<img src="' . $url . '"'; |
4994 | - foreach ( $atts as $key => $val ) |
|
4995 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
5028 | + foreach ( $atts as $key => $val ) { |
|
5029 | + $url .= ' ' . $key . '="' . $val . '"'; |
|
5030 | + } |
|
4996 | 5031 | $url .= ' />'; |
4997 | 5032 | } |
4998 | 5033 | return $url; |
@@ -29,8 +29,9 @@ |
||
29 | 29 | while (($file = readdir($dh)) !== false) { |
30 | 30 | if ($file[0] <> '.' && substr($file, -4, strlen($file)) == '.php') { |
31 | 31 | if ($only_main_name) { |
32 | - if ($file != '' && strpos($file, '.inc.php')) |
|
33 | - $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
32 | + if ($file != '' && strpos($file, '.inc.php')) { |
|
33 | + $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
34 | + } |
|
34 | 35 | } else { |
35 | 36 | $content_dir[] = $file; |
36 | 37 | } |
@@ -594,7 +594,7 @@ |
||
594 | 594 | if (!empty($limit_array)) { |
595 | 595 | if (count($limit_array) > 1) { |
596 | 596 | $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]); |
597 | - } else { |
|
597 | + } else { |
|
598 | 598 | $return_value .= ' LIMIT '.intval($limit_array[0]); |
599 | 599 | } |
600 | 600 | } |