Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F439215
PassphraseCredentialCreateController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PassphraseCredentialCreateController.php
View Options
<?php
final
class
PassphraseCredentialCreateController
extends
PassphraseController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$types
=
PassphraseCredentialType
::
getAllCreateableTypes
();
$types
=
mpull
(
$types
,
null
,
'getCredentialType'
);
$types
=
msort
(
$types
,
'getCredentialTypeName'
);
$errors
=
array
();
$e_type
=
null
;
if
(
$request
->
isFormPost
())
{
$type
=
$request
->
getStr
(
'type'
);
if
(
empty
(
$types
[
$type
]))
{
$errors
[]
=
pht
(
'You must choose a credential type.'
);
$e_type
=
pht
(
'Required'
);
}
if
(!
$errors
)
{
$uri
=
$this
->
getApplicationURI
(
'edit/?type='
.
$type
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$uri
);
}
}
$types_control
=
id
(
new
AphrontFormRadioButtonControl
())
->
setName
(
'type'
)
->
setLabel
(
pht
(
'Credential Type'
))
->
setError
(
$e_type
);
foreach
(
$types
as
$type
)
{
$types_control
->
addButton
(
$type
->
getCredentialType
(),
$type
->
getCredentialTypeName
(),
$type
->
getCredentialTypeDescription
());
}
$form
=
id
(
new
AphrontFormView
())
->
setUser
(
$viewer
)
->
appendChild
(
$types_control
)
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
setValue
(
pht
(
'Continue'
))
->
addCancelButton
(
$this
->
getApplicationURI
()));
$title
=
pht
(
'New Credential'
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
pht
(
'Create'
));
$box
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
pht
(
'Create New Credential'
))
->
setFormErrors
(
$errors
)
->
setForm
(
$form
);
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$box
,
),
array
(
'title'
=>
$title
,
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 3:44 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63654
Default Alt Text
PassphraseCredentialCreateController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment