Commit 7afaf67acf09a2672e002e018fd84b76f918a5ff
1 parent
e8b6eda9
Exists in
master
and in
1 other branch
- merge de branch (2.4) revisão [859]
git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/gerente@860 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
3 changed files
with
56 additions
and
1 deletions
Show diff stats
admin/softwares/softwares_classificar.class.php
| ... | ... | @@ -43,6 +43,7 @@ defined( 'CACIC' ) or die( 'Acesso restrito (Restricted access)!' ); |
| 43 | 43 | $this->addVar('SoftwaresClassificar_form', 'SOFTWARE_NAME_TITLE', $this->oTranslator->_('Nome do software') ); |
| 44 | 44 | $this->addVar('SoftwaresClassificar_form', 'NO', $this->oTranslator->_('Nao') ); |
| 45 | 45 | $this->addVar('SoftwaresClassificar_form', 'YES', $this->oTranslator->_('Sim') ); |
| 46 | + $this->addVar('SoftwaresType_list', 'IMG_TYPE', $this->isIEBrowser()?'gd':'svg' ); | |
| 46 | 47 | $this->addRows('SoftwaresType_list', $this->fillListSoftwaresType() ); |
| 47 | 48 | $this->addVar('SoftwaresClassificar_form', 'COLSPAN', 20 ); |
| 48 | 49 | $this->addVar('SoftwaresClassificar_form', 'BTN_SALVAR', $this->oTranslator->_('Gravar alteracoes') ); |
| ... | ... | @@ -50,6 +51,16 @@ defined( 'CACIC' ) or die( 'Acesso restrito (Restricted access)!' ); |
| 50 | 51 | $this->addVar('SoftwaresClassificar_form', 'BTN_RESET', $this->oTranslator->_('Restaurar valores') ); |
| 51 | 52 | } |
| 52 | 53 | |
| 54 | + /** | |
| 55 | + * Detecta se o navegador é IE | |
| 56 | + */ | |
| 57 | + function isIEBrowser() { | |
| 58 | + if (isset($_SERVER['HTTP_USER_AGENT']) and (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) | |
| 59 | + return true; | |
| 60 | + else | |
| 61 | + return false; | |
| 62 | + } | |
| 63 | + | |
| 53 | 64 | /** |
| 54 | 65 | * Armazena na "sessao" os dados de configuração padrao |
| 55 | 66 | * @access public | ... | ... |
admin/softwares/softwares_classificar_01.tmpl.php
| ... | ... | @@ -49,7 +49,7 @@ defined( 'CACIC' ) or die( 'Acesso restrito (Restricted access)!' ); |
| 49 | 49 | </th> |
| 50 | 50 | <softwareClassificacao:tmpl name="SoftwaresType_list"> |
| 51 | 51 | <td width="5%" class="header"> |
| 52 | - <object data="softwares_classificar_tipo_svgimage.php?texto={SOFTWARE_TYPE_NAME}" type="image/svg+xml"></object> | |
| 52 | + <object data="softwares_classificar_tipo_{IMG_TYPE}image.php?texto={SOFTWARE_TYPE_NAME}" type="image/svg+xml"></object> | |
| 53 | 53 | </td> |
| 54 | 54 | </softwareClassificacao:tmpl> |
| 55 | 55 | </tr> | ... | ... |
| ... | ... | @@ -0,0 +1,44 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @version $Id: softwares_classificar_tipo_gdimage.php 2009-09-14 00:18 harpiain $ | |
| 4 | + * @package CACIC-Admin | |
| 5 | + * @subpackage SoftwaresClassificar | |
| 6 | + * @author Adriano dos Santos Vieira <harpiain at gmail.com> | |
| 7 | + * @copyright Copyright (C) 2008 Adriano dos Santos Vieira. All rights reserved. | |
| 8 | + * @license GNU/GPL, see LICENSE.php | |
| 9 | + * CACIC is free software and parts of it may contain or be derived from the | |
| 10 | + * GNU General Public License or other free or open source software licenses. | |
| 11 | + * See COPYRIGHT.php for copyright notices and details. | |
| 12 | + * | |
| 13 | + * Gerador de imagem GD para tipos de software a ser classificado | |
| 14 | + */ | |
| 15 | + | |
| 16 | +$text = $_GET['texto']; //'Imagem com texto na vertical!'; | |
| 17 | +// Tamanho da fonte | |
| 18 | +$font = 3; | |
| 19 | + | |
| 20 | +// Tamanho da imagem para o texto e a fonte | |
| 21 | +$font_width = ImageFontWidth($font) * strlen($text);; | |
| 22 | +$font_height = ImageFontHeight($font); | |
| 23 | +$img_altura = $font_width; | |
| 24 | +$img_largura = $font_height; | |
| 25 | + | |
| 26 | +$im = ImageCreate($img_largura, $img_altura); | |
| 27 | +// Fundo cinza para a imagem (igual ao fundo do cabecalho) | |
| 28 | +$bg = ImageColorAllocate($im, 207, 207, 205); | |
| 29 | + | |
| 30 | +// borda cinza | |
| 31 | +$border = ImageColorAllocate($im, 207, 199, 199); | |
| 32 | +ImageRectangle($im, 0, 0, $img_largura - 1, $img_altura - 1, $border); | |
| 33 | + | |
| 34 | +// Cor da fonte em preto | |
| 35 | +$textcolor = ImageColorAllocate($im, 0, 0, 0); | |
| 36 | + | |
| 37 | +// coloca o texto na imagem | |
| 38 | +$image_string = imageStringUp ( $im, $font, 0, $img_altura-1, $text, $textcolor ); | |
| 39 | + | |
| 40 | +// Escreve a imagem | |
| 41 | +header("Content-type: image/png"); | |
| 42 | +ImagePNG($im); | |
| 43 | +ImageDestroy($im); | |
| 44 | +?> | ... | ... |