本文整理汇总了PHP中sfWidgetFormSchema类的典型用法代码示例。如果您正苦于以下问题:PHP sfWidgetFormSchema类的具体用法?PHP sfWidgetFormSchema怎么用?PHP sfWidgetFormSchema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfWidgetFormSchema类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: setup
public function setup()
{
$this->enablePlugins('sfPropelORMPlugin');
$this->enablePlugins('sfGuardPlugin');
$this->enablePlugins('sfLESSPlugin');
sfWidgetFormSchema::setDefaultFormFormatterName('div');
}
示例3: configure
public function configure()
{
// SET DEFAULT FORM-FORMATTER
sfWidgetFormSchema::setDefaultFormFormatterName('bootstrap');
}
示例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);
}
}
}
示例5: setup
public function setup()
{
$this->enablePlugins('sfDoctrinePlugin');
$this->enablePlugins('sfThumbnailPlugin');
$this->enablePlugins('sfImageTransformPlugin');
$this->enablePlugins('sfFormExtraPlugin');
sfWidgetFormSchema::setDefaultFormFormatterName('list');
}
示例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');
}
示例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: configure
public function configure()
{
// SET DEFAULT FORM-FORMATTER
/* sfWidgetFormSchema::setDefaultFormFormatterName('bootstrap'); */
sfWidgetFormSchema::setDefaultFormFormatterName('foundation');
ProjectConfiguration::getActive()->loadHelpers( array('I18N') );
}
示例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');
}
示例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);
}
示例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);
}
示例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();
}
示例14: configure
public function configure()
{
ProjectConfiguration::getActive()->loadHelpers(array('I18N', 'OrangeDate', 'Orange', 'Url'));
sfWidgetFormSchema::setDefaultFormFormatterName('Default');
}
示例15: dirname
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* 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');