예제 #1
0
파일: Select.php 프로젝트: rtsantos/mais
 /**
  * Renderiza o botão da Toolbar
  * 
  * @return string
  */
 public function render()
 {
     $options = '';
     if (count($this->_options) > 0) {
         foreach ($this->_options as $key => $value) {
             if ($this->_value == $key) {
                 $options .= '<option value="' . $key . '" selected>' . $value . '</option>';
             } else {
                 $options .= '<option value="' . $key . '">' . $value . '</option>';
             }
         }
     }
     $this->setAttr('value', $options);
     return parent::render();
 }
예제 #2
0
파일: Button.php 프로젝트: rtsantos/mais
 /**
  * Renderiza o botão da Toolbar
  * 
  * @return string
  */
 public function render()
 {
     $this->createJS();
     $value = $this->getCaption();
     if ($this->getIcon()) {
         //$this->addClass('ui-button-text-icon-primary');
         $value = '
                 <span class="ui-icon ' . $this->getIcon() . '"></span>
                 <span class="ui-text">' . $value . '</span>
             ';
     } else {
         //$this->addClass('ui-button-text-only');
         $value = '<span class="ui-text">' . $value . '</span>';
     }
     $this->setAttr('value', $value);
     return parent::render();
 }
예제 #3
0
파일: Seeker.php 프로젝트: rtsantos/mais
 /**
  *
  * @param string $content
  * @return string 
  */
 public function render($content)
 {
     $element = $this->getElement();
     $attribs = $element->getAttribs();
     $search = $attribs['propSearch'];
     $name = $element->getFullyQualifiedName();
     $suffix = $attribs['suffix'];
     $prefix = $attribs['prefix'];
     if (!$suffix && !$prefix) {
         $suffix = $name;
     }
     #$id = htmlentities($element->getId());
     #$value = $element->getValue();
     if ($element->isRequired()) {
         $search->setRequired();
     }
     $xhtmlElements = '';
     $renderKeys = array('propId', 'propSearch', 'propDisplay');
     foreach ($renderKeys as $key) {
         if (isset($attribs[$key])) {
             $field = $attribs[$key]->getAttrib('field');
             $xhtmlElements .= $this->_renderElement($attribs[$key], $suffix, $prefix);
             unset($attribs['fields'][$field]);
         }
     }
     foreach ($attribs['fields'] as $field) {
         $key = 'prop' . ucfirst($field);
         $xhtmlElements .= $this->_renderElement($attribs[$key], $suffix, $prefix);
         unset($attribs[$key]);
     }
     $attribs['button']->addStyle('top', '-1px');
     $attribs['button']->addStyle('height', '20px');
     $attribs['button']->addStyle('width', '20px');
     $attribs['button']->addStyle('margin', '0px');
     $attribs['button']->addStyle('padding', '0px');
     //$attribs['button']->addStyle('position','absolute');
     if ($suffix) {
         $nameButton = $attribs['button']->getName();
         $nameButton .= '_' . $suffix;
         $attribs['button']->setName($nameButton);
     }
     if ($prefix) {
         $nameButton = $prefix . '_' . $attribs['button']->getName();
         $attribs['button']->setName($nameButton);
     }
     $xhtmlElements .= $attribs['button']->render();
     unset($attribs['button']);
     $id = $search->getAttrib('id');
     if (!$id) {
         $id = ZendT_View_Html::normalizeId($search->getName());
     }
     /**
      * 
      */
     $xhtml = '
         <div id="group-' . $id . '" class="form-group">
             <label for="' . $id . '" class="t-element">' . $element->getLabel() . '</label>
             <div style="position: relative;">
                 ' . $xhtmlElements . '
                 <div style="clear:both"></div>
             </div>
         </div>
     ';
     unset($attribs['propId']);
     unset($attribs['propSearch']);
     unset($attribs['propDisplay']);
     return $xhtml;
 }
예제 #4
0
파일: Action.php 프로젝트: rtsantos/mais
 /**
  *
  * @throws ZendT_Exception_Alert 
  */
 public function dynamicAction()
 {
     $typeModal = $this->getRequest()->getParam('typeModal');
     $iframeDownload = $this->getRequest()->getParam('iframeDownload');
     $driver = $this->getRequest()->getParam('driver');
     $download = $this->getRequest()->getParam('download');
     $arquivo = $this->getRequest()->getParam('arquivo');
     $profileKey = $this->getRequest()->getParam('profile_key');
     $noToolbar = $this->getRequest()->getParam('noToolbar');
     $toolbar = $this->getRequest()->getParam('toolbar');
     $width = $this->getRequest()->getParam('width');
     $height = $this->getRequest()->getParam('height');
     $disableSidebar = $this->getRequest()->getParam('disable_sidebar');
     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');
             } else {
                 if ($typeModal == 'PDF') {
                     Zend_Layout::getMvcInstance()->setLayout('pdf');
                 }
             }
         }
     }
     try {
         $this->view->disableSidebar = $disableSidebar;
         $objectName = get_class($this->_mapper);
         $config = ZendT_Profile::get($objectName, 'C');
         $this->view->profiles = ZendT_Profile::listProfile($objectName, array('C', 'D'));
         $this->view->profileId = $config['id'];
         $this->view->profileKey = $profileKey;
         $this->view->dynamic = true;
         $this->view->objectName = $objectName;
         $this->view->profileType = $config['tipo'];
         if ($config['id']) {
             //$listProfile = ZendT_Profile::listProfile($objectName, array('C', 'D'));
             //$_profile = new ZendT_View_Profile('selProfile', $config['id'], $listProfile, 'C', $objectName);
             $_toolbar = new ZendT_View_Toolbar('toolChart');
             //$_toolbar->add($_profile);
             if ($toolbar == 'simple' && $config['tipo'] == 'C') {
                 // quando for gráfico não mostra botões de exportação
             } else {
                 $button = new ZendT_View_Button('btExportPDF', 'Download em PDF', new ZendT_JS_Command("function(){\n                             jQuery('#driver').val('PDF');\n                             jQuery('#download').val(1);                        \n                             jQuery('#formChart').attr('action','" . ZendT_Url::getUri() . "').submit();\n                         }"));
                 $button->setIcon('ui-icon-document');
                 //$button->addStyle('float', 'left');
                 $_toolbar->add($button, 'btExportPDF');
                 $button = new ZendT_View_Button('btExportXLS', 'Download em XLS', new ZendT_JS_Command("function(){\n                             jQuery('#driver').val('XLS');\n                             jQuery('#download').val(1);\n                             jQuery('#formChart').attr('action','" . ZendT_Url::getUri() . "').submit();\n                         }"));
                 $button->setIcon('ui-icon-calculator');
                 //$button->addStyle('float', 'left');
                 $_toolbar->add($button, 'btExportXLS');
                 $buttonMail = new ZendT_View_Button('btMail', 'Enviar e-mail', new ZendT_JS_Command(" function(){\n                             var form = jQuery('#formChart');\n                             form.attr('action','" . ZendT_Url::getUri(true) . "/mail');\n                             jQuery.AjaxT.submitJson({selector:form});\n                         }"));
                 $buttonMail->setIcon('ui-icon-mail-closed');
                 $_toolbar->add($buttonMail);
             }
             $button = new ZendT_View_Button('btFilterChart', 'Filtrar', new ZendT_JS_Command("function(){\n                        jQuery('#formChart').attr('action','" . ZendT_Url::getUri(true) . "/filter').submit();\n                    }"));
             $button->setIcon('ui-icon-search');
             $_toolbar->addButton($button);
             $button = new ZendT_View_Button('btRefreshChart', 'Atualizar', new ZendT_JS_Command("function(){\n                        jQuery('#formChart').attr('action','" . ZendT_Url::getUri() . "').submit();\n                    }"));
             $button->setIcon('ui-icon-refresh');
             $_toolbar->addButton($button);
             if ($toolbar != 'simple') {
                 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={$config['tipo']}&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);
                 }
                 if (ZendT_Acl::getInstance()->isAllowed('relatorio', 'log')) {
                     $buttonLog = new ZendT_View_Button('btLogViews', 'Log de Acesso', new ZendT_JS_Command("function(){\n                             window.open('" . ZendT_Url::getBaseUrl() . "/log/relatorio?arquivo=" . $objectName . "','_BLANK');\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={$config['id']}', 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');
             $form = new ZendT_Form();
             $form->setName('formChart');
             $form->setAction(ZendT_Url::getUri());
             $element = new ZendT_Form_Element_Hidden('profile');
             $element->setValue($config['id']);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('profile_key');
             $element->setValue($profileKey);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('toolbar');
             $element->setValue($toolbar);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('width');
             $element->setValue($width);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('height');
             $element->setValue($height);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('driver');
             $element->setValue($driver);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('download');
             $element->setValue($download);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('typeModal');
             $element->setValue($typeModal);
             $form->addElement($element);
             $element = new ZendT_Form_Element_Hidden('disable_sidebar');
             $element->setValue($disableSidebar);
             $form->addElement($element);
             if ($width) {
                 $config['width'] = $width;
             }
             if ($height) {
                 $config['height'] = $height - 58;
             }
             #$config['iframeDownload'] = $iframeDownload;
             if ($config['tipo'] == 'C' && $driver == '') {
                 if ($toolbar == 'simple') {
                     $config['show_parameters'] = false;
                     $config['show_title'] = false;
                     $_label = new ZendT_View_Html('span');
                     $_label->setId('spn_filter');
                     $_label->addStyle('float', 'left');
                     $_label->addStyle('margin-top', '9px');
                     $_label->addAttr('title', 'Visualizar parâmetros');
                     $_label->addClass('ui-icon ui-icon-pin-w');
                     $_label->setAttr('value', ' ');
                     $_toolbar->addObject($_label);
                     $_label = new ZendT_View_Html('label');
                     $_label->addStyle('float', 'left');
                     $_label->addStyle('padding', '10px');
                     $_label->addStyle('font-weight', 'bold');
                     $_label->addClass('ui-widget');
                     $_label->setAttr('value', $config['title']);
                     $_toolbar->addObject($_label, 'lbl_title');
                     $_toolbar->addStyle('margin-bottom', '0px');
                 } else {
                     $config['show_parameters'] = true;
                     $config['show_title'] = true;
                 }
                 $view = new ZendT_Report_View_Chart('Chart', $this->_mapper, $config);
             } else {
                 if ($config['tipo'] == 'I') {
                     $view = new ZendT_Report_View_Dynamic_Form($driver, $this->_mapper, $config);
                 } else {
                     $view = new ZendT_Report_View_Dynamic($driver, $this->_mapper, $config);
                 }
             }
             $viewRendered = $view->render($typeModal);
             $params = $view->getParams();
             if ($params) {
                 foreach ($params as $name => $value) {
                     $element = new ZendT_Form_Element_Hidden($name);
                     $element->setValue($value);
                     $form->addElement($element);
                 }
             }
             if ($iframeDownload) {
                 $this->_helper->layout->disableLayout();
                 #$this->_helper->viewRenderer->setNoRender(true);
                 $this->view->content = $viewRendered;
             } else {
                 if ($typeModal == 'PDF') {
                     $this->view->content = $viewRendered;
                 } else {
                     $this->view->placeholder('title')->set('');
                     $this->view->title = $config['title'];
                     $this->view->typeModal = $typeModal;
                     $this->view->content = '';
                     /* if (!$noToolbar) {
                        $this->view->content = $_toolbar->render();
                        } */
                     $this->view->content .= $form->render() . $viewRendered;
                 }
             }
         } else {
             throw new ZendT_Exception_Alert('Nenhuma análise configurada para essa visão!');
         }
     } catch (Exception $ex) {
         $this->view->content = '';
         if ($_toolbar instanceof ZendT_View_Toolbar) {
             $this->view->content .= $_toolbar->render();
         }
         if ($form instanceof ZendT_Form) {
             $this->view->content .= $form->render();
         }
         $this->view->content .= $this->view->exception($ex);
     }
     $this->view->addScriptPath(APPLICATION_PATH . '/views/scripts/index/');
     $this->renderScript('profile-report.phtml');
 }
예제 #5
0
파일: Toolbar.php 프로젝트: rtsantos/mais
 /**
  * Renderiza o objeto para uma string html
  */
 public function render()
 {
     $this->_attribs['value'] = '';
     if ($this->_object) {
         foreach ($this->_object as $name => $value) {
             $this->_attribs['value'] .= $value->render();
         }
     }
     for ($i = 0; $i < count($this->_buttons); $i++) {
         $name = $this->_buttonsOrder[$i];
         if ($this->_float) {
             $this->_buttons[$name]->addStyle('float', $this->_float);
         }
         $this->_attribs['value'] .= $this->_buttons[$name]->render();
     }
     return parent::render() . '<div style="clear: both;"></div>';
 }