本文整理汇总了PHP中AphrontFormView::appendControl方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontFormView::appendControl方法的具体用法?PHP AphrontFormView::appendControl怎么用?PHP AphrontFormView::appendControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontFormView
的用法示例。
在下文中一共展示了AphrontFormView::appendControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$document_phids = $saved_query->getParameter('documentPHIDs', array());
$signer_phids = $saved_query->getParameter('signerPHIDs', array());
if (!$this->document) {
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new LegalpadDocumentDatasource())->setName('documents')->setLabel(pht('Documents'))->setValue($document_phids));
}
$name_contains = $saved_query->getParameter('nameContains', '');
$email_contains = $saved_query->getParameter('emailContains', '');
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('signers')->setLabel(pht('Signers'))->setValue($signer_phids))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Name Contains'))->setName('nameContains')->setValue($name_contains))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Email Contains'))->setName('emailContains')->setValue($email_contains));
}
示例2: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$author_phids = $saved_query->getParameter('authorPHIDs', array());
$answerer_phids = $saved_query->getParameter('answererPHIDs', array());
$status = $saved_query->getParameter('status', PonderQuestionStatus::STATUS_OPEN);
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_phids))->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('answerers')->setLabel(pht('Answered By'))->setValue($answerer_phids))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Status'))->setName('status')->setValue($status)->setOptions(PonderQuestionStatus::getQuestionStatusMap()));
}
示例3: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$author_phids = $saved_query->getParameter('authorPHIDs', array());
$voted = $saved_query->getParameter('voted', false);
$statuses = $saved_query->getParameter('statuses', array());
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_phids))->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('voted', 1, pht("Show only polls I've voted in."), $voted))->appendChild(id(new AphrontFormCheckboxControl())->setLabel(pht('Status'))->addCheckbox('statuses[]', 'open', pht('Open'), in_array('open', $statuses))->addCheckbox('statuses[]', 'closed', pht('Closed'), in_array('closed', $statuses)));
}
示例4: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$user_phids = $saved_query->getParameter('userPHIDs', array());
$proj_phids = $saved_query->getParameter('projectPHIDs', array());
$viewer_projects = $saved_query->getParameter('viewerProjects');
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('users')->setLabel(pht('Include Users'))->setValue($user_phids))->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorProjectDatasource())->setName('projectPHIDs')->setLabel(pht('Include Projects'))->setValue($proj_phids))->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('viewerProjects', 1, pht('Include stories about projects I am a member of.'), $viewer_projects));
}
示例5: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$author_phids = $saved_query->getParameter('authorPHIDs', array());
$content_type = $saved_query->getParameter('contentType');
$rule_type = $saved_query->getParameter('ruleType');
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_phids))->appendChild(id(new AphrontFormSelectControl())->setName('contentType')->setLabel(pht('Content Type'))->setValue($content_type)->setOptions($this->getContentTypeOptions()))->appendChild(id(new AphrontFormSelectControl())->setName('ruleType')->setLabel(pht('Rule Type'))->setValue($rule_type)->setOptions($this->getRuleTypeOptions()))->appendChild(id(new AphrontFormSelectControl())->setName('disabled')->setLabel(pht('Rule Status'))->setValue($this->getBoolFromQuery($saved_query, 'disabled'))->setOptions(array('' => pht('Show Enabled and Disabled Rules'), 'false' => pht('Show Only Enabled Rules'), 'true' => pht('Show Only Disabled Rules'))));
}
示例6: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$user_phids = $saved_query->getParameter('userPHIDs', array());
$ended = $saved_query->getParameter('ended', PhrequentUserTimeQuery::ENDED_ALL);
$order = $saved_query->getParameter('order', PhrequentUserTimeQuery::ORDER_ENDED_DESC);
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('users')->setLabel(pht('Users'))->setValue($user_phids))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Ended'))->setName('ended')->setValue($ended)->setOptions(PhrequentUserTimeQuery::getEndedSearchOptions()))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Order'))->setName('order')->setValue($order)->setOptions(PhrequentUserTimeQuery::getOrderSearchOptions()));
}
示例7: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
{
$auditor_phids = $saved->getParameter('auditorPHIDs', array());
$commit_author_phids = $saved->getParameter('commitAuthorPHIDs', array());
$audit_status = $saved->getParameter('auditStatus', null);
$repository_phids = $saved->getParameter('repositoryPHIDs', array());
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new DiffusionAuditorDatasource())->setName('auditorPHIDs')->setLabel(pht('Auditors'))->setValue($auditor_phids))->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Commit Authors'))->setValue($commit_author_phids))->appendChild(id(new AphrontFormSelectControl())->setName('auditStatus')->setLabel(pht('Audit Status'))->setOptions($this->getAuditStatusOptions())->setValue($audit_status))->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Repositories'))->setName('repositoryPHIDs')->setDatasource(new DiffusionRepositoryDatasource())->setValue($repository_phids));
}
示例8: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
{
$form->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Name Contains'))->setName('name')->setValue($saved->getParameter('name')));
$all_types = array();
foreach (DivinerAtom::getAllTypes() as $type) {
$all_types[$type] = DivinerAtom::getAtomTypeNameString($type);
}
asort($all_types);
$types = $saved->getParameter('types', array());
$types = array_fuse($types);
$type_control = id(new AphrontFormCheckboxControl())->setLabel(pht('Types'));
foreach ($all_types as $type => $name) {
$type_control->addCheckbox('types[]', $type, $name, isset($types[$type]));
}
$form->appendChild($type_control);
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new DivinerBookDatasource())->setName('bookPHIDs')->setLabel(pht('Books'))->setValue($saved->getParameter('bookPHIDs')));
$form->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Repositories'))->setName('repositoryPHIDs')->setDatasource(new DiffusionRepositoryDatasource())->setValue($saved->getParameter('repositoryPHIDs')));
}
示例9: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
{
$statuses = $saved->getParameter('statuses', array());
$statuses = array_fuse($statuses);
$owner_phids = $saved->getParameter('ownerPHIDs', array());
$status_map = FundInitiative::getStatusNameMap();
$status_control = id(new AphrontFormCheckboxControl())->setLabel(pht('Statuses'));
foreach ($status_map as $status => $name) {
$status_control->addCheckbox('statuses[]', $status, $name, isset($statuses[$status]));
}
$form->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Owners'))->setName('owners')->setDatasource(new PhabricatorPeopleDatasource())->setValue($owner_phids))->appendChild($status_control);
}
示例10: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved)
{
$actor_phids = $saved->getParameter('actorPHIDs', array());
$user_phids = $saved->getParameter('userPHIDs', array());
$actions = $saved->getParameter('actions', array());
$remote_prefix = $saved->getParameter('ip');
$sessions = $saved->getParameter('sessions', array());
$actions = array_fuse($actions);
$action_control = id(new AphrontFormCheckboxControl())->setLabel(pht('Actions'));
$action_types = PhabricatorUserLog::getActionTypeMap();
foreach ($action_types as $type => $label) {
$action_control->addCheckbox('actions[]', $type, $label, isset($actions[$label]));
}
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('actors')->setLabel(pht('Actors'))->setValue($actor_phids))->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('users')->setLabel(pht('Users'))->setValue($user_phids))->appendChild($action_control)->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Filter IP'))->setName('ip')->setValue($remote_prefix))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Sessions'))->setName('sessions')->setValue(implode(', ', $sessions)));
}
示例11: appendToForm
public function appendToForm(AphrontFormView $form)
{
$form->appendControl($this->renderControl());
return $this;
}
示例12: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$key = $request->getURIData('key');
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
if (empty($options[$key])) {
$ancient = PhabricatorExtraConfigSetupCheck::getAncientConfig();
if (isset($ancient[$key])) {
$desc = pht("This configuration has been removed. You can safely delete " . "it.\n\n%s", $ancient[$key]);
} else {
$desc = pht('This configuration option is unknown. It may be misspelled, ' . 'or have existed in a previous version of Phabricator.');
}
// This may be a dead config entry, which existed in the past but no
// longer exists. Allow it to be edited so it can be reviewed and
// deleted.
$option = id(new PhabricatorConfigOption())->setKey($key)->setType('wild')->setDefault(null)->setDescription($desc);
$group = null;
$group_uri = $this->getApplicationURI();
} else {
$option = $options[$key];
$group = $option->getGroup();
$group_uri = $this->getApplicationURI('group/' . $group->getKey() . '/');
}
$issue = $request->getStr('issue');
if ($issue) {
// If the user came here from an open setup issue, send them back.
$done_uri = $this->getApplicationURI('issue/' . $issue . '/');
} else {
$done_uri = $group_uri;
}
// Check if the config key is already stored in the database.
// Grab the value if it is.
$config_entry = id(new PhabricatorConfigEntry())->loadOneWhere('configKey = %s AND namespace = %s', $key, 'default');
if (!$config_entry) {
$config_entry = id(new PhabricatorConfigEntry())->setConfigKey($key)->setNamespace('default')->setIsDeleted(true);
$config_entry->setPHID($config_entry->generatePHID());
}
$e_value = null;
$errors = array();
if ($request->isFormPost() && !$option->getLocked()) {
$result = $this->readRequest($option, $request);
list($e_value, $value_errors, $display_value, $xaction) = $result;
$errors = array_merge($errors, $value_errors);
if (!$errors) {
$editor = id(new PhabricatorConfigEditor())->setActor($viewer)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request);
try {
$editor->applyTransactions($config_entry, array($xaction));
return id(new AphrontRedirectResponse())->setURI($done_uri);
} catch (PhabricatorConfigValidationException $ex) {
$e_value = pht('Invalid');
$errors[] = $ex->getMessage();
}
}
} else {
if ($config_entry->getIsDeleted()) {
$display_value = null;
} else {
$display_value = $this->getDisplayValue($option, $config_entry, $config_entry->getValue());
}
}
$form = new AphrontFormView();
$error_view = null;
if ($errors) {
$error_view = id(new PHUIInfoView())->setErrors($errors);
}
$status_items = array();
if ($option->getHidden()) {
$message = pht('This configuration is hidden and can not be edited or viewed from ' . 'the web interface.');
$status_items[] = id(new PHUIStatusItemView())->setIcon('fa-eye-slash red')->setTarget(phutil_tag('strong', array(), pht('Configuration Hidden')))->setNote($message);
} else {
if ($option->getLocked()) {
$message = $option->getLockedMessage();
$status_items[] = id(new PHUIStatusItemView())->setIcon('fa-lock red')->setTarget(phutil_tag('strong', array(), pht('Configuration Locked')))->setNote($message);
}
}
if ($status_items) {
$doc_href = PhabricatorEnv::getDoclink('Configuration Guide: Locked and Hidden Configuration');
$doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Configuration Guide: Locked and Hidden Configuration'));
$status_items[] = id(new PHUIStatusItemView())->setIcon('fa-book')->setTarget(phutil_tag('strong', array(), pht('Learn More')))->setNote($doc_link);
}
if ($option->getHidden() || $option->getLocked()) {
$control = null;
} else {
$control = $this->renderControl($option, $display_value, $e_value);
}
$engine = new PhabricatorMarkupEngine();
$engine->setViewer($viewer);
$engine->addObject($option, 'description');
$engine->process();
$description = phutil_tag('div', array('class' => 'phabricator-remarkup'), $engine->getOutput($option, 'description'));
$form->setUser($viewer)->addHiddenInput('issue', $request->getStr('issue'));
if ($status_items) {
$status_view = id(new PHUIStatusListView());
foreach ($status_items as $status_item) {
$status_view->addItem($status_item);
}
$form->appendControl(id(new AphrontFormMarkupControl())->setValue($status_view));
}
$description = $option->getDescription();
if (strlen($description)) {
//.........这里部分代码省略.........
示例13: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$author_phids = $saved_query->getParameter('authorPHIDs', array());
$upcoming = $saved_query->getParameter('upcoming');
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('authors')->setLabel(pht('Authors'))->setValue($author_phids))->appendChild(id(new AphrontFormCheckboxControl())->addCheckbox('upcoming', 1, pht('Show only countdowns that are still counting down.'), $upcoming));
}
示例14: buildSearchForm
public function buildSearchForm(AphrontFormView $form, PhabricatorSavedQuery $saved_query)
{
$creator_phids = $saved_query->getParameter('creatorPHIDs', array());
$form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setName('creators')->setLabel(pht('Creators'))->setValue($creator_phids));
}
示例15: handleRequest
//.........这里部分代码省略.........
$error_view = null;
if ($errors) {
$error_view = new PHUIInfoView();
$error_view->setErrors($errors);
}
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
if ($task->getOwnerPHID()) {
$assigned_value = array($task->getOwnerPHID());
} else {
$assigned_value = array();
}
if ($task->getSubscriberPHIDs()) {
$cc_value = $task->getSubscriberPHIDs();
} else {
$cc_value = array();
}
if ($task->getProjectPHIDs()) {
$projects_value = $task->getProjectPHIDs();
} else {
$projects_value = array();
}
$cancel_id = nonempty($task->getID(), $template_id);
if ($cancel_id) {
$cancel_uri = '/T' . $cancel_id;
} else {
$cancel_uri = '/maniphest/';
}
if ($task->getID()) {
$button_name = pht('Save Task');
$header_name = pht('Edit Task');
} else {
if ($parent_task) {
$cancel_uri = '/T' . $parent_task->getID();
$button_name = pht('Create Task');
$header_name = pht('Create New Subtask');
} else {
$button_name = pht('Create Task');
$header_name = pht('Create New Task');
}
}
require_celerity_resource('maniphest-task-edit-css');
$project_tokenizer_id = celerity_generate_unique_node_id();
$form = new AphrontFormView();
$form->setUser($viewer)->addHiddenInput('template', $template_id)->addHiddenInput('responseType', $response_type)->addHiddenInput('order', $order)->addHiddenInput('ungrippable', $request->getStr('ungrippable'))->addHiddenInput('columnPHID', $request->getStr('columnPHID'));
if ($parent_task) {
$form->appendChild(id(new AphrontFormStaticControl())->setLabel(pht('Parent Task'))->setValue($viewer->renderHandle($parent_task->getPHID())))->addHiddenInput('parent', $parent_task->getID());
}
$form->appendChild(id(new AphrontFormTextAreaControl())->setLabel(pht('Title'))->setName('title')->setError($e_title)->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)->setValue($task->getTitle()));
if ($can_edit_status) {
// See T4819.
$status_map = ManiphestTaskStatus::getTaskStatusMap();
$dup_status = ManiphestTaskStatus::getDuplicateStatus();
if ($task->getStatus() != $dup_status) {
unset($status_map[$dup_status]);
}
$form->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Status'))->setName('status')->setValue($task->getStatus())->setOptions($status_map));
}
$policies = id(new PhabricatorPolicyQuery())->setViewer($viewer)->setObject($task)->execute();
if ($can_edit_assign) {
$form->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Assigned To'))->setName('assigned_to')->setValue($assigned_value)->setUser($viewer)->setDatasource(new PhabricatorPeopleDatasource())->setLimit(1));
}
$form->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('CC'))->setName('cc')->setValue($cc_value)->setUser($viewer)->setDatasource(new PhabricatorMetaMTAMailableDatasource()));
if ($can_edit_priority) {
$form->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Priority'))->setName('priority')->setOptions($priority_map)->setValue($task->getPriority()));
}
if ($can_edit_policies) {
$form->appendChild(id(new AphrontFormPolicyControl())->setUser($viewer)->setCapability(PhabricatorPolicyCapability::CAN_VIEW)->setPolicyObject($task)->setPolicies($policies)->setSpacePHID($v_space)->setName('viewPolicy'))->appendChild(id(new AphrontFormPolicyControl())->setUser($viewer)->setCapability(PhabricatorPolicyCapability::CAN_EDIT)->setPolicyObject($task)->setPolicies($policies)->setName('editPolicy'));
}
if ($can_edit_projects) {
$caption = null;
if ($can_create_projects) {
$caption = javelin_tag('a', array('href' => '/project/create/', 'mustcapture' => true, 'sigil' => 'project-create'), pht('Create New Project'));
}
$form->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($projects_value)->setID($project_tokenizer_id)->setCaption($caption)->setDatasource(new PhabricatorProjectDatasource()));
}
$field_list->appendFieldsToForm($form);
require_celerity_resource('phui-info-view-css');
Javelin::initBehavior('project-create', array('tokenizerID' => $project_tokenizer_id));
$description_control = id(new PhabricatorRemarkupControl())->setLabel(pht('Description'))->setName('description')->setID('description-textarea')->setValue($task->getDescription())->setUser($viewer);
$form->appendChild($description_control);
if ($request->isAjax()) {
$dialog = id(new AphrontDialogView())->setUser($viewer)->setWidth(AphrontDialogView::WIDTH_FULL)->setTitle($header_name)->appendChild(array($error_view, $form->buildLayoutView()))->addCancelButton($cancel_uri)->addSubmitButton($button_name);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
$form->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($cancel_uri)->setValue($button_name));
$form_box = id(new PHUIObjectBoxView())->setHeaderText($header_name)->setFormErrors($errors)->setForm($form);
$preview = id(new PHUIRemarkupPreviewPanel())->setHeader(pht('Description Preview'))->setControlID('description-textarea')->setPreviewURI($this->getApplicationURI('task/descriptionpreview/'));
if ($task->getID()) {
$page_objects = array($task->getPHID());
} else {
$page_objects = array();
}
$crumbs = $this->buildApplicationCrumbs();
if ($task->getID()) {
$crumbs->addTextCrumb('T' . $task->getID(), '/T' . $task->getID());
}
$crumbs->addTextCrumb($header_name);
$title = $header_name;
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->setPageObjectPHIDs($page_objects)->appendChild(array($form_box, $preview));
}