public function optionsAddClone($broadperiod, $coinDataFlat) { Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->addMessage('Your last record data has been cloned'); switch ($broadperiod) { case 'IRON AGE': if (isset($coinDataFlat['denomination'])) { $geographies = new Geography(); $geography_options = $geographies->getIronAgeGeographyMenu($coinDataFlat['denomination']); $this->_view->form->geographyID->addMultiOptions(array(NULL => 'Choose geographic region', 'Available regions' => $geography_options)); } break; case 'ROMAN': if (isset($coinDataFlat['ruler'])) { $reverses = new Revtypes(); $reverse_options = $reverses->getRevTypesForm($coinDataFlat['ruler']); if ($reverse_options) { $this->_view->form->revtypeID->addMultiOptions(array(NULL => 'Choose reverse type', 'Available reverses' => $reverse_options)); } else { $this->_view->form->revtypeID->addMultiOptions(array(NULL => 'No options available')); } } else { $this->_view->form->revtypeID->addMultiOptions(array(NULL => 'No options available')); } if (isset($coinDataFlat['ruler']) && $coinDataFlat['ruler'] == 242) { $moneyers = new Moneyers(); $moneyer_options = $moneyers->getRepublicMoneyers(); $this->_view->form->moneyer->addMultiOptions(array(NULL => NULL, 'Choose reverse type' => $moneyer_options)); } else { $this->_view->form->moneyer->addMultiOptions(array(NULL => 'No options available')); //$this->_view->form->moneyer->disabled=true; } break; case 'EARLY MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $this->_view->form->typeID->addMultiOptions(array(NULL => 'Choose Early Medieval type', 'Available types' => $type_options)); break; case 'MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $this->_view->form->typeID->addMultiOptions(array(NULL => 'Choose Medieval type', 'Available types' => $type_options)); break; case 'POST MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $this->_view->form->typeID->addMultiOptions(array(NULL => 'Choose Post Medieval type', 'Available types' => $type_options)); break; } }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { // Construct the select menu data $denominations = new Denominations(); $denomination_options = $denominations->getOptionsRoman(); $statuses = new Statuses(); $status_options = $statuses->getCoinStatus(); $dies = new Dieaxes(); $die_options = $dies->getAxes(); $wears = new WearTypes(); $wear_options = $wears->getWears(); $rulers = new Rulers(); $ro = $rulers->getRomanRulers(); $mints = new Mints(); $mo = $mints->getRomanMints(); $reeces = new Reeces(); $reece = $reeces->getOptions(); $money = new Moneyers(); $moneyers = $money->getRepublicMoneyers(); $reverse = new RevTypes(); $reverses = $reverse->getRevTypes(); parent::__construct($options); $this->setName('romancoin'); $denomination = new Zend_Form_Element_Select('denomination'); $denomination->setLabel('Denomination: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose denomination', 'Valid denominations' => $denomination_options))->addValidator('InArray', false, array(array_keys($denomination_options)))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a denomination'); $denomination_qualifier = new Zend_Form_Element_Radio('denomination_qualifier'); $denomination_qualifier->setLabel('Denomination qualifier: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->setValue(1)->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => '')); $ruler = new Zend_Form_Element_Select('ruler_id'); $ruler->setLabel('Ruler: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a ruler', 'Valid rulers' => $ro))->addValidator('InArray', false, array(array_keys($ro))); $ruler_qualifier = new Zend_Form_Element_Radio('ruler_qualifier'); $ruler_qualifier->setLabel('Ruler qualifier: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => '')); $ricID = new Zend_Form_Element_Select('ricID'); $ricID->setLabel('Roman Imperial Coinage ID number: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Imperial')->addMultiOptions(array(null => 'Choose RIC type from Nomisma'))->setDescription('These identifiers are dynamically drawn from Nomisma.org. They have not parsed all volumes of RIC yet and it may take a short while to load.')->setRegisterInArrayValidator(false); $mint_id = new Zend_Form_Element_Select('mint_id'); $mint_id->setLabel('Issuing mint: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a mint', 'Valid mints' => $mo))->addValidator('InArray', false, array(array_keys($mo)))->addFilters(array('StripTags', 'StringTrim')); $mint_qualifier = new Zend_Form_Element_Radio('mint_qualifier'); $mint_qualifier->setLabel('Mint qualifier: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => '')); $reeceID = new Zend_Form_Element_Select('reeceID'); $reeceID->setLabel('Reece period: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a Reece period', 'Valid periods' => $reece))->addValidator('InArray', false, array(array_keys($reece)))->addFilters(array('StripTags', 'StringTrim')); $moneyer = new Zend_Form_Element_Select('moneyer'); $moneyer->setLabel('Republican Moneyer: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a moneyer', 'Valid moneyers' => $moneyers))->addValidator('InArray', false, array(array_keys($moneyers)))->addFilters(array('StripTags', 'StringTrim')); $moneyer_qualifier = new Zend_Form_Element_Radio('moneyer_qualifier'); $moneyer_qualifier->setLabel('Republican Moneyer qualifier: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => '')); $rrcID = new Zend_Form_Element_Select('rrcID'); $rrcID->setLabel('Roman Republican Coinage ID number: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Republican')->addMultiOptions(array(null => 'Choose RRC type from Nomisma'))->setDescription('These identifiers are dynamically drawn from Nomisma.org and there maybe a short delay loading them.')->setRegisterInArrayValidator(false); $revtypeID = new Zend_Form_Element_Select('revtypeID'); $revtypeID->setLabel('Reverse type: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a reverse type', 'Valid reverses' => $reverses))->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($reverses))); $revTypeID_qualifier = new Zend_Form_Element_Radio('revTypeID_qualifier'); $revTypeID_qualifier->setLabel('Reverse type qualifier: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => '')); $status = new Zend_Form_Element_Select('status'); $status->setLabel('Status: ')->setValue(1)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose coin status', 'Valid options' => $status_options))->addValidator('InArray', false, array(array_keys($status_options))); $status_qualifier = new Zend_Form_Element_Radio('status_qualifier'); $status_qualifier->setLabel('Status qualifier: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->setValue(1)->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => '')); $degree_of_wear = new Zend_Form_Element_Select('degree_of_wear'); $degree_of_wear->setLabel('Degree of wear: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose coin wear status', 'Valid options' => $wear_options))->addValidator('InArray', false, array(array_keys($wear_options)))->addFilters(array('StripTags', 'StringTrim')); $obverse_inscription = new Zend_Form_Element_Text('obverse_inscription'); $obverse_inscription->setLabel('Obverse inscription: ')->setAttrib('class', 'span6')->addFilters(array('StripTags', 'StringTrim')); $reverse_inscription = new Zend_Form_Element_Text('reverse_inscription'); $reverse_inscription->setLabel('Reverse inscription: ')->setAttrib('class', 'span6')->addFilters(array('StripTags', 'StringTrim')); $obverse_description = new Zend_Form_Element_Textarea('obverse_description'); $obverse_description->setLabel('Obverse description: ')->setAttribs(array('rows' => 3, 'cols' => 80, 'class' => 'span6'))->addFilters(array('StripTags', 'StringTrim')); $reverse_description = new Zend_Form_Element_Textarea('reverse_description'); $reverse_description->setLabel('Reverse description: ')->setAttribs(array('rows' => 3, 'cols' => 80, 'class' => 'span6'))->addFilters(array('StripTags', 'StringTrim')); $reverse_mintmark = new Zend_Form_Element_Textarea('reverse_mintmark'); $reverse_mintmark->setLabel('Reverse mint mark: ')->setAttribs(array('rows' => 3, 'cols' => 80, 'class' => 'span6'))->addFilters(array('StripTags', 'StringTrim')); $die_axis_measurement = new Zend_Form_Element_Select('die_axis_measurement'); $die_axis_measurement->setLabel('Die axis measurement: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose die axis', 'Available axes' => $die_options))->addValidator('InArray', false, array(array_keys($die_options)))->addFilters(array('StripTags', 'StringTrim')); $die_axis_certainty = new Zend_Form_Element_Radio('die_axis_certainty'); $die_axis_certainty->setLabel('Die axis certainty: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => '')); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($ruler, $denomination, $moneyer, $mint_id, $reeceID, $status, $revtypeID, $degree_of_wear, $obverse_description, $obverse_inscription, $reverse_description, $reverse_inscription, $die_axis_measurement, $die_axis_certainty, $mint_qualifier, $ruler_qualifier, $denomination_qualifier, $status_qualifier, $revTypeID_qualifier, $reverse_mintmark, $rrcID, $ricID, $submit)); $this->addDisplayGroup(array('denomination', 'denomination_qualifier', 'ruler_id', 'ruler_qualifier', 'ricID', 'mint_id', 'mint_qualifier', 'reeceID', 'revtypeID', 'revTypeID_qualifier', 'moneyer', 'rrcID', 'status', 'status_qualifier', 'degree_of_wear', 'obverse_description', 'obverse_inscription', 'reverse_description', 'reverse_inscription', 'reverse_mintmark', 'die_axis_measurement', 'die_axis_certainty'), 'details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
/** Clone the options * @access public * @param string $broadperiod * @param array $coinDataFlat * @throw Exeption */ public function optionsAddClone($broadperiod, array $coinDataFlat) { switch ($broadperiod) { case 'IRON AGE': if (isset($coinDataFlat['denomination'])) { $geographies = new Geography(); $geography_options = $geographies->getIronAgeGeographyMenu($coinDataFlat['denomination']); $form->geographyID->addMultiOptions(array(null => 'Choose geographic region', 'Available regions' => $geography_options)); $form->geographyID->addValidator('InArray', false, array(array_keys($geography_options))); } break; case 'ROMAN': if (isset($coinDataFlat['ruler'])) { $reverses = new RevTypes(); $reverse_options = $reverses->getRevTypesForm($coinDataFlat['ruler']); if ($reverse_options) { $form->revtypeID->addMultiOptions(array(null => 'Choose reverse type', 'Available reverses' => $reverse_options)); } else { $form->revtypeID->addMultiOptions(array(null => 'No options available')); } } else { $form->revtypeID->addMultiOptions(array(null => 'No options available')); } if (isset($coinDataFlat['ruler']) && $coinDataFlat['ruler'] == 242) { $moneyers = new Moneyers(); $moneyer_options = $moneyers->getRepublicMoneyers(); $form->moneyer->addMultiOptions(array(null => 'Choose moneyer', 'Available moneyers' => $moneyer_options)); } else { $form->moneyer->addMultiOptions(array(null => 'No options available')); } break; case 'EARLY MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $form->typeID->addMultiOptions(array(null => 'Choose Early Medieval type', 'Available types' => $type_options)); break; case 'MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $form->typeID->addMultiOptions(array(null => 'Choose Medieval type', 'Available types' => $type_options)); break; case 'POST MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $form->typeID->addMultiOptions(array(null => 'Choose Post Medieval type', 'Available types' => $type_options)); break; default: throw new Exception('No period supplied', 500); } }
public function __construct($options = null) { //Get data to form select menu for primary and secondary material $primaries = new Materials(); $primary_options = $primaries->getPrimaries(); //Get Rally data $rallies = new Rallies(); $rally_options = $rallies->getRallies(); //Get Hoard data $hoards = new Hoards(); $hoard_options = $hoards->getHoards(); $counties = new Counties(); $county_options = $counties->getCountyName2(); $denominations = new Denominations(); $denom_options = $denominations->getOptionsRoman(); $rulers = new Rulers(); $ruler_options = $rulers->getRomanRulers(); $mints = new Mints(); $mint_options = $mints->getRomanMints(); $axis = new Dieaxes(); $axis_options = $axis->getAxes(); $reece = new Reeces(); $reece_options = $reece->getReeces(); $regions = new Regions(); $region_options = $regions->getRegionName(); $moneyers = new Moneyers(); $money = $moneyers->getRepublicMoneyers(); $institutions = new Institutions(); $inst_options = $institutions->getInsts(); parent::__construct($options); $decorator = array('SimpleInput'); $decoratorSelect = array('SelectInput'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li'))); $decoratorsHide = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'class' => 'hideme')), array('HtmlTag', array('tag' => 'li'))); $decoratorsRally = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'class' => 'hiderally')), array('HtmlTag', array('tag' => 'li'))); $decoratorsHoard = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'class' => 'hidehoard')), array('HtmlTag', array('tag' => 'li'))); $decoratorsNote = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'class' => 'hidenote')), array('HtmlTag', array('tag' => 'li'))); $this->setName('search-roman-coins'); $old_findID = new Zend_Form_Element_Text('old_findID'); $old_findID->setLabel('Find number: ')->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid number!')->setDecorators($decorators); $description = new Zend_Form_Element_Text('description'); $description->setLabel('Object description contains: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter a valid term')->setDecorators($decorators); $workflow = new Zend_Form_Element_Select('workflow'); $workflow->setLabel('Workflow stage: ')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); if (in_array($this->getRole(), $this->_higherlevel)) { $workflow->addMultiOptions(array(NULL => NULL, 'Available worklow stage' => array('1' => 'Quarantine', '2' => 'On review', '4' => 'Awaiting validation', '3' => 'Published'))); } if (in_array($this->getRole(), $this->_restricted)) { $workflow->addMultiOptions(array(NULL => 'Choose a workflow stage', 'Available worklow stage' => array('4' => 'Awaiting validation', '3' => 'Published'))); } $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElement($hash); //Rally details $rally = new Zend_Form_Element_Checkbox('rally'); $rally->setLabel('Rally find: ')->addFilters(array('StripTags', 'StringTrim'))->setUncheckedValue(NULL)->setDecorators($decorators); $rallyID = new Zend_Form_Element_Select('rallyID'); $rallyID->setLabel('Found at this rally: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose rally name', 'Available rallies' => $rally_options))->addValidator('InArray', false, array(array_keys($rally_options)))->setDecorators($decorators); $hoard = new Zend_Form_Element_Checkbox('hoard'); $hoard->setLabel('Hoard find: ')->addFilters(array('StripTags', 'StringTrim'))->setUncheckedValue(NULL)->setDecorators($decorators); $hoardID = new Zend_Form_Element_Select('hID'); $hoardID->setLabel('Part of this hoard: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose hoard name', 'Available hoards' => $hoard_options))->addValidator('InArray', false, array(array_keys($hoard_options)))->setDecorators($decorators); $county = new Zend_Form_Element_Select('county'); $county->setLabel('County: ')->addValidators(array('NotEmpty'))->addMultiOptions(array(NULL => 'Choose county first', 'Available counties' => $county_options))->addValidator('InArray', false, array(array_keys($county_options)))->setDecorators($decorators); $district = new Zend_Form_Element_Select('district'); $district->setLabel('District: ')->addMultiOptions(array(NULL => 'Choose district after county'))->setRegisterInArrayValidator(false)->setDecorators($decorators)->disabled = true; $parish = new Zend_Form_Element_Select('parish'); $parish->setLabel('Parish: ')->addMultiOptions(array(NULL => 'Choose parish after county'))->setDecorators($decorators)->disabled = true; $regionID = new Zend_Form_Element_Select('regionID'); $regionID->setLabel('European region: ')->setDecorators($decorators)->addMultiOptions(array(NULL => 'Choose a region for a wide result', 'Choose region' => $region_options))->addValidator('InArray', false, array(array_keys($region_options)))->addFilters(array('StripTags', 'StringTrim')); $gridref = new Zend_Form_Element_Text('gridref'); $gridref->setLabel('Grid reference: ')->addValidators(array('ValidGridRef'))->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); $fourFigure = new Zend_Form_Element_Text('fourFigure'); $fourFigure->setLabel('Four figure grid reference: ')->addValidators(array('ValidGridRef'))->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); ### ##Numismatic data ### //Denomination $denomination = new Zend_Form_Element_Select('denomination'); $denomination->setLabel('Denomination: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose denomination type', 'Available denominations' => $denom_options))->addValidator('InArray', false, array(array_keys($denom_options)))->setDecorators($decorators); //Primary ruler $ruler = new Zend_Form_Element_Select('ruler'); $ruler->setLabel('Ruler / issuer: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose primary ruler', 'Available rulers' => $ruler_options))->addValidator('InArray', false, array(array_keys($ruler_options)))->setDecorators($decorators); //Mint $mint = new Zend_Form_Element_Select('mint'); $mint->setLabel('Issuing mint: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose issuing mint', 'Available mints' => $mint_options))->addValidator('InArray', false, array(array_keys($mint_options)))->setDecorators($decorators); //Reece $reece = new Zend_Form_Element_Select('reeceID'); $reece->setLabel('Reece period: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose Reece period', 'Available Reece periods' => $reece_options))->addValidator('InArray', false, array(array_keys($reece_options)))->setDecorators($decorators); //Reverse type $reverse = new Zend_Form_Element_Select('revtypeID'); $reverse->setLabel('Fourth Century reverse type: ')->setDescription('This field is only applicable for fourth century AD coins.')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->addMultiOptions(array(NULL => 'Only available after choosing a 4th century issuer')); //Moneyer $moneyer = new Zend_Form_Element_Select('moneyer'); $moneyer->setLabel('Republican moneyers: ')->setDescription('This field is only applicable for Republican coins.')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->addMultiOptions(array(NULL => 'Only available after choosing a Republican issuer'))->addValidator('InArray', false, array(array_keys($money))); //Obverse inscription $obverseinsc = new Zend_Form_Element_Text('obverseLegend'); $obverseinsc->setLabel('Obverse inscription contains: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter a valid term')->setDecorators($decorators); //Obverse description $obversedesc = new Zend_Form_Element_Text('obverseDescription'); $obversedesc->setLabel('Obverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter a valid term')->setDecorators($decorators); //reverse inscription $reverseinsc = new Zend_Form_Element_Text('reverseLegend'); $reverseinsc->setLabel('Reverse inscription contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term')->setAttrib('size', 60)->setDecorators($decorators); //reverse description $reversedesc = new Zend_Form_Element_Text('reverseDescription'); $reversedesc->setLabel('Reverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term')->setAttrib('size', 60)->setDecorators($decorators); //Die axis $axis = new Zend_Form_Element_Select('axis'); $axis->setLabel('Die axis measurement: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose measurement' => $axis_options))->addValidator('InArray', false, array(array_keys($axis_options)))->setDecorators($decorators); $objecttype = new Zend_Form_Element_Hidden('objecttype'); $objecttype->setValue('coin')->setAttrib('class', 'none')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $broadperiod = new Zend_Form_Element_Hidden('broadperiod'); $broadperiod->setValue('Roman')->setAttrib('class', 'none')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->addFilters(array('StringToUpper', 'StripTags', 'StringTrim'))->addValidator('Alpha'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setLabel('Submit your search ..')->setAttrib('class', 'large'); $institution = new Zend_Form_Element_Select('institution'); $institution->setLabel('Recording institution: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(NULL => NULL, 'Choose institution' => $inst_options))->setDecorators($decorators); $this->addElements(array($old_findID, $description, $workflow, $rally, $rallyID, $hoard, $hoardID, $county, $regionID, $district, $parish, $fourFigure, $gridref, $denomination, $ruler, $mint, $axis, $reece, $reverse, $obverseinsc, $obversedesc, $reverseinsc, $reversedesc, $moneyer, $objecttype, $broadperiod, $submit, $hash, $institution)); $this->addDisplayGroup(array('denomination', 'ruler', 'mint', 'moneyer', 'axis', 'reeceID', 'revtypeID', 'obverseLegend', 'obverseDescription', 'reverseLegend', 'reverseDescription'), 'numismatics')->removeDecorator('HtmlTag'); $this->numismatics->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->numismatics->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('old_findID', 'description', 'rally', 'rallyID', 'hoard', 'hID', 'workflow'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('county', 'regionID', 'district', 'parish', 'gridref', 'fourFigure', 'institution'), 'spatial')->removeDecorator('HtmlTag'); $this->spatial->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->spatial->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); $this->numismatics->setLegend('Numismatic details'); $this->details->setLegend('Artefact details'); $this->spatial->setLegend('Spatial details'); }
/** add and clone last record * @access public * @param string $broadperiod * @param array $coinDataFlat * @return void */ public function optionsAddClone($broadperiod, array $coinDataFlat) { $coinDataFlat = $coinDataFlat[0]; switch ($broadperiod) { case 'IRON AGE': if (array_key_exists('denomination', $coinDataFlat)) { $geographies = new Geography(); $geography_options = $geographies->getIronAgeGeographyMenu($coinDataFlat['denomination']); $this->_view->form->geographyID->addMultiOptions(array(null => 'Choose geographic region', 'Available regions' => $geography_options)); $this->_view->form->geographyID->addValidator('InArray', false, array(array_keys($geography_options))); } break; case 'ROMAN': if (array_key_exists('ruler_id', $coinDataFlat)) { if (!is_null($coinDataFlat['ruler_id'])) { $rulers = new Rulers(); $identifier = $rulers->fetchRow($rulers->select()->where('id = ?', $coinDataFlat['ruler_id'])); if ($identifier) { $nomisma = $identifier->nomismaID; $rrcTypes = new Nomisma(); $this->_view->form->ricID->addMultiOptions(array(null => 'Choose RIC type', 'Available RIC types' => $rrcTypes->getRICDropdownsFlat($nomisma))); } } $reverses = new RevTypes(); $reverse_options = $reverses->getRevTypesForm($coinDataFlat['ruler_id']); if ($reverse_options) { $this->_view->form->revtypeID->addMultiOptions(array(null => 'Choose reverse type', 'Available reverses' => $reverse_options)); $this->_view->form->revtypeID->setRegisterInArrayValidator(false); } else { $this->_view->form->revtypeID->addMultiOptions(array(null => 'No options available')); $this->_view->form->revtypeID->setRegisterInArrayValidator(false); } } else { $this->_view->form->revtypeID->addMultiOptions(array(null => 'No options available')); $this->_view->form->revtypeID->setRegisterInArrayValidator(false); } if (array_key_exists('ruler_id', $coinDataFlat) && $coinDataFlat['ruler_id'] == '242') { $moneyers = new Moneyers(); $moneyer_options = $moneyers->getRepublicMoneyers(); $this->_view->form->moneyer->addMultiOptions(array(null => 'Choose moneyer', 'Available moneyers' => $moneyer_options)); if (array_key_exists('moneyer', $coinDataFlat)) { if (!is_null($coinDataFlat['moneyer'])) { $identifier = $moneyers->fetchRow($moneyers->select()->where('id = ?', $coinDataFlat['moneyer'])); if ($identifier) { $nomisma = $identifier->nomismaID; $rrcTypes = new Nomisma(); $this->_view->form->rrcID->addMultiOptions(array(null => 'Choose RRC type', 'Available RRC types' => $rrcTypes->getRRCDropdownsFlat($nomisma))); } } } } else { $this->_view->form->moneyer->addMultiOptions(array(null => 'No options available')); } break; case 'EARLY MEDIEVAL': if (array_key_exists('ruler_id', $coinDataFlat)) { $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler_id']); $this->_view->form->typeID->addMultiOptions(array(null => 'Choose Early Medieval type', 'Available types' => $type_options)); } break; case 'MEDIEVAL': if (array_key_exists('ruler_id', $coinDataFlat)) { $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler_id']); $this->_view->form->typeID->addMultiOptions(array(null => 'Choose Medieval type', 'Available types' => $type_options)); } break; case 'POST MEDIEVAL': if (array_key_exists('ruler_id', $coinDataFlat)) { $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu((int) $coinDataFlat['ruler_id']); $this->_view->form->typeID->addMultiOptions(array(null => 'Choose Post Medieval type', 'Available types' => $type_options)); } break; default: return false; } }
public function optionsAddClone($broadperiod, $coinDataFlat) { switch ($broadperiod) { case 'IRON AGE': if (isset($coinDataFlat['denomination'])) { $geographies = new Geography(); $geography_options = $geographies->getIronAgeGeographyMenu($coinDataFlat['denomination']); $form->geographyID->addMultiOptions(array(NULL => 'Choose geographic region', 'Available regions' => $geography_options)); } break; case 'ROMAN': if (isset($coinDataFlat['ruler'])) { $reverses = new Revtypes(); $reverse_options = $reverses->getRevTypesForm($coinDataFlat['ruler']); if ($reverse_options) { $form->revtypeID->addMultiOptions(array(NULL => 'Choose reverse type', 'Available reverses' => $reverse_options)); } else { $form->revtypeID->addMultiOptions(array(NULL => 'No options available')); } } else { $form->revtypeID->addMultiOptions(array(NULL => 'No options available')); } if (isset($coinDataFlat['ruler']) && $coinDataFlat['ruler'] == 242) { $moneyers = new Moneyers(); $moneyer_options = $moneyers->getRepublicMoneyers(); $form->moneyer->addMultiOptions(array(NULL => NULL, 'Choose reverse type' => $moneyer_options)); } else { $form->moneyer->addMultiOptions(array(NULL => 'No options available')); //$form->moneyer->disabled=true; } break; case 'EARLY MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $form->typeID->addMultiOptions(array(NULL => 'Choose Early Medieval type', 'Available types' => $type_options)); break; case 'MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $form->typeID->addMultiOptions(array(NULL => 'Choose Medieval type', 'Available types' => $type_options)); break; case 'POST MEDIEVAL': $types = new MedievalTypes(); $type_options = $types->getMedievalTypeToRulerMenu($coinDataFlat['ruler']); $form->typeID->addMultiOptions(array(NULL => 'Choose Post Medieval type', 'Available types' => $type_options)); break; } }