コード例 #1
0
 /**
  * List signoff notes.
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function listNotes($args, $request)
 {
     $this->setupTemplate($request);
     $templateMgr = TemplateManager::getManager($request);
     $noteDao = DAORegistry::getDAO('NoteDAO');
     $notesFactory = $noteDao->getByAssoc(ASSOC_TYPE_SIGNOFF, $this->_signoff->getId());
     $notes = $notesFactory->toAssociativeArray();
     // Get any note files.
     $noteFilesDownloadLink = array();
     $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
     /** @var $submissionFileDao SubmissionFileDAO */
     import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
     foreach ($notes as $noteId => $note) {
         $file = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_NOTE, $noteId, $this->_submission->getId(), SUBMISSION_FILE_NOTE);
         // We don't expect more than one file per note
         $file = current($file);
         // Get the download file link action.
         if ($file) {
             $noteFilesDownloadLink[$noteId] = new DownloadFileLinkAction($request, $file, $this->_stageId);
         }
     }
     $user = $request->getUser();
     import('lib.pkp.classes.core.ArrayItemIterator');
     $templateMgr->assign('notes', new ArrayItemIterator($notes));
     $templateMgr->assign('noteFilesDownloadLink', $noteFilesDownloadLink);
     $templateMgr->assign('notesListId', 'notesList');
     $templateMgr->assign('currentUserId', $user->getId());
     $templateMgr->assign('notesDeletable', false);
     $json = new JSONMessage(true, $templateMgr->fetch('controllers/informationCenter/notesList.tpl'));
     $json->setEvent('dataChanged');
     return $json->getString();
 }
コード例 #2
0
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column)
 {
     switch ($column->getId()) {
         case 'contents':
             $element = $row->getData();
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             import('lib.pkp.classes.submission.SubmissionFile');
             $submissionFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_NOTE, $element->getId(), $this->_submission->getId(), SUBMISSION_FILE_QUERY);
             import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
             $actions = array();
             foreach ($submissionFiles as $submissionFile) {
                 $actions[] = new DownloadFileLinkAction($request, $submissionFile, $request->getUserVar('stageId'));
             }
             return $actions;
     }
     return parent::getCellActions($request, $row, $column);
 }
コード例 #3
0
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column)
 {
     switch ($column->getId()) {
         case 'label':
             $element = $row->getData();
             if ($element->getRemoteUrl() != '' || !$element->getFileId()) {
                 break;
             }
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             import('lib.pkp.classes.submission.SubmissionFile');
             $submissionFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_REPRESENTATION, $element->getId(), $this->_submission->getId(), SUBMISSION_FILE_PROOF);
             import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
             $actions = array();
             foreach ($submissionFiles as $submissionFile) {
                 $actions[] = new DownloadFileLinkAction($request, $submissionFile, $request->getUserVar('stageId'), $element->getLabel());
             }
             return $actions;
     }
     return parent::getCellActions($request, $row, $column);
 }
コード例 #4
0
ファイル: Marking.php プロジェクト: sawh/ostepu-system
 /**
  * converts an object to insert/update data
  *
  * @return a comma separated string e.g. "a=1,b=2"
  */
 public function getInsertData($doubleEscaped = false)
 {
     $values = '';
     if ($this->id !== null) {
         $this->addInsertData($values, 'M_id', DBJson::mysql_real_escape_string($this->id));
     }
     if ($this->tutorId !== null) {
         $this->addInsertData($values, 'U_id_tutor', DBJson::mysql_real_escape_string($this->tutorId));
     }
     if ($this->file != null && $this->file->getFileId() !== null) {
         $this->addInsertData($values, 'F_id_file', DBJson::mysql_real_escape_string($this->file->getFileId()));
     }
     if ($this->submission !== null && $this->submission->getId() !== null) {
         $this->addInsertData($values, 'S_id', DBJson::mysql_real_escape_string($this->submission->getId()));
     }
     if ($this->tutorComment !== null) {
         $this->addInsertData($values, 'M_tutorComment', DBJson::mysql_real_escape_string($this->tutorComment));
     }
     if ($this->outstanding !== null) {
         $this->addInsertData($values, 'M_outstanding', DBJson::mysql_real_escape_string($this->outstanding));
     }
     if ($this->status !== null) {
         $this->addInsertData($values, 'M_status', DBJson::mysql_real_escape_string($this->status));
     }
     if ($this->points !== null) {
         $this->addInsertData($values, 'M_points', DBJson::mysql_real_escape_string($this->points));
     }
     if ($this->date !== null) {
         $this->addInsertData($values, 'M_date', DBJson::mysql_real_escape_string($this->date));
     }
     if ($this->hideFile !== null) {
         $this->addInsertData($values, 'M_hideFile', DBJson::mysql_real_escape_string($this->hideFile));
     }
     if ($values != '') {
         $values = substr($values, 1);
     }
     return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values;
 }
コード例 #5
0
 /**
  * Get an array representing link parameters that subclasses
  * need to have passed to their various handlers (i.e. submission ID
  * to the delete note handler).
  * @return array
  */
 function _getLinkParams()
 {
     return array('submissionId' => $this->_submission->getId());
 }
コード例 #6
0
 /**
  * Check for roles that give access to the passed workflow stage.
  * @param int $userId
  * @param int $contextId
  * @param Submission $submission
  * @param int $stageId
  * @return array
  */
 function _getAccessibleStageRoles($userId, $contextId, &$submission, $stageId)
 {
     $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
     /* @var $stageAssignmentDao StageAssignmentDAO */
     $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
     $accessibleStageRoles = array();
     foreach ($userRoles as $roleId) {
         switch ($roleId) {
             case ROLE_ID_MANAGER:
                 // Context managers have access to all submission stages.
                 $accessibleStageRoles[] = $roleId;
                 break;
             case ROLE_ID_ASSISTANT:
             case ROLE_ID_SUB_EDITOR:
             case ROLE_ID_AUTHOR:
                 // The requested workflow stage has been assigned to them
                 // in the requested submission.
                 $stageAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), $roleId, $stageId, $userId);
                 if (!$stageAssignments->wasEmpty()) {
                     $accessibleStageRoles[] = $roleId;
                 }
                 if ($roleId == ROLE_ID_SUB_EDITOR) {
                     // The requested submission must be part of their section/series...
                     // and the requested workflow stage must be assigned to
                     // them in the context settings.
                     import('lib.pkp.classes.security.authorization.internal.SectionAssignmentRule');
                     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
                     if (SectionAssignmentRule::effect($contextId, $submission->getSectionId(), $userId) && $userGroupDao->userAssignmentExists($contextId, $userId, $stageId)) {
                         $accessibleStageRoles[] = $roleId;
                     }
                 }
                 break;
             default:
                 break;
         }
     }
     return $accessibleStageRoles;
 }
コード例 #7
0
 /**
  * Check for roles that give access to the passed workflow stage.
  * @param int $userId
  * @param int $contextId
  * @param Submission $submission
  * @param int $stageId
  * @return array
  */
 function _getAccessibleStageRoles($userId, $contextId, &$submission, $stageId)
 {
     $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
     /* @var $stageAssignmentDao StageAssignmentDAO */
     $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
     $accessibleStageRoles = array();
     foreach ($userRoles as $roleId) {
         switch ($roleId) {
             case ROLE_ID_MANAGER:
                 // Context managers have access to all submission stages.
                 $accessibleStageRoles[] = $roleId;
                 break;
             case ROLE_ID_ASSISTANT:
             case ROLE_ID_SUB_EDITOR:
             case ROLE_ID_AUTHOR:
                 // The requested workflow stage has been assigned to them
                 // in the requested submission.
                 $stageAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), $roleId, $stageId, $userId);
                 if (!$stageAssignments->wasEmpty()) {
                     $accessibleStageRoles[] = $roleId;
                 }
                 break;
             default:
                 break;
         }
     }
     return $accessibleStageRoles;
 }
コード例 #8
0
 /**
  * Clear potential tasks that may have been assigned to certain
  * users on certain stages.  Right now, just LAYOUT uploads on the production stage.
  * @param Submission $submission
  * @param int $task
  * @param PKRequest $request
  */
 private function _removeUploadTaskNotification($submission, $task, $request)
 {
     // if this is a submission by a LAYOUT_EDITOR for a submission in production, check
     // to see if there is a task notification for that and if so, clear it.
     $currentStageId = $this->getStageId();
     $notificationMgr = new NotificationManager();
     if ($currentStageId == WORKFLOW_STAGE_ID_PRODUCTION) {
         $user = $request->getUser();
         $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
         $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
         $stageAssignments = $stageAssignmentDao->getBySubmissionAndStageId($submission->getId(), $this->getStageId(), null, $user->getId());
         while ($stageAssignment = $stageAssignments->next()) {
             $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId());
             if (in_array($userGroup->getRoleId(), array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT))) {
                 $notificationDao = DAORegistry::getDAO('NotificationDAO');
                 $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), $user->getId(), $task);
                 return;
             }
         }
     }
 }
コード例 #9
0
 /**
  * Get request arguments.
  * @param $row GridRow
  * @return array
  */
 function getRequestArgs($row)
 {
     return array('submissionId' => $this->_submission->getId(), 'stageId' => $this->_stageId, 'queryId' => $row->getId());
 }
コード例 #10
0
 /**
  * Get request arguments.
  * @param $row GridRow
  * @return array
  */
 function getRequestArgs($row)
 {
     return array('submissionId' => $this->_submission->getId());
 }