Exemple #1
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAction('/main/new');
     $this->setAttrib('id', 'newRoute');
     $note = new Zend_Form_Element_Note('title', array('value' => '<h2 id="titleProductDetails">Create a New Route</h2>'));
     $intermed = new Zend_Form_Element_Hidden('intermed');
     $intermed->setAttrib('readonly', 'readonly');
     $intermed->addFilter('StripTags');
     $intermed->addFilter('HtmlEntities');
     $intermed->addFilter('StringTrim');
     $start = new Zend_Form_Element_Text('startForm');
     $start->setLabel('Starting Point*');
     $start->setAttrib('autocomplete', 'off');
     $start->addFilter('StripTags');
     $start->addFilter('HtmlEntities');
     $start->setAttrib('class', 'form-control');
     $start->addFilter('StringTrim');
     $start->setRequired(true)->addErrorMessage('Start Location Required');
     //        $start->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\s]*$/'))->addErrorMessage('Invalid characters used');
     //        $start->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $end = new Zend_Form_Element_Text('endForm');
     $end->setLabel('Destination*');
     $end->setAttrib('autocomplete', 'off');
     $end->addFilter('StripTags');
     $end->setAttrib('class', 'form-control');
     $end->addFilter('HtmlEntities');
     $end->addFilter('StringTrim');
     $end->setRequired(true)->addErrorMessage('Destination Required');
     //        $end->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
     $routeDate = new Zend_Form_Element_Text('routeDate');
     $routeDate->setAttrib('autocomplete', 'off');
     $routeDate->setAttrib('readonly', 'readonly');
     $routeDate->setAttrib('maxlength', '10');
     $routeDate->setAttrib('class', 'form-control');
     $routeDate->setLabel('Date of Journey' . '*');
     $routeDate->addFilter('StripTags');
     $routeDate->addFilter('HtmlEntities');
     $routeDate->addFilter('StringTrim');
     $routeDate->setRequired(true)->addErrorMessage('Date Required');
     $routeDate->addValidator('Regex', true, array('/^[0-9.\\s]*$/'))->addErrorMessage('Invalid characters used');
     $routeDate->addValidator('StringLength', true, array(10, 10))->addErrorMessage('Required Field');
     $passangers = new Zend_Form_Element_Select('passangers');
     $passangers->setLabel('No of Passangers*');
     $passangers->setAttrib('autocomplete', 'off');
     $passangers->setAttrib('class', 'form-control');
     $passangers->addFilter('StripTags');
     $passangers->addFilter('HtmlEntities');
     $passangers->addFilter('StringTrim');
     $passangers->setRequired(true)->addErrorMessage('Password Required');
     $passangers->setMultiOptions(array('1' => '1 Passanger', '2' => '2 Passangers', '3' => '3 Passangers', '4' => '4 Passangers', '5' => '5 Passangers', '6' => '6 Passangers'));
     $submit = new Zend_Form_Element_Submit('newRoute');
     $submit->setLabel('New Route');
     $submit->setAttrib('class', 'btn btn-info');
     $submit->setAttrib('style', 'margin-top:20px');
     $this->addElements(array($note, $intermed, $start, $end, $passangers, $routeDate, $submit));
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
     $submit->setDecorators(array('ViewHelper'));
     $this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'div', 'id' => 'newRouteFormContainer'))));
 }
Exemple #2
0
 /**
  *
  */
 protected function initIdPersonElement()
 {
     $element = new \Zend_Form_Element_Select('id_person');
     $options = \Application\Query\PersonQuery::create()->find()->toCombo();
     $element->addMultiOptions($options);
     $element->setLabel($this->getTranslator()->_('IdPerson'));
     $element->addValidator($this->validator->getFor('id_person'));
     $element->addFilter($this->filter->getFor('id_person'));
     $element->setRequired(true);
     $this->addElement($element);
     $this->elements['id_person'] = $element;
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'shortlistedcandidates/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'businessunits');
     $id = new Zend_Form_Element_Hidden('id');
     $selectionstatus = new Zend_Form_Element_Select('selectionstatus');
     $selectionstatus->setRequired(true)->addErrorMessage('Please change the candidate status.');
     $selectionstatus->addFilter('Int')->addValidator('NotEmpty', true, array('integer', 'zero'));
     $selectionstatus->setLabel('domain')->setMultiOptions(array('0' => 'Select status', '2' => 'Selected', '3' => 'Rejected'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Update');
     $this->addElements(array($id, $selectionstatus, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
 public function init()
 {
     $naoVazio = new Zend_Validate_NotEmpty();
     $categoriaTB = new Application_Model_DbTable_Categoria();
     $categorias = $categoriaTB->fetchAll(null, 'categoria');
     $array = array(0 => 'Selecione uma categoria');
     foreach ($categorias as $categoria) {
         $array[$categoria->idcategoria] = $categoria->categoria;
     }
     $idcategoria = new Zend_Form_Element_Select('idcategoria', array('label' => 'Categoria:', 'required' => true, 'multioptions' => $array));
     $idcategoria->addValidator($naoVazio);
     $filter = new Zend_Filter_Null();
     $idcategoria->addFilter($filter);
     $this->addElement($idcategoria);
     $titulo = new Zend_Form_Element_Text('titulo', array('label' => 'Titulo:', 'required' => true));
     $titulo->addValidator($naoVazio);
     $this->addElement($titulo);
     $texto = new Zend_Form_Element_Textarea('texto', array('label' => 'Texto:', 'required' => true));
     $texto->addValidator($naoVazio);
     $this->addElement($texto);
     $botao = new Zend_Form_Element_Submit('botao', array('label' => 'Salvar'));
     $this->addElement($botao);
 }
Exemple #5
0
 protected function _id_tipo_horario()
 {
     $e = new Zend_Form_Element_Select('id_tipo_horario');
     $e->setLabel('* Tipo Horário:');
     $e->setRequired();
     $e->addFilter('Int');
     $e->setAttrib('class', 'form-control');
     $model = new Admin_Model_TipoHorario();
     $rs = $model->getAdapter()->fetchAll("SELECT id_tipo_horario,\n            intervalo_minutos, TO_CHAR(horario_inicial, 'HH24:MI') as horario_inicial,\n            TO_CHAR(horario_final, 'HH24:MI') as horario_final\n            FROM tipo_horario ORDER BY id_tipo_horario");
     foreach ($rs as $item) {
         $descricao = "Intervalo de {$item['intervalo_minutos']} min.,\n                de {$item['horario_inicial']} até {$item['horario_final']}";
         $e->addMultiOptions(array($item['id_tipo_horario'] => $descricao));
     }
     $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', '')));
     return $e;
 }
Exemple #6
0
 public function __construct($options = null, $data = null, $contentId = 0, $contentType = 'problem', $lang = 'en')
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $this->setDisableLoadDefaultDecorators(true);
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->removeDecorator('DtDdWrapper');
     $this->setName('add_content_form');
     $this->setAction($baseUrl . '/' . $lang . '/content/edit/' . $contentId);
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->setAttrib('enctype', 'multipart/form-data');
     // Content header input form element
     $header = new Zend_Form_Element_Text('content_header');
     $header->setValue($data['content_header'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-header"))->setDecorators(array('FormElementDecorator'));
     // if ($data['published_cnt']) { // Disable editing of header if data is already published
     //	$header->setAttrib('readonly', true);
     // }
     // Content keywords input form element
     $keywords = new Zend_Form_Element_Text('content_keywords');
     $keywords->addFilter('StringtoLower')->setValue($data['content_keywords'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long'))), array('Regex', true, array('/^[\\p{L}0-9, ]*$/'))))->setLabel($translate->_("content-add-keywords"))->setDescription($translate->_("content-add-keywords-help-text"))->setDecorators(array('FormElementDecorator'));
     $content_type = new Zend_Form_Element_Hidden('content_type');
     $content_type->setValue($data['content_type'])->setDecorators(array('FormHiddenElementDecorator'));
     // Content lead text input form element
     $textlead = new Zend_Form_Element_Textarea('content_textlead');
     $textlead->setValue($data['content_textlead'])->setRequired(true)->setAttrib('class', 'textlead')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 320, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-textlead"))->setDescription($translate->_("content-add-textlead-help-text"))->setDecorators(array('FormElementDecorator'));
     // Content text input form element
     $text = new Zend_Form_Element_Textarea('content_text');
     $text->setValue($data['content_text'])->setAttrib('class', 'textbody')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(0, 4000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooShort' => 'content-add-field-too-short', 'stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-text"))->setDescription($translate->_('content-add-' . $contentType . '-textbody-help-text'))->setDecorators(array('FormOptionalElementDecorator'));
     // Content keywords input form element
     $related_companies = new Zend_Form_Element_Text('content_related_companies');
     $related_companies->setRequired(false)->addValidators(array(array('StringLength', true, array(0, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-related_companies"))->setDescription($translate->_("content-add-related_companies-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     // Problem research question input form element
     $research = new Zend_Form_Element_Text('content_research');
     $research->setValue($data['content_research'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-research"))->setDescription($translate->_("content-add-research-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info opportunity
     $opportunity = new Zend_Form_Element_Text('content_opportunity');
     $opportunity->setValue($data['content_opportunity'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-opportunity"))->setDescription($translate->_("content-add-opportunity-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info threat
     $threat = new Zend_Form_Element_Text('content_threat');
     $threat->setValue($data['content_threat'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-threat"))->setDescription($translate->_("content-add-threat-help-text"))->setDecorators(array('FormElementDecorator'));
     // Idea/solution in one sentence
     $solution = new Zend_Form_Element_Text('content_solution');
     $solution->setValue($data['content_solution'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-solution"))->setDecorators(array('FormElementDecorator'));
     // File upload
     $file = new Zend_Form_Element_File('content_file_upload');
     $file->setDestination('../www/upload')->removeDecorator('DtDdWrapper')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'png,gif,jpg,jpeg,doc,zip,xls,mpp,pdf,wmv,avi,mkv,mov,mpeg,mp4,divx,flv,ogg,3gp');
     $file->setLabel($translate->_("content-add-upload-file"))->setDescription($translate->_("content-add-file-upload-help-text"))->setDecorators(array('UploadDecorator'))->setAttrib("onchange", "multiFile(this, '" . $translate->_("content-add-file-delete-file-button") . "');");
     $uploadedFilesBoxes = new Zend_Form_Element_MultiCheckbox('uploadedFiles');
     $uploadedFilesBoxes->setMultiOptions($data['filenames'])->setRequired(false)->setDecorators(array('FormElementDecorator'))->setLabel($translate->_('content-add-file-delete-files-label'));
     // References
     $references = new Zend_Form_Element_Textarea('content_references');
     $references->setValue($data['content_references'])->setAttrib('class', 'textlead')->addValidators(array(array('StringLength', true, array(0, 2000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-references"))->setDescription($translate->_("content-add-references-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     // Language select form element
     $language = new Zend_Form_Element_Select('content_language');
     $language->addFilter('StringtoLower')->setLabel($translate->_("content-add-language"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['languages']);
     // Future info classification
     $finfoClasses = new Zend_Form_Element_Select('content_finfo_class');
     $finfoClasses->setLabel($translate->_("content-add-finfo-classification"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['FutureinfoClasses']);
     /*
     		// Industry select form element
     		$industry = new Zend_Form_Element_Select('content_industry');
     		$industry->addFilter('StringtoLower')
             ->setValue($data['industryIds'][0])
             ->setLabel($translate->_("content-view-industry-classification"))
     				->setDecorators(array('FormElementDecorator'))
     				->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/division/industry/'+this.value, 
                         'content_division_div', this.value);")
     				->setMultiOptions($data['Industries']);	
     
     		$division = new Zend_Form_Element_Select('content_division');
     		$division->addFilter('StringtoLower')
             ->setValue($data['industryIds'][1])
     				->setDecorators(array('FormElementDecorator'))
             ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/group/division/'+this.value, 
                         'content_group_div', this.value);")
     				->setMultiOptions($data['Divisions'])
             ->setRegisterInArrayValidator(false);
     		
     		$group = new Zend_Form_Element_Select('content_group');
     		$group->addFilter('StringtoLower')
             ->setValue($data['industryIds'][2])
     				->setDecorators(array('FormElementDecorator'))
             ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/class/group/'+this.value, 
                         'content_class_div', this.value);")
     				->setMultiOptions($data['Groups'])
             ->setRegisterInArrayValidator(false);
     				
     		$class = new Zend_Form_Element_Select('content_class');
     		$class->addFilter('StringtoLower')
             ->setValue($data['industryIds'][3])
     				->setDecorators(array('FormElementDecorator'))
     				->setMultiOptions($data['Classes'])
             ->setRegisterInArrayValidator(false);
     */
     $innovation = new Zend_Form_Element_Select('innovation_type');
     $innovation->setLabel($translate->_("content-view-innovationtype-classification"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['InnovationTypes']);
     // Used for track button clicks
     $hidden_content_publish = new Zend_Form_Element_Hidden('content_publish');
     $hidden_content_publish->setDecorators(array('FormHiddenElementDecorator'));
     $hidden_content_save = new Zend_Form_Element_Hidden('content_save');
     $hidden_content_save->setDecorators(array('FormHiddenElementDecorator'));
     // Form buttons
     $publish = new Zend_Form_Element_Button('content_publish_button');
     $publish->setLabel($translate->_("content-add-publish"))->setAttrib('class', 'content_manage_button')->removeDecorator('DtDdWrapper');
     $save = new Zend_Form_Element_Button('content_save_button');
     $save->setLabel($translate->_("content-add-save"))->setAttrib('class', 'content_manage_button')->removeDecorator('DtDdWrapper');
     $preview = new Zend_Form_Element_Button('content_preview_button');
     $preview->setLabel($translate->_("content-add-preview"))->setAttrib('class', 'content_manage_button')->removeDecorator('DtDdWrapper');
     // Add elements to form
     $elements = array($header, $keywords, $content_type, $textlead, $text, $related_companies);
     if ($contentType == "problem") {
         array_push($elements, $research);
     } else {
         if ($contentType == "finfo") {
             array_push($elements, $opportunity, $threat);
         } else {
             if ($contentType == "idea") {
                 array_push($elements, $solution);
             }
         }
     }
     array_push($elements, $file);
     if (count($data['filenames'])) {
         array_push($elements, $uploadedFilesBoxes);
     }
     array_push($elements, $references, $language, $hidden_content_save, $hidden_content_publish);
     /*
     if($contentType == "finfo") {
         array_push($elements, $finfoClasses);
     }
     
     array_push($elements, $industry, $division, $group, $class);
     
     if($contentType == "idea") {
         array_push($elements, $innovation);
     }
     */
     // If data is published dont draw the publish button
     if ($data['published_cnt'] == false) {
         array_push($elements, $publish, $save, $preview);
     } else {
         $save->setLabel("Publish changes");
         array_push($elements, $save, $preview);
     }
     // Set custom form layout
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/contentAddForm.phtml', 'placement' => false))));
     $this->addElements($elements);
     /*$this->addElements(array($innovation, $industry, 
       $division, $group,
       $class, $header,
       $keywords, $content_type,
       $content_relatesto_id, $textlead,
       $text, $submit,
       $preview, $publish));*/
 }
Exemple #7
0
 public function __construct($options = null, $data = null, $lang = 'en', $contentType = 'problem')
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $this->setDisableLoadDefaultDecorators(true);
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->removeDecorator('DtDdWrapper');
     $this->setName('add_content_form');
     //$this->setName('contentAdd');
     $this->setAction($baseUrl . '/' . $lang . '/content/add/' . $contentType);
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->setAttrib('enctype', 'multipart/form-data');
     /**
      * 
      * Form Elements
      * 
      */
     // Language, Select
     $language = new Zend_Form_Element_Select('content_language');
     $language->addFilter('StringtoLower')->setLabel($translate->_("content-add-language"))->setRequired(true)->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['languages']);
     // Header, input
     $header = new Zend_Form_Element_Text('content_header');
     $header->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setDescription($translate->_("content-add-headline-help-text"))->setLabel($translate->_("content-add-header"))->setDecorators(array('FormElementDecorator'));
     // Keywords, input
     $keywords = new Zend_Form_Element_Text('content_keywords');
     $keywords->addFilter('StringToLower')->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long'))), array('Regex', true, array('/^[\\p{L}0-9, ]*$/'))))->setLabel($translate->_("content-add-keywords"))->setDescription($translate->_("content-add-keywords-help-text"))->setDecorators(array('FormElementDecorator'));
     // Content type, Hidden
     $content_type = new Zend_Form_Element_Hidden('content_type');
     $content_type->setValue($data['content_type'])->setDecorators(array('FormHiddenElementDecorator'));
     // Used for track button clicks
     $hidden_content_publish = new Zend_Form_Element_Hidden('content_publish');
     $hidden_content_publish->setDecorators(array('FormHiddenElementDecorator'));
     $hidden_content_save = new Zend_Form_Element_Hidden('content_save');
     $hidden_content_save->setDecorators(array('FormHiddenElementDecorator'));
     // Related content, Hidden
     $content_relatesto_id = new Zend_Form_Element_Hidden('content_relatesto_id');
     $content_relatesto_id->setValue($data['content_relatesto_id'])->setDecorators(array('FormHiddenElementDecorator'));
     // Lead, Textarea
     $textlead = new Zend_Form_Element_Textarea('content_textlead');
     $textlead->setRequired(true)->setAttrib('class', 'textlead')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 320, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-textlead"))->setDescription($translate->_("content-add-textlead-help-text"))->setDecorators(array('FormElementDecorator'));
     // Body, Textarea
     $text = new Zend_Form_Element_Textarea('content_text');
     $text->setAllowEmpty(true)->setAttrib('class', 'textbody')->addValidators(array(array('StringLength', true, array(0, 4000, 'messages' => array('stringLengthTooShort' => 'content-add-field-too-short', 'stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-text"))->setDescription($translate->_('content-add-' . $contentType . '-textbody-help-text'))->setDecorators(array('FormOptionalElementDecorator'));
     // Related companies, Input
     $related_companies = new Zend_Form_Element_Text('content_related_companies');
     $related_companies->setRequired(false)->addValidators(array(array('StringLength', true, array(0, 120, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-related_companies"))->setDescription($translate->_("content-add-related_companies-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     // Problem research question, Input
     $research = new Zend_Form_Element_Text('content_research');
     $research->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-research"))->setDescription($translate->_("content-add-research-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info opportunity, Input
     $opportunity = new Zend_Form_Element_Text('content_opportunity');
     $opportunity->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-opportunity"))->setDescription($translate->_("content-add-opportunity-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info threat, Input
     $threat = new Zend_Form_Element_Text('content_threat');
     $threat->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-threat"))->setDescription($translate->_("content-add-threat-help-text"))->setDecorators(array('FormElementDecorator'));
     // Idea/solution in one sentence, Input
     $solution = new Zend_Form_Element_Text('content_solution');
     $solution->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-solution"))->setDecorators(array('FormElementDecorator'));
     // File upload, File
     $file = new Zend_Form_Element_File('content_file_upload');
     $file->setDestination('../www/upload')->removeDecorator('DtDdWrapper')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'png,gif,jpg,jpeg,doc,zip,xls,mpp,pdf,wmv,avi,mkv,mov,mpeg,mp4,divx,flv,ogg,3gp');
     $file->setLabel($translate->_("content-add-upload-file"))->setDescription($translate->_("content-add-file-upload-help-text"))->setDecorators(array('UploadDecorator'))->setAttrib("onchange", "multiFile(this, '" . $translate->_("content-add-file-delete-file-button") . "');");
     // References, Textarea
     $references = new Zend_Form_Element_Textarea('content_references');
     $references->setAttrib('class', 'textlead')->addValidators(array(array('StringLength', true, array(0, 2000, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-references"))->setDescription($translate->_("content-add-references-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     /*
             
             // Future info classification, Select
             $finfoClasses = new Zend_Form_Element_Select('content_finfo_class');
             $finfoClasses->addFilter('StringtoLower')
                     ->setLabel($translate->_("content-add-finfo-classification"))
     				->setDecorators(array('FormElementDecorator'))
     				->setMultiOptions($data['FutureinfoClasses']);
             
     		// Industry, Select
     		$industry = new Zend_Form_Element_Select('content_industry');
             $industry->addFilter('StringtoLower')
                     ->setLabel($translate->_("content-view-industry-classification"))
                     ->setDecorators(array('FormElementDecorator'))
                     // This should probably be converted to use jquery
                     ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/division/industry/'+this.value, 
                                 'content_division_div', this.value);")
                     ->setMultiOptions($data['Industries']);    
             
             // Division, Select
             $division = new Zend_Form_Element_Select('content_division');
             $division->addFilter('StringtoLower')
                     ->setDecorators(array('FormElementDecorator'))
                     ->setMultiOptions($data['Divisions'])
                     ->setRegisterInArrayValidator(false);
             
             // Group, Select
             $group = new Zend_Form_Element_Select('content_group');
             $group->addFilter('StringtoLower')
                     ->setDecorators(array('FormElementDecorator'))
                     ->setMultiOptions($data['Groups'])
                     ->setRegisterInArrayValidator(false);
     
             // Class, Select
             $class = new Zend_Form_Element_Select('content_class');
             $class->addFilter('StringtoLower')
                     ->setDecorators(array('FormElementDecorator'))
                     ->setMultiOptions($data['Classes'])
                     ->setRegisterInArrayValidator(false);
             
             // Innovation type, Select
             $innovation = new Zend_Form_Element_Select('innovation_type');
             $innovation->addFilter('StringToLower')
                     ->setLabel($translate->_("content-view-innovationtype-classification"))
                     ->setDecorators(array('FormElementDecorator'))
                     ->setMultiOptions($data['InnovationTypes']);
     */
     // Form buttons
     $publish = new Zend_Form_Element_Button('content_publish_button');
     $publish->setLabel($translate->_("content-add-publish"))->removeDecorator('DtDdWrapper')->setAttrib('class', 'content_manage_button');
     $save = new Zend_Form_Element_Button('content_save_button');
     $save->setLabel($translate->_("content-add-save"))->removeDecorator('DtDdWrapper')->setAttrib('class', 'content_manage_button');
     $preview = new Zend_Form_Element_Button('content_preview_button');
     $preview->setLabel($translate->_("content-add-preview"))->removeDecorator('DtDdWrapper')->setAttrib('class', 'content_manage_button')->setAttrib('onclick', 'generatePreview();');
     // Set custom form layout
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/contentAddForm.phtml', 'placement' => false))));
     // Add generic elements to form
     $this->addElements(array($language, $header, $keywords, $content_type, $content_relatesto_id, $textlead, $text, $related_companies, $file, $references, $hidden_content_publish, $hidden_content_save, $publish, $save, $preview));
     // Add content type specific elements
     switch ($contentType) {
         case 'problem':
             $this->addElements(array($research));
             break;
         case 'finfo':
             $this->addElements(array($opportunity, $threat, $finfoClasses));
             break;
         case 'idea':
             $this->addElements(array($solution, $innovation));
             break;
         default:
             break;
     }
     // Add elements to form
     /*
     $elements = array(
         $header,
         $keywords,
         $content_type,
         $content_relatesto_id,
         $textlead,
         $text,
         $related_companies
     );
                       
     if($contentType == "problem") {
         array_push($elements, $research);
     }
     else if($contentType == "finfo") {
         array_push($elements, $opportunity, $threat);
     }
     else if($contentType == "idea") {
         array_push($elements, $solution);
     }
     
     array_push($elements, $campaigns, $file, $references, $language);
     
     if($contentType == "finfo") {
         array_push($elements, $finfoClasses);
     }
     
     array_push($elements, $industry, $division, $group, $class);
     
     if($contentType == "idea") {
         array_push($elements, $innovation);
     }
     
     array_push($elements, $publish, $save, $preview);
     
     $this->addElements($elements);
     */
 }
Exemple #8
0
 /**
  * @author code generate
  * @return mixed
  */
 public function __construct($option = array())
 {
     $userId = new Zend_Form_Element_Hidden('TutorId');
     $userId->setDecorators(array('ViewHelper'));
     $this->addElement($userId);
     $birthDay = new Zend_Form_Element_Text('Birthday');
     $birthDay->setLabel('Ngày sinh *');
     $birthDay->addFilter('StringTrim');
     $birthDay->setRequired(true);
     $birthDay->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $birthDay->addValidator('stringLength', false, array(2, 50, "messages" => "Ngày sinh dài tối đa 50 ký tự"));
     $this->addElement($birthDay);
     $gender = new Zend_Form_Element_Select('Gender');
     $gender->setLabel('Giới tính *');
     $gender->addFilter('StringTrim');
     $gender->setRequired(true);
     $gender->setMultiOptions(array('1' => 'Nam', '0' => 'Nữ'));
     $gender->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $gender->setSeparator('');
     $gender->setValue("1");
     $this->addElement($gender);
     $email = new Zend_Form_Element_Text('Email');
     $email->setLabel('Email *');
     $email->addFilter('StringTrim');
     $email->setRequired(true);
     $email->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $email->addValidator(new Zend_Validate_Db_NoRecordExists("Tutors", "Email"));
     $email->addValidator('EmailAddress', true);
     $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp")));
     $this->addElement($email);
     $userName = new Zend_Form_Element_Text('UserName');
     $userName->setLabel('Họ tên *');
     $userName->addFilter('StringTrim');
     $userName->setRequired(true);
     $userName->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $userName->addValidator('stringLength', false, array(2, 50, "messages" => "Họ tên dài tối đa 2-50 ký tự"));
     $this->addElement($userName);
     $address = new Zend_Form_Element_Text('Address');
     $address->setLabel('Địa chỉ *');
     $address->addFilter('StringTrim');
     $address->setRequired(true);
     $address->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $userName->addValidator('stringLength', false, array(1, 100, "messages" => "Địa chỉ dài tối đa 100 ký tự"));
     $this->addElement($address);
     $phone = new Zend_Form_Element_Text('Phone');
     $phone->setLabel('Điện thoại *');
     $phone->addFilter('StringTrim');
     $phone->setRequired(true);
     $phone->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $phone->addValidator('stringLength', false, array(6, 50, "messages" => "Điện thoại dài tối đa 6-50 ký tự"));
     $this->addElement($phone);
     $required = new Zend_Validate_NotEmpty();
     $required->setType($required->getType() | Zend_Validate_NotEmpty::INTEGER | Zend_Validate_NotEmpty::ZERO);
     $level = new Zend_Form_Element_Select('Level');
     $level->setLabel('Trình độ *');
     $level->addFilter('StringTrim');
     $level->addValidator('Int');
     $level->setRequired(true);
     $level->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $level->addValidators(array($required));
     $level->setMultiOptions(unserialize(TUTOR_LEVELS));
     $this->addElement($level);
     $university = new Zend_Form_Element_Text('University');
     $university->setLabel('Trường tốt nghiệp *');
     $university->addFilter('StringTrim');
     $university->setRequired(true);
     $university->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $university->addValidator('stringLength', false, array(1, 100, "messages" => "Trường tố nghiệp dài tối đa 100 ký tự"));
     $this->addElement($university);
     $subject = new Zend_Form_Element_Text('Subject');
     $subject->setLabel('Chuyên ngành *');
     $subject->addFilter('StringTrim');
     $subject->setRequired(true);
     $subject->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $subject->addValidator('stringLength', false, array(1, 100, "messages" => "Chuyên ngành dài tối đa 100 ký tự"));
     $this->addElement($subject);
     $experienceYears = new Zend_Form_Element_Select('ExperienceYears');
     $experienceYears->setLabel('Số Năm Kinh Nghiệm *');
     $experienceYears->addFilter('StringTrim');
     $experienceYears->setRequired(false);
     $experienceYears->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $options = unserialize(EXPERIENCE_YEAR);
     //$experienceYears->addMultiOptions(array_combine($options, $options));
     $experienceYears->setMultiOptions(unserialize(EXPERIENCE_YEAR));
     $this->addElement($experienceYears);
     $career = new Zend_Form_Element_Select('Career');
     $career->setLabel('Hiện tại là *');
     $career->addFilter('StringTrim');
     $career->addValidator('Int');
     $career->setRequired(true);
     $career->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $career->setMultiOptions(unserialize(TUTOR_CAREERS));
     $this->addElement($career);
     $careerLocation = new Zend_Form_Element_Text('CareerLocation');
     $careerLocation->setLabel('Nơi Công Tác ( Giáo hoặc Giảng Viên ) *');
     $careerLocation->addFilter('StringTrim');
     $careerLocation->setRequired(false);
     $careerLocation->setAttrib('style', 'min-height: 30px;');
     $careerLocation->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $careerLocation->addValidator('stringLength', false, array(1, 100, "messages" => "Nơi Công Tác dài tối đa 100 ký tự"));
     $this->addElement($careerLocation);
     $teachableInClass = new Zend_Form_Element_Text('TeachableInClass');
     $teachableInClass->setLabel('Lớp Có Thể Dạy');
     $teachableInClass->addFilter('StringTrim');
     $teachableInClass->setRequired(false);
     $teachableInClass->setAttrib('disabled', true);
     $teachableInClass->setDescription('<a id="grades-modal" class="btn btn-info" title="Chọn lớp">...</a>');
     $teachableInClass->setDecorators(array('ViewHelper', array('Description', array('escape' => false)), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control col-lg-6')), array('Label', array('class' => 'control-label col-lg-2')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElement($teachableInClass);
     $teachableSubjects = new Zend_Form_Element_Text('TeachableSubjects');
     $teachableSubjects->setLabel('Môn Có Thể Dạy');
     $teachableSubjects->addFilter('StringTrim');
     $teachableSubjects->setRequired(false);
     $teachableSubjects->setAttrib('disabled', true);
     $teachableSubjects->setDescription('<a id="subjects-modal" class="btn btn-info" title="Chọn môn">...</a>');
     $teachableSubjects->setDecorators(array('ViewHelper', array('Description', array('escape' => false)), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control col-lg-6')), array('Label', array('class' => 'control-label col-lg-2')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElement($teachableSubjects);
     $teachableDistricts = new Zend_Form_Element_Text('TeachableDistricts');
     $teachableDistricts->setLabel('Khu Vực Có Thể Dạy');
     $teachableDistricts->addFilter('StringTrim');
     $teachableDistricts->setRequired(false);
     $teachableDistricts->setAttrib('disabled', true);
     $teachableDistricts->setDescription('<span id="districts-modal" class="btn btn-info" title="Chọn quận">...</span>');
     $teachableDistricts->setDecorators(array('ViewHelper', array('Description', array('escape' => false)), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control col-lg-6')), array('Label', array('class' => 'control-label col-lg-2')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElement($teachableDistricts);
     $avatar = new Zend_Form_Element_Hidden('Upload');
     $avatar->setLabel('Hình đại diện');
     $avatar->setRequired(false);
     $avatar->setDescription('fieldlabel');
     $avatar->setDecorators(array('ViewHelper', array(array('Description' => 'HtmlTag'), array('tag' => 'div', 'id' => "file-uploader")), array(array('Errors' => 'HtmlTag'), array('placement' => 'append', 'tag' => 'img', 'id' => 'progress-img', 'src' => "/scripts/upload/loading.gif")), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control', 'style' => "position: relative;float: left;margin-left: 20px;")), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElement($avatar);
     $avatarNote = new Zend_Form_Element_Hidden('Avatar');
     $avatarNote->setLabel('Chú ý');
     $avatarNote->setRequired(false);
     $avatarNote->setDescription("Kích thước khoảng: 240 x 120 (px)<br>Kích cỡ cho phép: " . IMAGE_SIZE_LIMIT . " kB");
     $avatarNote->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => 'div')), array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group', 'style' => "float: left;"))));
     $this->addElement($avatarNote);
     $introduction = new Zend_Form_Element_Textarea('Introduction');
     $introduction->setLabel('Giới thiệu bản thân');
     $introduction->addFilter('StringTrim');
     $introduction->setRequired(false);
     $introduction->setOptions(array('cols' => '10', 'rows' => '4'));
     /* $introduction->setDecorators(array('ViewHelper')); */
     $introduction->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $subject->addValidator('stringLength', false, array(1, 2000, "messages" => "Giới thiệu bản thân dài tối đa 2000 ký tự"));
     $this->addElement($introduction);
     $isDisabled = new Zend_Form_Element_Text('IsDisabled');
     $isDisabled->setLabel('IsDisabled');
     $isDisabled->addFilter('StringTrim');
     $isDisabled->addValidator('Int');
     $isDisabled->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElement($isDisabled);
     $submit = new Zend_Form_Element_Submit('Save');
     $submit->setLabel('Đăng ký');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setDecorators(array('ViewHelper'));
     $this->addElement($submit);
     $reset = new Zend_Form_Element_Reset('Reset');
     $reset->setLabel('Làm lại');
     $reset->setAttrib('class', 'btn btn-primary');
     $reset->setDecorators(array('ViewHelper'));
     $this->addElement($reset);
     $this->addDisplayGroup(array('UserName', 'Gender', 'Birthday', 'Email', 'Address', 'Phone'), 'contact', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin cá nhân'));
     $contact = $this->getDisplayGroup('contact');
     $contact->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset'))));
     $this->addDisplayGroup(array('Level', 'University', 'Subject', 'Career', 'CareerLocation', 'ExperienceYears'), 'level', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin học vấn'));
     $level = $this->getDisplayGroup('level');
     $level->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset'))));
     $this->addDisplayGroup(array('TeachableInClass', 'TeachableSubjects', 'TeachableDistricts', 'Upload', 'Avatar', 'Introduction'), 'extra', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin thêm'));
     $extra = $this->getDisplayGroup('extra');
     $extra->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset'))));
     $this->addDisplayGroup(array('Save', 'Reset'), 'submit', array('disableLoadDefaultDecorators' => false, 'legend' => 'Thông tin học vấn'));
     $submit = $this->getDisplayGroup('submit');
     $submit->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'fieldset', 'class' => 'well the-fieldset'))));
 }
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'frm_sinterview_rounds');
     $id = new Zend_Form_Element_Hidden('id');
     $req_id = new Zend_Form_Element_Select("req_id");
     $req_id->setRegisterInArrayValidator(false);
     $req_id->setRequired(true);
     $req_id->setAttrib("class", "formDataElement");
     $req_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.'));
     $req_id->setAttrib('title', 'Interviewer');
     $req_id->setAttrib('onchange', 'displayParticularCandidates(this,"")');
     $candidate_name = new Zend_Form_Element_Select('candidate_name');
     $candidate_name->setAttrib('title', 'Candidate Name');
     $candidate_name->addFilter(new Zend_Filter_StringTrim());
     $candidate_name->setRequired(true);
     $candidate_name->addValidator('NotEmpty', false, array('messages' => 'Please select candidate.'));
     $candidate_name->addMultiOption('', 'Select candidate');
     $candidate_name->setRegisterInArrayValidator(false);
     $interviewer_id = new Zend_Form_Element_Select("interviewer_id");
     $interviewer_id->setRegisterInArrayValidator(false);
     $interviewer_id->setAttrib("class", "formDataElement");
     $interviewer_id->setAttrib('title', 'Interviewer');
     $interview_mode = new Zend_Form_Element_Select("interview_mode");
     $interview_mode->setRegisterInArrayValidator(true);
     $interview_mode->setAttrib("class", "formDataElement");
     $interview_mode->addMultiOptions(array('' => 'Select Interview Type', 'In person' => 'In person', 'Phone' => 'Phone', 'Video conference' => 'Video conference'));
     $interview_mode->setAttrib('title', 'Interview Type');
     $int_location = new Zend_Form_Element_Text('int_location');
     $int_location->setAttrib('maxLength', 100);
     $int_location->setAttrib('title', 'Location');
     $int_location->addFilter(new Zend_Filter_StringTrim());
     $job_title = new Zend_Form_Element_Text('job_title');
     $job_title->setAttrib('readonly', 'readonly');
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('country');
     $country->setAttrib('onchange', 'displayParticularState_normal(this,"state","state","city")');
     $country->setRegisterInArrayValidator(false);
     $countryModal = new Default_Model_Countries();
     $countriesData = $countryModal->fetchAll('isactive=1', 'country');
     $country->addMultiOption('', 'Select country');
     foreach ($countriesData->toArray() as $data) {
         $country->addMultiOption(trim($data['country_id_org']), $data['country']);
     }
     $state = new Zend_Form_Element_Select('state');
     $state->setAttrib('onchange', 'displayParticularCity_normal(this,"city","city","")');
     $state->setRegisterInArrayValidator(false);
     $state->addMultiOption('', 'Select State');
     $city = new Zend_Form_Element_Select('city');
     $city->setAttrib('class', 'selectoption');
     $city->setAttrib('onchange', 'displayCityCode(this)');
     $city->setRegisterInArrayValidator(false);
     $city->addMultiOption('', 'Select City');
     $interview_time = new Zend_Form_Element_Text('interview_time');
     $interview_time->setAttrib('title', 'Interview Time');
     $interview_time->setAttrib('readonly', 'readonly');
     $interview_time->setAttrib('onfocus', 'this.blur()');
     $interview_time->setAttrib('class', 'time');
     $interview_time->addFilter(new Zend_Filter_StringTrim());
     $interview_date = new Zend_Form_Element_Text('interview_date');
     $interview_date->setAttrib('readonly', 'readonly');
     $interview_date->setAttrib('onfocus', 'this.blur()');
     $interview_date->setAttrib('title', 'Interview Date');
     $interview_date->addFilter(new Zend_Filter_StringTrim());
     $interview_round = new Zend_Form_Element_Text('interview_round');
     $interview_round->setAttrib('title', 'Interview Round');
     $interview_round->addFilter(new Zend_Filter_StringTrim());
     $interview_round->setAttrib('maxlength', 45);
     $interview_feedback = new Zend_Form_Element_Textarea('interview_feedback');
     $interview_feedback->setAttrib('rows', 10);
     $interview_feedback->setAttrib('cols', 50);
     $interview_feedback->setAttrib('maxlength', 300);
     $interview_feedback->setAttrib('title', 'Feedback.');
     $interview_comments = new Zend_Form_Element_Textarea('interview_comments');
     $interview_comments->setAttrib('rows', 10);
     $interview_comments->setAttrib('cols', 50);
     $interview_comments->setAttrib('maxlength', 300);
     $interview_comments->setAttrib('title', 'Comments.');
     $round_status = new Zend_Form_Element_Select('round_status');
     $round_status->setRegisterInArrayValidator(false);
     $round_status->setLabel('Round status');
     $round_status->addMultiOptions(array('' => 'Select status', 'Schedule for next round' => 'Schedule for next round', 'Qualified' => 'Qualified', 'Selected' => 'Selected', 'Disqualified' => 'Disqualified', 'Incompetent' => 'Incompetent', 'Ineligible' => 'Ineligible', 'Candidate no show' => 'Candidate no show'));
     $hid_round_status_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('hid_round_status', null);
     $interview_status = new Zend_Form_Element_Select('interview_status');
     $interview_status->setLabel('Interview status')->setMultiOptions(array('' => 'Select status', 'In process' => 'In process', 'Completed' => 'Complete', 'On hold' => 'On hold'));
     $interview_status->setRegisterInArrayValidator(false);
     $cand_status = new Zend_Form_Element_Select('cand_status');
     $cand_status->setLabel('Candidate status')->setMultiOptions(array('' => 'Select status'));
     $cand_status->setRegisterInArrayValidator(false);
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $intrvid_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('intrvid', null);
     if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $intrvid_val == $loginUserId) {
         $round_status->setRequired(true);
         $round_status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
         $interview_comments->setRequired(true);
         $interview_comments->addValidator('NotEmpty', false, array('messages' => 'Please select comments.'));
         $interview_feedback->setRequired(true);
         $interview_feedback->addValidator('NotEmpty', false, array('messages' => 'Please select feedback.'));
     }
     if (($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '') && $intrvid_val != $loginUserId) {
         if ($hid_round_status_val != '' && ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '')) {
             $round_status->setRequired(true);
             $round_status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
         } else {
             $interview_status->setRequired(true);
             $interview_status->addValidator('NotEmpty', false, array('messages' => 'Please select interview status.'));
             $cand_status->setRequired(true);
             $cand_status->addValidator('NotEmpty', false, array('messages' => 'Please select candidate status.'));
             $interviewer_id->setRequired(true);
             $interviewer_id->addValidator('NotEmpty', false, array('messages' => 'Please select interviewer.'));
             $interview_mode->setRequired(true);
             $interview_mode->addValidator('NotEmpty', false, array('messages' => 'Please select interview type.'));
             $int_location->setRequired(true);
             $int_location->addValidator('NotEmpty', false, array('messages' => 'Please enter location.'));
             $country->setRequired(true);
             $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
             $state->setRequired(true);
             $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
             $city->setRequired(true);
             $city->addValidator('NotEmpty', false, array('messages' => 'Please select city.'));
             $interview_time->setRequired(true);
             $interview_time->addValidator('NotEmpty', false, array('messages' => 'Please select interview time.'));
             $interview_date->setRequired(true);
             $interview_date->addValidator('NotEmpty', false, array('messages' => 'Please select interview date.'));
             $interview_round->setRequired(true);
             $interview_round->addValidator('NotEmpty', false, array('messages' => 'Please select interview name.'));
         }
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Update');
     $int_location->addValidator("regex", true, array('pattern' => '/^[a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid location.')));
     $interview_round->addValidator("regex", true, array('pattern' => '/^[0-9a-zA-Z.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please select valid interview name.')));
     $this->addElements(array($req_id, $id, $candidate_name, $job_title, $interviewer_id, $interview_mode, $int_location, $country, $state, $city, $interview_time, $interview_date, $round_status, $interview_feedback, $interview_comments, $interview_round, $interview_status, $cand_status, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Exemple #10
0
 public function getForm()
 {
     $form = new Zend_Form();
     $form->setName($this->poClass . "_form");
     $schema = $this->schema->getSchema();
     foreach ($this->getEditableProperties() as $propertyName => $property) {
         $methodName = 'get' . ucfirst($propertyName) . 'Element';
         if (method_exists($this, $methodName)) {
             $form->addElement($this->{$methodName}());
             continue;
         }
         $dbField = $schema[$this->poDef->table]->fields[$property->columnName];
         $dbType = $dbField->type;
         switch ($dbType) {
             case 'integer':
             case 'timestamp':
             case 'boolean':
                 $element = new Zend_Form_Element_Text($propertyName);
                 $element->addValidator('allnum');
                 $element->addFilter('int');
                 break;
             case 'float':
             case 'decimal':
                 $element = new Zend_Form_Element_Text($propertyName);
                 break;
             case 'blob':
             case 'clob':
                 $element = new Zend_Form_Element_Textarea($propertyName);
                 break;
             case 'text':
             case 'time':
             case 'date':
             default:
                 $element = new Zend_Form_Element_Text($propertyName);
                 break;
         }
         if (list($relatedClassName, $relationDef) = $this->isFK($property->columnName)) {
             $element = new Zend_Form_Element_Select($propertyName);
             $pos = ezcPersistentSessionInstance::get();
             $q = $pos->createFindQuery($relatedClassName);
             $this->queryHook($q);
             $list = $pos->find($q, $relatedClassName);
             $element->options = $list;
             $element->addFilter('int');
         }
         if (!$this->isNullProperty($property->columnName, $this->poDef->table)) {
             $element->setRequired(true)->addValidator('NotEmpty');
         }
         $element->setLabel($propertyName);
         $form->addElement($element);
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit');
     $form->addElement($submit);
     $form->clearDecorators();
     $form->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => '<ul>'))->addDecorator('Form');
     $form->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Description'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'li', 'class' => 'element-group'))));
     // buttons do not need labels
     $submit->setDecorators(array(array('ViewHelper'), array('Description'), array('HtmlTag', array('tag' => 'li', 'class' => 'submit-group'))));
     $form->setView(new Zend_View());
     return $form;
 }