Example #1
0
File: Event.php Project: 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));
 }
Example #2
0
File: User.php Project: 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));
 }
Example #3
0
 /**
  * Gets thumbnail if there is one
  *
  * @return	mixed	false if there is no thumbnail or the fullpath
  * 					and name if there is.
  */
 public function getThumb()
 {
     $resize = new TA_Filter_ImageResize();
     $thumbName = $this->filename . $resize->getThumbnailSuffix();
     if (file_exists(Zend_Registry::get('config')->directories->uploads . $thumbName)) {
         return $thumbName;
     }
     return false;
 }
Example #4
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));
 }