Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
<?php | <?php | ||||
final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO | final class PhabricatorSlowvotePoll | ||||
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_VISIBLE = 0; | ||||
const RESPONSES_VOTERS = 1; | const RESPONSES_VOTERS = 1; | ||||
const RESPONSES_OWNER = 2; | 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 = 0; | ||||
protected $shuffle = 0; | protected $shuffle = 0; | ||||
protected $method; | protected $method; | ||||
protected $mailKey; | |||||
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; | ||||
Show All 17 Lines | 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', | ||||
'shuffle' => 'bool', | 'shuffle' => 'bool', | ||||
'method' => 'uint32', | 'method' => 'uint32', | ||||
'description' => 'text', | 'description' => 'text', | ||||
'isClosed' => 'bool', | 'isClosed' => 'bool', | ||||
'mailKey' => 'bytes20', | |||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function generatePHID() { | public function getPHIDType() { | ||||
return PhabricatorPHID::generateNewPHID( | return PhabricatorSlowvotePollPHIDType::TYPECONST; | ||||
PhabricatorSlowvotePollPHIDType::TYPECONST); | |||||
} | } | ||||
public function getOptions() { | public function getOptions() { | ||||
return $this->assertAttached($this->options); | return $this->assertAttached($this->options); | ||||
} | } | ||||
public function attachOptions(array $options) { | public function attachOptions(array $options) { | ||||
assert_instances_of($options, 'PhabricatorSlowvoteOption'); | assert_instances_of($options, 'PhabricatorSlowvoteOption'); | ||||
Show All 27 Lines | final class PhabricatorSlowvotePoll | ||||
public function getMonogram() { | public function getMonogram() { | ||||
return 'V'.$this->getID(); | return 'V'.$this->getID(); | ||||
} | } | ||||
public function getURI() { | public function getURI() { | ||||
return '/'.$this->getMonogram(); | return '/'.$this->getMonogram(); | ||||
} | } | ||||
public function save() { | |||||
if (!$this->getMailKey()) { | |||||
$this->setMailKey(Filesystem::readRandomCharacters(20)); | |||||
} | |||||
return parent::save(); | |||||
} | |||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
return new PhabricatorSlowvoteEditor(); | return new PhabricatorSlowvoteEditor(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |