public function __construct($options = null) { parent::__construct($options); $levels = new ProjectTypes(); $levelsListed = $levels->getDegrees(); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('education'); ZendX_JQuery::enableForm($this); $school = new Zend_Form_Element_Text('school'); $school->setLabel('Institution name: ')->setRequired(true)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 30)->addErrorMessage('Please enter a valid institutional name!')->setDecorators($decorators); $schoolUrl = new Zend_Form_Element_Text('schoolUrl'); $schoolUrl->setLabel('Institution web address: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->addValidator('Uri')->setAttrib('size', 30)->addErrorMessage('Please enter a valid url!')->setDecorators($decorators); $subject = new Zend_Form_Element_Text('subject'); $subject->setLabel('Subject studied: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 30)->addErrorMessage('Please enter a valid string!')->setDecorators($decorators); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Adademic level of study: ')->addMultiOptions(array(NULL => 'Choose an academic level', 'Valid levels' => $levelsListed))->setDecorators($decorators); $dateFrom = new ZendX_JQuery_Form_Element_DatePicker('dateFrom'); $dateFrom->setLabel('Commenced programme: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Date')->addValidator('NotEmpty')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->setJQueryParams(array('yearRange' => '-20:+10')); $dateTo = new ZendX_JQuery_Form_Element_DatePicker('dateTo'); $dateTo->setLabel('Finished programme: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Date')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper')->setJQueryParams(array('yearRange' => '-20:+10')); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($school, $schoolUrl, $subject, $level, $dateFrom, $dateTo, $submit)); $this->addDisplayGroup(array('school', 'schoolUrl', 'subject', 'level', 'dateFrom', 'dateTo'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Educational background'); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('suggested'); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a level', 'Research levels' => $projectype_list))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags')); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a period', 'Periods available' => $period_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags')); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.'); $description = new Pas_Form_Element_CKEditor('description'); $description->setLabel('Short description of project: ')->setRequired(false)->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph')); $valid = new Zend_Form_Element_Checkbox('taken'); $valid->setLabel('Is the topic taken: ')->setRequired(true)->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash)); $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), 'details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { parent::__construct($options); $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $this->setName('emailsearch'); ZendX_JQuery::enableForm($this); $message = new Zend_Form_Element_Textarea('messageToUser'); $message->setLabel('Message to user: '******'StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addFilter('BasicHtml')->addErrorMessage('You must enter a message to your recipient.'); $fullname = new Zend_Form_Element_Text('fullname'); $fullname->setLabel('Send this to: ')->addFilters(array('StringTrim', 'StripTags', 'Purifier'))->setAttrib('size', 30); $email = $this->addElement('text', 'email', array('label' => 'Their email Address', 'size' => '30'))->email; $email->addValidator('EmailAddress')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(60); $this->addElement($hash); $this->addElements(array($fullname, $submit, $message)); $this->addDisplayGroup(array('fullname', 'email', 'messageToUser'), 'details'); $this->details->setLegend('Details: '); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); ZendX_JQuery::enableForm($this); parent::__construct($options); $this->setName('research'); $investigator = new Zend_Form_Element_Text('investigator'); $investigator->setLabel('Principal work conducted by: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a lead for this project.'); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => null, 'Choose type of research' => $projectype_list))->addValidator('inArray', false, array(array_keys($projectype_list))); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 60)->addErrorMessage('Choose title for the project.'); $description = new Pas_Form_Element_CKEditor('description'); $description->setLabel('Short description of project: ')->setRequired(false)->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph')); $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate'); $startDate->setLabel('Start date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addErrorMessage('You must enter a start date for this project'); $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate'); $endDate->setLabel('End date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addErrorMessage('You must enter an end date for this project'); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Make public: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($title, $description, $level, $startDate, $endDate, $valid, $investigator, $submit)); $this->addDisplayGroup(array('title', 'investigator', 'level', 'description', 'startDate', 'endDate', 'valid'), 'details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $authors = new Users(); $authorOptions = $authors->getAuthors(); parent::__construct($options); $this->setName('activity'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Choose title for the project.'); $description = new Pas_Form_Element_CKEditor('description'); $description->setLabel('Short description of project: ')->setRequired(true)->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Basic')->addFilters(array('BasicHtml', 'EmptyParagraph', 'StringTrim')); $length = new Zend_Form_Element_Text('length'); $length->setLabel('Length of project: ')->setAttrib('size', 12)->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a duration for this project in months')->addValidator('Digits')->setDescription('Enter length in months'); $managedBy = new Zend_Form_Element_Select('managedBy'); $managedBy->setLabel('Managed by: ')->addMultiOptions(array('Choose an author' => $authorOptions))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($authorOptions)))->addErrorMessage('You must enter a manager for this project.'); $suitableFor = new Zend_Form_Element_Select('suitableFor'); $suitableFor->setLabel('Suitable for: ')->addMultiOptions(array(null => 'Choose type of research', 'Available types' => $projectype_list))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter suitability for this task.'); $location = new Zend_Form_Element_Text('location'); $location->setLabel('Where would this be located?: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a location for the task.'); $valid = new Zend_Form_Element_Checkbox('status'); $valid->setLabel('Publish this task? ')->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(480); $this->addElements(array($title, $description, $length, $valid, $managedBy, $suitableFor, $location, $submit, $hash)); $this->addDisplayGroup(array('title', 'description', 'length', 'location', 'suitableFor', 'managedBy', 'status', 'submit'), 'details'); $this->details->setLegend('Activity details: '); parent::init(); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); parent::__construct($options); $this->setName('activity'); $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'))); $decorators2 = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('HtmlTag', array('tag' => 'li'))); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Choose title for the project.')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Short description of project: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->addFilters(array('BasicHtml', 'EmptyParagraph', 'StringTrim'))->addDecorator('HtmlTag', array('tag' => 'li')); $length = new Zend_Form_Element_Text('length'); $length->setLabel('Length of project: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a duration for this project in months')->addValidator('Digits')->setDecorators($decorators); $managedBy = new Zend_Form_Element_Text('managedBy'); $managedBy->setLabel('Managed by: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a manager for this project.')->setDecorators($decorators); $suitableFor = new Zend_Form_Element_Select('suitableFor'); $suitableFor->setLabel('Suitable for: ')->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->setRequired(true)->addValidator('InArray', false, array($projectype_list))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter suitability for this task.')->setDecorators($decorators); $location = new Zend_Form_Element_Text('location'); $location->setLabel('Where would this be located?: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a location for the task.')->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Publish this task? ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->removeDecorator('HtmlTag'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setDecorators($decorators2); $this->addElements(array($title, $description, $length, $valid, $managedBy, $suitableFor, $location, $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->addDisplayGroup(array('title', 'description', 'length', 'location', 'suitableFor', 'managedBy', 'valid', 'submit'), 'details')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->removeDecorator('HtmlTag'); $this->details->setLegend('Activity details: '); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('suggested'); $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'))); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array('Please choose a level' => NULL, 'Research levels' => $projectype_list))->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array('Please choose a period' => NULL, 'Periods available' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.')->setDecorators($decorators); $description = $this->addElement('Textarea', 'description', array('label' => 'Short description of project: ')); $description = $this->getElement('description')->setRequired(false)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->setAttribs(array('cols' => 80, 'rows' => 10))->addDecorator('HtmlTag', array('tag' => 'li')); $valid = new Zend_Form_Element_Checkbox('taken'); $valid->setLabel('Is the topic taken: ')->setRequired(true)->setDecorators($decorators)->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->removeDecorator('label')->removeDecorator('HtmlTag')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper'); $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash)); $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), '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'); }
public function __construct($options = null) { parent::__construct($options); $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $this->setName('emailsearch'); ZendX_JQuery::enableForm($this); $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'))); $message = new Zend_Form_Element_Textarea('messageToUser'); $message->setLabel('Message to user: '******'StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addFilter('BasicHtml')->addErrorMessage('You must enter a message to your recipient.'); $fullname = new Zend_Form_Element_Text('fullname'); $fullname->setLabel('Send this to: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 30)->setDecorators($decorators); $email = $this->addElement('text', 'email', array('label' => 'Their email Address', 'size' => '30'))->email; $email->addValidator('EmailAddress')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!'); $email->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setLabel('Send to a friend'); $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($fullname, $submit, $message)); $this->addDisplayGroup(array('fullname', 'email', 'messageToUser'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Details: '); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); ZendX_JQuery::enableForm($this); parent::__construct($options); $this->setName('research'); $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'))); $investigator = new Zend_Form_Element_Text('investigator'); $investigator->setLabel('Principal work conducted by: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a lead for this project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->addValidator('inArray', false, array(array_keys($projectype_list)))->setDecorators($decorators); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Choose title for the project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $description = $this->addElement('RTE', 'description', array('label' => 'Short description of project: ')); $description = $this->getElement('description')->setRequired(false)->addFilter('stringTrim')->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->addDecorator('HtmlTag', array('tag' => 'li')); $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate'); $startDate->setLabel('Start date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->addValidator('Date')->setRequired(false)->addErrorMessage('You must enter a start date for this project')->setDecorators($decorators); $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate'); $endDate->setLabel('End date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addValidator('Date')->addErrorMessage('You must enter an end date for this project')->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Make public: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->removeDecorator('label')->setAttrib('class', 'large')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElements(array($title, $description, $level, $startDate, $endDate, $valid, $investigator, $submit, $hash)); $this->addDisplayGroup(array('title', 'investigator', 'level', 'description', 'startDate', 'endDate', 'valid'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { parent::__construct($options); $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $this->setName('acceptupgrades'); ZendX_JQuery::enableForm($this); $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'))); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->setDecorators($decorators)->addFilter('StripTags')->addFilter('StringTrim')->addErrorMessage('You must set the level of research'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('size', 60)->addErrorMessage('This project needs a title.')->setDecorators($decorators); $researchOutline = new Pas_Form_Element_RTE('researchOutline'); $researchOutline->setLabel('Research outline: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilter('StringTrim')->addFilter('BasicHtml')->addFilter('EmptyParagraph')->addFilter('WordChars')->addErrorMessage('Outline must be present.'); $reference = new Zend_Form_Element_Text('reference'); $reference->setLabel('Referee\'s name: ')->setAttrib('size', 30)->addFilter('StringTrim')->addFilter('StripTags')->setDecorators($decorators); $referenceEmail = new Zend_Form_Element_Text('referenceEmail'); $referenceEmail->setLabel('Referee\'s email address: ')->setAttrib('size', 30)->addValidator('EmailAddress')->addFilter('StringToLower')->addFilter('StringTrim')->addFilter('StripTags')->setDecorators($decorators); $message = new Pas_Form_Element_RTE('message'); $message->setLabel('Message to user: '******'rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilter('StringTrim')->addFilter('BasicHtml')->addFilter('EmptyParagraph')->addFilter('WordChars')->addErrorMessage('You must enter a message for the user to know they have been approved.'); $fullname = new Zend_Form_Element_Text('fullname'); $fullname->setLabel('Fullname: ')->setAttrib('size', 30)->addFilter('StringTrim')->addFilter('StripTags')->setDecorators($decorators); $institution = $this->addElement('select', 'institution', array('label' => 'Recording institution: '))->institution; $institution->setDecorators($decorators)->addMultiOptions(array(NULL => NULL, 'Choose institution' => $inst_options)); $role = $this->addElement('select', 'role', array('label' => 'Site role: '))->role; $role->setDecorators($decorators); $role->addMultiOptions(array(NULL => NULL, 'Choose role' => $role_options)); $role->removeMultiOption('admin'); $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate'); $startDate->setLabel('Start date of project: ')->setAttrib('size', 12)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilter('StringTrim')->addFilter('StripTags')->addValidator('Date')->setRequired(false)->addErrorMessage('You must enter a valid start date for this project'); $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate'); $endDate->setLabel('End date of project: ')->addValidator('Date')->addFilter('StringTrim')->addFilter('StripTags')->setJQueryParam('dateFormat', 'yy-mm-dd')->setAttrib('size', 12)->setRequired(false)->addErrorMessage('You must enter a valid end date for this project'); $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email; $email->addValidator('emailAddress')->setRequired(true)->addFilter('StringToLower')->addErrorMessage('Please enter a valid address!')->setDecorators($decorators); $already = new Zend_Form_Element_Radio('already'); $already->setLabel('Is your topic already listed on our research register?: ')->addMultiOptions(array(1 => 'Yes it is', 0 => 'No it isn\'t'))->setRequired(true)->setOptions(array('separator' => ''))->setDecorators($decorators); $insert = new Zend_Form_Element_Checkbox('insert'); $insert->setLabel('Insert details into research register: ')->setCheckedValue(1)->setDecorators($decorators); $valid = new Zend_Form_Element_Radio('higherLevel'); $valid->setLabel('Approve?: ')->addMultiOptions(array(1 => 'Unauthorised', 0 => 'Authorised'))->setRequired(true)->setOptions(array('separator' => ''))->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($reference, $referenceEmail, $researchOutline, $startDate, $endDate, $fullname, $valid, $level, $title, $submit, $already, $insert, $message)); $this->addDisplayGroup(array('fullname', 'username', 'email', 'institution', 'level', 'role', 'reference', 'referenceEmail', 'message', 'researchOutline', 'title', 'startDate', 'endDate', 'already', 'higherLevel', 'insert'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Details: '); $this->addDisplayGroup(array('submit'), 'submit'); }
/** * This method returns the project types for the given id. * Returns model if successfully found. * Returns false if not found. * * @return model || false */ public static function getProjectTypeById($Id) { $projectType = ProjectTypes::model()->findByPk($Id); if ($projectType) { return $projectType->project_type; } else { return false; } }
public function __construct($options = null) { parent::__construct($options); $roles = new Roles(); $role_options = $roles->getRoles(); $inst = new Institutions(); $inst_options = $inst->getInsts(); $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $this->setName('acceptupgrades'); ZendX_JQuery::enableForm($this); $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'))); $researchOutline = new Zend_Form_Element_Textarea('researchOutline'); $researchOutline->setLabel('Research outline: ')->setRequired(true)->addFilters(array('StringTrim', 'BasicHtml'))->setAttribs(array('rows' => 10))->addErrorMessage('Outline must be present.'); $message = new Zend_Form_Element_Textarea('messageToUser'); $message->setLabel('Message to user: '******'StringTrim', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addErrorMessage('You must enter a message for the user to know they have been approved.'); $reference = new Zend_Form_Element_Text('reference'); $reference->setLabel('Referee\'s name: ')->setAttrib('size', 30)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $referenceEmail = new Zend_Form_Element_Text('referenceEmail'); $referenceEmail->setLabel('Referee\'s email address: ')->setAttrib('size', 30)->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->addValidator('EmailAddress', false, array('mx' => true))->setDecorators($decorators); $fullname = new Zend_Form_Element_Text('fullname'); $fullname->setLabel('Fullname: ')->setAttrib('size', 30)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email; $email->setRequired(true)->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->addValidator('EmailAddress', false, array('mx' => true))->addErrorMessage('Please enter a valid address!'); $email->setDecorators($decorators); $already = new Zend_Form_Element_Radio('already'); $already->setLabel('Is your topic already listed on our research register?: ')->addMultiOptions(array(1 => 'Yes it is', 0 => 'No it isn\'t'))->setRequired(true)->setOptions(array('separator' => ''))->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setLabel('Reject application'); $this->addElements(array($researchOutline, $fullname, $reference, $referenceEmail, $submit, $message)); $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->addDisplayGroup(array('fullname', 'email', 'messageToUser', 'reference', 'referenceEmail', 'researchOutline'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Details: '); $this->addDisplayGroup(array('submit'), 'submit'); }
echo $form->labelEx($model, 'description'); ?> <?php echo $form->textArea($model, 'description', array('rows' => 6, 'cols' => 50)); ?> <?php echo $form->error($model, 'description'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'project_type_id'); ?> <?php echo $form->dropDownList($model, 'project_type_id', CHtml::listData(ProjectTypes::model()->findAll(), 'id', 'project_type'), array('empty' => 'Select')); ?> <?php echo $form->error($model, 'project_type_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'ownership_type_id'); ?> <?php echo $form->dropDownList($model, 'ownership_type_id', CHtml::listData(CategoryOwnershipTypes::model()->findAll(), 'id', 'ownership_type'), array('empty' => 'Select')); ?> <?php echo $form->error($model, 'ownership_type_id');
public function actionFind() { $location = Yii::app()->Ini->getlocationbyip(Yii::app()->Ini->rip('ip')); $projects = Projecttypes::model()->findAll(array('order' => 'Name ASC')); $criteria = new CDbCriteria(); $criteria->order = "question_id DESC"; $criteria->limit = 5; $questions = Questions::model()->findAll($criteria); $states = States::model()->findAll(array('order' => 'Name ASC')); $city = Yii::app()->Ini->v('city'); $project = Yii::app()->Ini->v('project'); $zipcode = Yii::app()->Ini->v('zipcode'); $match = Yii::app()->Ini->v('match'); $homeowner_projects = $this->getHomeOwnerProjects(); $pie = new SimplePie(); $pie->set_feed_url('http://media.handyman.com/feed/'); $pie->init(); $pie->handle_content_type(); if ($city) { $details = Cities::model()->findByAttributes(array('RewriteUrl' => $city . "/")); if (count($details) > 0) { $city_name = $details->Name; } else { $city_name = ""; } $criteria = new CDbCriteria(); $criteria->condition = "City like '%{$city_name}%'"; $count = Contractors::model()->count($criteria); $pages = new CPagination($count); // results per page $pages->pageSize = 5; $pages->applyLimit($criteria); $models = Contractors::model()->findAll($criteria); $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $city_name, 'location' => $city_name . ",USA", 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie)); } else { if ($project && $zipcode) { $details = Projecttypes::model()->findByAttributes(array('ProjectTypeId' => $project)); if (count($details) > 0) { $oid = $details->OID; $city_name = $details->Name; $home_advisor = Yii::app()->Ini->searchhomeadvisor($zipcode, $oid); //$home_advisor = Yii::app()->Ini->searchhomeadvisor('11741','12005'); if ($home_advisor == false) { $home_advisor_results = false; } else { $home_advisor_results = $home_advisor['serviceProvider']; } } $criteria = new CDbCriteria(); $criteria->condition = "ProjectTypeId='" . $project . "' AND Zip='" . $zipcode . "'"; $count = Contractors::model()->count($criteria); $pages = new CPagination($count); // results per page $pages->pageSize = 5; $pages->applyLimit($criteria); $models = Contractors::model()->findAll($criteria); $this->render('match-result', array('pages' => $pages, 'result' => $models, 'home_advisors' => $home_advisor_results, 'projects' => $projects, 'states' => $states, 'location' => $location, 'city_name' => $city_name . ' In Zipcode ' . $zipcode, 'questions' => $questions, 'feed' => $pie)); } else { if ($project) { $details = Projecttypes::model()->findByAttributes(array('ProjectTypeId' => $project)); if (count($details) > 0) { $city_name = $details->Name; } $criteria = new CDbCriteria(); $criteria->condition = "ProjectTypeId=" . $project; $count = Contractors::model()->count($criteria); $pages = new CPagination($count); // results per page $pages->pageSize = 5; $pages->applyLimit($criteria); $models = Contractors::model()->findAll($criteria); $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $city_name, 'location' => $location, 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie)); } else { if ($zipcode) { $criteria = new CDbCriteria(); $criteria->condition = "Zip='{$zipcode}'"; $count = Contractors::model()->count($criteria); $pages = new CPagination($count); // results per page $pages->pageSize = 5; $pages->applyLimit($criteria); $models = Contractors::model()->findAll($criteria); $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $zipcode, 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie)); } else { if ($match) { $proj = Projects::model()->findByPk($match); if (count($proj) > 0) { $proj_zipcode = $proj->zipcode; $project_type_id = $proj->project_type_id; $criteria = new CDbCriteria(); $criteria->condition = "ProjectTypeId='" . $project_type_id . "' AND Zip = '" . $proj_zipcode . "'"; $count = Contractors::model()->count($criteria); $pages = new CPagination($count); $result = Contractors::model()->findAll($criteria); $projecttypes = ProjectTypes::model()->findByPK($project_type_id); $proj_oid = $projecttypes->OID; //$proj_zipcode = '11741'; //$proj_oid = '12070'; $home_advisor = Yii::app()->Ini->searchhomeadvisor($proj_zipcode, $proj_oid); if ($home_advisor == false) { $home_advisor_results = false; } else { $home_advisor_results = $home_advisor['serviceProvider']; } $this->render('match-result', array('pages' => $pages, 'result' => $result, 'home_advisors' => $home_advisor_results, 'projects' => $projects, 'states' => $states, 'location' => $location, 'city_name' => $this->getProjectTypeName($project_type_id) . ' In Zipcode ' . $proj_zipcode, 'questions' => $questions, 'feed' => $pie)); } else { $this->render('find_form', array('projects' => $projects, 'states' => $states, 'location' => $location, 'questions' => $questions)); } } else { $this->render('find_form', array('projects' => $projects, 'states' => $states, 'location' => $location, 'questions' => $questions, 'feed' => $pie)); } } } } } }
<span class="required">*</span></span> <?php echo $form->textArea($model, 'company_description', array('class' => 'txtarea')); ?> </li> <li class="error_message"><?php echo $form->error($model, 'company_description'); ?> </li> </ul> </fieldset> <fieldset><legend>Deals In</legend> <ul> <li><span><label for="Property_description" class="required">Property Type <span class="required">*</span></label></span> <div class="multi_checkbox avg"> <?php echo CHtml::checkBoxList('project_type_id', $projecttypes, CHtml::listData(ProjectTypes::model()->findAll(), 'id', 'project_type')); ?> </div> </li> <li class="error_message"><?php echo $form->error($projectType, 'project_type_id'); ?> </li> </ul> <?php if ($locationCityIds) { $i = 0; $data = 'City'; foreach ($locationCityIds as $i => $location) { if ($i > 0) { $data = ' ';
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = ProjectTypes::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<ul class="acc" id="acc2"> <li> <h3>Basic Details</h3> <div class="acc-section"> <table width="92%" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td><input type="checkbox" value="1" name="new_launches" <?php echo $launchesChecked; ?> > <label>New launches</label> </td> </tr> <tr> <td><label>Project Type</label> <?php echo $form->dropDownList($modelProject, 'project_type_id', CHtml::listData(ProjectTypes::model()->findAll(), 'id', 'project_type'), array('class' => 'select_box', 'empty' => 'All')); ?> </td> </tr> <tr> <td>Keyword(s)<input type="text" name="keyword" class="txt-box1" value="<?php echo isset($_POST['keyword']) ? $_POST['keyword'] : ''; ?> " /></td> </tr> </table> </div> </li> <li> <h3>Location</h3> <div class="acc-section">