public function render(ddUploadify $up)
 {
     $widget_id = $this->getSlug() . '-input';
     $form = new BaseForm();
     $csrf_token = $form->getCSRFToken();
     $output = '<div class="container dd-img-upload-wrapper">';
     $output .= '<div id="fileQueue"></div>';
     $output .= '<input type="file" name="' . $up->getSlug() . '" id="' . $widget_id . '" />';
     $output .= '<p><a href="javascript:jQuery(\'#' . $widget_id . '\').uploadifyClearQueue()">Cancel All Uploads</a></p>';
     $output .= '<div class="swfupload-buttontarget">
     <noscript>
       We\'re sorry.  SWFUpload could not load.  You must have JavaScript enabled to enjoy SWFUpload.
     </noscript>
   </div>';
     $output .= '<script type="text/javascript">
     //<![CDATA[
     $(document).ready(function() {
       $(\'#' . $widget_id . ' \').uploadify({
         \'scriptData\': {\' ' . array_key($up->getSession()) . ' \': \' ' . array_value($up->getSession()) . ' \', \'_csrf_token\': \' ' . $csrf_token . ' \'},
         \'uploader\': \' ' . $up->getUploader() . ' \',
         \'cancelImg\': \'cancel.png\',
         \'auto\'      : true,
         \'script\': $(\'#' . $widget_id . '\').closest(\'form\').attr(\'action\')+\'/upload\',
         \'folder\': \'\',
         \'multi\': false,
         \'displayData\': \'speed \',
         \'fileDataName\': \' ' . $widget_id . ' \',
         \'simUploadLimit\': 2
       });
     });
     //]]>
   </script>';
     printf($output);
 }
Example #2
0
 public function bind(array $taintedValues = null, array $taintedFiles = null)
 {
     $new_occurrences = new BaseForm();
     if (isset($taintedValues["EiBlockParams"])) {
         try {
             $formParams = $this->getEmbeddedForm("EiBlockParams");
         } catch (InvalidArgumentException $exc) {
             $formParams = null;
         }
     }
     if (isset($taintedValues['EiBlockParams'])) {
         foreach ($taintedValues['EiBlockParams'] as $key => $new_occurrence) {
             try {
                 if (isset($new_occurrence["id"]) && $new_occurrence["id"] == "") {
                     $blockParam = new EiBlockParam();
                     $blockParam->setEiVersionStructureParent($this->getObject());
                     $blockParam->setId($new_occurrence["id"]);
                     $blockParam->setEiVersionId($this->getObject()->getEiVersionId());
                     $occurrence_form = new EiBlockParamForm($blockParam);
                     $new_occurrences->embedForm($key, $occurrence_form);
                 } elseif ($formParams != null && ($subForm = $formParams->getEmbeddedForm($key))) {
                     $occurrence_form = new EiBlockParamForm($subForm->getObject());
                     $new_occurrences->embedForm($key, $occurrence_form);
                 }
             } catch (InvalidArgumentException $exc) {
                 // TODO: Traiter l'exception.
             }
         }
         $this->embedForm('EiBlockParams', $new_occurrences);
     } else {
         $this->embedForm("EiBlockParams", new BaseForm());
     }
     parent::bind($taintedValues, $taintedFiles);
 }
Example #3
0
 protected function getCommandForm()
 {
     $form = new BaseForm();
     $form->setWidgetSchema(new sfWidgetFormSchema(array('dm_command' => new sfWidgetFormInputText())));
     $form->setValidatorSchema(new sfValidatorSchema(array('dm_command' => new sfValidatorString())));
     return $form;
 }
Example #4
0
 public static function getToken()
 {
     $form = new BaseForm();
     if ($form->isCSRFProtected()) {
         return $form->getCSRFToken();
     }
     return '';
 }
Example #5
0
 private function processForm($params, BaseForm $form)
 {
     $form->bind($params);
     if ($form->isValid()) {
         $form->save();
         return true;
     }
     return false;
 }
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $form = new BaseForm('docs.DocumentationForm', $model);
     $this->performAjaxValidation($model);
     if ($form->submitted() && $model->save()) {
         $this->redirect($model->manageUrl);
     }
     $this->render('update', array('form' => $form));
 }
Example #7
0
 /**
  *
  */
 public function handleRequest()
 {
     if ($this->_processForm()) {
         $result = array('r' => true, 'message' => $this->_form->successMessage);
         // добавляем к результату переменные от экшенов
         $result = array_merge($result, $this->_form->getActionResults());
         echo json_encode($result);
     } else {
         $this->_statusError('Ошибка при заполнении формы. Проверьте правильность заполнения всех обязательных полей');
     }
 }
Example #8
0
 /**
  * @param BaseForm $form
  */
 public function processSignInForm(BaseForm $form)
 {
     $values = $form->getValues();
     $this->getUser()->setExpiration('+ 20 minutes', TRUE);
     try {
         $this->getUser()->login($values->email, $values->password);
     } catch (Nette\Security\AuthenticationException $e) {
         $form->addError($e->getMessage());
         return;
     }
     $this->redirect('Homepage:');
 }
 public function bind(array $taintedValues = null, array $taintedFiles = null)
 {
     if (isset($taintedValues['new'])) {
         $new_stop_times = new BaseForm();
         foreach ($taintedValues['new'] as $key => $new_stop_time) {
             $stop_time = new NjStopTime();
             $stop_time->setNjTrip($this->getObject());
             $stop_time_form = new NjStopTimeForm($stop_time);
             $new_stop_times->embedForm($key, $stop_time_form);
         }
         $this->embedForm('new', $new_stop_times);
     }
     parent::bind($taintedValues, $taintedFiles);
 }
 public function bind(array $taintedValues = null, array $taintedFiles = null)
 {
     $new_occurrences = new BaseForm();
     if (isset($taintedValues['kalParams'])) {
         foreach ($taintedValues['kalParams'] as $key => $new_occurrence) {
             $kalparam = new EiFunctionHasParam();
             $kalparam->setKalFunction($this->getObject());
             $occurrence_form = new EiFunctionHasParamForm($kalparam);
             $new_occurrences->embedForm($key, $occurrence_form);
         }
         $this->embedForm('kalParams', $new_occurrences);
     }
     parent::bind($taintedValues, $taintedFiles);
 }
Example #11
0
 public function bind(array $taintedValues = null, array $taintedFiles = null)
 {
     if (array_key_exists('new', $taintedValues)) {
         $new_occurrences = new BaseForm();
         foreach ($taintedValues['new'] as $key => $new_occurrence) {
             $occurrence = new UserSport();
             $occurrence->setSport($this->getObject());
             $occurrence_form = new UserSportForm($occurrence);
             $new_occurrences->embedForm($key, $occurrence_form);
         }
     }
     $this->embedForm('new', $new_occurrences);
     parent::bind($taintedValues, $taintedFiles);
 }
Example #12
0
 /**
  * DOCUMENT ME
  * @param mixed $id
  * @param mixed $value
  * @param mixed $soptions
  */
 public function __construct($id, $value, $soptions)
 {
     $this->id = $id;
     $this->value = $value;
     $this->soptions = $soptions;
     parent::__construct();
 }
 public function __construct($programId = NULL, $courseIds = NULL, $courseNumbers = NULL)
 {
     $this->programId = $programId;
     $this->courseIds = $courseIds;
     $this->courseNumbers = $courseNumbers;
     parent::__construct();
 }
 public function __construct($studentIdNamePairArray = NULL, $courseId = NULL, $gradeChoices = NULL)
 {
     $this->gradeChoices = $gradeChoices;
     $this->studentIdNamePairArray = $studentIdNamePairArray;
     $this->courseId = $courseId;
     parent::__construct();
 }
 public function __construct($registrationId = NULL, $studentId = NULL, $courseArray = NULL)
 {
     $this->registrationId = $registrationId;
     $this->studentId = $studentId;
     $this->courseArray = $courseArray;
     parent::__construct();
 }
 public function configure()
 {
     parent::configure();
     $this->setWidget('username_or_email', new sfWidgetFormInput(array(), array('maxlength' => 100)));
     $this->setValidator('username_or_email', new sfValidatorOr(array(new sfValidatorAnd(array(new sfValidatorString(array('required' => true, 'trim' => true, 'min_length' => 4, 'max_length' => 16)), new sfValidatorDoctrineChoice(array('model' => 'sfGuardUser', 'column' => 'username'), array("invalid" => "There is no such user.")))), new sfValidatorEmail(array('required' => true)))));
     $this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]');
 }
Example #17
0
 public function configure()
 {
     $this->widgetSchema['query'] = new sfWidgetFormInputText();
     $this->validatorSchema['query'] = new sfValidatorString(array('required' => true));
     $this->widgetSchema->setLabels(array('query' => 'Запрос'));
     parent::configure();
 }
 /**
  * Moves button below embedded forms
  * @inheritdoc
  * @param string $name
  * @param sfForm $form
  * @param string $decorator
  */
 public function embedForm($name, sfForm $form, $decorator = null)
 {
     parent::embedForm($name, $form, $decorator);
     if ($this->getOption('addByCloning')) {
         $this->widgetSchema->moveField('_', sfWidgetFormSchema::LAST);
     }
 }
 public function setup()
 {
     $this->widgetSchema['email_address'] = new sfWidgetFormInputText();
     $this->validatorSchema['email_address'] = new sfGuardValidatorUsernameOrEmail(array('trim' => true), array('required' => 'Your username or e-mail address is required.', 'invalid' => 'Username or e-mail address not found please try again.'));
     $this->widgetSchema->setNameFormat('forgot_password[%s]');
     parent::setup();
 }
 public function __construct($enrollments = NULL, $courses = NULL, $gradeChoices = NULL)
 {
     $this->gradeChoices = $gradeChoices;
     $this->enrollments = $enrollments;
     $this->courses = $courses;
     parent::__construct();
 }
  public function configure()
  {
    
    $this->setWidgets(array(
      /* 'partner'              => new sfWidgetFormInputText(), */
      'message'              => new sfWidgetFormTextarea(),
      /* 'fee'                  => new sfWidgetFormInputText() */
    ));
    
    /*
    $role = new sfWidgetFormChoice(array(
      'expanded' => true,
      'multiple' => false,
      'choices'  => array('follower' => 'Follower', 'leader' => 'Leader')
    )); */
    /*
    $this->widgetSchema['role'] = $role;
    $this->setValidator('role' , new sfValidatorString(array('required' => true)));

    $this->setValidators(array(
      'fee'            => new sfValidatorString(array('required' => true))
    ));
     
     */
    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
    
    parent::configure();
    
    // $this->addCSRFProtection('flkd445rvvrGV34G');
    
    $this->disableLocalCSRFProtection();
    
    
  }
 public function __construct($studentId = NULL, $fromSectionId = NULL, $toSectionIdNamePair = NULL)
 {
     $this->fromSectionId = $fromSectionId;
     $this->studentId = $studentId;
     $this->toSectionIdNamePair = $toSectionIdNamePair;
     parent::__construct();
 }
 public function __construct($enrollmentInfoId = NULL, $studentId = NULL, $courseArray = NULL)
 {
     $this->enrollmentInfoId = $enrollmentInfoId;
     $this->studentId = $studentId;
     $this->courseArray = $courseArray;
     parent::__construct();
 }
Example #24
0
 public function getJavaScripts()
 {
     return array('/js/FLoginForm.js');
     $url_params = sfJqueryFormValidationRules::getUrlParams();
     $url_params['form'] = get_class($this);
     return array_merge(parent::getJavaScripts(), array(url_for($url_params)));
 }
  public function configure()
  {
    
    $this->setWidgets(array(
      'studio_id'            => new sfWidgetFormDoctrineChoice(array('model' => 'dsStudio', 'add_empty' => false)),
      'time'                 => new sfWidgetFormTime(),
      'duration'             => new sfWidgetFormInputText(),
      'num_lessons'          => new sfWidgetFormInputText(),
      'start_date'           => new sfWidgetFormDate(),
      'teachers_list'        => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'dsTeacher')),
    ));


   // "dateFormat" => 'd.m.yy'
    $date_options = array(
      'culture' => 'de',
      "change_month" => true,
      "change_year" => true  
    );
    $this->widgetSchema['start_date'] = new MOvEWidgetFormDateJQueryUI( $date_options );

    $time_options = array(
      'can_be_empty' => true,
      'format'       => '%hour% : %minute%',
      'hours' => array_combine( range(8,23), range(8,23)),
      'minutes' => array(
        0  => '00',
        15 => '15',
        30 => '30',
        45 => '45',
      )
    );
    $this->widgetSchema['time']= new sfWidgetFormTime($time_options);

    $this->widgetSchema['teachers_list']
        ->setOption('renderer_class', 'sfWidgetFormSelectDoubleList' );

    $this->setValidators(array(
      'studio_id'            => new sfValidatorDoctrineChoice(array('model' => 'dsStudio')),
      'time'                 => new sfValidatorTime(array('required' => false)),
      'duration'             => new sfValidatorInteger(array('required' => false)),
      'num_lessons'          => new sfValidatorInteger(array('required' => false)),
      'start_date'           => new sfValidatorDate(array('required' => false)),
      'teachers_list'        => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'dsTeacher', 'required' => false)),
    ));


    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);




    parent::configure();

    $this->widgetSchema->setNameFormat('ds_class_schedule[%s]');

    $this->addCSRFProtection('flkd445rvvrGV34G');
    
  }
 public function configure()
 {
     parent::configure();
     $this->setWidget('title', new sfWidgetFormInputText());
     $this->setValidator('title', new sfValidatorString(array('min_length' => 2, 'required' => true)));
     $this->widgetSchema->setNameFormat('a_new_event[%s]');
     $this->widgetSchema->setFormFormatterName('aAdmin');
 }
Example #27
0
 public function setup()
 {
     $this->setWidgets(array('importer' => new sfWidgetFormChoice(array('choices' => self::$importers, 'expanded' => false)), 'file' => new sfWidgetFormInputFile()));
     $this->setValidators(array('importer' => new sfValidatorChoice(array('choices' => array_keys(self::$importers))), 'file' => new sfValidatorFile(array('required' => true, 'max_size' => 100000, 'path' => sfConfig::get('sf_upload_dir') . '/imports', 'mime_types' => 'gps_files', 'mime_categories' => array('gps_files' => array('application/octet-stream'))))));
     $this->widgetSchema->setNameFormat('import[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
     parent::setup();
 }
 public function __construct($page = null)
 {
     if (!$page) {
         $page = new aPage();
     }
     $this->page = $page;
     parent::__construct();
 }
Example #29
0
 /**
  * Constructor
  * @param Nette\Application\UI\Control $parent
  * @param string $name
  */
 public function __construct($parent, $name)
 {
     parent::__construct($parent, $name);
     $galleryId = $this->parent->getId();
     $this->addSubmit('send', 'OK');
     $this->addHidden('galleryId', $galleryId);
     $this->onSuccess[] = array($this, 'formSubmited');
 }
Example #30
0
 public function setup()
 {
     $lI18n = sfContext::getInstance()->getI18N();
     $this->setWidgets(array('single_code' => new sfWidgetFormInputText(), 'multiple_codes' => new sfWidgetFormTextarea()));
     $this->setValidators(array('single_code' => new sfValidatorString(array("required" => false, 'trim' => true)), 'multiple_codes' => new sfValidatorString(array("required" => false, 'trim' => true))));
     $this->widgetSchema->setNameFormat('coupon[%s]');
     parent::setup();
 }