[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diviner/storage/ -> DivinerLiveBook.php (source)

   1  <?php
   2  
   3  final class DivinerLiveBook extends DivinerDAO
   4    implements PhabricatorPolicyInterface {
   5  
   6    protected $name;
   7    protected $viewPolicy;
   8    protected $configurationData = array();
   9  
  10    public function getConfiguration() {
  11      return array(
  12        self::CONFIG_AUX_PHID => true,
  13        self::CONFIG_SERIALIZATION => array(
  14          'configurationData' => self::SERIALIZATION_JSON,
  15        ),
  16        self::CONFIG_COLUMN_SCHEMA => array(
  17          'name' => 'text64',
  18        ),
  19        self::CONFIG_KEY_SCHEMA => array(
  20          'key_phid' => null,
  21          'phid' => array(
  22            'columns' => array('phid'),
  23            'unique' => true,
  24          ),
  25          'name' => array(
  26            'columns' => array('name'),
  27            'unique' => true,
  28          ),
  29        ),
  30      ) + parent::getConfiguration();
  31    }
  32  
  33    public function getConfig($key, $default = null) {
  34      return idx($this->configurationData, $key, $default);
  35    }
  36  
  37    public function setConfig($key, $value) {
  38      $this->configurationData[$key] = $value;
  39      return $this;
  40    }
  41  
  42    public function generatePHID() {
  43      return PhabricatorPHID::generateNewPHID(
  44        DivinerBookPHIDType::TYPECONST);
  45    }
  46  
  47    public function getTitle() {
  48      return $this->getConfig('title', $this->getName());
  49    }
  50  
  51    public function getShortTitle() {
  52      return $this->getConfig('short', $this->getTitle());
  53    }
  54  
  55    public function getPreface() {
  56      return $this->getConfig('preface');
  57    }
  58  
  59    public function getGroupName($group) {
  60      $groups = $this->getConfig('groups');
  61      $spec = idx($groups, $group, array());
  62      return idx($spec, 'name', $group);
  63    }
  64  
  65  /* -(  PhabricatorPolicyInterface  )----------------------------------------- */
  66  
  67    public function getCapabilities() {
  68      return array(
  69        PhabricatorPolicyCapability::CAN_VIEW,
  70      );
  71    }
  72  
  73    public function getPolicy($capability) {
  74      return PhabricatorPolicies::getMostOpenPolicy();
  75    }
  76  
  77    public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
  78      return false;
  79    }
  80  
  81    public function describeAutomaticCapability($capability) {
  82      return null;
  83    }
  84  
  85  }


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