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

source: OpenPNE3/branches/goto_doctrine/apps/pc_frontend/modules/default/actions/components.class.php @ 11219

Last change on this file since 11219 was 11219, checked in by ebihara, 13 years ago

#3765:imported new models for Doctrine from some old models for Propel to enable to login

File size: 2.6 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
11class defaultComponents extends sfComponents
12{
13  public function executeGlobalNav()
14  {
15    $type = 'insecure_global';
16    if ($this->isSecurePage()) {
17      $type = 'secure_global';
18    }
19    $this->navs = Doctrine::getTable('Navigation')->retrieveByType($type);
20  }
21
22  public function executeLocalNav()
23  {
24    if (!$this->isSecurePage()) {
25      return sfView::NONE;
26    }
27
28    $context = sfContext::getInstance();
29    $module = $context->getActionStack()->getLastEntry()->getModuleName();
30    $action = $context->getActionStack()->getLastEntry()->getActionName();
31
32    $this->type = sfConfig::get('sf_nav_type', sfConfig::get('mod_' . $module . '_default_nav', 'default'));
33
34    $this->navs = Doctrine::getTable('Navigation')->retrieveByType($this->type);
35
36    if ('default' !== $this->type)
37    {
38      $this->navId = sfConfig::get('sf_nav_id', $context->getRequest()->getParameter('id'));
39    }
40  }
41
42  public function executeSideBannerGadgets()
43  {
44    $this->gadgets = Doctrine::getTable('Gadget')->retrieveSideBannerContentsGadgets();
45  }
46
47  public function executeInformationBox()
48  {
49    $this->information = Doctrine::getTable('SnsConfig')->get('pc_home_information');
50  }
51
52  public function executeFreeAreaBox()
53  {
54  }
55
56  public function executeMemberImageBox()
57  {
58  }
59
60  public function executeSearchBox()
61  {
62    $this->searchActions = array(
63      'Member' => 'member',
64      'Community' => 'community',
65    );
66  }
67
68  public function executeLanguageSelecterBox()
69  {
70    $this->form = new opLanguageSelecterForm();
71  }
72
73  public function executeLoginFormBox()
74  {
75    $this->forms = $this->getUser()->getAuthForms();
76  }
77
78  private function isSecurePage()
79  {
80    $context = sfContext::getInstance();
81    $action = $context->getActionStack()->getLastEntry()->getActionInstance();
82    $credential = $action->getCredential();
83
84    if (sfConfig::get('sf_login_module') === $context->getModuleName() && sfConfig::get('sf_login_action') === $context->getActionName()) {
85      return false;
86    }
87
88    if (sfConfig::get('sf_secure_module') == $context->getModuleName() && sfConfig::get('sf_secure_action') == $context->getActionName()) {
89      return false;
90    }
91
92    if (!$action->isSecure()) {
93      return false;
94    }
95
96    if ((is_array($credential) && !in_array('SNSMember', $credential)) || (is_string($credential) && 'SNSMember' !== $credential)) {
97      return false;
98    }
99
100    return true;
101  }
102}
Note: See TracBrowser for help on using the repository browser.