Commit | Line | Data |
---|---|---|
3950bc21 FB |
1 | <?php |
2 | /*************************************************************************** | |
9f5bd98e | 3 | * Copyright (C) 2003-2010 Polytechnique.org * |
3950bc21 FB |
4 | * http://opensource.polytechnique.org/ * |
5 | * * | |
6 | * This program is free software; you can redistribute it and/or modify * | |
7 | * it under the terms of the GNU General Public License as published by * | |
8 | * the Free Software Foundation; either version 2 of the License, or * | |
9 | * (at your option) any later version. * | |
10 | * * | |
11 | * This program is distributed in the hope that it will be useful, * | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
14 | * GNU General Public License for more details. * | |
15 | * * | |
16 | * You should have received a copy of the GNU General Public License * | |
17 | * along with this program; if not, write to the Free Software * | |
18 | * Foundation, Inc., * | |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * | |
20 | ***************************************************************************/ | |
21 | ||
12bcf04b | 22 | class ProfileSettingJob extends ProfileSettingGeocoding |
37d44b3b FB |
23 | { |
24 | private $pub; | |
541e8d03 SJ |
25 | private $email_new; |
26 | private $email; | |
27 | private $url; | |
f93fb300 | 28 | private $bool; |
37d44b3b FB |
29 | private $checks; |
30 | ||
31 | public function __construct() | |
32 | { | |
12bcf04b | 33 | $this->pub = new ProfileSettingPub(); |
541e8d03 SJ |
34 | $this->email |
35 | = $this->email_new | |
12bcf04b RB |
36 | = new ProfileSettingEmail(); |
37 | $this->url = new ProfileSettingWeb(); | |
38 | $this->bool = new ProfileSettingBool(); | |
541e8d03 SJ |
39 | $this->checks = array('url' => array('w_url'), |
40 | 'email' => array('w_email'), | |
41 | 'pub' => array('pub', 'w_email_pub'), | |
42 | ); | |
37d44b3b FB |
43 | } |
44 | ||
afaa2cc7 SJ |
45 | public function emptyJob() |
46 | { | |
47 | return array( | |
48 | 'id' => '0', | |
49 | 'jobid' => '', | |
50 | 'pub' => 'private', | |
51 | 'name' => '', | |
52 | 'hq_acronym' => '', | |
53 | 'hq_url' => '', | |
54 | 'hq_email' => '', | |
55 | 'hq_address' => array( | |
56 | 'text' => '', | |
57 | 'accuracy' => '', | |
58 | 'postalText' => '', | |
59 | 'postalCode' => '', | |
60 | 'administrativeAreaId' => '', | |
61 | 'subAdministrativeAreaId' => '', | |
62 | 'localityId' => '', | |
63 | 'countryId' => '', | |
64 | 'latitude' => '', | |
65 | 'longitude' => '', | |
66 | 'north' => '', | |
67 | 'south' => '', | |
68 | 'east' => '', | |
69 | 'west' => '', | |
70 | 'cedex' => '', | |
71 | 'updateTime' => '', | |
72 | 'changed' => '0', | |
73 | 'removed' => '0', | |
74 | ), | |
75 | 'hq_phone' => '', | |
76 | 'hq_fax' => '', | |
77 | 'subSubSectorName' => null, | |
78 | 'sector' => '0', | |
79 | 'subSector' => '0', | |
80 | 'subSubSector' => '0', | |
81 | 'description' => '', | |
82 | 'w_url' => '', | |
83 | 'w_address' => array( | |
84 | 'pub' => 'private', | |
85 | 'text' => '', | |
86 | 'accuracy' => '', | |
87 | 'postalText' => '', | |
88 | 'postalCode' => '', | |
89 | 'administrativeAreaId' => '', | |
90 | 'subAdministrativeAreaId' => '', | |
91 | 'localityId' => '', | |
92 | 'countryId' => '', | |
93 | 'latitude' => '', | |
94 | 'longitude' => '', | |
95 | 'north' => '', | |
96 | 'south' => '', | |
97 | 'east' => '', | |
98 | 'west' => '', | |
99 | 'cedex' => '', | |
100 | 'updateTime' => '', | |
101 | 'changed' => '0', | |
102 | 'removed' => '0', | |
103 | ), | |
104 | 'w_email' => '', | |
105 | 'w_email_pub' => 'private', | |
106 | 'w_email_new' => '', | |
107 | 'w_phone' => array(0 => array( | |
108 | 'type' => 'fixed', | |
109 | 'tel' => '', | |
110 | 'pub' => 'private', | |
111 | 'comment' => '', | |
112 | )), | |
113 | ); | |
114 | } | |
115 | ||
b814a8b8 | 116 | private function cleanJob(ProfilePage &$page, $jobid, array &$job, &$success) |
37d44b3b FB |
117 | { |
118 | $success = true; | |
541e8d03 SJ |
119 | if ($job['w_email'] == "new@example.org") { |
120 | $job['w_email'] = $job['w_email_new']; | |
121 | } | |
37d44b3b FB |
122 | foreach ($this->checks as $obj=>&$fields) { |
123 | $chk =& $this->$obj; | |
124 | foreach ($fields as $field) { | |
125 | $job[$field] = $chk->value($page, $field, $job[$field], $s); | |
126 | if (!$s) { | |
127 | $success = false; | |
128 | $job[$field . '_error'] = true; | |
129 | } | |
130 | } | |
131 | } | |
541e8d03 | 132 | if (!$job['subSubSectorName']) { |
c7139c07 SJ |
133 | $res = XDB::query("SELECT name |
134 | FROM profile_job_subsubsector_enum | |
135 | WHERE id = {?}", | |
541e8d03 SJ |
136 | $job['subSubSector']); |
137 | $job['subSubSectorName'] = $res->fetchOneCell(); | |
c7139c07 SJ |
138 | } else { |
139 | $res = XDB::query("SELECT sectorid, subsectorid, id | |
140 | FROM profile_job_subsubsector_enum | |
141 | WHERE name = {?}", | |
541e8d03 | 142 | $job['subSubSectorName']); |
c7139c07 SJ |
143 | if ($res->numRows() != 1) { |
144 | $success = false; | |
145 | $job['sector_error'] = true; | |
146 | } else { | |
541e8d03 | 147 | list($job['sector'], $job['subSector'], $job['subSubSector']) = $res->fetchOneRow(); |
c7139c07 SJ |
148 | } |
149 | } | |
b814a8b8 | 150 | if ($job['name']) { |
c7139c07 SJ |
151 | $res = XDB::query("SELECT id |
152 | FROM profile_job_enum | |
153 | WHERE name = {?}", | |
154 | $job['name']); | |
155 | if ($res->numRows() != 1) { | |
4d7d27fc SJ |
156 | $this->geocodeAddress($job['hq_address'], $s); |
157 | if (!$s) { | |
158 | $gmapsGeocoder = new GMapsGeocoder(); | |
159 | $job['hq_address'] = $gmapsGeocoder->stripGeocodingFromAddress($job['hq_address']); | |
160 | } | |
024ec1e5 | 161 | $req = new EntrReq(S::user(), $page->profile, $jobid, $job['name'], $job['hq_acronym'], $job['hq_url'], |
4d7d27fc | 162 | $job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']); |
b814a8b8 SJ |
163 | $req->submit(); |
164 | $job['jobid'] = null; | |
c7139c07 SJ |
165 | } else { |
166 | $job['jobid'] = $res->fetchOneCell(); | |
167 | } | |
168 | } | |
541e8d03 SJ |
169 | $job['w_address']['pub'] = $this->pub->value($page, 'address_pub', $job['w_address']['pub'], $s); |
170 | if (!isset($job['w_phone'])) { | |
171 | $job['w_phone'] = array(); | |
bde2be3b | 172 | } |
12bcf04b | 173 | $profiletel = new ProfileSettingPhones('pro', $jobid); |
541e8d03 | 174 | $job['w_phone'] = $profiletel->value($page, 'tel', $job['w_phone'], $s); |
afaa2cc7 | 175 | |
37d44b3b FB |
176 | unset($job['removed']); |
177 | unset($job['new']); | |
37d44b3b FB |
178 | } |
179 | ||
180 | public function value(ProfilePage &$page, $field, $value, &$success) | |
181 | { | |
a6483c12 | 182 | require_once 'validations.inc.php'; |
024ec1e5 | 183 | $entreprise = ProfileValidate::get_typed_requests($page->pid(), 'entreprise'); |
b814a8b8 SJ |
184 | $entr_val = 0; |
185 | ||
37d44b3b FB |
186 | $init = false; |
187 | if (is_null($value)) { | |
188 | $value = $page->values['jobs']; | |
189 | $init = true; | |
190 | } | |
191 | $success = true; | |
a6483c12 | 192 | foreach ($value as $key => &$job) { |
b814a8b8 | 193 | $job['name'] = trim($job['name']); |
a6483c12 | 194 | if ($job['name'] == '' && $entreprise) { |
b814a8b8 | 195 | $job['tmp_name'] = $entreprise[$entr_val]->name; |
a6483c12 SJ |
196 | ++$entr_val; |
197 | } else if ($job['name'] == '') { | |
198 | $job['name_error'] = true; | |
199 | $success = false; | |
b814a8b8 | 200 | } |
b94719c1 | 201 | |
541e8d03 | 202 | if (isset($job['removed']) && $job['removed']) { |
b94719c1 SJ |
203 | if ($job['name'] == '' && $entreprise) { |
204 | $entreprise[$entr_val - 1]->clean(); | |
205 | } | |
ed01acac | 206 | array_splice($value, $key, 1); |
37d44b3b FB |
207 | } |
208 | } | |
a6483c12 | 209 | foreach ($value as $key => &$job) { |
37d44b3b | 210 | $ls = true; |
541e8d03 | 211 | $this->geocodeAddress($job['w_address'], $s); |
37d44b3b | 212 | $ls = ($ls && $s); |
bde2be3b | 213 | $this->cleanJob($page, $key, $job, $s); |
37d44b3b FB |
214 | $ls = ($ls && $s); |
215 | if (!$init) { | |
216 | $success = ($success && $ls); | |
217 | } | |
218 | } | |
219 | return $value; | |
220 | } | |
221 | ||
222 | public function save(ProfilePage &$page, $field, $value) | |
223 | { | |
ecad8a08 SJ |
224 | // TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done. |
225 | ||
a6483c12 | 226 | require_once 'profil.func.inc.php'; |
b814a8b8 | 227 | |
c7139c07 | 228 | XDB::execute("DELETE FROM profile_job |
ce0b2c6f | 229 | WHERE pid = {?}", |
a6483c12 | 230 | $page->pid()); |
541e8d03 SJ |
231 | XDB::execute("DELETE FROM profile_addresses |
232 | WHERE pid = {?} AND type = 'job'", | |
a6483c12 | 233 | $page->pid()); |
b235d980 | 234 | XDB::execute("DELETE FROM profile_phones |
ce0b2c6f | 235 | WHERE pid = {?} AND link_type = 'pro'", |
a6483c12 SJ |
236 | $page->pid()); |
237 | foreach ($value as $id => &$job) { | |
afaa2cc7 SJ |
238 | if (isset($job['name']) && $job['name']) { |
239 | if (isset($job['jobid']) && $job['jobid']) { | |
ce0b2c6f | 240 | XDB::execute("INSERT INTO profile_job (pid, id, description, sectorid, subsectorid, |
afaa2cc7 SJ |
241 | subsubsectorid, email, url, pub, email_pub, jobid) |
242 | VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})", | |
a6483c12 | 243 | $page->pid(), $id, $job['description'], $job['sector'], $job['subSector'], |
afaa2cc7 SJ |
244 | $job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub'], $job['jobid']); |
245 | } else { | |
ce0b2c6f | 246 | XDB::execute("INSERT INTO profile_job (pid, id, description, sectorid, subsectorid, |
afaa2cc7 SJ |
247 | subsubsectorid, email, url, pub, email_pub) |
248 | VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})", | |
a6483c12 | 249 | $page->pid(), $id, $job['description'], $job['sector'], $job['subSector'], |
afaa2cc7 SJ |
250 | $job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub']); |
251 | } | |
12bcf04b | 252 | $address = new ProfileSettingAddress(); |
a6483c12 | 253 | $address->saveAddress($page->pid(), $id, $job['w_address'], 'job'); |
12bcf04b | 254 | $profiletel = new ProfileSettingPhones('pro', $id); |
e3164bb1 | 255 | $profiletel->saveTels($page->pid(), 'tel', $job['w_phone']); |
b814a8b8 | 256 | } |
37d44b3b FB |
257 | } |
258 | } | |
259 | } | |
260 | ||
12bcf04b | 261 | class ProfileSettingJobs extends ProfilePage |
3950bc21 FB |
262 | { |
263 | protected $pg_template = 'profile/jobs.tpl'; | |
264 | ||
265 | public function __construct(PlWizard &$wiz) | |
266 | { | |
267 | parent::__construct($wiz); | |
37d44b3b | 268 | $this->settings['cv'] = null; |
72e96bc0 | 269 | $this->settings['corps'] = null; |
12bcf04b | 270 | $this->settings['jobs'] = new ProfileSettingJob(); |
72e96bc0 | 271 | $this->watched = array('cv' => true, 'jobs' => true, 'corps' => true); |
37d44b3b FB |
272 | } |
273 | ||
7c2e0f0d | 274 | protected function _fetchData() |
37d44b3b | 275 | { |
37d44b3b FB |
276 | // Checkout the CV |
277 | $res = XDB::query("SELECT cv | |
e5bcd851 FB |
278 | FROM profiles |
279 | WHERE pid = {?}", | |
280 | $this->pid()); | |
37d44b3b FB |
281 | $this->values['cv'] = $res->fetchOneCell(); |
282 | ||
72e96bc0 SJ |
283 | // Checkout the corps |
284 | $res = XDB::query("SELECT original_corpsid AS original, current_corpsid AS current, | |
285 | rankid AS rank, corps_pub AS pub | |
286 | FROM profile_corps | |
ce0b2c6f | 287 | WHERE pid = {?}", |
e5bcd851 | 288 | $this->pid()); |
72e96bc0 SJ |
289 | $this->values['corps'] = $res->fetchOneAssoc(); |
290 | ||
37d44b3b | 291 | // Build the jobs tree |
563f86f5 | 292 | $res = XDB::iterRow("SELECT j.id, j.jobid, je.name, j.sectorid, j.subsectorid, j.subsubsectorid, |
541e8d03 SJ |
293 | s.name, j.description, j.email, j.email_pub, j.url, j.pub, |
294 | je.acronym, je.url, je.email, | |
295 | aw.accuracy, aw.text, aw.postalText, aw.postalCode, aw.localityId, | |
296 | aw.subAdministrativeAreaId, aw.administrativeAreaId, aw.countryId, | |
297 | aw.latitude, aw.longitude, aw.pub, aw.updateTime, | |
298 | aw.north, aw.south, aw.east, aw.west, | |
299 | ah.accuracy, ah.text, ah.postalText, ah.postalCode, ah.localityId, | |
300 | ah.subAdministrativeAreaId, ah.administrativeAreaId, ah.countryId, | |
301 | ah.latitude, ah.longitude, ah.pub, ah.updateTime, | |
302 | ah.north, ah.south, ah.east, ah.west | |
c7139c07 SJ |
303 | FROM profile_job AS j |
304 | LEFT JOIN profile_job_enum AS je ON (j.jobid = je.id) | |
c7139c07 | 305 | LEFT JOIN profile_job_subsubsector_enum AS s ON (s.id = j.subsubsectorid) |
ce0b2c6f | 306 | LEFT JOIN profile_addresses AS aw ON (aw.pid = j.pid AND aw.type = 'job' |
4d7d27fc | 307 | AND aw.id = j.id) |
541e8d03 | 308 | LEFT JOIN profile_addresses AS ah ON (ah.jobid = j.jobid AND ah.type = 'hq') |
ce0b2c6f | 309 | WHERE j.pid = {?} |
541e8d03 | 310 | ORDER BY j.id", |
a6391000 | 311 | $this->pid()); |
37d44b3b | 312 | $this->values['jobs'] = array(); |
bde2be3b | 313 | |
afaa2cc7 SJ |
314 | if ($res->numRows() > 0) { |
315 | while (list($id, $jobid, $name, $sector, $subSector, $subSubSector, | |
316 | $subSubSectorName, $description, $w_email, $w_emailPub, $w_url, $pub, | |
317 | $hq_acronym, $hq_url, $hq_email, | |
318 | $w_accuracy, $w_text, $w_postalText, $w_postalCode, $w_localityId, | |
319 | $w_subAdministrativeAreaId, $w_administrativeAreaId, $w_countryId, | |
320 | $w_latitude, $w_longitude, $w_pub, $w_updateTime, | |
321 | $w_north, $w_south, $w_east, $w_west, | |
322 | $hq_accuracy, $hq_text, $hq_postalText, $hq_postalCode, $hq_localityId, | |
323 | $hq_subAdministrativeAreaId, $hq_administrativeAreaId, $hq_countryId, | |
324 | $hq_latitude, $hq_longitude, $hq_pub, $hq_updateTime, | |
325 | $hq_north, $hq_south, $hq_east, $hq_west, | |
326 | ) = $res->next()) { | |
327 | $this->values['jobs'][] = array( | |
328 | 'id' => $id, | |
329 | 'jobid' => $jobid, | |
330 | 'name' => $name, | |
331 | 'sector' => $sector, | |
332 | 'subSector' => $subSector, | |
333 | 'subSubSector' => $subSubSector, | |
334 | 'subSubSectorName' => $subSubSectorName, | |
335 | 'description' => $description, | |
336 | 'pub' => $pub, | |
337 | 'w_email' => $w_email, | |
338 | 'w_email_pub' => $w_emailPub, | |
339 | 'w_url' => $w_url, | |
340 | 'hq_acronym' => $hq_acronym, | |
341 | 'hq_url' => $hq_url, | |
342 | 'hq_email' => $hq_email, | |
343 | 'w_address' => array( | |
344 | 'accuracy' => $w_accuracy, | |
345 | 'text' => $w_text, | |
346 | 'postalText' => $w_postalText, | |
347 | 'postalCode' => $w_postalCode, | |
348 | 'localityId' => $w_localityId, | |
349 | 'subAdministrativeAreaId' => $w_subAdministrativeAreaId, | |
350 | 'administrativeAreaId' => $w_administrativeAreaId, | |
351 | 'countryId' => $w_countryId, | |
352 | 'latitude' => $w_latitude, | |
353 | 'longitude' => $w_longitude, | |
354 | 'pub' => $w_pub, | |
355 | 'updateTime' => $w_updateTime, | |
356 | 'north' => $w_north, | |
357 | 'south' => $w_south, | |
358 | 'east' => $w_east, | |
359 | 'west' => $w_west, | |
360 | ), | |
361 | 'hq_address' => array( | |
362 | 'accuracy' => $hq_accuracy, | |
363 | 'text' => $hq_text, | |
364 | 'postalText' => $hq_postalText, | |
365 | 'postalCode' => $hq_postalCode, | |
366 | 'localityId' => $hq_localityId, | |
367 | 'subAdministrativeAreaId' => $hq_subAdministrativeAreaId, | |
368 | 'administrativeAreaId' => $hq_administrativeAreaId, | |
369 | 'countryId' => $hq_countryId, | |
370 | 'latitude' => $hq_latitude, | |
371 | 'longitude' => $hq_longitude, | |
372 | 'pub' => $hq_pub, | |
373 | 'updateTime' => $hq_updateTime, | |
374 | 'north' => $hq_north, | |
375 | 'south' => $hq_south, | |
376 | 'east' => $hq_east, | |
377 | 'west' => $hq_west, | |
378 | ), | |
379 | ); | |
bde2be3b | 380 | } |
afaa2cc7 SJ |
381 | |
382 | $res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment | |
383 | FROM profile_phones | |
ce0b2c6f | 384 | WHERE pid = {?} AND link_type = 'pro' |
afaa2cc7 | 385 | ORDER BY link_id", |
a6483c12 | 386 | $this->pid()); |
afaa2cc7 SJ |
387 | $i = 0; |
388 | $jobNb = count($this->values['jobs']); | |
389 | while ($phone = $res->next()) { | |
390 | $jobid = $phone['jobid']; | |
391 | while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) { | |
392 | $i++; | |
393 | } | |
394 | if ($i >= $jobNb) { | |
395 | break; | |
396 | } | |
397 | $job =& $this->values['jobs'][$i]; | |
398 | if (!isset($job['w_phone'])) { | |
399 | $job['w_phone'] = array(); | |
400 | } | |
401 | if ($job['id'] == $jobid) { | |
402 | $job['w_phone'][] = $phone; | |
403 | } | |
bde2be3b | 404 | } |
afaa2cc7 SJ |
405 | foreach ($this->values['jobs'] as $id => &$job) { |
406 | if (!isset($job['w_phone'])) { | |
407 | $job['w_phone'] = array( | |
408 | 0 => array( | |
409 | 'type' => 'fixed', | |
410 | 'tel' => '', | |
411 | 'pub' => 'private', | |
412 | 'comment' => '', | |
413 | ) | |
414 | ); | |
415 | } | |
bde2be3b | 416 | } |
afaa2cc7 SJ |
417 | |
418 | $job['w_email_new'] = ''; | |
419 | if (!isset($job['hq_phone'])) { | |
420 | $job['hq_phone'] = ''; | |
bde2be3b | 421 | } |
afaa2cc7 SJ |
422 | if (!isset($job['hq_fax'])) { |
423 | $job['hq_fax'] = ''; | |
bde2be3b | 424 | } |
afaa2cc7 SJ |
425 | if (!isset($job['w_email_pub'])) { |
426 | $job['w_email_pub'] = 'private'; | |
bde2be3b | 427 | } |
afaa2cc7 SJ |
428 | if (!$job['hq_address']['text']) { |
429 | $job['hq_address'] = array( | |
430 | 'text' => '', | |
431 | 'accuracy' => '', | |
432 | 'postalText' => '', | |
433 | 'postalCode' => '', | |
434 | 'administrativeAreaId' => '', | |
435 | 'subAdministrativeAreaId' => '', | |
436 | 'localityId' => '', | |
437 | 'countryId' => '', | |
438 | 'latitude' => '', | |
439 | 'longitude' => '', | |
440 | 'north' => '', | |
441 | 'south' => '', | |
442 | 'east' => '', | |
443 | 'west' => '', | |
444 | 'cedex' => '', | |
445 | 'updateTime' => '', | |
446 | 'changed' => '0', | |
447 | 'removed' => '0', | |
448 | ); | |
449 | } | |
450 | $job['w_address']['cedex'] = ''; | |
451 | $job['w_address']['changed'] = '0'; | |
452 | $job['w_address']['removed'] = '0'; | |
453 | } else { | |
454 | $this->values['jobs'][] = $this->settings['jobs']->emptyJob(); | |
bde2be3b | 455 | } |
37d44b3b FB |
456 | } |
457 | ||
7c2e0f0d | 458 | protected function _saveData() |
37d44b3b FB |
459 | { |
460 | if ($this->changed['cv']) { | |
e5bcd851 | 461 | XDB::execute("UPDATE profiles |
37d44b3b | 462 | SET cv = {?} |
e5bcd851 FB |
463 | WHERE pid = {?}", |
464 | $this->values['cv'], $this->pid()); | |
37d44b3b | 465 | } |
72e96bc0 SJ |
466 | |
467 | if ($this->changed['corps']) { | |
34d09b54 SJ |
468 | XDB::execute('REPLACE INTO profile_corps (original_corpsid, current_corpsid, rankid, corps_pub, pid) |
469 | VALUES ({?}, {?}, {?}, {?}, {?})', | |
72e96bc0 | 470 | $this->values['corps']['original'], $this->values['corps']['current'], |
e5bcd851 | 471 | $this->values['corps']['rank'], $this->values['corps']['pub'], $this->pid()); |
72e96bc0 | 472 | } |
3950bc21 | 473 | } |
2dcac0f5 | 474 | |
04334c61 | 475 | public function _prepare(PlPage &$page, $id) |
2dcac0f5 | 476 | { |
a6483c12 | 477 | require_once 'emails.combobox.inc.php'; |
e5bcd851 | 478 | fill_email_combobox($page, $this->owner, $this->profile); |
b715c1e1 | 479 | |
33b6f5a0 SJ |
480 | $res = XDB::query("SELECT id, name AS label |
481 | FROM profile_job_sector_enum"); | |
541e8d03 | 482 | $page->assign('sectors', $res->fetchAllAssoc()); |
72e96bc0 SJ |
483 | |
484 | $res = XDB::iterator("SELECT id, name | |
485 | FROM profile_corps_enum | |
486 | ORDER BY id = 1 DESC, name"); | |
487 | $page->assign('original_corps', $res->fetchAllAssoc()); | |
488 | ||
489 | $res = XDB::iterator("SELECT id, name | |
490 | FROM profile_corps_enum | |
491 | WHERE still_exists = 1 | |
492 | ORDER BY id = 1 DESC, name"); | |
493 | $page->assign('current_corps', $res->fetchAllAssoc()); | |
494 | ||
495 | $res = XDB::iterator("SELECT id, name | |
e489faf7 SJ |
496 | FROM profile_corps_rank_enum |
497 | ORDER BY id = 1 DESC, name"); | |
72e96bc0 | 498 | $page->assign('corps_rank', $res->fetchAllAssoc()); |
2dcac0f5 | 499 | } |
3950bc21 FB |
500 | } |
501 | ||
502 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: | |
503 | ?> |