Example #1
0
 /**
  * Delete a section editor association with this section.
  * @see ListbuilderHandler::deleteEntry
  * @param $request PKPRequest
  * @param $rowId int
  * @return boolean Success
  */
 function deleteSubEditorEntry($request, $rowId)
 {
     $subEditorsDao = Application::getSubEditorsDAO();
     $context = $request->getContext();
     $subEditorsDao->deleteEditor($context->getId(), $this->getSectionId(), $rowId);
     return true;
 }
 /**
  * Check if a sub-editor user is assigned to a section/series.
  * @param $contextId
  * @param $sectionId
  * @param $userId
  * @return boolean
  */
 function effect($contextId, $sectionId, $userId)
 {
     $subEditorsDao = Application::getSubEditorsDAO();
     if ($subEditorsDao->editorExists($contextId, $sectionId, $userId)) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * Get possible items to populate pulldown with
  * @return array Listbuilder-formatted array of pulldown options
  */
 function getOptions()
 {
     $context = $this->getContext();
     $subEditorsDao = Application::getSubEditorsDAO();
     if ($this->getSectionId()) {
         $unassignedSubEditors = $subEditorsDao->getEditorsNotInSection($context->getId(), $this->getSectionId());
     } else {
         $roleDao = DAORegistry::getDAO('RoleDAO');
         $editors = $roleDao->getUsersByRoleId(ROLE_ID_SUB_EDITOR, $context->getId());
         $unassignedSubEditors = $editors->toArray();
     }
     $itemList = array(0 => array());
     foreach ($unassignedSubEditors as $subEditor) {
         $itemList[0][$subEditor->getId()] = $subEditor->getFullName();
     }
     return $itemList;
 }
 /**
  * Get the list of users for the specified user group
  * @param $args array
  * @param $request Request
  * @return JSON string
  */
 function fetchUserList($args, $request)
 {
     $submission = $this->getSubmission();
     $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
     $userGroupId = (int) $request->getUserVar('userGroupId');
     $userStageAssignmentDao = DAORegistry::getDAO('UserStageAssignmentDAO');
     /* @var $userStageAssignmentDao UserStageAssignmentDAO */
     $users = $userStageAssignmentDao->getUsersNotAssignedToStageInUserGroup($submission->getId(), $stageId, $userGroupId);
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $userGroup = $userGroupDao->getById($userGroupId);
     $roleId = $userGroup->getRoleId();
     $subEditorFilterId = $this->_getIdForSubEditorFilter($submission);
     $contextId = $submission->getContextId();
     $filterSubEditors = false;
     if ($roleId == ROLE_ID_SUB_EDITOR && $subEditorFilterId) {
         $subEditorsDao = Application::getSubEditorsDAO();
         // Flag to filter sub editors only.
         $filterSubEditors = true;
     }
     $userList = array();
     while ($user = $users->next()) {
         if ($filterSubEditors && !$subEditorsDao->editorExists($contextId, $subEditorFilterId, $user->getId())) {
             continue;
         }
         $userList[$user->getId()] = $user->getFullName();
     }
     if (count($userList) == 0) {
         $userList[0] = __('common.noMatches');
     }
     $json = new JSONMessage(true, $userList);
     return $json->getString();
 }