Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F177892
Multiple HTMLforms in single page
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
01tonythomas
Jun 11 2015, 1:28 PM
2015-06-11 13:28:46 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
Multiple HTMLforms in single page
View Options
<?php
/**
* Special page for creating newsletters and announcing issues
*
*/
class
SpecialNewsletterPublishers
extends
SpecialPage
{
function
__construct
()
{
parent
::
__construct
(
'NewsletterPublishers'
);
}
public
function
execute
(
$par
)
{
$this
->
setHeaders
();
$array1
=
$this
->
getAnnounceFormFields
();
$array2
=
$this
->
getCreateFormFields
();
# Do stuff
# ...
$htmlFormNewIssue
=
new
HTMLForm
(
$array1
,
$this
->
getContext
()
);
$htmlFormNewIssue
->
setSubmitText
(
'Create a new Issue'
);
$htmlFormNewIssue
->
setSubmitCallback
(
array
(
'SpecialNewsLetterPublishers'
,
'onSubmitNewIssue'
)
);
$htmlFormNewIssue
->
show
();
$htmlFormNewNewsLetter
=
new
HTMLForm
(
$array2
,
$this
->
getContext
()
);
$htmlFormNewNewsLetter
->
setSubmitText
(
'Create a new Newsletter'
);
$htmlFormNewNewsLetter
->
setSubmitCallback
(
array
(
'SpecialNewsLetterPublishers'
,
'onSubmitNewsLetter'
)
);
$htmlFormNewNewsLetter
->
show
();
}
function
getCreateFormFields
()
{
return
array
(
'name'
=>
array
(
'section'
=>
'newslettersection2'
,
'type'
=>
'text'
,
'label'
=>
'Name of newsletter'
),
'description'
=>
array
(
'section'
=>
'newslettersection2'
,
'type'
=>
'textarea'
,
'label'
=>
'Description'
,
'rows'
=>
15
,
'cols'
=>
50
,
),
'mainpage'
=>
array
(
'section'
=>
'newslettersection2'
,
'type'
=>
'text'
,
'label'
=>
'Title of Main Page'
),
);
}
function
getAnnounceFormFields
()
{
return
array
(
'name1'
=>
array
(
'section'
=>
'newslettersection1'
,
'type'
=>
'text'
,
'label'
=>
'Name of newsletter'
),
'mainpage1'
=>
array
(
'section'
=>
'newslettersection1'
,
'type'
=>
'text'
,
'label'
=>
'Title of Main Page'
),
);
}
static
function
onSubmitNewsLetter
(
$formData
)
{
echo
"submitted new newsletter"
;
print_r
(
$formData
);
return
true
;
}
static
function
onSubmitNewIssue
(
$formData
)
{
echo
"submitted new issue "
;
print_r
(
$formData
);
return
true
;
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
171354
Default Alt Text
Multiple HTMLforms in single page (1 KB)
Attached To
Mode
P770 Multiple HTMLforms in single page
Attached
Detach File
Event Timeline
Log In to Comment