ここの情報は古いです。ご理解頂いた上でお取り扱いください。

source: OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_backend/modules/application/actions/actions.class.php @ 9562

Last change on this file since 9562 was 9562, checked in by ShogoKawahara, 12 years ago

#3119:added some actions for the OpenSocial application configuration

File size: 2.7 KB
Line 
1<?php
2
3/**
4 * application actions.
5 *
6 * @package    OpenPNE
7 * @subpackage application
8 * @author     Shogo Kawahara<kawahara@tejimaya.net>
9 * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
10 */
11class applicationActions extends sfActions
12{
13 /**
14  * Executes index action
15  *
16  * @param sfRequest $request A request object
17  */
18  public function executeIndex($request)
19  {
20    return $this->redirect('application/applicationConfig');
21  }
22
23 /**
24  * Executes applicationConfig action
25  *
26  * @param sfRequest $request A request object
27  */
28  public function executeApplicationConfig($request)
29  {
30    $this->applicationConfigForm = new ApplicationConfigForm();
31
32    if (!$request->isMethod('post'))
33    {
34      return sfView::SUCCESS;
35    }
36
37    $this->applicationConfigForm->bind($request->getParameter('application_config'));
38    if ($this->applicationConfigForm->isValid())
39    {
40      $this->applicationConfigForm->save();
41    }
42    return sfView::SUCCESS;
43  }
44
45 /**
46  * Executes list action
47  *
48  * @param sfRequest $request A request object
49  */
50  public function executeList($request)
51  {
52    $criteria = new Criteria();
53    $criteria->addDescendingOrderByColumn(ApplicationPeer::ID);
54    $this->pager = new sfPropelPager('Application', 20);
55    $this->pager->setCriteria($criteria);
56    $this->pager->setPage($request->getParameter('page',1));
57    $this->pager->init();
58
59    $this->addform = new AddApplicationForm();
60    if (!$request->isMethod('post'))
61    {
62      return sfView::SUCCESS;
63    }
64
65    $this->addform->bind($request->getParameter('contact'));
66    if (!$this->addform->isValid())
67    {
68      return sfView::SUCCESS;
69    }
70
71    $contact = $this->addform->getValues();
72    try
73    {
74      $application = ApplicationPeer::addApplication($contact['application_url'], $this->getUser()->getCulture(),true);     
75    }
76    catch (Exception $e)
77    {
78      return sfView::ERROR;
79    }
80    return $this->redirect('application/info?id='.$application->getId());
81  }
82
83 /**
84  * Execute info action
85  *
86  * @param sfRequest $request A request object
87  */
88  public function executeInfo($request)
89  {
90    $application_id = $request->getParameter('id',false);
91    if (!$application_id)
92    {
93      return sfView::ERROR;
94    }
95
96    $application = ApplicationPeer::retrieveByPk($application_id);
97    if (!$application)
98    {
99      return sfView::ERROR;
100    }
101
102    $this->application = $application;
103    return sfView::SUCCESS;
104  }
105
106 /**
107  * Execute profileSetting action
108  *
109  * @param sfRequest $request A request object
110  */
111  public function executeProfileSetting($request)
112  {
113    $this->profileConfigForm = new OpenSocialPersonFieldConfigForm();
114    return sfView::SUCCESS;
115  }
116}
Note: See TracBrowser for help on using the repository browser.