public function deleteAction() { $this->_disableRender(); if ($this->getRequest()->getParam('all')) { $json = new ZendT_Json_Result(); try { if (!$this->getRequest()->getParam('confirmacao')) { $form = new ZendT_Form(); $form->setAction(ZendT_Url::getUri()); $params = $this->getRequest()->getParams(); $params['confirmacao'] = '1'; foreach ($params as $key => $val) { $element = new ZendT_Form_Element_Hidden($key); $element->setValue($val); $form->addElement($element); } $msg = "Deseja remover todas as notificações?"; throw new ZendT_Exception_Confirm($msg . $form->render()); } else { if (Auth_Session_User::getInstance()->authenticated()) { $this->getMapper()->setIdUsuario(Zend_Auth::getInstance()->getStorage()->read()->getId())->delete(); } $json->setResult(true); } } catch (Exception $ex) { $json->setException($ex); } echo $json->render(); } else { parent::deleteAction(); } }
public function loadProfileFilter($fields, $params) { $this->enablejQueryValidate(); $element = new ZendT_Form_Element_Hidden('_search'); $element->setDecorators(array(new ZendT_Form_Decorator_Hidden())); $element->setValue('1'); $this->addElement($element); if (count($fields)) { foreach ($fields as $field => $config) { if ($config['seeker']) { $baseUri = $itens = ZendT_Lib::mapperViewToArrayUri($config['seeker']['mapperView']); foreach ($config['seeker']['fields'] as $searchName => $searchProp) { unset($config['seeker']['fields'][$searchName]); break; } $element = new ZendT_Form_Element_Seeker($field); $element->setSufix(str_replace('id_', '', $field)); $element->setIdField('id'); $element->setSearchField($searchName); $element->setSearchAttribs($searchProp); $element->modal()->setWidth(800); $element->modal()->setHeight(400); $element->url()->setGrid("/{$baseUri['module']}/{$baseUri['controller']}/grid"); $element->url()->setSearch("/{$baseUri['module']}/{$baseUri['controller']}/seeker-search"); $element->url()->setRetrive("/{$baseUri['module']}/{$baseUri['controller']}/retrive"); $element->url()->setAutoComplete("/{$baseUri['module']}/{$baseUri['controller']}/auto-complete"); //$element->enableAutoComplete(); if ($config['multiple'] !== '0') { $element->setMultiple(true); } else { $element->setMultiple(false); } $element->setMapperView($config['seeker']['mapperView']); //Procura os elementos que referenciam essa seeker, para criar uma dependência (filterRefer) foreach ($fields as $field1 => $config1) { if (isset($config1['seeker']) && isset($config1['seeker']['filter'])) { $filterRefer = $config1['seeker']['filter']; if ($filterRefer) { foreach ($filterRefer as $filter1 => $key1) { if ($filter1 == $field) { $element->addFilterRefer($field1); } } } } } $_where = $config['seeker']['where']; $preFilter = $config['seeker']['filter']; if ($_where && !$preFilter) { $element->setWhere($_where); } else { if ($preFilter) { /* print_r($config['seeker']); exit; */ $dynamicWhere = "var where = new TWhere('AND');"; if ($_where) { $whereFilters = $_where->getFilters(); foreach ($whereFilters as $i => $key) { $value = $key['value']; if (is_array($value)) { $value = $value[0]; } $dynamicWhere .= "\n\t\t\t\t\t\t\t\t\twhere.addFilter({\n\t\t\t\t\t\t\t\t\t field: '{$key['field']}',\n\t\t\t\t\t\t\t\t\t value: '{$value}',\n\t\t\t\t\t\t\t\t\t mapper: '{$key['mapper']}',\n\t\t\t\t\t\t\t\t\t operation: '{$key['operation']}'\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t"; } } foreach ($preFilter as $filter => $key) { if ($filter) { $label = $fields[$filter]['label']; $operation = !$key['operation'] ? 'in' : $key['operation']; $dynamicWhere .= "\n\t\t\t\t\t\t\t\t\t\tvar value1 = \$('#{$filter}').val();\n\t\t\t\t\t\t\t\t\t\tvar value2 = \$('#{$filter}-multiple').val();\n\t\t\t\t\t\t\t\t\t\tif(!value1 && !value2){\n\t\t\t\t\t\t\t\t\t\t\tvar searchid = \$('#{$field}').attr('searchid');\n\t\t\t\t\t\t\t\t\t\t\t\$('#group-' + searchid + ' input').val('');\n\t\t\t\t\t\t\t\t\t\t\talert('Favor preencher o campo {$label}!');\n\t\t\t\t\t\t\t\t\t\t\tvar searchid = \$('#{$filter}').attr('searchid');\n\t\t\t\t\t\t\t\t\t\t\t\$('#' + searchid).focus();\n\t\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tvar value = (value1?value1:value2);\n\t\t\t\t\t\t\t\t\t\tif(value.indexOf(';') != -1){\n\t\t\t\t\t\t\t\t\t\t\twhile(value.indexOf(';') != -1){\n\t\t\t\t\t\t\t\t\t\t\t\tvalue = value.replace(';',',');\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tvalue = [value];\n\t\t\t\t\t\t\t\t\t\t}\n\t \n\t\t\t\t\t\t\t\t\t\twhere.addFilter({\n\t\t\t\t\t\t\t\t\t\t field: '{$key['field']}',\n\t\t\t\t\t\t\t\t\t\t value: value,\n\t\t\t\t\t\t\t\t\t\t mapper: '{$key['mapper']}',\n\t\t\t\t\t\t\t\t\t\t operation: '{$operation}'\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t"; } } $dynamicWhere = "function(){ {$dynamicWhere} return where.toJson(); }"; #echo $preWhere;die; $element->setOnFilter($dynamicWhere); } } foreach ($config['seeker']['fields'] as $fieldName => $fieldProp) { $element->addField($fieldName, $fieldName, 'text', $fieldProp); } } else { if ($config['autocomplete']) { $element = new ZendT_Form_Element_AutoComplete($field); $url = ZendT_Url::getUri(true) . '/auto-complete/suggest/1/column/' . $field . '/profile/' . $params['profile']; $element->setDataSource($url); $extraParams = array('filters' => new ZendT_JS_Command("function(){\n\t\t\t\t\t\t\tvar formData = jQuery('#" . $this->getId() . "').serializeArray();\n\t\t\t\t\t\t\tvar data = '';\n\t\t\t\t\t\t\tfor(var index in formData){\n\t\t\t\t\t\t\t\tdata = data + '&' + formData[index].name + '=' + formData[index].value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn data.substr(1);\n\t\t\t\t\t\t}")); $element->setJQueryParam('limit', 100); $element->setJQueryParam('extraParams', $extraParams); $element->setJQueryParam('showButtonSearch', true); if ($config['multiple'] !== '0') { $element->setJQueryParam('multiple', true); } else { $element->setJQueryParam('multiple', false); } $element->setJQueryParam('multipleSeparator', ';'); $element->setJQueryParam('mustMatch', true); $element->setJQueryParam('autoFill', true); } else { if (in_array($config['type'], array('Date', 'DateTime'))) { if (getBrowser() != 'IE 8.0') { $element = new ZendT_Form_Element_DateDynamic($field); $_profile = new Profile_DataView_ObjectView_MapperView(); $_profile->newRow()->setId($params['profile'])->retrieve(); if ($_profile->getObjeto()) { $objeto = $_profile->getObjeto()->toPhp(); $objeto = new $objeto(); $columns = $objeto->getColumns()->toArray(); if ($columns[$field]['bind']) { $element->setJQueryParam('fix_elements', count($columns[$field]['bind'])); } } if ($config['max_periodo']) { $element->setMaxPeriodo($config['max_periodo']); } } else { $element = new ZendT_Form_Element_DateMulti($field); } } else { if (in_array($config['type'], array('Numeric', 'Number'))) { $element = new ZendT_Form_Element_NumericMulti($field); } else { $element = new ZendT_Form_Element_Text($field); } } } } /** * Trata o valor a ser preenchido no elemento */ if ($params[$field]) { $value = $params[$field]; } else { $value = $config['value']; } $value = $this->_parseValue($value, $element, $config['type']); /** * Preenche as propriedaddes do elemento */ $element->setValue($value); $element->setLabel($config['label'] . ':'); $element->setRequired($config['required']); if ($element instanceof ZendT_Form_Element_DateDynamic) { $element->addStyle('width', '90px'); } else { $element->addStyle('width', '270px'); } if ($config['hidden']) { $element->setDecorators(array(new ZendT_Form_Decorator_Hidden())); } #var_dump($config);die; $this->addElement($element); } } /* $element = new ZendT_Form_Element_Button('btPesquisar'); $element->setDecorators(array(new ZendT_Form_Decorator_Button())); $element->setLabel('Pesquisar'); $element->setIcon('ui-icon-search'); $element->setAttrib('onClick', "jQuery('form').submit();"); $this->addElement($element); */ }
public function loadElements() { $translate = Zend_Registry::get('translate_wf'); $model = new Wf_Model_WfFase_Table(); $element = new ZendT_Form_Element_SelectSqlGroupOperation(); $element->setLabel('Filtrar com:'); $this->addElement($element); /** * Campo para identificar que a busca é do tipo Search de GRID */ $element = new ZendT_Form_Element_Hidden('isSearch'); $element->setValue('true'); $this->addElement($element); /** * Pesquisa na coluna id */ $element = new ZendT_Form_Element_Hidden('idfield'); $element->setBelongsTo('filter[id][field]'); $element->setValue('wf_fase.id'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('idmapper'); $element->setBelongsTo('filter[id][mapper]'); $element->setValue('Wf_Model_WfFase_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('idop'); $element->setBelongsTo('filter[id][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('id'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[id][value]'); $this->addElement($element); $this->addDisplayGroup(array('idop', $nameElement), 'id.idop'); $fields = $this->getDisplayGroup('id.idop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_fase.id') . ':')->setAttrib('id', 'id-fieldset'); /** * Pesquisa na coluna id_wf_processo */ $element = new ZendT_Form_Element_Hidden('id_wf_processofield'); $element->setBelongsTo('filter[id_wf_processo][field]'); $element->setValue('wf_fase.id_wf_processo'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('id_wf_processomapper'); $element->setBelongsTo('filter[id_wf_processo][mapper]'); $element->setValue('Wf_Model_WfFase_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('id_wf_processoop'); $element->setBelongsTo('filter[id_wf_processo][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('id_wf_processo'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[id_wf_processo][value]'); $this->addElement($element); $this->addDisplayGroup(array('id_wf_processoop', $nameElement), 'id_wf_processo.id_wf_processoop'); $fields = $this->getDisplayGroup('id_wf_processo.id_wf_processoop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_fase.id_wf_processo') . ':')->setAttrib('id', 'id_wf_processo-fieldset'); /** * Pesquisa na coluna valor */ $element = new ZendT_Form_Element_Hidden('valorfield'); $element->setBelongsTo('filter[valor][field]'); $element->setValue('wf_fase.valor'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('valormapper'); $element->setBelongsTo('filter[valor][mapper]'); $element->setValue('Wf_Model_WfFase_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('valorop'); $element->setBelongsTo('filter[valor][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('valor'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[valor][value]'); $this->addElement($element); $this->addDisplayGroup(array('valorop', $nameElement), 'valor.valorop'); $fields = $this->getDisplayGroup('valor.valorop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_fase.valor') . ':')->setAttrib('id', 'valor-fieldset'); /** * Pesquisa na coluna descricao */ $element = new ZendT_Form_Element_Hidden('descricaofield'); $element->setBelongsTo('filter[descricao][field]'); $element->setValue('wf_fase.descricao'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('descricaomapper'); $element->setBelongsTo('filter[descricao][mapper]'); $element->setValue('Wf_Model_WfFase_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('descricaoop'); $element->setBelongsTo('filter[descricao][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('descricao'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[descricao][value]'); $this->addElement($element); $this->addDisplayGroup(array('descricaoop', $nameElement), 'descricao.descricaoop'); $fields = $this->getDisplayGroup('descricao.descricaoop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_fase.descricao') . ':')->setAttrib('id', 'descricao-fieldset'); /** * Pesquisa na coluna proc_prox_fase */ $element = new ZendT_Form_Element_Hidden('proc_prox_fasefield'); $element->setBelongsTo('filter[proc_prox_fase][field]'); $element->setValue('wf_fase.proc_prox_fase'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('proc_prox_fasemapper'); $element->setBelongsTo('filter[proc_prox_fase][mapper]'); $element->setValue('Wf_Model_WfFase_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('proc_prox_faseop'); $element->setBelongsTo('filter[proc_prox_fase][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('proc_prox_fase'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[proc_prox_fase][value]'); $this->addElement($element); $this->addDisplayGroup(array('proc_prox_faseop', $nameElement), 'proc_prox_fase.proc_prox_faseop'); $fields = $this->getDisplayGroup('proc_prox_fase.proc_prox_faseop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_fase.proc_prox_fase') . ':')->setAttrib('id', 'proc_prox_fase-fieldset'); /** * Pesquisa na coluna proc_prox_usuario */ $element = new ZendT_Form_Element_Hidden('proc_prox_usuariofield'); $element->setBelongsTo('filter[proc_prox_usuario][field]'); $element->setValue('wf_fase.proc_prox_usuario'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('proc_prox_usuariomapper'); $element->setBelongsTo('filter[proc_prox_usuario][mapper]'); $element->setValue('Wf_Model_WfFase_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('proc_prox_usuarioop'); $element->setBelongsTo('filter[proc_prox_usuario][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('proc_prox_usuario'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[proc_prox_usuario][value]'); $this->addElement($element); $this->addDisplayGroup(array('proc_prox_usuarioop', $nameElement), 'proc_prox_usuario.proc_prox_usuarioop'); $fields = $this->getDisplayGroup('proc_prox_usuario.proc_prox_usuarioop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_fase.proc_prox_usuario') . ':')->setAttrib('id', 'proc_prox_usuario-fieldset'); /** * Pesquisa na coluna proc_notif */ $element = new ZendT_Form_Element_Hidden('proc_notiffield'); $element->setBelongsTo('filter[proc_notif][field]'); $element->setValue('wf_fase.proc_notif'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('proc_notifmapper'); $element->setBelongsTo('filter[proc_notif][mapper]'); $element->setValue('Wf_Model_WfFase_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('proc_notifop'); $element->setBelongsTo('filter[proc_notif][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('proc_notif'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[proc_notif][value]'); $this->addElement($element); $this->addDisplayGroup(array('proc_notifop', $nameElement), 'proc_notif.proc_notifop'); $fields = $this->getDisplayGroup('proc_notif.proc_notifop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_fase.proc_notif') . ':')->setAttrib('id', 'proc_notif-fieldset'); }
public function loadElements() { $translate = Zend_Registry::get('translate_wf'); $model = new Wf_Model_WfTransacao_Table(); $element = new ZendT_Form_Element_SelectSqlGroupOperation(); $element->setLabel('Filtrar com:'); $this->addElement($element); /** * Campo para identificar que a busca é do tipo Search de GRID */ $element = new ZendT_Form_Element_Hidden('isSearch'); $element->setValue('true'); $this->addElement($element); /** * Pesquisa na coluna id_wf_fase */ $element = new ZendT_Form_Element_Hidden('id_wf_fasefield'); $element->setBelongsTo('filter[id_wf_fase][field]'); $element->setValue('wf_transacao.id_wf_fase'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('id_wf_fasemapper'); $element->setBelongsTo('filter[id_wf_fase][mapper]'); $element->setValue('Wf_Model_WfTransacao_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('id_wf_faseop'); $element->setBelongsTo('filter[id_wf_fase][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('id_wf_fase'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[id_wf_fase][value]'); $this->addElement($element); $this->addDisplayGroup(array('id_wf_faseop', $nameElement), 'id_wf_fase.id_wf_faseop'); $fields = $this->getDisplayGroup('id_wf_fase.id_wf_faseop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_transacao.id_wf_fase') . ':')->setAttrib('id', 'id_wf_fase-fieldset'); /** * Pesquisa na coluna id_objeto */ $element = new ZendT_Form_Element_Hidden('id_objetofield'); $element->setBelongsTo('filter[id_objeto][field]'); $element->setValue('wf_transacao.id_objeto'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('id_objetomapper'); $element->setBelongsTo('filter[id_objeto][mapper]'); $element->setValue('Wf_Model_WfTransacao_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('id_objetoop'); $element->setBelongsTo('filter[id_objeto][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('id_objeto'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[id_objeto][value]'); $this->addElement($element); $this->addDisplayGroup(array('id_objetoop', $nameElement), 'id_objeto.id_objetoop'); $fields = $this->getDisplayGroup('id_objeto.id_objetoop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_transacao.id_objeto') . ':')->setAttrib('id', 'id_objeto-fieldset'); /** * Pesquisa na coluna id_usuario_aloc */ $element = new ZendT_Form_Element_Hidden('id_usuario_alocfield'); $element->setBelongsTo('filter[id_usuario_aloc][field]'); $element->setValue('wf_transacao.id_usuario_aloc'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('id_usuario_alocmapper'); $element->setBelongsTo('filter[id_usuario_aloc][mapper]'); $element->setValue('Wf_Model_WfTransacao_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('id_usuario_alocop'); $element->setBelongsTo('filter[id_usuario_aloc][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('id_usuario_aloc'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[id_usuario_aloc][value]'); $this->addElement($element); $this->addDisplayGroup(array('id_usuario_alocop', $nameElement), 'id_usuario_aloc.id_usuario_alocop'); $fields = $this->getDisplayGroup('id_usuario_aloc.id_usuario_alocop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_transacao.id_usuario_aloc') . ':')->setAttrib('id', 'id_usuario_aloc-fieldset'); /** * Pesquisa na coluna dh_inc */ $element = new ZendT_Form_Element_Hidden('dh_incfield'); $element->setBelongsTo('filter[dh_inc][field]'); $element->setValue('wf_transacao.dh_inc'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('dh_incmapper'); $element->setBelongsTo('filter[dh_inc][mapper]'); $element->setValue('Wf_Model_WfTransacao_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('dh_incop'); $element->setBelongsTo('filter[dh_inc][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('dh_inc'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[dh_inc][value]'); $this->addElement($element); $this->addDisplayGroup(array('dh_incop', $nameElement), 'dh_inc.dh_incop'); $fields = $this->getDisplayGroup('dh_inc.dh_incop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('wf_transacao.dh_inc') . ':')->setAttrib('id', 'dh_inc-fieldset'); /** * Pesquisa na coluna observacao */ }
public function loadElements() { $translate = Zend_Registry::get('translate_auth'); $model = new Auth_Model_TipoRecurso_Table(); $element = new ZendT_Form_Element_SelectSqlGroupOperation(); $element->setLabel('Filtrar com:'); $this->addElement($element); /** * Campo para identificar que a busca é do tipo Search de GRID */ $element = new ZendT_Form_Element_Hidden('isSearch'); $element->setValue('true'); $this->addElement($element); /** * Pesquisa na coluna id */ $element = new ZendT_Form_Element_Hidden('idfield'); $element->setBelongsTo('filter[id][field]'); $element->setValue('tipo_recurso.id'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('idmapper'); $element->setBelongsTo('filter[id][mapper]'); $element->setValue('Auth_Model_TipoRecurso_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('idop'); $element->setBelongsTo('filter[id][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('id'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[id][value]'); $this->addElement($element); $this->addDisplayGroup(array('idop', $nameElement), 'id.idop'); $fields = $this->getDisplayGroup('id.idop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('tipo_recurso.id') . ':')->setAttrib('id', 'id-fieldset'); /** * Pesquisa na coluna nome */ $element = new ZendT_Form_Element_Hidden('nomefield'); $element->setBelongsTo('filter[nome][field]'); $element->setValue('tipo_recurso.nome'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('nomemapper'); $element->setBelongsTo('filter[nome][mapper]'); $element->setValue('Auth_Model_TipoRecurso_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('nomeop'); $element->setBelongsTo('filter[nome][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('nome'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[nome][value]'); $this->addElement($element); $this->addDisplayGroup(array('nomeop', $nameElement), 'nome.nomeop'); $fields = $this->getDisplayGroup('nome.nomeop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('tipo_recurso.nome') . ':')->setAttrib('id', 'nome-fieldset'); /** * Pesquisa na coluna descricao */ $element = new ZendT_Form_Element_Hidden('descricaofield'); $element->setBelongsTo('filter[descricao][field]'); $element->setValue('tipo_recurso.descricao'); $this->addElement($element); $element = new ZendT_Form_Element_Hidden('descricaomapper'); $element->setBelongsTo('filter[descricao][mapper]'); $element->setValue('Auth_Model_TipoRecurso_Mapper'); $this->addElement($element); $element = new ZendT_Form_Element_SelectSqlOperation('descricaoop'); $element->setBelongsTo('filter[descricao][op]'); $element->setLabel($translate->_('operacao') . ':'); $this->addElement($element); $element = $model->getElement('descricao'); $nameElement = $element->getName(); $element->setLabel($translate->_('valor') . ':'); $element->setBelongsTo('filter[descricao][value]'); $this->addElement($element); $this->addDisplayGroup(array('descricaoop', $nameElement), 'descricao.descricaoop'); $fields = $this->getDisplayGroup('descricao.descricaoop'); $fields->addDecorator('Fieldset'); $fields->setLegend($translate->_('tipo_recurso.descricao') . ':')->setAttrib('id', 'descricao-fieldset'); }
public function panelAction() { $objectName = get_class($this->_mapper); $view = ZendT_Profile::get($objectName, array('B')); $this->view->panels = $view['cols-panel']['fields']; $this->view->refresh = $view['advanced']['refresh']; if (isset($view['title'])) { $title = $view['title']; } else { $title = 'Painel de Indicações'; } $this->view->placeholder('title')->set($title); $_toolbar = new ZendT_View_Toolbar('toolChart'); $button = new ZendT_View_Button('btFilter', 'Filtrar Geral', new ZendT_JS_Command("function(){\n jQuery('#frm_panel').attr('action','" . ZendT_Url::getUri(true) . "/filter').submit();\n }")); $button->setIcon('ui-icon-search'); $_toolbar->addButton($button); $button = new ZendT_View_Button('btRefresh', 'Atualizar Geral', new ZendT_JS_Command("function(){\n jQuery('#frm_panel').attr('action','" . ZendT_Url::getUri() . "').submit();\n }")); $button->setIcon('ui-icon-refresh'); $_toolbar->addButton($button); if (ZendT_Acl::getInstance()->isAllowed('object-view', 'profile')) { $onClick = "\$.WindowT.open({id:'win-{$objectName}', type: 'WINDOW', url: '/Mais/index.php/profile/object-view/list-config', param: 'objeto={$objectName}&tipo=B&id={$config['id']}', method: 'GET', title: 'Configuração da Visão', height: 580, width: 1370, modal: false });"; $buttonConfig = new ZendT_View_Button('bt-' . $objectName, 'Configurar Visão', $onClick); $buttonConfig->setIcon('ui-icon-gear'); $_toolbar->addButton($buttonConfig); } $_toolbar->setFloat('right'); $form = new ZendT_Form(); $form->setName('frm_panel'); $form->setAction(ZendT_Url::getUri()); $params = $this->getRequest()->getParams(); $element = new ZendT_Form_Element_Hidden('profile'); $element->setValue($params['profile']); $form->addElement($element); unset($params['module']); unset($params['controller']); unset($params['action']); unset($params['profile']); unset($params['_search']); if (count($params) > 0) { foreach ($params as $name => &$value) { if (isset($params[$name . '-multiple']) && $params[$name . '-multiple']) { $value = $params[$name . '-multiple']; //unset($params[$name.'-multiple']); } } foreach ($params as $name => $value) { $element = new ZendT_Form_Element_Hidden($name); $element->setValue($value); $form->addElement($element); } } $this->view->toolbar = $_toolbar; $this->view->form = $form; $this->view->params = $params; $this->view->addScriptPath(APPLICATION_PATH . '/views/scripts/index/'); $this->renderScript('panel.phtml'); }