This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PluginGabaritsComponents.class.php
56 lines (46 loc) · 1.92 KB
/
PluginGabaritsComponents.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* sfCms actions.
*
* @subpackage sfCms
* @author Vincent CHALAMON <vincentchalamon@gmail.com>
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class PluginGabaritsComponents extends sfComponents
{
public function executeContact(sfWebRequest $request)
{
$this->form = new ContactForm();
if ($request->isMethod('post')) {
$this->form->bind($request->getParameter($this->form->getName(), array()));
if ($this->form->isValid()) {
$this->getContext()->getConfiguration()->loadHelpers('Partial');
$message = $this->getMailer()->compose(
array($this->form->getValue('email') => $this->form->getValue('name')),
sfConfig::get('app_sf_cms_contact'),
$this->getContext()->getI18N()->__('New contact message', array(), 'sf_cms'),
get_partial('sfCms/mail', array(
'title' => $this->getContext()->getI18N()->__('New contact message', array(), 'sf_cms'),
'message' => $this->form->getValue('message')
))
)->setContentType('text/html');
$this->getMailer()->send($message);
$this->getUser()->setFlash('notice', $this->getContext()->getI18N()->__('Message has been successfully sent.', array(), 'sf_cms'));
} else {
$this->getUser()->setFlash('error', $this->getContext()->getI18N()->__('Form has errors.', array(), 'sf_cms'), false);
}
}
}
public function executeDefault(sfWebRequest $request)
{
}
public function executeError(sfWebRequest $request)
{
}
public function executeHomepage(sfWebRequest $request)
{
}
public function executeSitemap(sfWebRequest $request)
{
}
}