public function configure() { $status = array('Enabled' => __('Enabled'), 'Disabled' => __('Disabled')); $idGenService = new IDGeneratorService(); $idGenService->setEntity(new Employee()); $empNumber = $idGenService->getNextID(false); $employeeId = str_pad($empNumber, 4, '0'); $this->widgets = array('firstName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'middleName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'lastName' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 30)), 'employeeId' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 10)), 'photofile' => new sfWidgetFormInputFileEditable(array('edit_mode' => false, 'with_delete' => false, 'file_src' => ''), array("class" => "duplexBox")), 'chkLogin' => new sfWidgetFormInputCheckbox(array('value_attribute_value' => 1), array()), 'user_name' => new sfWidgetFormInputText(array(), array("class" => "formInputText", "maxlength" => 20)), 'user_password' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText passwordRequired", "maxlength" => 20)), 're_password' => new sfWidgetFormInputPassword(array(), array("class" => "formInputText passwordRequired", "maxlength" => 20)), 'status' => new sfWidgetFormSelect(array('choices' => $status), array("class" => "formInputText")), 'empNumber' => new sfWidgetFormInputHidden()); $this->widgets['empNumber']->setDefault($empNumber); $this->widgets['employeeId']->setDefault($employeeId); if ($this->getOption('employeeId') != "") { $this->widgets['employeeId']->setDefault($this->getOption('employeeId')); } $this->widgets['firstName']->setDefault($this->getOption('firstName')); $this->widgets['middleName']->setDefault($this->getOption('middleName')); $this->widgets['lastName']->setDefault($this->getOption('lastName')); $this->widgets['chkLogin']->setDefault($this->getOption('chkLogin')); $this->widgets['user_name']->setDefault($this->getOption('user_name')); $this->widgets['user_password']->setDefault($this->getOption('user_password')); $this->widgets['re_password']->setDefault($this->getOption('re_password')); $selectedStatus = $this->getOption('status'); if (empty($selectedStatus) || !isset($status[$selectedStatus])) { $selectedStatus = 'Enabled'; } $this->widgets['status']->setDefault($selectedStatus); $this->setWidgets($this->widgets); $this->setValidators(array('photofile' => new sfValidatorFile(array('max_size' => 1000000, 'required' => false)), 'firstName' => new sfValidatorString(array('required' => true, 'max_length' => 30, 'trim' => true)), 'empNumber' => new sfValidatorString(array('required' => false)), 'lastName' => new sfValidatorString(array('required' => true, 'max_length' => 30, 'trim' => true)), 'middleName' => new sfValidatorString(array('required' => false, 'max_length' => 30, 'trim' => true)), 'employeeId' => new sfValidatorString(array('required' => false, 'max_length' => 10)), 'chkLogin' => new sfValidatorString(array('required' => false)), 'user_name' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 'user_password' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 're_password' => new sfValidatorString(array('required' => false, 'max_length' => 20, 'trim' => true)), 'status' => new sfValidatorString(array('required' => false)))); $this->getWidgetSchema()->setLabels($this->getFormLabels()); $formExtension = PluginFormMergeManager::instance(); $formExtension->mergeForms($this, 'addEmployee', 'AddEmployeeForm'); $customRowFormats[0] = "<li class=\"line nameContainer\"><label class=\"hasTopFieldHelp\">" . __('Full Name') . "</label><ol class=\"fieldsInLine\"><li><div class=\"fieldDescription\"><em>*</em> " . __('First Name') . "</div>\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[1] = "<li><div class=\"fieldDescription\">" . __('Middle Name') . "</div>\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[2] = "<li><div class=\"fieldDescription\"><em>*</em> " . __('Last Name') . "</div>\n %field%%help%\n%hidden_fields%%error%</li>\n</ol>\n</li>"; $customRowFormats[6] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[7] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[8] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; $customRowFormats[9] = "<li class=\"loginSection\">%label%\n %field%%help%\n%hidden_fields%%error%</li>\n"; sfWidgetFormSchemaFormatterCustomRowFormat::setCustomRowFormats($customRowFormats); $this->widgetSchema->setFormFormatterName('CustomRowFormat'); }
public static function setCustomRowFormats($customRowFormats) { self::$customRowFormats = $customRowFormats; }