private function buildActionList(AlmanacBinding $binding) { $viewer = $this->getViewer(); $id = $binding->getID(); $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $binding, PhabricatorPolicyCapability::CAN_EDIT); $actions = id(new PhabricatorActionListView())->setUser($viewer); $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Binding'))->setHref($this->getApplicationURI("binding/edit/{$id}/"))->setWorkflow(!$can_edit)->setDisabled(!$can_edit)); return $actions; }
private function buildActionList(AlmanacBinding $binding) { $viewer = $this->getViewer(); $id = $binding->getID(); $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $binding, PhabricatorPolicyCapability::CAN_EDIT); $actions = id(new PhabricatorActionListView())->setUser($viewer); $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Binding'))->setHref($this->getApplicationURI("binding/edit/{$id}/"))->setWorkflow(!$can_edit)->setDisabled(!$can_edit)); if ($binding->getIsDisabled()) { $disable_icon = 'fa-check'; $disable_text = pht('Enable Binding'); } else { $disable_icon = 'fa-ban'; $disable_text = pht('Disable Binding'); } $disable_href = $this->getApplicationURI("binding/disable/{$id}/"); $actions->addAction(id(new PhabricatorActionView())->setIcon($disable_icon)->setName($disable_text)->setHref($disable_href)->setWorkflow(true)->setDisabled(!$can_edit)); return $actions; }
protected function getBindingDictionary(AlmanacBinding $binding) { return array('id' => (int) $binding->getID(), 'phid' => $binding->getPHID(), 'properties' => $this->getPropertiesDictionary($binding), 'interface' => $this->getInterfaceDictionary($binding->getInterface())); }
protected function getAlmanacBindingDictionary(AlmanacBinding $binding) { $interface = $binding->getInterface(); return array('id' => (int) $binding->getID(), 'phid' => $binding->getPHID(), 'properties' => $this->getAlmanacPropertyList($binding), 'interface' => $this->getAlmanacInterfaceDictionary($interface), 'disabled' => (bool) $binding->getIsDisabled()); }