Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/12/2013, 13:18
emmaghost
 
Fecha de Ingreso: enero-2013
Mensajes: 68
Antigüedad: 11 años, 3 meses
Puntos: 0
imagen en vez de un texto

hola de nuevo :D

pues tengo el siguiente problema:

tengo un grid el cual metrae el dato de "activo e inactivo" lo que intento hacer es que cuando este inactivo se muestre una imagen roja (de semaforo) y cuando este activo muestre una verde el problema es que no lo eh logrado, estoy ocupando la clace de data grid que pusieron aqui mismo en fin pongo mi codigo:

Código PHP:
Ver original
  1. <?php
  2.         require_once 'Aco_DataGrid.php';
  3.         $id = $_GET['ID'];
  4.         $conexion = mysql_connect('localhost', 'root','');
  5.                     mysql_select_db('Almacenes', $conexion);  
  6.         $sql= "select * from dependencias where tipo = '$id' order by dependencia";    
  7.         $result=mysql_query("select * from dependencias where tipo = '$id' order by dependencia");
  8.         $campos = array(
  9.         'DEPENDENCIA' => 'dependencia',
  10.         'RESPONSABLE' => 'responsable',    
  11.         'CONTACTO' => 'contacto',
  12.         'ESTADO' => 'estado'
  13.         );
  14.         $grid = new Aco_DataGrid( $sql, $conexion, $campos );
  15.         $paginar_resultados = array( 0, 5, 3 );
  16.         $grid->add_FilaArriba( $contenidoF = 'ESCOGE UNA DEPENDENCIA PARA VER SU DAI-3', $alignF = 'center', $colspanF =20 );
  17.         $nombreGrid = "busqueda";
  18.         $grid->iniciar($sql, '', $campos,$nombreGrid,$paginar_resultados);
  19.         $campoEscogido=array('DEPENDENCIA' => '1');
  20.        
  21.                 while($row=mysql_fetch_array($result)){
  22.                 $activo = $row["estado"];
  23.                     if ("$activo" == "ACTIVO"){
  24.                                             $ruta = "imagenes/verde.jpg";
  25.                     }else{
  26.                                             $ruta = "imagenes/rojo.jpg";
  27.                     }
  28.                 }      
  29.         //$contenido = "<a href='redireccionando.php?DEPENDENCIA={1}'><img src='".$ruta."'width='50' height='50'/>;</a>";  
  30.         $contenido = "<a href='redireccionando.php?DEPENDENCIA={1}'>$activo</a>";  
  31.         $despuesDe ='ESTADO';      
  32.         $titulo = "SELECCIONA LA DEPENDENCIA";
  33.         $grid->add_ColumnaDespuesDe( $contenido, $campoEscogido, $despuesDe, $titulo);
  34.         $grid->grid_AtributosTabla(0,'cccccc','999999','','center');
  35.         $colores = array ( '#E5EECC', '#FFFFFF' );
  36.         $grid->grid_BgColorFC('#FFFFFF', $colores);
  37.         $grid->grid_WidthAndHeight(960,100);
  38.         $grid->grid_PacingAndPadding(4, 2);
  39. ?>
  40. <!DOCTYPE
  41. html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  42. <html xmlns="http://www.w3.org/1999/xhtml">
  43. <head>
  44. <meta http-equiv="Content-Type" content="text/html; charset= ISO-8859-1" />
  45. <title>SELECCIONA LA DELEGACION/ENTIDAD</title>
  46. <meta name="keywords" content="" />
  47. <meta name="description" content="" />
  48. <script language="JavaScript" type="text/javascript" src="../templates/Publish/SpryAssets/SpryCollapsiblePanel.js"></script>
  49.         <link href="default.css" rel="stylesheet" type="text/css" />
  50. <style type="text/css">
  51. body,td,th {
  52.     color: #333333;
  53. }
  54. body {
  55.     background-color: #FFFFFF;
  56. }
  57. #wrapper #header #logo h1 a {
  58.     color: #FF8000;
  59. }
  60. </style>
  61. </head>
  62. <body>
  63.   <div id="submenu">
  64.     <div align="center">
  65.       <table width="935" border="0" align="center" class="title">
  66.         <tr>
  67.            <td width="130"><img src="imagenes/angel.jpg" alt="" width="132" height="120" /></td>
  68.            <td width="340"><img src="imagenes/OM completo.PNG" alt="" width="342" height="124" /></td>
  69.            <td width="406"><img src="imagenes/OM_naranja.png" alt="" width="426" height="134" /></td>
  70.          </tr>
  71.       </table>
  72.     </div>
  73.   </div>
  74.   <div id="page" >
  75.     <div id="page-bgtop">
  76.       <div id="content">
  77.         <div class="post">
  78.        <div class="entry">
  79.             <p align="left">
  80.             <h2 class="title" align ="left"><a href="index.php">ATRAS</a></h2>    
  81.             </p>
  82.             <p align="center"><br>          
  83.               <?php
  84.                     $grid->gridMostrar();
  85.               ?>
  86.             </p>
  87.           </div>
  88.         </div>
  89.       </div>
  90.       <div style="clear: both; height: 0px"></div>
  91.     </div>
  92.   <div id="footer">
  93.     <p>Copyright &copy; 2013
  94.     Almacenes. All Rights Reserved. Designed by Ortega Twins.</p>
  95.     <p id="links"><a href="http://rmsg.df.gob.mx/precios/">M&aacute;s sobre OM</a> | <a href="#">Terms of Use</a></p>
  96.   </div>
  97. </div>
  98. </body>
  99. </html>