当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorCustomField类代码示例

本文整理汇总了PHP中PhabricatorCustomField的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorCustomField类的具体用法?PHP PhabricatorCustomField怎么用?PHP PhabricatorCustomField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PhabricatorCustomField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(PhabricatorCustomField $field)
 {
     $key = $field->getFieldKey();
     $name = $field->getFieldName();
     $class = get_class($field);
     parent::__construct("Custom field '{$name}' (with key '{$key}', of class '{$class}') can " . "not have a proxy set with setProxy(), because it returned false from " . "canSetProxy().");
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PhabricatorCustomFieldNotProxyException.php

示例2: __construct

 public function __construct(PhabricatorCustomField $field)
 {
     $key = $field->getFieldKey();
     $name = $field->getFieldName();
     $class = get_class($field);
     parent::__construct("Custom field '{$name}' (with key '{$key}', of class '{$class}') is " . "attempting to access data which is not available in this context.");
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PhabricatorCustomFieldDataNotAvailableException.php

示例3: setCustomField

 public function setCustomField(PhabricatorCustomField $field)
 {
     $this->customField = $field;
     $this->setKey('custom:' . $field->getFieldIndex());
     $aliases = array();
     $aliases[] = $field->getFieldKey();
     $this->setAliases($aliases);
     return $this;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:PhabricatorSearchCustomFieldProxyField.php

示例4: __construct

 public function __construct(PhabricatorCustomField $field, $field_key_is_incomplete = false)
 {
     if ($field_key_is_incomplete) {
         $key = pht('<incomplete key>');
         $name = pht('<incomplete name>');
     } else {
         $key = $field->getFieldKey();
         $name = $field->getFieldName();
     }
     parent::__construct(pht("Custom field '%s' (with key '%s', of class '%s') is incompletely " . "implemented: it claims to support a feature, but does not " . "implement all of the required methods for that feature.", $name, $key, get_class($field)));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:11,代码来源:PhabricatorCustomFieldImplementationIncompleteException.php

示例5: addField

 public function addField(PhabricatorCustomField $field)
 {
     $role_storage = PhabricatorCustomField::ROLE_STORAGE;
     if (!$field->shouldEnableForRole($role_storage)) {
         return $this;
     }
     $storage = $field->newStorageObject();
     $source_key = $storage->getStorageSourceKey();
     $this->fieldMap[$source_key][] = $field;
     if (empty($this->storageSources[$source_key])) {
         $this->storageSources[$source_key] = $storage;
     }
     return $this;
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:14,代码来源:PhabricatorCustomFieldStorageQuery.php

示例6: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $id = $request->getURIData('id');
     $step = id(new HarbormasterBuildStepQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$step) {
         return new Aphront404Response();
     }
     $plan = $step->getBuildPlan();
     $plan_id = $plan->getID();
     $plan_uri = $this->getApplicationURI("plan/{$plan_id}/");
     $field_list = PhabricatorCustomField::getObjectFields($step, PhabricatorCustomField::ROLE_VIEW);
     $field_list->setViewer($viewer)->readFieldsFromStorage($step);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Plan %d', $plan_id), $plan_uri);
     $crumbs->addTextCrumb(pht('Step %d', $id));
     $crumbs->setBorder(true);
     $header = id(new PHUIHeaderView())->setHeader(pht('Build Step %d: %s', $id, $step->getName()))->setHeaderIcon('fa-chevron-circle-right');
     $properties = $this->buildPropertyList($step, $field_list);
     $curtain = $this->buildCurtainView($step);
     $timeline = $this->buildTransactionTimeline($step, new HarbormasterBuildStepTransactionQuery());
     $timeline->setShouldTerminate(true);
     $view = id(new PHUITwoColumnView())->setHeader($header)->setCurtain($curtain)->setMainColumn(array($properties, $timeline));
     return $this->newPage()->setTitle(pht('Step %d', $id))->setCrumbs($crumbs)->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:25,代码来源:HarbormasterStepViewController.php

示例7: buildSetFieldTransaction

function buildSetFieldTransaction($object, $field_key, $field_value, $template, $viewer)
{
    $role = PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS;
    $fields = PhabricatorCustomField::getObjectFields($object, $role)->setViewer($viewer)->readFieldsFromStorage($object)->getFields();
    $field = idx($fields, $field_key);
    $transaction_type = $field->getApplicationTransactionType();
    $xaction = id(clone $template)->setTransactionType($transaction_type);
    if ($transaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) {
        // For TYPE_CUSTOMFIELD transactions only, we provide the old value
        // as an input.
        $old_value = $field->getOldValueForApplicationTransactions();
        $xaction->setOldValue($old_value);
    }
    $field->getProxy()->setFieldValue($field_value);
    $new_value = $field->getNewValueForApplicationTransactions();
    $xaction->setNewValue($new_value);
    if ($transaction_type == PhabricatorTransactions::TYPE_CUSTOMFIELD) {
        // For TYPE_CUSTOMFIELD transactions, add the field key in metadata.
        $xaction->setMetadataValue('customfield:key', $field->getFieldKey());
    }
    $metadata = $field->getApplicationTransactionMetadata();
    foreach ($metadata as $key => $value) {
        $xaction->setMetadataValue($key, $value);
    }
    return $xaction;
}
开发者ID:uhd-urz,项目名称:phabricator-enforce-ruleset,代码行数:26,代码来源:phabricator-enforce-ruleset.inc.php

示例8: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $corpus = $request->getValue('corpus');
     $is_partial = $request->getValue('partial');
     $revision = new DifferentialRevision();
     $field_list = PhabricatorCustomField::getObjectFields($revision, DifferentialCustomField::ROLE_COMMITMESSAGE);
     $field_list->setViewer($viewer);
     $field_map = mpull($field_list->getFields(), null, 'getFieldKeyForConduit');
     $this->errors = array();
     $label_map = $this->buildLabelMap($field_list);
     $corpus_map = $this->parseCommitMessage($corpus, $label_map);
     $values = array();
     foreach ($corpus_map as $field_key => $text_value) {
         $field = idx($field_map, $field_key);
         if (!$field) {
             throw new Exception(pht('Parser emitted text value for field key "%s", but no such ' . 'field exists.', $field_key));
         }
         try {
             $values[$field_key] = $field->parseValueFromCommitMessage($text_value);
         } catch (DifferentialFieldParseException $ex) {
             $this->errors[] = pht('Error parsing field "%s": %s', $field->renderCommitMessageLabel(), $ex->getMessage());
         }
     }
     if (!$is_partial) {
         foreach ($field_map as $key => $field) {
             try {
                 $field->validateCommitMessageValue(idx($values, $key));
             } catch (DifferentialFieldValidationException $ex) {
                 $this->errors[] = pht('Invalid or missing field "%s": %s', $field->renderCommitMessageLabel(), $ex->getMessage());
             }
         }
     }
     return array('errors' => $this->errors, 'fields' => $values);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:DifferentialParseCommitMessageConduitAPIMethod.php

示例9: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $blueprint = id(new DrydockBlueprintQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$blueprint) {
         return new Aphront404Response();
     }
     $title = $blueprint->getBlueprintName();
     $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($blueprint);
     if ($blueprint->getIsDisabled()) {
         $header->setStatus('fa-ban', 'red', pht('Disabled'));
     } else {
         $header->setStatus('fa-check', 'bluegrey', pht('Active'));
     }
     $actions = $this->buildActionListView($blueprint);
     $properties = $this->buildPropertyListView($blueprint, $actions);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Blueprint %d', $blueprint->getID()));
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $field_list = PhabricatorCustomField::getObjectFields($blueprint, PhabricatorCustomField::ROLE_VIEW);
     $field_list->setViewer($viewer)->readFieldsFromStorage($blueprint);
     $field_list->appendFieldsToPropertyList($blueprint, $viewer, $properties);
     $resource_box = $this->buildResourceBox($blueprint);
     $authorizations_box = $this->buildAuthorizationsBox($blueprint);
     $timeline = $this->buildTransactionTimeline($blueprint, new DrydockBlueprintTransactionQuery());
     $timeline->setShouldTerminate(true);
     $log_query = id(new DrydockLogQuery())->withBlueprintPHIDs(array($blueprint->getPHID()));
     $log_box = $this->buildLogBox($log_query, $this->getApplicationURI("blueprint/{$id}/logs/query/all/"));
     return $this->buildApplicationPage(array($crumbs, $object_box, $resource_box, $authorizations_box, $log_box, $timeline), array('title' => $title));
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:31,代码来源:DrydockBlueprintViewController.php

示例10: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     // Load all projects with "Sprint" in the name.
     $projects = id(new PhabricatorProjectQuery())->setViewer($viewer)->withDatasourceQuery('sprint')->execute();
     $rows = array();
     foreach ($projects as $project) {
         // We need the custom fields so we can pull out the start and end date
         // TODO: query in a loop is bad
         $field_list = PhabricatorCustomField::getObjectFields($project, PhabricatorCustomField::ROLE_EDIT);
         $field_list->setViewer($viewer);
         $field_list->readFieldsFromStorage($project);
         $aux_fields = $field_list->getFields();
         $start = idx($aux_fields, 'isdc:sprint:startdate')->getProxy()->getFieldValue();
         $end = idx($aux_fields, 'isdc:sprint:enddate')->getProxy()->getFieldValue();
         $rows[] = array('project' => phutil_tag('a', array('href' => '/burndown/view/' . $project->getId(), 'style' => 'font-weight:bold'), $project->getName()), 'start' => phabricator_datetime($start, $viewer), 'end' => phabricator_datetime($end, $viewer));
     }
     $projects_table = id(new AphrontTableView($rows))->setHeaders(array('Project/Sprint name', 'Start Date', 'End Date'))->setColumnClasses(array('wide', 'date', 'date'));
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Burndown List'));
     $help = id(new PHUIBoxView())->appendChild(phutil_tag('p', array(), "To have a project show up in this list, make sure it's name includes" . "\"sprint\" and then edit it to set the start and end date."))->addMargin(PHUI::MARGIN_LARGE);
     $box = id(new PHUIBoxView())->appendChild($projects_table)->addMargin(PHUI::MARGIN_LARGE);
     return $this->buildApplicationPage(array($crumbs, $help, $box), array('title' => array(pht('Burndown List')), 'device' => true));
 }
开发者ID:yangming85,项目名称:phabricator-sprint,代码行数:25,代码来源:BurndownListController.php

示例11: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $id = $request->getURIData('id');
     $step = id(new HarbormasterBuildStepQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$step) {
         return new Aphront404Response();
     }
     $plan = $step->getBuildPlan();
     $plan_id = $plan->getID();
     $plan_uri = $this->getApplicationURI("plan/{$plan_id}/");
     $field_list = PhabricatorCustomField::getObjectFields($step, PhabricatorCustomField::ROLE_VIEW);
     $field_list->setViewer($viewer)->readFieldsFromStorage($step);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Plan %d', $plan_id), $plan_uri);
     $crumbs->addTextCrumb(pht('Step %d', $id));
     $box = id(new PHUIObjectBoxView())->setHeaderText(pht('Build Step %d: %s', $id, $step->getName()));
     $properties = $this->buildPropertyList($step, $field_list);
     $actions = $this->buildActionList($step);
     $properties->setActionList($actions);
     $box->addPropertyList($properties);
     $timeline = $this->buildTransactionTimeline($step, new HarbormasterBuildStepTransactionQuery());
     $timeline->setShouldTerminate(true);
     return $this->buildApplicationPage(array($crumbs, $box, $timeline), array('title' => pht('Step %d', $id)));
 }
开发者ID:Houzz,项目名称:phabricator,代码行数:25,代码来源:HarbormasterStepViewController.php

示例12: getCustomFieldList

 public function getCustomFieldList()
 {
     $field_list = PhabricatorCustomField::getObjectFields($this->project, PhabricatorCustomField::ROLE_EDIT);
     $field_list->setViewer($this->viewer);
     $field_list->readFieldsFromStorage($this->project);
     return $field_list;
 }
开发者ID:kanarip,项目名称:phabricator-extensions-Sprint,代码行数:7,代码来源:SprintQuery.php

示例13: getObjectFields

 /**
  * @task apps
  */
 public static function getObjectFields(PhabricatorCustomFieldInterface $object, $role)
 {
     try {
         $attachment = $object->getCustomFields();
     } catch (PhabricatorDataNotAttachedException $ex) {
         $attachment = new PhabricatorCustomFieldAttachment();
         $object->attachCustomFields($attachment);
     }
     try {
         $field_list = $attachment->getCustomFieldList($role);
     } catch (PhabricatorCustomFieldNotAttachedException $ex) {
         $base_class = $object->getCustomFieldBaseClass();
         $spec = $object->getCustomFieldSpecificationForRole($role);
         if (!is_array($spec)) {
             $obj_class = get_class($object);
             throw new Exception("Expected an array from getCustomFieldSpecificationForRole() for " . "object of class '{$obj_class}'.");
         }
         $fields = PhabricatorCustomField::buildFieldList($base_class, $spec, $object);
         foreach ($fields as $key => $field) {
             if (!$field->shouldEnableForRole($role)) {
                 unset($fields[$key]);
             }
         }
         foreach ($fields as $field) {
             $field->setObject($object);
         }
         $field_list = new PhabricatorCustomFieldList($fields);
         $attachment->addCustomFieldList($role, $field_list);
     }
     return $field_list;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:34,代码来源:PhabricatorCustomField.php

示例14: renderResultsList

 public function renderResultsList(array $requests, PhabricatorSavedQuery $query)
 {
     assert_instances_of($requests, 'ReleephRequest');
     $viewer = $this->getRequest()->getUser();
     // TODO: This is generally a bit sketchy, but we don't do this kind of
     // thing elsewhere at the moment. For the moment it shouldn't be hugely
     // costly, and we can batch things later. Generally, this commits fewer
     // sins than the old code did.
     $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer);
     $list = array();
     foreach ($requests as $pull) {
         $field_list = PhabricatorCustomField::getObjectFields($pull, PhabricatorCustomField::ROLE_VIEW);
         $field_list->setViewer($viewer)->readFieldsFromStorage($pull);
         foreach ($field_list->getFields() as $field) {
             if ($field->shouldMarkup()) {
                 $field->setMarkupEngine($engine);
             }
         }
         $list[] = id(new ReleephRequestView())->setUser($viewer)->setCustomFields($field_list)->setPullRequest($pull)->setIsListView(true);
     }
     // This is quite sketchy, but the list has not actually rendered yet, so
     // this still allows us to batch the markup rendering.
     $engine->process();
     return $list;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:ReleephBranchViewController.php

示例15: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withIDs(array($this->id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     $profile_uri = '/p/' . $user->getUsername() . '/';
     $field_list = PhabricatorCustomField::getObjectFields($user, PhabricatorCustomField::ROLE_EDIT);
     $field_list->setViewer($viewer)->readFieldsFromStorage($user);
     $validation_exception = null;
     if ($request->isFormPost()) {
         $xactions = $field_list->buildFieldTransactionsFromRequest(new PhabricatorUserTransaction(), $request);
         $editor = id(new PhabricatorUserProfileEditor())->setActor($viewer)->setContentSource(PhabricatorContentSource::newFromRequest($request))->setContinueOnNoEffect(true);
         try {
             $editor->applyTransactions($user, $xactions);
             return id(new AphrontRedirectResponse())->setURI($profile_uri);
         } catch (PhabricatorApplicationTransactionValidationException $ex) {
             $validation_exception = $ex;
         }
     }
     $title = pht('Edit Profile');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($user->getUsername(), $profile_uri);
     $crumbs->addTextCrumb($title);
     $form = id(new AphrontFormView())->setUser($viewer);
     $field_list->appendFieldsToForm($form);
     $form->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($profile_uri)->setValue(pht('Save Profile')));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Edit Profile'))->setValidationException($validation_exception)->setForm($form);
     return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $title));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:32,代码来源:PhabricatorPeopleProfileEditController.php


注:本文中的PhabricatorCustomField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。