[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/project/storage/ -> PhabricatorProjectColumnPosition.php (source)

   1  <?php
   2  
   3  final class PhabricatorProjectColumnPosition extends PhabricatorProjectDAO
   4    implements PhabricatorPolicyInterface {
   5  
   6    protected $boardPHID;
   7    protected $columnPHID;
   8    protected $objectPHID;
   9    protected $sequence;
  10  
  11    private $column = self::ATTACHABLE;
  12  
  13    public function getConfiguration() {
  14      return array(
  15        self::CONFIG_TIMESTAMPS => false,
  16        self::CONFIG_COLUMN_SCHEMA => array(
  17          'sequence' => 'uint32',
  18        ),
  19        self::CONFIG_KEY_SCHEMA => array(
  20          'boardPHID' => array(
  21            'columns' => array('boardPHID', 'columnPHID', 'objectPHID'),
  22            'unique' => true,
  23          ),
  24          'objectPHID' => array(
  25            'columns' => array('objectPHID', 'boardPHID'),
  26          ),
  27          'boardPHID_2' => array(
  28            'columns' => array('boardPHID', 'columnPHID', 'sequence'),
  29          ),
  30        ),
  31      ) + parent::getConfiguration();
  32    }
  33  
  34    public function getColumn() {
  35      return $this->assertAttached($this->column);
  36    }
  37  
  38    public function attachColumn(PhabricatorProjectColumn $column) {
  39      $this->column = $column;
  40      return $this;
  41    }
  42  
  43    public function getOrderingKey() {
  44      // Low sequence numbers go above high sequence numbers.
  45      // High position IDs go above low position IDs.
  46      // Broadly, this makes newly added stuff float to the top.
  47  
  48      return sprintf(
  49        '~%012d%012d',
  50        $this->getSequence(),
  51        ((1 << 31) - $this->getID()));
  52    }
  53  
  54  /* -(  PhabricatorPolicyInterface  )----------------------------------------- */
  55  
  56    public function getCapabilities() {
  57      return array(
  58        PhabricatorPolicyCapability::CAN_VIEW,
  59      );
  60    }
  61  
  62    public function getPolicy($capability) {
  63      switch ($capability) {
  64        case PhabricatorPolicyCapability::CAN_VIEW:
  65          return PhabricatorPolicies::getMostOpenPolicy();
  66      }
  67    }
  68  
  69    public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
  70      return false;
  71    }
  72  
  73    public function describeAutomaticCapability($capability) {
  74      return null;
  75    }
  76  
  77  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1