2010/3/8 Buddhika Perera <[email protected]>:
> Guys i am looking for a good tutorial on how to use symfony for use
> feedback form example where it uses mysql database?
>
>
> pls send some link or tutorials on how to do it .....
schema
Notification:
actAs:
Signable:
created:
name: created_by
type: integer
updated:
name: updated_by
type: integer
Timestampable:
columns:
user_id: { type: integer(5), notnull: true }
content: { type: string(8096), notnull: true }
state: { type: integer(1), notnull: true, default: 0 }
indexes:
notification_myindex:
fields: [user_id, state, created_at]
relations:
User:
class: sfGuardUser
local: user_id
foreign: id
onDelete: CASCADE
action
<?php
/**
* notification actions.
*
* @package portal
* @subpackage notification
* @author Michał Piotrowski <[email protected]>
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z
Kris.Wallsmith $
*/
class notificationActions extends sfActions
{
public function executeNew(sfWebRequest $request)
{
$this->form = new NotificationForm();
}
public function executeCreate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST));
$this->form = new NotificationForm();
$this->processForm($request, $this->form);
$this->setTemplate('new');
}
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()),
$request->getFiles($form->getName()));
if ($form->isValid())
{
$this->UserData = $this->getUser()->getUserData();
$this->logged_user_id = $this->UserData['logged_user_id'];
$this->logged_username = $this->UserData['logged_username'];
$form->updateObject(array('user_id' => $this->logged_user_id));
$notification = $form->save();
$this->redirect('main', array('username' => $this->logged_username));
}
}
}
_form.php
<?php use_stylesheet('notification.css') ?>
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<form action="<?php echo url_for('@notification_create') ?>"
method="post" <?php $form->isMultipart() and print
'enctype="multipart/form-data" ' ?>>
<table>
<tfoot>
<tr>
<td colspan="2">
<div class="notification_submit">
<br />
<input type="submit" value="Wyślij" />
</div>
</td>
</tr>
</tfoot>
<tbody>
<?php echo $form ?>
</tbody>
</table>
</form>
newSuccess.php
<?php slot('title') ?>
<?php echo sprintf('%s - zgłoszenie problemu z działaniem portalu',
sfConfig::get('app_portal_title')) ?>
<?php end_slot(); ?>
<div id="lx6">
<div class="h6">
<div class="ht6">
Zgłoszenie problemu z działaniem portalu
</div>
</div>
<div class="b6">
<div class="bt6">
W treści zgłoszenia problemu z działaniem portalu prosimy o
podanie jak największej ilości szczegółów dotyczących problemu -
pozwoli to na szybkie jego rozwiązanie. Dziękujemy za współpracę :)
<br />
<br />
<?php include_partial('form', array('form' => $form)) ?>
</div>
</div>
<br />
<br />
</div>
<div id="rx3">
<?php include_partial('ad/show_ad_taily', array('width' => 3)) ?>
<br />
<?php include_partial('ad/show_ad_sense', array('width' => 3)) ?>
<br />
<br />
</div>
routing
notification_create:
url: /portal/notification/c
options: { model: Notification }
param: { module: notification, action: create }
notification_new:
url: /portal/notification
options: { model: Notification }
param: { module: notification, action: new }
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en