2013-04-02 11:23:24 -07:00
|
|
|
<?php
|
|
|
|
|
2015-01-04 08:36:47 +11:00
|
|
|
final class PhabricatorMultiColumnUIExample extends PhabricatorUIExample {
|
2013-04-02 11:23:24 -07:00
|
|
|
|
|
|
|
public function getName() {
|
2015-05-22 17:27:56 +10:00
|
|
|
return pht('Multiple Column Layouts');
|
2013-04-02 11:23:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription() {
|
2015-05-22 17:27:56 +10:00
|
|
|
return pht(
|
|
|
|
'A container good for 1-7 equally spaced columns. '.
|
|
|
|
'Fixed and Fluid layouts.');
|
2013-04-02 11:23:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function renderExample() {
|
2013-05-21 15:28:43 -07:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
2013-04-02 11:23:24 -07:00
|
|
|
|
|
|
|
$column1 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'pm',
|
2014-10-08 00:01:04 +11:00
|
|
|
'style' => 'border: 1px solid green;',
|
2013-04-02 11:23:24 -07:00
|
|
|
),
|
|
|
|
'Bruce Campbell');
|
|
|
|
|
|
|
|
$column2 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'pm',
|
2014-10-08 00:01:04 +11:00
|
|
|
'style' => 'border: 1px solid blue;',
|
2013-04-02 11:23:24 -07:00
|
|
|
),
|
|
|
|
'Army of Darkness');
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head1 = id(new PHUIHeaderView())
|
2013-04-02 11:23:24 -07:00
|
|
|
->setHeader(pht('2 Column Fixed'));
|
|
|
|
$layout1 = id(new AphrontMultiColumnView())
|
|
|
|
->addColumn($column1)
|
|
|
|
->addColumn($column2)
|
|
|
|
->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM);
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head2 = id(new PHUIHeaderView())
|
2013-04-02 11:23:24 -07:00
|
|
|
->setHeader(pht('2 Column Fluid'));
|
|
|
|
$layout2 = id(new AphrontMultiColumnView())
|
|
|
|
->addColumn($column1)
|
|
|
|
->addColumn($column2)
|
|
|
|
->setFluidLayout(true)
|
|
|
|
->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM);
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head3 = id(new PHUIHeaderView())
|
2013-04-02 11:23:24 -07:00
|
|
|
->setHeader(pht('4 Column Fixed'));
|
|
|
|
$layout3 = id(new AphrontMultiColumnView())
|
|
|
|
->addColumn($column1)
|
|
|
|
->addColumn($column2)
|
|
|
|
->addColumn($column1)
|
|
|
|
->addColumn($column2)
|
|
|
|
->setGutter(AphrontMultiColumnView::GUTTER_SMALL);
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head4 = id(new PHUIHeaderView())
|
2013-04-02 11:23:24 -07:00
|
|
|
->setHeader(pht('4 Column Fluid'));
|
|
|
|
$layout4 = id(new AphrontMultiColumnView())
|
|
|
|
->addColumn($column1)
|
|
|
|
->addColumn($column2)
|
|
|
|
->addColumn($column1)
|
|
|
|
->addColumn($column2)
|
|
|
|
->setFluidLayout(true)
|
|
|
|
->setGutter(AphrontMultiColumnView::GUTTER_SMALL);
|
|
|
|
|
2013-05-21 15:28:43 -07:00
|
|
|
$sunday = hsprintf('<strong>Sunday</strong><br /><br />Watch Football'.
|
|
|
|
'<br />Code<br />Eat<br />Sleep');
|
|
|
|
|
|
|
|
$monday = hsprintf('<strong>Monday</strong><br /><br />Code'.
|
|
|
|
'<br />Eat<br />Sleep');
|
|
|
|
|
|
|
|
$tuesday = hsprintf('<strong>Tuesday</strong><br />'.
|
|
|
|
'<br />Code<br />Eat<br />Sleep');
|
|
|
|
|
|
|
|
$wednesday = hsprintf('<strong>Wednesday</strong><br /><br />Code'.
|
|
|
|
'<br />Eat<br />Sleep');
|
|
|
|
|
|
|
|
$thursday = hsprintf('<strong>Thursday</strong><br />'.
|
|
|
|
'<br />Code<br />Eat<br />Sleep');
|
|
|
|
|
|
|
|
$friday = hsprintf('<strong>Friday</strong><br /><br />Code'.
|
|
|
|
'<br />Eat<br />Sleep');
|
|
|
|
|
|
|
|
$saturday = hsprintf('<strong>Saturday</strong><br /><br />StarCraft II'.
|
|
|
|
'<br />All<br />Damn<br />Day');
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head5 = id(new PHUIHeaderView())
|
2013-04-06 07:23:59 -07:00
|
|
|
->setHeader(pht('7 Column Fluid'));
|
|
|
|
$layout5 = id(new AphrontMultiColumnView())
|
2013-05-21 15:28:43 -07:00
|
|
|
->addColumn($sunday)
|
|
|
|
->addColumn($monday)
|
|
|
|
->addColumn($tuesday)
|
|
|
|
->addColumn($wednesday)
|
|
|
|
->addColumn($thursday)
|
|
|
|
->addColumn($friday)
|
|
|
|
->addColumn($saturday)
|
|
|
|
->setFluidLayout(true)
|
2014-02-10 16:04:42 -08:00
|
|
|
->setBorder(true);
|
2013-05-21 15:28:43 -07:00
|
|
|
|
2013-08-26 11:53:11 -07:00
|
|
|
$shipping = id(new PHUIFormLayoutView())
|
2013-05-21 15:28:43 -07:00
|
|
|
->setUser($user)
|
|
|
|
->setFullWidth(true)
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('Name'))
|
2015-07-09 15:07:58 -07:00
|
|
|
->setDisableAutocomplete(true)
|
2013-05-21 15:28:43 -07:00
|
|
|
->setSigil('name-input'))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('Address'))
|
2013-05-21 15:28:43 -07:00
|
|
|
->setDisableAutocomplete(true)
|
|
|
|
->setSigil('address-input'))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('City/State'))
|
2013-05-21 15:28:43 -07:00
|
|
|
->setDisableAutocomplete(true)
|
|
|
|
->setSigil('city-input'))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('Country'))
|
2013-05-21 15:28:43 -07:00
|
|
|
->setDisableAutocomplete(true)
|
|
|
|
->setSigil('country-input'))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('Postal Code'))
|
2013-05-21 15:28:43 -07:00
|
|
|
->setDisableAutocomplete(true)
|
|
|
|
->setSigil('postal-input'));
|
|
|
|
|
2013-08-26 11:53:11 -07:00
|
|
|
$cc = id(new PHUIFormLayoutView())
|
2013-05-21 15:28:43 -07:00
|
|
|
->setUser($user)
|
|
|
|
->setFullWidth(true)
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('Card Number'))
|
2013-05-21 15:28:43 -07:00
|
|
|
->setDisableAutocomplete(true)
|
|
|
|
->setSigil('number-input')
|
|
|
|
->setError(''))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('CVC'))
|
2013-05-21 15:28:43 -07:00
|
|
|
->setDisableAutocomplete(true)
|
|
|
|
->setSigil('cvc-input')
|
|
|
|
->setError(''))
|
|
|
|
->appendChild(
|
|
|
|
id(new PhortuneMonthYearExpiryControl())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setLabel(pht('Expiration'))
|
2013-05-21 15:28:43 -07:00
|
|
|
->setUser($user)
|
|
|
|
->setError(''));
|
|
|
|
|
|
|
|
$shipping_title = pht('Shipping Address');
|
|
|
|
$billing_title = pht('Billing Address');
|
|
|
|
$cc_title = pht('Payment Information');
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$head6 = id(new PHUIHeaderView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setHeader(pht("Let's Go Shopping"));
|
2013-05-21 15:28:43 -07:00
|
|
|
$layout6 = id(new AphrontMultiColumnView())
|
|
|
|
->addColumn(hsprintf('<h1>%s</h1>%s', $shipping_title, $shipping))
|
|
|
|
->addColumn(hsprintf('<h1>%s</h1>%s', $billing_title, $shipping))
|
|
|
|
->addColumn(hsprintf('<h1>%s</h1>%s', $cc_title, $cc))
|
|
|
|
->setFluidLayout(true)
|
2014-02-10 16:04:42 -08:00
|
|
|
->setBorder(true);
|
2013-04-06 07:23:59 -07:00
|
|
|
|
2013-04-02 11:23:24 -07:00
|
|
|
$wrap1 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-10-08 00:01:04 +11:00
|
|
|
'class' => 'ml',
|
2013-04-02 11:23:24 -07:00
|
|
|
),
|
|
|
|
$layout1);
|
|
|
|
|
|
|
|
$wrap2 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-10-08 00:01:04 +11:00
|
|
|
'class' => 'ml',
|
2013-04-02 11:23:24 -07:00
|
|
|
),
|
|
|
|
$layout2);
|
|
|
|
|
|
|
|
$wrap3 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-10-08 00:01:04 +11:00
|
|
|
'class' => 'ml',
|
2013-04-02 11:23:24 -07:00
|
|
|
),
|
|
|
|
$layout3);
|
|
|
|
|
|
|
|
$wrap4 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-10-08 00:01:04 +11:00
|
|
|
'class' => 'ml',
|
2013-04-02 11:23:24 -07:00
|
|
|
),
|
|
|
|
$layout4);
|
|
|
|
|
2013-04-06 07:23:59 -07:00
|
|
|
$wrap5 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-10-08 00:01:04 +11:00
|
|
|
'class' => 'ml',
|
2013-04-06 07:23:59 -07:00
|
|
|
),
|
|
|
|
$layout5);
|
|
|
|
|
2013-05-21 15:28:43 -07:00
|
|
|
$wrap6 = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-10-08 00:01:04 +11:00
|
|
|
'class' => 'ml',
|
2013-05-21 15:28:43 -07:00
|
|
|
),
|
|
|
|
$layout6);
|
|
|
|
|
2013-04-02 11:23:24 -07:00
|
|
|
return phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(),
|
|
|
|
array(
|
|
|
|
$head1,
|
|
|
|
$wrap1,
|
|
|
|
$head2,
|
|
|
|
$wrap2,
|
|
|
|
$head3,
|
|
|
|
$wrap3,
|
|
|
|
$head4,
|
2013-04-06 07:23:59 -07:00
|
|
|
$wrap4,
|
|
|
|
$head5,
|
2013-05-21 15:28:43 -07:00
|
|
|
$wrap5,
|
|
|
|
$head6,
|
2014-10-08 00:01:04 +11:00
|
|
|
$wrap6,
|
2013-04-02 11:23:24 -07:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|