Differential D21843 Diff 52062 src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$v_responses = $poll->getResponseVisibility(); | $v_responses = $poll->getResponseVisibility(); | ||||
$v_shuffle = $poll->getShuffle(); | $v_shuffle = $poll->getShuffle(); | ||||
$v_space = $poll->getSpacePHID(); | $v_space = $poll->getSpacePHID(); | ||||
$responses = $request->getArr('response'); | $responses = $request->getArr('response'); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$v_question = $request->getStr('question'); | $v_question = $request->getStr('question'); | ||||
$v_description = $request->getStr('description'); | $v_description = $request->getStr('description'); | ||||
$v_responses = (int)$request->getInt('responses'); | $v_responses = $request->getStr('responses'); | ||||
$v_shuffle = (int)$request->getBool('shuffle'); | $v_shuffle = (int)$request->getBool('shuffle'); | ||||
$v_view_policy = $request->getStr('viewPolicy'); | $v_view_policy = $request->getStr('viewPolicy'); | ||||
$v_projects = $request->getArr('projects'); | $v_projects = $request->getArr('projects'); | ||||
$v_space = $request->getStr('spacePHID'); | $v_space = $request->getStr('spacePHID'); | ||||
if ($is_new) { | if ($is_new) { | ||||
$poll->setMethod($request->getInt('method')); | $poll->setMethod($request->getInt('method')); | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$poll_type_options = array( | $poll_type_options = array( | ||||
PhabricatorSlowvotePoll::METHOD_PLURALITY => | PhabricatorSlowvotePoll::METHOD_PLURALITY => | ||||
pht('Plurality (Single Choice)'), | pht('Plurality (Single Choice)'), | ||||
PhabricatorSlowvotePoll::METHOD_APPROVAL => | PhabricatorSlowvotePoll::METHOD_APPROVAL => | ||||
pht('Approval (Multiple Choice)'), | pht('Approval (Multiple Choice)'), | ||||
); | ); | ||||
$response_type_options = array( | $response_type_map = SlowvotePollResponseVisibility::getAll(); | ||||
PhabricatorSlowvotePoll::RESPONSES_VISIBLE | $response_type_options = mpull($response_type_map, 'getNameForEdit'); | ||||
=> pht('Allow anyone to see the responses'), | |||||
PhabricatorSlowvotePoll::RESPONSES_VOTERS | |||||
=> pht('Require a vote to see the responses'), | |||||
PhabricatorSlowvotePoll::RESPONSES_OWNER | |||||
=> pht('Only I can see the responses'), | |||||
); | |||||
if ($is_new) { | if ($is_new) { | ||||
$form->appendChild( | $form->appendChild( | ||||
id(new AphrontFormSelectControl()) | id(new AphrontFormSelectControl()) | ||||
->setLabel(pht('Vote Type')) | ->setLabel(pht('Vote Type')) | ||||
->setName('method') | ->setName('method') | ||||
->setValue($poll->getMethod()) | ->setValue($poll->getMethod()) | ||||
->setOptions($poll_type_options)); | ->setOptions($poll_type_options)); | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |