本文整理汇总了PHP中ArticleLog::logEventHeadless方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleLog::logEventHeadless方法的具体用法?PHP ArticleLog::logEventHeadless怎么用?PHP ArticleLog::logEventHeadless使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleLog
的用法示例。
在下文中一共展示了ArticleLog::logEventHeadless方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logEvent
/**
* Add a new event log entry with the specified parameters
* @param $request object
* @param $article object
* @param $eventType int
* @param $messageKey string
* @param $params array optional
* @return object ArticleLogEntry iff the event was logged
*/
function logEvent(&$request, &$article, $eventType, $messageKey, $params = array())
{
$journal =& $request->getJournal();
$user =& $request->getUser();
$userId = isset($user) ? $user->getId() : 0;
return ArticleLog::logEventHeadless($journal, $userId, $article, $eventType, $messageKey, $params);
}
示例2: handleArticleNode
//.........这里部分代码省略.........
$articleDao->insertArticle($article);
$dependentItems[] = array('article', $article);
/* --- Handle authors --- */
for ($index = 0; $node = $articleNode->getChildByName('author', $index); $index++) {
if (!NativeImportDom::handleAuthorNode($journal, $node, $issue, $section, $article, $authorErrors, $index)) {
$errors = array_merge($errors, $authorErrors);
$hasErrors = true;
}
}
if ($hasErrors) {
return false;
}
// Create submission mangement records
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$initialCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId());
$initialCopyeditSignoff->setUserId(0);
$signoffDao->updateObject($initialCopyeditSignoff);
$authorCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
$authorCopyeditSignoff->setUserId(0);
$signoffDao->updateObject($authorCopyeditSignoff);
$finalCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId());
$finalCopyeditSignoff->setUserId(0);
$signoffDao->updateObject($finalCopyeditSignoff);
$layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
$layoutSignoff->setUserId(0);
$signoffDao->updateObject($layoutSignoff);
$authorProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
$authorProofSignoff->setUserId(0);
$signoffDao->updateObject($authorProofSignoff);
$proofreaderProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId());
$proofreaderProofSignoff->setUserId(0);
$signoffDao->updateObject($proofreaderProofSignoff);
$layoutProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
$layoutProofSignoff->setUserId(0);
$signoffDao->updateObject($layoutProofSignoff);
// Log the import in the article event log.
import('classes.article.log.ArticleLog');
ArticleLog::logEventHeadless($journal, $user->getId(), $article, ARTICLE_LOG_ARTICLE_IMPORT, 'log.imported', array('userName' => $user->getFullName(), 'articleId' => $article->getId()));
// Insert published article entry.
$publishedArticle = new PublishedArticle();
$publishedArticle->setId($article->getId());
$publishedArticle->setIssueId($issue->getId());
if ($node = $articleNode->getChildByName('date_published')) {
$publishedDate = strtotime($node->getValue());
if ($publishedDate === -1) {
$errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue()));
return false;
} else {
$publishedArticle->setDatePublished($publishedDate);
}
}
$node = $articleNode->getChildByName('open_access');
$publishedArticle->setAccessStatus($node ? ARTICLE_ACCESS_OPEN : ARTICLE_ACCESS_ISSUE_DEFAULT);
$publishedArticle->setSeq(REALLY_BIG_NUMBER);
$publishedArticle->setViews(0);
$publishedArticle->setPublishedArticleId($publishedArticleDao->insertPublishedArticle($publishedArticle));
$publishedArticleDao->resequencePublishedArticles($section->getId(), $issue->getId());
/* --- Galleys (html or otherwise handled simultaneously) --- */
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($article->getId());
/* --- Handle galleys --- */
$hasErrors = false;
$galleyCount = 0;
for ($index = 0; $index < count($articleNode->children); $index++) {
$node = $articleNode->children[$index];
if ($node->getName() == 'htmlgalley') {
$isHtml = true;
} elseif ($node->getName() == 'galley') {
$isHtml = false;
} else {
continue;
}
if (!NativeImportDom::handleGalleyNode($journal, $node, $issue, $section, $article, $galleyErrors, $isCommandLine, $isHtml, $galleyCount, $articleFileManager)) {
$errors = array_merge($errors, $galleyErrors);
$hasErrors = true;
}
$galleyCount++;
}
if ($hasErrors) {
return false;
}
/* --- Handle supplemental files --- */
$hasErrors = false;
for ($index = 0; $node = $articleNode->getChildByName('supplemental_file', $index); $index++) {
if (!NativeImportDom::handleSuppFileNode($journal, $node, $issue, $section, $article, $suppFileErrors, $isCommandLine, $articleFileManager)) {
$errors = array_merge($errors, $suppFileErrors);
$hasErrors = true;
}
}
if ($hasErrors) {
return false;
}
// Index the inserted article.
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleMetadataChanged($article);
$articleSearchIndex->articleFilesChanged($article);
$articleSearchIndex->articleChangesFinished();
return true;
}