Example #1
0
 public function setup()
 {
     $this->WEB_IMATGE = 'images/cursos/';
     $this->WEB_PDF = 'images/cursos/';
     $this->BASE = sfConfig::get('sf_websysroot');
     $this->setWidgets(array('idCursos' => new sfWidgetFormInputHidden(), 'Codi' => new sfWidgetFormInputText(array(), array('style' => 'width:100px;')), 'TitolCurs' => new sfWidgetFormInputText(array(), array('style' => 'width:100%;')), 'isActiu' => new sfWidgetFormChoice(array('choices' => array(1 => 'Sí', 0 => 'No'))), 'Places' => new sfWidgetFormInputText(array(), array('style' => 'width:10%;')), 'Descripcio' => new sfWidgetFormTextareaTinyMCE(array(), array()), 'Preu' => new sfWidgetFormInputText(array(), array('style' => 'width:10%;')), 'Preur' => new sfWidgetFormInputText(array(), array('style' => 'width:10%;')), 'Horaris' => new sfWidgetFormInputText(array(), array('style' => 'width:50%;')), 'Categoria' => new sfWidgetFormChoice(array('choices' => CursosPeer::getSelectCategories())), 'OrdreSortida' => new sfWidgetFormInputText(array(), array('style' => 'width:10%;')), 'DataInici' => new sfWidgetFormJQueryDateMy(array('format' => '%day%/%month%/%year%'), array()), 'DataInMatricula' => new sfWidgetFormJQueryDateMy(array('format' => '%day%/%month%/%year%'), array()), 'DataFiMatricula' => new sfWidgetFormJQueryDateMy(array('format' => '%day%/%month%/%year%'), array()), 'site_id' => new sfWidgetFormInputHidden(), 'VisibleWEB' => new sfWidgetFormChoice(array('choices' => array(1 => 'Sí', 0 => 'No'))), 'actiu' => new sfWidgetFormInputHidden(), 'isEntrada' => new sfWidgetFormChoice(array('choices' => array(0 => 'No', 1 => 'Només reserva', 2 => 'Matrícula i pagament amb targeta')), array()), 'PDF' => new sfWidgetFormInputFileEditableMy(array('file_src' => '/' . $this->WEB_PDF . $this->getObject()->getPdf(), 'is_image' => false, 'with_delete' => false)), 'ADescomptes' => new sfWidgetFormChoice(array('renderer_class' => 'sfWidgetFormSelectManyMy', 'choices' => MatriculesPeer::selectDescomptes(), 'multiple' => true, 'expanded' => true), array('class' => 'ul_espais'))));
     $this->setDefaults(array('isEntrada' => CursosPeer::HOSPICI_RESERVA, 'VisibleWEB' => 1, 'isActiu' => 1));
     $this->setValidators(array('idCursos' => new sfValidatorPropelChoice(array('model' => 'Cursos', 'column' => 'idCursos', 'required' => false)), 'TitolCurs' => new sfValidatorString(array('required' => true)), 'isActiu' => new sfValidatorBoolean(array('required' => true)), 'Places' => new sfValidatorInteger(array('required' => true)), 'Codi' => new sfValidatorString(array('required' => true)), 'Descripcio' => new sfValidatorString(array('required' => true)), 'Preu' => new sfValidatorInteger(array('required' => true)), 'Preur' => new sfValidatorInteger(array('required' => true)), 'Horaris' => new sfValidatorString(array('required' => true)), 'Categoria' => new sfValidatorString(array('required' => true)), 'OrdreSortida' => new sfValidatorInteger(array('required' => false)), 'DataInMatricula' => new sfValidatorDate(array('required' => true)), 'DataFiMatricula' => new sfValidatorDate(array('required' => true)), 'DataInici' => new sfValidatorDate(array('required' => true)), 'VisibleWEB' => new sfValidatorInteger(array('required' => true)), 'site_id' => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)), 'actiu' => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)), 'isEntrada' => new sfValidatorInteger(array('required' => true), array()), 'PDF' => new sfValidatorFile(array('path' => $this->BASE . $this->WEB_PDF, 'required' => false)), 'ADescomptes' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->setLabels(array('TitolCurs' => 'Títol del curs: ', 'isActiu' => 'Matrícula oberta? ', 'Places' => 'Núm de places: ', 'Descripcio' => 'Descripció: ', 'Preu' => 'Preu: ', 'Preur' => 'Preu reduït: ', 'Horaris' => 'Descripció d\'horaris: ', 'Categoria' => 'Categoria: ', 'OrdreSortida' => 'Ordre de sortida: ', 'DataInici' => 'Inici del curs: ', 'DataInMatricula' => 'WEB: Inici matriculació: ', 'DataFiMatricula' => 'WEB: Fi matriculació: ', 'VisibleWEB' => 'WEB: Visible a hospici?', 'isEntrada' => 'WEB: Reserva i pagament?', 'PDF' => 'WEB: Doc. pdf: ', 'ADescomptes' => 'WEB: Descompte possible? '));
     $this->widgetSchema->setNameFormat('cursos[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
     $this->widgetSchema->setFormFormatterName('Span');
 }
 public function setup()
 {
     $this->setWidgets(array('idCursos' => new sfWidgetFormInputHidden(), 'Codi' => new sfWidgetFormInputText(array(), array('style' => 'width:100px;')), 'TitolCurs' => new sfWidgetFormInputText(array(), array('style' => 'width:100%;')), 'isActiu' => new sfWidgetFormChoice(array('choices' => array(1 => 'Sí', 0 => 'No'))), 'Places' => new sfWidgetFormInputText(array(), array('style' => 'width:10%;')), 'Descripcio' => new sfWidgetFormTextareaTinyMCE(array(), array()), 'Preu' => new sfWidgetFormInputText(array(), array('style' => 'width:10%;')), 'Horaris' => new sfWidgetFormInputText(array(), array('style' => 'width:50%;')), 'Categoria' => new sfWidgetFormChoice(array('choices' => CursosPeer::getSelectCategories())), 'OrdreSortida' => new sfWidgetFormInputText(array(), array('style' => 'width:10%;')), 'DataInici' => new sfWidgetFormJQueryDateMy(array('format' => '%day%/%month%/%year%'), array()), 'DataInMatricula' => new sfWidgetFormJQueryDateMy(array('format' => '%day%/%month%/%year%'), array()), 'DataFiMatricula' => new sfWidgetFormJQueryDateMy(array('format' => '%day%/%month%/%year%'), array()), 'site_id' => new sfWidgetFormInputHidden(), 'VisibleWEB' => new sfWidgetFormChoice(array('choices' => array(1 => 'Sí', 0 => 'No'))), 'actiu' => new sfWidgetFormInputHidden(), 'PagamentExtern' => new sfWidgetFormChoice(array('choices' => array())), 'PagamentIntern' => new sfWidgetFormChoice(array('choices' => array())), 'ADescomptes' => new sfWidgetFormChoice(array('choices' => array()), array()), 'isRestringit' => new sfWidgetFormChoice(array('choices' => array(1 => 'Sí', 0 => 'No')))));
     $this->setValidators(array('idCursos' => new sfValidatorPropelChoice(array('model' => 'Cursos', 'column' => 'idCursos', 'required' => false)), 'TitolCurs' => new sfValidatorString(array('required' => true)), 'isActiu' => new sfValidatorBoolean(array('required' => true)), 'Places' => new sfValidatorInteger(array('required' => true)), 'Codi' => new sfValidatorString(array('required' => true)), 'Descripcio' => new sfValidatorString(array('required' => true)), 'Preu' => new sfValidatorInteger(array('required' => true)), 'Horaris' => new sfValidatorString(array('required' => true)), 'Categoria' => new sfValidatorString(array('required' => true)), 'DataInMatricula' => new sfValidatorDate(array('required' => true)), 'DataFiMatricula' => new sfValidatorDate(array('required' => true)), 'DataInici' => new sfValidatorDate(array('required' => true)), 'VisibleWEB' => new sfValidatorInteger(array('required' => true)), 'site_id' => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)), 'actiu' => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)), 'ADescomptes' => new sfValidatorCallback(array('callback' => array('CursosForm', 'ComprovaDescomptes'), 'arguments' => array(), 'required' => true)), 'PagamentIntern' => new sfValidatorCallback(array('callback' => array('CursosForm', 'PagamentIntern'), 'arguments' => array(), 'required' => true)), 'PagamentExtern' => new sfValidatorCallback(array('callback' => array('CursosForm', 'PagamentExtern'), 'arguments' => array(), 'required' => true)), 'isRestringit' => new sfValidatorBoolean(array('required' => false))));
     $this->widgetSchema->setNameFormat('cursos[%s]');
 }
    ?>
</span>                        
                    </div>
                    
                    <div class="clear row fb">
                        <span class="title row_title fb"><label for="cursos_Horaris">Descripció d'horaris: </label></span>
                        <span class="row_field fb"><?php 
    echo input_tag('cursos[Horaris]', $FOC['Horaris']->getValue(), array('style' => "width:50%;"));
    ?>
</span>                                            
                    </div>
                    
                    <div class="clear row fb">
                        <span class="title row_title fb"><label for="cursos_Categoria">Categoria: </label></span>
                        <span class="row_field fb"><?php 
    echo select_tag('cursos[Categoria]', options_for_select(CursosPeer::getSelectCategories(), $FOC['Categoria']->getValue()));
    ?>
</span>
                    </div>
                    
                    <div class="clear row fb">
                        <span class="title row_title fb"><label for="cursos_Datainici">Data inici curs: </label></span>
                        <span class="row_field fb"><?php 
    echo input_tag('cursos[DataInici]', $FOC['DataInici']->getValue(), array('style' => 'width:100px', 'class' => 'select_date'));
    ?>
</span>
                    </div>

                    <div class="clear row fb">
                        <span class="title row_title fb"><label for="cursos_DataInMatricula">Data inici matrícula: </label></span>
                        <span class="row_field fb"><?php