コード例 #1
0
ファイル: UserDetailsForm.inc.php プロジェクト: doana/pkp-lib
 /**
  * Initialize form data from current user profile.
  * @param $args array
  * @param $request PKPRequest
  */
 function initData($args, $request)
 {
     $data = array();
     if (isset($this->userId)) {
         $userDao = DAORegistry::getDAO('UserDAO');
         $user = $userDao->getById($this->userId);
         import('lib.pkp.classes.user.InterestManager');
         $interestManager = new InterestManager();
         $data = array('authId' => $user->getAuthId(), 'username' => $user->getUsername(), 'salutation' => $user->getSalutation(), 'firstName' => $user->getFirstName(), 'middleName' => $user->getMiddleName(), 'lastName' => $user->getLastName(), 'suffix' => $user->getSuffix(), 'signature' => $user->getSignature(null), 'initials' => $user->getInitials(), 'gender' => $user->getGender(), 'affiliation' => $user->getAffiliation(null), 'email' => $user->getEmail(), 'userUrl' => $user->getUrl(), 'phone' => $user->getPhone(), 'fax' => $user->getFax(), 'mailingAddress' => $user->getMailingAddress(), 'country' => $user->getCountry(), 'biography' => $user->getBiography(null), 'interestsKeywords' => $interestManager->getInterestsForUser($user), 'interestsTextOnly' => $interestManager->getInterestsString($user), 'userLocales' => $user->getLocales());
     } else {
         if (isset($this->author)) {
             $author =& $this->author;
             $data = array('salutation' => $author->getSalutation(), 'firstName' => $author->getFirstName(), 'middleName' => $author->getMiddleName(), 'lastName' => $author->getLastName(), 'affiliation' => $author->getAffiliation(null), 'email' => $author->getEmail(), 'userUrl' => $author->getUrl(), 'country' => $author->getCountry(), 'biography' => $author->getBiography(null));
         }
     }
     foreach ($data as $key => $value) {
         $this->setData($key, $value);
     }
 }
コード例 #2
0
 /**
  * Initialize form data from current user profile.
  */
 function initData(&$args, &$request)
 {
     if (isset($this->userId)) {
         $userDao =& DAORegistry::getDAO('UserDAO');
         $user =& $userDao->getById($this->userId);
         import('lib.pkp.classes.user.InterestManager');
         $interestManager = new InterestManager();
         if ($user != null) {
             $this->_data = array('authId' => $user->getAuthId(), 'username' => $user->getUsername(), 'salutation' => $user->getSalutation(), 'firstName' => $user->getFirstName(), 'middleName' => $user->getMiddleName(), 'lastName' => $user->getLastName(), 'signature' => $user->getSignature(null), 'initials' => $user->getInitials(), 'gender' => $user->getGender(), 'affiliation' => $user->getAffiliation(null), 'email' => $user->getEmail(), 'orcid' => $user->getData('orcid'), 'userUrl' => $user->getUrl(), 'phone' => $user->getPhone(), 'fax' => $user->getFax(), 'mailingAddress' => $user->getMailingAddress(), 'country' => $user->getCountry(), 'biography' => $user->getBiography(null), 'interestsKeywords' => $interestManager->getInterestsForUser($user), 'interestsTextOnly' => $interestManager->getInterestsString($user), 'gossip' => $user->getGossip(null), 'userLocales' => $user->getLocales());
         } else {
             $this->userId = null;
         }
     }
     if (!isset($this->userId)) {
         $roleDao =& DAORegistry::getDAO('RoleDAO');
         $roleId = Request::getUserVar('roleId');
         $roleSymbolic = $roleDao->getRolePath($roleId);
         $this->_data = array('enrollAs' => array($roleSymbolic));
     }
 }
コード例 #3
0
ファイル: PKPProfileForm.inc.php プロジェクト: doana/pkp-lib
 /**
  * Initialize form data from current settings.
  */
 function initData()
 {
     $user = $this->getUser();
     import('lib.pkp.classes.user.InterestManager');
     $interestManager = new InterestManager();
     $this->_data = array('salutation' => $user->getSalutation(), 'firstName' => $user->getFirstName(), 'middleName' => $user->getMiddleName(), 'initials' => $user->getInitials(), 'lastName' => $user->getLastName(), 'suffix' => $user->getSuffix(), 'gender' => $user->getGender(), 'affiliation' => $user->getAffiliation(null), 'signature' => $user->getSignature(null), 'email' => $user->getEmail(), 'userUrl' => $user->getUrl(), 'phone' => $user->getPhone(), 'fax' => $user->getFax(), 'mailingAddress' => $user->getMailingAddress(), 'country' => $user->getCountry(), 'biography' => $user->getBiography(null), 'userLocales' => $user->getLocales(), 'interestsKeywords' => $interestManager->getInterestsForUser($user), 'interestsTextOnly' => $interestManager->getInterestsString($user));
 }
コード例 #4
0
 /**
  * Get the user's interests displayed as a comma-separated string
  * @return string
  */
 function getInterestString()
 {
     import('lib.pkp.classes.user.InterestManager');
     $interestManager = new InterestManager();
     return $interestManager->getInterestsString($this);
 }
コード例 #5
0
 /**
  * Initialize form data from current settings.
  */
 function initData(&$args, &$request)
 {
     $user =& $request->getUser();
     import('lib.pkp.classes.user.InterestManager');
     $interestManager = new InterestManager();
     $this->_data = array('salutation' => $user->getSalutation(), 'firstName' => $user->getFirstName(), 'middleName' => $user->getMiddleName(), 'initials' => $user->getInitials(), 'lastName' => $user->getLastName(), 'gender' => $user->getGender(), 'affiliation' => $user->getAffiliation(null), 'signature' => $user->getSignature(null), 'email' => $user->getEmail(), 'orcid' => $user->getData('orcid'), 'userUrl' => $user->getUrl(), 'phone' => $user->getPhone(), 'fax' => $user->getFax(), 'mailingAddress' => $user->getMailingAddress(), 'country' => $user->getCountry(), 'biography' => $user->getBiography(null), 'userLocales' => $user->getLocales(), 'isAuthor' => Validation::isAuthor(), 'isReader' => Validation::isReader(), 'isReviewer' => Validation::isReviewer(), 'interestsKeywords' => $interestManager->getInterestsForUser($user), 'interestsTextOnly' => $interestManager->getInterestsString($user));
     return parent::initData();
 }
 /**
  * Create and return a user node.
  * @param $doc DOMDocument
  * @param $user PKPUser
  * @return DOMElement
  */
 function createPKPUserNode($doc, $user)
 {
     $deployment = $this->getDeployment();
     $context = $deployment->getContext();
     // Create the user node
     $userNode = $doc->createElementNS($deployment->getNamespace(), 'user');
     // Add metadata
     $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'firstname', $user->getFirstName()));
     $this->createOptionalNode($doc, $userNode, 'middlename', $user->getMiddleName());
     $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'lastname', $user->getLastName()));
     if (is_array($user->getAffiliation(null))) {
         $this->createLocalizedNodes($doc, $userNode, 'affiliation', $user->getAffiliation(null));
     }
     $this->createOptionalNode($doc, $userNode, 'country', $user->getCountry());
     $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'email', $user->getEmail()));
     $this->createOptionalNode($doc, $userNode, 'url', $user->getUrl());
     if (is_array($user->getBiography(null))) {
         $this->createLocalizedNodes($doc, $userNode, 'biography', $user->getBiography(null));
     }
     $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'username', $user->getUsername()));
     if (is_array($user->getGossip(null))) {
         $this->createLocalizedNodes($doc, $userNode, 'gossip', $user->getGossip(null));
     }
     if (is_array($user->getSignature(null))) {
         $this->createLocalizedNodes($doc, $userNode, 'signature', $user->getSignature(null));
     }
     $passwordNode = $doc->createElementNS($deployment->getNamespace(), 'password');
     $passwordNode->setAttribute('is_disabled', $user->getDisabled() ? 'true' : 'false');
     $passwordNode->setAttribute('must_change', $user->getMustChangePassword() ? 'true' : 'false');
     $passwordNode->setAttribute('encryption', Config::getVar('security', 'encryption'));
     $passwordNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'value', $user->getPassword()));
     $userNode->appendChild($passwordNode);
     $this->createOptionalNode($doc, $userNode, 'salutation', $user->getSalutation());
     $this->createOptionalNode($doc, $userNode, 'initials', $user->getInitials());
     $this->createOptionalNode($doc, $userNode, 'suffix', $user->getSuffix());
     $this->createOptionalNode($doc, $userNode, 'gender', $user->getGender());
     $this->createOptionalNode($doc, $userNode, 'date_registered', $user->getDateRegistered());
     $this->createOptionalNode($doc, $userNode, 'date_last_login', $user->getDateLastLogin());
     $this->createOptionalNode($doc, $userNode, 'date_last_email', $user->getDateLastEmail());
     $this->createOptionalNode($doc, $userNode, 'date_validated', $user->getDateValidated());
     $this->createOptionalNode($doc, $userNode, 'inline_help', $user->getInlineHelp() ? 'true' : 'false');
     $this->createOptionalNode($doc, $userNode, 'auth_id', $user->getAuthId());
     $this->createOptionalNode($doc, $userNode, 'auth_string', $user->getAuthStr());
     $this->createOptionalNode($doc, $userNode, 'fax', $user->getFax());
     $this->createOptionalNode($doc, $userNode, 'phone', $user->getPhone());
     $this->createOptionalNode($doc, $userNode, 'mailing_address', $user->getMailingAddress());
     $this->createOptionalNode($doc, $userNode, 'billing_address', $user->getBillingAddress());
     $this->createOptionalNode($doc, $userNode, 'locales', join(':', $user->getLocales()));
     if ($user->getDisabled()) {
         $this->createOptionalNode($doc, $userNode, 'disabled_reason', $user->getDisabledReason());
     }
     $userGroupAssignmentDao = DAORegistry::getDAO('UserGroupAssignmentDAO');
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $assignedGroups = $userGroupAssignmentDao->getByUserId($user->getId(), $context->getId());
     while ($assignedGroup = $assignedGroups->next()) {
         $userGroup = $userGroupDao->getById($assignedGroup->getUserGroupId());
         if ($userGroup) {
             $userNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'user_group_ref', $userGroup->getName($context->getPrimaryLocale())));
         }
     }
     // Add Reviewing Interests, if any.
     import('lib.pkp.classes.user.InterestManager');
     $interestManager = new InterestManager();
     $interests = $interestManager->getInterestsString($user);
     $this->createOptionalNode($doc, $userNode, 'review_interests', $interests);
     return $userNode;
 }