Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1043
board_edit_sketch.php
Active
Public
Actions
Authored by
epriestley
on Jan 9 2014, 5:10 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F100297: board_edit_sketch.php
Jan 9 2014, 5:10 PM
2014-01-09 17:10:39 (UTC+0)
Subscribers
None
<?php
final
class
ProjectBoardEditController
extends
ProjectController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
projectID
=
=
$data
[
'projectID'
];
$this
->
id
=
idx
(
$data
[
'id'
]);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
// First, load the project and make sure the user can edit it.
// Use `PhabricatorProjectQuery` with `requireCapabilities()`.
$project
=
id
(
new
PhabricatorProjectQuery
())->...->
executeOne
();
if
(!
$project
)
{
// 404
}
// Now, either load an existing column (for an edit) or create a new one.
if
(
$this
->
id
)
{
$column
=
// load
// You can ignore this for now, we only care about create.
}
else
{
$column
=
PhabricatorProjectBoardColumn
::
initializeNewColumn
(
$viewer
);
}
if
(
$request
->
isFormPost
())
{
// set values from the request on the $column, then call save()
// then redirect back to the board
}
// If we reach this, there were form errors or the request isn't a form
// submit. Render the create/edit form.
$form
=
new
AphrontFormView
();
// add fields
return
$this
->
buildApplicationPage
(
// ...
);
}
}
Event Timeline
epriestley
edited the content of this paste.
(Show Details)
Jan 9 2014, 5:10 PM
2014-01-09 17:10:39 (UTC+0)
epriestley
changed the title of this paste from untitled to
board_edit_sketch.php
.
epriestley
updated the paste's language from
autodetect
to
autodetect
.
Log In to Comment