Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
EnrollExistingReviewerForm.inc.php
1 <?php
2 
16 import('lib.pkp.controllers.grid.users.reviewer.form.ReviewerForm');
17 
22  function EnrollExistingReviewerForm($submission, $reviewRound) {
23  parent::ReviewerForm($submission, $reviewRound);
24  $this->setTemplate('controllers/grid/users/reviewer/form/enrollExistingReviewerForm.tpl');
25 
26  $this->addCheck(new FormValidator($this, 'userGroupId', 'required', 'user.profile.form.usergroupRequired'));
27  $this->addCheck(new FormValidator($this, 'userId', 'required', 'manager.people.existingUserRequired'));
28  }
29 
34  function fetch($request) {
35  $searchByNameAction = $this->getSearchByNameAction($request);
36 
37  $this->setReviewerFormAction($searchByNameAction);
38  return parent::fetch($request);
39  }
40 
45  function readInputData() {
46  parent::readInputData();
47 
48  $this->readUserVars(array('userId', 'userGroupId'));
49  }
50 
56  function execute($args, $request) {
57  // Assign a reviewer user group to an existing non-reviewer
58  $userId = (int) $this->getData('userId');
59 
60  $userGroupId = (int) $this->getData('userGroupId');
61  $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /* @var $userGroupDao UserGroupDAO */
62  $userGroupDao->assignUserToGroup($userId, $userGroupId);
63 
64  // Set the reviewerId in the Form for the parent class to use
65  $this->setData('reviewerId', $userId);
66 
67  return parent::execute($args, $request);
68  }
69 }
70 
71 ?>
static & getDAO($name, $dbconn=null)
addCheck($formValidator)
Definition: Form.inc.php:396
setData($key, $value)
Definition: Form.inc.php:219
readUserVars($vars)
Definition: Form.inc.php:364
setReviewerFormAction($action)
getData($key)
Definition: Form.inc.php:210
Form for enrolling an existing reviewer and adding them 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
EnrollExistingReviewerForm($submission, $reviewRound)
Class to represent a form validation check.
getSearchByNameAction($request)