public function init() { $this->setMethod('post'); $this->setAttrib('id', 'agencylistreport'); $this->setAttrib('name', 'agencylistreport'); $this->setAttrib('action', DOMAIN . 'reports/agencylistreport'); $agencyname = new Zend_Form_Element_Text('agencynamef'); $agencyname->setLabel('Agency'); $agencyname->setAttrib('onblur', 'clearagencyname(this)'); $agencyname->setAttrib('maxLength', 50); $primaryphone = new Zend_Form_Element_Text('primaryphonef'); $primaryphone->setLabel('Primary Phone'); $primaryphone->setAttrib('onblur', 'blurelement(this)'); $primaryphone->setAttrib('maxLength', 15); $primaryphone->addFilter(new Zend_Filter_StringTrim()); $primaryphone->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Primary phone number must contain at most %max% characters', Zend_Validate_StringLength::TOO_SHORT => 'Primary phone number must contain at least %min% characters.'))))); $primaryphone->addValidator("regex", true, array('pattern' => '/^(?!0{10})[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid phone number.'))); $checktype = new Zend_Form_Element_Multiselect('bg_checktypef'); $checktype->setLabel('Screening Type'); $checktypeModal = new Default_Model_Bgscreeningtype(); $typesData = $checktypeModal->fetchAll('isactive=1', 'type'); foreach ($typesData->toArray() as $data) { $checktype->addMultiOption($data['id'], $data['type']); } $checktype->setRegisterInArrayValidator(false); $checktype->setAttrib('onchange', 'changeelement(this)'); $website = new Zend_Form_Element_Text('website_urlf'); $website->setLabel('Website Url'); $website->setAttrib('maxLength', 50); $website->addFilter(new Zend_Filter_StringTrim()); $website->setAttrib('onblur', 'clearagencyname(this)'); $this->addElements(array($agencyname, $primaryphone, $checktype, $website)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'holidaygroups'); $id = new Zend_Form_Element_Hidden('id'); $holidayname = new Zend_Form_Element_Text('holidayname'); $holidayname->setAttrib('maxLength', 20); $holidayname->addFilter(new Zend_Filter_StringTrim()); $holidayname->setRequired(true); $holidayname->addValidator('NotEmpty', false, array('messages' => 'Please enter holiday.')); $holidayname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid holiday.'))); $groupid = new Zend_Form_Element_Multiselect('groupid'); $groupid->setAttrib('class', 'selectoption'); $groupid->setRegisterInArrayValidator(false); $groupid->setRequired(true); $groupid->addValidator('NotEmpty', false, array('messages' => 'Please select holiday group.')); $holiday_date = new ZendX_JQuery_Form_Element_DatePicker('holidaydate'); $holiday_date->setAttrib('readonly', 'true'); $holiday_date->setAttrib('onfocus', 'this.blur()'); $holiday_date->setOptions(array('class' => 'brdr_none')); $holiday_date->setRequired(true); $holiday_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $description = new Zend_Form_Element_Textarea('description'); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $holidayname, $groupid, $holiday_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('holidaydate')); }
public function init() { $menu_items_model = new Admin_Model_MenuItems(); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Usergroup name')->setRequired(true)->setAttrib("class", "form-control")->setAttrib("style", "width:200px"); $menu_items = new Zend_Form_Element_Multiselect('admin_menu_item_id'); $menu_items->addValidator(new Zend_Validate_Digits(), true); $menu_items->setLabel('Menu Items: '); $menu_items->setAttrib("class", "select2"); $menu_items->setAttrib("data-placeholder", "Choose..."); $menu_items->setAttrib("style", "width:200px"); $menu_items->addMultiOptions($menu_items_model->getForDropDown()); $permit = new Zend_Form_Element_MultiCheckbox('permit'); $permit->setLabel('Available resources '); $resources_table = new Admin_Model_Resources(); foreach ($resources_table->getAll() as $resource) { $permit->addMultiOption((string) $resource->id, ' ' . $resource->name); } $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/admin/admin-usersgroups/'"); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($name)->addElement($menu_items)->addElement($permit)->addElement($cancel)->addElement($submit); }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oTableName = new Zend_Form_Element_Multiselect("table_name"); $oTableName->addMultiOptions($this->_aTableName); $oTableName->addValidator(new Zend_Validate_InArray(array_keys($this->_aTableName))); $oTableName->setRequired(FALSE); $oTableName->setLabel("Nazwa tabeli:"); $oTableName->setAttrib("class", "multiselect"); $this->addElement($oTableName); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/_defaultform.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'states/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'states'); $id = new Zend_Form_Element_Hidden('id'); $country = new Zend_Form_Element_Select('countryid'); $country->setAttrib('class', 'selectoption'); $country->setAttrib('onchange', 'displayParticularState(this,"otheroption","state","")'); $country->setRegisterInArrayValidator(false); $country->addMultiOption('', 'Select Country'); $country->setRequired(true); $country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $state = new Zend_Form_Element_Multiselect('state'); $state->setAttrib('onchange', 'displayStateCode(this)'); $state->setRegisterInArrayValidator(false); $state->setRequired(true); $state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $state->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_states', 'field' => 'state_id_org', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $state->getValidator('Db_NoRecordExists')->setMessage('State already exists.'); $otherstatename = new Zend_Form_Element_Text('otherstatename'); $otherstatename->setAttrib('maxLength', 20); $otherstatename->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[^ ][a-zA-Z\\s]*$/i', 'messages' => array('regexNotMatch' => 'Please enter valid state name.'))))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $country, $state, $otherstatename, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function renderFormElement() { $elm = new Zend_Form_Element_Multiselect($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setMultiOptions($this->getOptions()); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); $elm->setAttrib('style', 'width:300px;height:100px'); return $elm; }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oRobots = new Zend_Form_Element_Select("site_seo_robots_id"); $oRobots->setLabel("Tryb indeksowania przez roboty:"); $oRobots->setRequired(FALSE); $oRobots->addMultiOptions($this->_aAllSiteSeoRobots); $oRobots->setValue(1); $this->addElement($oRobots); $oSeoTagTitle = new Zend_Form_Element_Textarea("head_title"); $oSeoTagTitle->setLabel("Tytuł strony (meta titile):")->setFilters($this->_aFilters); $oSeoTagTitle->setRequired(FALSE); $this->addElement($oSeoTagTitle); $oAdditionalSeoTagKeywords = new Zend_Form_Element_Text("additional_seo_tag_keywords"); $oAdditionalSeoTagKeywords->setLabel("Dodaj nowe słowo kluczowe:"); $oAdditionalSeoTagKeywords->setRequired(FALSE); $oAdditionalSeoTagKeywords->addValidator(new Zend_Validate_StringLength(array("min" => 1, "max" => 45))); $oAdditionalSeoTagKeywords->setAttrib("class", "valid"); $this->addElement($oAdditionalSeoTagKeywords); $oAddAdditionalSeoTagKeywords = new Zend_Form_Element_Button("add_additional_seo_tag_keywords"); $oAddAdditionalSeoTagKeywords->setLabel("Dodaj"); $oAddAdditionalSeoTagKeywords->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oAddAdditionalSeoTagKeywords); $oSeoTagKeywords = new Zend_Form_Element_Multiselect("keywords"); $oSeoTagKeywords->addMultiOptions($this->_aAllSiteSeoKeywords); $oSeoTagKeywords->setRequired(FALSE); $oSeoTagKeywords->setLabel("Słowa kluczowe (meta keywords):"); $oSeoTagKeywords->setAttrib("class", "chosen"); $this->addElement($oSeoTagKeywords); $oSeoTagDescription = new Zend_Form_Element_Textarea("description"); $oSeoTagDescription->setLabel("Opis strony (meta description):")->setFilters($this->_aFilters); $oSeoTagDescription->setRequired(FALSE); $this->addElement($oSeoTagDescription); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/siteseo.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oLayoutName = new Zend_Form_Element_Hidden("layout_name"); $oLayoutName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oLayoutName); $oLabel = new Zend_Form_Element_Text("label"); $oLabel->setLabel("Etykieta:")->setFilters($this->_aFilters); $oLabel->setRequired(TRUE); $this->addElement($oLabel); $oDesc = new Zend_Form_Element_Text("desc"); $oDesc->setLabel("Opis:")->setFilters($this->_aFilters); $oDesc->setRequired(FALSE); $this->addElement($oDesc); $oImageId = new Zend_Form_Element_Select("image_id"); $oImageId->setLabel("Ikona menu:")->setFilters($this->_aFilters); $oImageId->setRequired(FALSE); $oImageId->addMultiOptions($this->_aAllImage); $this->addElement($oImageId); $oModuleId = new Zend_Form_Element_Select("navigation_module_id"); $oModuleId->setLabel("Moduł:"); $oModuleId->setRequired(TRUE)->setAttrib("class", "valid"); $oModuleId->addMultiOptions($this->_aAllModule); $this->addElement($oModuleId); $oSiteLayout = new Zend_Form_Element_Select("site_layout_id"); $oSiteLayout->setLabel("Szablon:"); $oSiteLayout->setRequired(TRUE)->setAttrib("class", "valid"); $oSiteLayout->addMultiOptions($this->_aAllSiteLayout); $this->addElement($oSiteLayout); $oControllerId = new Zend_Form_Element_Select("navigation_controller_id"); $oControllerId->setLabel("Kontroler:"); $oControllerId->setRequired(TRUE)->setAttrib("class", "valid"); $oControllerId->addMultiOptions($this->_aAllController); $this->addElement($oControllerId); $oActionId = new Zend_Form_Element_Select("navigation_action_id"); $oActionId->setLabel("Akcja:"); $oActionId->setRequired(TRUE)->setAttrib("class", "valid"); $oActionId->addMultiOptions($this->_aAllAction); $this->addElement($oActionId); $oResourceId = new Zend_Form_Element_Select("navigation_resource_id"); $oResourceId->setLabel("Kwalifikator zasobu:"); $oResourceId->setRequired(TRUE); $oResourceId->addMultiOptions($this->_aAllResource); //$this->addElement($oResourceId); $oPrivilegeId = new Zend_Form_Element_Select("navigation_privilege_id"); $oPrivilegeId->setLabel("Kwalifikator dostępu:"); $oPrivilegeId->setRequired(TRUE)->setAttrib("class", "valid"); $oPrivilegeId->addMultiOptions($this->_aAllPrivilege); $this->addElement($oPrivilegeId); $oVisible = new Zend_Form_Element_Select("visible"); $oVisible->setLabel("Widoczne w menu:"); $oVisible->setRequired(TRUE)->setAttrib("class", "valid"); $oVisible->addMultiOptions(array(1 => "Tak", 0 => "Nie")); $this->addElement($oVisible); $oPrivilege = new Zend_Form_Element_Multiselect("user_role"); $oPrivilege->addMultiOptions($this->_aAllUserRole); $oPrivilege->setRequired(FALSE); $oPrivilege->setLabel("Dostęp do zasobu dla grupy użytkowników:"); $oPrivilege->setAttrib("class", "multiselect"); $this->addElement($oPrivilege); $oNavigationMenuCopy = new Zend_Form_Element_Hidden("navigation_menu_edit_id"); $oNavigationMenuCopy->setValue(0); $oNavigationMenuCopy->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oNavigationMenuCopy); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/navigationmenu.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // datum pohovoru $elem = new Zend_Form_Element_Text('datum_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pohovoru'); // Multi select (perzonalista – pokročilé informace) $elem = new Zend_Form_Element_Multiselect('perzonalista_informace'); $elem->removeDecorator('Label'); $elem->setAttrib('placeholder', 'Pick an interviewers…'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'perzonalista_informace'); // vzdělání $elem = new Zend_Form_Element_Text('vzdelani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Education…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'vzdelani'); // motivace $elem = new Zend_Form_Element_Textarea('motivace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Motivation…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'motivace'); // preferovaná práce $elem = new Zend_Form_Element_Textarea('preferovana_prace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Kind of work preferred…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'preferovana_prace'); // ambice $elem = new Zend_Form_Element_Textarea('ambice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ambitions…'); $elem->setAttrib('rows', '1'); $elem->removeDecorator('Label'); $this->addElement($elem, 'ambice'); // jazyky $elem = new Zend_Form_Element_Text('jazyky'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Languages…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'jazyky'); // cestování $elem = new Zend_Form_Element_Text('cestovani'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Travelling…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'cestovani'); // ################## SECOND COLUMN ################### // plusy_minusy $elem = new Zend_Form_Element_Textarea('plusy_minusy'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Pluses/Minuses…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'plusy_minusy'); // zkusenosti_v_tymu $elem = new Zend_Form_Element_Textarea('zkusenosti_v_tymu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Team work experience…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'zkusenosti_v_tymu'); // pracovni_misto $elem = new Zend_Form_Element_Textarea('pracovni_misto'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Domain/Areas of work…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'pracovni_misto'); // knowhow $elem = new Zend_Form_Element_Textarea('knowhow'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Skills and technologies…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'knowhow'); // dalsi_informace $elem = new Zend_Form_Element_Textarea('dalsi_informace'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Other informations…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'dalsi_informace'); // ################## THIRD COLUMN ################### // shrnuti_pohovoru $elem = new Zend_Form_Element_Textarea('shrnuti_pohovoru'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Summary of the interview…'); $elem->setAttrib('rows', '3'); $elem->removeDecorator('Label'); $this->addElement($elem, 'shrnuti_pohovoru'); // idealni_pozice $elem = new Zend_Form_Element_Text('idealni_pozice'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Ideal for position/project…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'idealni_pozice'); // datum_zahajeni $elem = new Zend_Form_Element_Text('datum_zahajeni'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Posible starting date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_zahajeni'); // uvazek $elem = new Zend_Form_Element_Select('id_uvazek'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_uvazek'); // mzda $elem = new Zend_Form_Element_Text('mzda'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', 'form-control'); $elem->setAttrib('placeholder', 'Salary…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'mzda'); $elem = new Zend_Form_Element_Select('id_mena'); $elem->removeDecorator('Label'); $elem->setAttrib('class', 'form-control'); $this->addElement($elem, 'id_mena'); // datum_pristiho_kontaktu $elem = new Zend_Form_Element_Text('datum_pristiho_kontaktu'); $elem->addFilter('StringTrim'); $elem->setAttrib('class', array('form-control', 'date-picker')); $elem->setAttrib('placeholder', 'Pick a date…'); $elem->removeDecorator('Label'); $this->addElement($elem, 'datum_pristiho_kontaktu'); // ###################### BUTTON ###################### $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // Photo (id_foto) // File picker $profilePhotoPicker = new Zend_Form_Element_File('profilePhoto'); $profilePhotoPicker->setDestination(PUBLIC_PATH . '/temp'); $profilePhotoPicker->addValidator('Count', false, 1); $profilePhotoPicker->addValidator('Size', false, 2097152); $profilePhotoPicker->removeDecorator('Label'); $this->addElement($profilePhotoPicker, 'profilePhoto'); $avatar = new Zend_Form_Element_Image('avatar'); $avatar->setAttrib('class', array("profile-user-img", "img-responsive", "img-circle")); $this->addElement($avatar, 'avatar'); // First name (jmeno) $firstName = $this->createElement('text', 'jmeno'); $firstName->addFilter('StringTrim'); $firstName->setRequired(true); $firstName->setAttrib('class', 'form-control'); $firstName->setAttrib('placeholder', 'First name'); $firstName->removeDecorator('Label'); $this->addElement($firstName); // Last name (prijmeni) $lastName = $this->createElement('text', 'prijmeni'); $lastName->addFilter('StringTrim'); $lastName->setRequired(true); $lastName->setAttrib('class', 'form-control'); $lastName->setAttrib('placeholder', 'Surname'); $lastName->removeDecorator('Label'); $this->addElement($lastName); // Date of birth (datum_narozeni) // Date picker $birthdate = $this->createElement('text', 'datum_narozeni'); $birthdate->setRequired(true); $birthdate->setAttrib('class', array('form-control', 'date-picker')); $birthdate->removeDecorator('Label'); $birthdate->setAttrib('placeholder', 'Birthdate'); $this->addElement($birthdate); // ################## SECOND COLUMN ################## // Status (id_status) // Select box $status = new Zend_Form_Element_Select('id_status'); $status->removeDecorator('Label'); $status->setAttrib('class', 'form-control'); $this->addElement($status, 'id_status'); // Position (id_pozice) // Select box $position = new Zend_Form_Element_Select('id_pozice'); $position->removeDecorator('Label'); $position->setAttrib('class', 'form-control'); $this->addElement($position, 'id_pozice'); // Technology (kandidat_technologie) // Multi select $technology = new Zend_Form_Element_Multiselect('kandidat_technologie'); $technology->removeDecorator('Label'); $technology->setAttrib('class', 'form-control'); $this->addElement($technology, 'kandidat_technologie'); // Seniority (id_seniorita) // Select box $seniority = new Zend_Form_Element_Select('id_seniorita'); $seniority->removeDecorator('Label'); $seniority->setAttrib('class', 'form-control'); $this->addElement($seniority, 'id_seniorita'); // Comment (komentar) $comment = $this->createElement('textarea', 'komentar'); $comment->addFilter('StringTrim'); $comment->setAttrib('class', 'form-control'); $comment->setAttrib('rows', '3'); $comment->setAttrib('placeholder', 'Enter your comment…'); $comment->removeDecorator('Label'); $this->addElement($comment); // ################### ATTACHEMENTS ################### // Attchements (kandidat_priloha) // File picker $attachments = new Zend_Form_Element_File('attachments'); $attachments->setDestination(PUBLIC_PATH . '/temp'); $attachments->addValidator('Count', false, array('min' => 0, 'max' => 4)); $attachments->addValidator('Size', false, 2097152); $attachments->setMultiFile(4); $attachments->removeDecorator('Label'); $this->addElement($attachments, 'attachments'); $attachmentsCheckGroup = new Zend_Form_Element_MultiCheckbox('attachmentsCheckGroup'); $comment->removeDecorator('Label'); $this->addElement($attachmentsCheckGroup, 'attachmentsCheckGroup'); // ###################### BUTTON ###################### $close = new Zend_Form_Element_Submit('closeButton'); $close->setLabel('Back'); $close->setAttrib('class', 'btn btn-default'); $close->setDecorators(array('ViewHelper')); $this->addElement($close, 'closeButton'); $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); $delete = new Zend_Form_Element_Submit('deleteButton'); $delete->setLabel('Delete'); $delete->setAttrib('class', 'btn btn-danger'); $delete->setAttrib('onclick', 'if (confirm("Are you sure?")) { document.form.submit(); } return false;'); $delete->setDecorators(array('ViewHelper')); $this->addElement($delete, 'deleteButton'); }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oNewsEditId = new Zend_Form_Element_Hidden("news_edit_id"); $oNewsEditId->setValue(0); $oNewsEditId->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oNewsEditId); $oTranslation = new Zend_Form_Element_Select("translation"); $oTranslation->setLabel("Tłumaczenie:"); $oTranslation->setRequired(TRUE)->setAttrib("class", "valid"); $oTranslation->addMultiOptions($this->_aAllLang); $this->addElement($oTranslation); $oImagePreview = new Zend_Form_Element_Hidden("image_preview"); $oImagePreview->setValue(0); $oImagePreview->setRequired(FALSE)->removeDecorator("Label"); $this->addElement($oImagePreview); $oImageId = new Zend_Form_Element_Select("image_id"); $oImageId->setLabel("Zdjęcie:")->setFilters($this->_aFilters); $oImageId->setRequired(FALSE); $oImageId->addMultiOptions($this->_aAllImage); $this->addElement($oImageId); $oCreatedDate = new Zend_Form_Element_Text("created_date"); $oCreatedDate->setLabel("Data utworzenia:"); $oCreatedDate->setRequired(TRUE); $oCreatedDate->setAttrib("class", "valid"); $this->addElement($oCreatedDate); $oName = new Zend_Form_Element_Text("news_title"); $oName->setLabel("Tytuł:"); $oName->addValidator(new Zend_Validate_StringLength(array("min" => 3, "max" => 255))); $oName->setRequired(TRUE)->setAttrib("class", "valid"); $this->addElement($oName); $oContent = new Zend_Form_Element_Textarea("news_content"); $oContent->setLabel("Treść:"); $oContent->setRequired(FALSE); $oContent->setAttrib("class", "ckeditor"); $this->addElement($oContent); $oAdditionalCategoryTag = new Zend_Form_Element_Text("additional_category_tag"); $oAdditionalCategoryTag->setLabel("Dodaj nowe tagi:"); $oAdditionalCategoryTag->setRequired(FALSE); $oAdditionalCategoryTag->addValidator(new Zend_Validate_StringLength(array("min" => 1, "max" => 45))); $oAdditionalCategoryTag->setAttrib("class", "valid"); $this->addElement($oAdditionalCategoryTag); $oAddAdditionalCategoryTag = new Zend_Form_Element_Button("add_additional_category_tag"); $oAddAdditionalCategoryTag->setLabel("Dodaj"); $oAddAdditionalCategoryTag->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oAddAdditionalCategoryTag); $oCategoryTag = new Zend_Form_Element_Multiselect("category_tag"); $oCategoryTag->addMultiOptions(array()); $oCategoryTag->setRequired(FALSE); $oCategoryTag->setLabel("Tagi:"); $oCategoryTag->setAttrib("class", "chosen"); $this->addElement($oCategoryTag); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/_defaultform.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalinit'); $id = new Zend_Form_Element_Hidden('id'); $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id'); $department_id = new Zend_Form_Element_Hidden('department_id'); $businessunit_name = new Zend_Form_Element_Text('businessunit_name'); $businessunit_name->setLabel("Business Unit"); $businessunit_name->setAttrib('readonly', 'true'); $businessunit_name->setAttrib('onfocus', 'this.blur()'); $businessunit_name->setOptions(array('class' => 'brdr_none')); $department_name = new Zend_Form_Element_Text('department_name'); $department_name->setLabel("Department"); $department_name->setAttrib('readonly', 'true'); $department_name->setAttrib('onfocus', 'this.blur()'); $department_name->setOptions(array('class' => 'brdr_none')); $appraisal_mode = new Zend_Form_Element_Text('appraisal_mode'); $appraisal_mode->setLabel("Mode"); $appraisal_mode->setAttrib('readonly', 'readonly'); $appraisal_mode->setAttrib('onfocus', 'this.blur()'); $appraisal_mode->setOptions(array('class' => 'brdr_none')); $status = new Zend_Form_Element_Select('status'); $status->setLabel("Status"); $status->setAttrib('class', 'selectoption'); $status->setMultiOptions(array('1' => 'Open')); $status->setRegisterInArrayValidator(false); $status->setRequired(true); $status->addValidator('NotEmpty', false, array('messages' => 'Please select status.')); $from_year = new Zend_Form_Element_Select('from_year'); $from_year->setAttrib('class', 'selectoption'); $from_year->setRegisterInArrayValidator(false); $from_year->setRequired(true); $from_year->setLabel("From Year"); $from_year->addMultiOption("", "Select from year"); $from_year->addValidator('NotEmpty', false, array('messages' => 'Please select starting year.')); for ($i = date('Y'); $i <= date('Y') + 5; $i++) { $from_year->addMultiOption($i, $i); } $to_year = new Zend_Form_Element_Select('to_year'); $to_year->setAttrib('class', 'selectoption'); $to_year->setRegisterInArrayValidator(false); $to_year->setRequired(true); $to_year->setLabel("To Year"); $to_year->addMultiOption("", "Select to year"); $to_year->addValidator('NotEmpty', false, array('messages' => 'Please select ending year.')); for ($i = date('Y'); $i <= date('Y') + 5; $i++) { $to_year->addMultiOption($i, $i); } $appraisal_period = new Zend_Form_Element_Text('appraisal_period'); $appraisal_period->setLabel("Period"); $appraisal_period->setAttrib('readonly', 'readonly'); $eligibility = new Zend_Form_Element_Multiselect('eligibility'); $eligibility->setLabel("Eligibility"); $eligibility->setAttrib('class', 'selectoption'); $eligibility->setMultiOptions(array('' => 'Select Eligibility')); $eligibility->setRegisterInArrayValidator(false); $eligibility->setRequired(true); $eligibility->addValidator('NotEmpty', false, array('messages' => 'Please select eliblity.')); $enable = new Zend_Form_Element_Select('enable_step'); $enable->setLabel("Enable To"); $enable->setAttrib('class', 'selectoption'); $enable->setMultiOptions(array('' => 'Select Enable To', '1' => 'Managers', '2' => 'Employees')); $enable->setRegisterInArrayValidator(false); $enable->setRequired(true); $enable->addValidator('NotEmpty', false, array('messages' => 'Please select enable to.')); $mgr_due_date = new Zend_Form_Element_Text('manager_due_date'); $mgr_due_date->setLabel("Due Date"); $mgr_due_date->setAttrib('readonly', 'true'); $mgr_due_date->setAttrib('onfocus', 'this.blur()'); $mgr_due_date->setOptions(array('class' => 'brdr_none')); $mgr_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $emp_due_date = new Zend_Form_Element_Text('employee_due_date'); $emp_due_date->setLabel("Due Date"); $emp_due_date->setAttrib('readonly', 'true'); $emp_due_date->setAttrib('onfocus', 'this.blur()'); $emp_due_date->setOptions(array('class' => 'brdr_none')); $emp_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $businessunit_name, $department_name, $appraisal_mode, $status, $eligibility, $enable, $mgr_due_date, $emp_due_date, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'appraisalinit'); $id = new Zend_Form_Element_Hidden('id'); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $businessunit_id = $auth->getStorage()->read()->businessunit_id; $department_id = $auth->getStorage()->read()->department_id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } if ($loginuserRole != SUPERADMINROLE && $loginuserGroup != MANAGEMENT_GROUP) { $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id'); $department_id = new Zend_Form_Element_Hidden('department_id'); $businessunit_name = new Zend_Form_Element_Text('businessunit_name'); $businessunit_name->setLabel("Business Unit"); $businessunit_name->setAttrib('readonly', 'true'); $businessunit_name->setAttrib('onfocus', 'this.blur()'); $businessunit_name->setOptions(array('class' => 'brdr_none')); $department_name = new Zend_Form_Element_Text('department_name'); $department_name->setLabel("Department"); $department_name->setAttrib('readonly', 'true'); $department_name->setAttrib('onfocus', 'this.blur()'); $department_name->setOptions(array('class' => 'brdr_none')); } else { $businessunit_id = new Zend_Form_Element_Select('businessunit_id'); $businessunit_id->setLabel("Business Unit"); $businessunit_id->setRegisterInArrayValidator(false); $businessunit_id->setRequired(true); $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit')); $department_id = new Zend_Form_Element_Select('department_id'); $department_id->setLabel("Department"); $department_id->setRegisterInArrayValidator(false); $department_id->addMultiOptions(array('' => 'Select Department')); $performance_app_flag = Zend_Controller_Front::getInstance()->getRequest()->getParam('performance_app_flag', null); if ($performance_app_flag != '' && $performance_app_flag == 0) { $department_id->setRequired(true); $department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department')); } } // $appraisal_mode = new Zend_Form_Element_Text('appraisal_mode'); // $appraisal_mode->setLabel("Appraisal Mode"); // $appraisal_mode->setAttrib('readonly', 'readonly'); // $appraisal_mode->setAttrib('onfocus', 'this.blur()'); // $appraisal_mode->setOptions(array('class' => 'brdr_none')); $appraisal_mode = new Zend_Form_Element_Select('appraisal_mode'); $appraisal_mode->setLabel("Appraisal Mode"); $appraisal_mode->setAttrib('class', 'selectoption'); $appraisal_mode->addMultiOptions(array('' => 'Select appraisal mode', 'Quarterly' => 'Quarterly', 'Half-yearly' => 'Half-yearly', 'Yearly' => 'Yearly')); $appraisal_mode->setRegisterInArrayValidator(false); $appraisal_mode->setRequired(true); $appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal mode')); $status = new Zend_Form_Element_Select('status'); $status->setLabel("Appraisal Status"); $status->setAttrib('class', 'selectoption'); $status->setMultiOptions(array('1' => 'Open')); $status->setRegisterInArrayValidator(false); $status->setRequired(true); $status->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal status.')); $from_year = new Zend_Form_Element_Select('from_year'); $from_year->setAttrib('class', 'selectoption'); $from_year->setRegisterInArrayValidator(false); $from_year->setRequired(true); $from_year->setLabel("From Year"); $from_year->addMultiOption("", "From Year"); $from_year->addValidator('NotEmpty', false, array('messages' => 'Please select from year')); $current_date = date('Y-m-d'); $previous_year = date('Y', strtotime("{$current_date} -1 year")); for ($i = $previous_year; $i <= $previous_year + 5; $i++) { $from_year->addMultiOption($i, $i); } $to_year = new Zend_Form_Element_Select('to_year'); $to_year->setAttrib('class', 'selectoption'); $to_year->setRegisterInArrayValidator(false); $to_year->setRequired(true); $to_year->setLabel("To Year"); $to_year->addMultiOption("", "To Year"); $to_year->addValidator('NotEmpty', false, array('messages' => 'Please select to year')); /* Limit 'To Year' field years * upto following year of 'From Year' * upto 5 years from current last year i.e.$previous_year */ $post_from_year = Zend_Controller_Front::getInstance()->getRequest()->getParam('from_year', null); if (!empty($post_from_year)) { for ($i = $post_from_year; $i <= $post_from_year + 1 && $i <= $previous_year + 5; $i++) { $to_year->addMultiOption($i, $i); } } $appraisal_period = new Zend_Form_Element_Text('appraisal_period'); $appraisal_period->setLabel("Period"); $appraisal_period->setAttrib('readonly', 'readonly'); $appraisal_period->setAttrib('onfocus', 'this.blur()'); $appraisal_period->setOptions(array('class' => 'brdr_none')); // $appraisal_period->setRequired(true); // $appraisal_period->addValidator('NotEmpty', false, array('messages' => 'Please enter period')); $eligibility = new Zend_Form_Element_Multiselect('eligibility'); $eligibility->setLabel("Eligibility"); $eligibility->setAttrib('class', 'selectoption'); $eligibility->setMultiOptions(array('' => 'Select Eligibility')); /*$eligibility->setRegisterInArrayValidator(false); $eligibility->setRequired(true); $eligibility->addValidator('NotEmpty', false, array('messages' => 'Please select eligiblity'));*/ $eligibility_hidden = new Zend_Form_Element_Multiselect('eligibility_hidden'); $eligibility_hidden->setLabel("Eligibility"); $eligibility_hidden->setAttrib('class', 'selectoption'); $eligibility_hidden->setRegisterInArrayValidator(false); $eligibilityflag = new Zend_Form_Element_Hidden('eligibilityflag'); $eligibility_value = new Zend_Form_Element_Hidden('eligibility_value'); $category_id = new Zend_Form_Element_Multiselect('category_id'); $category_id->setLabel("Parameters"); $category_id->setMultiOptions(array('' => 'Select Parameters')); $category_id->setRegisterInArrayValidator(false); $category_id->setRequired(true); $category_id->addValidator('NotEmpty', false, array('messages' => 'Please select parameters')); $enable = new Zend_Form_Element_Select('enable_step'); $enable->setLabel("Enable To"); $enable->setAttrib('onchange', 'changeduedatetext(this.value)'); $enable->setMultiOptions(array('1' => 'Managers', '2' => 'Employees')); $enable->setRegisterInArrayValidator(false); $enable->setRequired(true); $enable->addValidator('NotEmpty', false, array('messages' => 'Please select enable to')); $enable_to_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('enable_step', null); $mgr_due_date = new Zend_Form_Element_Text('managers_due_date'); $mgr_due_date->setLabel("Managers Due Date"); $emp_due_date = new Zend_Form_Element_Text('employee_due_date'); $emp_due_date->setLabel("Employees Due Date"); if ($enable_to_val == '' || $enable_to_val == 1) { $mgr_due_date->setRequired(true); $mgr_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select managers due date')); } else { $emp_due_date->setRequired(true); $emp_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select employees due date')); } $management_appraisal = new Zend_Form_Element_Checkbox('management_appraisal'); $management_appraisal->setLabel("Consider management"); // $appraisal_ratings = new Zend_Form_Element_Text('appraisal_ratings'); // $appraisal_ratings->setAttrib('readonly', 'readonly'); // $appraisal_ratings->setAttrib('onfocus', 'this.blur()'); // $appraisal_ratings->setLabel("Ratings"); $appraisal_ratings = new Zend_Form_Element_Select('appraisal_ratings'); $appraisal_ratings->setLabel("Appraisal Ratings"); $appraisal_ratings->setAttrib('class', 'selectoption'); $appraisal_ratings->addMultiOptions(array('' => 'Select ratings', '1' => '1-5', '2' => '1-10')); $appraisal_ratings->setRegisterInArrayValidator(false); $appraisal_ratings->setRequired(true); $appraisal_ratings->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal ratings')); $app_period_hid = new Zend_Form_Element_Hidden('app_period_hid'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); if ($loginuserRole != SUPERADMINROLE && $loginuserGroup != MANAGEMENT_GROUP) { $this->addElements(array($appraisal_ratings, $management_appraisal, $id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $businessunit_name, $department_name, $appraisal_mode, $category_id, $status, $eligibility, $eligibility_hidden, $eligibility_value, $eligibilityflag, $enable, $mgr_due_date, $emp_due_date, $app_period_hid, $submit)); } else { $this->addElements(array($appraisal_ratings, $management_appraisal, $id, $appraisal_period, $from_year, $to_year, $businessunit_id, $department_id, $appraisal_mode, $category_id, $status, $eligibility, $eligibility_hidden, $eligibility_value, $eligibilityflag, $enable, $mgr_due_date, $emp_due_date, $app_period_hid, $submit)); } $this->setElementDecorators(array('ViewHelper')); }
/** * Add form elements when a responseDatabase is present * @param \Gems_Form $form existing form type * @param array data existing options set in the form * @return array of form elements */ protected function addResponseDatabaseForm($form, &$data, &$elements) { if (isset($data['tid']) && !empty($data['tid'])) { // If we have a responsedatabase and a track id, try something cool ;-) $responseDb = $this->project->getResponseDatabase(); if ($this->db === $responseDb) { // We are in the same database, now put that to use by allowing to filter respondents based on an answer in any survey $empty = $this->util->getTranslated()->getEmptyDropdownArray(); $allSurveys = $empty + $this->util->getDbLookup()->getSurveysForExport(); $element = new \Zend_Form_Element_Select('filter_sid'); $element->setLabel($this->_('Survey'))->setMultiOptions($allSurveys); $groupElements = array($element); if (isset($data['filter_sid']) && !empty($data['filter_sid'])) { $filterSurvey = $this->loader->getTracker()->getSurvey($data['filter_sid']); $filterQuestions = $empty + $filterSurvey->getQuestionList($this->locale->getLanguage()); $element = new \Zend_Form_Element_Select('filter_answer'); $element->setLabel($this->_('Question'))->setMultiOptions($filterQuestions); $groupElements[] = $element; } if (isset($filterSurvey) && isset($data['filter_answer']) && !empty($data['filter_answer'])) { $questionInfo = $filterSurvey->getQuestionInformation($this->locale->getLanguage()); if (array_key_exists($data['filter_answer'], $questionInfo)) { $questionInfo = $questionInfo[$data['filter_answer']]; } else { $questionInfo = array(); } if (array_key_exists('answers', $questionInfo) && is_array($questionInfo['answers']) && count($questionInfo['answers']) > 1) { $element = new \Zend_Form_Element_Multiselect('filter_value'); $element->setMultiOptions($empty + $questionInfo['answers']); $element->setAttrib('size', count($questionInfo['answers']) + 1); } else { $element = new \Zend_Form_Element_Text('filter_value'); } $element->setLabel($this->_('Value')); $groupElements[] = $element; } $form->addDisplayGroup($groupElements, 'filter', array('showLabels' => true, 'Description' => $this->_('Filter'))); array_shift($elements); } } }
/** * Accepts an array with parameters and mixed values and returns a Zend Form Element to be used by a Zend Form object * * @param array $v * @param mixed $value * @return object */ function getFormElement($v, $value = '') { $config = $this->config; $this->toTpl('hasForm', 1); $v = $this->doQoolHook('pre_getformelement_element', $v); $value = $this->doQoolHook('pre_getformelement_value', $value); switch ($v['value']) { case "editor": $this->loadEditorBtns(); $this->toTpl("loadEditor", 1); $this->toTpl("isEditor", 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editor span12'); if ($value != '') { $element->setValue($value); } break; case "rte": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'cleditor span12'); $this->toTpl("isRTE", 1); if ($value != '') { $element->setValue($value); } break; case "fileinput": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); break; case "dropboxchooser": $element = new Zend_Form_Element_Dropbox($v['name']); $element->setAttrib('style', 'visibility:hidden'); $element->setAttrib('data-multiselect', true); break; case "captcha": if ($config->site->captcha_adapter == 'ReCaptcha') { //Do whats needed for recaptcha to work with form } $element = new Zend_Form_Element_Captcha($v['name'], array('label' => $this->t("Please verify you are a human"), 'captcha' => $config->site->captcha_adapter, 'captchaOptions' => array('captcha' => $config->site->captcha_adapter, 'wordLen' => 6, 'timeout' => 300))); return $element; break; case "multifileinputs": $element = new Zend_Form_Element_File($v['name']); $element->setAttrib('class', 'input-file'); $element->setMultiFile(10); break; case "multifileinput": $name = $v['name'] . "[]"; $element = new Zend_Form_Element_File($name); $element->setAttrib('class', 'input-file'); $element->setAttrib('multiple', 'multiple'); $element->setMultiFileForQool(1); $this->toTpl('filelist', true); break; case "checkbox": $element = new Zend_Form_Element_Checkbox($v['name']); $element->setAttrib('class', 'checkbox'); $element->setValue($value); break; case "editarea": $this->toTpl('editarea', 1); $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'editarea span12'); $element->setAttrib('id', 'editarea'); $element->setAttrib('style', 'height:500px'); if ($value != '') { $element->setValue($value); } break; case "password": $element = new Zend_Form_Element_Password($v['name']); break; case "textarea": $element = new Zend_Form_Element_Textarea($v['name']); $element->setAttrib('class', 'span9'); $element->setAttrib('style', 'height:80px'); if ($value != '') { $element->setValue($value); } break; case "hidden": $element = new Zend_Form_Element_Hidden($v['name']); $element->setValue($value); $element->setDecorators(array("ViewHelper")); break; case "textinput": $element = new Zend_Form_Element_Text($v['name']); if ($value != '') { $element->setValue($value); } break; case "datepicker": $element = new Zend_Form_Element_Text($v['name']); $element->setAttrib('class', 'input-xlarge datepicker'); if ($value != '') { $element->setValue($value); } break; case "imageselect": $element = new Zend_Form_Element_Text($v['name']); $element->setAttrib('class', 'imageselector'); $this->toTpl("hiddenEditor", 1); if ($value != '') { $element->setValue($value); } break; case "selectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } elseif (is_array($v['use_pool'])) { if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool'] as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } elseif ($v['use_pool']) { //the pools might have been assigned by an addon //include the file and run it. require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php"; if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool']($this) as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "multiselectbox": $element = new Zend_Form_Element_Multiselect($v['name']); $element->setAttrib('data-rel', 'chosen'); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($this->{$v}['use_pool']() as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if (is_array($value)) { foreach ($value as $a) { $vals[] = $a['selected_value']; } $element->setValue($vals); } } else { //the pools might have been assigned by an addon //include the file and run it. require_once $this->dirs['structure']['addons'] . DIR_SEP . Zend_Registry::get('controller') . DIR_SEP . "func.php"; if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } foreach ($v['use_pool']($this) as $ko => $vo) { if ($v['noself'] && $vo['id'] == $v['noself']) { } else { $element->addMultiOption($vo['id'], $vo['title']); } } if ($value != '') { $element->setValue($value); } } break; case "treeselectbox": $element = new Zend_Form_Element_Select($v['name']); if ($v['use_pool'] && method_exists($this, $v['use_pool'])) { if ($v['pool_type'] != '0') { $this->pool_type = $v['pool_type']; } if ($v['novalue']) { $element->addMultiOption(0, $this->t('No Selection')); } if ($value != '') { $element->setValue($value); } //x10 times nested support. Needs fix foreach ($this->{$v}['use_pool']() as $vo) { $element->addMultiOption($vo['id'], $vo['title']); foreach ($vo['kids'] as $a) { $element->addMultiOption($a['id'], "|_" . $a['title']); foreach ($a['kids'] as $b) { $element->addMultiOption($b['id'], "|__" . $b['title']); foreach ($b['kids'] as $c) { $element->addMultiOption($c['id'], "|___" . $c['title']); foreach ($c['kids'] as $d) { $element->addMultiOption($d['id'], "|____" . $d['title']); foreach ($d['kids'] as $e) { $element->addMultiOption($e['id'], "|_____" . $e['title']); foreach ($e['kids'] as $f) { $element->addMultiOption($f['id'], "|______" . $f['title']); foreach ($f['kids'] as $g) { $element->addMultiOption($g['id'], "|______" . $g['title']); foreach ($g['kids'] as $h) { $element->addMultiOption($h['id'], "|_______" . $h['title']); foreach ($h['kids'] as $i) { $element->addMultiOption($i['id'], "|________" . $i['title']); foreach ($i['kids'] as $j) { $element->addMultiOption($j['id'], "|_________" . $j['title']); foreach ($j['kids'] as $l) { $element->addMultiOption($l['id'], "|__________" . $l['title']); } } } } } } } } } } } } } break; } if ($v['required']) { $element->setRequired(true); } if ($v['title']) { $element->setLabel($v['title']); } else { $element->setLabel($this->t(ucfirst(str_replace("_", " ", $v['name'])))); } if ($v['attributes']) { foreach ($v['attributes'] as $k => $r) { $element->setAttrib($k, $r); } } //$element->setDecorators(array("ViewHelper")); $element = $this->doQoolHook('post_getformelement_object', $element); return $element; }
public function init() { $this->setMethod('post'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicedeskrequests'); $id = new Zend_Form_Element_Hidden('id'); $postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id'); $businessunit_id = new Zend_Form_Element_Select('businessunit_id'); $businessunit_id->setLabel("Business Unit"); $businessunit_id->setAttrib('class', 'selectoption'); if ($postid == '') { $businessunit_id->setAttrib('onchange', 'displayemployees(this)'); $bunitModel = new Default_Model_Businessunits(); $bunitdata = $bunitModel->fetchAll('isactive=1', 'unitname'); $businessunit_id->addMultiOptions(array('' => 'Select Business unit', '0' => 'No Business Unit')); foreach ($bunitdata->toArray() as $data) { $businessunit_id->addMultiOption($data['id'], $data['unitname']); } } else { $businessunit_id->addMultiOptions(array('' => 'Select Business unit')); } $businessunit_id->setRegisterInArrayValidator(false); $businessunit_id->setRequired(true); $businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.')); $department_id = new Zend_Form_Element_Select('department_id'); $department_id->setLabel("Department"); $department_id->setAttrib('class', 'selectoption'); $department_id->addMultiOption('', 'Select Department'); if ($postid == '') { $department_id->setAttrib('onchange', 'displayemployees(this)'); } $department_id->setRegisterInArrayValidator(false); $service_desk_flag = new Zend_Form_Element_Radio('service_desk_flag'); $service_desk_flag->setLabel("Applicability"); $service_desk_flag->setAttrib('onclick', 'changeimplementation(this)'); $service_desk_flag->addMultiOptions(array('1' => 'Business unit wise', '0' => 'Department wise')); $service_desk_flag->setSeparator(''); $service_desk_flag->setValue(1); $service_desk_flag->setRegisterInArrayValidator(false); $service_desk_flag->setRequired(true); $service_desk_flag->addValidator('NotEmpty', false, array('messages' => 'Please select applicability.')); $service_desk_id = new Zend_Form_Element_Select('service_desk_id'); $service_desk_id->setLabel("Category"); $service_desk_id->setAttrib('class', 'selectoption'); $service_desk_id->addMultiOption('', 'Select category'); $service_desk_id->setRegisterInArrayValidator(false); $service_desk_id->setRequired(true); $service_desk_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.')); $request_recievers = new Zend_Form_Element_Multiselect('request_recievers'); $request_recievers->setLabel("Executors"); $request_recievers->setAttrib('class', 'selectoption'); $request_recievers->setRegisterInArrayValidator(false); $request_recievers->setRequired(true); $request_recievers->addValidator('NotEmpty', false, array('messages' => 'Please select executor.')); $approvingauthority = new Zend_Form_Element_Select('approvingauthority'); $approvingauthority->setLabel("No. of Approvers"); $approvingauthority->setAttrib('class', 'selectoption'); $approvingauthority->setAttrib('onchange', 'displayapprovingauthority(this)'); $approvingauthority->addMultiOptions(array('' => 'Select no. of approvers', '1' => '1', '2' => '2', '3' => '3')); $approvingauthority->setRegisterInArrayValidator(false); $approvingauthority->setRequired(true); $approvingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select no. of approvers.')); $approver_1 = new Zend_Form_Element_Select('approver_1'); $approver_1->setLabel("Approver 1"); $approver_1->setAttrib('class', 'selectoption'); $approver_1->addMultiOption('', 'Select Approver 1'); $approver_1->setAttrib('onchange', 'displayapprovingauthority(this)'); $approver_1->setRegisterInArrayValidator(false); $approver_2 = new Zend_Form_Element_Select('approver_2'); $approver_2->setLabel("Approver 2"); $approver_2->setAttrib('class', 'selectoption'); $approver_2->addMultiOption('', 'Select Approver 2'); $approver_2->setAttrib('onchange', 'displayapprovingauthority(this)'); $approver_2->setRegisterInArrayValidator(false); $approver_3 = new Zend_Form_Element_Select('approver_3'); $approver_3->setLabel("Approver 3"); $approver_3->setAttrib('class', 'selectoption'); $approver_3->addMultiOption('', 'Select Approver 3'); $approver_3->setRegisterInArrayValidator(false); $cc_mail_recievers = new Zend_Form_Element_Multiselect('cc_mail_recievers'); $cc_mail_recievers->setLabel("Request Viewers"); $cc_mail_recievers->setAttrib('class', 'selectoption'); $cc_mail_recievers->setRegisterInArrayValidator(false); $attachment = new Zend_Form_Element_Radio('attachment'); $attachment->setLabel("Attachment"); $attachment->addMultiOptions(array('1' => 'Yes', '0' => 'No')); $attachment->setSeparator(''); $attachment->setValue(0); $attachment->setRegisterInArrayValidator(false); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("Description"); $description->setAttrib('rows', 10); $description->setAttrib('cols', 50); $description->setAttrib('maxlength', '200'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $businessunit_id, $department_id, $description, $service_desk_flag, $service_desk_id, $request_recievers, $approvingauthority, $approver_1, $approver_2, $approver_3, $cc_mail_recievers, $attachment, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'policies'); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = new Zend_Form_Element_Hidden('id'); $requisition_code = new Zend_Form_Element_Text('requisition_code'); $requisition_code->setAttrib('title', 'Requisition Code.'); $requisition_code->setAttrib('readonly', 'readonly'); $requisition_code->setAttrib('onfocus', 'this.blur()'); $requisition_code->setRequired(true); $requisition_code->addValidator('NotEmpty', false, array('messages' => 'Identity codes are not configured yet.')); $onboard_date = new Zend_Form_Element_Text('onboard_date'); $onboard_date->setAttrib('title', 'Due Date.'); $onboard_date->setAttrib('maxLength', 10); $onboard_date->setAttrib('readonly', 'readonly'); $onboard_date->setAttrib('onfocus', 'this.blur()'); $business_unit = new Zend_Form_Element_Select("business_unit"); $business_unit->setAttrib("class", "formDataElement"); $business_unit->setAttrib("onchange", "getdepts_req(this,'department','position_id');"); $business_unit->setAttrib('title', 'Business Unit.'); $department = new Zend_Form_Element_Select("department"); $department->setAttrib("class", "formDataElement"); $department->setAttrib('title', 'Department.'); $department->addMultiOptions(array('' => 'Select Department')); $department->setAttrib('onchange', 'displayEmpReportingmanagers(this,"reporting_id","req")'); /* * added New $ipbusiness_unit and $ipdepartment controls */ //start--------------- $ipbusiness_unit = new Zend_Form_Element_Select("ipbusiness_unit"); $ipbusiness_unit->setAttrib("class", "formDataElement"); $ipbusiness_unit->setAttrib("onchange", "getdepts_req(this,'ipdepartment','position_id');"); $ipbusiness_unit->setAttrib('title', 'Business Unit.'); $ipdepartment = new Zend_Form_Element_Select("ipdepartment"); $ipdepartment->setAttrib("class", "formDataElement"); $ipdepartment->setAttrib('title', 'Department.'); $ipdepartment->addMultiOptions(array('' => 'Select Department')); $ipdepartment->setAttrib('onchange', 'displayEmpReportingmanagers(this,"ipreporting_id","req")'); $ipdepartment->setRegisterInArrayValidator(false); //$ipdepartment->setRequired(true); $ipdepartment->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); //$ipreporting_id = new Zend_Form_Element_Select("ipreporting_id"); $ipreporting_id = new Zend_Form_Element_Multiselect("ipreporting_id"); $ipreporting_id->setAttrib('title', 'Interview Panel Member.'); $ipreporting_id->setAttrib("class", "formDataElement"); $ipreporting_id->addMultiOptions(array('' => 'Select Interview Panel Member')); $ipreporting_id->setRegisterInArrayValidator(false); $ipreporting_id->setRequired(true); $ipreporting_id->addValidator('NotEmpty', false, array('messages' => 'Please select Interview Panel Member.')); //end--------------- $jobtitle = new Zend_Form_Element_Select("jobtitle"); $jobtitle->setAttrib("class", "formDataElement"); $jobtitle->setAttrib("onchange", "getpositions_req('department','business_unit','position_id','jobtitle');"); $jobtitle->setAttrib('title', 'Job Title.'); $reporting_id = new Zend_Form_Element_Select("reporting_id"); $reporting_id->setAttrib('title', 'Reporting Manager.'); $reporting_id->setRegisterInArrayValidator(false); $reporting_id->addMultiOptions(array('' => 'Select Reporting Manager')); $position_id = new Zend_Form_Element_Select("position_id"); $position_id->setAttrib("class", "formDataElement"); $position_id->setAttrib('title', 'Position.'); $position_id->addMultiOptions(array('' => 'Select Position')); $req_no_positions = new Zend_Form_Element_Text('req_no_positions'); $req_no_positions->setAttrib('maxLength', 4); $req_no_positions->setAttrib('title', 'Required no.of positions.'); $req_no_positions->addFilter(new Zend_Filter_StringTrim()); $jobdescription = new Zend_Form_Element_Textarea('jobdescription'); $jobdescription->setAttrib('rows', 10); $jobdescription->setAttrib('cols', 50); $jobdescription->setAttrib('title', 'Job description.'); $req_skills = new Zend_Form_Element_Textarea('req_skills'); $req_skills->setAttrib('rows', 10); $req_skills->setAttrib('cols', 50); $req_skills->setAttrib('maxlength', 400); $req_skills->setAttrib('title', 'Required Skills.'); $req_qualification = new Zend_Form_Element_Text('req_qualification'); $req_qualification->setAttrib('maxLength', 100); $req_qualification->setAttrib('title', 'Required Qualification.'); $req_qualification->addFilter(new Zend_Filter_StringTrim()); $req_exp_years = new Zend_Form_Element_Text('req_exp_years'); $req_exp_years->setAttrib('maxLength', 5); $req_exp_years->setAttrib('title', 'Required Experience.'); $req_exp_years->addFilter(new Zend_Filter_StringTrim()); $emp_type = new Zend_Form_Element_Select("emp_type"); $emp_type->setAttrib("class", "formDataElement"); $emp_type->setAttrib('title', 'Employment Status.'); $req_priority = new Zend_Form_Element_Select("req_priority"); $req_priority->setAttrib('title', 'Priority.'); $req_priority->addMultiOptions(array('' => 'Select Priority', 1 => 'High', 3 => 'Low', 2 => 'Medium')); $req_priority->setAttrib("class", "formDataElement"); $additional_info = new Zend_Form_Element_Textarea('additional_info'); $additional_info->setAttrib('rows', 10); $additional_info->setAttrib('cols', 50); $additional_info->setAttrib('maxlength', 400); $additional_info->setAttrib('title', 'Additional Information.'); $req_status = new Zend_Form_Element_Select('req_status'); $req_status->setLabel('Requisition Status'); if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) { $reporting_id->setAttrib("class", "formDataElement"); $reporting_id->setRequired(true); $reporting_id->addValidator('NotEmpty', false, array('messages' => 'Please select reporting manager.')); } $onboard_date->setRequired(true); $onboard_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.')); $department->setRegisterInArrayValidator(false); $department->setRequired(true); $department->addValidator('NotEmpty', false, array('messages' => 'Please select department.')); $jobtitle->setRegisterInArrayValidator(false); $jobtitle->setRequired(true); $jobtitle->addValidator('NotEmpty', false, array('messages' => 'Please select job title.')); $position_id->setRegisterInArrayValidator(false); $position_id->setRequired(true); $position_id->addValidator('NotEmpty', false, array('messages' => 'Please select position.')); $req_no_positions->setRequired(true); $req_no_positions->addValidator('NotEmpty', false, array('messages' => 'Please enter required no.of positions.')); $req_no_positions->addValidator("regex", true, array('pattern' => '/^([0-9]+?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers.'))); $req_no_positions->addValidator("greaterThan", true, array('min' => 0, 'messages' => array('notGreaterThan' => 'No.of positions cannot be zero.'))); $req_skills->setRequired(true); $req_skills->addValidator('NotEmpty', false, array('messages' => 'Please enter required skills.')); $req_qualification->setRequired(true); $req_qualification->addValidator('NotEmpty', false, array('messages' => 'Please enter required qualification.')); $req_qualification->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z\\/\\-\\. ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid qualification.'))); $req_exp_years->setRequired(true); $req_exp_years->addValidator('NotEmpty', false, array('messages' => 'Please enter required experience range.')); $req_exp_years->addValidator("regex", true, array('pattern' => '/^([0-9]{1,2}\\-[0-9]{1,2})+$/', 'messages' => array('regexNotMatch' => 'Please enter valid experience range.'))); $emp_type->setRegisterInArrayValidator(false); $emp_type->setRequired(true); $emp_type->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.')); $req_priority->setRequired(true); $req_priority->addValidator('NotEmpty', false, array('messages' => 'Please select priority.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $email_cnt = new Zend_Form_Element_Hidden('email_cnt'); $idval = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null); $bunit_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('business_unit', null); $approver1 = new Zend_Form_Element_Select("approver1"); $approver1->setRegisterInArrayValidator(false); $approver1->addMultiOptions(array('' => 'Select Approver -1')); $approver1->setRequired(true); $approver1->addValidator('NotEmpty', false, array('messages' => 'Please select approver-1.')); $approver2 = new Zend_Form_Element_Select("approver2"); $approver2->setRegisterInArrayValidator(false); $approver2->addMultiOptions(array('' => 'Select Approver -2')); $approver3 = new Zend_Form_Element_Select("approver3"); $approver3->setRegisterInArrayValidator(false); $approver3->addMultiOptions(array('' => 'Select Approver -3')); /* * added New $ipbusiness_unit and $ipdepartment controls */ $this->addElements(array($id, $submit, $requisition_code, $onboard_date, $business_unit, $department, $jobtitle, $reporting_id, $position_id, $req_no_positions, $jobdescription, $req_skills, $req_qualification, $req_exp_years, $emp_type, $req_priority, $additional_info, $req_status, $email_cnt, $approver1, $approver2, $approver3, $ipbusiness_unit, $ipdepartment, $ipreporting_id)); $this->setElementDecorators(array('ViewHelper')); }