Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P770
Multiple HTMLforms in single page
Active
Public
Actions
Authored by
01tonythomas
on Jun 11 2015, 1:28 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
MediaWiki-extensions-Newsletter
Referenced Files
F177892: Multiple HTMLforms in single page
Jun 11 2015, 1:28 PM
2015-06-11 13:28:46 (UTC+0)
Subscribers
None
<?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
;
}
}
Event Timeline
01tonythomas
edited the content of this paste.
(Show Details)
Jun 11 2015, 1:28 PM
2015-06-11 13:28:46 (UTC+0)
01tonythomas
changed the title of this paste from untitled to
Multiple HTMLforms in single page
.
01tonythomas
updated the paste's language from
autodetect
to
autodetect
.
01tonythomas
added a project:
MediaWiki-extensions-Newsletter
.
Log In to Comment