/** * Initialize model with the following fields: * - Language * - Title * * @return void */ protected function _init() { $language = new Opus_Model_Field('Language'); if (Zend_Registry::isRegistered('Available_Languages') === true) { $language->setDefault(Zend_Registry::get('Available_Languages')); } $language->setSelection(true); $language->setMandatory(true); $value = new Opus_Model_Field('Value'); $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty())->setTextarea(true); $type = new Opus_Model_Field('Type'); $type->setMandatory(false); $type->setSelection(true); $type->setDefault(array('main' => 'main', 'parent' => 'parent', 'sub' => 'sub', 'additional' => 'additional')); $this->addField($language)->addField($value)->addField($type); }
/** * Initialize model with the following fields: * - Language * - Type * - Value * - External key * * @return void */ protected function _init() { $language = new Opus_Model_Field('Language'); if (Zend_Registry::isRegistered('Available_Languages') === true) { $language->setDefault(Zend_Registry::get('Available_Languages')); } $language->setSelection(true); $language->setMandatory(true); $type = new Opus_Model_Field('Type'); $type->setMandatory(true); $type->setSelection(true); $type->setDefault(array('swd' => 'swd', 'psyndex' => 'psyndex', 'uncontrolled' => 'uncontrolled')); $value = new Opus_Model_Field('Value'); $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty()); $externalKey = new Opus_Model_Field('ExternalKey'); $this->addField($language)->addField($type)->addField($value)->addField($externalKey); }
/** * Initialize model with the following fields: * - Value * - Label * * @return void */ protected function _init() { $value = new Opus_Model_Field('Value'); $value->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty()); $label = new Opus_Model_Field('Label'); $label->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty()); $relation = new Opus_Model_Field('Relation'); $relation->setMandatory(false); $relation->setSelection(true); $relation->setDefault(array('updates' => 'updates', 'updated-by' => 'updated-by', 'other' => 'other')); $type = new Opus_Model_Field('Type'); $type->setMandatory(false); // TODO change later $type->setSelection(true); $type->setDefault(array('isbn' => 'isbn', 'urn' => 'urn', 'doi' => 'doi', 'handle' => 'handle', 'url' => 'url', 'issn' => 'issn', 'std-doi' => 'std-doi', 'cris-link' => 'cris-link', 'splash-url' => 'splash-url', 'opus4-id' => 'opus4-id')); $this->addField($value); $this->addField($label); $this->addField($relation); $this->addField($type); }
/** * 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); }
/** * Initialize model with the following values: * - Institute * - Role * - SortOrder * * @return void */ protected function _init() { $modelClass = $this->_modelClass; if (is_null($this->getId()) === false) { $this->setModel(new $modelClass($this->_primaryTableRow->{$this->_modelKey})); } $role = new Opus_Model_Field('Role'); $role->setSelection(true); $role->setMandatory(false); // TODO change later maybe $role->setDefault(array('advisor' => 'advisor', 'author' => 'author', 'contributor' => 'contributor', 'editor' => 'editor', 'referee' => 'referee', 'other' => 'other', 'translator' => 'translator', 'submitter' => 'submitter')); $sortOrder = new Opus_Model_Field('SortOrder'); $allowEmailContact = new Opus_Model_Field('AllowEmailContact'); $allowEmailContact->setCheckbox(true); $this->addField($role)->addField($sortOrder)->addField($allowEmailContact); }
/** * 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); }
/** * Initialize model with the following fields: * - Active * - CommentInternal * - DescMarkup * - DescText * - Language * - LinkLicence * - LinkLogo * - LinkSign * - MimeType * - NameLong * - PodAllowed * - SortOrder * * @return void */ protected function _init() { $active = new Opus_Model_Field('Active'); $active->setCheckbox(true); $comment_internal = new Opus_Model_Field('CommentInternal'); $comment_internal->setTextarea(true); $desc_markup = new Opus_Model_Field('DescMarkup'); $desc_markup->setTextarea(true); $desc_text = new Opus_Model_Field('DescText'); $desc_text->setTextarea(true); $licence_language = new Opus_Model_Field('Language'); if (Zend_Registry::isRegistered('Available_Languages') === true) { $licence_language->setDefault(Zend_Registry::get('Available_Languages')); } $licence_language->setSelection(true); $licence_language->setMandatory(true); $link_licence = new Opus_Model_Field('LinkLicence'); $link_licence->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty()); $link_logo = new Opus_Model_Field('LinkLogo'); $link_sign = new Opus_Model_Field('LinkSign'); $mime_type = new Opus_Model_Field('MimeType'); $name_long = new Opus_Model_Field('NameLong'); $name_long->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty()); $sort_order = new Opus_Model_Field('SortOrder'); $pod_allowed = new Opus_Model_Field('PodAllowed'); $pod_allowed->setCheckbox(true); $this->addField($active)->addField($comment_internal)->addField($desc_markup)->addField($desc_text)->addField($licence_language)->addField($link_licence)->addField($link_logo)->addField($link_sign)->addField($mime_type)->addField($name_long)->addField($sort_order)->addField($pod_allowed); }
/** * Initialize model with the following fields: * - PathName * - Label * - FileType * - MimeType * - Language * * @return void */ protected function _init() { $filepathname = new Opus_Model_Field('PathName'); $filepathname->setMandatory(true)->setValidator(new Zend_Validate_NotEmpty()); $filelabel = new Opus_Model_Field('Label'); $filecomment = new Opus_Model_Field('Comment'); $mimetype = new Opus_Model_Field('MimeType'); $filelanguage = new Opus_Model_Field('Language'); if (Zend_Registry::isRegistered('Available_Languages') === true) { $filelanguage->setDefault(Zend_Registry::get('Available_Languages')); } $filelanguage->setSelection(true); $tempfile = new Opus_Model_Field('TempFile'); $server_date_submitted = new Opus_Model_Field('ServerDateSubmitted'); $server_date_submitted->setValueModelClass('Opus_Date'); $sortOrder = new Opus_Model_Field('SortOrder'); $filesize = new Opus_Model_Field('FileSize'); $filesize->setMandatory(true); $visible_in_frontdoor = new Opus_Model_Field('VisibleInFrontdoor'); $visible_in_oai = new Opus_Model_Field('VisibleInOai'); $hashvalue = new Opus_Model_Field('HashValue'); $hashvalue->setMandatory(true)->setMultiplicity('*'); $this->addField($filepathname)->addField($filelabel)->addField($filecomment)->addField($mimetype)->addField($filelanguage)->addField($tempfile)->addField($filesize)->addField($visible_in_frontdoor)->addField($visible_in_oai)->addField($hashvalue)->addField($server_date_submitted)->addField($sortOrder); }