Esempio n. 1
0
File: Event.php Progetto: GEANT/CORE
 public function init()
 {
     $this->setAction('/core/event/new');
     $this->setAttrib('enctype', 'multipart/form-data');
     $eventModel = new Core_Model_Event();
     $category = new Zend_Form_Element_Select('category_id');
     $category->setLabel('Category')->setMultiOptions($eventModel->getCategories())->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title')->setRequired(true)->addValidator('regex', true, array('pattern' => '/^.*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Wrong format')))->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'sessions', 'field' => 'title')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 30 characters, only letters, numbers and spaces allowed')->setDecorators(array('Composite'));
     $desc = new Zend_Form_Element_Textarea('description');
     $desc->setLabel('Description')->setAttrib('class', 'medium')->setDescription('Please don\'t make your description too long')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $locationModel = new Core_Model_Location();
     $location = new Zend_Form_Element_Select('location_id');
     $location->setLabel('Location')->setDescription('<a href="/core/location/new/type/2">Add a new location</a>')->setMultiOptions($locationModel->getLocationsForSelect())->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $closed = new Zend_Form_Element_Checkbox('closed');
     $closed->setLabel('Closed meeting')->setRequired(false)->setDecorators(array('Composite'));
     $cancelled = new Zend_Form_Element_Checkbox('cancelled');
     $cancelled->setLabel('Meeting cancelled')->setRequired(false)->setDecorators(array('Composite'));
     $registration = new Zend_Form_Element_Text('registration');
     $registration->setLabel('Registration link')->addValidator('Url')->setAttrib('class', 'medium')->setDescription('Please supply a valid Url')->setDecorators(array('Composite'));
     $person = new Zend_Form_Element_Text('persons');
     $person->setLabel('Persons')->setAttrib('class', 'medium')->setDescription('Please add person(s)')->setDecorators(array('Composite'));
     $start = new Zend_Form_Element_Text('tstart');
     $start->setLabel('Start')->setDescription('dd/MM/yyyy HH:mm - 23/11/2011 14:30')->setAttrib('class', 'medium')->addFilter('Null')->setRequired(false)->setDecorators(array('Composite'));
     $end = new Zend_Form_Element_Text('tend');
     $end->setLabel('End')->setDescription('dd/MM/yyyy HH:mm')->setAttrib('class', 'medium')->addFilter('Null')->addValidator('DateIsLater', false, array('tstart'))->setRequired(false)->setDecorators(array('Composite'));
     $resize = new TA_Filter_ImageResize();
     $resize->setWidth(260)->setHeight(170);
     $image = new TA_Form_Element_MagicFile('file');
     $image->setLabel('Image')->setDescription('This image will show on the event details page')->addDecorators($this->_magicFileElementDecorator)->addFilter($resize)->addValidators(array(array('Count', true, 1), array('IsImage', true), array('Size', true, array('max' => '5Mb')), array('ImageSize', true, array('minwidth' => 300, 'minheight' => 200))));
     $this->addElements(array($category, $title, $person, $start, $end, $registration, $desc, $location, $closed, $cancelled, $image));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Esempio n. 2
0
 public function init()
 {
     $this->setAction('/core/submit/new');
     $type = new Zend_Form_Element_MultiCheckbox('submission_type');
     $type->setLabel('')->setRequired(false)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('submission_type'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title')->setRequired(true)->addValidator('StringLength', true, array(2, 64, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer title', Zend_Validate_StringLength::TOO_LONG => 'Your title is too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 64 characters')->setAttrib('maxLength', 64)->setDecorators(array('Composite'));
     $audience = new Zend_Form_Element_Radio('target_audience');
     $audience->setLabel('Please mark the target audience for your presentation')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('target_audience'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $publish = new Zend_Form_Element_Radio('publish_paper');
     $publish->setLabel('Please indicate whether you wish to prepare a full paper for possible publication')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('publish_paper', 'submit'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $topicModel = new Core_Model_Topic();
     $topicsForSelect = $topicModel->getTopicsForSelect();
     $topicsel = new Zend_Form_Element_MultiCheckbox('topic');
     $topicsel->setLabel('Topic')->setRequired(false)->setAttrib('class', 'tiny')->setMultiOptions($topicsForSelect)->setSeparator('<br />')->setDecorators(array('Composite'));
     $keywords = new Zend_Form_Element_Text('keywords');
     $keywords->setLabel('Keywords')->setRequired(false)->addValidator('StringLength', true, array(2, 500, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide longer keywords', Zend_Validate_StringLength::TOO_LONG => 'Your keywords are too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 500 characters')->setDecorators(array('Composite'));
     $abstract = new Zend_Form_Element_Textarea('abstract');
     $abstract->setLabel('Submission Summary (If your submission is accepted, this will be publicly visible!)')->setAttrib('class', 'small')->setDescription('Must be between 5 and 2000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 2000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer abstract', Zend_Validate_StringLength::TOO_LONG => 'Your abstract is too long')))->setDecorators(array('Composite'));
     $comment = new Zend_Form_Element_Textarea('comment');
     $comment->setLabel('Information for Reviewers')->setAttrib('class', 'small')->setDescription('Must be between 5 and 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $file = new TA_Form_Element_MagicFile('file');
     $file->setLabel('Your submission (File must be pdf and no bigger than 10Mb) *')->setRequired(false)->addDecorators($this->_magicFileElementDecorator)->addValidators(array(array('Count', true, 1), array('Size', true, 10000000), array('Extension', true, array('pdf', 'case' => true)), array('MimeType', false, array('application/pdf'))));
     $file->getValidator('Extension')->setMessage('Only pdf files are allowed!');
     $subform = new Zend_Form_SubForm();
     $subform->setDecorators(array('FormElements'));
     $subform->addElements(array($type, $file, $title, $audience, $topicsel, $keywords, $abstract, $comment));
     $this->addSubForm($subform, 'submission');
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Esempio n. 3
0
File: User.php Progetto: GEANT/CORE
 public function init()
 {
     $this->setAction('/core/user/new');
     $this->setAttrib('enctype', 'multipart/form-data');
     $fname = new Zend_Form_Element_Text('fname');
     $fname->setLabel('First Name')->setRequired(true)->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $lname = new Zend_Form_Element_Text('lname');
     $lname->setLabel('Last Name')->setRequired(true)->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $organisation = new Zend_Form_Element_Text('organisation');
     $organisation->setLabel('Organisation')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $country = new TA_Form_Element_Country('country');
     $country->setLabel('Country')->setDecorators(array('Composite'));
     $jobtitle = new Zend_Form_Element_Text('jobtitle');
     $jobtitle->setLabel('Job title')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $profile = new Zend_Form_Element_Textarea('profile');
     $profile->setLabel('Biography')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setRequired(true)->setAttrib('class', 'medium')->setDescription('the invitation will be sent to this address')->addValidators(array(array('EmailAddress', true)))->setDecorators(array('Composite'));
     $resize = new TA_Filter_ImageResize();
     $resize->setWidth(260)->setHeight(170);
     $image = new TA_Form_Element_MagicFile('file');
     $image->setLabel('Picture')->setDescription('Image should be at least 300 pixels wide and 200 pixels high, and not be over 5Mb')->addDecorators($this->_magicFileElementDecorator)->addFilter($resize)->addValidators(array(array('Count', true, 1), array('IsImage', true), array('Size', true, array('max' => '5Mb')), array('ImageSize', true, array('minwidth' => 300, 'minheight' => 200))));
     $this->addElements(array($fname, $lname, $organisation, $email, $country, $jobtitle, $profile, $image));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Esempio n. 4
0
 public function init()
 {
     parent::init();
     $this->setAction('/core/session/files');
     $this->setAttrib('enctype', 'multipart/form-data');
     $id = new Zend_Form_Element_Hidden('session_id');
     $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite'));
     // the name of this form element must be of an existing filetype
     $file1 = new TA_Form_Element_MagicFile('slides');
     $file1->setLabel('Session slide')->setDescription('')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '4Mb'))));
     $subForm = new Zend_Form_SubForm();
     $subForm->addElements(array($file1))->setDecorators(array('FormElements'));
     $this->addSubForm($subForm, 'files');
     $this->addElements(array($id));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Esempio n. 5
0
 public function init()
 {
     $this->setAction('/core/poster/new');
     $this->setAttrib('enctype', 'multipart/form-data');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title')->setRequired(true)->addValidator('regex', true, array('pattern' => '/^.*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Wrong format')))->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'posters', 'field' => 'title')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 30 characters, only letters, numbers and spaces allowed')->setDecorators(array('Composite'));
     $desc = new Zend_Form_Element_Textarea('description');
     $desc->setLabel('Description')->setAttrib('class', 'medium')->setDescription('Please don\'t make your description too long')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $person = new Zend_Form_Element_Text('persons');
     $person->setLabel('Persons')->setAttrib('class', 'medium')->setDescription('Please add person(s)')->setDecorators(array('Composite'));
     $cats = new Zend_Form_Element_Select('category');
     $cats->setLabel('Category')->setAttrib('class', 'small')->setMultiOptions($this->_getFieldValues('categories', 'poster'))->setDecorators(array('Composite'));
     $file = new TA_Form_Element_MagicFile('file');
     $file->setLabel('File')->addDecorators($this->_magicFileElementDecorator)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '5Mb'))));
     $this->addElements(array($title, $desc, $person, $cats, $file));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Esempio n. 6
0
File: Files.php Progetto: GEANT/CORE
 public function init()
 {
     parent::init();
     $this->setAttrib('enctype', 'multipart/form-data');
     $id = new Zend_Form_Element_Hidden('presentation_id');
     $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite'));
     $paper = new TA_Form_Element_MagicFile('paper');
     $paper->setLabel('Paper')->setDescription('OpenOffice, PDF, and Microsoft Word are acceptable formats.')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb'))));
     $slides = new TA_Form_Element_MagicFile('slides');
     $slides->setLabel('Slides')->setDescription('Microsoft Powerpoint, OpenOffice, and PDF are acceptable formats.')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb'))));
     $file1 = new TA_Form_Element_MagicFile('misc');
     $file1->setLabel('Extra file')->setDescription('')->addDecorators($this->_magicFileElementDecorator)->setValueDisabled(true)->addValidators(array(array('Count', true, 1), array('Size', true, array('max' => '64Mb'))));
     $subForm = new Zend_Form_SubForm();
     $subForm->addElements(array($paper, $slides, $file1))->setDecorators(array('FormElements'));
     $this->addSubForm($subForm, 'files');
     $this->addElements(array($id));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Esempio n. 7
0
 public function init()
 {
     $this->setAction('/core/location/new');
     $this->_conference = Zend_Registry::get('conference');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name')->setRequired(true)->addValidator('regex', true, array('pattern' => '/^[a-zA-Z0-9\\s]{2,100}$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Wrong format')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 100 characters, only letters, numbers and spaces allowed')->setDecorators(array('Composite'));
     $abbreviation = new Zend_Form_Element_Text('abbreviation');
     $abbreviation->setLabel('Abbreviation')->addValidator('regex', true, array('pattern' => '/^[a-zA-Z0-9\\s]{1,10}$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Wrong format')))->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'locations', 'field' => 'abbreviation', 'exclude' => 'conference_id = ' . $this->_conference['conference_id'])))->setRequired(true)->setAttrib('class', 'medium')->setDescription('Must be between 1 and 10 characters, only letters, numbers and spaces allowed')->setDecorators(array('Composite'));
     $comments = new Zend_Form_Element_Textarea('comments');
     $comments->setLabel('Description')->setAttrib('class', 'small')->setDescription('Must be between 1 and 10 characters')->setRequired(false)->setDecorators(array('Composite'));
     $capacity = new Zend_Form_Element_Text('capacity');
     $capacity->setLabel('Capacity')->setAttrib('class', 'tiny')->addValidator('Int')->addFilter('Null')->setRequired(false)->setDecorators(array('Composite'));
     $types = new Zend_Form_Element_Select('type');
     $types->setLabel('Type')->setAttrib('class', 'small')->setRequired(true)->setDescription('Only locations with "room" type will be shown in the schedule')->setMultiOptions($this->_getFieldValues('types', 'location'))->setDecorators(array('Composite'));
     $address = new TA_Form_Element_Location('address');
     $address->setLabel('Address')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $resize = new TA_Filter_ImageResize();
     $resize->setWidth(90)->setHeight(68);
     $image = new TA_Form_Element_MagicFile('file');
     $image->setLabel('Picture')->setDescription('This will be the thumbnail for the live streaming box on the homepage')->addDecorators($this->_magicFileElementDecorator)->addFilter($resize)->addValidators(array(array('Count', true, 1), array('IsImage', true), array('Size', true, array('max' => '5Mb')), array('ImageSize', true, array('minwidth' => 300, 'minheight' => 200))));
     $this->addElements(array($types, $name, $abbreviation, $address, $comments, $capacity, $image));
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }
Esempio n. 8
0
 public function init()
 {
     $this->setAction('/core/submit/new');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title of paper')->setRequired(true)->addValidator('StringLength', true, array(2, 150, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer title', Zend_Validate_StringLength::TOO_LONG => 'Your title is too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 150 characters')->setDecorators(array('Composite'));
     $audience = new Zend_Form_Element_Radio('target_audience');
     $audience->setLabel('Please mark the target audience for your presentation')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('target_audience'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $publish = new Zend_Form_Element_Radio('publish_paper');
     $publish->setLabel('Please indicate whether you wish to prepare a full paper for possible publication')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('publish_paper', 'submit'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $topicsel = new Zend_Form_Element_Radio('topic');
     $topicsel->setLabel('Topic')->setRequired(true)->setAttrib('class', 'tiny')->addMultiOptions($this->_getFieldValues('topic'))->setSeparator('<br />')->setDecorators(array('Composite'));
     $keywords = new Zend_Form_Element_Text('keywords');
     $keywords->setLabel('Keywords')->setRequired(false)->addValidator('StringLength', true, array(2, 500, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide longer keywords', Zend_Validate_StringLength::TOO_LONG => 'Your keywords are too long')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 500 characters')->setDecorators(array('Composite'));
     $comment = new Zend_Form_Element_Textarea('comment');
     $comment->setLabel('Comment')->setAttrib('class', 'small')->setDescription('Must be between 5 and 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(5, 1000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite'));
     $file = new TA_Form_Element_MagicFile('file');
     $file->setLabel('Your submission')->setRequired(true)->addDecorators($this->_magicFileElementDecorator)->setDescription('File must be a maximum of 10Mb')->addValidators(array(array('Count', true, 1), array('Size', true, 10000000)));
     $subform = new Zend_Form_SubForm();
     $subform->setDecorators(array('FormElements'));
     $subform->addElements(array($title, $audience, $publish, $topicsel, $keywords, $comment, $file));
     $this->addSubForm($subform, 'submission');
     $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator));
 }