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

source: OpenPNE3/trunk/lib/filter/sfOpenPNEExecutionFilter.class.php @ 10003

Last change on this file since 10003 was 10003, checked in by ebihara, 12 years ago

#3385:changed reference to the Apache License 2.0 and copyright for the OpenPNE package are now compact.

File size: 1.9 KB
Line 
1<?php
2
3/**
4 * This file is part of the OpenPNE package.
5 * (c) OpenPNE Project (http://www.openpne.jp/)
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file and the NOTICE file that were distributed with this source code.
9 */
10
11/**
12 * sfOpenPNEExecutionFilter
13 *
14 * @package    OpenPNE
15 * @subpackage filter
16 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
17 */
18class sfOpenPNEExecutionFilter extends sfExecutionFilter
19{
20  protected function handleAction($filterChain, $actionInstance)
21  {
22    $moduleName = $actionInstance->getModuleName();
23    $actionName = $actionInstance->getActionName();
24    $dispatcher = sfContext::getInstance()->getEventDispatcher();
25
26    $dispatcher->notify(new sfEvent($this, 'op_action.pre_execute_'.$moduleName.'_'.$actionName, array(
27      'moduleName'     => $moduleName,
28      'actionName'     => $actionName,
29      'actionInstance' => $actionInstance,
30    )));
31
32    $result = parent::handleAction($filterChain, $actionInstance);
33
34    $dispatcher->notify(new sfEvent($this, 'op_action.post_execute_'.$moduleName.'_'.$actionName, array(
35      'moduleName'     => $moduleName,
36      'actionName'     => $actionName,
37      'actionInstance' => $actionInstance,
38      'result'         => $result,
39    )));
40
41    return $result;
42  }
43
44  protected function executeView($moduleName, $actionName, $viewName, $viewAttributes)
45  {
46    if (sfConfig::get('app_is_mobile'))
47    {
48      foreach ($viewAttributes as $key => $attribute)
49      {
50        $this->setFormFormatterForMobile($attribute);
51        $viewAttributes[$key] = $attribute;
52      }
53    }
54
55    parent::executeView($moduleName, $actionName, $viewName, $viewAttributes);
56  }
57
58  protected function setFormFormatterForMobile(&$form)
59  {
60    if (is_array($form))
61    {
62      array_map(array($this, 'setFormFormatterForMobile'), $form);
63    }
64    elseif ($form instanceof sfForm)
65    {
66      $form->getWidgetSchema()->setFormFormatterName('mobile');
67    }
68  }
69}
Note: See TracBrowser for help on using the repository browser.