ProfileController.php

00001 <?php
00009 class User_ProfileController extends Dsao_Controller_Action
00010 {
00014   protected $_userProfile = null;
00015 
00021   public function postDispatch()
00022   {
00023     // Profildaten übergeben
00024     $this->getView()->assign
00025       ('userProfileUser', $this->_userProfile);
00026   }
00027 
00028   public function preDispatch()
00029   {
00030     $this->_setDefaultModelClass('User_Profile')
00031       ->getHelper('History')->setAddToHistory();
00032 
00033     // Benutzerobjekt erzeugen
00034     $this->_userProfile = new Dsao_User();
00035   }
00036 
00045   public function editAction()
00046   {
00047     // Referenz auf Objekt in Registry
00048     $this->_userProfile = $this->getUser();
00049 
00050     // Layouts uebergeben
00051     $this->getView()->assign('userProfileLayouts', $this->getView()->getLayouts());
00052 
00053     // Falls Formular nicht abgeschickt wurde oder kein Token vorhanden,
00054     // abbrechen
00055     if (!$this->getRequest()->isPost() || !$this->getHelper('SessionToken')->hasValidToken())
00056     {
00057       return true;
00058     }
00059 
00060     // array, Geaenderte Benutzerdaten
00061     $userDataChanged = $this->_getModel()->editProfile($this->getRequest(), $this->_userProfile);
00062 
00063     if ($userDataChanged['invalidCols'])
00064     {
00065       foreach ($userDataChanged['invalidCols'] as $col)
00066       {
00067         $this->getLog()->err
00068             ($this->getTranslate()->_('user_profile_edit_error_invalid_field').
00069               ': '.$this->getTranslate()->_('user_profile_show_'.$col.'_template'));
00070       }
00071     }
00072 
00073     // Falls Benutzerdaten veraendert wurden
00074     if ($userDataChanged['changedCols'])
00075     {
00076       // Bestaetigung anzeigen
00077       $this->getLog()->affirm('user_profile_edit_affirmation_changed');
00078     }
00079   }
00080 
00089   public function showAction()
00090   {
00091     // Falls ID uebergeben wurde, diese bei $_userProfile setzen
00092     if ($this->getUri()->id)
00093     {
00094       $this->_userProfile->setId($this->getUri()->id)->refresh();
00095     }
00096     // Ansonsten ID des angemeldeten Benutzers verwenden
00097     else
00098     {
00099       $this->_userProfile = $this->getUser();
00100     }
00101   }
00102 }

Erzeugt am Fri Sep 18 19:04:11 2009 für DSA online - Morgendaemmerung von  doxygen 1.5.7.1