本文整理汇总了PHP中sfWidgetFormSchema::setDefaultFormFormatterName方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWidgetFormSchema::setDefaultFormFormatterName方法的具体用法?PHP sfWidgetFormSchema::setDefaultFormFormatterName怎么用?PHP sfWidgetFormSchema::setDefaultFormFormatterName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWidgetFormSchema
的用法示例。
在下文中一共展示了sfWidgetFormSchema::setDefaultFormFormatterName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
public function configure()
{
// SET DEFAULT FORM-FORMATTER
sfWidgetFormSchema::setDefaultFormFormatterName('bootstrap');
}
示例2: setup
public function setup()
{
$this->enablePlugins('sfPropelORMPlugin');
$this->enablePlugins('sfGuardPlugin');
$this->enablePlugins('sfLESSPlugin');
sfWidgetFormSchema::setDefaultFormFormatterName('div');
}
示例3: execute
public function execute($filterChain)
{
$context = $this->getContext();
$request = $context->getRequest();
if (jfPortableDevice::isPortableDevice()) {
$layout = isset(self::$_layout) ? self::$_layout : $this->getParameter('layout');
$context->getActionStack()->getFirstEntry()->getActionInstance()->setLayout($layout);
if (class_exists('sfWidgetFormSchema')) {
// compatibility with symfony 1.0
sfWidgetFormSchema::setDefaultFormFormatterName($this->getParameter('defaultFormFormatterName', 'jfPD'));
}
jfPortableDevice::setPageAttribute('data-url', $request->getUri());
}
$filterChain->execute();
if (jfPortableDevice::isPortableDevice()) {
if (jfPortableDevice::getConfig('lazyLoadImages')) {
$response = $context->getResponse();
$content = $response->getContent();
$content = preg_replace('/(<img.*)(src=)([\'|\\"].*>)/', '$1data-jfPD-src=$3', $content);
$response->setContent($content);
}
if (jfPortableDevice::isNativeApp()) {
sfConfig::set('sf_web_debug', false);
}
}
}
示例4: setup
public function setup()
{
$this->enablePlugins('sfDoctrinePlugin');
$this->enablePlugins('sfThumbnailPlugin');
$this->enablePlugins('sfImageTransformPlugin');
$this->enablePlugins('sfFormExtraPlugin');
sfWidgetFormSchema::setDefaultFormFormatterName('list');
}
示例5: configure
public function configure()
{
// Cookie settings for increased security
ini_set('session.use_only_cookies', "1");
ini_set('session.cookie_httponly', "1");
ProjectConfiguration::getActive()->loadHelpers(array('I18N', 'OrangeDate', 'Orange', 'Url'));
sfWidgetFormSchema::setDefaultFormFormatterName('Default');
}
示例6: configure
public function configure()
{
// SET DEFAULT FORM-FORMATTER
/* sfWidgetFormSchema::setDefaultFormFormatterName('bootstrap'); */
sfWidgetFormSchema::setDefaultFormFormatterName('foundation');
ProjectConfiguration::getActive()->loadHelpers( array('I18N') );
}
示例7: setup
public function setup()
{
sfWidgetFormSchema::setDefaultFormFormatterName('list');
$this->culture = $this->getOption('culture', sfConfig::get('sf_default_culture'));
$this->JQueryDateOptions['culture'] = substr($this->culture, 0, 2);
$this->JQueryDateOptions['image'] = $this->getImagePath('icons/calendar.png');
$startYear = sfConfig::get('app_year_range_start', date('Y') - 5);
$years = range($startYear, date('Y') + 5);
$this->JQueryDateOptions['years'] = array_combine($years, $years);
}
示例8: initialize
public function initialize()
{
parent::initialize();
if (!opMobileUserAgent::getInstance()->isCookie()) {
ini_set('session.use_only_cookies', 0);
ini_set('session.use_cookies', 0);
ini_set('session.use_trans_sid', 1);
}
sfWidgetFormSchema::setDefaultFormFormatterName('mobile');
}
示例9: setup
public function setup()
{
$this->enablePlugins('sfDoctrinePlugin');
$this->enablePlugins('sfDoctrineGuardPlugin');
$this->enablePlugins('ioMenuPlugin');
$this->enablePlugins('sfFormExtraPlugin');
$this->enablePlugins('sfDoctrineApplyPlugin');
$this->enablePlugins('sfTCPDFPlugin');
$this->enablePlugins('sfTaskExtraPlugin');
$this->enablePlugins('sfZurbFoundationPlugin');
//// changing webDir if on donax
if (@$_SERVER['HTTP_HOST'] == 'otokou.donax.ch') {
$this->setWebDir($this->getRootDir() . '/..');
}
$this->enablePlugins('sfJqueryReloadedPlugin');
// defines the default schema formatter for forms
sfWidgetFormSchema::setDefaultFormFormatterName('otokou');
}
示例10: createBuildWidgetValidator
/**
* @param array $parameters
* @return array
*/
private function createBuildWidgetValidator($parameters)
{
$extraParametersWidgets = array();
$extraParametersValidators = array();
foreach ($parameters as $name => $parameter) {
if (is_array($parameter['choices'])) {
$extraParametersWidgets[$name] = new sfWidgetFormChoice(array('choices' => $this->combine($parameter['choices']), 'default' => $parameter['default']), array('label' => strlen($parameter['description']) > 0 ? $parameter['description'] : $name));
$extraParametersValidators[$name] = new sfValidatorChoice(array('choices' => $parameter['choices']));
} else {
$extraParametersWidgets[$name] = new sfWidgetFormInput(array('default' => $parameter['default']), array('label' => strlen($parameter['description']) > 0 ? $parameter['description'] : $name));
$extraParametersValidators[$name] = new sfValidatorString(array('required' => false));
}
}
$widget = new sfWidgetFormSchema($extraParametersWidgets, array('label' => 'Parameters'));
$widget->setDefaultFormFormatterName('jobParameter');
foreach ($parameters as $name => $parameter) {
if ($parameter['description']) {
$widget->setHelp($name, $parameter['description']);
}
}
$validator = new sfValidatorSchema($extraParametersValidators);
return array($widget, $validator);
}
示例11: configure
public function configure()
{
ProjectConfiguration::getActive()->loadHelpers(array('I18N', 'OrangeDate', 'Orange', 'Url'));
sfWidgetFormSchema::setDefaultFormFormatterName('Default');
}
示例12: sfWidgetFormSchemaFormatterList
$w->addFormFormatter('list', new sfWidgetFormSchemaFormatterList($w));
$w1 = clone $w;
$f1 = $w1->getFormFormatters();
$f = $w->getFormFormatters();
$t->is(array_keys($f1), array_keys($f), '__clone() clones form formatters');
foreach ($f1 as $key => $formFormatter) {
$t->ok($formFormatter !== $f[$key], '__clone() clones form formatters');
$t->is(get_class($formFormatter), get_class($f[$key]), '__clone() clones form formatters');
$t->ok($formFormatter->getWidgetSchema() !== $f[$key]->getWidgetSchema(), '__clone() clones form formatters');
$t->is(get_class($formFormatter->getWidgetSchema()), get_class($f[$key]->getWidgetSchema()), '__clone() clones form formatters');
}
// setDefaultFormFormatterName()
$t->diag('setDefaultFormFormatterName()');
$w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2));
$t->isa_ok($w->getFormFormatter(), 'sfWidgetFormSchemaFormatterTable', 'setDefaultFormFormatterName() has the "sfWidgetFormSchemaFormatterTable" form formatter by default');
sfWidgetFormSchema::setDefaultFormFormatterName('list');
$w = new sfWidgetFormSchema(array('w1' => $w1, 'w2' => $w2));
$t->isa_ok($w->getFormFormatter(), 'sfWidgetFormSchemaFormatterList', 'setDefaultFormFormatterName() changes the default form formatter name correctly');
class MyWidget extends sfWidgetForm
{
protected function configure($options = array(), $attributes = array())
{
$this->addRequiredOption('name');
}
public function render($name, $value = null, $attributes = array(), $errors = array())
{
return null;
}
public function getJavaScripts()
{
return array('/path/to/a/' . $this->getOption('name') . '.js', '/path/to/foo.js');
示例13: configure
public function configure()
{
sfWidgetFormSchema::setDefaultFormFormatterName('TwitterBootstrap');
}
示例14: configure
//.........这里部分代码省略.........
$this->widgetSchema['people_ref'] = new widgetFormButtonRef(array('model' => 'People', 'link_url' => 'people/searchBoth', 'box_title' => $this->getI18N()->__('Choose people role'), 'nullable' => true, 'button_class' => ''), array('class' => 'inline'));
$fields_to_search = array('spec_coll_ids' => $this->getI18N()->__('Collector'), 'spec_don_sel_ids' => $this->getI18N()->__('Donator or seller'), 'ident_ids' => $this->getI18N()->__('Identifier'));
$this->widgetSchema['role_ref'] = new sfWidgetFormChoice(array('choices' => $fields_to_search, 'multiple' => true, 'expanded' => true));
$this->validatorSchema['people_ref'] = new sfValidatorInteger(array('required' => false));
$this->validatorSchema['role_ref'] = new sfValidatorChoice(array('choices' => array_keys($fields_to_search), 'required' => false));
$this->validatorSchema['role_ref'] = new sfValidatorPass();
/* Acquisition categories */
$this->widgetSchema['acquisition_category'] = new sfWidgetFormChoice(array('choices' => array_merge(array('' => ''), SpecimensTable::getDistinctCategories())));
$this->widgetSchema['acquisition_from_date'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'from_date'));
$this->widgetSchema['acquisition_to_date'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'to_date'));
$this->validatorSchema['acquisition_from_date'] = new fuzzyDateValidator(array('required' => false, 'from_date' => true, 'min' => $minDate, 'max' => $maxDate, 'empty_value' => $dateLowerBound), array('invalid' => 'Date provided is not valid'));
$this->validatorSchema['acquisition_to_date'] = new fuzzyDateValidator(array('required' => false, 'min' => $minDate, 'from_date' => false, 'max' => $maxDate, 'empty_value' => $dateUpperBound), array('invalid' => 'Date provided is not valid'));
/**
* Individuals Fields
*/
$this->widgetSchema['type'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctTypeGroups', 'multiple' => true, 'expanded' => true, 'add_empty' => false));
$this->validatorSchema['type'] = new sfValidatorPass();
$this->widgetSchema['sex'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctSexes', 'multiple' => true, 'expanded' => true, 'add_empty' => false));
$this->validatorSchema['sex'] = new sfValidatorPass();
$this->widgetSchema['stage'] = new widgetFormSelectDoubleListFilterable(array('choices' => new sfCallable(array(Doctrine::getTable('Specimens'), 'getDistinctStages')), 'label_associated' => $this->getI18N()->__('Selected'), 'label_unassociated' => $this->getI18N()->__('Available')));
$this->validatorSchema['stage'] = new sfValidatorPass();
$this->widgetSchema['status'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctStates', 'multiple' => true, 'expanded' => true, 'add_empty' => false));
$this->validatorSchema['status'] = new sfValidatorPass();
$this->widgetSchema['specimen_status'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctSpecimenStatus', 'multiple' => false, 'expanded' => false, 'add_empty' => true));
$this->validatorSchema['specimen_status'] = new sfValidatorPass();
$this->widgetSchema['social'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctSocialStatuses', 'multiple' => true, 'expanded' => true, 'add_empty' => false));
$this->validatorSchema['social'] = new sfValidatorPass();
$this->widgetSchema['rockform'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctRockForms', 'multiple' => true, 'expanded' => true, 'add_empty' => false));
$this->validatorSchema['rockform'] = new sfValidatorPass();
$this->widgetSchema['count'] = new sfWidgetFormInput();
$this->widgetSchema['count']->setAttributes(array('class' => 'vsmall_size'));
$this->validatorSchema['count'] = new sfValidatorString(array('required' => false));
$operators = array('' => '', 'e' => '=', 'l' => '<=', 'g' => '>=');
$this->widgetSchema['count_operator'] = new sfWidgetFormChoice(array('choices' => $operators));
$this->validatorSchema['count_operator'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($operators)));
$this->widgetSchema['container'] = new sfWidgetFormInput();
$this->validatorSchema['container'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['sub_container'] = new sfWidgetFormInput();
$this->validatorSchema['sub_container'] = new sfValidatorString(array('required' => false));
$this->validatorSchema['part'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['part'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctParts', 'add_empty' => true));
$this->widgetSchema['object_name'] = new sfWidgetFormInput();
$this->validatorSchema['object_name'] = new sfValidatorString(array('required' => false));
$this->validatorSchema['floor'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['institution_ref'] = new widgetFormButtonRef(array('model' => 'Institutions', 'link_url' => 'institution/choose?with_js=1', 'method' => 'getFamilyName', 'box_title' => $this->getI18N()->__('Choose Institution'), 'nullable' => true));
$this->widgetSchema['institution_ref']->setLabel('Institution');
$this->validatorSchema['institution_ref'] = new sfValidatorInteger(array('required' => false));
$this->widgetSchema['building'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctBuildings', 'add_empty' => true));
$this->validatorSchema['building'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['floor'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctFloors', 'add_empty' => true));
$this->validatorSchema['floor'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['row'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctRows', 'add_empty' => true));
$this->validatorSchema['row'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['col'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctCols', 'add_empty' => true));
$this->validatorSchema['col'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['room'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctRooms', 'add_empty' => true));
$this->validatorSchema['room'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['shelf'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Specimens', 'table_method' => 'getDistinctShelfs', 'add_empty' => true));
$this->validatorSchema['shelf'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['property_type'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Properties', 'table_method' => array('method' => 'getDistinctType', 'parameters' => array('specimens')), 'add_empty' => $this->getI18N()->__('All')));
$this->validatorSchema['property_type'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['property_applies_to'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Properties', 'table_method' => array('method' => 'getDistinctApplies', 'parameters' => array()), 'add_empty' => $this->getI18N()->__('All')));
$this->validatorSchema['property_applies_to'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['property_value_from'] = new sfWidgetFormInput();
$this->validatorSchema['property_value_from'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['property_value_to'] = new sfWidgetFormInput();
$this->validatorSchema['property_value_to'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['property_units'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'Properties', 'table_method' => array('method' => 'getDistinctUnit', 'parameters' => array()), 'add_empty' => true));
$this->validatorSchema['property_units'] = new sfValidatorString(array('required' => false));
$this->widgetSchema['comment'] = new sfWidgetFormInput();
$this->validatorSchema['comment'] = new sfValidatorString(array('required' => false));
$comment_choices = array('' => '');
$comment_choices = $comment_choices + CommentsTable::getNotionsFor('specimens');
$this->widgetSchema['comment_notion_concerned'] = new sfWidgetFormChoice(array('choices' => $comment_choices));
$this->validatorSchema['comment_notion_concerned'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($comment_choices)));
$subForm = new sfForm();
$this->embedForm('Codes', $subForm);
// LAT LON
$this->widgetSchema['lat_from'] = new sfWidgetForminput();
$this->widgetSchema['lat_from']->setLabel('Latitude');
$this->widgetSchema['lat_from']->setAttributes(array('class' => 'medium_small_size'));
$this->widgetSchema['lat_to'] = new sfWidgetForminput();
$this->widgetSchema['lat_to']->setAttributes(array('class' => 'medium_small_size'));
$this->widgetSchema['lon_from'] = new sfWidgetForminput();
$this->widgetSchema['lon_from']->setLabel('Longitude');
$this->widgetSchema['lon_from']->setAttributes(array('class' => 'medium_small_size'));
$this->widgetSchema['lon_to'] = new sfWidgetForminput();
$this->widgetSchema['lon_to']->setAttributes(array('class' => 'medium_small_size'));
$this->validatorSchema['lat_from'] = new sfValidatorNumber(array('required' => false, 'min' => '-180', 'max' => '180'));
$this->validatorSchema['lon_from'] = new sfValidatorNumber(array('required' => false, 'min' => '-360', 'max' => '360'));
$this->validatorSchema['lat_to'] = new sfValidatorNumber(array('required' => false, 'min' => '-180', 'max' => '180'));
$this->validatorSchema['lon_to'] = new sfValidatorNumber(array('required' => false, 'min' => '-360', 'max' => '360'));
sfWidgetFormSchema::setDefaultFormFormatterName('list');
$this->widgetSchema->setNameFormat('specimen_search_filters[%s]');
/* Labels */
$this->widgetSchema->setLabels(array('rockform' => 'Rock form', 'gtu_code' => 'Sampling Location code', 'taxon_name' => 'Taxon text search', 'litho_name' => 'Litho text search', 'lithology_name' => 'Lithology text search', 'chrono_name' => 'Chrono text search', 'mineral_name' => 'Mineralo text search', 'taxon_level_ref' => 'Level', 'code_ref_relation' => 'Code of', 'people_ref' => 'Whom are you looking for', 'role_ref' => 'Which role', 'with_multimedia' => 'Search Only objects with multimedia files', 'gtu_from_date' => 'Between', 'gtu_to_date' => 'and', 'acquisition_from_date' => 'Between', 'acquisition_to_date' => 'and', 'ig_from_date' => 'Between', 'ig_to_date' => 'and', 'ig_num' => 'I.G. unit', 'property_type' => 'Type', 'property_applies_to' => 'Applies to', 'property_value_from' => 'From', 'property_value_to' => 'To', 'property_units' => 'Unit', 'comment_notion_concerned' => 'Notion concerned'));
// For compat only with old saved search
// might be removed with a migration
$this->validatorSchema['what_searched'] = new sfValidatorPass();
}
示例15: initialize
public function initialize()
{
parent::initialize();
sfWidgetFormSchema::setDefaultFormFormatterName('pc');
}