4758abb6926f94ba24426c1ac2e8e59adf005e93
2 /***************************************************************************
3 * Copyright (C) 2003-2010 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
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. *
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. *
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 *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
24 static private $v_values = array('public' => array('public'),
25 'ax' => array('ax', 'public'),
26 'private' => array('private', 'ax', 'public'));
28 const VISIBILITY_PUBLIC
= 'public';
29 const VISIBILITY_AX
= 'ax';
30 const VISIBILITY_PRIVATE
= 'private';
33 const LASTNAME
= 'lastname';
34 const FIRSTNAME
= 'firstname';
35 const NICKNAME
= 'nickname';
36 const PSEUDONYM
= 'pseudonym';
39 const VN_MARITAL
= 'marital';
40 const VN_ORDINARY
= 'ordinary';
41 const VN_OTHER
= 'other';
44 const DN_FULL
= 'directory_name';
45 const DN_DISPLAY
= 'yourself';
46 const DN_YOURSELF
= 'yourself';
47 const DN_DIRECTORY
= 'directory_name';
48 const DN_PRIVATE
= 'private_name';
49 const DN_PUBLIC
= 'public_name';
50 const DN_SHORT
= 'short_name';
51 const DN_SORT
= 'sort_name';
52 /* education related names */
53 const EDU_X
= 'École polytechnique';
54 const DEGREE_X
= 'Ingénieur';
55 const DEGREE_M
= 'Master';
56 const DEGREE_D
= 'Doctorat';
58 static public $name_variants = array(
59 self
::LASTNAME
=> array(self
::VN_MARITAL
, self
::VN_ORDINARY
),
60 self
::FIRSTNAME
=> array(self
::VN_ORDINARY
, self
::VN_INI
, self
::VN_OTHER
)
63 const ADDRESS_MAIN
= 0x000001;
64 const ADDRESS_PERSO
= 0x000002;
65 const ADDRESS_PRO
= 0x000004;
66 const ADDRESS_ALL
= 0x000006;
67 const ADDRESS_POSTAL
= 0x000008;
69 const EDUCATION_MAIN
= 0x000010;
70 const EDUCATION_EXTRA
= 0x000020;
71 const EDUCATION_ALL
= 0x000040;
72 const EDUCATION_FINISHED
= 0x000080;
73 const EDUCATION_CURRENT
= 0x000100;
75 const JOBS_MAIN
= 0x001000;
76 const JOBS_ALL
= 0x002000;
77 const JOBS_FINISHED
= 0x004000;
78 const JOBS_CURRENT
= 0x008000;
80 const NETWORKING_ALL
= 0x000000;
81 const NETWORKING_WEB
= 0x010000;
82 const NETWORKING_IM
= 0x020000;
83 const NETWORKING_SOCIAL
= 0x040000;
85 const FETCH_ADDRESSES
= 0x000001;
86 const FETCH_CORPS
= 0x000002;
87 const FETCH_EDU
= 0x000004;
88 const FETCH_JOBS
= 0x000008;
89 const FETCH_MEDALS
= 0x000010;
90 const FETCH_NETWORKING
= 0x000020;
91 const FETCH_PHONES
= 0x000040;
92 const FETCH_PHOTO
= 0x000080;
94 // xor of all FETCH_XYZ
95 const FETCH_ALL
= 0x0000FF;
99 private $data = array();
101 private $visibility = null
;
103 private function __construct(array $data)
106 $this->pid
= $this->data
['pid'];
107 $this->hrpid
= $this->data
['hrpid'];
109 $this->setVisibilityLevel(self
::VISIBILITY_PUBLIC
);
111 $this->setVisibilityLevel(self
::VISIBILITY_PRIVATE
);
115 static private $contexts = array();
117 /** Returns the best visibility context toward $visibility
118 * @param $visibility A wished visibility level
119 * @return An array of compatible visibilities
121 * if $visibility is null, the best visibility is returned
123 static public function getVisibilityContext($visibility = null
)
125 if (array_key_exists($visibility, self
::$contexts)) {
126 return self
::$contexts[$visibility];
129 $asked_vis = $visibility;
132 $minvis = self
::VISIBILITY_PRIVATE
;
134 $minvis = self
::VISIBILITY_PUBLIC
;
136 if ($visibility == null
) {
137 $visibility = $minvis;
140 if ($minvis == self
::VISIBILITY_PUBLIC
) {
141 $visibility = self
::VISIBILITY_PUBLIC
;
144 $visibility = self
::$v_values[$visibility];
145 self
::$contexts[$asked_vis] = $visibility;
155 public function hrid()
160 public function promo()
165 public function yearpromo()
167 return intval(substr($this->promo
, 1, 4));
170 /** Print a name with the given formatting:
178 public function name($format)
180 return str_replace(array('%s', '%f', '%l', '%F', '%S', '%p'),
181 array($this->isFemale() ?
'•' : '',
182 $this->firstName(), $this->lastName(),
183 $this->fullName(), $this->shortName(),
184 $this->promo()), $format);
187 public function fullName($with_promo = false
)
190 return $this->full_name
. ' (' . $this->promo
. ')';
192 return $this->full_name
;
195 public function shortName($with_promo = false
)
198 return $this->short_name
. ' (' . $this->promo
. ')';
200 return $this->short_name
;
203 public function firstName()
205 return $this->firstname
;
208 public function firstNames()
210 return $this->nameVariants(self
::FIRSTNAME
);
213 public function lastName()
215 return $this->lastname
;
218 public function lastNames()
220 return $this->nameVariants(self
::LASTNAME
);
223 public function isFemale()
225 return $this->sex
== PlUser
::GENDER_FEMALE
;
228 public function data()
234 private function nameVariants($type)
236 $vals = array($this->$type);
237 foreach (self
::$name_variants[$type] as $var) {
238 $vartype = $type . '_' . $var;
239 $varname = $this->$vartype;
240 if ($varname != null
&& $varname != "") {
244 return array_unique($vals);
247 public function nationalities()
250 if ($this->nationality1
) {
251 $nats[] = $this->nationality1
;
253 if ($this->nationality2
) {
254 $nats[] = $this->nationality2
;
256 if ($this->nationality3
) {
257 $nats[] = $this->nationality3
;
262 public function __get($name)
264 if (property_exists($this, $name)) {
268 if (isset($this->data
[$name])) {
269 return $this->data
[$name];
275 public function __isset($name)
277 return property_exists($this, $name) ||
isset($this->data
[$name]);
280 /** Sets the level of visibility of the profile
281 * Sets $this->visibility to a list of valid visibilities.
282 * @param one of the self::VISIBILITY_* values
284 public function setVisibilityLevel($visibility)
286 if ($visibility != self
::VISIBILITY_PRIVATE
287 && $visibility != self
::VISIBILITY_AX
288 && $visibility != self
::VISIBILITY_PUBLIC
) {
289 Platal
::page()->kill("Visibility invalide: " . $visibility);
291 $this->visibility
= self
::$v_values[$visibility];
292 if ($this->mobile
&& !in_array($this->mobile_pub
, $this->visibility
)) {
293 unset($this->data
['mobile']);
297 /** Determine whether an item with visibility $visibility can be displayed
298 * with the current level of visibility of the profile
299 * @param $visibility The level of visibility to be checked
301 public function isVisible($visibility)
303 return in_array($visibility, $this->visibility
);
306 public static function getCompatibleVisibilities($visibility)
308 return self
::$v_values[$visibility];
311 private function getProfileField($cls)
313 return ProfileField
::getForPID($cls, $this->id(), $this->visibility
);
316 /** Consolidates internal data (addresses, phones, jobs)
318 private function consolidateFields()
320 if ($this->phones
!= null
) {
321 if ($this->addresses
!= null
) {
322 $this->addresses
->addPhones($this->phones
);
325 if ($this->jobs
!= null
) {
326 $this->jobs
->addPhones($this->phones
);
330 if ($this->addresses
!= null
&& $this->jobs
!= null
) {
331 $this->jobs
->addAddresses($this->addresses
);
337 private $photo = null
;
338 public function setPhoto(ProfilePhoto
$photo)
340 $this->photo
= $photo;
343 public function getPhoto($fallback = true
)
345 if ($this->photo
== null
) {
346 $this->setPhoto($this->getProfileField('ProfilePhoto'));
349 if ($this->photo
!= null
) {
350 return $this->photo
->pic
;
351 } else if ($fallback) {
352 return PlImage
::fromFile(dirname(__FILE__
).'/../htdocs/images/none.png',
360 private $addresses = null
;
361 public function setAddresses(ProfileAddresses
$addr)
363 $this->addresses
= $addr;
364 $this->consolidateFields();
367 public function getAddresses($flags, $limit = null
)
369 if ($this->addresses
== null
) {
370 $this->setAddresses($this->getProfileField('ProfileAddresses'));
373 if ($this->addresses
== null
) {
374 return PlIteratorUtils
::emptyIterator();
376 return $this->addresses
->get($flags, $limit);
379 public function getMainAddress()
381 $it = $this->getAddresses(self
::ADDRESS_PERSO | self
::ADDRESS_MAIN
);
382 if ($it->total() == 0) {
392 private $educations = null
;
393 public function setEducations(ProfileEducation
$edu)
395 $this->educations
= $edu;
398 public function getEducations($flags, $limit = null
)
400 if ($this->educations
== null
) {
401 $this->setEducations($this->getProfileField('ProfileEducation'));
404 if ($this->educations
== null
) {
405 return PlIteratorUtils
::emptyIterator();
407 return $this->educations
->get($flags, $limit);
410 public function getExtraEducations($limit = null
)
412 return $this->getEducations(self
::EDUCATION_EXTRA
, $limit);
418 private $networks = null
;
419 public function setNetworking(ProfileNetworking
$nw)
421 $this->networks
= $nw;
424 public function getNetworking($flags, $limit = null
)
426 if ($this->networks
== null
) {
427 $this->setNetworking($this->getProfileField('ProfileNetworking'));
429 if ($this->networks
== null
) {
430 return PlIteratorUtils
::emptyIterator();
432 return $this->networks
->get($flags, $limit);
435 public function getWebSite()
437 $site = $this->getNetworking(self
::NETWORKING_WEB
, 1);
438 if ($site->total() != 1) {
441 $site = $site->next();
442 return $site['address'];
448 private $jobs = null
;
449 public function setJobs(ProfileJobs
$jobs)
452 $this->consolidateFields();
455 public function getJobs($flags, $limit = null
)
457 if ($this->jobs
== null
) {
458 $this->setJobs($this->getProfileField('ProfileJobs'));
461 if ($this->jobs
== null
) {
462 return PlIteratorUtils
::emptyIterator();
464 return $this->jobs
->get($flags, $limit);
467 public function getMainJob()
469 $job = $this->getJobs(self
::JOBS_MAIN
, 1);
470 if ($job->total() != 1) {
478 public function getBinets()
480 return XDB
::fetchColumn('SELECT binet_id
482 WHERE pid = {?}', $this->id());
484 public function getBinetsNames()
486 return XDB
::fetchColumn('SELECT text
487 FROM profile_binets AS pb
488 LEFT JOIN profile_binet_enum AS pbe ON (pbe.id = pb.binet_id)
489 WHERE pb.pid = {?}', $this->id());
494 private $medals = null
;
495 public function setMedals(ProfileMedals
$medals)
497 $this->medals
= $medals;
500 public function getMedals()
502 if ($this->medals
== null
) {
503 $this->setMedals($this->getProfileField('ProfileMedals'));
505 if ($this->medals
== null
) {
508 return $this->medals
->medals
;
511 public function owner()
513 return User
::getSilent($this);
516 public function compareNames($firstname, $lastname)
518 $_lastname = mb_strtoupper($this->lastName());
519 $_firstname = mb_strtoupper($this->firstName());
520 $lastname = mb_strtoupper($lastname);
521 $firstname = mb_strtoupper($firstname);
523 $isOk = (mb_strtoupper($_firstname) == mb_strtoupper($firstname));
524 $tokens = preg_split("/[ \-']/", $lastname, -1, PREG_SPLIT_NO_EMPTY
);
527 foreach ($tokens as $str) {
528 $isOk &= (strpos($_lastname, $str) !== false
);
529 $maxlen = max($maxlen, strlen($str));
532 return ($isOk && ($maxlen > 2 ||
$maxlen == strlen($_lastname)));
535 private static function fetchProfileData(array $pids, $respect_order = true
, $fields = 0x0000, $visibility = null
)
537 if (count($pids) == 0) {
541 if ($respect_order) {
542 $order = 'ORDER BY ' . XDB
::formatCustomOrder('p.pid', $pids);
548 $it = XDB
::Iterator('SELECT p.*, p.sex = \'female\' AS sex, pe.entry_year, pe.grad_year, pse.text AS section,
549 pn_f.name AS firstname, pn_l.name AS lastname, pn_n.name AS nickname,
550 IF(pn_uf.name IS NULL, pn_f.name, pn_uf.name) AS firstname_ordinary,
551 IF(pn_ul.name IS NULL, pn_l.name, pn_ul.name) AS lastname_ordinary,
552 pd.promo AS promo, pd.short_name, pd.directory_name AS full_name,
553 pd.directory_name, pp.display_tel AS mobile, pp.pub AS mobile_pub,
554 ph.attach IS NOT NULL AS has_photo, ph.pub AS photo_pub,
555 p.last_change < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_old,
558 INNER JOIN profile_display AS pd ON (pd.pid = p.pid)
559 INNER JOIN profile_education AS pe ON (pe.pid = p.pid AND FIND_IN_SET(\'primary\', pe.flags))
560 LEFT JOIN profile_section_enum AS pse ON (pse.id = p.section)
561 INNER JOIN profile_name AS pn_f ON (pn_f.pid = p.pid
562 AND pn_f.typeid = ' . self
::getNameTypeId('firstname', true
) . ')
563 INNER JOIN profile_name AS pn_l ON (pn_l.pid = p.pid
564 AND pn_l.typeid = ' . self
::getNameTypeId('lastname', true
) . ')
565 LEFT JOIN profile_name AS pn_uf ON (pn_uf.pid = p.pid
566 AND pn_uf.typeid = ' . self
::getNameTypeId('firstname_ordinary', true
) . ')
567 LEFT JOIN profile_name AS pn_ul ON (pn_ul.pid = p.pid
568 AND pn_ul.typeid = ' . self
::getNameTypeId('lastname_ordinary', true
) . ')
569 LEFT JOIN profile_name AS pn_n ON (pn_n.pid = p.pid
570 AND pn_n.typeid = ' . self
::getNameTypeId('nickname', true
) . ')
571 LEFT JOIN profile_phones AS pp ON (pp.pid = p.pid AND pp.link_type = \'user\' AND tel_type = \'mobile\')
572 LEFT JOIN profile_photos AS ph ON (ph.pid = p.pid)
573 LEFT JOIN account_profiles AS ap ON (ap.pid = p.pid AND FIND_IN_SET(\'owner\', ap.perms))
574 WHERE p.pid IN ' . XDB
::formatArray($pids) . '
577 return new ProfileIterator($it, $pids, $fields, $visibility);
580 public static function getPID($login)
582 if ($login instanceof PlUser
) {
583 return XDB
::fetchOneCell('SELECT pid
584 FROM account_profiles
585 WHERE uid = {?} AND FIND_IN_SET(\'owner\', perms)',
587 } else if (ctype_digit($login)) {
588 return XDB
::fetchOneCell('SELECT pid
590 WHERE pid = {?}', $login);
592 return XDB
::fetchOneCell('SELECT pid
594 WHERE hrpid = {?}', $login);
598 public static function getPIDsFromUIDs($uids, $respect_order = true
)
600 if ($respect_order) {
601 $order = 'ORDER BY ' . XDB
::formatCustomOrder('uid', $uids);
605 return XDB
::fetchAllAssoc('uid', 'SELECT ap.uid, ap.pid
606 FROM account_profiles AS ap
607 WHERE FIND_IN_SET(\'owner\', ap.perms)
608 AND ap.uid IN ' . XDB
::formatArray($uids) .'
612 /** Return the profile associated with the given login.
614 public static function get($login, $fields = 0x0000, $visibility = null
)
616 if (is_array($login)) {
617 return new Profile($login);
619 $pid = self
::getPID($login);
620 if (!is_null($pid)) {
621 $it = self
::iterOverPIDs(array($pid), false
, $fields, $visibility);
624 /* Let say we can identify a profile using the identifiers of its owner.
626 if (!($login instanceof PlUser
)) {
627 $user = User
::getSilent($login);
628 if ($user && $user->hasProfile()) {
629 return $user->profile();
636 public static function iterOverUIDs($uids, $respect_order = true
, $fields = 0x0000, $visibility = null
)
638 return self
::iterOverPIDs(self
::getPIDsFromUIDs($uids), $respect_order, $fields, $visibility);
641 public static function iterOverPIDs($pids, $respect_order = true
, $fields = 0x0000, $visibility = null
)
643 return self
::fetchProfileData($pids, $respect_order, $fields, $visibility);
646 /** Return profiles for the list of pids.
648 public static function getBulkProfilesWithPIDs(array $pids, $fields = self
::FETCH_ADDRESSES
, $visibility = null
)
650 if (count($pids) == 0) {
653 $it = self
::iterOverPIDs($pids, true
, $fields, $visibility);
655 while ($p = $it->next()) {
656 $profiles[$p->id()] = $p;
661 /** Return profiles for uids.
663 public static function getBulkProfilesWithUIDS(array $uids, $fields = 0x000, $visibility = null
)
665 if (count($uids) == 0) {
668 return self
::getBulkProfilesWithPIDs(self
::getPIDsFromUIDs($uids), $fields, $visibility);
671 public static function isDisplayName($name)
673 return $name == self
::DN_FULL ||
$name == self
::DN_DISPLAY
674 ||
$name == self
::DN_YOURSELF ||
$name == self
::DN_DIRECTORY
675 ||
$name == self
::DN_PRIVATE ||
$name == self
::DN_PUBLIC
676 ||
$name == self
::DN_SHORT ||
$name == self
::DN_SORT
;
679 public static function getNameTypeId($type, $for_sql = false
)
681 if (!S
::has('name_types')) {
682 $table = XDB
::fetchAllAssoc('type', 'SELECT id, type
683 FROM profile_name_enum');
684 S
::set('name_types', $table);
686 $table = S
::v('name_types');
689 return XDB
::escape($table[$type]);
691 return $table[$type];
695 public static function rebuildSearchTokens($pid)
697 XDB
::execute('DELETE FROM search_name
700 $keys = XDB
::iterator("SELECT CONCAT(n.particle, n.name) AS name, e.score,
701 FIND_IN_SET('public', e.flags) AS public
702 FROM profile_name AS n
703 INNER JOIN profile_name_enum AS e ON (n.typeid = e.id)
707 foreach ($keys as $i => $key) {
708 if ($key['name'] == '') {
711 $toks = preg_split('/[ \'\-]+/', $key['name']);
715 $token = strtolower(replace_accent(array_pop($toks) . $token));
716 $score = ($toks ?
0 : 10 +
$first) * ($key['score'] / 10);
717 XDB
::execute('REPLACE INTO search_name (token, pid, soundex, score, flags)
718 VALUES ({?}, {?}, {?}, {?}, {?})',
719 $token, $pid, soundex_fr($token), $score, $key['public']);
725 /** The school identifier consists of 6 digits. The first 3 represent the
726 * promotion entry year. The last 3 indicate the student's rank.
728 * Our identifier consists of 8 digits and both half have the same role.
729 * This enables us to deal with bigger promotions and with a wider range
732 * getSchoolId returns a school identifier given one of ours.
733 * getXorgId returns a X.org identifier given a school identifier.
735 public static function getSchoolId($xorgId)
737 if (!preg_match('/^[0-9]{8}$/', $xorgId)) {
741 $year = intval(substr($xorgId, 0, 4));
742 $rank = intval(substr($xorgId, 5, 3));
745 } elseif ($year < 2000) {
746 $year = intval(substr(1900 - $year, 1, 3));
747 return sprintf('%02u0%03u', $year, $rank);
749 $year = intval(substr(1900 - $year, 1, 3));
750 return sprintf('%03u%03u', $year, $rank);
754 public static function getXorgId($schoolId)
756 if (!preg_match('/^[0-9]{6}$/', $schoolId)) {
760 $year = intval(substr($schoolId, 0, 3));
761 $rank = intval(substr($schoolId, 3, 3));
769 return sprintf('%04u%04u', 1900 +
$year, $rank);
775 /** Iterator over a set of Profiles
777 class ProfileIterator
implements PlIterator
779 private $iterator = null
;
782 public function __construct(PlIterator
$it, array $pids, $fields = 0x0000, $visibility = null
)
784 require_once 'profilefields.inc.php';
785 $visibility = Profile
::getVisibilityContext($visibility);
786 $this->fields
= $fields;
789 $callbacks = array();
792 $callbacks[0] = PlIteratorUtils
::arrayValueCallback('pid');
793 $cb = PlIteratorUtils
::objectPropertyCallback('pid');
795 if ($fields & Profile
::FETCH_ADDRESSES
) {
796 $callbacks[Profile
::FETCH_ADDRESSES
] = $cb;
797 $subits[Profile
::FETCH_ADDRESSES
] = new ProfileFieldIterator('ProfileAddresses', $pids, $visibility);
800 if ($fields & Profile
::FETCH_CORPS
) {
801 $callbacks[Profile
::FETCH_CORPS
] = $cb;
802 $subits[Profile
::FETCH_CORPS
] = new ProfileFieldIterator('ProfileCorps', $pids, $visibility);
805 if ($fields & Profile
::FETCH_EDU
) {
806 $callbacks[Profile
::FETCH_EDU
] = $cb;
807 $subits[Profile
::FETCH_EDU
] = new ProfileFieldIterator('ProfileEducation', $pids, $visibility);
810 if ($fields & Profile
::FETCH_JOBS
) {
811 $callbacks[Profile
::FETCH_JOBS
] = $cb;
812 $subits[Profile
::FETCH_JOBS
] = new ProfileFieldIterator('ProfileJobs', $pids, $visibility);
815 if ($fields & Profile
::FETCH_MEDALS
) {
816 $callbacks[Profile
::FETCH_MEDALS
] = $cb;
817 $subits[Profile
::FETCH_MEDALS
] = new ProfileFieldIterator('ProfileMedals', $pids, $visibility);
820 if ($fields & Profile
::FETCH_NETWORKING
) {
821 $callbacks[Profile
::FETCH_NETWORKING
] = $cb;
822 $subits[Profile
::FETCH_NETWORKING
] = new ProfileFieldIterator('ProfileNetworking', $pids, $visibility);
825 if ($fields & Profile
::FETCH_PHONES
) {
826 $callbacks[Profile
::FETCH_PHONES
] = $cb;
827 $subits[Profile
::FETCH_PHONES
] = new ProfileFieldIterator('ProfilePhones', $pids, $visibility);
830 if ($fields & Profile
::FETCH_PHOTO
) {
831 $callbacks[Profile
::FETCH_PHOTO
] = $cb;
832 $subits[Profile
::FETCH_PHOTO
] = new ProfileFieldIterator('ProfilePhoto', $pids, $visibility);
835 $this->iterator
= PlIteratorUtils
::parallelIterator($subits, $callbacks, 0);
838 private function hasData($flag, $vals)
840 return ($this->fields
& $flag) && ($vals[$flag] != null
);
843 private function fillProfile(array $vals)
845 $pf = Profile
::get($vals[0]);
846 if ($this->hasData(Profile
::FETCH_PHONES
, $vals)) {
847 $pf->setPhones($vals[Profile
::FETCH_PHONES
]);
849 if ($this->hasData(Profile
::FETCH_ADDRESSES
, $vals)) {
850 $pf->setAddresses($vals[Profile
::FETCH_ADDRESSES
]);
852 if ($this->hasData(Profile
::FETCH_JOBS
, $vals)) {
853 $pf->setJobs($vals[Profile
::FETCH_JOBS
]);
856 if ($this->hasData(Profile
::FETCH_CORPS
, $vals)) {
857 $pf->setCorps($vals[Profile
::FETCH_CORPS
]);
859 if ($this->hasData(Profile
::FETCH_EDU
, $vals)) {
860 $pf->setEducations($vals[Profile
::FETCH_EDU
]);
862 if ($this->hasData(Profile
::FETCH_MEDALS
, $vals)) {
863 $pf->setMedals($vals[Profile
::FETCH_MEDALS
]);
865 if ($this->hasData(Profile
::FETCH_NETWORKING
, $vals)) {
866 $pf->setNetworking($vals[Profile
::FETCH_NETWORKING
]);
868 if ($this->hasData(Profile
::FETCH_PHOTO
, $vals)) {
869 $pf->setPhoto($vals[Profile
::FETCH_PHOTO
]);
875 public function next()
877 $vals = $this->iterator
->next();
881 return $this->fillProfile($vals);
884 public function first()
886 return $this->iterator
->first();
889 public function last()
891 return $this->iterator
->last();
894 public function total()
896 return $this->iterator
->total();
900 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: