示例#1
0
 /**
  * @copydoc PKPMetricsDAO::foreignKeyLookup()
  */
 protected function foreignKeyLookup($assocType, $assocId)
 {
     list($contextId, $sectionId, $assocObjType, $assocObjId, $submissionId, $representationId) = parent::foreignKeyLookup($assocType, $assocId);
     $isFile = false;
     if (!$contextId) {
         switch ($assocType) {
             case ASSOC_TYPE_ISSUE_GALLEY:
                 $issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO');
                 $issueGalley = $issueGalleyDao->getById($assocId);
                 if (!$issueGalley) {
                     throw new Exception('Cannot load record: invalid issue galley id.');
                 }
                 $assocObjType = ASSOC_TYPE_ISSUE;
                 $assocObjId = $issueGalley->getIssueId();
                 $isFile = true;
                 // Don't break but go on to retrieve the issue.
             // Don't break but go on to retrieve the issue.
             case ASSOC_TYPE_ISSUE:
                 if (!$isFile) {
                     $assocObjType = $assocObjId = null;
                     $issueId = $assocId;
                 } else {
                     $issueId = $assocObjId;
                 }
                 $issueDao = DAORegistry::getDAO('IssueDAO');
                 $issue = $issueDao->getById($issueId);
                 if (!$issue) {
                     throw new Exception('Cannot load record: invalid issue id.');
                 }
                 $contextId = $issue->getJournalId();
                 break;
         }
     }
     return array($contextId, $sectionId, $assocObjType, $assocObjId, $submissionId, $representationId);
 }
示例#2
0
 /**
  * @copydoc PKPMetricsDAO::getAssocObjectInfo()
  */
 protected function getAssocObjectInfo($submissionId, $contextId)
 {
     $returnArray = parent::getAssocObjectInfo($submissionId, $contextId);
     // Submissions in OJS are associated with an Issue.
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submissionId, $contextId, true);
     if ($publishedArticle) {
         $returnArray = array(ASSOC_TYPE_ISSUE, $publishedArticle->getIssueId());
     }
     return $returnArray;
 }