Overview

Packages

  • alpha::controller
  • alpha::controller::front
  • alpha::exceptions
  • alpha::model
  • alpha::model::types
  • alpha::tasks
  • alpha::tests
  • alpha::util
  • alpha::util::cache
  • alpha::util::codehighlight
  • alpha::util::convertors
  • alpha::util::feeds
  • alpha::util::filters
  • alpha::util::graphs
  • alpha::util::helpers
  • alpha::util::metrics
  • alpha::util::search
  • alpha::view
  • alpha::view::renderers
  • alpha::view::widgets

Classes

  • AlphaView
  • ArticleCommentView
  • ArticleView
  • DEnumView
  • PersonView
  • SequenceView
  • ViewState
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  1: <?php
  2: 
  3: /**
  4:  *
  5:  * The rendering class for the PersonObject class
  6:  *
  7:  * @package alpha::view
  8:  * @since 1.0
  9:  * @author John Collins <dev@alphaframework.org>
 10:  * @version $Id: PersonView.inc 1745 2014-03-29 15:19:05Z alphadevx $
 11:  * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
 12:  * @copyright Copyright (c) 2014, John Collins (founder of Alpha Framework).
 13:  * All rights reserved.
 14:  *
 15:  * <pre>
 16:  * Redistribution and use in source and binary forms, with or
 17:  * without modification, are permitted provided that the
 18:  * following conditions are met:
 19:  *
 20:  * * Redistributions of source code must retain the above
 21:  *   copyright notice, this list of conditions and the
 22:  *   following disclaimer.
 23:  * * Redistributions in binary form must reproduce the above
 24:  *   copyright notice, this list of conditions and the
 25:  *   following disclaimer in the documentation and/or other
 26:  *   materials provided with the distribution.
 27:  * * Neither the name of the Alpha Framework nor the names
 28:  *   of its contributors may be used to endorse or promote
 29:  *   products derived from this software without specific
 30:  *   prior written permission.
 31:  *
 32:  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 33:  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 34:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 35:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 36:  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 37:  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 38:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 39:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 40:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 41:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 42:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 43:  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 44:  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 45:  * </pre>
 46:  *
 47:  */
 48: class PersonView extends AlphaView {
 49: 
 50:     /**
 51:      * Method to render the login HTML form
 52:      *
 53:      * @return string
 54:      * @since 1.0
 55:      */
 56:     public function displayLoginForm() {
 57:         global $config;
 58: 
 59:         $html = '<div class="bordered padded">';
 60:         $html .= "<h1>Login</h1>";
 61:         $html .= '<form action="'.FrontController::generateSecureURL('act=Login&no-forceframe=true').'" method="POST" id="loginForm" accept-charset="UTF-8">';
 62: 
 63:         $email = new String(isset($_POST['email']) ? $_POST['email'] : '');
 64:         $email->setRule(AlphaValidator::REQUIRED_EMAIL);
 65:         $email->setSize(70);
 66:         $email->setHelper('Please provide a valid e-mail address!');
 67:         $stringBox = new StringBox($email, $this->BO->getDataLabel('email'), 'email', 'loginForm', '50');
 68:         $html .= $stringBox->render();
 69: 
 70:         $password = new String();
 71:         $password->isPassword();
 72: 
 73:         $stringBox = new StringBox($password, $this->BO->getDataLabel('password'), 'password', 'loginForm', '50');
 74:         $html .= $stringBox->render();
 75: 
 76:         $temp = new Button('submit', 'Login', 'loginBut');
 77:         $html .= '<div class="centered">'.$temp->render(80).'</div>';
 78: 
 79:         $html .= $this->renderSecurityFields();
 80: 
 81:         $html .= '</form>';
 82: 
 83:         $html .= '<p><a href="'.FrontController::generateSecureURL('act=Login&reset=true&no-forceframe=true').'">Forgotten your password?</a></p>';
 84:         $html .= '</div>';
 85: 
 86:         return $html;
 87:     }
 88: 
 89:     /**
 90:      * Method to render the reset password HTML form
 91:      *
 92:      * @return string
 93:      * @since 1.0
 94:      */
 95:     public function displayResetForm() {
 96:         global $config;
 97: 
 98:         $html = '<div class="bordered padded">';
 99:         $html .= '<h1>Password reset</h1>';
100:         $html .= '<p>If you have forgotten your password, you can use this form to have a new password automatically generated and sent to your e-mail address.</p>';
101:         $html .= '<form action="'.FrontController::generateSecureURL('act=Login&reset=true&no-forceframe=true').'" method="POST" id="resetForm" accept-charset="UTF-8">';
102: 
103:         $email = new String(isset($_POST['email']) ? $_POST['email'] : '');
104:         $email->setRule(AlphaValidator::REQUIRED_EMAIL);
105:         $email->setSize(70);
106:         $email->setHelper('Please provide a valid e-mail address!');
107:         $stringBox = new StringBox($email, $this->BO->getDataLabel('email'), 'email', 'resetForm', '50');
108:         $html .= $stringBox->render();
109: 
110:         $html .= '<div class="form-group lower spread">';
111: 
112:         $temp = new Button('submit', 'Reset Password', 'resetBut');
113:         $html .= $temp->render();
114: 
115:         $temp = new Button("document.location.replace('".$config->get('app.url')."')", 'Cancel', 'cancelBut');
116:         $html .= $temp->render();
117: 
118:         $html .= '</div>';
119: 
120:         $html .= $this->renderSecurityFields();
121: 
122:         $html .= '</form>';
123:         $html .= '</div>';
124: 
125:         return $html;
126:     }
127: 
128:     /**
129:      * Method to render the user registration form
130:      *
131:      * @return string
132:      * @since 1.0
133:      */
134:     public function displayRegisterForm() {
135:         global $config;
136: 
137:         $html = '<p>In order to access this site, you will need to create a user account.  In order to do so, please provide a valid email address below and a password will be sent to your inbox shortly (you can change your password once you log in).</p>';
138:         $html .= '<table cols="2">';
139:         $html .= '<form action="'.$_SERVER["PHP_SELF"].'?reset=true" method="POST" accept-charset="UTF-8">';
140:         $html .= '<tr>';
141:         if($config->get('security.encrypt.http.fieldnames'))
142:             $fieldname = base64_encode(AlphaSecurityUtils::encrypt('displayname'));
143:         else
144:             $fieldname = 'displayname';
145:         $html .= '  <td>Forum name</td> <td><input type="text" name="'.$fieldname.'" size="50" value="'.(isset($_POST[$fieldname])? $_POST[$fieldname] : '').'"/></td>';
146:         $html .= '</tr>';
147:         $html .= '<tr>';
148:         if($config->get('security.encrypt.http.fieldnames'))
149:             $fieldname = base64_encode(AlphaSecurityUtils::encrypt('email'));
150:         else
151:             $fieldname = 'email';
152:         $html .= '  <td>E-mail Address</td> <td><input type="text" name="'.$fieldname.'" size="50" value="'.(isset($_POST[$fieldname])? $_POST[$fieldname] : '').'"/></td>';
153:         $html .= '</tr>';
154:         $html .= '<tr><td colspan="2">';
155:         $temp = new Button("submit","Register","registerBut");
156:         $html .= $temp->render();
157:         $html .= '&nbsp;&nbsp;';
158:         $temp = new Button("document.location.replace('".$config->get('app.url')."')","Cancel","cancelBut");
159:         $html .= $temp->render();
160:         $html .= '</td></tr>';
161: 
162:         $html .= $this->renderSecurityFields();
163: 
164:         $html .= '</form>';
165:         $html .= '</table>';
166: 
167:         return $html;
168:     }
169: }
170: 
171: ?>
Alpha Framework 1.2.4 API Documentation API documentation generated by ApiGen 2.8.0