Exemplo n.º 1
0
 /**
  * Initialize model with the following fields:
  * - Language
  * - Title
  *
  * @return void
  */
 protected function _init()
 {
     $message = new Opus_Model_Field('Message');
     $message->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setTextarea(true);
     $visibility = new Opus_Model_Field('Visibility');
     $visibility->setValidator(new Opus_Validate_NoteVisibility())->setDefault(array('private' => 'private', 'public' => 'public'))->setSelection(true);
     $this->addField($visibility)->addField($message);
 }
Exemplo n.º 2
0
 /**
  * Initialize model with the following fields:
  * - Language
  * - Title
  *
  * @return void
  */
 protected function _init()
 {
     $countries = new Opus_Model_Field('Countries');
     $dateGranted = new Opus_Model_Field('DateGranted');
     $dateGranted->setValueModelClass('Opus_Date');
     $number = new Opus_Model_Field('Number');
     $number->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $yearApplied = new Opus_Model_Field('YearApplied');
     $yearApplied->setValidator(new Opus_Validate_Year());
     $application = new Opus_Model_Field('Application');
     $this->addField($countries)->addField($dateGranted)->addField($number)->addField($yearApplied)->addField($application);
 }
Exemplo n.º 3
0
 /**
  * Initialize model with fields.
  *
  * @return void
  */
 protected function _init()
 {
     $title = new Opus_Model_Field('Title');
     $title->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $infobox = new Opus_Model_Field('Infobox');
     $infobox->setTextarea(true);
     $visible = new Opus_Model_Field('Visible');
     $visible->setCheckbox(true);
     $sortOrder = new Opus_Model_Field('SortOrder');
     $sortOrder->setValidator(new Zend_Validate_Int());
     $this->addField($title)->addField($infobox)->addField($visible)->addField($sortOrder);
 }
Exemplo n.º 4
0
 /**
  * Initialize model by adding the corresponding fields
  * Year, Month, Day, Hour, Minute, Second, Timezone, and UnixTimestamp.
  *
  * @return void
  */
 protected function _init()
 {
     $fields = array('Year', 'Month', 'Day', 'Hour', 'Minute', 'Second');
     foreach ($fields as $fieldName) {
         $field = new Opus_Model_Field($fieldName);
         $field->setValidator(new Zend_Validate_Int());
         $this->addField($field);
     }
     $field = new Opus_Model_Field('Timezone');
     $this->addField($field);
     $field = new Opus_Model_Field('UnixTimestamp');
     $this->addField($field);
 }
Exemplo n.º 5
0
 /**
  * Initialize model with the following fields:
  * - AcademicTitle
  * - Email
  * - FirstName
  * - LastName
  *
  * @return void
  */
 protected function _init()
 {
     $title = new Opus_Model_Field('AcademicTitle');
     $first_name = new Opus_Model_Field('FirstName');
     $last_name = new Opus_Model_Field('LastName');
     $last_name->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty());
     $date_of_birth = new Opus_Model_Field('DateOfBirth');
     $date_of_birth->setValueModelClass('Opus_Date');
     $place_of_birth = new Opus_Model_Field('PlaceOfBirth');
     $email = new Opus_Model_Field('Email');
     $email->setValidator(new Zend_Validate_EmailAddress());
     $identifier_orcid = new Opus_Model_Field('IdentifierOrcid');
     $identifier_gnd = new Opus_Model_Field('IdentifierGnd');
     $identifier_misc = new Opus_Model_Field('IdentifierMisc');
     $this->addField($title)->addField($first_name)->addField($last_name)->addField($date_of_birth)->addField($place_of_birth)->addField($identifier_orcid)->addField($identifier_gnd)->addField($identifier_misc)->addField($email);
 }
Exemplo n.º 6
0
 /**
  * Initialize model with the following fields:
  * - Username
  * - Password
  *
  * @return void
  */
 protected function _init()
 {
     $login = new Opus_Model_Field('Login');
     $loginValidator = new Zend_Validate();
     $loginValidator->addValidator(new Zend_Validate_Regex('/^[A-Za-z0-9@._-]+$/'));
     $login->setValidator($loginValidator)->setMandatory(true);
     $password = new Opus_Model_Field('Password');
     $password->setMandatory(true);
     $email = new Opus_Model_Field('Email');
     $emailValidator = new Zend_Validate();
     $emailValidator->addValidator(new Zend_Validate_EmailAddress());
     $email->setMandatory(true);
     $first_name = new Opus_Model_Field('FirstName');
     $last_name = new Opus_Model_Field('LastName');
     $role = new Opus_Model_Field('Role');
     $role->setMultiplicity('*');
     $role->setSelection(true);
     $this->addField($login)->addField($password)->addField($email)->addField($first_name)->addField($last_name)->addField($role);
 }