public function configure()
  {

    // SET DEFAULT FORM-FORMATTER
    sfWidgetFormSchema::setDefaultFormFormatterName('bootstrap');
    
  }
 public function setup()
 {
     $this->enablePlugins('sfPropelORMPlugin');
     $this->enablePlugins('sfGuardPlugin');
     $this->enablePlugins('sfLESSPlugin');
     sfWidgetFormSchema::setDefaultFormFormatterName('div');
 }
 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);
         }
     }
 }
 public function setup()
 {
     $this->enablePlugins('sfDoctrinePlugin');
     $this->enablePlugins('sfThumbnailPlugin');
     $this->enablePlugins('sfImageTransformPlugin');
     $this->enablePlugins('sfFormExtraPlugin');
     sfWidgetFormSchema::setDefaultFormFormatterName('list');
 }
 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');
 }
  public function configure()
  {

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

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

  }
Ejemplo n.º 7
0
 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);
 }
 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');
 }
 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');
 }
Ejemplo n.º 10
0
 /**
  * @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);
 }
 public function configure()
 {
     ProjectConfiguration::getActive()->loadHelpers(array('I18N', 'OrangeDate', 'Orange', 'Url'));
     sfWidgetFormSchema::setDefaultFormFormatterName('Default');
 }
Ejemplo n.º 12
0
$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');
 public function configure()
 {
     sfWidgetFormSchema::setDefaultFormFormatterName('TwitterBootstrap');
 }
 public function configure()
 {
     $this->with_group = false;
     $this->useFields(array('gtu_code', 'gtu_from_date', 'gtu_to_date', 'taxon_level_ref', 'litho_name', 'litho_level_ref', 'litho_level_name', 'chrono_name', 'chrono_level_ref', 'chrono_level_name', 'lithology_name', 'lithology_level_ref', 'lithology_level_name', 'mineral_name', 'mineral_level_ref', 'mineral_level_name', 'ig_num', 'acquisition_category', 'acquisition_date'));
     $this->addPagerItems();
     $this->widgetSchema['gtu_code'] = new sfWidgetFormInputText();
     $this->widgetSchema['expedition_name'] = new sfWidgetFormInputText(array(), array('class' => 'medium_size'));
     $this->widgetSchema['taxon_name'] = new sfWidgetFormInputText(array(), array('class' => 'medium_size taxon_name'));
     $this->widgetSchema['taxon_level_ref'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'CatalogueLevels', 'table_method' => array('method' => 'getLevelsByTypes', 'parameters' => array(array('table' => 'taxonomy'))), 'add_empty' => $this->getI18N()->__('All')), array('class' => 'taxon_name'));
     $rel = array('child' => 'Is a Child Of', 'direct_child' => 'Is a Direct Child', 'synonym' => 'Is a Synonym Of', 'equal' => 'Is strictly equal to');
     $this->widgetSchema['taxon_relation'] = new sfWidgetFormChoice(array('choices' => $rel, 'expanded' => true));
     $this->widgetSchema['taxon_relation']->setDefault('child');
     $this->widgetSchema['taxon_item_ref'] = new widgetFormCompleteButtonRef(array('model' => 'Taxonomy', 'method' => 'getName', 'link_url' => 'taxonomy/choose', 'box_title' => $this->getI18N()->__('Choose Taxon'), 'button_is_hidden' => true, 'complete_url' => 'catalogue/completeName?table=taxonomy&level=1', 'nullable' => true, 'field_to_clean_class' => 'taxon_name'), array('class' => 'taxon_autocomplete'));
     $this->widgetSchema['taxon_child_syn_included'] = new WidgetFormInputCheckboxDarwin();
     $this->widgetSchema['taxon_child_syn_included']->setOption('label', 'Syn. included ?');
     $this->validatorSchema['taxon_item_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['taxon_relation'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($rel)));
     $this->validatorSchema['taxon_child_syn_included'] = new sfValidatorBoolean();
     $this->widgetSchema['lithology_relation'] = new sfWidgetFormChoice(array('choices' => $rel, 'expanded' => true));
     $this->widgetSchema['lithology_relation']->setDefault('child');
     $this->widgetSchema['lithology_item_ref'] = new widgetFormCompleteButtonRef(array('model' => 'Lithology', 'link_url' => 'lithology/choose', 'method' => 'getName', 'box_title' => $this->getI18N()->__('Choose Lithologic unit'), 'button_is_hidden' => true, 'complete_url' => 'catalogue/completeName?table=lithology', 'nullable' => true, 'field_to_clean_class' => 'lithology_name'), array('class' => 'lithology_autocomplete'));
     $this->widgetSchema['lithology_child_syn_included'] = new WidgetFormInputCheckboxDarwin();
     $this->widgetSchema['lithology_child_syn_included']->setOption('label', 'Syn. included ?');
     $this->validatorSchema['lithology_item_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['lithology_relation'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($rel)));
     $this->validatorSchema['lithology_child_syn_included'] = new sfValidatorBoolean();
     $this->widgetSchema['lithology_name'] = new sfWidgetFormInputText(array(), array('class' => 'medium_size lithology_name'));
     $this->widgetSchema['lithology_level_ref'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'CatalogueLevels', 'table_method' => array('method' => 'getLevelsByTypes', 'parameters' => array(array('table' => 'lithology'))), 'add_empty' => $this->getI18N()->__('All')), array('class' => 'lithology_name'));
     $this->widgetSchema['litho_name'] = new sfWidgetFormInputText(array(), array('class' => 'medium_size litho_name'));
     $this->widgetSchema['litho_level_ref'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'CatalogueLevels', 'table_method' => array('method' => 'getLevelsByTypes', 'parameters' => array(array('table' => 'lithostratigraphy'))), 'add_empty' => $this->getI18N()->__('All')), array('class' => 'litho_name'));
     $this->widgetSchema['litho_relation'] = new sfWidgetFormChoice(array('choices' => $rel, 'expanded' => true));
     $this->widgetSchema['litho_relation']->setDefault('child');
     $this->widgetSchema['litho_item_ref'] = new widgetFormCompleteButtonRef(array('model' => 'Lithostratigraphy', 'link_url' => 'lithostratigraphy/choose', 'method' => 'getName', 'box_title' => $this->getI18N()->__('Choose Lithostratigraphic unit'), 'button_is_hidden' => true, 'complete_url' => 'catalogue/completeName?table=lithostratigraphy', 'nullable' => true, 'field_to_clean_class' => 'litho_name'), array('class' => 'litho_autocomplete'));
     $this->widgetSchema['litho_child_syn_included'] = new WidgetFormInputCheckboxDarwin();
     $this->widgetSchema['litho_child_syn_included']->setOption('label', 'Syn. included ?');
     $this->validatorSchema['litho_item_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['litho_relation'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($rel)));
     $this->validatorSchema['litho_child_syn_included'] = new sfValidatorBoolean();
     $this->widgetSchema['chrono_name'] = new sfWidgetFormInputText(array(), array('class' => 'medium_size chrono_name'));
     $this->widgetSchema['chrono_level_ref'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'CatalogueLevels', 'table_method' => array('method' => 'getLevelsByTypes', 'parameters' => array(array('table' => 'chronostratigraphy'))), 'add_empty' => $this->getI18N()->__('All')), array('class' => 'chrono_name'));
     $this->widgetSchema['chrono_relation'] = new sfWidgetFormChoice(array('choices' => $rel, 'expanded' => true));
     $this->widgetSchema['chrono_relation']->setDefault('child');
     $this->widgetSchema['chrono_item_ref'] = new widgetFormCompleteButtonRef(array('model' => 'Chronostratigraphy', 'link_url' => 'chronostratigraphy/choose', 'method' => 'getName', 'box_title' => $this->getI18N()->__('Choose Chronostratigraphic unit'), 'nullable' => true, 'button_is_hidden' => true, 'complete_url' => 'catalogue/completeName?table=chronostratigraphy', 'button_class' => '', 'field_to_clean_class' => 'chrono_name'), array('class' => 'chrono_autocomplete'));
     $this->widgetSchema['chrono_child_syn_included'] = new WidgetFormInputCheckboxDarwin();
     $this->widgetSchema['chrono_child_syn_included']->setOption('label', 'Syn. included ?');
     $this->validatorSchema['chrono_item_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['chrono_relation'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($rel)));
     $this->validatorSchema['chrono_child_syn_included'] = new sfValidatorBoolean();
     $this->widgetSchema['mineral_name'] = new sfWidgetFormInputText(array(), array('class' => 'medium_size mineral_name'));
     $this->widgetSchema['mineral_level_ref'] = new sfWidgetFormDarwinDoctrineChoice(array('model' => 'CatalogueLevels', 'table_method' => array('method' => 'getLevelsByTypes', 'parameters' => array(array('table' => 'mineralogy'))), 'add_empty' => $this->getI18N()->__('All')), array('class' => 'mineral_name'));
     $this->widgetSchema['mineral_item_ref'] = new widgetFormCompleteButtonRef(array('model' => 'Mineralogy', 'link_url' => 'mineralogy/choose', 'method' => 'getName', 'box_title' => $this->getI18N()->__('Choose Mineralogic unit'), 'nullable' => true, 'button_is_hidden' => true, 'complete_url' => 'catalogue/completeName?table=mineralogy', 'button_class' => '', 'field_to_clean_class' => 'mineral_name'), array('class' => 'mineral_autocomplete'));
     $this->widgetSchema['mineral_child_syn_included'] = new WidgetFormInputCheckboxDarwin();
     $this->widgetSchema['mineral_child_syn_included']->setOption('label', 'Syn. included ?');
     $this->widgetSchema['mineral_relation'] = new sfWidgetFormChoice(array('choices' => $rel, 'expanded' => true));
     $this->widgetSchema['mineral_relation']->setDefault('child');
     $this->validatorSchema['mineral_item_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['mineral_relation'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($rel)));
     $this->validatorSchema['mineral_child_syn_included'] = new sfValidatorBoolean();
     $minDate = new FuzzyDateTime(strval(min(range(intval(sfConfig::get('dw_yearRangeMin')), intval(sfConfig::get('dw_yearRangeMax')))) . '/01/01'));
     $maxDate = new FuzzyDateTime(strval(max(range(intval(sfConfig::get('dw_yearRangeMin')), intval(sfConfig::get('dw_yearRangeMax')))) . '/12/31'));
     $maxDate->setStart(false);
     $dateLowerBound = new FuzzyDateTime(sfConfig::get('dw_dateLowerBound'));
     $dateUpperBound = new FuzzyDateTime(sfConfig::get('dw_dateUpperBound'));
     $this->widgetSchema['ig_num'] = new sfWidgetFormInputText();
     $this->widgetSchema['ig_from_date'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'from_date'));
     $this->widgetSchema['ig_to_date'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'to_date'));
     $this->widgetSchema['ig_num']->setAttributes(array('class' => 'small_size'));
     $this->validatorSchema['ig_num'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['ig_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['ig_to_date'] = new fuzzyDateValidator(array('required' => false, 'from_date' => false, 'min' => $minDate, 'max' => $maxDate, 'empty_value' => $dateUpperBound), array('invalid' => 'Date provided is not valid'));
     $this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare('ig_from_date', '<=', 'ig_to_date', array('throw_global_error' => true), array('invalid' => 'The "begin" date cannot be above the "end" date.')));
     $this->widgetSchema['col_fields'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['collection_ref'] = new sfWidgetCollectionList(array('choices' => array()));
     $this->widgetSchema['collection_ref']->addOption('public_only', false);
     $this->validatorSchema['collection_ref'] = new sfValidatorPass();
     //Avoid duplicate the query
     $this->widgetSchema['spec_ids'] = new sfWidgetFormTextarea(array('label' => "#ID list separated by ',' "));
     $this->validatorSchema['spec_ids'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['col_fields'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['gtu_code'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['expedition_name'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['taxon_name'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['taxon_level_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['chrono_name'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['chrono_level_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['litho_name'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['litho_level_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['lithology_name'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['lithology_level_ref'] = new sfValidatorInteger(array('required' => false));
     $this->validatorSchema['mineral_name'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['mineral_level_ref'] = new sfValidatorInteger(array('required' => false));
     $minDate = new FuzzyDateTime(strval(min(range(intval(sfConfig::get('dw_yearRangeMin')), intval(sfConfig::get('dw_yearRangeMax')))) . '/01/01'));
     $maxDate = new FuzzyDateTime(strval(max(range(intval(sfConfig::get('dw_yearRangeMin')), intval(sfConfig::get('dw_yearRangeMax')))) . '/12/31'));
     $maxDate->setStart(false);
     $dateLowerBound = new FuzzyDateTime(sfConfig::get('dw_dateLowerBound'));
     $dateUpperBound = new FuzzyDateTime(sfConfig::get('dw_dateUpperBound'));
     $this->widgetSchema['tags'] = new sfWidgetFormInputText();
     $this->widgetSchema['gtu_from_date'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'from_date'));
     $this->widgetSchema['gtu_to_date'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'to_date'));
     $this->validatorSchema['tags'] = new sfValidatorString(array('required' => false, 'trim' => true));
     $this->validatorSchema['gtu_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['gtu_to_date'] = new fuzzyDateValidator(array('required' => false, 'from_date' => false, 'min' => $minDate, 'max' => $maxDate, 'empty_value' => $dateUpperBound), array('invalid' => 'Date provided is not valid'));
     $subForm = new sfForm();
     $this->embedForm('Tags', $subForm);
     $this->widgetSchema['tools'] = new widgetFormSelectDoubleListFilterable(array('choices' => new sfCallable(array(Doctrine::getTable('CollectingTools'), 'fetchTools')), 'label_associated' => $this->getI18N()->__('Selected'), 'label_unassociated' => $this->getI18N()->__('Available')));
     $this->widgetSchema['methods'] = new widgetFormSelectDoubleListFilterable(array('choices' => new sfCallable(array(Doctrine::getTable('CollectingMethods'), 'fetchMethods')), 'label_associated' => $this->getI18N()->__('Selected'), 'label_unassociated' => $this->getI18N()->__('Available')));
     $this->validatorSchema['methods'] = new sfValidatorPass();
     $this->validatorSchema['tools'] = new sfValidatorPass();
     $this->widgetSchema['with_multimedia'] = new sfWidgetFormInputCheckbox();
     $this->validatorSchema['with_multimedia'] = new sfValidatorPass();
     //people widget
     $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();
 }
 public function initialize()
 {
     parent::initialize();
     sfWidgetFormSchema::setDefaultFormFormatterName('pc');
 }
 /**
  * Config
  */
 public function configure()
 {
     sfWidgetFormSchema::setDefaultFormFormatterName('myList');
 }
Ejemplo n.º 17
0
 public function setup()
 {
     sfWidgetFormSchema::setDefaultFormFormatterName('div');
 }
 public function configure()
 {
     sfWidgetFormSchema::setDefaultFormFormatterName('list');
     $this->widgetSchema->setNameFormat('mass_action[%s]');
     $this->widgetSchema['field_action'] = new sfWidgetFormSelectCheckbox(array('choices' => self::getPossibleActions(), 'template' => '<div class="group_%group% fld_group"><label>%group%</label> %options%</div>'));
     $this->validatorSchema['field_action'] = new sfValidatorPass();
     $this->widgetSchema['item_list'] = new sfWidgetFormChoice(array('choices' => array()));
     $this->validatorSchema['item_list'] = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'Specimens', 'min' => 0));
     $subForm = new sfForm();
     $this->embedForm('MassActionForm', $subForm);
 }
 public function setup()
 {
     $this->enablePlugins(array('sfDoctrinePlugin', 'sfDoctrineGuardPlugin'));
     sfWidgetFormSchema::setDefaultFormFormatterName('div');
 }