3 final class PhabricatorProjectColumnPosition
extends PhabricatorProjectDAO
4 implements PhabricatorPolicyInterface
{
11 private $column = self
::ATTACHABLE
;
12 private $viewSequence = 0;
14 protected function getConfiguration() {
16 self
::CONFIG_TIMESTAMPS
=> false,
17 self
::CONFIG_COLUMN_SCHEMA
=> array(
18 'sequence' => 'uint32',
20 self
::CONFIG_KEY_SCHEMA
=> array(
22 'columns' => array('boardPHID', 'columnPHID', 'objectPHID'),
25 'objectPHID' => array(
26 'columns' => array('objectPHID', 'boardPHID'),
28 'boardPHID_2' => array(
29 'columns' => array('boardPHID', 'columnPHID', 'sequence'),
32 ) + parent
::getConfiguration();
35 public function getColumn() {
36 return $this->assertAttached($this->column
);
39 public function attachColumn(PhabricatorProjectColumn
$column) {
40 $this->column
= $column;
44 public function setViewSequence($view_sequence) {
45 $this->viewSequence
= $view_sequence;
49 public function newColumnPositionOrderVector() {
50 // We're ordering both real positions and "virtual" positions which we have
51 // created but not saved yet.
53 // Low sequence numbers go above high sequence numbers. Virtual positions
54 // will have sequence number 0.
56 // High virtual sequence numbers go above low virtual sequence numbers.
57 // The layout engine gets objects in ID order, and this puts them in
60 // High IDs go above low IDs.
62 // Broadly, this collectively makes newly added stuff float to the top.
64 return id(new PhutilSortVector())
65 ->addInt($this->getSequence())
66 ->addInt(-1 * $this->viewSequence
)
67 ->addInt(-1 * $this->getID());
70 /* -( PhabricatorPolicyInterface )----------------------------------------- */
72 public function getCapabilities() {
74 PhabricatorPolicyCapability
::CAN_VIEW
,
78 public function getPolicy($capability) {
79 switch ($capability) {
80 case PhabricatorPolicyCapability
::CAN_VIEW
:
81 return PhabricatorPolicies
::getMostOpenPolicy();
85 public function hasAutomaticCapability($capability, PhabricatorUser
$viewer) {