コード例 #1
0
ファイル: Iprange.php プロジェクト: alexukua/opus4
 /**
  * Initialize model with the following fields:
  * - staringip
  * - endingip
  * - Name
  *
  * @return void
  */
 protected function _init()
 {
     $startingip = new Opus_Model_Field('Startingip');
     $endingip = new Opus_Model_Field('Endingip');
     $name = new Opus_Model_Field('Name');
     $role = new Opus_Model_Field('Role');
     $startingip->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setValidator(new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_IP));
     $endingip->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setValidator(new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_IP));
     $role->setMultiplicity('*')->setDefault(Opus_UserRole::getAll())->setSelection(true);
     $this->addField($startingip)->addField($endingip)->addField($name)->addField($role);
 }
コード例 #2
0
ファイル: Account.php プロジェクト: alexukua/opus4
 /**
  * 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);
 }
コード例 #3
0
ファイル: Collection.php プロジェクト: alexukua/opus4
 /**
  * Sets up field by analyzing collection content table metadata.
  *
  * @return void
  */
 protected function _init()
 {
     $fields = array('Number', 'Name', 'OaiSubset', 'RoleId', 'Role', 'RoleName', 'RoleDisplayFrontdoor', 'RoleVisibleFrontdoor', 'DisplayFrontdoor', 'VisiblePublish');
     foreach ($fields as $field) {
         $field = new Opus_Model_Field($field);
         $this->addField($field);
     }
     $visible = new Opus_Model_Field('Visible');
     $visible->setCheckbox(true);
     $this->addField($visible);
     // Add a field to hold collection specific theme.
     $theme = new Opus_Model_Field('Theme');
     $theme->setSelection(true);
     $this->addField($theme);
     /**
      * External fields.
      */
     $children = new Opus_Model_Field('Children');
     $children->setMultiplicity('*');
     $this->addField($children);
     // Contains the path back to the root node.
     $parents = new Opus_Model_Field('Parents');
     $parents->setMultiplicity('*');
     $this->addField($parents);
     /*
      * Fields used to define the position of new nodes.
      */
     $positionKeys = array('Root', 'FirstChild', 'LastChild', 'NextSibling', 'PrevSibling');
     $positionKey = new Opus_Model_Field('PositionKey');
     $positionKey->setDefault($positionKeys);
     $this->addField($positionKey);
     $positionId = new Opus_Model_Field('PositionId');
     $this->addField($positionId);
     $pending_nodes = new Opus_Model_Field('PendingNodes');
     $pending_nodes->setMultiplicity('*');
     $this->addField($pending_nodes);
 }
コード例 #4
0
ファイル: Document.php プロジェクト: alexukua/opus4
 /**
  * Initialize the document's fields.  The language field needs special
  * treatment to initialize the default values.
  *
  * @return void
  */
 protected function _init()
 {
     $fields = array("CompletedDate", "CompletedYear", "ContributingCorporation", "CreatingCorporation", "ThesisDateAccepted", "ThesisYearAccepted", "Edition", "Issue", "Language", "PageFirst", "PageLast", "PageNumber", "PublishedDate", "PublishedYear", "PublisherName", "PublisherPlace", "PublicationState", "ServerDateCreated", "ServerDateModified", "ServerDatePublished", "ServerDateDeleted", "ServerState", "Type", "Volume", "BelongsToBibliography", "EmbargoDate");
     foreach ($fields as $fieldname) {
         if (isset($this->_externalFields[$fieldname])) {
             throw new Exception("Field {$fieldname} exists in _externalFields");
         }
         $field = new Opus_Model_Field($fieldname);
         $this->addField($field);
     }
     foreach (array_keys($this->_externalFields) as $fieldname) {
         $field = new Opus_Model_Field($fieldname);
         $field->setMultiplicity('*');
         $this->addField($field);
     }
     // Initialize available date fields and set up date validator
     // if the particular field is present
     $dateFields = array('ThesisDateAccepted', 'CompletedDate', 'PublishedDate', 'ServerDateCreated', 'ServerDateModified', 'ServerDatePublished', 'ServerDateDeleted', 'EmbargoDate');
     foreach ($dateFields as $fieldName) {
         $this->getField($fieldName)->setValueModelClass('Opus_Date');
     }
     $this->initFieldOptionsForDisplayAndValidation();
 }