コード例 #1
0
ファイル: VacancyForm.php プロジェクト: lesleyauk/findsorguk
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setName('vacancies');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Role title: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a title for this vacancy.')->setAttrib('size', 60);
     $salary = new Zend_Form_Element_Text('salary');
     $salary->setLabel('Salary: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 20)->addErrorMessage('You must enter a salary.');
     $specification = new Pas_Form_Element_CKEditor('specification');
     $specification->setLabel('Job specification: ')->setRequired(true)->addFilters(array('BasicHtml', 'StringTrim'))->setAttribs(array('cols' => 50, 'rows' => 10, 'Height' => 400))->addErrorMessage('You must enter a job description.');
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('Location of role: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('InArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(null => 'Choose region', 'Available regions' => $staffregions_options))->addErrorMessage('You must choose a region');
     $live = new ZendX_JQuery_Form_Element_DatePicker('live');
     $live->setLabel('Date for advert to go live: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20);
     $expire = new ZendX_JQuery_Form_Element_DatePicker('expire');
     $expire->setLabel('Date for advert to expire: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20);
     $status = new Zend_Form_Element_Select('status');
     $status->SetLabel('Publish status: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a status', 2 => 'Publish', 1 => 'Draft'))->setValue(2)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must choose a status');
     $submit = new Zend_Form_Element_Submit('submit');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElements(array($title, $salary, $specification, $regionID, $live, $expire, $status, $submit, $hash));
     $this->addDisplayGroup(array('title', 'salary', 'specification', 'regionID'), 'details');
     $this->details->setLegend('Vacancy details');
     $this->addDisplayGroup(array('live', 'expire', 'status'), 'dates');
     $this->dates->setLegend('Publication details');
     $this->setLegend('Vacancy details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
コード例 #2
0
ファイル: EventForm.php プロジェクト: rwebley/Beowulf---PAS
 public function __construct($options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     $eventtypes = new EventTypes();
     $event_options = $eventtypes->getTypes();
     $orgs = array('PAS' => 'The Portable Antiquities Scheme', 'BM' => 'The British Museum', 'MLA' => 'MLA', 'HLF' => 'Heritage Lottery Fund', 'IFA' => 'Institute of Archaeology', 'CBA' => 'Council for British Archaeology', 'ARCH' => 'Current Archaeology', 'AF' => 'The Art Fund', 'LOC' => 'Local museum', 'NADFAS' => 'NADFAS', 'CASPAR' => 'CASPAR');
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('event');
     $eventTitle = new Zend_Form_Element_Text('eventTitle');
     $eventTitle->setLabel('Event title: ')->setRequired(true)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 70)->setDecorators($decorators);
     $eventDescription = new Pas_Form_Element_RTE('eventDescription');
     $eventDescription->setLabel('Event description: ')->setRequired(true)->addFilters('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds');
     $address = new Zend_Form_Element_Text('eventLocation');
     $address->setLabel('Address: ')->setRequired(true)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 70)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators);
     $eventStartTime = new Zend_Form_Element_Text('eventStartTime');
     $eventStartTime->setLabel('Event start time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDecorators($decorators);
     $eventEndTime = new Zend_Form_Element_Text('eventEndTime');
     $eventEndTime->setLabel('Event end time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDecorators($decorators);
     $eventStartDate = new ZendX_JQuery_Form_Element_DatePicker('eventStartDate');
     $eventStartDate->setLabel('Event start date: ')->setRequired(false)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $eventEndDate = new ZendX_JQuery_Form_Element_DatePicker('eventEndDate');
     $eventEndDate->setLabel('Event end date: ')->setRequired(false)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $eventRegion = new Zend_Form_Element_Select('eventRegion');
     $eventRegion->setLabel('Organising section: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($staffregions_options)))->addMultiOptions($staffregions_options)->setDecorators($decorators);
     $eventType = new Zend_Form_Element_Select('eventType');
     $eventType->setLabel('Type of event: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($event_options)))->addMultiOptions($event_options)->setDecorators($decorators);
     $adultsAttend = new Zend_Form_Element_Text('adultsAttend');
     $adultsAttend->setLabel('Adults attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setDecorators($decorators);
     $childrenAttend = new Zend_Form_Element_Text('childrenAttend');
     $childrenAttend->setLabel('Children attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setDecorators($decorators);
     $organisation = new Zend_Form_Element_Select('organisation');
     $organisation->setLabel('Organised by: ')->setRequired(false)->setValue('PAS')->addFilters(array('StripTags', 'StringTrim'))->addMultioptions(array(NULL => 'Choose an organisation', 'Available institutions' => array($orgs)))->addValidator('InArray', false, array(array_keys($orgs)))->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $this->addElements(array($eventTitle, $eventDescription, $eventStartTime, $eventEndTime, $eventStartDate, $eventEndDate, $organisation, $childrenAttend, $eventRegion, $adultsAttend, $address, $eventType, $submit));
     $this->addDisplayGroup(array('eventTitle', 'eventDescription', 'eventLocation', 'eventStartTime', 'eventEndTime', 'eventStartDate', 'eventEndDate', 'eventRegion', 'organisation', 'childrenAttend', 'adultsAttend', 'eventType'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
 }
コード例 #3
0
ファイル: EventForm.php プロジェクト: lesleyauk/findsorguk
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     $eventtypes = new EventTypes();
     $event_options = $eventtypes->getTypes();
     $orgs = array('PAS' => 'The Portable Antiquities Scheme', 'BM' => 'The British Museum', 'MLA' => 'MLA', 'HLF' => 'Heritage Lottery Fund', 'IFA' => 'Institute of Archaeology', 'CBA' => 'Council for British Archaeology', 'ARCH' => 'Current Archaeology', 'AF' => 'The Art Fund', 'LOC' => 'Local museum', 'NADFAS' => 'NADFAS', 'CASPAR' => 'CASPAR');
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setName('event');
     $eventTitle = new Zend_Form_Element_Text('eventTitle');
     $eventTitle->setLabel('Event title: ')->setRequired(true)->addErrorMessage('You must enter an event title')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 70);
     $eventDescription = new Pas_Form_Element_CKEditor('eventDescription');
     $eventDescription->setLabel('Event description: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds');
     $address = new Zend_Form_Element_Text('eventLocation');
     $address->setLabel('Address: ')->setRequired(true)->addErrorMessage('You must enter an address')->setAttrib('size', 70)->addFilters(array('StripTags', 'StringTrim', 'Purifier'));
     $eventStartTime = new Zend_Form_Element_Text('eventStartTime');
     $eventStartTime->setLabel('Event start time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDescription('Enter in 24 hour clock format');
     $eventEndTime = new Zend_Form_Element_Text('eventEndTime');
     $eventEndTime->setLabel('Event end time: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Zend_Validate_Date('H:i:s'))->setDescription('Enter in 24 hour clock format');
     $eventStartDate = new ZendX_JQuery_Form_Element_DatePicker('eventStartDate');
     $eventStartDate->setLabel('Event start date: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You need a start date')->setAttrib('size', 20);
     $eventEndDate = new ZendX_JQuery_Form_Element_DatePicker('eventEndDate');
     $eventEndDate->setLabel('Event end date: ')->setRequired(false)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You need an end date')->setAttrib('size', 20);
     $eventRegion = new Zend_Form_Element_Select('eventRegion');
     $eventRegion->setLabel('Organising section: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(null => 'Please choose a region', 'Valid regions' => $staffregions_options));
     $eventType = new Zend_Form_Element_Select('eventType');
     $eventType->setLabel('Type of event: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('stringLength', false, array(1, 10))->addValidator('inArray', false, array(array_keys($event_options)))->addMultiOptions($event_options);
     $adultsAttend = new Zend_Form_Element_Text('adultsAttend');
     $adultsAttend->setLabel('Adults attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int');
     $childrenAttend = new Zend_Form_Element_Text('childrenAttend');
     $childrenAttend->setLabel('Children attending: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int');
     $organisation = new Zend_Form_Element_Select('organisation');
     $organisation->setLabel('Organised by: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setValue('PAS')->addFilters(array('StripTags', 'StringTrim'))->addMultioptions(array(null => 'Choose an organisation', 'Available institutions' => $orgs))->addValidator('InArray', false, array(array_keys($orgs)));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($eventTitle, $eventDescription, $eventStartTime, $eventEndTime, $eventStartDate, $eventEndDate, $organisation, $childrenAttend, $eventRegion, $adultsAttend, $address, $eventType, $submit, $hash));
     $this->addDisplayGroup(array('eventTitle', 'eventDescription', 'eventLocation', 'eventStartTime', 'eventEndTime', 'eventStartDate', 'eventEndDate', 'eventRegion', 'organisation', 'childrenAttend', 'adultsAttend', 'eventType'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
コード例 #4
0
ファイル: VacancyForm.php プロジェクト: rwebley/Beowulf---PAS
 public function __construct($options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $decorator = array('SimpleInput');
     $decoratorSelect = array('SelectInput');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('vacancies');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Role title: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter a title for this vacancy.')->setAttrib('size', 60)->setDecorators($decorators);
     $salary = new Zend_Form_Element_Text('salary');
     $salary->setLabel('Salary: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 20)->addValidator('Currency')->addErrorMessage('You must enter a salary.')->setDecorators($decorators);
     $specification = new Pas_Form_Element_RTE('specification');
     $specification->setLabel('Job specification: ')->setRequired(true)->addFilters(array('BasicHtml', 'StringTrim'))->setAttribs(array('cols' => 50, 'rows' => 10, 'Height' => 400))->setAttrib('ToolbarSet', 'Basic')->addErrorMessage('You must enter a job description.');
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('Location of role: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('InArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(NULL => NULL, 'Choose region' => $staffregions_options))->setDecorators($decorators)->addErrorMessage('You must choose a region');
     $live = new ZendX_JQuery_Form_Element_DatePicker('live');
     $live->setLabel('Date for advert to go live: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $expire = new ZendX_JQuery_Form_Element_DatePicker('expire');
     $expire->setLabel('Date for advert to expire: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $status = new Zend_Form_Element_Select('status');
     $status->SetLabel('Publish status: ')->setRequired(true)->addMultiOptions(array(NULL => 'Choose a status', '2' => 'Publish', '1' => 'Draft'))->setValue(2)->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators)->addErrorMessage('You must choose a status');
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'large');
     $this->addElements(array($title, $salary, $specification, $regionID, $live, $expire, $status, $submit));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElement($hash);
     $this->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('title', 'salary', 'specification', 'regionID'), 'details');
     $this->details->setLegend('Vacancy details');
     $this->details->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('live', 'expire', 'status'), 'dates');
     $this->dates->setLegend('Publication details');
     $this->dates->removeDecorator('DtDdWrapper');
     $this->setLegend('Vacancy details');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
コード例 #5
0
ファイル: ContactForm.php プロジェクト: lesleyauk/findsorguk
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $roles = new StaffRoles();
     $role_options = $roles->getOptions();
     $institutions = new Institutions();
     $insts = $institutions->getInsts();
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $users = new Users();
     $users_options = $users->getOptions();
     parent::__construct($options);
     $this->setName('contact');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a firstname')->addValidator('StringLength', false, array(1, 200));
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setLabel('Last name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a lastname');
     $role = new Zend_Form_Element_Select('role');
     $role->setLabel('Role within the Scheme: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a role', 'Available roles' => $role_options))->addErrorMessage('You must choose a role');
     $dbaseID = new Zend_Form_Element_Select('dbaseID');
     $dbaseID->setLabel('Database account: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose account', 'Available accounts' => $users_options))->addErrorMessage('You must enter a database account.');
     $email_one = new Zend_Form_Element_Text('email_one');
     $email_one->SetLabel('Primary email address: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false)->addErrorMessage('You must enter an email address');
     $email_two = new Zend_Form_Element_Text('email_two');
     $email_two->SetLabel('Secondary email address: ')->setAttrib('size', 50)->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(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a first line for the address');
     $address_2 = new Zend_Form_Element_Text('address_2');
     $address_2->SetLabel('Address line two: ')->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $town = new Zend_Form_Element_Text('town');
     $town->SetLabel('Town: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a town');
     $county = new Zend_Form_Element_Text('county');
     $county->SetLabel('County: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a county or unitary authority');
     $euroregion = new Zend_Form_Element_Text('euroregion');
     $euroregion->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(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('ValidPostCode')->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a postal code');
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('InArray', false, array(array_keys($countries_options)));
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->SetLabel('Telephone number: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a telephone number');
     $fax = new Zend_Form_Element_Text('fax');
     $fax->SetLabel('Fax number: ')->setRequired(false)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $identifier = new Zend_Form_Element_Select('identifier');
     $identifier->SetLabel('Database entry identifier: ')->setRequired(true)->addMultiOptions(array(null => null, 'Choose institution' => $insts))->addValidator('InArray', false, array(array_keys($insts)))->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 6));
     $region = new Zend_Form_Element_Select('region');
     $region->SetLabel('Recording region: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 10))->addValidator('InArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(null => null, 'Choose staff region' => $staffregions_options));
     $profile = new Pas_Form_Element_CKEditor('profile');
     $profile->setLabel('Profile: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilter('StringTrim')->addFilter('BasicHtml')->addFilter('EmptyParagraph')->addFilter('WordChars');
     $website = new Zend_Form_Element_Text('website');
     $website->SetLabel('Employer\'s website address: ')->setRequired(false)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 150));
     $alumni = new Zend_Form_Element_Checkbox('alumni');
     $alumni->SetLabel('Currently employed by the Scheme: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
     $submit = new Zend_Form_Element_Submit('submit');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElements(array($firstname, $lastname, $role, $dbaseID, $email_one, $email_two, $address_1, $address_2, $town, $postcode, $county, $identifier, $telephone, $fax, $region, $profile, $website, $alumni, $submit, $hash));
     $this->addDisplayGroup(array('firstname', 'lastname', 'role', 'dbaseID', 'identifier', 'region', 'profile', 'email_one', 'email_two', 'address_1', 'address_2', 'town', 'postcode', 'county', 'telephone', 'fax', 'website', 'alumni'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->details->setLegend('Contact details');
     parent::init();
 }
コード例 #6
0
 /** Give them a logo
  * @access public
  * @return void
  *
  */
 public function logoAction()
 {
     $form = new AddStaffLogoForm();
     $form->details->setLegend('Add a logo: ');
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $upload = new Zend_File_Transfer_Adapter_Http();
             $upload->addValidator('NotExists', true, array(self::LOGOPATH));
             if ($upload->isValid()) {
                 $filename = $form->getValue('image');
                 $insertData = array();
                 $insertData['host'] = $filename;
                 $insertData['updated'] = $this->getTimeForForms();
                 $insertData['updatedBy'] = $this->getIdentityForForms();
                 $regions = new StaffRegions();
                 $where = array();
                 $where[] = $regions->getAdapter()->quoteInto('id = ?', $this->getParam('id'));
                 $regions->update($insertData, $where);
                 $upload->receive();
                 $this->getFlash()->addMessage('The image has been resized and zoomified!');
                 $this->redirect('/admin/contacts/institution/id/' . $this->getParam('id'));
             } else {
                 $this->getFlash()->addMessage('There is a problem with your upload. Probably that image exists.');
                 $this->view->errors = $upload->getMessages();
             }
         } else {
             $form->populate($formData);
             $this->getFlash()->addMessage('Check your form for errors');
         }
     }
 }
コード例 #7
0
    /** Give them a logo
     */
    public function logoAction()
    {
        $form = new AddStaffLogoForm();
        $form->details->setLegend('Add a logo: ');
        $this->view->form = $form;
        if ($this->_request->isPost()) {
            $formData = $this->_request->getPost();
            if ($form->isValid($formData)) {
                $upload = new Zend_File_Transfer_Adapter_Http();
                $upload->addValidator('NotExists', true, array(self::LOGOPATH));
                if ($upload->isValid()) {
                    $filename = $form->getValue('image');
                    $insertData = array();
                    $insertData['host'] = $filename;
                    $insertData['updated'] = $this->getTimeForForms();
                    $insertData['updatedBy'] = $this->getIdentityForForms();
                    foreach ($insertData as $key => $value) {
                        if (is_null($value) || $value == "") {
                            unset($insertData[$key]);
                        }
                    }
                    $original = self::LOGOPATH . $filename;
                    $name = substr($filename, 0, strrpos($filename, '.'));
                    $ext = '.jpg';
                    $converted = $name . $ext;
                    $smallpath = self::LOGOPATH . 'thumbnails/' . $converted;
                    $mediumpath = self::LOGOPATH . 'resized/' . $converted;
                    //create medium size
                    $phMagick = new phMagick($original, $mediumpath);
                    $phMagick->resize(300, 0);
                    $phMagick->convert();
                    /* Zend_Debug::dump($convertsmall);
                    	Zend_Debug::dump($phMagick);
                    	exit; */
                    $phMagick = new phMagick($original, $smallpath);
                    $phMagick->resize(100, 0);
                    $phMagick->convert();
                    $regions = new StaffRegions();
                    $where = array();
                    $where[] = $regions->getAdapter()->quoteInto('id = ?', $this->_getParam('id'));
                    $regions->update($insertData, $where);
                    $upload->receive();
                    $this->_flashMessenger->addMessage('The image has been resized and zoomified!');
                    $this->_redirect('/admin/contacts/institution/id/' . $this->_getParam('id'));
                } else {
                    $this->_flashMessenger->addMessage('There is a problem with your upload. 
	Probably that image exists.');
                    $this->view->errors = $upload->getMessages();
                }
            } else {
                $form->populate($formData);
                $this->_flashMessenger->addMessage('Check your form for errors');
            }
        }
    }