Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SearchByNameReviewerForm.inc.php
1 <?php
2 
16 import('lib.pkp.controllers.grid.users.reviewer.form.ReviewerForm');
17 
24  function SearchByNameReviewerForm($submission, $reviewRound) {
25  parent::ReviewerForm($submission, $reviewRound);
26  $this->setTemplate('controllers/grid/users/reviewer/form/searchByNameReviewerForm.tpl');
27 
28  $this->addCheck(new FormValidator($this, 'reviewerId', 'required', 'editor.review.mustSelect'));
29  }
30 
35  function readInputData() {
36  parent::readInputData();
37 
38  $this->readUserVars(array('reviewerId'));
39  }
40 
45  function fetch($request) {
46  // Pass along the request vars
47  $actionArgs = $request->getUserVars();
48  $reviewRound = $this->getReviewRound();
49  $actionArgs['reviewRoundId'] = $reviewRound->getId();
50  $actionArgs['selectionType'] = REVIEWER_SELECT_ADVANCED_SEARCH;
51  // but change the selectionType for each action
52  $advancedSearchAction = new LinkAction(
53  'advancedSearch',
54  new AjaxAction($request->url(null, null, 'reloadReviewerForm', null, $actionArgs)),
55  __('manager.reviewerSearch.advancedSearch.short'),
56  'user_search'
57  );
58 
59  $this->setReviewerFormAction($advancedSearchAction);
60 
61  // Only add actions to forms where user can operate.
62  if (array_intersect($this->getUserRoles(), array(ROLE_ID_MANAGER))) {
63  $actionArgs['selectionType'] = REVIEWER_SELECT_CREATE;
64  // but change the selectionType for each action
65  $advancedSearchAction = new LinkAction(
66  'selectCreate',
67  new AjaxAction($request->url(null, null, 'reloadReviewerForm', null, $actionArgs)),
68  __('editor.review.createReviewer'),
69  'add_user'
70  );
71 
72  $this->setReviewerFormAction($advancedSearchAction);
73  $actionArgs['selectionType'] = REVIEWER_SELECT_ENROLL_EXISTING;
74  // but change the selectionType for each action
75  $advancedSearchAction = new LinkAction(
76  'enrolExisting',
77  new AjaxAction($request->url(null, null, 'reloadReviewerForm', null, $actionArgs)),
78  __('editor.review.enrollReviewer.short'),
79  'enroll_user'
80  );
81 
82  $this->setReviewerFormAction($advancedSearchAction);
83  }
84 
85  return parent::fetch($request);
86  }
87 }
88 
89 ?>
addCheck($formValidator)
Definition: Form.inc.php:396
readUserVars($vars)
Definition: Form.inc.php:364
setReviewerFormAction($action)
SearchByNameReviewerForm($submission, $reviewRound)
Class defining an AJAX action.
Form for searching (by name) and adding a reviewer to a submission.
Base Form for adding a reviewer to a submission. N.B. Requires a subclass to implement the &quot;reviewerI...
setTemplate($template)
Definition: Form.inc.php:121
Class to represent a form validation check.
Base class defining an action that can be performed by the user in the user interface.