Alpha Framework alpha--view
[ class tree: alpha--view ] [ index: alpha--view ] [ all elements ]

Source for file PersonView.inc

Documentation is available at PersonView.inc

  1. <?php
  2.  
  3. require_once $config->get('sysRoot').'alpha/model/PersonObject.inc';
  4. require_once $config->get('sysRoot').'alpha/view/AlphaView.inc';
  5.  
  6. /**
  7.  *
  8.  * The rendering class for the PersonObject class
  9.  * 
  10.  * @package alpha::view
  11.  * @since 1.0
  12.  * @author John Collins <dev@alphaframework.org>
  13.  * @version $Id: PersonView.inc 1341 2011-03-17 15:02:02Z johnc $
  14.  * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
  15.  * @copyright Copyright (c) 2011, John Collins (founder of Alpha Framework).
  16.  *  All rights reserved.
  17.  * 
  18.  *  <pre>
  19.  *  Redistribution and use in source and binary forms, with or
  20.  *  without modification, are permitted provided that the
  21.  *  following conditions are met:
  22.  * 
  23.  *  * Redistributions of source code must retain the above
  24.  *    copyright notice, this list of conditions and the
  25.  *    following disclaimer.
  26.  *  * Redistributions in binary form must reproduce the above
  27.  *    copyright notice, this list of conditions and the
  28.  *    following disclaimer in the documentation and/or other
  29.  *    materials provided with the distribution.
  30.  *  * Neither the name of the Alpha Framework nor the names
  31.  *    of its contributors may be used to endorse or promote
  32.  *    products derived from this software without specific
  33.  *    prior written permission.
  34.  *   
  35.  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  36.  *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  37.  *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  38.  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39.  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  40.  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41.  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  42.  *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  43.  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  44.  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  45.  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  46.  *  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  47.  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  48.  *  </pre>
  49.  *  
  50.  */
  51. class PersonView extends AlphaView {
  52.     
  53.     /**
  54.      * Method to render the login HTML form
  55.      * 
  56.      * @return string 
  57.      * @since 1.0
  58.      */
  59.     public function displayLoginForm({
  60.         global $config;
  61.         
  62.         $html '<div class="bordered" style="text-align:center; padding:10px; margin:10px;">';
  63.         $html .= '<form action="'.FrontController::generateSecureURL('act=Login&no-forceframe=true').'" method="POST" id="loginForm">';
  64.         $html .= '<table cols="2" align="center">';
  65.         $html .= '<tr>';
  66.         $stringBox new StringBox(new String(isset($_POST["email"])$_POST["email"'')$this->BO->getDataLabel('email')'email''loginForm''50');
  67.         $html .= $stringBox->render(true);
  68.         $html .= '</tr>';
  69.         $html .= '<tr>';
  70.         $password new String();
  71.         $password->isPassword();
  72.         $stringBox new StringBox($password$this->BO->getDataLabel('password')'password''loginForm''50');
  73.         $html .= $stringBox->render(true);
  74.         $html .= '</tr>';
  75.         $html .= '<tr><td colspan="2">';
  76.         $temp new Button("submit","Login","loginBut");
  77.         $html .= '<div align="center">'.$temp->render(80).'</div>';
  78.         $html .= '</td></tr>';
  79.         
  80.         $html .= $this->renderSecurityFields();
  81.         
  82.         $html .= '</table>';
  83.         $html .= '</form>';
  84.         
  85.         $html .= '<p><a href="'.FrontController::generateSecureURL('act=Login&reset=true&no-forceframe=true').'">Forgotten your password?</a></p>';
  86.         $html .= '</div>';
  87.         
  88.         return $html;
  89.     }
  90.     
  91.     /**
  92.      * Method to render the reset password HTML form
  93.      * 
  94.      * @return string 
  95.      * @since 1.0
  96.      */
  97.     public function displayResetForm({
  98.         global $config;
  99.         
  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 .= '<table cols="2">';
  102.         $html .= '<form action="'.FrontController::generateSecureURL('act=Login&reset=true&no-forceframe=true').'" method="POST">';
  103.         $html .= '<tr>';
  104.         $html .= '    <td>E-mail Address</td> <td><input type="text" name="email" size="50" value="'.(isset($_POST["email"])$_POST["email"'').'"/></td>';
  105.         $html .= '</tr>';        
  106.         $html .= '<tr><td colspan="2">';
  107.         $temp new Button("submit","Reset Password","resetBut");
  108.         $html .= $temp->render();
  109.         $html .= '&nbsp;&nbsp;';
  110.         $temp new Button("document.location.replace('".$config->get('sysURL')."')","Cancel","cancelBut");
  111.         $html .= $temp->render();
  112.         $html .= '</td></tr>';
  113.         
  114.         $html .= $this->renderSecurityFields();
  115.         
  116.         $html .= '</form>';
  117.         $html .= '</table>';
  118.         
  119.         return $html;
  120.     }
  121.     
  122.     /**
  123.      * Method to render the user registration form
  124.      * 
  125.      * @return string 
  126.      * @since 1.0
  127.      */
  128.     public function displayRegisterForm({
  129.         global $config;
  130.         
  131.         $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>';
  132.         $html .= '<p class="warning">Please note: the forum is currently not available, but will be made available in the coming weeks!</p>';
  133.         $html .= '<table cols="2">';
  134.         $html .= '<form action="'.$_SERVER["PHP_SELF"].'?reset=true" method="POST">';
  135.         $html .= '<tr>';
  136.         $html .= '    <td>Forum name</td> <td><input type="text" name="displayname" size="50" value="'.(isset($_POST["displayname"])$_POST["displayname"'').'"/></td>';
  137.         $html .= '</tr>';
  138.         $html .= '<tr>';
  139.         $html .= '    <td>E-mail Address</td> <td><input type="text" name="email" size="50" value="'.(isset($_POST["email"])$_POST["email"'').'"/></td>';
  140.         $html .= '</tr>';        
  141.         $html .= '<tr><td colspan="2">';
  142.         $temp new Button("submit","Register","registerBut");
  143.         $html .= $temp->render();
  144.         $html .= '&nbsp;&nbsp;';
  145.         $temp new Button("document.location.replace('".$config->get('sysURL')."')","Cancel","cancelBut");
  146.         $html .= $temp->render();
  147.         $html .= '</td></tr>';
  148.         
  149.         $html .= $this->renderSecurityFields();
  150.         
  151.         $html .= '</form>';
  152.         $html .= '</table>';
  153.         
  154.         return $html;
  155.     }
  156. }
  157.  
  158. ?>

Documentation generated on Thu, 17 Mar 2011 16:44:37 +0000 by phpDocumentor 1.4.3