diff --git a/application/common/LatexContent.php b/application/common/LatexContent.php index 1895b11..b16afd2 100644 --- a/application/common/LatexContent.php +++ b/application/common/LatexContent.php @@ -30,6 +30,7 @@ class LatexContent{ \end{figure}' ; //首页内容 private $sFirst = '\documentclass[ +articletype={{article_type}}, journal={{journal_abbr}}, journalname={{{{journal_title}}}}, layout=largetwo, @@ -55,21 +56,22 @@ page={{stage_page}},%号 {{author_info}} -{{correspondence_info}} +\Correspondence{{{correspondence_info}}} \keywords{keyword entry 1, keyword entry 2, keyword entry 3} %% First letter not capped -{{author_contribution}} +\authorcontributions{{{author_contribution}}} \competinginterests{The authors declare no conflicts of interest.} -{{article_acknowledgment}} -\Peerreviewinformation{{{journal_title}} thanks all anonymous reviewers for their contribution to the peer review of this paper} -{{article_abbreviation}} -{{article_cite}} +\Acknowledgments{{{article_acknowledgment}}} +\Peerreviewinformation{\textit{{{journal_title}}} thanks all anonymous reviewers for their contribution to the peer review of this paper} +\Abbreviations{{{article_abbreviation}}} +\Citation{{{article_cite}}} \received{{{received_date}}} \revised{{{revision_date}}} \accepted{{{accepted_date}}} \Availableonline{{{pub_date}}} +\EditorialAdvisoryBoard{{{editorial_advisory_board}}} {{executive_editor}} {{abstract}} {{keywords}} @@ -119,9 +121,9 @@ page={{stage_page}},%号 //年 $iYear = empty($aJournalStage['stage_year']) ? date('Y') : $aJournalStage['stage_year']; //卷 - $iVolume = empty($aJournalStage['stage_vol']) ? 0 : $aJournalStage['stage_vol']; + $iVolume = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol']; //期 - $iPeriod = empty($aJournalStage['stage_no']) ? 0 : $aJournalStage['stage_no']; + $iPeriod = empty($aJournalStage['stage_no']) ? '' : $aJournalStage['stage_no']; //页 $sPage = empty($aProductionArticle['npp']) ? '' : $aProductionArticle['npp']; @@ -139,7 +141,7 @@ page={{stage_page}},%号 $aAuthoInfo = $this->dealAuthor(['p_article_id' => $aProductionArticle['p_article_id']]); $aSearch['{{author_info}}'] = empty($aAuthoInfo['author']) ? '' : $aAuthoInfo['author']; //通讯作者信息 - $aSearch['{{correspondence_info}}'] = empty($aAuthoInfo['correspondence']) ? '' : '\Correspondence{'.$aAuthoInfo['correspondence'].'}'; + $aSearch['{{correspondence_info}}'] = empty($aAuthoInfo['correspondence']) ? '' : $aAuthoInfo['correspondence']; //文章基本信息处理 //标题 @@ -157,24 +159,31 @@ page={{stage_page}},%号 } $aSearch['{{article_title}}'] = $sTitle; //author_contribution - $aSearch['{{author_contribution}}'] = empty($aProductionArticle['author_contribution']) ? '' : '\authorcontributions{'.$this->dealContent($aProductionArticle['author_contribution']).'}'; + $aSearch['{{author_contribution}}'] = empty($aProductionArticle['author_contribution']) ? '' : $this->dealContent($aProductionArticle['author_contribution']); //acknowledgment - $aSearch['{{article_acknowledgment}}'] = empty($aProductionArticle['acknowledgment']) ? '' : '\Acknowledgments{'.$this->dealContent($aProductionArticle['acknowledgment']).'}'; + $aSearch['{{article_acknowledgment}}'] = empty($aProductionArticle['acknowledgment']) ? '' : $this->dealContent($aProductionArticle['acknowledgment']); //abbreviation - $aSearch['{{article_abbreviation}}'] = empty($aProductionArticle['abbreviation']) ? '' : '\Abbreviations{'.$this->dealContent($aProductionArticle['abbreviation']).'}'; + $aSearch['{{article_abbreviation}}'] = empty($aProductionArticle['abbreviation']) ? '' : $this->dealContent($aProductionArticle['abbreviation']); //文章引用信息 $sCite = $this->getArticleCite($aProductionArticle,$aJournal,$aJournalStage); - $aSearch['{{article_cite}}'] = empty($sCite) ? '' : '\Citation{'.$sCite.'}'; + $aSearch['{{article_cite}}'] = empty($sCite) ? '' : $sCite; + //文章类型 + $aSearch['{{article_type}}'] = empty($aProductionArticle['type']) ? 'ARTICLE' : strtoupper($aProductionArticle['type']); //获取文章时间 $aTime = $this->getArticleTime(['article_id' => $aProductionArticle['article_id']]); $aTime = empty($aTime['data']) ? [] : $aTime['data']; $aSearch['{{received_date}}'] = empty($aTime['received_date']) ? '' : $aTime['received_date']; - $aSearch['{{revision_date}}'] = empty($aTime['revision_date']) ? '' : $aTime['revision_date']; + $aSearch['{{revision_date}}'] = ''; + if(in_array( $aSearch['{{article_type}}'], ['ARTICLE','REVIEW','MINI REVIEW'])){ + $aSearch['{{revision_date}}'] = empty($aTime['revision_date']) ? '' : '\textbf{Revised:}'.$aTime['revision_date'].'; '; + } + $aSearch['{{accepted_date}}'] = empty($aTime['accepted_date']) ? '' : $aTime['accepted_date']; $aSearch['{{pub_date}}'] = empty($aProductionArticle['pub_date']) ? '' : $aProductionArticle['pub_date']; - + //终审编委名字 + $aSearch['{{editorial_advisory_board}}'] = empty($aTime['editorial_advisory_board']) ? '' : $aTime['editorial_advisory_board']; //获取编辑信息 $executive_editor = empty($aProductionArticle['executive_editor']) ? '' : '\Executiveeditor{'.$this->dealContent($aProductionArticle['executive_editor']).'}'; $executive_editor_realname = empty($aUser['realname']) ? '' : '\Executiveeditor{'.$this->dealContent($aUser['realname']).'}'; @@ -184,7 +193,7 @@ page={{stage_page}},%号 //摘要替换 $sAbstract = empty($aProductionArticle['abstract']) ? '' : $this->dealContent($aProductionArticle['abstract']); if(!empty($sAbstract)){ - $aRelace = ['Background:' => '\textcolor[HTML]{0070C0}{\textbf{Background:}}','Methods:' => '\textcolor[HTML]{0070C0}{\textbf{Methods:}}','Results:' => '\textcolor[HTML]{0070C0}{\textbf{Results:}}','Conclusion:' => '\textcolor[HTML]{0070C0}{\textbf{Conclusion:}}']; + $aRelace = ['Background:' => '\textcolor[HTML]{0070C0}{\textbf{Background:}}','Methods:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Methods:}}','Results:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Results:}}','Conclusion:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Conclusion:}}']; $sAbstract = str_replace(array_keys($aRelace), array_values($aRelace), $sAbstract); $sAbstract = '\tmrabstract{'.$sAbstract.'}'; } @@ -195,12 +204,13 @@ page={{stage_page}},%号 //文章图片地址 $sIcon = empty($aProductionArticle['icon']) ? '' : $aProductionArticle['icon']; + $is_graphical_abstract = empty($aProductionArticle['is_graphical_abstract']) ? 3 : $aProductionArticle['is_graphical_abstract'];//是否显示图文摘要1是2否3未选择 if(!empty($sIcon)){ $sIconUrl = ROOT_PATH.trim($this->sArticleIcon,'/').'/'.$sIcon; - if(file_exists($sIconUrl)){ + if(file_exists($sIconUrl) && $is_graphical_abstract == 1){ $sIconUrl = str_replace(ROOT_PATH.'public/', '', $sIconUrl); $sIconUrl = '../../'.$sIconUrl; - $sIcon = '\KeywordImage{'.$sIconUrl.'}'; + $sIcon = $sIconUrl; }else{ $sIcon = ''; } @@ -214,7 +224,7 @@ page={{stage_page}},%号 // $sIcon = ''; // } } - $aSearch['{{article_icon}}'] = $sIcon; + $aSearch['{{article_icon}}'] = '\KeywordImage{'.$sIcon.'}'; $aSearch['{{keywords}}'] = $sKeywords; // $aSearch['{{CLSFILEURL}}'] = ROOT_PATH.'public/latex/cls'; $aSearch['{{article_id}}'] = $aProductionArticle['article_id']; @@ -311,10 +321,10 @@ page={{stage_page}},%号 if($value['type'] == 0 ){ //处理内容 $sMainContent = $this->dealContent($value['content'],$aReferences); - //替换myh3标签 - $contentpattern = '/(.*?)<\/myh3>/is'; - $contentreplacement = '\\subsubsection{$1}'; - $sMainContent = preg_replace($contentpattern, $contentreplacement, $sMainContent); + // //替换myh3标签 + // $contentpattern = '/(.*?)<\/myh3>/is'; + // $contentreplacement = '\\subsubsection{$1}'; + // $sMainContent = preg_replace($contentpattern, $contentreplacement, $sMainContent); $sMain .= $sMainContent."\\par\n"; } if($value['type'] == 1 ){//图片 @@ -390,7 +400,7 @@ page={{stage_page}},%号 } //查询作者机构 $aWhere['p_article_author_id'] = ['in',array_column($aAuthor, 'p_article_author_id')]; - $aAuthorOrgan = Db::name('production_article_author_to_organ')->field('p_article_author_id,p_article_organ_id')->where($aWhere)->select(); + $aAuthorOrgan = Db::name('production_article_author_to_organ')->field('p_article_author_id,p_article_organ_id')->where($aWhere)->order('p_article_author_id asc,p_article_organ_id asc')->select(); //查询机构信息 $aAuthorOrganList = []; if(!empty($aAuthorOrgan)){ @@ -409,9 +419,10 @@ page={{stage_page}},%号 } //处理作者 $sAuthor = $sCorrespondence = ''; + $iFirstNum = 0; foreach ($aAuthor as $key => $value) { //作者姓名 - $sName = empty($value['fifirst_name']) ? '' : $value['fifirst_name']; + $sName = empty($value['first_name']) ? '' : $value['first_name']; $sName = empty($sName) ? '' : $sName . ' ' .$value['last_name']; if(empty($sName)){ $sName = empty($value['author_name']) ? '' : $value['author_name']; @@ -442,21 +453,32 @@ page={{stage_page}},%号 } if($value['is_first'] == 1){ $sAuthor .= '\firstauthor'."\n"; + $iFirstNum++; } if(!empty($value['orcid'])){ $sAuthor .= '\orcid{'.$this->dealContent($value['orcid']).'}'."\n"; } if($value['is_report'] == 1){ - $sCorrespondence .= $sName; - if(!empty($aOrganList[0])){ - $sCorrespondence .= ','.trim($this->dealContent($aOrganList[0]),'.'); + $sCorrespondenceInfo = $sName; + // if(!empty($aOrganList[0])){ + // $sCorrespondence .= ','.trim($this->dealContent($aOrganList[0]),'.'); + // } + if(!empty($value['mailing_address'])){//通讯地址 + $value['mailing_address'] = trim($value['mailing_address']); + $sCorrespondenceInfo .= ','.trim($this->dealContent($value['mailing_address']),'.'); } if(!empty($value['email'])){ - $sCorrespondence .= '.E-mail: '.trim($this->dealContent($value['email']),'.').'.'; + $sCorrespondenceInfo .= '. E-mail:'.trim($this->dealContent($value['email']),'.').'.'; + }else{ + $sCorrespondenceInfo .= trim($sCorrespondenceInfo,'.').'.'; } + $sCorrespondence .= $sCorrespondenceInfo .' '; } } - return ['author' => $sAuthor,'correspondence' => $sCorrespondence]; + if($iFirstNum == 1 && !empty($sAuthor)){ + $sAuthor = str_replace('\firstauthor'."\n", '', $sAuthor); + } + return ['author' => $sAuthor,'correspondence' => trim($sCorrespondence)]; } /** @@ -484,23 +506,24 @@ page={{stage_page}},%号 $jabbr = empty($aJournal['jabbr']) ? '' : $aJournal['jabbr']; $stage_year = empty($aJournalStage['stage_year']) ? '' : $aJournalStage['stage_year']; $stage_vol = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol']; - - $aAbbr = empty($aArticle['abbr']) ? '' : explode(',', trim($aArticle['abbr'])); - if(!empty($aAbbr)){ - $sEnd = end($aAbbr); - if($sEnd != 'et al'){ - $aArticle['abbr'] = implode(',', array_slice($aAbbr, 0,3)); - if(!empty($aArticle['abbr'])){ - $aArticle['abbr'] .= ', et al'; - } - } - } + $sAbbr = empty($aArticle['abbr']) ? '' : trim(trim($aArticle['abbr'],'.')); + // $aAbbr = empty( $sAbbr ) ? [] : explode(',', trim( $sAbbr )); + // if(!empty($aAbbr)){ + // $sEnd = end($aAbbr); + // if($sEnd != 'et al'){ + // $aThree = array_slice($aAbbr, 0,3); + // $sAbbr = implode(',', $aThree); + // if(!empty( $sAbbr ) && count($aThree) > 3){ + // $sAbbr .= ', et al'; + // } + // } + // } $sCite = ''; if ($aArticle['journal_id'] == 22) { - $sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; + $sCite = $sAbbr . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; $sCite = $this->dealContent($sCite); } else { - $sCite = $this->dealContent($aArticle['abbr']) . '. ' . $this->dealContent($aArticle['title']) . '. \textit{' . $this->dealContent(choiseJabbr($aArticle['article_id'], $jabbr)) . '}. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; + $sCite = $this->dealContent($sAbbr) . '. ' . $this->dealContent($aArticle['title']) . '. \textit{' . $this->dealContent(choiseJabbr($aArticle['article_id'], $jabbr)) . '}. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; } return $sCite; } @@ -517,6 +540,15 @@ page={{stage_page}},%号 if(empty($aArticle)){ return array('status' => 2,'msg' => 'The article does not exist' ); } + //查询终审-审稿记录 + $aWhere = ['article_id' => $iArticleId,'state' => ['in',[1,2,3]]]; + $aFinalReviewerId = Db::name('article_reviewer_final')->order('review_time desc')->where($aWhere)->column('reviewer_id'); + //查询审稿人姓名 + $aUserName = []; + if(!empty($aFinalReviewerId)){ + $aWhere = ['user_id' => ['in',array_unique($aFinalReviewerId)],'state' => 0,'realname' => ['<>','']]; + $aUserName = Db::name('user')->where($aWhere)->column('realname'); + } //获取文章记录 $aWhere = ['article_id' => $iArticleId,'state' => 0,'state_to' => ['in',[0,1,5]]]; $aArticleMsg = Db::name('article_msg')->field('state_from,state_to,ctime')->where($aWhere)->order('ctime deac')->select(); @@ -540,6 +572,7 @@ page={{stage_page}},%号 $aTime['received_date'] = empty($iReceivedTime) ? '' : $this->timestampToEnglishDate($iReceivedTime); $aTime['revision_date'] = empty($iRevisionTime) ? '' : $this->timestampToEnglishDate($iRevisionTime); $aTime['accepted_date'] = empty($iAcceptedTime) ? '' : $this->timestampToEnglishDate($iAcceptedTime); + $aTime['editorial_advisory_board'] = empty($aUserName) ? '' : implode(',', $aUserName); return ['status' => 1,'msg' => 'success','data' => $aTime]; } /**