✏️ 正在编辑: Funcionario.php
路径:
/srv/systems_dir/yuppiecred-lidernegocios/application/forms/Filtro/Funcionario.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Form_Filtro_Funcionario extends Core_Form { public function init() { $this->setMethod('post'); $this->setAttrib('autocomplete', 'off'); $this->addElement('text', 'nome', [ 'label' => 'Nome:', 'size' => 40 ]); $this->addElement('multiselect', 'setor', [ 'label' => 'Setor:', 'multiOptions' => array_filter(Core_Combos::getSetoresCadastroOptions()), 'class' => 'multiselect' ]); $this->addElement('select', 'motivo_desligamento', [ 'label' => 'Motivo Desligamento:', 'multiOptions' => Core_Combos::getMotivoDesligamentoOptions(), ]); $this->addElement(Form_DatePicker::getDatePicker('data_contratacao_de', 'Data Contratação de:')); $this->addElement(Form_DatePicker::getDatePicker('data_contratacao_a', 'a:')); $this->getElement('data_contratacao_de') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->addElement('select', 'situacao', [ 'label' => 'Situação:', 'multiOptions' => [ "" => "", "Ativo" => "Ativo", "Desligado" => "Desligado", ], ]); $this->addElement(Form_DatePicker::getDatePicker('data_desligamento_de', 'Data Desligamento de:')); $this->addElement(Form_DatePicker::getDatePicker('data_desligamento_a', 'a:')); $this->getElement('data_desligamento_de') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->_initButtons(); } protected function _initButtons() { $this->addElement('submit', 'btn_filtrar', [ 'label' => 'Buscar', 'class' => 'bt_find' ]); $this->addElement('button', 'btn_new', [ 'label' => 'Novo Cadastro', 'class' => 'bt_new', 'onclick' => "window.location='" . $this->getView()->baseUrl() . "/funcionario/save'" ]); $this->addDisplayGroup(['btn_filtrar', 'btn_new'], 'buttons'); } public function getFilter() { $where = []; if( !empty($this->nome->getValue()) ){ $where['nome LIKE ?'] = "%{$this->nome->getValue()}%"; } if( !empty($this->setor->getValue()) ){ $where['setor_id in (?)'] = $this->setor->getValue(); } if( !empty($this->motivo_desligamento->getValue()) ){ $where['motivo_desligamento = ?'] = $this->motivo_desligamento->getValue(); } if( !empty($this->data_contratacao_de->getValue()) ){ $where['data_contratacao >= ?'] = (new Zend_Date($this->data_contratacao_de->getValue(), 'dd/MM/yyyy')) ->get('yyyy-MM-dd'); } if( !empty($this->data_contratacao_a->getValue()) ){ $where['data_contratacao <= ?'] = (new Zend_Date($this->data_contratacao_a->getValue(), 'dd/MM/yyyy')) ->get('yyyy-MM-dd'); } if( !empty($this->data_desligamento_de->getValue()) ){ $where['data_desligamento >= ?'] = (new Zend_Date($this->data_desligamento_de->getValue(), 'dd/MM/yyyy')) ->get('yyyy-MM-dd'); } if( !empty($this->data_desligamento_a->getValue()) ){ $where['data_desligamento <= ?'] = (new Zend_Date($this->data_desligamento_a->getValue(), 'dd/MM/yyyy')) ->get('yyyy-MM-dd'); } if (!empty($this->situacao->getValue())) { switch ($this->situacao->getValue()) { case 'Ativo': $where["data_desligamento is null or data_desligamento = ?"] = '0000-00-00'; break; case 'Desligado': $where["data_desligamento is not null and data_desligamento <> ?"] = '0000-00-00'; break; } } return $where; } }
💾 保存文件
← 返回文件管理器