X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2Fprofile.php;h=6574d0a3b85e8a035b36444df36135a0cda53c9e;hb=54cccfcc1f4e128e0a2c7f0e23c20e10107b9504;hp=6b062315be26fb43f44ac4dc4da21c7f8a7ee837;hpb=22771578c2d44fe4488546116a84e1561f083ed7;p=platal.git diff --git a/classes/profile.php b/classes/profile.php index 6b06231..6574d0a 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -110,10 +110,11 @@ class Profile implements PlExportable const FETCH_JOB_TERMS = 0x000200; const FETCH_MENTOR_TERMS = 0x000400; const FETCH_DELTATEN = 0x000800; + const FETCH_PARTNER = 0x001000; const FETCH_MINIFICHES = 0x00012D; // FETCH_ADDRESSES | FETCH_EDU | FETCH_JOBS | FETCH_NETWORKING | FETCH_PHONES - const FETCH_ALL = 0x000FFF; // OR of FETCH_* + const FETCH_ALL = 0x001FFF; // OR of FETCH_* static public $descriptions = array( 'search_names' => 'Noms', @@ -458,7 +459,8 @@ class Profile implements PlExportable * Clears a profile. * *always deletes in: profile_addresses, profile_binets, profile_deltaten, * profile_job, profile_langskills, profile_mentor, profile_networking, - * profile_phones, profile_skills, watch_profile + * profile_partnersharing_settings, profile_phones, profile_skills, + * watch_profile * *always keeps in: profile_corps, profile_display, profile_education, * profile_medals, profile_*_names, profile_photos, search_name * *modifies: profiles @@ -469,7 +471,7 @@ class Profile implements PlExportable 'profile_job', 'profile_langskills', 'profile_mentor', 'profile_networking', 'profile_skills', 'watch_profile', 'profile_phones', 'profile_addresses', 'profile_binets', - 'profile_deltaten'); + 'profile_deltaten', 'profile_partnersharing_settings'); foreach ($tables as $t) { XDB::execute('DELETE FROM ' . $t . ' @@ -913,6 +915,25 @@ class Profile implements PlExportable return $this->medals->medals; } + /** Sharing data with partner websites + */ + private $partners_settings = null; + public function setPartnersSettings(ProfilePartnerSharing $partners_settings) + { + $this->partners_settings = $partners_settings; + } + + public function getPartnerSettings($partner_id) + { + if ($this->partners_settings === null && !$this->fetched(self::FETCH_PARTNER)) { + $this->setPartnersSettings($this->getProfileField(self::FETCH_PARTNER)); + } + if ($this->partners_settings === null) { + return PartnerSettings::getEmpty($partner_id); + } + return $this->partners_settings->get($partner_id); + } + public function compareNames($firstname, $lastname) { $_lastname = mb_strtoupper($this->lastName()); @@ -979,7 +1000,7 @@ class Profile implements PlExportable pd.yourself, pd.promo, pd.short_name, pd.public_name AS full_name, pd.directory_name, pd.public_name, pd.private_name, IF (pp.pub >= {?}, pp.display_tel, NULL) AS mobile, - (ph.pub >= {?} AND ph.attach IS NOT NULL) AS has_photo, + (ph.pub >= {?} AND ph.attach IS NOT NULL) AS has_photo, ph.pub as photo_pub, ph.x AS photo_width, ph.y AS photo_height, p.last_change < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_old, pm.expertise AS mentor_expertise,