Example #1
1
 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'));
 }
Example #2
1
 public function init()
 {
     // Init settings object
     $translate = Zend_Registry::get('Zend_Translate');
     // Init form
     $this->setTitle('Email To Friends')->setDescription('Send message to your followers.')->setLegend('');
     $this->setAttrib('class', 'global_form_popup');
     $followerTable = Engine_Api::_()->getDbTable('follow', 'advgroup');
     $followers = $followerTable->getUserFollow($this->_group->getIdentity());
     $arrValue = array();
     foreach ($followers as $follower) {
         $user = Engine_Api::_()->getItem('user', $follower->user_id);
         $arrValue[$follower->user_id] = $user->getTitle();
     }
     $multi = new Zend_Form_Element_Multiselect('followers');
     $multi->setMultiOptions($arrValue);
     $this->addElement($multi);
     // Init custom message
     $this->addElement('Textarea', 'message', array('label' => 'Custom Message', 'style' => 'width:450px', 'required' => true, 'allowEmpty' => false, 'filters' => array(new Engine_Filter_Censor())));
     $this->message->getDecorator('Description')->setOptions(array('placement' => 'APPEND'));
     $this->addElement('Button', 'submit', array('label' => 'Send Emails', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $buttons[] = 'submit';
     $onclick = 'parent.Smoothbox.close();';
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'href' => '', 'onclick' => $onclick, 'decorators' => array('ViewHelper')));
     $buttons[] = 'cancel';
     $this->addDisplayGroup($buttons, 'buttons');
     $button_group = $this->getDisplayGroup('buttons');
 }
 /**
  * Prepare form
  * 
  * @param Uni_Core_Form $form 
  */
 protected function _prepareForm(Uni_Core_Form $form)
 {
     $form->setName('menu')->setMethod('post');
     $subForm1 = new Zend_Form_SubForm();
     $subForm1->setLegend('Menu Item Information');
     $subForm1->setDescription('Menu Item Information');
     $idField = new Zend_Form_Element_Hidden('id');
     $title = new Zend_Form_Element_Text('title', array('class' => 'required', 'maxlength' => 200));
     $title->setRequired(true)->setLabel('Title')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $link = new Zend_Form_Element_Text('link', array('maxlength' => 200));
     $link->setLabel('Link')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDescription('Use module/controller/action for internal links or http://www.example.com for external links');
     $open_window = new Zend_Form_Element_Select('open_window', array('class' => 'required', 'maxlength' => 200));
     $open_window->setRequired(true)->setLabel('Open Window')->setMultiOptions(Fox::getModel('navigation/menu')->getAllTargetWindows());
     $status = new Zend_Form_Element_Select('status', array('class' => 'required', 'maxlength' => 200));
     $status->setRequired(true)->setLabel('Status')->setMultiOptions(Fox::getModel('navigation/menu')->getAllStatuses());
     $sort_order = new Zend_Form_Element_Text('sort_order', array('class' => 'required', 'maxlength' => 200));
     $sort_order->setRequired(true)->setLabel('Sort Order')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $style_class = new Zend_Form_Element_Text('style_class');
     $style_class->setLabel('Style Class')->addFilter('StripTags')->addFilter('StringTrim');
     $menugroup = new Zend_Form_Element_Multiselect('menu_group', array('class' => 'required'));
     $menugroup->setRequired(true)->setLabel('Menu Group')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setMultiOptions(Fox::getModel('navigation/menugroup')->getMenuGroupOptions());
     $subForm1->addElements(array($idField, $title, $link, $open_window, $sort_order, $style_class, $status, $menugroup));
     $form->addSubForm($subForm1, 'subform1');
     parent::_prepareForm($form);
 }
Example #4
1
 public function init()
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $href = $request->getBaseUrl() . '/' . $request->getModuleName() . '/' . $request->getControllerName() . '/' . $request->getActionName();
     //get models
     $users_model = new Admin_Model_AdminUsers();
     $roles_model = new Admin_Model_Roles();
     $users = new Zend_Form_Element_Multiselect('users');
     $users->setLabel('Users:')->setAttrib("class", "select2")->setAttrib("data-placeholder", "Choose user...")->setAttrib("style", "width:200px")->addMultiOptions($users_model->getForDropdown());
     $roles = new Zend_Form_Element_Multiselect('roles');
     $roles->setLabel('Usergroup:')->setAttrib("class", "select2")->setAttrib("data-placeholder", "Choose usergroup...")->setAttrib("style", "width:200px")->addMultiOptions($roles_model->getForDropdown());
     $actions = new Zend_Form_Element_Multiselect('actions');
     $actions->setLabel('Actions:')->setAttrib("class", "select2")->setAttrib("data-placeholder", "Choose action...")->setAttrib("style", "width:200px");
     $actions->addMultiOption('INSERT', 'INSERT')->addMultiOption('UPDATE', 'UPDATE')->addMultiOption('DELETE', 'DELETE');
     $affected_table = new Zend_Form_Element_Text('affected_table');
     $affected_table->setLabel("Tabela")->setAttrib("class", "form-control")->setAttrib("style", "width:200px");
     $start_date = new Zend_Form_Element_Text('start_date');
     $start_date->setLabel("Date from")->setAttrib('class', 'datepicker');
     $end_date = new Zend_Form_Element_Text('end_date');
     $end_date->setLabel("Date to")->setAttrib('class', 'datepicker');
     $submit = new Zend_Form_Element_Submit('filter_submit');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setLabel('Filter');
     $this->setAction($href)->setMethod('post')->addElement($users)->addElement($roles)->addElement($actions)->addElement($affected_table)->addElement($start_date)->addElement($end_date)->addElement($submit);
 }
Example #5
1
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'timezone/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'timezone');
     $id = new Zend_Form_Element_Hidden('id');
     $timezone = new Zend_Form_Element_Multiselect('timezone');
     $timezone->setRegisterInArrayValidator(false);
     $timezone->setRequired(true);
     $timezone->addValidator('NotEmpty', false, array('messages' => 'Please select time zone.'));
     $timezoneModal = new Default_Model_Timezone();
     $timezoneData = $timezoneModal->getalltimezones();
     foreach ($timezoneData as $data) {
         $timezone->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']');
     }
     $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');
     $url = "'timezone/saveupdate/format/json'";
     $dialogMsg = "''";
     $toggleDivId = "''";
     $jsFunction = "'redirecttocontroller(\\'timezone\\');'";
     $this->addElements(array($id, $timezone, $description, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #6
1
 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()
 {
     parent::init();
     $this->addElement('hidden', 'idECD');
     $vm = new Zend_Form_Element_Multiselect('idVM');
     $vm->setLabel('Value Meaning:')->addMultiOptions($this->_getDependentSelect('Default_Model_ValueMeaning'))->setDecorators($this->decorators);
     $this->addElement($vm);
     $this->addDisplayGroup(array('idVM'), 'group1', array("legend" => "Enumerated Conceptual Domain specific values"));
 }
Example #8
1
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'empscreeningreport');
     $this->setAttrib('action', BASE_URL . 'reports/empscreening');
     $specimen = new Zend_Form_Element_Select('specimen');
     $specimen->setLabel('Select Employee/Candidate');
     $specimen->addMultiOption('', 'Select Employee/Candidate');
     $specimen->addMultiOption('1', 'Employee');
     $specimen->addMultiOption('2', 'Candidate');
     $empname = new Zend_Form_Element_Text('empname');
     $empname->setLabel('Employee / Candidate Name');
     $empname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.\\-]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $empname->setAttrib('onblur', 'clearEmpScreeningAutoCompleteNames(this)');
     $agencyname = new Zend_Form_Element_Text('agencyname');
     $agencyname->setLabel('Agency Name');
     $agencyname->setAttrib('class', 'selectoption');
     $agencyname->addValidator("regex", true, array('pattern' => '/^([a-zA-Z.\\-]+ ?)+$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $agencyname->setAttrib('onblur', 'clearEmpScreeningAutoCompleteNames(this)');
     $screeningtype = new Zend_Form_Element_Multiselect('screeningtype');
     $screeningtype->setLabel('Screening Type');
     $checktypeModal = new Default_Model_Bgscreeningtype();
     $typesData = $checktypeModal->fetchAll('isactive=1', 'type');
     foreach ($typesData->toArray() as $data) {
         $screeningtype->addMultiOption($data['id'], $data['type']);
     }
     $screeningtype->setRegisterInArrayValidator(false);
     $process_status = new Zend_Form_Element_Select('process_status');
     $process_status->setLabel('Select Status');
     $process_status->addMultiOption('', 'Select Status');
     $process_status->addMultiOption('In process', 'In process');
     $process_status->addMultiOption('Complete', 'Complete');
     $process_status->addMultiOption('On hold', 'On hold');
     $month = new Zend_Form_Element_Select('month');
     $month->setLabel('Select Month');
     $month->addMultiOption('', 'Select Month');
     $monthnamesarray = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
     for ($i = 1; $i <= sizeof($monthnamesarray); $i++) {
         $month->addMultiOption($i, $monthnamesarray[$i]);
     }
     $year = new Zend_Form_Element_Select('year');
     $year->setLabel('Select Year');
     $curYear = date("Y");
     $preYear = $curYear - 10;
     $year->addMultiOption('', 'Select Year');
     for ($i = $preYear; $i <= $curYear; $i++) {
         $year->addMultiOption($i, $i);
     }
     $this->addElements(array($specimen, $empname, $agencyname, $screeningtype, $process_status, $month, $year));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #9
1
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'frm_emp_report');
     $reporting_manager = new Zend_Form_Element_Text("reporting_manager");
     $reporting_manager->setLabel("Reporting Manager");
     $reporting_manager->setAttrib('name', '');
     $reporting_manager->setAttrib('id', 'idreporting_manager');
     $joined_date = new Zend_Form_Element_Text("date_of_joining");
     $joined_date->setLabel("Joined Date");
     $joined_date->setAttrib('readonly', 'readonly');
     $modeofentry = new Zend_Form_Element_Select("modeofentry");
     $modeofentry->setLabel("Mode of Employment")->addMultiOptions(array('' => 'Select mode of employment', 'Direct' => 'Direct', 'Interview' => 'Interview', 'Reference' => 'Reference', 'Other' => 'Other'));
     // Form elelment name 'emailaddress' has to be DB table field name
     $email_id = new Zend_Form_Element_Text("emailaddress");
     $email_id->setLabel("Email ID");
     $email_id->setAttrib('name', '');
     $email_id->setAttrib('id', 'idemailaddress');
     // Form elelment name 'userfullname' has to be DB table field name
     $emp_name = new Zend_Form_Element_Text("userfullname");
     $emp_name->setLabel("Employee Name");
     $emp_name->setAttrib('name', '');
     $emp_name->setAttrib('id', 'iduserfullname');
     $employeeid = new Zend_Form_Element_Text("hidempId");
     $employeeid->setLabel("Employee ID");
     $employeeid->setAttrib('name', '');
     $jobtitle = new Zend_Form_Element_Select("jobtitle_id");
     $jobtitle->setLabel("Job Title");
     $jobtitle->setAttrib("onchange", "getpositions_req('department','business_unit','position_id','jobtitle_id');");
     $position_id = new Zend_Form_Element_Select("position_id");
     $position_id->setLabel("Position");
     $position_id->addMultiOptions(array('' => 'Select Position'));
     $emp_type = new Zend_Form_Element_Select("emp_status_id");
     $emp_type->setLabel("Employment Status");
     $emp_type->addMultiOptions(array('' => 'Select Employment Status'));
     $emprole = new Zend_Form_Element_Select("emprole");
     $emprole->setLabel("Role");
     $emprole->addMultiOptions(array('' => 'Select Role'));
     $department_id = new Zend_Form_Element_Multiselect("department_id");
     $department_id->setLabel("Department");
     $businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id");
     $businessunit_id->setLabel("Business Unit");
     $isactive = new Zend_Form_Element_Select("isactive");
     $isactive->setLabel("User Status")->addMultiOptions(array('' => 'Select User Status', '0' => 'Inactive', '1' => 'Active', '2' => 'Resigned', '3' => 'Left', '4' => 'Suspended'));
     $submit = new Zend_Form_Element_Button('submit');
     $submit->setAttrib('id', 'idsubmitbutton');
     $submit->setLabel('Report');
     $this->addElements(array($reporting_manager, $submit, $joined_date, $modeofentry, $email_id, $emp_name, $jobtitle, $position_id, $emp_type, $emprole, $department_id, $businessunit_id, $employeeid, $isactive));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #10
1
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', DOMAIN . 'heirarchy/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'heirarchy');
     $id = new Zend_Form_Element_Hidden('id');
     $level_1 = new Zend_Form_Element_Multiselect('level_1');
     $level_1->setLabel('Level one');
     $level_1->setRequired(true);
     $level_1->addValidator('NotEmpty', false, array('messages' => 'Please select level one employees.'));
     $level_1->setRegisterInArrayValidator(false);
     $level_2 = new Zend_Form_Element_Multiselect('level_2');
     $level_2->setLabel('Level two');
     $level_2->setRequired(true);
     $level_2->addValidator('NotEmpty', false, array('messages' => 'Please select level two employees.'));
     $level_2->setRegisterInArrayValidator(false);
     $level_3 = new Zend_Form_Element_Multiselect('level_3');
     $level_3->setLabel('Level three');
     $level_3->setRequired(true);
     $level_3->addValidator('NotEmpty', false, array('messages' => 'Please select level three employees.'));
     $level_3->setRegisterInArrayValidator(false);
     $level_4 = new Zend_Form_Element_Multiselect('level_4');
     $level_4->setLabel('Level four');
     $level_4->setRegisterInArrayValidator(false);
     $level_5 = new Zend_Form_Element_Multiselect('level_5');
     $level_5->setLabel('Level five');
     $level_5->setRegisterInArrayValidator(false);
     $level_6 = new Zend_Form_Element_Multiselect('level_6');
     $level_6->setLabel('Level six');
     $level_6->setRegisterInArrayValidator(false);
     $level_7 = new Zend_Form_Element_Multiselect('level_7');
     $level_7->setLabel('Level seven');
     $level_7->setRegisterInArrayValidator(false);
     $level_8 = new Zend_Form_Element_Multiselect('level_8');
     $level_8->setLabel('Level eight');
     $level_8->setRegisterInArrayValidator(false);
     $level_9 = new Zend_Form_Element_Multiselect('level_9');
     $level_9->setLabel('Level nine');
     $level_9->setRegisterInArrayValidator(false);
     $level_10 = new Zend_Form_Element_Multiselect('level_10');
     $level_10->setLabel('Level ten');
     $level_10->setRegisterInArrayValidator(false);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $level_1, $level_2, $level_3, $level_4, $level_5, $level_6, $level_7, $level_8, $level_9, $level_10, $submit));
     $this->setElementDecorators(array('ViewHelper'));
     $this->setElementDecorators(array('UiWidgetElement'), array('start_date'));
 }
Example #11
1
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'addempleaves');
     $id = new Zend_Form_Element_Hidden('id');
     $id_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     $emp_leave_limit = new Zend_Form_Element_Text('leave_limit');
     $emp_leave_limit->setLabel("Allot Leave Limit");
     $emp_leave_limit->setAttrib('maxLength', 3);
     $emp_leave_limit->addFilter(new Zend_Filter_StringTrim());
     if ($id_val == '') {
         $businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id");
         $businessunit_id->setLabel("Business Units");
         $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_Multiselect("department_id");
         $department_id->setLabel("Departments");
         $department_id->setRegisterInArrayValidator(false);
         $department_id->setRequired(true);
         $department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
         $user_id = new Zend_Form_Element_Multiselect("user_id");
         $user_id->setLabel("Employees");
         $user_id->setRegisterInArrayValidator(false);
         $user_id->setRequired(true);
         $user_id->addValidator('NotEmpty', false, array('messages' => 'Please select employees.'));
     } else {
         $businessunit_id = new Zend_Form_Element_Hidden('businessunit_id');
         $department_id = new Zend_Form_Element_Hidden('department_id');
         $user_id = new Zend_Form_Element_Hidden('user_id');
         $emp_leave_limit->setRequired(true);
         $emp_leave_limit->addValidator('NotEmpty', false, array('messages' => 'Please enter leave limit for current year.'));
     }
     $emp_leave_limit->addValidator("regex", true, array('pattern' => '/^(\\-?[1-9]|\\-?[1-9][0-9])$/', 'messages' => array('regexNotMatch' => 'Leave limit must be in the range of 0 to 100.')));
     $alloted_year = new Zend_Form_Element_Text('alloted_year');
     $alloted_year->setLabel("Year");
     $alloted_year->setAttrib('maxLength', 4);
     $alloted_year->setAttrib('disabled', 'disabled');
     $alloted_year->setAttrib('onfocus', 'this.blur()');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $submitbutton = new Zend_Form_Element_Button('submitbutton');
     $submitbutton->setAttrib('id', 'submitbuttons');
     $submitbutton->setAttrib('onclick', 'validateEmployeLeaves()');
     $submitbutton->setLabel('Save');
     $this->addElements(array($id, $user_id, $businessunit_id, $department_id, $emp_leave_limit, $alloted_year, $submit, $submitbutton));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #12
0
 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);
 }
Example #13
0
 public function init()
 {
     $this->setName('usuario')->setAttrib('class', 'form-horizontal');
     $usu_id_usuario = new Zend_Form_Element_Hidden('usu_id_usuario');
     $usu_id_usuario->addFilter('Int');
     $usu_nombre = new Zend_Form_Element_Text('usu_nombre');
     $usu_nombre->setAttrib('placeholder', 'Nombres')->setLabel('Nombres:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_apellido_1 = new Zend_Form_Element_Text('usu_apellido_1');
     $usu_apellido_1->setAttrib('placeholder', 'Apellido Paterno')->setLabel('Apellido Paterno:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_apellido_2 = new Zend_Form_Element_Text('usu_apellido_2');
     $usu_apellido_2->setAttrib('placeholder', 'Apellido Materno')->setLabel('Apellido Materno:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_rut = new Zend_Form_Element_Text('usu_rut');
     $usu_rut->setAttrib('placeholder', 'RUT')->setLabel('RUT:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_fono_1 = new Zend_Form_Element_Text('usu_fono_1');
     $usu_fono_1->setAttrib('placeholder', 'Teléfono Móvil')->setLabel('Teléfono Móvil:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_fono_2 = new Zend_Form_Element_Text('usu_fono_2');
     $usu_fono_2->setAttrib('placeholder', 'Teléfono Fijo')->setLabel('Teléfono Fijo:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_direccion = new Zend_Form_Element_Text('usu_direccion');
     $usu_direccion->setAttrib('placeholder', 'Dirección')->setLabel('Dirección:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_ciudad = new Zend_Form_Element_Text('usu_ciudad');
     $usu_ciudad->setAttrib('placeholder', 'Ciudad')->setLabel('Ciudad:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_porcentaje_comision = new Zend_Form_Element_Select('usu_porcentaje_comision');
     $usu_porcentaje_comision->setLabel('Pctje. de comisión:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_porcentaje_comision->addMultiOption("0", "0%");
     $usu_porcentaje_comision->addMultiOption("3", "3%");
     $usu_porcentaje_comision->addMultiOption("5", "5%");
     $per_id_perfil = new Zend_Form_Element_Multiselect('per_id_perfil');
     $per_id_perfil->setLabel('Perfil(es) de usuario:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('multiple', 'multiple');
     $filaPerfil = new Application_Model_DbTable_Perfil();
     foreach ($filaPerfil->fetchAll() as $per) {
         $per_id_perfil->addMultiOption($per->per_id_perfil, $per->per_nombre);
     }
     $usu_password = new Zend_Form_Element_Password('usu_password');
     $usu_password->setAttrib('placeholder', 'Password')->setLabel('Password:'******'StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_password_2 = new Zend_Form_Element_Password('usu_password_2');
     $usu_password_2->setAttrib('placeholder', 'Reingrese el Password')->setLabel('Password (2):')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $usu_password_2->addValidator('Identical', false, array('token' => 'usu_password'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $this->addElements(array($usu_id_usuario, $usu_rut, $usu_nombre, $usu_apellido_1, $usu_apellido_2, $usu_fono_1, $usu_fono_2, $usu_direccion, $usu_ciudad, $usu_password, $usu_password_2, $per_id_perfil, $usu_porcentaje_comision, $submit));
     //************* contacto
     $this->addDisplayGroup(array('usu_nombre', 'usu_apellido_1', 'usu_apellido_2', 'usu_fono_1', 'usu_fono_2', 'usu_direccion', 'usu_ciudad'), 'personal');
     $personal = $this->getDisplayGroup('personal');
     $personal->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'class' => 'span4'))));
     //************* sistema
     $this->addDisplayGroup(array('usu_rut', 'usu_password', 'usu_password_2', 'per_id_perfil', 'usu_porcentaje_comision'), 'sistema');
     $sistema = $this->getDisplayGroup('sistema');
     $sistema->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'class' => 'span4'))));
 }
Example #14
0
 public function init()
 {
     $this->setName('supplier');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $id->removeDecorator('label');
     $companies_id = new Zend_Form_Element_Hidden('companies_id');
     $companies_id->addFilter('Int');
     $companies_id->removeDecorator('label');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     //
     //        $supplier_types_id = new Zend_Form_Element_Select('supplier_types_id');
     //        $supplier_types_id->setLabel('supplier types')
     //                ->addValidator('NotEmpty', true)
     //                ->setmultiOptions($this->_selectOptions_types())
     //                ->setAttrib('maxlength', 200)
     //                ->setAttrib('size', 1)
     //                ->setAttrib("class", "toolboxdrop")
     //                ->setDecorators(array(array('ViewScript', array(
     //                            'viewScript' => 'forms/_element_select.phtml'))))
     //        ;
     $activity_types_id = new Zend_Form_Element_Multiselect('$activity_types_id');
     $activity_types_id->setLabel('Activity types')->setmultiOptions($this->_selectOptions_types())->setAttrib('maxlength', 200)->setAttrib('size', 5)->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))))->setAttrib("class", "toolboxdrop");
     $fiscal_name = new Zend_Form_Element_Text('fiscal_name');
     $fiscal_name->setLabel('Fiscal name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $company_types_id = new Zend_Form_Element_Select('company_types_id');
     $company_types_id->setLabel('Type')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompanyTypes())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->setLabel('Telephone')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $fax = new Zend_Form_Element_Text('fax');
     $fax->setLabel('fax')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $direction = new Zend_Form_Element_Text('direction');
     $direction->setLabel('Direction')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $city = new Zend_Form_Element_Text('city');
     $city->setLabel('City')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $country = new Zend_Form_Element_Text('country');
     $country->setLabel('Country')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $postal_code = new Zend_Form_Element_Text('postal_code');
     $postal_code->setLabel('Postal code')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $observation = new Zend_Form_Element_Text('observation');
     $observation->setLabel('Observation')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label');
     $this->addElements(array($id, $companies_id, $name, $activity_types_id, $fiscal_name, $company_types_id, $email, $telephone, $fax, $direction, $city, $country, $postal_code, $observation, $submit));
 }
Example #15
0
 public function init()
 {
     $this->setName('role');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $id->removeDecorator('label');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))))->setAttrib("class", "inputbox");
     $role_parent = new Zend_Form_Element_Multiselect('role_parent');
     $role_parent->setLabel('Role Parent')->setmultiOptions($this->_selectOptionsRoles())->setAttrib('maxlength', 200)->setAttrib('size', 5)->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))))->setAttrib("class", "toolboxdrop");
     $prefered_uri = new Zend_Form_Element_Text('prefered_uri');
     $prefered_uri->setLabel('Prefered Uri')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))))->setAttrib("class", "inputbox");
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label');
     $this->addElements(array($id, $name, $role_parent, $prefered_uri, $submit));
 }
 public function __construct($spec, $options = NULL)
 {
     if ($spec instanceof BuggyPress_Filter) {
         $this->_filter = $spec;
         $spec = self::FIELD_NAME;
     }
     parent::__construct($spec, $options);
 }
Example #17
0
 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");
     }
 }
Example #18
0
 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'));
 }
Example #19
0
 /**
  * Constrcuts the form
  *
  * @param Admin_Model_DbRow_Role $role
  * @param array $groups
  * @param array $users
  * @param array $inherits
  */
 public function __construct(Admin_Model_DbRow_Role $role, array $groups, array $users, array $inherits)
 {
     // create the dynamic multi options
     $selectGroups = new Zend_Form_Element_Multiselect('groups', array('label' => 'Groups:'));
     $selectUsers = new Zend_Form_Element_Multiselect('users', array('label' => 'Users:'));
     $inheritRole = new Zend_Form_Element_Multiselect('inherit', array('label' => 'Roles:', 'multiOptions' => array(0 => 'none')));
     foreach ($groups as $group) {
         $selectGroups->addMultiOption($group->get('id'), $group->get('name'));
     }
     foreach ($users as $user) {
         $selectUsers->addMultiOption($user->get('id'), $user->get('name'));
     }
     foreach ($inherits as $inRole) {
         $inheritRole->addMultiOption($inRole->get('id'), $inRole->get('name'));
     }
     $this->addElements(array(new Zend_Form_Element_Text('name', array('required' => true, 'label' => 'Name of the role:', 'attribs' => array('class' => 'text span-5'), 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('notEmpty'), 'value' => $role->get('name', ''), 'order' => 1)), new Zend_Form_Element_Textarea('description', array('label' => 'Description:', 'filters' => array('StripTags'), 'value' => $role->get('description'), 'order' => 2)), $selectGroups, $selectUsers, $inheritRole, new Zend_Form_Element_Submit('saveBtn', array('label' => 'Save', 'order' => 10))));
     $this->addDisplayGroups(array(array(array('name', 'description'), 'metadata', array('legend' => 'General Informations')), array(array('groups', 'users'), 'roleassignments', array('legend' => 'Apply groups and users to this role')), array(array('inherit'), 'roleinherit', array('legend' => 'Inherit the rights from the following roles'))));
     parent::__construct();
 }
Example #20
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'announcements');
     $this->setAttrib('name', 'announcements');
     $id = new Zend_Form_Element_Hidden('id');
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     if ($loginuserGroup == HR_GROUP) {
         $businessunit_id = new Zend_Form_Element_Select("businessunit_id");
     } else {
         $businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id");
     }
     $businessunit_id->setLabel("Business Units");
     $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_Multiselect("department_id");
     $department_id->setLabel("Departments");
     $department_id->setRegisterInArrayValidator(false);
     $department_id->setRequired(true);
     $department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
     $title = new Zend_Form_Element_Text("title");
     $title->setLabel("Title");
     $title->setAttrib('maxLength', 100);
     $title->addFilter(new Zend_Filter_StringTrim());
     $title->setRequired(true);
     $title->addValidator('NotEmpty', false, array('messages' => 'Please enter title.'));
     $title->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid title.')));
     $title->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_announcements', 'field' => 'title', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
     // Validation for duplicate name is not required
     $title->getValidator('Db_NoRecordExists')->setMessage('Title name already exists.');
     $description = new Zend_Form_Element_Textarea('post_description');
     $description->setLabel("Description");
     $description->setAttrib('rows', 10);
     $description->setAttrib('cols', 50);
     $description->setRequired(true);
     $description->addValidator('NotEmpty', false, array('messages' => 'Please enter post.'));
     $this->addElements(array($id, $businessunit_id, $department_id, $title, $description));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #21
0
 /**
  * Inserts two selections and buttons to control the elements between them.
  *
  * @param string $name - Define elements id. Important to javascript interaction
  * @param string $label
  * @param array $start_itens
  * @param array $end_itens
  */
 public function setSelectBox($name, $label, $start_itens, $end_itens = false)
 {
     $i18n = Zend_Registry::get("i18n");
     $header = new Zend_Form_Element_Hidden('elementHeader');
     $header->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selects', 'openOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::PREPEND));
     $start_box = new Zend_Form_Element_Multiselect("box");
     $start_box->setLabel($i18n->translate($label))->setMultiOptions($start_itens)->removeDecorator('DtDdWrapper')->setAttrib('id', $name . '_box')->setRegisterInArrayValidator(false);
     $end_box = new Zend_Form_Element_Multiselect("box_add");
     if ($end_itens) {
         $end_box->setMultiOptions($end_itens);
         $end_box->setValue(array_keys($end_itens));
     }
     $end_box->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setAttrib('id', $name . '_box_add')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selects', 'closeOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::APPEND))->setRegisterInArrayValidator(false);
     $add_action = new Zend_Form_Element_Button($i18n->translate('Add'));
     $add_action->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'li'))->setAttrib('id', $name . '_add_bt')->setAttrib('class', 'add_item')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selectActions', 'openOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::PREPEND));
     $remove_action = new Zend_Form_Element_Button($i18n->translate('Remove'));
     $remove_action->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'li'))->setAttrib('id', $name . '_remove_bt')->setAttrib('class', 'remove_item')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selectActions', 'closeOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::APPEND));
     $this->addElements(array($header, $start_box, $add_action, $remove_action, $end_box));
 }
Example #22
0
 /**
  * @group ZF-11667
  */
 public function testSimilarErrorMessagesForMultiElementAreNotDuplicated()
 {
     $this->element->setConcatJustValuesInErrorMessage(true);
     // create element with 4 checkboxes
     $this->element->setMultiOptions(array('multiOptions' => array(array('key' => 'a', 'value' => 'A'), array('key' => 'b', 'value' => 'B'), array('key' => 'c', 'value' => 'C'), array('key' => 'd', 'value' => 'D'))));
     // check 3 of them
     $this->element->setValue(array('A', 'B', 'D'));
     // later on, fails some validation on submit
     $this->element->addError('some error! %value%');
     $this->assertEquals(array('some error! A; B; D'), $this->element->getMessages());
 }
Example #23
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'performance');
     $startyear = date('Y', strtotime('-2 year'));
     $endyear = date('Y', strtotime('+2 year'));
     $employeename = new Zend_Form_Element_Text('employeename');
     $employeename->setLabel('Employee Name');
     // $employeename->setAttrib('onblur', 'clearautocompletename(this)');
     $reporting_manager = new Zend_Form_Element_Text("reporting_manager");
     $reporting_manager->setLabel("Line Manager");
     $reporting_manager->setAttrib('name', '');
     $reporting_manager->setAttrib('id', 'idreporting_manager');
     $fromyear = new Zend_Form_Element_Select('fromyear');
     $fromyear->setLabel('From Year');
     $fromyear->addMultiOption('', 'From Year');
     for ($i = $startyear; $i <= $endyear; $i++) {
         $fromyear->addMultiOption($i, $i);
     }
     $fromyear->setAttrib('class', 'selectoption');
     $fromyear->setRegisterInArrayValidator(false);
     $toyear = new Zend_Form_Element_Select('toyear');
     $toyear->setLabel('To Year');
     $toyear->addMultiOption('', 'To Year');
     $toyear->setAttrib('class', 'selectoption');
     $toyear->setRegisterInArrayValidator(false);
     /*for($i=$startyear;$i<=$endyear;$i++)
     		{
     			$toyear->addMultiOption($i,$i);
     		}*/
     $department_id = new Zend_Form_Element_Multiselect("department_id");
     $department_id->setLabel("Department");
     $businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id");
     $businessunit_id->setLabel("Business Unit");
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($employeename, $reporting_manager, $department_id, $businessunit_id, $fromyear, $toyear, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #24
0
 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;
 }
Example #25
0
 public function save ()
     { // $this->Config()->fieldName
     $paymentRow = Shopware()->Payments()->createRow(array(
                                 'name' => 'skrill',
                                 'description' => 'Skrill',
                                 'action' => 'skrill',
                                 'active' => 1,
                                 'pluginID' => $this->getId(),
                                 'additionalDescription' => '',
                                 ))->save();
     
     parent::save();
     }
Example #26
0
 public function createForm($app)
 {
     $view = new \Zend_View();
     $form = new \Zend_Form();
     $form->setView($view);
     $categories = $app["db"]->fetchAll("SELECT * FROM categories");
     $ticket_tags = new \Zend_Form_Element_Multiselect("tags", ["label" => "Kategori", "required" => true]);
     foreach ($categories as $category) {
         $ticket_tags->addMultiOption($category["category_id"], $category["category_name"]);
     }
     $priority = new \Zend_Form_Element_Select("priority", ["label" => "Önem", "required" => true]);
     $priority->addMultiOption("Düşük", "Düşük");
     $priority->addMultiOption("Orta", "Orta");
     $priority->addMultiOption("Yüksek", "Yüksek");
     $priority->addMultiOption("Kritik", "Kritik");
     $form->setAction("/ticket/create-save");
     $form->addElement("text", "title", ["label" => "Başlık", "required" => true]);
     $form->addElement($ticket_tags);
     $form->addElement($priority);
     $form->addElement("textarea", "comment", ["label" => "İleti", "required" => true]);
     $form->addElement("submit", "submit", ["ignore" => true, "label" => "Giriş"]);
     return $app['twig']->render('ticket/create.html.twig', ["form" => $form]);
 }
 public function __construct($options = array(), $users = array())
 {
     //$options['onsubmit'] = 'FM.AskUs.submitRequest();return false;';
     parent::__construct($options, $users);
     $this->setName('upload');
     $this->setAttrib('enctype', 'multipart/form-data');
     $pc = new FM_Models_FM_SearchPrimaryCategories();
     $category = new Zend_Form_Element_Multiselect(array('label' => 'category :', 'name' => 'category', 'required' => 1));
     foreach ($pc->getRootCategories() as $index => $values) {
         $category->addMultiOption($values['id'], $values['name']);
     }
     $this->addElement($category);
     //	$this->addElement('text', 'specialty', array('label'=>'specialty :', 'name'=>'specialty'));
     $this->addElement('textarea', 'keywords', array('label' => 'keywords :', 'name' => 'keywords', 'rows' => 3));
     $icon = new FM_Forms_Element_File('icon');
     $icon->setLabel('Icon :');
     $this->addElement($icon);
     $file = new FM_Forms_Element_File('file');
     $file->setLabel('Logo :');
     $this->addElement($file);
     $banner = new FM_Forms_Element_File('banner');
     $banner->setLabel('Banner :');
     $this->addElement($banner);
     $this->addElement('submit', 'clear', array('value' => 'clear', 'class' => 'clear_org'));
     $this->addElement('submit', 'submit', array('name' => 'submit', 'class' => 'sub'));
     $this->addDisplayGroup(array('description', 'category', 'keywords', 'icon', 'file', 'banner'), 'detailinfo');
     $detailinfo = $this->getDisplayGroup('detailinfo');
     $detailinfo->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'h4', 'placement' => 'prepend')), 'Fieldset'));
     $this->addElement('hidden', 'type', array('name' => 'type', 'value' => '2'));
     $this->addElement('hidden', 'orgId', array('name' => 'orgId', 'value' => '0'));
     $this->addDisplayGroup(array('type', 'orgId'), 'hidden');
     $hidden = $this->getDisplayGroup('hidden');
     $hidden->setDecorators(array('FormElements', 'Fieldset'));
     $this->addDisplayGroup(array('submit', 'clear'), 'submitgroup');
     $submitgroup = $this->getDisplayGroup('submitgroup');
     $submitgroup->setDecorators(array('FormElements', 'Fieldset'));
 }
 public function __construct($attributId, $spec = '', $options = '')
 {
     parent::__construct($spec, $options);
     $table = new ValueList();
     $select = $table->select();
     $select->order(ValueList::COL_NAME);
     $select->where(ValueList::COL_ATTRIBUTE_DESCRIPTOR_ID . "= ?", $attributId);
     $rowset = $table->fetchAll($select);
     $array = $rowset->toArray();
     $optArray = array(null => 'Please select');
     foreach ($array as $value) {
         $optArray = $optArray + array($value[ValueList::COL_ID] => $value[ValueList::COL_NAME]);
     }
     $this->setMultiOptions($optArray);
 }
Example #29
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'frm_emp_report');
     $reporting_manager = new Zend_Form_Element_Text("reporting_manager");
     $reporting_manager->setLabel("Reporting Manager");
     $reporting_manager->setAttrib('name', '');
     $reporting_manager->setAttrib('id', 'idreporting_manager');
     $joined_date = new Zend_Form_Element_Text("date_of_joining");
     $joined_date->setLabel("Joined Date");
     $joined_date->setAttrib('readonly', 'readonly');
     $modeofentry = new Zend_Form_Element_Select("modeofentry");
     $modeofentry->setLabel("Mode of Employment")->addMultiOptions(array('' => 'Select mode of employment', 'Direct' => 'Direct', 'Interview' => 'Interview', 'Reference' => 'Reference', 'Other' => 'Other'));
     $jobtitle = new Zend_Form_Element_Select("jobtitle_id");
     $jobtitle->setLabel("Job Title");
     $jobtitle->setAttrib("onchange", "getpositions_req('department','business_unit','position_id','jobtitle_id');");
     $position_id = new Zend_Form_Element_Select("position_id");
     $position_id->setLabel("Position");
     $position_id->addMultiOptions(array('' => 'Select Position'));
     $emp_type = new Zend_Form_Element_Select("emp_status_id");
     $emp_type->setLabel("Employment Status");
     $emp_type->addMultiOptions(array('' => 'Select Employment Status'));
     $emprole = new Zend_Form_Element_Select("emprole");
     $emprole->setLabel("Role");
     $emprole->addMultiOptions(array('' => 'Select Role'));
     $department_id = new Zend_Form_Element_Multiselect("department_id");
     $department_id->setLabel("Department");
     $businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id");
     $businessunit_id->setLabel("Business Unit");
     $submit = new Zend_Form_Element_Button('submit');
     $submit->setAttrib('id', 'idsubmitbutton');
     $submit->setLabel('Report');
     $this->addElements(array($reporting_manager, $submit, $joined_date, $modeofentry, $jobtitle, $position_id, $emp_type, $emprole, $department_id, $businessunit_id));
     $this->setElementDecorators(array('ViewHelper'));
 }
Example #30
0
 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");
     }
 }