/** * Cria um campo texto com validador de data e datepicker * * @param string $id * @param string $value * @param array $params jQuery Widget Parameters * @param array $attribs HTML Element Attributes * @return string */ public function dateMulti($id, $value = null, array $attribs = array()) { $data = date('dmy'); #$this->view->headScript()->appendFile(ZendT_Url::getBaseDiretoryPublic() . '/scripts/jquery/widget/TCursor.js?'.$data); $this->view->headScript()->appendFile(ZendT_Url::getBaseDiretoryPublic() . '/scripts/jquery/widget/TDateMulti.js?' . $data); $this->jquery->addOnLoad('jQuery("#' . $id . '").TDateMulti();'); #$button = new ZendT_View_Button('bt-calend-'.$id,''); #$button->setIcon('ui-icon-calculator'); $attribs['style'] .= ';float:left;'; $_toolbar = new ZendT_View_Toolbar('calend-toolbar-' . $id); $_toolbar->addStyle('width', '390px'); $_toolbar->addStyle('height', '34px'); $_toolbar->addStyle('display', 'none'); $_toolbar->setAttr('align', 'center'); $padrao = explode(' ', $value); $hoje = new ZendT_Type_Date('SYSDATE', 'Date'); $ultimoMes[0] = clone $hoje; $ultimoMes[0]->addMonth(-1)->firstDayMonth(); $ultimoMes[1] = clone $hoje; $ultimoMes[1]->addMonth(-1)->lastDayMonth(); $mesCorrente[0] = clone $hoje; $mesCorrente[0]->firstDayMonth(); $mesCorrente[1] = clone $hoje; $mesCorrente[1]->lastDayMonth(); $ultimaSemana[0] = clone $hoje; $ultimaSemana[0]->addWeek(-1)->firstDayWeek(); $ultimaSemana[1] = clone $hoje; $ultimaSemana[1]->addWeek(-1)->lastDayWeek(); $semanaCorrente[0] = clone $hoje; $semanaCorrente[0]->firstDayWeek(); $semanaCorrente[1] = clone $hoje; $semanaCorrente[1]->lastDayWeek(); $options = "var option = jQuery('#calend_select_" . $id . "').val();\n\n if(option != ''){\n var data1 = '', data2 = '';\n if(option == '0'){\n data1 = '" . $padrao[0] . "';\n data2 = '" . $padrao[1] . "';\n }\n else if(option == '1'){\n data1 = '" . $hoje . "';\n data2 = '" . $hoje . "';\n } else if(option == 2){\n data1 = '" . $ultimoMes[0] . "';\n data2 = '" . $ultimoMes[1] . "';\n } else if(option == 3){\n data1 = '" . $mesCorrente[0] . "';\n data2 = '" . $mesCorrente[1] . "';\n } else if(option == 4){\n data1 = '" . $ultimaSemana[0] . "';\n data2 = '" . $ultimaSemana[1] . "';\n } else if(option == 5){\n data1 = '" . $semanaCorrente[0] . "';\n data2 = '" . $semanaCorrente[1] . "';\n }\n jQuery('#calend-" . $id . "-1').datepicker('setDate', data1);\n jQuery('#calend-" . $id . "-2').datepicker('setDate', data2);\n\n jQuery('#" . $id . "').val(\n jQuery('#calend-" . $id . "-1').datepicker({ dateFormat: 'yy-mm-dd' }).val() + ' ' +\n jQuery('#calend-" . $id . "-2').datepicker({ dateFormat: 'yy-mm-dd' }).val()\n );\n }\n "; $close = " jQuery('#calend-" . $id . "-1').hide('fast');\n jQuery('#calend-" . $id . "-2').hide('fast');\n jQuery('#calend-toolbar-" . $id . "').hide('fast');"; $element = new ZendT_Form_Element_Select("calend_select_" . $id); #$element->setLabel('Seleção'); $element->addMultiOption('', ''); $element->addMultiOption('1', 'Hoje'); $element->addMultiOption('2', 'Último Mês'); $element->addMultiOption('3', 'Mês corrente'); $element->addMultiOption('4', 'Última Semana'); $element->addMultiOption('5', 'Semana corrente'); $element->addAttr('breakline', 'none'); $element->setAttrib('onClick', $options); $element->addStyle('float', 'left'); $element->addStyle('height', '25px'); $element->addStyle('margin', '3px'); $_toolbar->add($element); $_button = new ZendT_View_Button('bt_ok' . $id, 'OK', $close); $_button->setIcon('ui-icon-check'); $_button->addStyle('float', 'right'); $_button->addStyle('height', '25px'); $_button->addStyle('margin', '3px'); $_toolbar->addButton($_button); return $this->view->formText($id, $value, $attribs) . '<span id="bt-calend-' . $id . '" style="margem:0px; float:left; height: 18px; width: 20px;" class="ui-button ui-state-default ui-corner-right ui-button-icon-only"><span id="icon-bt-calend-' . $id . '" class="ui-button-icon-primary ui-icon ui-icon-calculator"></span></span>' . '<br style="clear:both;" /><table><tr><td><div id="calend-' . $id . '-1" style="display:none"></div></td><td><div id="calend-' . $id . '-2" style="display:none"></div></td></tr></table>' . $_toolbar->render() . '<label class="error" for="dt_emissao_ctrc" generated="true" style="display:none"></label>' . '<div id="hour-' . $id . '" style="display:none"></div>'; }
/** * Cria um campo texto * * @param string $id * @param string $value * @param array $params jQuery Widget Parameters * @param array $attribs HTML Element Attributes * @return string */ public function button($id, $value = null, array $attribs = array()) { if (!isset($attribs['caption']) && $value != '') { $attribs['caption'] = $value; } $_button = new ZendT_View_Button($id, $attribs['caption']); $_button->setIcon($attribs['icon']); unset($attribs['icon']); unset($attribs['caption']); unset($attribs['jQueryParams']); unset($attribs['options']); foreach ($attribs as $name => $value) { $_button->setAttr($name, $value); } return $_button->render(); }
/** * Cria botões para window * * @param array $buttons * @return array */ protected function _createButtons(array $buttons) { $retorno = array(); foreach ($buttons as $button) { if ($button['onClick'] != '') { $button['onClick'] = stripslashes(urldecode($button['onClick'])); if (substr($button['onClick'], 0, 7) == 'base64:') { $button['onClick'] = base64_decode(substr($button['onClick'], 7)); } $_button = new ZendT_View_Button('button' . str_replace(' ', '_', $button['caption']), $button['caption'], new ZendT_JS_Command($button['onClick'])); $_button->setIcon($button['icon']); if (isset($button['class'])) { $_button->addClass($button['class']); } //$idButton = $_button->getId(); $retorno['buttons'] .= $_button->render(); $key = strtolower(substr(trim($button['caption']), 0, 1)); if ($key != 'c') { $this->view->hotkeys()->add('key_' . $_button->getId(), 'ctrl+' . $key, "jQuery('#" . $_button->getId() . "').click();"); } /* $retorno['functions'].= "$('#" . $idButton . "').click(" . . ");\n"; */ } } return $retorno; }
/** * Cria o HTMl para as tabs * * @return string */ public function createHtml() { $html .= '<select id="' . $this->getId() . '" name="' . $this->getId() . '">'; if (count($this->_serverPrinters) > 0) { $html .= '<optgroup id="server_' . $this->getId() . '" label="Impressoras do Servidor">'; foreach ($this->_serverPrinters as $name) { $add = true; if (isset($name['name'])) { $name = $name['name']; } if ($this->_filter && strpos(strtoupper($name), strtoupper($this->_filter)) === false) { $add = false; } if ($add) { $html .= ' <option value="' . $name . '">' . $name . '</option>'; } } $html .= '</optgroup>'; } $html .= '<optgroup id="local_' . $this->getId() . '" label="Impressoras Locais">'; $html .= '</optgroup>'; $html .= '</select>'; $btRefresh = new ZendT_View_Button('btn_' . $this->getId(), '', "jQuery('#" . $this->getId() . "').TPrinter('refreshPrinters');"); $btRefresh->setIcon('ui-icon-refresh'); $btRefresh->setTitle('Atualizar lista de impressoras'); $btRefresh->setCaption(''); $btRefresh->removeStyle('height'); $btRefresh->addStyle('margin', '-3px 0 0'); $btRefresh->addStyle('height', '24px'); $msg = '<div id="msg_' . $this->getId() . '" style="width:350px;padding:5px;text-align:center;float:left;display:none;" class="ui-state-highlight">'; $msg .= 'Servidor de impressão não detectado ou requer atualização. <br /> Para instalar, clique <a href = "https://www.tanet.com.br/download/WebServerPrinter.exe">aqui</a>. Em caso de dúvidas entre em contato com o departamento de TI, no telefone 19 2108-9180.'; $msg .= '</div>'; return "<div id='cmb_" . $this->getId() . "'>" . $html . $btRefresh->render() . "</div>" . $msg; }
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'); }