Пример #1
0
 /**
  * Builds fieldset with additional properties for the "yearly" repeat picker value.
  * It returns the built fieldset (used as a child of the "repeat" fieldset).
  * 
  * @return Fieldset
  */
 public function getRepeatYearlyFieldset()
 {
     $repeatYearlyFieldset = new Fieldset(self::YEARLY);
     $repeatYearlyFieldset->setLabel('Pick date');
     $month = new Element\Select('month');
     $month->setAttributes(array('class' => 'form-control month pull-left', 'autocomplete' => 'off'));
     $month->setValueOptions($this->_monthOptions);
     $repeatYearlyFieldset->add($month);
     $day = new Element\Number('dayOfMonth');
     $day->setValue(1);
     $day->setAttributes(array('class' => 'form-control input-day pull-left', 'autocomplete' => 'off', 'maxlength' => 2, 'min' => 1, 'max' => 31));
     $repeatYearlyFieldset->add($day);
     return $repeatYearlyFieldset;
 }
Пример #2
0
 public function __construct(EntityManager $em, OrmRelatorio $orm = null)
 {
     parent::__construct("formRelatorio");
     /*
      * txtID
      */
     $txtId = new Element\Hidden("id");
     /*
      * txtAno
      */
     $option = array();
     $ano = 0;
     if (date("m") >= 9) {
         $ano = 1;
     }
     $ano = $ano + date("Y");
     $option[$ano] = $ano;
     $option[$ano - 1] = $ano - 1;
     $cmbAno = new Element\Select('ano');
     $cmbAno->setValueOptions($option);
     $cmbAno->setEmptyOption("Escolha o ano");
     $cmbAno->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true'));
     /*
      * txtMes
      */
     setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
     date_default_timezone_set('America/Sao_Paulo');
     $option = array();
     for ($index = 1; $index < 13; $index++) {
         $option[$index] = strftime("%B", strtotime(date("Y") . "/" . $index . "/01"));
     }
     $cmbMes = new Element\Select('mes');
     $cmbMes->setValueOptions($option);
     $cmbMes->setEmptyOption("Escolha o ano");
     $cmbMes->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true'));
     /*
      *  cmbPublicador
      */
     $dao = $em->getRepository('Stj\\Entity\\OrmPublicador');
     $lista = $dao->findAll();
     $option = array();
     foreach ($lista as $key => $value) {
         $congregacao = new OrmCongregacao();
         $congregacao = $value;
         $option[$congregacao->getId()] = $congregacao->getNome();
     }
     $cmbPublicador = new Element\Select('publicador');
     $cmbPublicador->setValueOptions($option);
     $cmbPublicador->setEmptyOption("Escolha o publicador");
     $cmbPublicador->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true'));
     /*
      * txtLivros
      */
     $txtPublicacoes = new Element\Number("publicacoes");
     $txtPublicacoes->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "3", 'required' => 'true'));
     /*
      * $txtVideos
      */
     $txtVideos = new Element\Number("videos");
     $txtVideos->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "3", 'required' => 'true'));
     /*
      * $txtPublicacoes
      */
     $txtHoras = new Element\Text("horas");
     $txtHoras->setAttributes(array('class' => 'form-control', 'placeholder' => 'HH:MM', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+\\:[0-9]{2}$/', 'data-parsley-maxlength' => "6", 'required' => 'true'));
     /*
      * txtRevisitas
      */
     $txtRevisitas = new Element\Number("revisitas");
     $txtRevisitas->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "2", 'required' => 'true'));
     /*
      * txtEstudos
      */
     $txtEstudos = new Element\Number("estudos");
     $txtEstudos->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "2", 'required' => 'true'));
     /*
      *  txtObs
      */
     $txtObs = new Element\Textarea("obs");
     $txtObs->setAttributes(array('class' => 'form-control', 'placeholder' => 'Digites suas observações aqui'));
     /*
      * Itoken
      */
     $iToken = new Element\Csrf("iToken");
     /*
      * btnSalvar
      */
     $btnSalvar = new Element\Button('salvar');
     $btnSalvar->setAttributes(array('class' => 'btn btn-darkgray btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button'));
     /*
      * btnVoltar
      */
     $btnVoltar = new Element\Button('voltar');
     $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button'));
     /*
      * Preencher Componentes
      */
     if ($orm != null) {
         $txtId->setValue($orm->getId());
         $cmbAno->setValue($orm->getAno());
         $cmbMes->setValue($orm->getMes());
         $cmbPublicador->setValue($orm->getPublicador()->getId());
         $txtPublicacoes->setValue($orm->getPublicacoes());
         $txtVideos->setValue($orm->getVideos());
         $txtHoras->setValue($orm->getHoras());
         $txtRevisitas->setValue($orm->getRevisitas());
         $txtEstudos->setValue($orm->getEstudos());
     }
     // Adiciona componetes no form
     $this->add($txtId);
     //        $this->add();
     $this->add($cmbAno);
     $this->add($cmbMes);
     $this->add($cmbPublicador);
     $this->add($txtPublicacoes);
     $this->add($txtVideos);
     $this->add($txtHoras);
     $this->add($txtRevisitas);
     $this->add($txtEstudos);
     $this->add($txtObs);
     $this->add($iToken);
     $this->add($btnSalvar);
     $this->add($btnVoltar);
     $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL));
 }