pages/user/ProfileHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.user.UserHandler');
00018 
00019 class ProfileHandler extends UserHandler {
00023    function ProfileHandler() {
00024       parent::UserHandler();
00025    }
00026 
00030    function profile() {
00031       $this->validate();
00032       $this->setupTemplate(true);
00033 
00034       import('user.form.ProfileForm');
00035 
00036       $profileForm = new ProfileForm();
00037       if ($profileForm->isLocaleResubmit()) {
00038          $profileForm->readInputData();
00039       } else {
00040          $profileForm->initData();
00041       }
00042       $profileForm->display();
00043    }
00044 
00048    function saveProfile() {
00049       $this->validate();
00050       $this->setupTemplate();
00051       $dataModified = false;
00052 
00053       import('user.form.ProfileForm');
00054 
00055       $profileForm = new ProfileForm();
00056       $profileForm->readInputData();
00057 
00058       if (Request::getUserVar('uploadProfileImage')) {
00059          if (!$profileForm->uploadProfileImage()) {
00060             $profileForm->addError('profileImage', __('user.profile.form.profileImageInvalid'));
00061          }
00062          $dataModified = true;
00063       } else if (Request::getUserVar('deleteProfileImage')) {
00064          $profileForm->deleteProfileImage();
00065          $dataModified = true;
00066       }
00067 
00068       if (!$dataModified && $profileForm->validate()) {
00069          $profileForm->execute();
00070          Request::redirect(null, null, Request::getRequestedPage());
00071       } else {
00072          $profileForm->display();
00073       }
00074    }
00075 
00079    function changePassword() {
00080       $this->validate();
00081       $this->setupTemplate(true);
00082 
00083       import('user.form.ChangePasswordForm');
00084 
00085       if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
00086          $passwordForm = new ChangePasswordForm();
00087       } else {
00088          $passwordForm =& new ChangePasswordForm();
00089       }
00090       $passwordForm->initData();
00091       $passwordForm->display();
00092    }
00093 
00097    function savePassword() {
00098       $this->validate();
00099       $this->setupTemplate(true);
00100 
00101       import('user.form.ChangePasswordForm');
00102 
00103       if (checkPhpVersion('5.0.0')) { // WARNING: This form needs $this in constructor
00104          $passwordForm = new ChangePasswordForm();
00105       } else {
00106          $passwordForm =& new ChangePasswordForm();
00107       }
00108       $passwordForm->readInputData();
00109 
00110       $this->setupTemplate(true);
00111       if ($passwordForm->validate()) {
00112          $passwordForm->execute();
00113          Request::redirect(null, null, Request::getRequestedPage());
00114       } else {
00115          $passwordForm->display();
00116       }
00117    }
00118 
00119 }
00120 
00121 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7