}
+ /**
+ * Clears a profile.
+ * *always deletes in: profile_addresses, profile_binets, profile_job,
+ * profile_langskills, profile_mentor, profile_networking,
+ * profile_phones, profile_skills, watch_profile
+ * *always keeps in: profile_corps, profile_display, profile_education,
+ * profile_medals, profile_name, profile_photos, search_name
+ * *modifies: profiles
+ */
+ public function clear()
+ {
+ $tables = array(
+ 'profile_job', 'profile_langskills', 'profile_mentor',
+ 'profile_networking', 'profile_skills', 'watch_profile',
+ 'profile_phones', 'profile_addresses', 'profile_binets');
+
+ foreach ($tables as $t) {
+ XDB::execute('DELETE FROM ' . $t . '
+ WHERE pid = {?}',
+ $this->id());
+ }
+
+ XDB::execute("UPDATE profiles
+ SET cv = NULL, freetext = NULL, freetext_pub = 'private',
+ medals_pub = 'private', alias_pub = 'private',
+ email_directory = NULL
+ WHERE pid = {?}",
+ $this->id());
+ }
+
/** Sets the level of visibility of the profile
* Sets $this->visibility to a list of valid visibilities.
* @param one of the self::VIS_* values
$this->consolidateFields();
}
- public function getAddresses($flags, $limit = null)
+ private function fetchAddresses()
{
if ($this->addresses == null && !$this->fetched(self::FETCH_ADDRESSES)) {
$addr = $this->getProfileField(self::FETCH_ADDRESSES);
if ($addr) {
$this->setAddresses($addr);
+ $this->fetchPhones();
}
}
+ }
+
+ public function getAddresses($flags, $limit = null)
+ {
+ $this->fetchAddresses();
if ($this->addresses == null) {
return array();
$this->consolidateFields();
}
- public function getPhones($flags, $limit = null)
+ private function fetchPhones()
{
if ($this->phones == null && !$this->fetched(self::FETCH_PHONES)) {
$this->setPhones($this->getProfileField(self::FETCH_PHONES));
}
+ }
+ public function getPhones($flags, $limit = null)
+ {
+ $this->fetchPhones();
if ($this->phones == null) {
return array();
}
$this->consolidateFields();
}
- public function getJobs($flags, $limit = null)
+ private function fetchJobs()
{
if ($this->jobs == null && !$this->fetched(self::FETCH_JOBS)) {
$jobs = $this->getProfileField(self::FETCH_JOBS);
if ($jobs) {
$this->setJobs($jobs);
+ $this->fetchAddresses();
}
}
+ }
+
+ public function getJobs($flags, $limit = null)
+ {
+ $this->fetchJobs();
if ($this->jobs == null) {
return array();