~fabiocbalbuquerque/sahana-agasti/web-services

« back to all changes in this revision

Viewing changes to apps/frontend/modules/profile/actions/actions.class.php

  • Committer: Chad Heuschober
  • Date: 2011-08-04 00:05:46 UTC
  • mto: (1.26.1 push-trunk)
  • mto: This revision was merged to the branch mainline in revision 25.
  • Revision ID: chad.heuschober@mail.cuny.edu-20110804000546-4dqh6a7xrkrwccdh
Moved around some data fixtures to put the regular fixtures into more of a production-ready state.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
/**
4
 
 * profile actions.
5
 
 *
6
 
 * @package    AGASTI_CORE
7
 
 * @subpackage profile
8
 
 * @author     CUNY SPS
9
 
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
10
 
 */
11
 
class profileActions extends sfActions
12
 
{
13
 
  public function executeIndex(sfWebRequest $request)
14
 
  {
15
 
    $this->sf_guard_user_profiles = Doctrine_Core::getTable('sfGuardUserProfile')
16
 
      ->createQuery('a')
17
 
      ->execute();
18
 
  }
19
 
 
20
 
  public function executeNew(sfWebRequest $request)
21
 
  {
22
 
    $this->form = new sfGuardUserProfileForm();
23
 
  }
24
 
 
25
 
  public function executeCreate(sfWebRequest $request)
26
 
  {
27
 
    $this->forward404Unless($request->isMethod(sfRequest::POST));
28
 
 
29
 
    $this->form = new sfGuardUserProfileForm();
30
 
 
31
 
    $this->processForm($request, $this->form);
32
 
 
33
 
    $this->setTemplate('new');
34
 
  }
35
 
 
36
 
  public function executeEdit(sfWebRequest $request)
37
 
  {
38
 
    $this->forward404Unless($sf_guard_user_profile = Doctrine_Core::getTable('sfGuardUserProfile')->find(array($request->getParameter('id'))), sprintf('Object sf_guard_user_profile does not exist (%s).', $request->getParameter('id')));
39
 
    $this->form = new sfGuardUserProfileForm($sf_guard_user_profile);
40
 
  }
41
 
 
42
 
  public function executeUpdate(sfWebRequest $request)
43
 
  {
44
 
    $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
45
 
    $this->forward404Unless($sf_guard_user_profile = Doctrine_Core::getTable('sfGuardUserProfile')->find(array($request->getParameter('id'))), sprintf('Object sf_guard_user_profile does not exist (%s).', $request->getParameter('id')));
46
 
    $this->form = new sfGuardUserProfileForm($sf_guard_user_profile);
47
 
 
48
 
    $this->processForm($request, $this->form);
49
 
 
50
 
    $this->setTemplate('edit');
51
 
  }
52
 
 
53
 
  public function executeDelete(sfWebRequest $request)
54
 
  {
55
 
    $request->checkCSRFProtection();
56
 
 
57
 
    $this->forward404Unless($sf_guard_user_profile = Doctrine_Core::getTable('sfGuardUserProfile')->find(array($request->getParameter('id'))), sprintf('Object sf_guard_user_profile does not exist (%s).', $request->getParameter('id')));
58
 
    $sf_guard_user_profile->delete();
59
 
 
60
 
    $this->redirect('profile/index');
61
 
  }
62
 
 
63
 
  protected function processForm(sfWebRequest $request, sfForm $form)
64
 
  {
65
 
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
66
 
    if ($form->isValid())
67
 
    {
68
 
      $sf_guard_user_profile = $form->save();
69
 
 
70
 
      $this->redirect('profile/edit?id='.$sf_guard_user_profile->getId());
71
 
    }
72
 
  }
73
 
}