~fabiocbalbuquerque/sahana-agasti/web-services

« back to all changes in this revision

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

  • Committer: Usman Akeju
  • Date: 2011-05-26 16:55:44 UTC
  • mto: (1.26.1 push-trunk) (7.1.1 mayon)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: usman.akeju@mail.cuny.edu-20110526165544-5xjkltqrqmehmd3u
- minor code & doc cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    $foo = PluginagStaffResource::disableAllStaff();
34
34
    $this->redirect('admin/index');
35
35
  }
36
 
  
37
 
  
 
36
 
38
37
  /** Pacman is the basic shell for package management, it is currently NOT STABLE
39
38
   *
40
39
   * @param sfWebRequest $request is what the user is asking of the server
63
62
   */
64
63
  public function executeGlobals(sfWebRequest $request)
65
64
  {
66
 
    if ($ag_global_param = Doctrine_Core::getTable('agGlobalParam')->find(array($request->getParameter('param')))) {
 
65
    $ag_global_param = Doctrine_Core::getTable('agGlobalParam')
 
66
            ->find(array($request->getParameter('param')));
 
67
    if (isset($ag_global_param)) {
67
68
      $this->paramform = new agGlobalParamForm($ag_global_param);
68
69
    } else {
69
70
      $this->paramform = new agGlobalParamForm();
72
73
            ->createQuery('a')
73
74
            ->execute();
74
75
 
75
 
    if ($request->getParameter('delete')) {
 
76
    if ($request->hasParameter('delete')) {
76
77
      //$request->checkCSRFProtection();
77
78
 
78
79
      $this->forward404Unless(
86
87
      $this->redirect('admin/globals');
87
88
    }
88
89
 
89
 
    if ($request->getParameter('update')) {
 
90
    if ($request->hasParameter('update') /* && $request->hasParameter('ag_global_param') */) {
90
91
      $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
91
92
      //$this->forward404Unless($ag_global_param = Doctrine::getTable('agGlobalParam')->findAll()->getFirst(), sprintf('Object ag_account does not exist (%s).', $request->getParameter('id')));
92
93
      //are we editing or creating a new param
93
 
      $values = $request->getParameter('ag_global_param');
94
 
      $this->processParam($values, $this->paramform);
 
94
      $this->processParam($request, $this->paramform);
95
95
    }
96
96
  }
97
97
 
317
317
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
318
318
    if ($form->isValid()) {
319
319
      $ag_account = $form->save();
320
 
      if ($request->getParameter('Continue')) {
 
320
      if ($request->hasParameter('Continue')) {
321
321
        /** @todo pass the previously created username to the new template for verification */
322
322
        $this->redirect('admin/new');
323
323
      } else {
333
333
   * @param sfWebRequest $request
334
334
   * @param sfForm $paramform the form to be processed
335
335
   */
336
 
  protected function processParam($values, sfForm $paramform)
 
336
  protected function processParam(sfWebRequest $request, sfForm $paramform)
337
337
  {
338
 
    if($values['id'] != null) {
 
338
    $values = $request->getParameter('ag_global_param');
 
339
    if (isset($values['id'])) {
339
340
      $param = agDoctrineQuery::create()
340
 
                 ->select()
341
 
                 ->from('agGlobalParam')
342
 
                 ->where('id = ?', $values['id'])
343
 
                 ->fetchOne();
344
 
      
 
341
              ->select()
 
342
              ->from('agGlobalParam')
 
343
              ->where('id = ?', $values['id'])
 
344
              ->fetchOne();
345
345
    } else {
346
346
      $param = new agGlobalParam();
347
347
    }