public function GetAccountData(Application_Model_User_Profile $profile) { $view = Zend_Layout::getMvcInstance()->getView(); $account = $profile->getAccount(Application_Model_User_Account::TYPE_FB); $accountData['unlink-url'] = $view->url(array('type' => Application_Model_User_Account::TYPE_FB), 'account-unlink'); $accountData['connect-url'] = Application_Model_Api_Facebook::getInstance()->getLoginUrl($view->url(array(), 'profile-fb-connect')); if ($account instanceof Application_Model_User_Account) { $accountData['class'] = 'fb-btn connected'; $accountData['text'] = $view->translate->_('Подключено'); $accountData['email'] = $account->getUserEmail(); $accountData['active'] = true; } else { $accountData['class'] = 'fb-btn'; $accountData['text'] = $view->translate->_('Подключить'); $accountData['email'] = ''; $accountData['active'] = false; } return $accountData; }
private function _setData(stdClass $data) { $this->_entity->setEmail($data->email); if (!empty($data->passwd)) { $this->_entity->setPassword($data->passwd); } if (isset($data->id_avatar) && intval($data->id_avatar) !== 0) { $photo = RM_Photo::getById($data->id_avatar); if ($photo instanceof RM_Photo) { $this->_entity->setAvatar($photo); } } $this->_entity->setName($data->user_name); $this->_entity->setLastname($data->last_name); $this->_entity->setPhone($data->phone); }
public function getFacebookUser() { if ($this->getIdUser() === 0) { $profile = Application_Model_User_Profile::getByEmail($this->getUserEmail()); if (!$profile instanceof Application_Model_User_Profile) { $profile = parent::_createProfile(); $profile->setConfirmedEmail(); $profile->save(); } else { $this->setProfile($profile); $this->save(); } } else { $profile = parent::getProfile(); } return $profile; }
public function setUser(User $user) { $this->_user = $user; $this->__setIdUser($user->getId()); }
protected function _createProfile() { $profile = Application_Model_User_Profile::create(); $profile->setEmail($this->getUserEmail()); $profile->setName($this->getUserName()); $profile->setLastname($this->getUserLastname()); $profile->save(); $profile->setAvatar($this->_createAvatar($profile, $this->getPhotoPath())); $profile->save(); $this->setProfile($profile); $this->activate(); $this->save(); return $profile; }
public function GetUserInfo(Application_Model_User_Profile $user) { $view = Zend_Layout::getMvcInstance()->getView(); return join('', array('<a href="', $view->url(array('id' => $user->getId(), 'page' => 1), 'admin-user-edit'), '">', $user->getFullName(), '</a>')); }
public function sendToUser() { $this->send($this->_user->getEmail()); }
private function _hasConfirmedMail() { return $this->_profile instanceof Application_Model_User_Profile && $this->_profile->isConfirmedEmail(); }
protected function __setData(stdClass $data) { $this->__setContentFields(); $photo = RM_Photo::getById($data->id_photo); if (!$photo instanceof RM_Photo) { throw new Exception('Не выбрана фотография'); } if (empty($data->id_posts)) { throw new Exception('Не выбрана должность'); } $this->_entity->setPhoto($photo); $postCollection = $this->_entity->getPostCollection(); $postCollection->resetItems(); foreach ($data->id_posts as $idPost) { $post = Application_Model_Medical_Post::getById($idPost); if ($post instanceof Application_Model_Medical_Post) { $postCollection->add($post); } } $serviceCollection = $this->_entity->getServiceCollection(); $serviceCollection->resetItems(); foreach ($data->id_services as $idService) { $service = Application_Model_Medical_Service::getById($idService); if ($service instanceof Application_Model_Medical_Service) { $serviceCollection->add($service); } } $this->_initWorkTimeList($data); $user = Application_Model_User_Profile::getById($data->id_user); if ($user instanceof Application_Model_User_Profile) { $this->_entity->setUser($user); } else { $this->_entity->resetUser(); } $this->_entity->setReceptionDuration(new MedOptima_DateTime_Duration_InsideDay((int) $data->reception_duration)); }
public function sendToUser() { $this->send($this->_profile->getEmail()); }