Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
<?php | <?php | ||||
final class PhabricatorSlowvotePoll | final class PhabricatorSlowvotePoll | ||||
extends PhabricatorSlowvoteDAO | extends PhabricatorSlowvoteDAO | ||||
implements | implements | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
PhabricatorFlaggableInterface, | PhabricatorFlaggableInterface, | ||||
PhabricatorTokenReceiverInterface, | PhabricatorTokenReceiverInterface, | ||||
PhabricatorProjectInterface, | PhabricatorProjectInterface, | ||||
PhabricatorDestructibleInterface, | PhabricatorDestructibleInterface, | ||||
PhabricatorSpacesInterface, | PhabricatorSpacesInterface, | ||||
PhabricatorConduitResultInterface { | PhabricatorConduitResultInterface { | ||||
const RESPONSES_VISIBLE = 0; | |||||
const RESPONSES_VOTERS = 1; | |||||
const RESPONSES_OWNER = 2; | |||||
const METHOD_PLURALITY = 0; | const METHOD_PLURALITY = 0; | ||||
const METHOD_APPROVAL = 1; | const METHOD_APPROVAL = 1; | ||||
protected $question; | protected $question; | ||||
protected $description; | protected $description; | ||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $responseVisibility = 0; | protected $responseVisibility; | ||||
protected $shuffle = 0; | protected $shuffle = 0; | ||||
protected $method; | protected $method; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $isClosed = 0; | protected $isClosed = 0; | ||||
protected $spacePHID; | protected $spacePHID; | ||||
private $options = self::ATTACHABLE; | private $options = self::ATTACHABLE; | ||||
private $choices = self::ATTACHABLE; | private $choices = self::ATTACHABLE; | ||||
private $viewerChoices = self::ATTACHABLE; | private $viewerChoices = self::ATTACHABLE; | ||||
public static function initializeNewPoll(PhabricatorUser $actor) { | public static function initializeNewPoll(PhabricatorUser $actor) { | ||||
$app = id(new PhabricatorApplicationQuery()) | $app = id(new PhabricatorApplicationQuery()) | ||||
->setViewer($actor) | ->setViewer($actor) | ||||
->withClasses(array('PhabricatorSlowvoteApplication')) | ->withClasses(array('PhabricatorSlowvoteApplication')) | ||||
->executeOne(); | ->executeOne(); | ||||
$view_policy = $app->getPolicy( | $view_policy = $app->getPolicy( | ||||
PhabricatorSlowvoteDefaultViewCapability::CAPABILITY); | PhabricatorSlowvoteDefaultViewCapability::CAPABILITY); | ||||
$default_responses = SlowvotePollResponseVisibility::RESPONSES_VISIBLE; | |||||
return id(new PhabricatorSlowvotePoll()) | return id(new PhabricatorSlowvotePoll()) | ||||
->setAuthorPHID($actor->getPHID()) | ->setAuthorPHID($actor->getPHID()) | ||||
->setViewPolicy($view_policy) | ->setViewPolicy($view_policy) | ||||
->setSpacePHID($actor->getDefaultSpacePHID()); | ->setSpacePHID($actor->getDefaultSpacePHID()) | ||||
->setResponseVisibility($default_responses); | |||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'question' => 'text255', | 'question' => 'text255', | ||||
'responseVisibility' => 'uint32', | 'responseVisibility' => 'uint32', | ||||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |