public function getProfile() { if (is_array($this->prefetched)) { if (in_array('profile', $this->prefetched)) { if (in_array('profile', $this->prefetchedObjects)) { return $this->prefetchedObjects['profile']; } else { $obj = new DB_Profile($this->sourceRow); $obj->setNew(false); $this->prefetchedObjects['profile'] = $obj; return $obj; } } } return DB_ProfilePeer::instance()->selectByPrimaryKey($this->getUserId()); }
public function saveAboutEvent($runData) { $pl = $runData->getParameterList(); $userId = $runData->getUserId(); $profile = DB_ProfilePeer::instance()->selectByPrimaryKey($userId); // now manually get all files... $realName = $pl->getParameterValue("real_name"); $gender = $pl->getParameterValue("gender"); $birthdayDay = $pl->getParameterValue("birthday_day"); $birthdayMonth = $pl->getParameterValue("birthday_month"); $birthdayYear = $pl->getParameterValue("birthday_year"); $about = $pl->getParameterValue("about"); $website = $pl->getParameterValue("website"); $imAim = $pl->getParameterValue("im_aim"); $imGaduGadu = $pl->getParameterValue("im_gadu_gadu"); $imGoogleTalk = $pl->getParameterValue("im_google_talk"); $imIcq = $pl->getParameterValue("im_icq"); $imJabber = $pl->getParameterValue("im_jabber"); $imMsn = $pl->getParameterValue("im_msn"); $imYahoo = $pl->getParameterValue("im_yahoo"); $location = $pl->getParameterValue("location"); $profile->setRealName($realName); $profile->setGender($gender); // check date $d = getdate(); if (checkdate((int) $birthdayMonth, (int) $birthdayDay, (int) $birthdayYear) && $birthdayYear < $d['year']) { $profile->setBirthdayDay($birthdayDay); $profile->setBirthdayMonth($birthdayMonth); $profile->setBirthdayYear($birthdayYear); } $profile->setAbout(substr($about, 0, 220)); if (preg_match("/^(http[s]?:\\/\\/)|(ftp:\\/\\/)[a-zA-Z0-9\\-]+\\/.*/", $website) !== 0) { $profile->setWebsite($website); } $profile->setImAim($imAim); $profile->setImGaduGadu($imGaduGadu); $profile->setImGoogleTalk($imGoogleTalk); $profile->setImIcq($imIcq); $profile->setImJabber($imJabber); $profile->setImMsn($imMsn); $profile->setImYahoo($imYahoo); $profile->setLocation($location); $profile->save(); if (GlobalProperties::$UI_SLEEP) { sleep(1); } }
public function build($runData) { $userId = $runData->getUserId(); $profile = DB_ProfilePeer::instance()->selectByPrimaryKey($userId); $runData->contextAdd("profile", $profile); }