本文整理汇总了PHP中Application::getRepresentationDAO方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getRepresentationDAO方法的具体用法?PHP Application::getRepresentationDAO怎么用?PHP Application::getRepresentationDAO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::getRepresentationDAO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadData
/**
* @see GridDataProvider::loadData()
*/
function loadData()
{
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$representationDao = Application::getRepresentationDAO();
$representationFactory = $representationDao->getBySubmissionId($submission->getId());
return $representationFactory->toAssociativeArray();
}
开发者ID:energylevels,项目名称:pkp-lib,代码行数:10,代码来源:AuthorProofingSignoffFilesCategoryGridDataProvider.inc.php
示例2: handleElement
/**
* Handle a submission element
* @param $node DOMElement
* @return array Array of PublicationFormat objects
*/
function handleElement($node)
{
$deployment = $this->getDeployment();
$context = $deployment->getContext();
$submission = $deployment->getSubmission();
assert(is_a($submission, 'Submission'));
$representation = parent::handleElement($node);
if ($node->getAttribute('approved') == 'true') {
$representation->setIsApproved(true);
}
if ($node->getAttribute('physical_format') == 'true') {
$representation->setPhysicalFormat(true);
}
$representationDao = Application::getRepresentationDAO();
$representationDao->insertObject($representation);
// Handle metadata in subelements. Do this after the insertObject() call because it
// creates other DataObjects which depend on a representation id.
for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
if (is_a($n, 'DOMElement')) {
switch ($n->tagName) {
case 'Product':
$this->_processProductNode($n, $this->getDeployment(), $representation);
break;
default:
}
}
}
// Update the object.
$representationDao->updateObject($representation);
return $representation;
}
示例3: loadData
/**
* @see GridHandler::loadData
*/
function loadData($request, $filter = null)
{
$submission = $this->getSubmission();
$representationDao = Application::getRepresentationDAO();
$representations = $representationDao->getBySubmissionId($submission->getId());
return $representations->toAssociativeArray();
}
示例4: handleElement
/**
* Handle a submission element
* @param $node DOMElement
* @return array Array of Representation objects
*/
function handleElement($node)
{
$deployment = $this->getDeployment();
$context = $deployment->getContext();
$submission = $deployment->getSubmission();
assert(is_a($submission, 'Submission'));
// Create the data object
$representationDao = Application::getRepresentationDAO();
$representation = $representationDao->newDataObject();
$representation->setSubmissionId($submission->getId());
// Handle metadata in subelements. Look for the 'name' and 'seq' elements.
// All other elements are handled by subclasses.
for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
if (is_a($n, 'DOMElement')) {
switch ($n->tagName) {
case 'name':
$representation->setName($n->textContent, $n->getAttribute('locale'));
break;
case 'seq':
$representation->setSeq($n->textContent);
break;
}
}
}
return $representation;
// database insert is handled by sub class.
}
示例5: getQuerySubmission
/**
* Get the submission for a query.
* @param $query Query
* @return Submission
*/
protected function getQuerySubmission($query)
{
$submissionDao = Application::getSubmissionDAO();
switch ($query->getAssocType()) {
case ASSOC_TYPE_SUBMISSION:
return $submissionDao->getById($query->getAssocId());
case ASSOC_TYPE_REPRESENTATION:
$representationDao = Application::getRepresentationDAO();
$representation = $representationDao->getById($query->getAssocId());
return $submissionDao->getById($representation->getSubmissionId());
}
assert(false);
}
示例6: handleElement
/**
* Handle a submission element
* @param $node DOMElement
* @return array Array of ArticleGalley objects
*/
function handleElement($node)
{
$deployment = $this->getDeployment();
$context = $deployment->getContext();
$submission = $deployment->getSubmission();
assert(is_a($submission, 'Submission'));
$representation = parent::handleElement($node);
$representationDao = Application::getRepresentationDAO();
$representationDao->insertObject($representation);
// Update the object.
$representationDao->updateObject($representation);
return $representation;
}
示例7: importFile
/**
* @copydoc ManageSubmissionFilesForm::importFile()
*/
protected function importFile($context, $submissionFile, $fileStage)
{
$newSubmissionFile = parent::importFile($context, $submissionFile, $fileStage);
$representationDao = Application::getRepresentationDAO();
$representation = $representationDao->getById($this->_representationId, $this->getSubmissionId(), $context->getId());
$newSubmissionFile->setAssocType(ASSOC_TYPE_REPRESENTATION);
$newSubmissionFile->setAssocId($representation->getId());
$newSubmissionFile->setFileStage(SUBMISSION_FILE_PROOF);
$newSubmissionFile->setViewable(false);
// Not approved by default
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFileDao->updateObject($newSubmissionFile);
return $newSubmissionFile;
}
示例8: dataObjectEffect
/**
* @see DataObjectRequiredPolicy::dataObjectEffect()
*/
function dataObjectEffect()
{
$representationId = (int) $this->getDataObjectId();
if (!$representationId) {
return AUTHORIZATION_DENY;
}
// Need a valid submission in request.
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
if (!is_a($submission, 'Submission')) {
return AUTHORIZATION_DENY;
}
// Make sure the representation belongs to the submission.
$representationDao = Application::getRepresentationDAO();
$representation = $representationDao->getById($representationId, $submission->getId());
if (!is_a($representation, 'Representation')) {
return AUTHORIZATION_DENY;
}
// Save the representation to the authorization context.
$this->addAuthorizedContextObject(ASSOC_TYPE_REPRESENTATION, $representation);
return AUTHORIZATION_PERMIT;
}
示例9: handleElement
/**
* Handle a submission element
* @param $node DOMElement
* @return array Array of ArticleGalley objects
*/
function handleElement($node)
{
$deployment = $this->getDeployment();
$context = $deployment->getContext();
$submission = $deployment->getSubmission();
assert(is_a($submission, 'Submission'));
$submissionFileRefNodes = $node->getElementsByTagName('submission_file_ref');
assert($submissionFileRefNodes->length == 1);
$fileNode = $submissionFileRefNodes->item(0);
$fileId = $fileNode->getAttribute('id');
$revisionId = $fileNode->getAttribute('revision');
$dbFileId = $deployment->getFileDBId($fileId, $revisionId);
assert($dbFileId);
$representation = parent::handleElement($node);
for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
if (is_a($n, 'DOMElement')) {
switch ($n->tagName) {
case 'name':
// Labels are not localized in OJS ArticleGalleys, but we use the <name locale="....">...</name> structure.
$representation->setLabel($n->textContent);
$representation->setLocale($n->getAttribute('locale'));
break;
}
}
}
$representationDao = Application::getRepresentationDAO();
$representation->setFileId($dbFileId);
$representationDao->insertObject($representation);
// Update the submission file.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFile = $submissionFileDao->getRevision($dbFileId, $revisionId);
$submissionFile->setAssocType(ASSOC_TYPE_REPRESENTATION);
$submissionFile->setAssocId($representation->getId());
$submissionFileDao->updateObject($submissionFile);
// representation proof files
return $representation;
}
示例10: addRepresentations
/**
* Add the representations of a submission to its DOM element.
* @param $doc DOMDocument
* @param $submissionNode DOMElement
* @param $submission Submission
*/
function addRepresentations($doc, $submissionNode, $submission)
{
$filterDao = DAORegistry::getDAO('FilterDAO');
$nativeExportFilters = $filterDao->getObjectsByGroup($this->getRepresentationExportFilterGroupName());
assert(count($nativeExportFilters) == 1);
// Assert only a single serialization filter
$exportFilter = array_shift($nativeExportFilters);
$exportFilter->setDeployment($this->getDeployment());
$representationDao = Application::getRepresentationDAO();
$representations = $representationDao->getBySubmissionId($submission->getId());
while ($representation = $representations->next()) {
$representationDoc = $exportFilter->execute($representation);
$clone = $doc->importNode($representationDoc->documentElement, true);
$submissionNode->appendChild($clone);
}
}
示例11: _getDownloadStats
/**
* Get prepared download statistics from the DB
* @param $pubObjectId integer
* @return array
*/
function _getDownloadStats($pubObjectId)
{
$cache = CacheManager::getManager()->getCache('downloadStats', $pubObjectId, array($this, '_downloadStatsCacheMiss'));
if (time() - $cache->getCacheTime() > 60 * 60 * 24) {
// Cache is older than one day, erase it.
$cache->flush();
}
$statsReports = $cache->get($pubObjectId);
$currentYear = date("Y");
$months = range(1, 12);
$statsByFormat = $statsByMonth = $years = array();
$totalDownloads = 0;
foreach ($statsReports as $statsReport) {
$month = (int) substr($statsReport[STATISTICS_DIMENSION_MONTH], -2);
$year = (int) substr($statsReport[STATISTICS_DIMENSION_MONTH], 0, 4);
$metric = $statsReport[STATISTICS_METRIC];
// Keep track of the years, avoiding duplicates.
$years[$year] = null;
$representationId = $statsReport[STATISTICS_DIMENSION_REPRESENTATION_ID];
// Prepare the stats aggregating by Representation.
// Create entries for all months, so all representations will have the same entries count.
if (!array_key_exists($representationId, $statsByFormat)) {
$representationDao = Application::getRepresentationDAO();
$representation = $representationDao->getById($representationId);
if (empty($representation)) {
continue;
}
$statsByFormat[$representationId] = array('data' => array(), 'label' => $representation->getLocalizedName(), 'color' => $this->_getColor($representationId), 'total' => 0);
}
// Make sure we have entries for all years with stats.
if (!array_key_exists($year, $statsByFormat[$representationId]['data'])) {
$statsByFormat[$representationId]['data'][$year] = array_fill_keys($months, 0);
}
$statsByFormat[$representationId]['data'][$year][$month] = $metric;
$statsByFormat[$representationId]['total'] += $metric;
// Prepare the stats aggregating only by Month.
if (!array_key_exists($year, $statsByMonth)) {
$statsByMonth[$year] = array_fill_keys($months, 0);
}
$statsByMonth[$year][$month] += $metric;
$totalDownloads += $metric;
}
if ($statsByMonth) {
$datasetId = 'allDownloads';
// GraphJS works with datasets.
$statsByMonth = array($datasetId => array('data' => $statsByMonth, 'label' => __('common.allDownloads'), 'color' => $this->_getColor(REALLY_BIG_NUMBER), 'total' => $totalDownloads));
}
return array($statsByFormat, $statsByMonth, array_keys($years));
}
示例12: foreignKeyLookup
/**
* Foreign key lookup for the published object dimension.
* @param $assocType int
* @param $assocId int
* @return array Values must be foreign keys relative to the
* context, pkp section, associated object (type and id), submission
* and representation.
*/
protected function foreignKeyLookup($assocType, $assocId)
{
$contextId = $sectionId = $submissionId = $representationId = null;
$isFile = false;
$isRepresentation = false;
switch ($assocType) {
case ASSOC_TYPE_SUBMISSION_FILE:
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
/* @var $submissionFileDao SubmissionFileDAO */
$submissionFile = $submissionFileDao->getLatestRevision($assocId);
if ($submissionFile) {
$isFile = true;
$submissionId = $submissionFile->getSubmissionId();
if ($submissionFile->getAssocType() == ASSOC_TYPE_REPRESENTATION) {
$representationId = $submissionFile->getAssocId();
} else {
throw new Exception('Cannot load record: submission file is not associated with a representation object.');
}
} else {
throw new Exception('Cannot load record: invalid submission file id.');
}
// Don't break but go on to retrieve the representation.
// Don't break but go on to retrieve the representation.
case ASSOC_TYPE_REPRESENTATION:
if (!$isFile) {
$representationId = $assocId;
}
$representationDao = Application::getRepresentationDAO();
/* @var $representationDao RepresentationDAO */
$representation = $representationDao->getById($representationId);
/* @var $representation Representation */
if ($representation) {
if (!$isFile) {
$isRepresentation = true;
}
$contextId = $representation->getContextId();
$submissionId = $representation->getSubmissionId();
} else {
throw new Exception('Cannot load record: invalid representation id.');
}
// Don't break but go on to retrieve the submission.
// Don't break but go on to retrieve the submission.
case ASSOC_TYPE_SUBMISSION:
if (!$isFile && !$isRepresentation) {
$submissionId = $assocId;
}
$submissionDao = Application::getSubmissionDAO();
/* @var $submissionDao SubmissionDAO */
$submission = $submissionDao->getById($submissionId);
if ($submission) {
$contextId = $submission->getContextId();
$submissionId = $submission->getId();
$sectionId = $submission->getSectionId();
} else {
throw new Exception('Cannot load record: invalid submission id.');
}
break;
case ASSOC_TYPE_SECTION:
$sectionDao = Application::getSectionDAO();
$section = $sectionDao->getById($assocId);
/* @var $section PKPSection */
if ($section) {
$sectionId = $section->getId();
$contextId = $section->getContextId();
} else {
throw new Exception('Cannot load record: invalid section id.');
}
break;
case Application::getContextAssocType():
$contextDao = Application::getContextDAO();
/* @var $contextDao ContextDAO */
$context = $contextDao->getById($assocId);
if (!$context) {
throw new Exception('Cannot load record: invalid context id.');
}
$contextId = $assocId;
break;
}
return array($contextId, $sectionId, null, null, $submissionId, $representationId);
}
示例13: fetchTab
/**
* Fetch the specified authorDashboard tab.
* @param $args array
* @param $request Request
* @return JSONMessage JSON object
*/
function fetchTab($args, $request)
{
$this->setupTemplate($request);
$templateMgr = TemplateManager::getManager($request);
$stageId = $request->getUserVar('stageId');
$templateMgr->assign('stageId', $stageId);
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$templateMgr->assign('submission', $submission);
// Import submission file to define file stages.
import('lib.pkp.classes.submission.SubmissionFile');
// Workflow-stage specific "upload file" action.
$currentStage = $submission->getStageId();
$fileStage = $this->_fileStageFromWorkflowStage($currentStage);
$templateMgr->assign('lastReviewRoundNumber', $this->_getLastReviewRoundNumbers($submission));
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
$templateMgr->assign('externalReviewRounds', $reviewRoundDao->getBySubmissionId($submission->getId(), WORKFLOW_STAGE_ID_EXTERNAL_REVIEW));
// Get the last review round.
$lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $currentStage);
// Create and assign add file link action.
if ($fileStage && is_a($lastReviewRound, 'ReviewRound')) {
import('lib.pkp.controllers.api.file.linkAction.AddFileLinkAction');
$templateMgr->assign('uploadFileAction', new AddFileLinkAction($request, $submission->getId(), $currentStage, array(ROLE_ID_AUTHOR), null, $fileStage, null, null, $lastReviewRound->getId()));
}
// If the submission is in or past the editorial stage,
// assign the editor's copyediting emails to the template
$submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO');
$user = $request->getUser();
// Define the notification options.
$templateMgr->assign('authorDashboardNotificationRequestOptions', $this->_getNotificationRequestOptions($submission));
switch ($stageId) {
case WORKFLOW_STAGE_ID_SUBMISSION:
return $templateMgr->fetchJson('controllers/tab/authorDashboard/submission.tpl');
case WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
return $templateMgr->fetchJson('controllers/tab/authorDashboard/internalReview.tpl');
case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
return $templateMgr->fetchJson('controllers/tab/authorDashboard/externalReview.tpl');
case WORKFLOW_STAGE_ID_EDITING:
$templateMgr->assign('copyeditingEmails', $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_COPYEDIT_NOTIFY_AUTHOR, $user->getId()));
return $templateMgr->fetchJson('controllers/tab/authorDashboard/editorial.tpl');
case WORKFLOW_STAGE_ID_PRODUCTION:
$representationDao = Application::getRepresentationDAO();
$templateMgr->assign(array('productionEmails' => $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_PROOFREAD_NOTIFY_AUTHOR, $user->getId()), 'representations' => $representationDao->getBySubmissionId($submission->getId())->toArray()));
return $templateMgr->fetchJson('controllers/tab/authorDashboard/production.tpl');
}
}
示例14: handleElement
/**
* Handle a submission element
* @param $node DOMElement
* @return array Array of ArticleGalley objects
*/
function handleElement($node)
{
$deployment = $this->getDeployment();
$context = $deployment->getContext();
$submission = $deployment->getSubmission();
assert(is_a($submission, 'Submission'));
$representation = parent::handleElement($node);
if ($node->getAttribute('available') == 'true') {
$representation->setIsAvailable(true);
}
$galleyType = $node->getAttribute('galley_type');
$representation->setGalleyType($galleyType);
for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
if (is_a($n, 'DOMElement')) {
switch ($n->tagName) {
case 'remote_url':
$representation->setRemoteURL($n->textContent);
break;
case 'name':
// Labels are not localized in OJS ArticleGalleys, but we use the <name locale="....">...</name> structure.
$representation->setLabel($n->textContent);
$representation->setLocale($n->getAttribute('locale'));
break;
}
}
}
$representationDao = Application::getRepresentationDAO();
$representationDao->insertObject($representation);
// representation proof files
return $representation;
}
示例15: clearPubId
/**
* Clear pub id
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function clearPubId($args, $request)
{
if (!$request->checkCSRF()) {
return new JSONMessage(false);
}
$submission = $this->getSubmission();
$representationDao = Application::getRepresentationDAO();
$representation = $representationDao->getById($request->getUserVar('representationId'), $submission->getId());
import('lib.pkp.controllers.tab.pubIds.form.PKPPublicIdentifiersForm');
$form = new PKPPublicIdentifiersForm($representation);
$form->clearPubId($request->getUserVar('pubIdPlugIn'));
return new JSONMessage(true);
}