当前位置: 首页>>代码示例>>PHP>>正文


PHP Author::setUserGroupId方法代码示例

本文整理汇总了PHP中Author::setUserGroupId方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::setUserGroupId方法的具体用法?PHP Author::setUserGroupId怎么用?PHP Author::setUserGroupId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Author的用法示例。


在下文中一共展示了Author::setUserGroupId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Save author
  * @see Form::execute()
  * @see Form::execute()
  */
 function execute()
 {
     $authorDao = DAORegistry::getDAO('AuthorDAO');
     $submission = $this->getSubmission();
     $author = $this->getAuthor();
     if (!$author) {
         // this is a new submission contributor
         $author = new Author();
         $author->setSubmissionId($submission->getId());
         $existingAuthor = false;
     } else {
         $existingAuthor = true;
         if ($submission->getId() !== $author->getSubmissionId()) {
             fatalError('Invalid author!');
         }
     }
     $author->setFirstName($this->getData('firstName'));
     $author->setMiddleName($this->getData('middleName'));
     $author->setLastName($this->getData('lastName'));
     $author->setSuffix($this->getData('suffix'));
     $author->setAffiliation($this->getData('affiliation'), null);
     // localized
     $author->setCountry($this->getData('country'));
     $author->setEmail($this->getData('email'));
     $author->setUrl($this->getData('userUrl'));
     $author->setOrcid($this->getData('orcid'));
     $author->setUserGroupId($this->getData('userGroupId'));
     $author->setBiography($this->getData('biography'), null);
     // localized
     $author->setPrimaryContact($this->getData('primaryContact') ? true : false);
     $author->setIncludeInBrowse($this->getData('includeInBrowse') ? true : false);
     // in order to be able to use the hook
     parent::execute();
     if ($existingAuthor) {
         $authorDao->updateObject($author);
         $authorId = $author->getId();
     } else {
         $authorId = $authorDao->insertObject($author);
     }
     return $authorId;
 }
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:46,代码来源:AuthorForm.inc.php

示例2: execute

 /**
  * Save submissionContributor
  * @see Form::execute()
  * @see Form::execute()
  */
 function execute()
 {
     $authorDao =& DAORegistry::getDAO('AuthorDAO');
     $monograph = $this->getMonograph();
     $submissionContributor =& $this->getSubmissionContributor();
     if (!$submissionContributor) {
         // this is a new submission contributor
         $submissionContributor = new Author();
         $submissionContributor->setMonographId($monograph->getId());
         $existingSubmissionContributor = false;
     } else {
         $existingSubmissionContributor = true;
     }
     assert($monograph->getId() == $submissionContributor->getMonographId());
     $submissionContributor->setFirstName($this->getData('firstName'));
     $submissionContributor->setMiddleName($this->getData('middleName'));
     $submissionContributor->setLastName($this->getData('lastName'));
     $submissionContributor->setAffiliation($this->getData('affiliation'), Locale::getLocale());
     // localized
     $submissionContributor->setCountry($this->getData('country'));
     $submissionContributor->setEmail($this->getData('email'));
     $submissionContributor->setUrl($this->getData('url'));
     $submissionContributor->setUserGroupId($this->getData('userGroupId'));
     $submissionContributor->setBiography($this->getData('biography'), Locale::getLocale());
     // localized
     $submissionContributor->setPrimaryContact($this->getData('primaryContact') ? true : false);
     if ($existingSubmissionContributor) {
         $authorDao->updateAuthor($submissionContributor);
         $authorId = $submissionContributor->getId();
     } else {
         $authorId = $authorDao->insertAuthor($submissionContributor);
     }
     return $authorId;
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:39,代码来源:SubmissionContributorForm.inc.php

示例3: importArticles

    function importArticles()
    {
        assert($this->xml->name == 'articles');
        $articleDAO =& DAORegistry::getDAO('ArticleDAO');
        $articles = $articleDAO->getArticlesByJournalId($this->journal->getId());
        $journalFileManager = new JournalFileManager($this->journal);
        $publicFileManager =& new PublicFileManager();
        $this->nextElement();
        while ($this->xml->name == 'article') {
            $articleXML = $this->getCurrentElementAsDom();
            $article = new Article();
            $article->setJournalId($this->journal->getId());
            $article->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleXML->userId));
            $article->setSectionId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_SECTION, (int) $articleXML->sectionId));
            $article->setLocale((string) $articleXML->locale);
            $article->setLanguage((string) $articleXML->language);
            $article->setCommentsToEditor((string) $articleXML->commentsToEditor);
            $article->setCitations((string) $articleXML->citations);
            $article->setDateSubmitted((string) $articleXML->dateSubmitted);
            $article->setDateStatusModified((string) $articleXML->dateStatusModified);
            $article->setLastModified((string) $articleXML->lastModified);
            $article->setStatus((int) $articleXML->status);
            $article->setSubmissionProgress((int) $articleXML->submissionProgress);
            $article->setCurrentRound((int) $articleXML->currentRound);
            $article->setPages((string) $articleXML->pages);
            $article->setFastTracked((int) $articleXML->fastTracked);
            $article->setHideAuthor((int) $articleXML->hideAuthor);
            $article->setCommentsStatus((int) $articleXML->commentsStatus);
            $articleDAO->insertArticle($article);
            $oldArticleId = (int) $articleXML->oldId;
            $this->restoreDataObjectSettings($articleDAO, $articleXML->settings, 'article_settings', 'article_id', $article->getId());
            $article =& $articleDAO->getArticle($article->getId());
            // Reload article with restored settings
            $covers = $article->getFileName(null);
            if ($covers) {
                foreach ($covers as $locale => $oldCoverFileName) {
                    $sourceFile = $this->publicFolderPath . '/' . $oldCoverFileName;
                    $extension = $publicFileManager->getExtension($oldCoverFileName);
                    $destFile = 'cover_issue_' . $article->getId() . "_{$locale}.{$extension}";
                    $publicFileManager->copyJournalFile($this->journal->getId(), $sourceFile, $destFile);
                    unlink($sourceFile);
                    $article->setFileName($destFile, $locale);
                    $articleDAO->updateArticle($article);
                }
            }
            $articleFileManager = new ArticleFileManager($article->getId());
            $authorDAO =& DAORegistry::getDAO('AuthorDAO');
            foreach ($articleXML->author as $authorXML) {
                $author = new Author();
                $author->setArticleId($article->getId());
                $author->setFirstName((string) $authorXML->firstName);
                $author->setMiddleName((string) $authorXML->middleName);
                $author->setLastName((string) $authorXML->lastName);
                $author->setSuffix((string) $authorXML->suffix);
                $author->setCountry((string) $authorXML->country);
                $author->setEmail((string) $authorXML->email);
                $author->setUrl((string) $authorXML->url);
                $author->setUserGroupId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_GROUP, (int) $authorXML->userGroupId));
                $author->setPrimaryContact((int) $authorXML->primaryContact);
                $author->setSequence((int) $authorXML->sequence);
                $authorDAO->insertAuthor($author);
                $this->restoreDataObjectSettings($authorDAO, $authorXML->settings, 'author_settings', 'author_id', $author->getId());
                unset($author);
            }
            $articleEmailLogDAO =& DAORegistry::getDAO('ArticleEmailLogDAO');
            $emailLogsXML = array();
            foreach ($articleXML->emailLogs->emailLog as $emailLogXML) {
                array_unshift($emailLogsXML, $emailLogXML);
            }
            foreach ($emailLogsXML as $emailLogXML) {
                $emailLog = new ArticleEmailLogEntry();
                $emailLog->setAssocType(ASSOC_TYPE_ARTICLE);
                $emailLog->setAssocId($article->getId());
                $emailLog->setSenderId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $emailLogXML->senderId));
                $emailLog->setDateSent((string) $emailLogXML->dateSent);
                $emailLog->setIPAddress((string) $emailLogXML->IPAddress);
                $emailLog->setEventType((int) $emailLogXML->eventType);
                $emailLog->setFrom((string) $emailLogXML->from);
                $emailLog->setRecipients((string) $emailLogXML->recipients);
                $emailLog->setCcs((string) $emailLogXML->ccs);
                $emailLog->setBccs((string) $emailLogXML->bccs);
                $emailLog->setSubject((string) $emailLogXML->subject);
                $emailLog->setBody((string) $emailLogXML->body);
                $articleEmailLogDAO->insertObject($emailLog);
                $this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ARTICLE_EMAIL_LOG, (int) $emailLogXML->oldId, $emailLog->getId());
            }
            $articleFileDAO =& DAORegistry::getDAO('ArticleFileDAO');
            foreach ($articleXML->articleFile as $articleFileXML) {
                try {
                    $articleFile = new ArticleFile();
                    $articleFile->setArticleId($article->getId());
                    $articleFile->setSourceFileId((int) $articleFileXML->sourceFileId);
                    $articleFile->setSourceRevision((int) $articleFileXML->sourceRevision);
                    $articleFile->setRevision((int) $articleFileXML->revision);
                    $articleFile->setFileName((string) $articleFileXML->fileName);
                    $articleFile->setFileType((string) $articleFileXML->fileType);
                    $articleFile->setFileSize((string) $articleFileXML->fileSize);
                    $articleFile->setOriginalFileName((string) $articleFileXML->originalFileName);
                    $articleFile->setFileStage((int) $articleFileXML->fileStage);
                    $articleFile->setAssocId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_EMAIL_LOG, (int) $articleFileXML->assocId));
//.........这里部分代码省略.........
开发者ID:ulsdevteam,项目名称:fullJournalTransfer,代码行数:101,代码来源:XMLDisassembler.inc.php

示例4: execute

 /**
  * Save changes to submission.
  * @return int the monograph ID
  */
 function execute()
 {
     $monographDao =& DAORegistry::getDAO('MonographDAO');
     if (isset($this->monograph)) {
         // Update existing monograph
         $this->monograph->setSeriesId($this->getData('seriesId'));
         $this->monograph->setLocale($this->getData('locale'));
         $this->monograph->setCommentsToEditor($this->getData('commentsToEditor'));
         if ($this->monograph->getSubmissionProgress() <= $this->step) {
             $this->monograph->stampStatusModified();
             $this->monograph->setSubmissionProgress($this->step + 1);
         }
         $monographDao->updateMonograph($this->monograph);
     } else {
         $press =& Request::getPress();
         $user =& Request::getUser();
         // Get the session and the user group id currently used
         $sessionMgr =& SessionManager::getManager();
         $session =& $sessionMgr->getUserSession();
         // Create new monograph
         $this->monograph = new Monograph();
         $this->monograph->setLocale($this->getData('locale'));
         $this->monograph->setUserId($user->getId());
         $this->monograph->setPressId($press->getId());
         $this->monograph->setSeriesId($this->getData('seriesId'));
         $this->monograph->stampStatusModified();
         $this->monograph->setSubmissionProgress($this->step + 1);
         $this->monograph->setLanguage(String::substr($this->monograph->getLocale(), 0, 2));
         $this->monograph->setCommentsToEditor($this->getData('commentsToEditor'));
         $this->monograph->setWorkType($this->getData('isEditedVolume') ? WORK_TYPE_EDITED_VOLUME : WORK_TYPE_AUTHORED_WORK);
         $this->monograph->setCurrentStageId(WORKFLOW_STAGE_ID_SUBMISSION);
         // Get a default user group id for an Author
         $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
         $defaultAuthorGroup =& $userGroupDao->getDefaultByRoleId($press->getId(), ROLE_ID_AUTHOR);
         // Set user to initial author
         $authorDao =& DAORegistry::getDAO('AuthorDAO');
         $user =& Request::getUser();
         $author = new Author();
         $author->setFirstName($user->getFirstName());
         $author->setMiddleName($user->getMiddleName());
         $author->setLastName($user->getLastName());
         $author->setAffiliation($user->getAffiliation(null), null);
         $author->setCountry($user->getCountry());
         $author->setEmail($user->getEmail());
         $author->setUrl($user->getUrl());
         $author->setUserGroupId($defaultAuthorGroup->getId());
         $author->setBiography($user->getBiography(null), null);
         $author->setPrimaryContact(1);
         $monographDao->insertMonograph($this->monograph);
         $this->monographId = $this->monograph->getId();
         $author->setSubmissionId($this->monographId);
         $authorDao->insertAuthor($author);
     }
     return $this->monographId;
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:59,代码来源:SubmissionSubmitStep1Form.inc.php


注:本文中的Author::setUserGroupId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。