当前位置: 首页>>代码示例>>PHP>>正文


PHP sfForm::getWidgetSchema方法代码示例

本文整理汇总了PHP中sfForm::getWidgetSchema方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::getWidgetSchema方法的具体用法?PHP sfForm::getWidgetSchema怎么用?PHP sfForm::getWidgetSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfForm的用法示例。


在下文中一共展示了sfForm::getWidgetSchema方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup

 public static function setup(sfForm $form)
 {
     $formatter = new pmWidgetFormSchemaFormatterTable($form);
     $form->getWidgetSchema()->addFormFormatter("pm_table", $formatter);
     $form->getWidgetSchema()->setFormFormatterName("pm_table");
     $form->unsetFields();
     // auto configure widgets
     pmWidgetFactory::replaceWidgets($form);
     // auto configure validators
     pmValidatorFactory::replaceValidators($form);
     $form->configureWidgets();
     $form->configureValidators();
     if ($form instanceof pmFormPropel) {
         $sf_user = sfContext::getInstance()->getUser();
         if (method_exists($sf_user, "getGuardUser")) {
             $user_id = $sf_user->getGuardUser()->getId();
             if (array_key_exists("created_by", $form->getWidgetSchema()->getFields()) && $form->getObject()->isNew()) {
                 $form->getObject()->setCreatedBy($user_id);
             }
             if (array_key_exists("updated_by", $form->getWidgetSchema()->getFields())) {
                 $form->getObject()->setUpdatedBy($user_id);
             }
         }
     }
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:25,代码来源:pmFormCommon.class.php

示例2: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $activeProjectFound = false;
     $userRoleManager = sfContext::getInstance()->getUserRoleManager();
     $projectList = $userRoleManager->getAccessibleEntities('Project');
     foreach ($projectList as $project) {
         if ($project->getIsDeleted() != 0) {
             $activeProjectFound = true;
             break;
         }
     }
     $requiredMess = __('Select a project');
     if (!$activeProjectFound) {
         $requiredMess = __("No Projects Defined");
     }
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = __(ucwords(str_replace("_", " ", $this->attributes['id'])));
     $validator = new sfValidatorString();
     if ($this->attributes['required'] == "true") {
         $label .= "<span class='required'> * </span>";
         $validator = new sfValidatorString(array('required' => true), array('required' => $requiredMess));
     }
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], $validator);
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:30,代码来源:ohrmWidgetProjectList.php

示例3: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     //        $validatorSchema = $form->getValidatorSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     //        $widgetSchema[$this->attributes['id']]->setLabel(ucwords(str_replace("_", " ", $this->attributes['id'])));
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:11,代码来源:ohrmWidgetReportDisplayGroup.php

示例4: embedWidgetIntoForm

 /**
  * Embeds this widget into the form.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = ucwords(str_replace("_", " ", $this->attributes['id']));
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], new sfValidatorPass());
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:12,代码来源:ohrmWidgetInputCheckbox.php

示例5: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $validatorSchema = $form->getValidatorSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $widgetSchema[$this->attributes['id']]->setLabel(__(ucwords(str_replace("_", " ", $this->attributes['id']))));
     $validatorSchema[$this->attributes['id']] = new ohrmValidatorDateRange(array(), array("invalid" => "Insert a correct date"));
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:12,代码来源:ohrmWidgetDateRange.php

示例6: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $validatorSchema = $form->getValidatorSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $widgetSchema[$this->attributes['id']]->setLabel(ucwords(str_replace("_", " ", $this->attributes['id'])));
     $required = $requiredMessage = __(ValidationMessages::REQUIRED);
     $validatorSchema[$this->attributes['id']] = new ohrmValidatorConditionalFilter(array(), array('required' => $requiredMessage));
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:13,代码来源:ohrmReportWidgetAgeGroup.php

示例7: executeAjaxAddInvoiceItem

 /**
  * AJAX action to add new invoice items
  * @param sfWebRequest $request
  * @return unknown_type
  */
 public function executeAjaxAddInvoiceItem(sfWebRequest $request)
 {
     $index = 'new_item_invoice_' . time();
     $item = new Item();
     $item->common_id = $request->getParameter('invoice_id');
     $form = new sfForm();
     $form->getWidgetSchema()->setNameFormat('invoice[%s]');
     $form->embedForm('Items', new FormsContainer(array($index => new ItemForm($item)), 'ItemForm'));
     $params = array('invoiceItemForm' => $form['Items'][$index], 'item' => $item, 'isNew' => true, 'rowId' => $index);
     return $this->renderPartial('invoiceRow', $params);
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:16,代码来源:actions.class.php

示例8: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = ucwords(str_replace("_", " ", $this->attributes['id']));
     $validator = new sfValidatorChoice(array('choices' => array_keys($this->subDivisionList)));
     if ($this->attributes['required'] == "true") {
         $label .= "<span class='required'> * </span>";
     }
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], $validator);
 }
开发者ID:rabbitdigital,项目名称:HRM,代码行数:16,代码来源:ohrmWidgetSubDivisionList.php

示例9: embedWidgetIntoForm

 public function embedWidgetIntoForm(sfForm $form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $validatorSchema = $form->getValidatorSchema();
     $widgetSchema['from_date'] = new ohrmWidgetDatePicker(array(), array('id' => 'from_date'));
     $widgetSchema['from_date']->setLabel("From ");
     $form->setValidator('from_date', new sfValidatorDate());
     $widgetSchema['to_date'] = new ohrmWidgetDatePicker(array(), array('id' => 'to_date'));
     $widgetSchema['to_date']->setLabel("To ");
     $form->setValidator('to_date', new sfValidatorDate());
     $validatorSchema->setPostValidator(new sfValidatorSchemaCompare('from_date', sfValidatorSchemaCompare::LESS_THAN_EQUAL, 'to_date', array('throw_global_error' => true), array('invalid' => 'The from date ("%left_field%") must be before the to date ("%right_field%")')));
     return $form;
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:13,代码来源:ohrmWidgetJQueryDateRange.php

示例10: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = ucwords(str_replace("_", " ", $this->attributes['id']));
     $validator = new sfValidatorString();
     if ($this->attributes['required'] == "true") {
         $label .= "<span class='required'> * </span>";
         $validator = new sfValidatorString(array('required' => true), array('required' => 'No employees added to the system'));
     }
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], $validator);
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:17,代码来源:ohrmWidgetEmployeeList.php

示例11: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = __(ucwords(str_replace("_", " ", $this->attributes['id'])));
     $validator = new sfValidatorString(array('required' => false));
     if ($this->attributes['required'] == "true") {
         $label .= "<span class='required'> * </span>";
         $validator = new sfValidatorString(array('required' => true), array('required' => 'Add a project to view'));
     }
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], $validator);
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:17,代码来源:ohrmWidgetProjectListWithAllOption.php

示例12: embedWidgetIntoForm

 public function embedWidgetIntoForm(sfForm &$form)
 {
     $requiredMess = 'Select a location';
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = ucwords(str_replace("_", " ", $this->attributes['id']));
     $validator = new sfValidatorString();
     if (isset($this->attributes['required']) && $this->attributes['required'] == "true") {
         $label .= "<span class='required'> * </span>";
         $validator = new sfValidatorString(array('required' => true), array('required' => $requiredMess));
     }
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], $validator);
 }
开发者ID:rabbitdigital,项目名称:HRM,代码行数:14,代码来源:ohrmReportWidgetOperationalCountryLocationDropDown.php

示例13: embedWidgetIntoForm

 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $validatorSchema = $form->getValidatorSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $widgetSchema[$this->attributes['id']]->setLabel(ucwords(str_replace("_", " ", $this->attributes['id'])));
     $requiredMessage = __(ValidationMessages::REQUIRED);
     $validatorSchema[$this->attributes['id']] = new ohrmValidatorConditionalFilter(array(), array('required' => $requiredMessage));
     //$form->setValidator('date_period', new sfValidatorString());
     //        $validatorSchema[$this->attributes['id']] = new ohrmValidatorDateRange(array(), array("invalid" => "Insert a correct date"));
     //        $validatorSchema[$this->attributes['id']] = new sfValidatorPass();
     //        $validatorSchema->setPostValidator(new ohrmValidatorSchemaDateRange($this->attributes['id'], ohrmValidatorSchemaDateRange::LESS_THAN_EQUAL, $this->attributes['id'],
     //                        array('throw_global_error' => true),
     //                        array('invalid' => 'The from date ("%left_field%") must be before the to date ("%right_field%")')
     //        ));
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:20,代码来源:ohrmReportWidgetServicePeriod.php

示例14: configureWidgetSchema

 /**
  * Configures some things on the sfWidgetSchema of the form
  */
 protected function configureWidgetSchema(sfForm $form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $requiredFields = $form->getRequiredFields();
     $widgetSchema->addOption('required_fields', $requiredFields);
     $formFormatters = sfSympalConfig::get('form', 'form_formatters', array());
     $catalogue = $widgetSchema->getFormFormatter()->getTranslationCatalogue();
     foreach ($formFormatters as $name => $class) {
         $formFormatter = new $class($widgetSchema);
         // persist the translation catalogue
         if ($catalogue) {
             $formFormatter->setTranslationCatalogue($catalogue);
         }
         $widgetSchema->addFormFormatter($name, $formFormatter);
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:19,代码来源:sfSympalFormPostConfigureListener.class.php

示例15: replaceValidators

 public static function replaceValidators(sfForm $form)
 {
     foreach ($form->getWidgetSchema()->getFields() as $name => $widget) {
         if ($widget instanceof mtWidgetFormInputDate) {
             $form->setValidator($name, self::getDateValidator());
         } elseif ($widget instanceof sfWidgetFormFilterDate) {
             $form->getValidator($name)->setOption("from_date", self::getDateValidator(array("required" => false)));
             $form->getValidator($name)->setOption("to_date", self::getDateValidator(array("required" => false)));
         }
         if ($name == "attachment") {
             $form->setValidator($name, new sfValidatorFile(array("required" => false, "path" => sfConfig::get("sf_upload_dir"))));
         } elseif ($name == "email") {
             $form->setValidator($name, new sfValidatorEmail());
         }
     }
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:16,代码来源:pmValidatorFactory.class.php


注:本文中的sfForm::getWidgetSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。