Esempio n. 1
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $counties = new OsCounties();
     $county_options = $counties->getCountyNames();
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     $licenses = new LicenseTypes();
     $license = $licenses->getList();
     parent::__construct($options);
     $this->setName('imageeditfind');
     $imagelabel = new Zend_Form_Element_Text('label');
     $imagelabel->setLabel('Image label')->setRequired(true)->setAttribs(array('size' => 70, 'class' => 'span6'))->addErrorMessage('You must enter a label')->addFilters(array('StringTrim', 'StripTags'));
     $period = new Zend_Form_Element_Select('period');
     $period->setLabel('Period: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a period', 'Available periods' => $period_options))->addValidator('inArray', false, array(array_keys($period_options)));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose a county', 'Available counties' => $county_options))->addValidator('inArray', false, array(array_keys($county_options)));
     $copyright = new Zend_Form_Element_Select('imagerights');
     $copyright->setLabel('Image copyright: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addErrorMessage('You must enter a licence holder')->addMultiOptions(array(null => 'Select a licence holder', 'Valid copyrights' => $this->getCopyrights()))->setDescription('You can set the copyright of your image here
                 to your institution. If you are a public recorder, it
                 should default to your full name. For institutions that do
                 not appear contact head office to suggest its addition.')->setValue($this->getCopyright());
     $licenseField = new Zend_Form_Element_Select('ccLicense');
     $licenseField->setDescription('Our philosophy is to make our content
         available openly, by default we set the license as use by attribution
         to gain the best public benefit. You can choose a different license
         if you wish.');
     $licenseField->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setLabel('Creative Commons license:')->addMultiOptions(array(null => 'Select a license', 'Available licenses' => $license))->setValue(4)->addValidator('Int');
     $type = new Zend_Form_Element_Select('type');
     $type->setLabel('Image type: ')->setRequired(true)->addMultiOptions(array('Please choose publish state' => array('digital' => 'Digital image', 'illustration' => 'Scanned illustration')))->setValue('digital')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'));
     $rotate = new Zend_Form_Element_Radio('rotate');
     $rotate->setLabel('Rotate the image: ')->setRequired(false)->addValidator('Int')->addMultiOptions(array(-90 => '90 degrees anticlockwise', -180 => '180 degrees anticlockwise', -270 => '270 degrees anticlockwise', 90 => '90 degrees clockwise', 180 => '180 degrees clockwise', 270 => '270 degrees clockwise'));
     $regenerate = new Zend_Form_Element_Checkbox('regenerate');
     $regenerate->setLabel('Regenerate thumbnail: ');
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($imagelabel, $county, $period, $copyright, $licenseField, $type, $submit));
     $this->setMethod('post');
     $this->addDisplayGroup(array('label', 'county', 'period', 'imagerights', 'ccLicense', 'type'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->details->setLegend('Edit metadata on an image');
     parent::init();
 }
Esempio n. 2
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new OsCounties();
     $county_options = $counties->getCountyNames();
     parent::__construct($options);
     $this->setName('coroner');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Enter a firstname!');
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setLabel('Last name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false);
     $address_1 = new Zend_Form_Element_Text('address_1');
     $address_1->SetLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $address_2 = new Zend_Form_Element_Text('address_2');
     $address_2->SetLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $town = new Zend_Form_Element_Text('town');
     $town->SetLabel('Town: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidators(array('NotEmpty'))->addMultiOptions(array(null => 'Choose county', 'Valid county' => $county_options));
     $region_name = new Zend_Form_Element_Text('region_name');
     $region_name->SetLabel('Administrative region: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode');
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions($countries_options)->setValue('GB');
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->SetLabel('Telephone number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $fax = new Zend_Form_Element_Text('fax');
     $fax->SetLabel('Fax number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($firstname, $lastname, $email, $address_1, $address_2, $town, $postcode, $county, $country, $telephone, $fax, $region_name, $submit));
     $this->addDisplayGroup(array('firstname', 'lastname', 'region_name', 'email', 'address_1', 'address_2', 'town', 'postcode', 'county', 'country', 'telephone', 'fax'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->details->setLegend('Submit Coroner\'s details ');
     parent::init();
 }
Esempio n. 3
0
 /** Get the county dropdown
  * @access public
  * @return array
  */
 public function getCounties()
 {
     $counties = new OsCounties();
     return $counties->getCountyNames();
 }
Esempio n. 4
0
    /** The constructor
     * @access public
     * @param array $options
     * @return void
     */
    public function __construct(array $options = null)
    {
        $counties = new OsCounties();
        $county_options = $counties->getCountyNames();
        $periods = new Periods();
        $period_options = $periods->getPeriodFrom();
        $copyrights = new Copyrights();
        $copy = $copyrights->getTypes();
        $licenses = new LicenseTypes();
        $license = $licenses->getList();
        if (array_key_exists('id', $options)) {
            $slides = new Slides();
            $images = $slides->getSlides($options['id']);
        }
        $auth = Zend_Auth::getInstance();
        $this->_auth = $auth;
        if ($this->_auth->hasIdentity()) {
            $user = $this->_auth->getIdentity();
            if (!is_null($user->copyright)) {
                $this->_copyright = $user->copyright;
            } elseif (!is_null($user->fullname)) {
                $this->_copyright = $user->first_name . ' ' . $user->last_name;
            } else {
                $this->_copyright = $user->fullname;
            }
            if (!is_null($user->fullname)) {
                $copy[] = $user->first_name . ' ' . $user->last_name;
            } else {
                $copy[] = $user->fullname;
            }
        }
        $copyList = array_filter(array_merge(array($this->_copyright => $this->_copyright), $copy));
        parent::__construct($options);
        $this->setName('imagetofind');
        $period = new Zend_Form_Element_Select('period');
        $period->setLabel('Period: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->addErrorMessage('You must enter a period for the image')->addMultiOptions(array(null => 'Select a period', 'Valid periods' => $period_options))->addValidator('inArray', false, array(array_keys($period_options)));
        $country = new Zend_Form_Element_Select('country');
        $country->setLabel('Country: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a country of origin')->addMultiOptions(array(null => 'Select a country of origin', 'Valid countries' => array('England' => 'England', 'Wales' => 'Wales')))->addValidator('inArray', false, array(array_keys($county_options)));
        $county = new Zend_Form_Element_Select('county');
        $county->setLabel('County: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a county of origin')->addMultiOptions(array(null => 'Select a county of origin', 'Valid counties' => $county_options))->addValidator('inArray', false, array(array_keys($county_options)));
        $copyright = new Zend_Form_Element_Select('imagerights');
        $copyright->setLabel('Image copyright: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addErrorMessage('You must enter a licence holder')->addMultiOptions(array(null => 'Select a licence holder', 'Valid copyrights' => $copyList))->setDescription('You can set the copyright of your image here
                    to your institution. If you are a public recorder, it should
                    default to your full name. For institutions that do not
                    appear contact head office to suggest its addition')->setValue($this->_copyright);
        $licenseField = new Zend_Form_Element_Select('ccLicense');
        $licenseField->setDescription('Our philosophy is to make our content available openly, by default we
        set the license as use by attribution to gain the best public benefit. You can choose a different license
        if you wish.');
        $licenseField->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setLabel('Creative Commons license:')->addMultiOptions(array(null => 'Select a license', 'Available licenses' => $license))->setValue(4)->addValidator('Int');
        $type = new Zend_Form_Element_Select('type');
        $type->setLabel('Image type: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addMultiOptions(array(null => 'Select the type of image', 'Image types' => array('digital' => 'Digital image', 'illustration' => 'Scanned illustration')))->setValue('digital');
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Add metadata for images');
        $this->addElements(array($country, $county, $period, $copyright, $type, $licenseField, $submit));
        $this->setMethod('post');
        $this->addDisplayGroup(array('country', 'filename', 'county', 'period', 'imagerights', 'ccLicense', 'type'), 'details');
        foreach ($images as $image) {
            $label = 'label' . $image['imageID'];
            $group = 'metadata' . $image['imageID'];
            echo '<img src="http://finds.org.uk/images/thumbnails/' . $image['imageID'] . '.jpg"/>';
            $image['imageID'] = new Zend_Form_Element_Text($label);
            $image['imageID']->setLabel('Image label: ')->setRequired(true)->setAttribs(array('size' => 60, 'class' => 'span6 required'))->addErrorMessage('You must enter a label')->setDescription('This must be descriptive text about the image - NOT THE FILE or FIND NUMBER/NAME - and follow the
		conventions outlined below this form')->addFilters(array('StripTags', 'StringTrim'));
            $this->addElements(array($image['imageID']));
            $this->addDisplayGroup(array($label), $group);
        }
        $this->addDisplayGroup(array('submit'), 'buttons')->removeDecorator('HtmlTag');
        $this->details->setLegend('Attach an image');
        parent::init();
    }