private function _updateUserDb() { $fb_users = HTS_Util::getDbTable('users'); $fb_user = $fb_users->findOneByIdSocial($this->_id_social); if (empty($fb_user)) { $user_profile = $this->_social->api('/me'); if (FB_DEBUG) { Zend_Debug::dump($user_profile); } $fb_user = HTS_Util::getDbRow('users'); $birthday = new Zend_Date(@$user_profile['Birthday'], 'dd/MM/yyyy'); $updated_time = new Zend_Date(@$user_profile['Updated_time']); //TODO some values are null -> undefined index warning $fb_user->id_social = $user_profile['Id']; $fb_user->name = $user_profile['Name']; $fb_user->first_name = @$user_profile['First_name']; $fb_user->middle_name = @$user_profile['Middle_name']; $fb_user->last_name = @$user_profile['Last_name']; $fb_user->link = $user_profile['Link']; $fb_user->birthday = @$birthday->toString('yyyy/MM/dd'); $fb_user->gender = $user_profile['Gender']; $fb_user->timezone = @$user_profile['Timezone']; $fb_user->locale = @$user_profile['Locale']; $fb_user->time_created = time(); $fb_user->time_modified = time(); $fb_user->time_social_modified = $updated_time->toValue(); $this->_id_user = $fb_user->save(); } $this->_user = $fb_user; $this->_id_user = $fb_user->id; }
protected function _saveStore($data, $id = null) { if (empty($id)) { $this->_store_row = HTS_Util::getDbRow('stores'); $this->_store_row->setFromArray($data); } else { $this->_store_row = $this->_stores_table->findOne($id); $this->_store_row->setFromArray($data); } return $this->_store_row->save(); }
private function _updateUserDb() { $google_users = HTS_Util::getDbTable('users'); $google_user = $google_users->findOneByIdSocial($this->_id_social); if (empty($google_user)) { $google_user = HTS_Util::getDbRow('users'); $birthday = new Zend_Date(@$this->_me['birthday'], 'dd/MM/yyyy'); //TODO some values are null -> undefined index warning $google_user->id_social = $this->_id_social; $google_user->name = $this->_me['displayName']; // $google_user->first_name = $this->_me['name']['givenName']; // $google_user->middle_name = @$this->_me['name']['middleName']; // $google_user->last_name = @$this->_me['name']['familyName']; $google_user->link = $this->_me['url']; $google_user->image = $this->_me['image']['url']; $google_user->birthday = @$birthday->toString('yyyy/MM/dd'); $google_user->gender = $this->_me['gender']; //$google_user->timezone = $this->_me['timezone']; $google_user->locale = @$this->_me['currentLocation']; $google_user->time_created = time(); $google_user->time_modified = time(); $this->_id_user = $google_user->save(); } $this->_user = $google_user; $this->_id_user = $google_user->id; }
function __construct($config) { parent::__construct($config); $this->_user = HTS_Util::getDbRow('users'); }
protected function _updateUserDb() { $userData = HTS_Util::getObjectFileCache()->load('user_' . $this->_id_social); if ($userData === false) { $user_db = HTS_Util::getDbTable('users'); $user = $user_db->findOneByIdSocial($this->_id_social); if (empty($user)) { $user_profile = $this->getUserProfile(); $user = HTS_Util::getDbRow('users'); //TODO some values are null -> undefined index warning if (!empty($user_profile['birthday'])) { $birthday = new Zend_Date(@$user_profile['birthday'], 'dd/MM/yyyy'); $user->birthday = @$birthday->toString('yyyy/MM/dd'); } $updated_time = new Zend_Date($user_profile['updated_time']); $user->id_social = $user_profile['id']; $user->name = $user_profile['name']; $user->email = @$user_profile['email']; $user->first_name = $user_profile['first_name']; $user->middle_name = @$user_profile['middle_name']; $user->last_name = @$user_profile['last_name']; $user->link = $user_profile['link']; $user->image = 'http://graph.facebook.com/' . $user_profile['id'] . '/picture'; $user->gender = $user_profile['gender']; $user->timezone = $user_profile['timezone']; $user->locale = $user_profile['locale']; $user->time_created = time(); $user->time_modified = time(); $user->time_social_modified = $updated_time->toValue(); } $user->save(); HTS_Util::getObjectFileCache()->save($user->toArray(), 'user_' . $this->_id_social); } else { $user_db = HTS_Util::getDbTable('users'); $user = $user_db->createRow($userData); } $this->_user = $user; $this->_id_user = $user->id; }