Ejemplo n.º 1
0
 public function postCheckin()
 {
     $this->loadVisitor();
     $this->visitor->firstname = ucwords(trim($_POST['first_name']));
     $this->visitor->lastname = ucwords(trim($_POST['last_name']));
     // If set to ask for birthdate, save visitor's birthdate
     if (PHPWS_Settings::get('checkin', 'birthdate')) {
         if (PHPWS_Form::testDate('birthdate')) {
             $this->visitor->birthdate = PHPWS_Form::getPostedDate('birthdate');
         } else {
             $this->message[] = dgettext('checkin', 'Please enter a valid birthdate');
         }
     }
     // If set to ask for gender, save visitor's gender
     if (PHPWS_Settings::get('checkin', 'gender')) {
         if (isset($_POST['gender'])) {
             $this->visitor->gender = $_POST['gender'];
         } else {
             $this->message[] = dgettext('checkin', 'Please enter a gender');
         }
     }
     if (isset($_POST['reason_id'])) {
         if ($_POST['reason_id'] == 0) {
             $this->message[] = dgettext('checkin', 'Please enter the reason for your visit.');
         }
         $this->visitor->reason = (int) $_POST['reason_id'];
     }
     if (empty($this->visitor->firstname)) {
         $this->message[] = dgettext('checkin', 'Please enter your first name.');
     }
     if (empty($this->visitor->lastname)) {
         $this->message[] = dgettext('checkin', 'Please enter your last name.');
     }
     if (!empty($_POST['email'])) {
         $this->visitor->email = strip_tags(trim($_POST['email']));
     }
     $this->visitor->assign();
     return empty($this->message);
 }