• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfWidgetFormSchema类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setup

 /**
  * Setup the form.  To overload, you should use ->configure()
  */
 public function setup()
 {
     $widgetSchema = new sfWidgetFormSchema(array('query' => new sfWidgetFormInput()), array(), array(), array(), array());
     $widgetSchema->addFormFormatter('sfLuceneSimple', new sfLuceneWidgetFormatterSimple($widgetSchema));
     $widgetSchema->setFormFormatterName('sfLuceneSimple');
     $widgetSchema->setNameFormat('form[%s]');
     $validatorSchema = new sfValidatorSchema(array('query' => new sfValidatorString(array('required' => true)), 'page' => new sfValidatorInteger(array('required' => false, 'empty_value' => 1))), array(), array());
     if ($this->hasCategories()) {
         $widgetSchema['category'] = new sfWidgetFormSelect(array('choices' => $this->getCategories(), 'multiple' => false));
         $validatorSchema['category'] = new sfValidatorChoice(array('required' => false, 'choices' => $this->getCategories()));
     }
     $this->setWidgetSchema($widgetSchema);
     $this->setValidatorSchema($validatorSchema);
 }
开发者ID:rande,项目名称:sfSolrPlugin,代码行数:17,代码来源:sfLuceneSimpleFormBase.class.php


示例2: setup

 public function setup()
 {
     $this->enablePlugins('sfPropelORMPlugin');
     $this->enablePlugins('sfGuardPlugin');
     $this->enablePlugins('sfLESSPlugin');
     sfWidgetFormSchema::setDefaultFormFormatterName('div');
 }
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:7,代码来源:ProjectConfiguration.class.php


示例3: configure

  public function configure()
  {

    // SET DEFAULT FORM-FORMATTER
    sfWidgetFormSchema::setDefaultFormFormatterName('bootstrap');
    
  }
开发者ID:romankallweit,项目名称:swingmachine,代码行数:7,代码来源:backendConfiguration.class.php


示例4: 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);
         }
     }
 }
开发者ID:muliadi,项目名称:jfportabledevice,代码行数:26,代码来源:jfPortableDeviceFilter.class.php


示例5: setup

 public function setup()
 {
     $this->enablePlugins('sfDoctrinePlugin');
     $this->enablePlugins('sfThumbnailPlugin');
     $this->enablePlugins('sfImageTransformPlugin');
     $this->enablePlugins('sfFormExtraPlugin');
     sfWidgetFormSchema::setDefaultFormFormatterName('list');
 }
开发者ID:thefkboss,项目名称:ZenTracker,代码行数:8,代码来源:ProjectConfiguration.class.php


示例6: 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');
 }
开发者ID:EFForg,项目名称:lemonhrm,代码行数:8,代码来源:orangehrmConfiguration.class.php


示例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);
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:10,代码来源:BaseFormDoctrine.class.php


示例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');
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:10,代码来源:mobile_frontendConfiguration.class.php


示例9: configure

  public function configure()
  {

    // SET DEFAULT FORM-FORMATTER
    /* sfWidgetFormSchema::setDefaultFormFormatterName('bootstrap'); */    
    sfWidgetFormSchema::setDefaultFormFormatterName('foundation');

    ProjectConfiguration::getActive()->loadHelpers( array('I18N') ); 

  }
开发者ID:romankallweit,项目名称:swingmachine,代码行数:10,代码来源:frontendConfiguration.class.php


示例10: 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');
 }
开发者ID:rbolliger,项目名称:otokou,代码行数:18,代码来源:ProjectConfiguration.class.php


示例11: setup

 /**
  * Setup the form.  To overload, you should use ->configure()
  */
 public function setup()
 {
     $widgetSchema = new sfWidgetFormSchema(array('keywords' => new sfWidgetFormInput(), 'musthave' => new sfWidgetFormInput(), 'mustnothave' => new sfWidgetFormInput(), 'hasphrase' => new sfWidgetFormInput()), array(), array(), array('keywords' => 'May contain keywords', 'musthave' => 'Must contain keywords', 'mustnothave' => 'Must exclude keywords', 'hasphrase' => 'Contains exact phrase'), array());
     $widgetSchema->addFormFormatter('sfLuceneAdvanced', new sfLuceneWidgetFormatterAdvanced($widgetSchema));
     $widgetSchema->setFormFormatterName('sfLuceneAdvanced');
     $widgetSchema->setNameFormat('form[%s]');
     $validatorSchema = new sfValidatorSchema(array('keywords' => new sfValidatorString(array('required' => false)), 'musthave' => new sfValidatorString(array('required' => false)), 'mustnothave' => new sfValidatorString(array('required' => false)), 'hasphrase' => new sfValidatorString(array('required' => false))), array(), array());
     if ($this->hasCategories()) {
         $widgetSchema['category'] = new sfWidgetFormSelect(array('choices' => $this->getCategories(), 'multiple' => false));
         $widgetSchema->setLabel('category', 'Must be in category');
         $validatorSchema['category'] = new sfValidatorChoice(array('required' => false, 'choices' => $this->getCategories()));
     }
     $this->setWidgetSchema($widgetSchema);
     $this->setValidatorSchema($validatorSchema);
 }
开发者ID:palcoprincipal,项目名称:sfLucenePlugin,代码行数:18,代码来源:sfLuceneAdvancedFormBase.class.php


示例12: __construct

 /**
  * Constructor.
  *
  * @param sfWidgetFormSchema $widget      An sfWidgetFormSchema instance
  * @param integer            $count       The number of times to duplicate the widget
  * @param array              $options     An array of options
  * @param array              $attributes  An array of default HTML attributes
  * @param array              $labels      An array of HTML labels
  *
  * @see sfWidgetFormSchema
  */
 public function __construct(sfWidgetFormSchema $widget, $count, $options = array(), $attributes = array(), $labels = array())
 {
     parent::__construct(array_fill(0, $count, $widget), $options, $attributes, $labels);
 }
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:15,代码来源:sfWidgetFormSchemaForEach.class.php


示例13: __construct

 /**
  * Constructor.
  *
  * @param sfWidgetFormSchema $widget     A sfWidgetFormSchema instance
  * @param string             $decorator  A decorator string
  *
  * @see sfWidgetFormSchema
  */
 public function __construct(sfWidgetFormSchema $widget, $decorator)
 {
     $this->widget = $widget;
     $this->decorator = $decorator;
     parent::__construct();
 }
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:14,代码来源:sfWidgetFormSchemaDecorator.class.php


示例14: configure

 public function configure()
 {
     ProjectConfiguration::getActive()->loadHelpers(array('I18N', 'OrangeDate', 'Orange', 'Url'));
     sfWidgetFormSchema::setDefaultFormFormatterName('Default');
 }
开发者ID:CamilleCrespeau,项目名称:orangehrm,代码行数:5,代码来源:orangehrmConfiguration.class.php


示例15: dirname

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(31);
// widgets
$authorSchema = new sfWidgetFormSchema(array('id' => new sfWidgetFormInputHidden(), 'name' => $nameWidget = new sfWidgetFormInputText()));
$authorSchema->setNameFormat('article[author][%s]');
$schema = new sfWidgetFormSchema(array('title' => $titleWidget = new sfWidgetFormInputText(), 'author' => $authorSchema));
$schema->setNameFormat('article[%s]');
// errors
$authorErrorSchema = new sfValidatorErrorSchema(new sfValidatorString());
$authorErrorSchema->addError(new sfValidatorError(new sfValidatorString(), 'name error'), 'name');
$articleErrorSchema = new sfValidatorErrorSchema(new sfValidatorString());
$articleErrorSchema->addError($titleError = new sfValidatorError(new sfValidatorString(), 'title error'), 'title');
$articleErrorSchema->addError($authorErrorSchema, 'author');
$parent = new sfFormFieldSchema($schema, null, 'article', array('title' => 'symfony', 'author' => array('name' => 'Fabien')), $articleErrorSchema);
$f = $parent['title'];
$child = $parent['author'];
// ->getValue() ->getWidget() ->getParent() ->getError() ->hasError()
$t->diag('->getValue() ->getName() ->getWidget() ->getParent() ->getError() ->hasError()');
$t->ok($f->getWidget() == $titleWidget, '->getWidget() returns the form field widget');
$t->is($f->getName(), 'title', '->getName() returns the form field name');
$t->is($f->getValue(), 'symfony', '->getValue() returns the form field value');
$t->is($f->getParent(), $parent, '->getParent() returns the form field parent');
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:31,代码来源:sfFormFieldTest.php


示例16: catch

try {
    $f->setTranslationCallable('foo');
    $t->fail('setTranslationCallable() does not throw InvalidException when i18n callable is invalid');
} catch (InvalidArgumentException $e) {
    $t->pass('setTranslationCallable() throws InvalidException if i18n callable is not a valid callable');
} catch (Exception $e) {
    $t->fail('setTranslationCallable() throws unexpected exception');
}
$t->diag('->translate()');
$f = new MyFormatter(new sfWidgetFormSchema());
$t->is($f->translate('label'), '[label]', 'translate() call i18n sfCallable as expected');
MyFormatter::setTranslationCallable(array('myI18n', '__'));
$t->is($f->translate('label'), '[label]', 'translate() call i18n callable as expected');
$t->diag('->generateLabel() ->generateLabelName() ->setLabel() ->setLabels()');
MyFormatter::dropTranslationCallable();
$w = new sfWidgetFormSchema(array('author_id' => new sfWidgetFormInputText(), 'first_name' => new sfWidgetFormInputText(), 'last_name' => new sfWidgetFormInputText()));
$f = new MyFormatter($w);
$t->is($f->generateLabelName('first_name'), 'First Name', '->generateLabelName() generates a label value from a label name');
$t->is($f->generateLabelName('author_id'), 'Author', '->generateLabelName() removes _id from auto-generated labels');
$w->setLabels(array('first_name' => 'The first name'));
$t->is($f->generateLabelName('first_name'), 'The first name', '->setLabels() changes all current labels');
$w->setLabel('first_name', 'A first name');
$t->is($f->generateLabelName('first_name'), 'A first name', '->setLabel() sets a label value');
$w->setLabel('first_name', false);
$t->is($f->generateLabel('first_name'), '', '->generateLabel() returns an empty string if the label is false');
$w->setLabel('first_name', 'Your First Name');
$t->is($f->generateLabel('first_name'), '<label for="first_name">Your First Name</label>', '->generateLabelName() returns a label tag');
$t->is($f->generateLabel('first_name', array('class' => 'foo')), '<label class="foo" for="first_name">Your First Name</label>', '->generateLabelName() returns a label tag with optional HTML attributes');
$t->is($f->generateLabel('first_name', array('for' => 'myid')), '<label for="myid">Your First Name</label>', '->generateLabelName() returns a label tag with specified for-id');
$w->setLabel('last_name', 'Your Last Name');
$t->is($f->generateLabel('last_name'), '<label for="last_name">Your Last Name</label>', '->generateLabelName() returns a label tag');
开发者ID:ibr,项目名称:symfony1,代码行数:31,代码来源:sfWidgetFormSchemaFormatterTest.php


示例17: array

{
    public $translateSubjects = array();
    public function __construct()
    {
    }
    public function translate($subject, $parameters = array())
    {
        $this->translateSubjects[] = $subject;
        return sprintf('translation[%s]', $subject);
    }
}
class WidgetFormStub extends sfWidget
{
    public function __construct()
    {
    }
    public function render($name, $value = null, $attributes = array(), $errors = array())
    {
        return sprintf('##%s##', __CLASS__);
    }
}
$t = new lime_test(2);
// ->render()
$t->diag('->render()');
$ws = new sfWidgetFormSchema();
$ws->addFormFormatter('stub', $formatter = new FormFormatterMock());
$ws->setFormFormatterName('stub');
$w = new sfWidgetFormDateRange(array('from_date' => new WidgetFormStub(), 'to_date' => new WidgetFormStub()));
$w->setParent($ws);
$t->is($w->render('foo'), 'translation[from ##WidgetFormStub## to ##WidgetFormStub##]', '->render() remplaces %from_date% and %to_date%');
$t->is($formatter->translateSubjects, array('from %from_date% to %to_date%'), '->render() translates the template option');
开发者ID:Phennim,项目名称:symfony1,代码行数:31,代码来源:sfWidgetFormDateRangeTest.php


示例18: catch

}
try {
    $parent['title'] = null;
    $t->fail('sfFormField implements the ArrayAccess interface but in read-only mode');
} catch (LogicException $e) {
    $t->pass('sfFormField implements the ArrayAccess interface but in read-only mode');
}
try {
    $parent['title1'];
    $t->fail('sfFormField implements the ArrayAccess interface but in read-only mode');
} catch (LogicException $e) {
    $t->pass('sfFormField implements the ArrayAccess interface but in read-only mode');
}
// implements Countable
$t->diag('implements Countable');
$widgetSchema = new sfWidgetFormSchema(array('w1' => $w1 = new sfWidgetFormInputText(), 'w2' => $w2 = new sfWidgetFormInputText()));
$f = new sfFormFieldSchema($widgetSchema, null, 'article', array());
$t->is(count($f), 2, 'sfFormFieldSchema implements the Countable interface');
// implements Iterator
$t->diag('implements Iterator');
$f = new sfFormFieldSchema($widgetSchema, null, 'article', array());
$values = array();
foreach ($f as $name => $value) {
    $values[$name] = $value;
}
$t->is(isset($values['w1']), true, 'sfFormFieldSchema implements the Iterator interface');
$t->is(isset($values['w2']), true, 'sfFormFieldSchema implements the Iterator interface');
$t->is(count($values), 2, 'sfFormFieldSchema implements the Iterator interface');
$t->diag('implements Iterator respecting the order of fields');
$widgetSchema->moveField('w2', 'first');
$f = new sfFormFieldSchema($widgetSchema, null, 'article', array());
开发者ID:sensorsix,项目名称:app,代码行数:31,代码来源:sfFormFieldSchemaTest.php


示例19: sfWidgetFormChoice

// ->render()
$t->diag('->render()');
$w = new sfWidgetFormChoice(array('choices' => array('foo' => 'bar')));
$t->like($w->render('foo'), '/<select name="foo" id="foo">/', '->render() renders a select tag by default');
$w->setIdFormat('barID_%s');
$t->like($w->render('foo'), '/<select name="foo" id="barID_foo">/', '->render() uses the id format specified');
$w->setIdFormat('%s');
$w->setOption('multiple', true);
$t->like($w->render('foo'), '/<select name="foo\\[\\]" multiple="multiple" id="foo">/', '->render() adds a multiple attribute for multiple selects');
$w->setOption('expanded', true);
$t->like($w->render('foo'), '/<ul class="checkbox_list">/', '->render() uses a checkbox list when expanded and multiple are true');
$w->setOption('multiple', false);
$t->like($w->render('foo'), '/<ul class="radio_list">/', '->render() uses a checkbox list when expanded is true and multiple is false');
// choices are translated
$t->diag('choices are translated');
$ws = new sfWidgetFormSchema();
$ws->addFormFormatter('stub', new FormFormatterStub());
$ws->setFormFormatterName('stub');
$w = new sfWidgetFormChoice(array('choices' => array('foo' => 'bar', 'foobar' => 'foo')));
$w->setParent($ws);
$dom->loadHTML($w->render('foo'));
$css = new sfDomCssSelector($dom);
$t->is($css->matchSingle('#foo option[value="foo"]')->getValue(), 'translation[bar]', '->render() translates the options');
$t->is($css->matchSingle('#foo option[value="foobar"]')->getValue(), 'translation[foo]', '->render() translates the options');
// ->getJavaScripts() ->getStylesheets()
$t->diag('->getJavaScripts() ->getStylesheets()');
$w = new sfWidgetFormChoice(array('choices' => array()));
$w->setOption('renderer_class', 'MyWidget');
$t->is($w->getJavaScripts(), array('/path/to/a/file.js'), '->getJavaScripts() returns the stylesheets of the renderer widget');
$t->is($w->getStylesheets(), array('/path/to/a/file.css' => 'all'), '->getStylesheets() returns the JavaScripts of the renderer widget');
// __clone()
开发者ID:vcgato29,项目名称:poff,代码行数:31,代码来源:sfWidgetFormChoiceTest.php


示例20: dirname

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(26, new lime_output_color());
// widgets
$authorSchema = new sfWidgetFormSchema(array('id' => new sfWidgetFormInputHidden(), 'name' => $nameWidget = new sfWidgetFormInput()));
$authorSchema->setNameFormat('article[author][%s]');
$schema = new sfWidgetFormSchema(array('title' => $titleWidget = new sfWidgetFormInput(), 'author' => $authorSchema));
$schema->setNameFormat('article[%s]');
// errors
$authorErrorSchema = new sfValidatorErrorSchema(new sfValidatorString());
$authorErrorSchema->addError(new sfValidatorError(new sfValidatorString(), 'name error'), 'name');
$articleErrorSchema = new sfValidatorErrorSchema(new sfValidatorString());
$articleErrorSchema->addError($titleError = new sfValidatorError(new sfValidatorString(), 'title error'), 'title');
$articleErrorSchema->addError($authorErrorSchema, 'author');
$parent = new sfFormFieldSchema($schema, null, 'article', array('title' => 'symfony', 'author' => array('name' => 'Fabien')), $articleErrorSchema);
$f = $parent['title'];
$child = $parent['author'];
// ->getValue() ->getWidget() ->getParent() ->getError() ->hasError()
$t->diag('->getValue() ->getName() ->getWidget() ->getParent() ->getError() ->hasError()');
$t->ok($f->getWidget() == $titleWidget, '->getWidget() returns the form field widget');
$t->is($f->getName(), 'title', '->getName() returns the form field name');
$t->is($f->getValue(), 'symfony', '->getValue() returns the form field value');
$t->is($f->getParent(), $parent, '->getParent() returns the form field parent');
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:31,代码来源:sfFormFieldTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfWidgetFormSchemaFormatter类代码示例发布时间:2022-05-23
下一篇:
PHP sfWidgetFormInput类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap