本文整理匯總了PHP中InterestManager::getInterestsForUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP InterestManager::getInterestsForUser方法的具體用法?PHP InterestManager::getInterestsForUser怎麽用?PHP InterestManager::getInterestsForUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InterestManager
的用法示例。
在下文中一共展示了InterestManager::getInterestsForUser方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initData
/**
* @copydoc Form::initData()
*/
function initData()
{
import('lib.pkp.classes.user.InterestManager');
$interestManager = new InterestManager();
$user = $this->getUser();
$this->_data = array('interests' => $interestManager->getInterestsForUser($user));
}
示例2: initData
/**
* 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(), 'orcid' => $user->getOrcid(), 'mailingAddress' => $user->getMailingAddress(), 'country' => $user->getCountry(), 'biography' => $user->getBiography(null), 'interests' => $interestManager->getInterestsForUser($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(), 'orcid' => $author->getOrcid(), 'country' => $author->getCountry(), 'biography' => $author->getBiography(null));
}
}
foreach ($data as $key => $value) {
$this->setData($key, $value);
}
}
示例3: initData
/**
* 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));
}
}
示例4: initData
/**
* 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));
}
示例5: getUserInterests
/**
* Get the user's reviewing interests as an array. DEPRECATED in favour of direct interaction with the InterestManager.
* @return array
*/
function getUserInterests()
{
if (Config::getVar('debug', 'deprecation_warnings')) {
trigger_error('Deprecated function.');
}
import('lib.pkp.classes.user.InterestManager');
$interestManager = new InterestManager();
return $interestManager->getInterestsForUser($this);
}
示例6: foreach
function &exportUsers(&$journal, &$users, $allowedRoles = null)
{
$roleDao =& DAORegistry::getDAO('RoleDAO');
$doc =& XMLCustomWriter::createDocument('users', USERS_DTD_ID, USERS_DTD_URL);
$root =& XMLCustomWriter::createElement($doc, 'users');
foreach ($users as $user) {
$userNode =& XMLCustomWriter::createElement($doc, 'user');
XMLCustomWriter::createChildWithText($doc, $userNode, 'username', $user->getUserName(), false);
$passwordNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'password', $user->getPassword());
XMLCustomWriter::setAttribute($passwordNode, 'encrypted', Config::getVar('security', 'encryption'));
XMLCustomWriter::createChildWithText($doc, $userNode, 'salutation', $user->getSalutation(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'first_name', $user->getFirstName());
XMLCustomWriter::createChildWithText($doc, $userNode, 'middle_name', $user->getMiddleName(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'last_name', $user->getLastName());
XMLCustomWriter::createChildWithText($doc, $userNode, 'initials', $user->getInitials(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'gender', $user->getGender(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'email', $user->getEmail());
XMLCustomWriter::createChildWithText($doc, $userNode, 'url', $user->getUrl(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'phone', $user->getPhone(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'fax', $user->getFax(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'mailing_address', $user->getMailingAddress(), false);
XMLCustomWriter::createChildWithText($doc, $userNode, 'country', $user->getCountry(), false);
if (is_array($user->getAffiliation(null))) {
foreach ($user->getAffiliation(null) as $locale => $value) {
$affiliationNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'affiliation', $value, false);
if ($affiliationNode) {
XMLCustomWriter::setAttribute($affiliationNode, 'locale', $locale);
}
unset($affiliationNode);
}
}
if (is_array($user->getSignature(null))) {
foreach ($user->getSignature(null) as $locale => $value) {
$signatureNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'signature', $value, false);
if ($signatureNode) {
XMLCustomWriter::setAttribute($signatureNode, 'locale', $locale);
}
unset($signatureNode);
}
}
import('lib.pkp.classes.user.InterestManager');
$interestManager = new InterestManager();
$interests = $interestManager->getInterestsForUser($user);
if (is_array($interests)) {
foreach ($interests as $interest) {
XMLCustomWriter::createChildWithText($doc, $userNode, 'interests', $interest, false);
}
}
if (is_array($user->getGossip(null))) {
foreach ($user->getGossip(null) as $locale => $value) {
$gossipNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'gossip', $value, false);
if ($gossipNode) {
XMLCustomWriter::setAttribute($gossipNode, 'locale', $locale);
}
unset($gossipNode);
}
}
if (is_array($user->getBiography(null))) {
foreach ($user->getBiography(null) as $locale => $value) {
$biographyNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'biography', $value, false);
if ($biographyNode) {
XMLCustomWriter::setAttribute($biographyNode, 'locale', $locale);
}
unset($biographyNode);
}
}
XMLCustomWriter::createChildWithText($doc, $userNode, 'locales', join(':', $user->getLocales()), false);
$roles =& $roleDao->getRolesByUserId($user->getId(), $journal->getId());
foreach ($roles as $role) {
$rolePath = $role->getRolePath();
if ($allowedRoles !== null && !in_array($rolePath, $allowedRoles)) {
continue;
}
$roleNode =& XMLCustomWriter::createElement($doc, 'role');
XMLCustomWriter::setAttribute($roleNode, 'type', $rolePath);
XMLCustomWriter::appendChild($userNode, $roleNode);
unset($roleNode);
}
XMLCustomWriter::appendChild($root, $userNode);
}
XMLCustomWriter::appendChild($doc, $root);
return $doc;
}
示例7: initData
/**
* 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();
}
示例8: exportUsers
function exportUsers($writer)
{
import('lib.pkp.classes.user.InterestManager');
$interestManager = new InterestManager();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$userDAO =& DAORegistry::getDAO('UserDAO');
$result =& $userDAO->retrieveRange('SELECT DISTINCT u.*
FROM users u
LEFT JOIN controlled_vocabs cv ON (cv.symbolic = "interest")
LEFT JOIN user_interests ui ON (ui.user_id = u.user_id)
LEFT JOIN controlled_vocab_entries cve ON (cve.controlled_vocab_id = cv.controlled_vocab_id AND ui.controlled_vocab_entry_id = cve.controlled_vocab_entry_id)
LEFT JOIN controlled_vocab_entry_settings cves ON (cves.controlled_vocab_entry_id = cve.controlled_vocab_entry_id)
WHERE u.user_id IN (
SELECT r.user_id FROM roles AS r WHERE r.journal_id = ?
UNION
SELECT gm.user_id FROM group_memberships AS gm INNER JOIN groups AS g ON gm.group_id=g.group_id WHERE g.assoc_id = ?
UNION
SELECT se.user_id FROM section_editors AS se WHERE se.journal_id = ?
UNION
SELECT a.user_id FROM articles AS a WHERE a.journal_id = ?
UNION
SELECT ea.editor_id FROM edit_assignments AS ea INNER JOIN articles AS a ON ea.article_id=a.article_id WHERE a.journal_id = ?
UNION
SELECT ed.editor_id FROM edit_decisions AS ed INNER JOIN articles AS a ON ed.article_id=a.article_id WHERE a.journal_id = ?
UNION
SELECT ra.reviewer_id FROM review_assignments AS ra INNER JOIN articles AS a ON ra.submission_id=a.article_id WHERE a.journal_id = ?
UNION
SELECT s.user_id FROM signoffs AS s INNER JOIN articles AS a ON s.assoc_id=a.article_id WHERE a.journal_id = ?
UNION
SELECT el.sender_id FROM email_log AS el INNER JOIN articles AS a ON el.assoc_id=a.article_id WHERE a.journal_id = ?
UNION
SELECT evenl.user_id FROM event_log AS evenl INNER JOIN articles AS a ON evenl.assoc_id=a.article_id WHERE a.journal_id = ?
UNION
SELECT ac.author_id FROM article_comments AS ac INNER JOIN articles AS a ON ac.article_id=a.article_id WHERE a.journal_id = ?
UNION
SELECT n.user_id FROM notes AS n INNER JOIN articles AS a ON n.assoc_id=a.article_id WHERE a.journal_id = ?
)', array($this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId(), $this->journal->getId()), null);
$users =& new DAOResultFactory($result, $userDAO, '_returnUserFromRowWithData');
$writer->startElement('users');
while (!$users->eof()) {
$user = $users->next();
$writer->startElement('user');
$this->writeElement($writer, 'oldId', $user->getId());
$this->writeElement($writer, 'username', $user->getUsername());
$this->writeElement($writer, 'password', $user->getPassword());
$this->writeElement($writer, 'salutation', $user->getSalutation());
$this->writeElement($writer, 'firstName', $user->getFirstName());
$this->writeElement($writer, 'middleName', $user->getMiddleName());
$this->writeElement($writer, 'initials', $user->getInitials());
$this->writeElement($writer, 'lastName', $user->getLastName());
$this->writeElement($writer, 'suffix', $user->getSuffix());
$this->writeElement($writer, 'gender', $user->getGender());
$this->writeElement($writer, 'email', $user->getEmail());
$this->writeElement($writer, 'url', $user->getUrl());
$this->writeElement($writer, 'phone', $user->getPhone());
$this->writeElement($writer, 'fax', $user->getFax());
$this->writeElement($writer, 'mailingAddress', $user->getMailingAddress());
$this->writeElement($writer, 'billingAddress', $user->getBillingAddress());
$this->writeElement($writer, 'country', $user->getCountry());
$this->writeElement($writer, 'locales', $user->getLocales() ? implode(':', $user->getLocales()) : null);
$this->writeElement($writer, 'dateLastEmail', $user->getDateLastEmail());
$this->writeElement($writer, 'dateRegistered', $user->getDateRegistered());
$this->writeElement($writer, 'dateValidated', $user->getDateValidated());
$this->writeElement($writer, 'dateLastLogin', $user->getDateLastLogin());
$this->writeElement($writer, 'mustChangePassword', $user->getMustChangePassword());
$this->writeElement($writer, 'disabled', $user->getDisabled());
$this->writeElement($writer, 'disabledReason', $user->getDisabledReason());
$this->writeElement($writer, 'authId', $user->getAuthId());
$this->writeElement($writer, 'authStr', $user->getAuthStr());
$this->writeElement($writer, 'inlineHelp', $user->getInlineHelp());
$interests = $interestManager->getInterestsForUser($user);
if (is_array($interests)) {
foreach ($interests as $interest) {
$this->writeElement($writer, 'interest', $interest);
}
}
$roles = $roleDao->getRolesByUserId($user->getId(), $this->journal->getId());
foreach ($roles as $role) {
$this->writeElement($writer, 'role', $role->getRoleId());
}
$this->exportUserSettings($userDAO, $writer, $user->getId());
$writer->endElement();
$writer->flush();
}
$writer->endElement();
$writer->flush();
}