示例#1
0
文件: Button.php 项目: rtsantos/mais
 /**
  *  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();
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
文件: Printer.php 项目: rtsantos/mais
 /**
  * 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;
 }
示例#4
0
文件: Button.php 项目: rtsantos/mais
 /**
  * Renderiza o botão apenas usando o Html
  * 
  * @return string
  */
 public function renderHtml()
 {
     //$param['onClick'] = new ZendT_JS_Command();
     $js = $this->createJS();
     $js = str_replace('function', 'function ' . $this->getId(), $js);
     parent::setOnClick($this->getId() . '();');
     //$this->cli
     $this->addHeadScript($this->getId(), $js);
     //$this->addHeadScriptFile(ZendT_Url::getBaseDiretoryPublic().'/scripts/jquery/widget/TButton.js');
     return parent::render();
 }
示例#5
0
文件: Action.php 项目: rtsantos/mais
 /**
  *  
  */
 public function filterAction()
 {
     $typeModal = $this->getRequest()->getParam('typeModal');
     if ($typeModal == 'AJAX') {
         Zend_Layout::getMvcInstance()->setLayout('ajax');
     } else {
         if ($typeModal == 'WINDOW') {
             Zend_Layout::getMvcInstance()->setLayout('window');
         } else {
             if ($typeModal == 'IFRAME') {
                 Zend_Layout::getMvcInstance()->setLayout('iframe');
             }
         }
     }
     $params = $this->getRequest()->getParams();
     //var_dump($params);
     $profileId = $this->getRequest()->getParam('profile');
     $arquivo = $this->getRequest()->getParam('arquivo');
     $profileKey = $this->getRequest()->getParam('profile_key');
     $disableSidebar = $this->getRequest()->getParam('disable_sidebar');
     $objectName = get_class($this->_mapper);
     $columns = $this->_mapper->getColumns()->toArray();
     $this->view->profiles = ZendT_Profile::listProfile($objectName, array('C', 'D'));
     $profile = ZendT_Profile::get($objectName, '');
     $this->view->profileId = $profile['id'];
     $this->view->profileType = $profile['tipo'];
     $this->view->objectName = $objectName;
     $this->view->profileKey = $profileKey;
     $this->view->dynamic = false;
     $this->view->disableSidebar = $disableSidebar;
     $action = 'dynamic';
     $title = $profile['title'];
     $this->title = $profile['title'];
     if ($profile['tipo'] == 'B') {
         foreach ($profile['cols-filter']['fields'] as $name => $config) {
             list($view, $id, $desc) = explode('-', $name);
             break;
         }
         $profile = ZendT_Profile::get($objectName, '', $id);
         $action = 'panel';
     }
     $fields = $profile['cols-filter']['fields'];
     if (count($fields)) {
         foreach ($fields as $columnName => &$value) {
             $value['column'] = $columns[$columnName]['column'];
             $value['type'] = $columns[$columnName]['type'];
             $value['required'] = $columns[$columnName]['required'];
             $value['auto-complete'] = $columns[$columnName]['auto-complete'];
             $value['seeker'] = $columns[$columnName]['seeker'];
         }
     }
     $form = new ZendT_Form();
     $form->loadProfileFilter($fields, $params);
     if (isset($params['toolbar'])) {
         $element = new ZendT_Form_Element_Hidden('toolbar');
         $element->setValue($params['toolbar']);
         $form->addElement($element);
     }
     if (isset($params['width'])) {
         $element = new ZendT_Form_Element_Hidden('width');
         $element->setValue($params['width']);
         $form->addElement($element);
     }
     if (isset($params['height'])) {
         $element = new ZendT_Form_Element_Hidden('height');
         $element->setValue($params['height']);
         $form->addElement($element);
     }
     if (isset($params['typeModal'])) {
         $element = new ZendT_Form_Element_Hidden('typeModal');
         $element->setValue($params['typeModal']);
         $form->addElement($element);
     }
     if (isset($disableSidebar)) {
         $element = new ZendT_Form_Element_Hidden('disable_sidebar');
         $element->setValue($disableSidebar);
         $form->addElement($element);
     }
     $form->setAction(ZendT_Url::getBaseUrl() . '/' . $params['module'] . '/' . $params['controller'] . '/' . $action . '?profile=' . $profileId . '&profile_key=' . $profileKey);
     $button = new ZendT_View_Button('btSearch', 'Pesquisar', new ZendT_JS_Command("function(){\n\t\t\t\t//jQuery('#btSearch').attr('disabled',true);\n\t\t\t\tvar form = jQuery('#" . $form->getId() . "');\n\t\t\t\tif (form.valid()){\n\t\t\t\t\tvar data = form.serialize();\n\t\t\t\t\tjQuery.AjaxT.json({\n\t\t\t\t\t\turl: '" . ZendT_Url::getBaseUrl() . '/' . $params['module'] . '/' . $params['controller'] . '/filter-valid?profile=' . $profile['id'] . "',\n\t\t\t\t\t\tdata: data,\n\t\t\t\t\t\tsuccess: function(result){\n\t\t\t\t\t\t\tif (result){\n\t\t\t\t\t\t\t\tjQuery('#btSearch').attr('disabled',true);\n\t\t\t\t\t\t\t\tjQuery('#pAguarde').show();\n\t\t\t\t\t\t\t\tform.submit();\n\t\t\t\t\t\t\t\tdocument.body.style.cursor = 'wait';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}/*,\n\t\t\t\t\t\texception: function(ex){\n\t\t\t\t\t\t\tjQuery('#btSearch').attr('disabled',false);\n\t\t\t\t\t\t}*/\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}"));
     $button->setIcon('ui-icon-search');
     $_toolbar = new ZendT_View_Toolbar('toolChart');
     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={$profile['tipo']}&id={$profileId}', 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);
     }
     if (ZendT_Acl::getInstance()->isAllowed('relatorio', 'log')) {
         $buttonLog = new ZendT_View_Button('btLogViews', 'Log de Acesso', new ZendT_JS_Command("function(){\n                    document.location.href = '" . ZendT_Url::getBaseUrl() . "/log/relatorio?arquivo=" . $objectName . "';\n                }"));
         $buttonLog->setIcon('ui-icon-comment');
         $_toolbar->addButton($buttonLog);
     }
     if (ZendT_Acl::getInstance()->isAllowed('object-view', 'profile')) {
         $onClick = "\$.WindowT.open({id:'win-users-access', type: 'WINDOW', url: '/Mais/index.php/profile/object-view-users/dynamic', param: 'profile=813&id_visao={$profileId}', method: 'GET', title: 'Usuários com Acesso a Visão', height: 580, width: 1370, modal: false });";
         $buttonConfig = new ZendT_View_Button('bt-users-access', 'Usuários com Acesso', $onClick);
         $buttonConfig->setIcon('ui-icon-person');
         $_toolbar->addButton($buttonConfig);
     }
     $buttonViews = new ZendT_View_Button('btMyViews', 'Minhas Visões', new ZendT_JS_Command("function(){\n                document.location.href = '" . ZendT_Url::getUri(true) . "?arquivo=" . $arquivo . "&profile_key=" . $profileKey . "';\n            }"));
     $buttonViews->setIcon('ui-icon-newwin');
     $_toolbar->addButton($buttonViews);
     //$_toolbar->setFloat('right');
     $this->view->placeholder('title')->set('');
     $this->view->toolbar = $_toolbar;
     $this->view->title = $title;
     $this->view->content = $form->render();
     if (count($fields)) {
         $this->view->content .= $button->render();
     }
     $this->view->addScriptPath(APPLICATION_PATH . '/views/scripts/index/');
     $this->renderScript('profile-report.phtml');
 }