本文整理汇总了PHP中Application::getContextAssocType方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getContextAssocType方法的具体用法?PHP Application::getContextAssocType怎么用?PHP Application::getContextAssocType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::getContextAssocType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* @see Form::fetch()
*/
function fetch($request)
{
$templateMgr = TemplateManager::getManager($request);
$reviewAssignment = $this->getReviewAssignment();
$reviewRoundId = $reviewAssignment->getReviewRoundId();
// Assign the objects and data to the template.
$context = $this->request->getContext();
$templateMgr->assign('reviewAssignment', $reviewAssignment);
$templateMgr->assign('reviewRoundId', $reviewRoundId);
// Include the review recommendation options on the form.
$templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
if ($reviewAssignment->getReviewFormId()) {
// Get the review form components
$reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormElements = $reviewFormElementDao->getByReviewFormId($reviewAssignment->getReviewFormId());
$reviewFormResponseDao = DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewFormResponses = $reviewFormResponseDao->getReviewReviewFormResponseValues($reviewAssignment->getId());
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
$reviewformid = $reviewAssignment->getReviewFormId();
$reviewForm = $reviewFormDao->getById($reviewAssignment->getReviewFormId(), Application::getContextAssocType(), $context->getId());
$templateMgr->assign('reviewForm', $reviewForm);
$templateMgr->assign('reviewFormElements', $reviewFormElements);
$templateMgr->assign('reviewFormResponses', $reviewFormResponses);
$templateMgr->assign('disabled', isset($reviewAssignment) && $reviewAssignment->getDateCompleted() != null);
}
//
// Assign the link actions
//
if ($context->getLocalizedSetting('reviewGuidelines')) {
import('lib.pkp.controllers.confirmationModal.linkAction.ViewReviewGuidelinesLinkAction');
$viewReviewGuidelinesAction = new ViewReviewGuidelinesLinkAction($request, $reviewAssignment->getStageId());
$templateMgr->assign('viewGuidelinesAction', $viewReviewGuidelinesAction);
}
return parent::fetch($request);
}
示例2: getExpectedPageAndOp
/**
* @see PKPUsageStatsLoader::getExpectedPageAndOp()
*/
protected function getExpectedPageAndOp()
{
$pageAndOp = parent::getExpectedPageAndOp();
$pageAndOp = $pageAndOp + array(ASSOC_TYPE_SUBMISSION_FILE => array('catalog/download'), ASSOC_TYPE_MONOGRAPH => array('catalog/book'), ASSOC_TYPE_SERIES => array('catalog/series'));
$pageAndOp[Application::getContextAssocType()][] = 'catalog/index';
return $pageAndOp;
}
示例3: getExpectedPageAndOp
/**
* @see PKPUsageStatsLoader::getExpectedPageAndOp()
*/
protected function getExpectedPageAndOp()
{
$pageAndOp = parent::getExpectedPageAndOp();
$pageAndOp = $pageAndOp + array(ASSOC_TYPE_SUBMISSION_FILE => array('article/download'), ASSOC_TYPE_ARTICLE => array('article/view'), ASSOC_TYPE_ISSUE => array('issue/view'), ASSOC_TYPE_ISSUE_GALLEY => array('issue/download'));
$pageAndOp[Application::getContextAssocType()][] = 'index';
return $pageAndOp;
}
示例4: fetch
/**
* @copydoc Form::fetch()
*/
function fetch($request)
{
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($this->_submissionId);
// All stages can choose the default template
$templateKeys = array('NOTIFICATION_CENTER_DEFAULT');
// Determine if the current user can use any custom templates defined.
$user = $request->getUser();
$roleDao = DAORegistry::getDAO('RoleDAO');
$userRoles = $roleDao->getByUserId($user->getId(), $submission->getContextId());
foreach ($userRoles as $userRole) {
if (in_array($userRole->getId(), array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT))) {
$emailTemplateDao = DAORegistry::getDAO('EmailTemplateDAO');
$customTemplates = $emailTemplateDao->getCustomTemplateKeys(Application::getContextAssocType(), $submission->getContextId());
$templateKeys = array_merge($templateKeys, $customTemplates);
break;
}
}
$stageTemplates = $this->_getStageTemplates();
$currentStageId = $this->getStageId();
if (array_key_exists($currentStageId, $stageTemplates)) {
$templateKeys = array_merge($templateKeys, $stageTemplates[$currentStageId]);
}
foreach ($templateKeys as $templateKey) {
$template = $this->_getMailTemplate($submission, $templateKey);
$template->assignParams(array());
$template->replaceParams();
$templates[$templateKey] = $template->getSubject();
}
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign(array('templates' => $templates, 'stageId' => $currentStageId, 'includeNotifyUsersListbuilder' => $this->includeNotifyUsersListbuilder(), 'submissionId' => $this->_submissionId, 'itemId' => $this->_itemId, 'userId' => (int) $request->getUserVar('userId')));
return parent::fetch($request);
}
示例5: view
/**
* View announcement details.
* @param $args array first parameter is the ID of the announcement to display
* @param $request PKPRequest
*/
function view($args, $request)
{
$this->validate();
$this->setupTemplate($request);
$context = $request->getContext();
$announcementId = (int) array_shift($args);
$announcementDao = DAORegistry::getDAO('AnnouncementDAO');
$announcement = $announcementDao->getById($announcementId);
if ($announcement && $announcement->getAssocType() == Application::getContextAssocType() && $announcement->getAssocId() == $context->getId() && ($announcement->getDateExpire() == null || strtotime($announcement->getDateExpire()) > time())) {
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('announcement', $announcement);
$templateMgr->assign('announcementTitle', $announcement->getLocalizedTitleFull());
return $templateMgr->display('announcements/view.tpl');
}
$request->redirect(null, 'announcement');
}
示例6: initData
/**
* Initialize form data from current settings.
* @param $reviewForm ReviewForm optional
*/
function initData($request)
{
if ($this->reviewFormId) {
// Get review form
$context = $request->getContext();
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
$reviewForm = $reviewFormDao->getById($this->reviewFormId, Application::getContextAssocType(), $context->getId());
// Get review form elements
$reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormElements = $reviewFormElementDao->getByReviewFormId($this->reviewFormId);
$count = count($reviewFormElements);
// Set data
$this->setData('title', $reviewForm->getLocalizedTitle(null));
$this->setData('description', $reviewForm->getLocalizedDescription(null));
$this->setData('reviewFormElements', $reviewFormElements);
}
}
示例7: fetch
/**
* @copydoc Form::fetch()
*/
function fetch($request)
{
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('submissionId', $this->_submissionId);
$templateMgr->assign('itemId', $this->_itemId);
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($this->_submissionId);
// All stages can choose the default template
$templateKeys = array('NOTIFICATION_CENTER_DEFAULT');
// Determine if the current user can use any custom templates defined.
$user = $request->getUser();
$roleDao = DAORegistry::getDAO('RoleDAO');
$userRoles = $roleDao->getByUserId($user->getId(), $submission->getContextId());
foreach ($userRoles as $userRole) {
if (in_array($userRole->getId(), array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT))) {
$emailTemplateDao = DAORegistry::getDAO('EmailTemplateDAO');
$customTemplates = $emailTemplateDao->getCustomTemplateKeys(Application::getContextAssocType(), $submission->getContextId());
$templateKeys = array_merge($templateKeys, $customTemplates);
break;
}
}
// template keys indexed by stageId
$stageTemplates = $this->_getStageTemplates();
$currentStageId = $this->getStageId();
if (array_key_exists($currentStageId, $stageTemplates)) {
$templateKeys = array_merge($templateKeys, $stageTemplates[$currentStageId]);
}
foreach ($templateKeys as $templateKey) {
$template = $this->_getMailTemplate($submission, $templateKey);
$template->assignParams(array());
$templates[$templateKey] = $template->getSubject();
}
$templateMgr->assign('templates', $templates);
$templateMgr->assign('stageId', $currentStageId);
$templateMgr->assign('includeNotifyUsersListbuilder', $this->includeNotifyUsersListbuilder());
// check to see if we were handed a userId from the stage participants grid. If so,
// pass that in so the list builder can pre-populate. The Listbuilder validates this.
$templateMgr->assign('userId', (int) $request->getUserVar('userId'));
return parent::fetch($request);
}
示例8: fetch
/**
* @see Form::fetch()
*/
function fetch($request)
{
$templateMgr = TemplateManager::getManager($request);
$reviewAssignment = $this->getReviewAssignment();
// Assign the objects and data to the template.
$context = $this->request->getContext();
$templateMgr->assign(array('reviewAssignment' => $reviewAssignment, 'reviewRoundId' => $reviewAssignment->getReviewRoundId(), 'reviewerRecommendationOptions' => ReviewAssignment::getReviewerRecommendationOptions()));
if ($reviewAssignment->getReviewFormId()) {
// Get the review form components
$reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormResponseDao = DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
$templateMgr->assign(array('reviewForm' => $reviewFormDao->getById($reviewAssignment->getReviewFormId(), Application::getContextAssocType(), $context->getId()), 'reviewFormElements' => $reviewFormElementDao->getByReviewFormId($reviewAssignment->getReviewFormId()), 'reviewFormResponses' => $reviewFormResponseDao->getReviewReviewFormResponseValues($reviewAssignment->getId()), 'disabled' => isset($reviewAssignment) && $reviewAssignment->getDateCompleted() != null));
}
//
// Assign the link actions
//
import('lib.pkp.controllers.confirmationModal.linkAction.ViewReviewGuidelinesLinkAction');
$viewReviewGuidelinesAction = new ViewReviewGuidelinesLinkAction($request, $reviewAssignment->getStageId());
if ($viewReviewGuidelinesAction->getGuidelines()) {
$templateMgr->assign('viewGuidelinesAction', $viewReviewGuidelinesAction);
}
return parent::fetch($request);
}
示例9: execute
/**
* Save review assignment
* @param $args array
* @param $request PKPRequest
*/
function execute($args, $request)
{
$submission = $this->getSubmission();
$context = $request->getContext();
$currentReviewRound = $this->getReviewRound();
$stageId = $currentReviewRound->getStageId();
$reviewDueDate = $this->getData('reviewDueDate');
$responseDueDate = $this->getData('responseDueDate');
// Get reviewer id and validate it.
$reviewerId = (int) $this->getData('reviewerId');
if (!$this->_isValidReviewer($context, $submission, $currentReviewRound, $reviewerId)) {
fatalError('Invalid reviewer id.');
}
$reviewMethod = (int) $this->getData('reviewMethod');
import('lib.pkp.classes.submission.action.EditorAction');
$editorAction = new EditorAction();
$editorAction->addReviewer($request, $submission, $reviewerId, $currentReviewRound, $reviewDueDate, $responseDueDate, $reviewMethod);
// Get the reviewAssignment object now that it has been added.
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
/* @var $reviewAssignmentDao ReviewAssignmentDAO */
$reviewAssignment = $reviewAssignmentDao->getReviewAssignment($currentReviewRound->getId(), $reviewerId, $currentReviewRound->getRound(), $stageId);
$reviewAssignment->setDateNotified(Core::getCurrentDate());
$reviewAssignment->setCancelled(0);
$reviewAssignment->stampModified();
// Ensure that the review form ID is valid, if specified
$reviewFormId = (int) $this->getData('reviewFormId');
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
$reviewForm = $reviewFormDao->getById($reviewFormId, Application::getContextAssocType(), $context->getId());
$reviewAssignment->setReviewFormId($reviewForm ? $reviewFormId : null);
$reviewAssignmentDao->updateObject($reviewAssignment);
// Grant access for this review to all selected files.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
import('lib.pkp.classes.submission.SubmissionFile');
// File constants
$submissionFiles = $submissionFileDao->getLatestRevisionsByReviewRound($currentReviewRound, SUBMISSION_FILE_REVIEW_FILE);
$selectedFiles = (array) $this->getData('selectedFiles');
$reviewFilesDao = DAORegistry::getDAO('ReviewFilesDAO');
foreach ($submissionFiles as $submissionFile) {
if (in_array($submissionFile->getFileId(), $selectedFiles)) {
$reviewFilesDao->grant($reviewAssignment->getId(), $submissionFile->getFileId());
}
}
// Notify the reviewer via email.
import('lib.pkp.classes.mail.SubmissionMailTemplate');
$templateKey = $this->getData('template');
$mail = new SubmissionMailTemplate($submission, $templateKey, null, null, null, false);
if ($mail->isEnabled() && !$this->getData('skipEmail')) {
$userDao = DAORegistry::getDAO('UserDAO');
/* @var $userDao UserDAO */
$reviewer = $userDao->getById($reviewerId);
$user = $request->getUser();
$mail->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$mail->setBody($this->getData('personalMessage'));
$dispatcher = $request->getDispatcher();
// Set the additional arguments for the one click url
$reviewUrlArgs = array('submissionId' => $this->getSubmissionId());
if ($context->getSetting('reviewerAccessKeysEnabled')) {
import('lib.pkp.classes.security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
$expiryDays = $context->getSetting('numWeeksPerReview') + 4 * 7;
$accessKey = $accessKeyManager->createKey($context->getId(), $reviewerId, $reviewAssignment->getId(), $expiryDays);
$reviewUrlArgs = array_merge($reviewUrlArgs, array('reviewId' => $reviewAssignment->getId(), 'key' => $accessKey));
}
// Assign the remaining parameters
$mail->assignParams(array('reviewerName' => $reviewer->getFullName(), 'responseDueDate' => $responseDueDate, 'reviewDueDate' => $reviewDueDate, 'reviewerUserName' => $reviewer->getUsername(), 'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, $reviewUrlArgs)));
$mail->send($request);
}
return $reviewAssignment;
}
示例10: readReview
/**
* Open a modal to read the reviewer's review and
* download any files they may have uploaded
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function readReview($args, $request)
{
$templateMgr = TemplateManager::getManager($request);
$reviewAssignment = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT);
$templateMgr->assign(array('submission' => $this->getSubmission(), 'reviewAssignment' => $reviewAssignment, 'reviewerRecommendationOptions' => ReviewAssignment::getReviewerRecommendationOptions()));
if ($reviewAssignment->getReviewFormId()) {
// Retrieve review form
$context = $request->getContext();
$reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormElements = $reviewFormElementDao->getByReviewFormId($reviewAssignment->getReviewFormId());
$reviewFormResponseDao = DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewFormResponses = $reviewFormResponseDao->getReviewReviewFormResponseValues($reviewAssignment->getId());
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
$reviewformid = $reviewAssignment->getReviewFormId();
$reviewForm = $reviewFormDao->getById($reviewAssignment->getReviewFormId(), Application::getContextAssocType(), $context->getId());
$templateMgr->assign(array('reviewForm' => $reviewForm, 'reviewFormElements' => $reviewFormElements, 'reviewFormResponses' => $reviewFormResponses, 'disabled' => true));
} else {
// Retrieve reviewer comments.
$submissionCommentDao = DAORegistry::getDAO('SubmissionCommentDAO');
$templateMgr->assign(array('comments' => $submissionCommentDao->getReviewerCommentsByReviewerId($reviewAssignment->getSubmissionId(), null, $reviewAssignment->getId(), true), 'commentsPrivate' => $submissionCommentDao->getReviewerCommentsByReviewerId($reviewAssignment->getSubmissionId(), null, $reviewAssignment->getId(), false)));
}
// Render the response.
return $templateMgr->fetchJson('controllers/grid/users/reviewer/readReview.tpl');
}
示例11: deleteReviewFormElement
/**
* Delete a review form element.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function deleteReviewFormElement($args, $request)
{
$reviewFormElementId = (int) $request->getUserVar('rowId');
$context = $request->getContext();
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
if ($reviewFormDao->unusedReviewFormExists($this->reviewFormId, Application::getContextAssocType(), $context->getId())) {
$reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO');
$reviewFormElementDao->deleteById($reviewFormElementId);
return DAO::getDataChangedEvent($reviewFormElementId);
}
return new JSONMessage(false);
}
开发者ID:relaciones-internacionales-journal,项目名称:pkp-lib,代码行数:18,代码来源:ReviewFormElementsGridHandler.inc.php
示例12: execute
/**
* Save announcement.
* @param $request PKPRequest
*/
function execute($request)
{
$announcementDao = DAORegistry::getDAO('AnnouncementDAO');
$announcement = $announcementDao->getById($this->announcementId);
if (!$announcement) {
$announcement = $announcementDao->newDataObject();
}
$announcement->setAssocType(Application::getContextAssocType());
$announcement->setAssocId($this->getContextId());
$announcement->setTitle($this->getData('title'), null);
// Localized
$announcement->setDescriptionShort($this->getData('descriptionShort'), null);
// Localized
$announcement->setDescription($this->getData('description'), null);
// Localized
if ($this->getData('typeId')) {
$announcement->setTypeId($this->getData('typeId'));
} else {
$announcement->setTypeId(null);
}
// Give the parent class a chance to set the dateExpire.
$dateExpireSetted = $this->setDateExpire($announcement);
if (!$dateExpireSetted) {
if ($this->getData('dateExpireYear') != null) {
$announcement->setDateExpire($this->getData('dateExpire'));
} else {
$announcement->setDateExpire(null);
}
}
// Update or insert announcement
if ($announcement->getId()) {
$announcementDao->updateObject($announcement);
} else {
$announcement->setDatetimePosted(Core::getCurrentDate());
$announcementDao->insertObject($announcement);
}
$contextId = $this->getContextId();
// Send a notification to associated users
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$notificationUsers = array();
$allUsers = $userGroupDao->getUsersByContextId($contextId);
while ($user = $allUsers->next()) {
$notificationUsers[] = array('id' => $user->getId());
}
if (!$this->announcementId) {
// Only for new announcements
foreach ($notificationUsers as $userRole) {
$notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_NEW_ANNOUNCEMENT, $contextId, ASSOC_TYPE_ANNOUNCEMENT, $announcement->getId());
}
$notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_NEW_ANNOUNCEMENT, $contextId, ASSOC_TYPE_ANNOUNCEMENT, $announcement->getId()));
}
return $announcement->getId();
}
示例13: execute
/**
* Save review form.
* @param $request PKPRequest
*/
function execute($request)
{
$context = $request->getContext();
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
if ($this->reviewFormId) {
$reviewForm = $reviewFormDao->getById($this->reviewFormId, Application::getContextAssocType(), $context->getId());
} else {
$reviewForm = $reviewFormDao->newDataObject();
$reviewForm->setAssocType(Application::getContextAssocType());
$reviewForm->setAssocId($context->getId());
$reviewForm->setActive(0);
$reviewForm->setSequence(REALLY_BIG_NUMBER);
}
$reviewForm->setTitle($this->getData('title'), null);
// Localized
$reviewForm->setDescription($this->getData('description'), null);
// Localized
if ($this->reviewFormId) {
$reviewFormDao->updateObject($reviewForm);
$this->reviewFormId = $reviewForm->getId();
} else {
$this->reviewFormId = $reviewFormDao->insertObject($reviewForm);
$reviewFormDao->resequenceReviewForms(Application::getContextAssocType(), $context->getId());
}
}
示例14: getExpectedPageAndOp
/**
* Get the expected page and operation from the stats plugin.
* They are grouped by the object type constant that
* they give access to.
* @return array
*/
protected function getExpectedPageAndOp()
{
return array(Application::getContextAssocType() => array('index/index'));
}
示例15: deleteReviewForm
/**
* Delete a review form.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function deleteReviewForm($args, $request)
{
// Identify the current review form
$reviewFormId = (int) $request->getUserVar('rowId');
// Identify the context id.
$context = $request->getContext();
// Get review form object
$reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
$reviewForm = $reviewFormDao->getById($reviewFormId, Application::getContextAssocType(), $context->getId());
$completeCounts = $reviewFormDao->getUseCounts(Application::getContextAssocType(), $context->getId(), true);
$incompleteCounts = $reviewFormDao->getUseCounts(Application::getContextAssocType(), $context->getId(), false);
if (isset($reviewForm) && $completeCounts[$reviewFormId] == 0 && $incompleteCounts[$reviewFormId] == 0) {
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignments = $reviewAssignmentDao->getByReviewFormId($reviewFormId);
foreach ($reviewAssignments as $reviewAssignment) {
$reviewAssignment->setReviewFormId(null);
$reviewAssignmentDao->updateObject($reviewAssignment);
}
$reviewFormDao->deleteById($reviewFormId, $context->getId());
// Create the notification.
$notificationMgr = new NotificationManager();
$user = $request->getUser();
$notificationMgr->createTrivialNotification($user->getId());
return DAO::getDataChangedEvent($reviewFormId);
}
return new JSONMessage(false);
}