Ejemplo n.º 1
0
 /**
  * @return array
  */
 protected function getProfileFields()
 {
     //TODO gender enum
     $postcode = new RegexTextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $postcode->setRegex($this->postcodeRegex);
     $fields = array(new HeaderField('ProfileHeader', _t('Profileable.PROFILE', 'Profile')), new OptionsetField('Gender', _t('Profileable.GENDER', 'Gender'), array('m' => _t('Profileable.MASCULINE', 'masculine'), 'f' => _t('Profileable.FEMININE', 'feminine'), 'u' => _t('Profileable.UNKNOWN', 'unknown')), 'u'), new TextField('AcademicTitle', _t('Profileable.ACADEMICTITLE', 'Name')), new TextField('ProfileName', _t('Profileable.NAME', 'Name')), new TextField('Company', _t('Profileable.COMPANY', 'Company')), new TextField('Position', _t('Profileable.POSITION', 'Position')), new TextField('Address', _t('Addressable.ADDRESS', 'Address')), new TextField('AddressAddition', _t('Profileable.ADDRESSADDITION', 'Address Addition')), $postcode, new TextField('City', _t('Profileable.CITY', 'City')), new TextField('Suburb', _t('Addressable.SUBURB', 'Suburb')));
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields[] = new DropdownField('State', $label, $this->allowedStates);
     } elseif (!is_string($this->allowedStates)) {
         $fields[] = new TextField('State', $label);
     }
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $fields[] = new DropdownField('Country', $label, $this->allowedCountries);
     } elseif (!is_string($this->allowedCountries)) {
         $fields[] = new CountryDropdownField('Country', $label);
     }
     $fields[] = new TextField('Phone', _t('Profileable.PHONE', 'Phone'));
     $fields[] = new TextField('Fax', _t('Profileable.FAX', 'Fax'));
     $fields[] = new EmailField('ProfileEmail', _t('Profileable.EMAIL', 'E-Mail'));
     $fields[] = new TextField('Www', _t('Profileable.WWW', 'Homepage'));
     $profileUpload = new UploadField('ProfilePicture', _t('Profileable.PROFILEPICTURE', 'Profile Picture'));
     $profileUpload->allowedExtensions = self::$ProfilePictureAllowedTypes;
     $profileUpload->setFolderName(self::$ProfilePictureFolder);
     $profileUpload->setConfig('allowedMaxFileNumber', 1);
     $fields[] = $profileUpload;
     $fields[] = new TextareaField('Description', _t('Profileable.DESCRIPTION', 'Description'));
     return $fields;
 }
 /**
  * @return array
  */
 public function getAddressFields($_params = array())
 {
     $params = array_merge(array('includeHeader' => true), (array) $_params);
     $fields = array(new TextField('Address', _t('Addressable.ADDRESS', 'Address')), new TextField('Suburb', _t('Addressable.SUBURB', 'Suburb')));
     if ($params['includeHeader']) {
         array_unshift($fields, new HeaderField('AddressHeader', _t('Addressable.ADDRESSHEADER', 'Address')));
     }
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields[] = new DropdownField('State', $label, $this->allowedStates);
     } elseif (!is_string($this->allowedStates)) {
         $fields[] = new TextField('State', $label);
     }
     $postcode = new RegexTextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $postcode->setRegex($this->postcodeRegex);
     $fields[] = $postcode;
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $fields[] = new DropdownField('Country', $label, $this->allowedCountries);
     } elseif (!is_string($this->allowedCountries)) {
         $fields[] = new CountryDropdownField('Country', $label);
     }
     $this->owner->extend("updateAddressFields", $fields);
     return $fields;
 }
 public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
 {
     parent::__construct($name, $title, $value, $maxLength, $form);
 }
 /**
  * @return array
  */
 protected function getAddressFields()
 {
     $fields = array(new HeaderField('AddressHeader', _t('Addressable.ADDRESSHEADER', 'Address')), new TextField('Address', _t('Addressable.ADDRESS', 'Address')), new TextField('Suburb', _t('Addressable.SUBURB', 'Suburb')));
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields[] = new DropdownField('State', $label, $this->allowedStates);
     } elseif (!is_string($this->allowedStates)) {
         $fields[] = new TextField('State', $label);
     }
     $postcode = new RegexTextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $postcode->setRegex($this->postcodeRegex);
     $fields[] = $postcode;
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $fields[] = new DropdownField('Country', $label, $this->allowedCountries);
     } elseif (!is_string($this->allowedCountries)) {
         $fields[] = new CountryDropdownField('Country', $label);
     }
     return $fields;
 }