public function execute($request)
 {
     parent::execute($request);
     $this->dc = new sfDcPlugin($this->resource);
     if (1 > strlen($title = $this->resource)) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->identifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is a mandatory element.', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-identifier">', '%2%' => '</a>'))));
         $values['identifier'] = $this->resource->identifier;
         $validatorSchema->title = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Title%2% - This is a mandatory element.', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-title">', '%2%' => '</a>'))));
         $values['title'] = $this->resource->getTitle(array('cultureFallback' => true));
         $validatorSchema->repository = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Relation%2% (%3%isLocatedAt%4%) - This is a mandatory element for this resource or one its higher descriptive levels (if part of a collection hierarchy).', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-relation">', '%2%' => '</a>', '%3%' => '<a href="http://dublincore.org/groups/collections/collection-application-profile/#colcldisLocatedAt">', '%4%' => '</a>'))));
         foreach ($this->resource->ancestors->andSelf() as $item) {
             $values['repository'] = $item->repository;
             if (isset($values['repository'])) {
                 break;
             }
         }
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
 public function execute($request)
 {
     $this->resource = $this->getRoute()->resource;
     // Check user authorization
     if (!QubitAcl::check($this->resource, 'read')) {
         QubitAcl::forwardToSecureAction();
     }
     if (1 > strlen($title = $this->resource->__toString())) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->date = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Acquisition date - This is a mandatory element.')));
         $values['date'] = $this->resource->date;
         $validatorSchema->sourceOfAcquisition = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Source of acquisition - This is a mandatory element.')));
         $values['sourceOfAcquisition'] = $this->resource->getSourceOfAcquisition(array('culltureFallback' => true));
         $validatorSchema->locationInformation = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Location information - This is a mandatory element.')));
         $values['locationInformation'] = $this->resource->getLocationInformation(array('culltureFallback' => true));
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
 public function execute($request)
 {
     $this->resource = $this->getRoute()->resource;
     if (!$this->resource instanceof QubitTerm) {
         $this->forward404();
     }
     // Check that this isn't the root
     if (!isset($this->resource->parent)) {
         $this->forward404();
     }
     if (1 > strlen($title = $this->resource->__toString())) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->name = new sfValidatorCallback(array('callback' => array($this, 'checkForRepeatedNames')));
         $values['name'] = $this->resource->getName(array('cultureFallback' => true));
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
     QubitTreeView::addAssets($this->response);
 }
 public function execute($request)
 {
     parent::execute($request);
     $this->isdiah = new sfEhriIsdiahPlugin($this->resource);
     if (1 > strlen($title = $this->resource)) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $valuess = array();
         $validatorSchema->authorizedFormOfName = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Authorized form of name%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.1.2">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))));
         $values['authorizedFormOfName'] = $this->resource->getAuthorizedFormOfName(array('culltureFallback' => true));
         $validatorSchema->identifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.1.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))));
         $values['identifier'] = $this->resource->identifier;
         $validatorSchema->primaryContact = new sfValidatorAnd(array(new QubitValidatorCountable(), new sfValidatorOr(array(new sfValidatorSchema(array('city' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('countryCode' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('postalCode' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('region' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('streetAddress' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true))), array('required' => true), array('invalid' => $this->context->i18n->__('%1%Contact information%2% - You %3%must%4% at least include one of the following location or address fields: city, country, postal code, region or street address.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.2.1">', '%2%' => '</a>', '%3%' => '<a href="<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))))), array('required' => true), array('required' => $this->context->i18n->__('%1%Contact information%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.2.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))));
         if (null !== $this->resource->getPrimaryContact()) {
             $values['primaryContact']['city'] = $this->resource->getPrimaryContact()->getCity(array('culltureFallback' => true));
             $values['primaryContact']['countryCode'] = $this->resource->getPrimaryContact()->countryCode;
             $values['primaryContact']['postalCode'] = $this->resource->getPrimaryContact()->postalCode;
             $values['primaryContact']['region'] = $this->resource->getPrimaryContact()->getRegion(array('culltureFallback' => true));
             $values['primaryContact']['streetAddress'] = $this->resource->getPrimaryContact()->streetAddress;
         }
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
示例#5
0
 public function configure()
 {
     $user = $this->getOption('user');
     $this->widgetSchema['sf_guard_user_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['language'] = new sfWidgetFormI18nChoiceLanguage(array('culture' => $user->getLanguage(), 'languages' => CultureTools::getAvailableLanguages()));
     $this->widgetSchema['country'] = new sfWidgetFormI18nChoiceCountry(array('add_empty' => true, 'culture' => $user->getLanguage(), 'countries' => CultureTools::getCountriesForLanguage($this->getOption('language'))));
     $this->widgetSchema['search_filter'] = new sfWidgetFormSelect(array('choices' => InvoiceSearchForm::getQuickDates()));
     $this->widgetSchema['series'] = new sfWidgetFormSelect(array('choices' => SeriesTable::getChoicesForSelect()));
     $this->widgetSchema['old_password'] = new sfWidgetFormInputPassword();
     $this->widgetSchema['new_password'] = new sfWidgetFormInputPassword();
     $this->widgetSchema['new_password2'] = new sfWidgetFormInputPassword();
     $this->validatorSchema['sf_guard_user_id'] = new sfValidatorAnd(array(new sfValidatorDoctrineChoice(array('model' => 'sfGuardUser', 'required' => true), array('invalid' => "The user does not exist!")), new CompareValueValidator(array('value' => $user->getGuardUser()->getId()))));
     $this->validatorSchema['language'] = new sfValidatorI18nChoiceLanguage(array('required' => true));
     $this->validatorSchema['country'] = new sfValidatorI18nChoiceCountry(array('required' => false));
     $this->validatorSchema['series'] = new sfValidatorDoctrineChoice(array('model' => 'Series'), array('required' => 'The default invoicing series is mandatory'));
     $this->validatorSchema['search_filter'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys(InvoiceSearchForm::getQuickDates())));
     $this->validatorSchema['email'] = new sfValidatorEmail(array('max_length' => 100, 'required' => true));
     $this->validatorSchema['old_password'] = new sfValidatorPass();
     $vdPassword = new sfValidatorCallback(array('callback' => array($this, 'checkPassword')), array('invalid' => 'Wrong password', 'required' => 'Old password required'));
     $passwd_min_length = sfConfig::get('app_password_min_length', 4);
     $this->validatorSchema['new_password'] = new sfValidatorPass();
     $vdNewPassword = new sfValidatorString(array('min_length' => 1, 'required' => false), array('min_length' => 'Password length must be ' . "greater than {$passwd_min_length}"));
     $this->validatorSchema['new_password2'] = new sfValidatorPass();
     $vd = new sfValidatorSchema(array('old_password' => $vdPassword, 'new_password' => $vdNewPassword, 'new_password2' => new sfValidatorPass()));
     $vd->setPostValidator(new sfValidatorSchemaCompare('new_password', '==', 'new_password2', array(), array('invalid' => "Passwords don't match")));
     $this->validatorSchema->setPostValidator(new SiwappConditionalValidator(array('control_field' => 'new_password', 'validator_schema' => $vd, 'callback' => array('Tools', 'checkLength'))));
     $this->widgetSchema->setLabels(array('nb_display_results' => 'Results to display in listings', 'language' => 'Interface language', 'series' => 'Default invoicing series', 'old_password' => 'Old password', 'new_password' => 'New password', 'new_password2' => 'New password (confirmation)', 'first_name' => 'First Name', 'last_name' => 'Last Name'));
     $this->setDefaults(array('nb_display_results' => 10, 'language' => $user->getLanguage(), 'country' => $user->getCountry()));
     $this->widgetSchema->setNameFormat('config[%s]');
 }
 public function execute($request)
 {
     parent::execute($request);
     $this->isaar = new sfIsaarPlugin($this->resource);
     if (1 > strlen($title = $this->resource->__toString())) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->authorizedFormOfName = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Authorized form of name%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.1.2">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
         $values['authorizedFormOfName'] = $this->resource->getAuthorizedFormOfName(array('cultureFallback' => true));
         $validatorSchema->datesOfExistence = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Dates of existence%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.2.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
         $values['datesOfExistence'] = $this->resource->getDatesOfExistence(array('cultureFallback' => true));
         $validatorSchema->descriptionIdentifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Description identifier%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.4.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
         $values['descriptionIdentifier'] = $this->resource->descriptionIdentifier;
         $validatorSchema->entityType = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Type of entity%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.1.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
         $values['entityType'] = $this->resource->entityType;
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
 /**
  * Constructor.
  *
  * Available options:
  *
  *  * challange_field:    The challange field name
  *  * response_field:     The response field name
  *  * throw_global_error: Whether to throw a global error (false by default) or an error tied to the response field
  *
  * @param string $challengeField The challange field name
  * @param string $responseField The response field name
  * @param array  $options An array of options
  * @param array  $messages An array of error messages
  *
  * @see sfValidatorBase
  */
 public function __construct($challengeField, $responseField, $options = array(), $messages = array())
 {
     $this->addOption('challenge_field', $challengeField);
     $this->addOption('response_field', $responseField);
     $this->addOption('throw_global_error', false);
     parent::__construct(null, $options, $messages);
 }
 /**
  * Constructor.
  *
  * Available options:
  *
  *  * left_field:         The left field name
  *  * right_field:        The right field name
  *  * throw_global_error: Whether to throw a global error (false by default) or an error tied to the left field
  *
  * @param string $leftField   The left field name
  * @param string $rightField  The right field name
  * @param array  $options     An array of options
  * @param array  $messages    An array of error messages
  *
  * @see sfValidatorBase
  */
 public function __construct($leftField, $rightField, $options = array(), $messages = array())
 {
     $this->addOption('left_field', $leftField);
     $this->addOption('right_field', $rightField);
     $this->addOption('throw_global_error', false);
     parent::__construct(null, $options, $messages);
 }
 protected function configure($options = array(), $messages = array())
 {
     $this->addOption('tag_field', 'stabletag');
     $this->addOption('url_field', 'url');
     $this->addMessage('not_found', 'Git Tag "%value%" not found in repository tags.');
     parent::configure($options, $messages);
 }
 public function __construct($loginField, $passwordField, $options = array(), $messages = array())
 {
     $this->addOption('login_field', $loginField);
     $this->addOption('password_field', $passwordField);
     $this->addOption('throw_global_error', true);
     parent::__construct(null, $options, $messages);
 }
 public function configure($options = array(), $messages = array())
 {
     parent::configure($options, $messages);
     $this->addOption('primary_key', null);
     $this->addRequiredOption('id', null);
     $this->setMessage('invalid', 'This email is already in use by some one else');
     $this->addMessage('actuall', 'This email is already used by you');
 }
 /**
  * Constructor.
  *
  * Available options:
  *
  *  * private_key:        Your reCAPTCHA private key (app_recaptcha_private_key by default)
  *  * throw_global_error: Whether to throw a global error (false by default) or an error tied to the response field
  *
  * @param sfForm $form The form to validate 
  * @param string $captchaField The name of the sfWidgetFormReCaptcha
  * @param array  $options An array of options
  * @param array  $messages An array of error messages
  *
  * @see sfValidatorBase
  */
 public function __construct($form, $captchaField, $options = array(), $messages = array())
 {
     $this->addOption('form', $form);
     $this->addOption('captcha_field', $captchaField);
     $this->addOption('private_key', sfConfig::get('app_recaptcha_private_key'));
     $this->addOption('throw_global_error', false);
     parent::__construct(null, $options, $messages);
 }
 public function __construct($options = array(), $messages = array())
 {
     parent::__construct(null, $options, $messages);
     $this->addOption('members_count_field', 'members_count');
     $this->addOption('guests_count_field', 'guests_count');
     $this->addMessage('people_missing', 'Insufficient people count: you have %people_count% people, at least %needed_count% needed.');
     $this->addMessage('too_much_people', 'Too much people: you have %people_count% people, at most %granted_count% granted.');
 }
 public function __construct($options = array(), $messages = array())
 {
     $this->addMessage('invalid_max', 'You may not book for more than %maximum_duration% consecutive minutes.');
     $this->addMessage('invalid_min', 'Minimum duration for a reservation is %minimum_duration% minutes.');
     $this->addMessage('invalid_step', 'You may only book by periods of %step% minutes.');
     $this->addMessage('no_duration', 'No duration found. Please contact your administrator !');
     parent::__construct(null, $options, $messages);
 }
示例#15
0
 protected function doClean($values)
 {
     if (!call_user_func($this->getOption('callable'), $values[$this->getOption('conditional_field')])) {
         return $values;
     }
     // get the validators and turn them into an sfValidatorSchema for easy processing
     $validators = $this->getOption('conditional_validators');
     if (is_array($validators)) {
         $validators = new sfValidatorSchema($validators);
     } elseif (!$validators instanceof sfValidatorSchema) {
         throw new sfException('Options conditional_validators must be an array or an instance of sfValidatorSchema.');
     }
     // have the validator schema simply ignore the extra fields
     $validators->setOption('allow_extra_fields', true);
     $validators->setOption('filter_extra_fields', false);
     return $validators->clean($values);
 }
 protected function configure($options = array(), $messages = array())
 {
     $this->addOption('username_field', 'username');
     $this->addOption('url_field', 'url');
     $this->addMessage('not_found', 'You must provide your username in the "author" field of your package.yml');
     $this->addMessage('no_match', 'The "author:" field in package.yml does not match your username "%actual%"');
     parent::configure($options, $messages);
 }
 public function __construct($options = array(), $messages = array())
 {
     $this->addMessage('no_delay', 'No delay found ! Please contact an administrator.');
     $this->addMessage('no_subscription', 'No valid subscription found at this date ! Please contact an administrator.');
     $this->addMessage('minimum_delay', 'You cannot book that soon. Minimum delay: %minimum_delay% minute(s).');
     $this->addMessage('maximum_delay', 'You cannot book that far in the future. Maximum delay: %maximum_delay% day(s).');
     parent::__construct(null, $options, $messages);
 }
 /**
  * Constructor.
  *
  * @param sfValidatorBase $validator  Initial validator
  * @param integer         $count      The number of times to replicate the validator
  * @param array           $options    An array of options
  * @param array           $messages   An array of error messages
  *
  * @see sfValidatorBase
  */
 public function __construct(sfValidatorBase $validator, $count, $options = array(), $messages = array())
 {
     $fields = array();
     for ($i = 0; $i < $count; $i++) {
         $fields[$i] = clone $validator;
     }
     parent::__construct($fields, $options, $messages);
 }
 protected function configure($options = array(), $messages = array())
 {
     $this->addOption('dependencies_field', 'requires');
     $this->addMessage('no_package', 'A dependency is missing a "package:" attribute.');
     $this->addMessage('missing_tag', 'Please provide the version parameter for the forge plugin "%value%" with the release tag your plugin is known to work with.');
     $this->addMessage('plugin_not_found', 'The package http://mootools.net/plugins/p/<strong>"%value%"</strong> does not exist.');
     $this->addMessage('tag_not_found', 'The plugin "%plugin%" doesn\'t have a release called "%value%"');
     parent::configure($options, $messages);
 }
 public function __construct($fields = null, $options = array(), $messages = array())
 {
     if (!isset($options['ei_dataset_structure'])) {
         throw new Exception('ei_dataset_structure doit être passé en option au validateur');
     }
     $this->str = $options['ei_dataset_structure'];
     $this->isNew = $options['is_new'];
     unset($options['ei_dataset_structure']);
     unset($options['is_new']);
     parent::__construct($fields, $options, $messages);
 }
 /**
  * Constructor.
  *
  * Available options:
  *
  *  * num_required:         minimum amount of fields that must pass validation (default is 1)
  *  * field_labels:         field labels passed to the global_invalid message
  *
  * Available messages:
  *
  *  * global_invalid:       Global error thrown for the form
  *
  * @param string $fields      Array of fields to choose from.  These values are also passed to the global_invalid message
  * @param array  $options     An array of options
  * @param array  $messages    An array of error messages
  *
  * @see sfValidatorBase
  */
 public function __construct(array $fields, $options = array(), $messages = array())
 {
     $this->addOption('min_required', 1);
     $this->addOption('max_required', null);
     $this->addOption('fields', $fields);
     $this->addOption('labels', array());
     $this->addOption('throw_global_error', true);
     $this->addMessage('min_invalid', 'You must fill out at least %num_required% of these fields');
     $this->addMessage('max_invalid', 'You filled out too many fields. Only %num_required% allowed');
     $this->addMessage('global_invalid', 'You filled out %num_valid% of %num_required% required fields below');
     parent::__construct(null, $options, $messages);
 }
 public function preClean($values)
 {
     $method = isset($values['method']) && in_array($values['method'], $this->paymentMethods, true) ? $values['method'] : reset($this->paymentMethods);
     // make sure to ignore fields of methods which were not selected
     $passValidator = new sfValidatorCallback(array('callback' => array($this, 'validatorPass')));
     foreach ($this->paymentMethods as $pMethod) {
         if ($pMethod === $method) {
             continue;
         }
         $this->fields['method_' . $pMethod] = $passValidator;
     }
     parent::preClean($values);
 }
 public function execute($request)
 {
     $this->resource = $this->getRoute()->resource;
     // Check user authorization
     if (!QubitAcl::check($this->resource, 'read')) {
         QubitAcl::forwardUnauthorized();
     }
     if (1 > strlen($title = $this->resource->__toString())) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->authorizedFormOfName = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Authorized form of name - This is a mandatory element.')));
         $values['authorizedFormOfName'] = $this->resource->getAuthorizedFormOfName(array('cultureFallback' => true));
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
 /**
  * Initialize this validator.
  *
  * @param sfContext $context    The current application context.
  * @param array     $parameters An associative array of initialization parameters.
  *
  * @return bool true, if initialization completes successfully, otherwise false.
  */
 public function initialize($context, $parameters = null)
 {
     // initialize parent
     parent::initialize($context);
     $this->getParameterHolder()->add($parameters);
     // check parameters
     if (!$this->getParameter('column1')) {
         throw new sfValidatorException('The "column1" parameter is mandatory for the sfPropelUniqueRelationValidator validator.');
     }
     if (!$this->getParameter('column2')) {
         throw new sfValidatorException('The "column2" parameter is mandatory for the sfPropelUniqueRelationValidator validator.');
     }
     return true;
 }
 public function execute($request)
 {
     parent::execute($request);
     $this->isdf = new sfIsdfPlugin($this->resource);
     if (1 > strlen($title = $this->resource)) {
         $title = $this->context->i18n->__('Untitled');
     }
     $this->response->setTitle("{$title} - {$this->response->getTitle()}");
     if (QubitAcl::check($this->resource, 'update')) {
         $validatorSchema = new sfValidatorSchema();
         $values = array();
         $validatorSchema->type = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Type%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-4#Type_of_description">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-4#Structure_and_use_4.7">', '%4%' => '</a>'))));
         $values['type'] = $this->resource->type;
         $validatorSchema->authorizedFormOfName = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Authorized form of name%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-4#Authorised_name">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-4#Structure_and_use_4.7">', '%4%' => '</a>'))));
         $values['authorizedFormOfName'] = $this->resource->getAuthorizedFormOfName(array('cultureFallback' => true));
         $validatorSchema->descriptionIdentifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Description identifier%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-4#Function.2Factivity_description_identifier">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-4#Structure_and_use_4.7">', '%4%' => '</a>'))));
         $values['descriptionIdentifier'] = $this->resource->descriptionIdentifier;
         try {
             $validatorSchema->clean($values);
         } catch (sfValidatorErrorSchema $e) {
             $this->errorSchema = $e;
         }
     }
 }
 /**
  * Public constructor
  *
  * @param  string  $dateStartField  The name of the start date field
  * @param  string  $dateEndField    The name of the end date field
  * @param  array   $options         Options array
  * @param  array   $messages        Error messages array
  */
 public function __construct($dateStartField, $dateEndField, $options = array(), $messages = array())
 {
     // Validator options
     $this->addOption('date_start_field', $dateStartField);
     $this->addOption('date_end_field', $dateEndField);
     $this->addOption('min_duration', null);
     $this->addOption('max_duration', null);
     $this->addOption('disallow_future_dates', false);
     $this->addOption('disallow_past_dates', false);
     $this->addOption('throw_global_error', false);
     // Validation error messages
     $this->addMessage('future_date', 'The date cannot be in the future');
     $this->addMessage('past_date', 'The date cannot be in the past');
     $this->addMessage('too_short', 'The time interval between the two dates is too shortl');
     $this->addMessage('too_long', 'The time interval between the two dates is too long');
     $this->addMessage('start_not_prior', 'The start date must be prior to the end date');
     // Parent constructor call
     parent::__construct(null, $options, $messages);
 }
 public function __construct(\Doctrine\ORM\EntityManager $em, $options = array(), $messages = array())
 {
     $this->em = $em;
     parent::__construct(null, $options, $messages);
 }
示例#28
0
 /**
  * Constructor.
  *
  * @param array  $options   An array of options
  * @param array  $messages  An array of error messages
  *
  * @see sfValidatorSchema
  */
 public function __construct($options = array(), $messages = array())
 {
     $this->addRequiredOption('fields');
     $this->addOption('throw_global_error', false);
     parent::__construct(null, $options, $messages);
 }
 public function __construct($options = array(), $messages = array())
 {
     $this->addMessage('invalid', 'You cannot book in the past !');
     parent::__construct(null, $options, $messages);
 }
 public function __construct($options = array(), $messages = array())
 {
     $this->addMessage('missing_count', 'Count cannot be null with the selected repetition type.');
     $this->addMessage('missing_until_date', 'Until date cannot be null with the selected repetition type.');
     parent::__construct(null, $options, $messages);
 }