Ejemplo n.º 1
0
 /**
  * Constructor for the class that populates all of the complex types with default values.
  *
  * @since 1.0
  */
 public function __construct()
 {
     self::$logger = new Logger('Person');
     self::$logger->debug('>>__construct()');
     // ensure to call the parent constructor
     parent::__construct();
     $this->displayName = new String();
     $this->displayName->setRule(Validator::REQUIRED_USERNAME);
     $this->displayName->setSize(70);
     $this->displayName->setHelper('Please provide a name for display on the website (only letters, numbers, and .-_ characters are allowed!).');
     $this->email = new String();
     $this->email->setRule(Validator::REQUIRED_EMAIL);
     $this->email->setSize(70);
     $this->email->setHelper('Please provide a valid e-mail address as your username.');
     $this->password = new String();
     $this->password->setSize(70);
     $this->password->setHelper('Please provide a password for logging in.');
     $this->password->isPassword(true);
     $this->state = new Enum(array('Active', 'Disabled'));
     $this->state->setValue('Active');
     $this->URL = new String();
     $this->URL->setRule(Validator::OPTIONAL_HTTP_URL);
     $this->URL->setHelper('URLs must be in the format http://some_domain/ or left blank!');
     // add unique keys to displayName and email (which is effectively the username in Alpha)
     $this->markUnique('displayName');
     $this->markUnique('email');
     $this->rights = new Relation();
     $this->markTransient('rights');
     $this->actions = new Relation();
     $this->markTransient('actions');
     $this->setupRels();
     self::$logger->debug('<<__construct');
 }
Ejemplo n.º 2
0
 /**
  * The constructor which sets up some housekeeping attributes.
  *
  * @since 1.0
  */
 public function __construct()
 {
     self::$logger = new Logger('Article');
     // ensure to call the parent constructor
     parent::__construct();
     $this->title = new String();
     $this->title->setHelper('Please provide a title for the article.');
     $this->title->setSize(100);
     $this->title->setRule("/\\w+/");
     $this->section = new DEnum('Alpha\\Model\\Article::section');
     $this->description = new String();
     $this->description->setHelper('Please provide a brief description of the article.');
     $this->description->setSize(200);
     $this->description->setRule("/\\w+/");
     $this->bodyOnload = new String();
     $this->content = new Text();
     $this->headerContent = new Text();
     $this->author = new String();
     $this->author->setHelper('Please state the name of the author of this article');
     $this->author->setSize(70);
     $this->author->setRule("/\\w+/");
     $this->published = new Boolean(0);
     $this->comments = new Relation();
     $this->markTransient('comments');
     $this->votes = new Relation();
     $this->markTransient('votes');
     $this->tags = new Relation();
     $this->markTransient('tags');
     $this->URL = '';
     $this->printURL = '';
     // mark the URL attributes as transient
     $this->markTransient('URL');
     $this->markTransient('printURL');
     // mark title as unique
     $this->markUnique('title');
     $this->markTransient('filePath');
     $this->markTransient('taggedAttributes');
     $this->setupRels();
 }
Ejemplo n.º 3
0
 /**
  * Method to render the reset password HTML form.
  *
  * @return string
  *
  * @since 1.0
  */
 public function displayResetForm()
 {
     $config = ConfigProvider::getInstance();
     $html = '<div class="bordered padded">';
     $html .= '<h1>Password reset</h1>';
     $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>';
     $html .= '<form action="' . FrontController::generateSecureURL('act=Alpha\\Controller\\LoginController&reset=true') . '" method="POST" id="resetForm" accept-charset="UTF-8">';
     $request = new Request(array('method' => 'GET'));
     $email = new String($request->getParam('email', ''));
     $email->setRule(Validator::REQUIRED_EMAIL);
     $email->setSize(70);
     $email->setHelper('Please provide a valid e-mail address!');
     $stringBox = new StringBox($email, $this->BO->getDataLabel('email'), 'email', 'resetForm', '50');
     $html .= $stringBox->render();
     $html .= '<div class="form-group lower spread">';
     $temp = new Button('submit', 'Reset Password', 'resetBut');
     $html .= $temp->render();
     $temp = new Button("document.location.replace('" . $config->get('app.url') . "')", 'Cancel', 'cancelBut');
     $html .= $temp->render();
     $html .= '</div>';
     $html .= $this->renderSecurityFields();
     $html .= '</form>';
     $html .= '</div>';
     return $html;
 }