Show
Ignore:
Timestamp:
07/04/08 01:30:16 (5 months ago)
Author:
kumatch
Message:

Adjusted the change of authenticated user (self) object.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/piece_framework/trunk/libs/Phwittr/Interceptor/Self.php

    r15132 r15136  
    1414require_once 'Piece/Unity/Service/Authentication.php'; 
    1515 
    16 // {{{ Phwittr_Interceptor_LayoutSetter 
     16// {{{ Phwittr_Interceptor_Self 
    1717 
    1818/** 
    19  * Phwittr レイアウトセット 
     19 * Phwittr Self Interceptor 
    2020 * 
    2121 * @package    Phwittr_PieceFramework 
     
    2424 * @since      Class available since Release 0.1.0 
    2525 */ 
    26 class Phwittr_Interceptor_LayoutSetter extends Piece_Unity_Plugin_Common 
     26class Phwittr_Interceptor_Self extends Piece_Unity_Plugin_Common 
    2727{ 
    2828 
     
    6161    public function invoke() 
    6262    { 
    63         $viewElement = $this->_context->getViewElement(); 
    6463        $service = new Piece_Unity_Service_Authentication(); 
     64        if ($service->isAuthenticated()) { 
     65            $self = $this->_context->getSession()->getAttribute('self'); 
     66        } else { 
     67            $self = null; 
     68        } 
    6569 
    66         if ($service->isAuthenticated()) { 
    67             $viewElement->setElement('isAuthenticated', true); 
    68         } else { 
    69             $viewElement->setElement('isAuthenticated', false); 
    70         } 
     70        $this->_context->setAttributeByRef('self', $self); 
     71        $this->_context->getViewElement()->setElementByRef('self', $self); 
    7172 
    7273        return true;