Hola les paso un codigo de un componente de encuestas para joomla, lo que quiero hacer es que la 2da etapa, pueda tener un estilo personalizado, osea cambiar el sufijo generalizado que le da el codigo, ya que si tengo que cambiar ese estilo en el template_css.css de Joomla, cambia en todos los componentes, entonces quiero ponerle otra clase=" otro nombre y no que lo tome de algun lugar "
El codigo que quiero reemplazar es este:
<tr class="
<?php echo $tabclass_arr[$tabcnt];?>">
Desde ya quiero saber de donde saca el tabclass_arr ?? de la base de datos cierto???Bueno el tema es que yo dejo la clase de esta manera y no funciona:
<tr class="
mi estilo">
No soy experto pero creo que en la 2da etapa hay que declarar algo que falta... ayuda?? gracias...
El codigo completo es este: Código PHP:
<?php
/**
* @version $Id: poll.html.php 10002 2008-02-08 10:56:57Z willebil $
* @package Joomla
* @subpackage Polls
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license [url]http://www.gnu.org/licenses/gpl-2.0.html[/url] GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
/**
* @package Joomla
* @subpackage Polls
*/
class poll_html {
function showResults( &$poll, &$votes, $first_vote, $last_vote, $pollist, $params ) {
global $mosConfig_live_site;
?>
<script type = "text/javascript">
<!--
var link = document.createElement('link');
link.setAttribute('href', 'components/com_poll/poll_bars.css');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
var head = document.getElementsByTagName('head').item(0);
head.appendChild(link);
//-->
</script>
<form action="index.php" method="post" name="poll" id="poll">
<?php
if ( $params->get( 'page_title' ) ) {
?>
<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo $params->get( 'header' ); ?>
</div>
<?php
}
?>
<table width="100%" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>">
<tr>
<td align="center">
<table class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>">
<tr>
<td align="left">
<?php echo _SEL_POLL; ?>
</td>
<td align="left">
<?php echo $pollist; ?>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php
if ($votes) {
$j=0;
$data_arr["text"]=null;
$data_arr["hits"]=null;
$data_arr['voters']=null;
foreach ($votes as $vote) {
$data_arr["text"][$j]=trim($vote->text);
$data_arr["hits"][$j]=$vote->hits;
$data_arr["voters"][$j]=$vote->voters;
$j++;
}
?>
<tr>
<td>
<?php
poll_html::graphit( $data_arr, $poll->title, $first_vote, $last_vote );
?>
</td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<?php
// displays back button
mosHTML::BackButton ( $params );
?>
</form>
<?php
}
function graphit( $data_arr, $graphtitle, $first_vote, $last_vote ) {
global $mosConfig_live_site, $polls_maxcolors, $tabclass,
$polls_barheight, $polls_graphwidth, $polls_barcolor;
$tabclass_arr = explode( ",", $tabclass );
$tabcnt = 0;
$colorx = 0;
$maxval = 0;
array_multisort( $data_arr["hits"], SORT_NUMERIC,SORT_DESC, $data_arr["text"] );
foreach($data_arr["hits"] as $hits) {
if ($maxval < $hits) {
$maxval = $hits;
}
}
?>
<br />
<table class="pollstableborder" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2" class="sectiontableheaderabelpolls">
<img src="<?php echo $mosConfig_live_site; ?>/components/com_poll/images/poll.png" align="top" border="0" width="18" height="18" alt="" />
<?php echo $graphtitle; ?>
</td>
</tr>
<?php
for ($i=0, $n=count($data_arr["text"]); $i < $n; $i++) {
$text = &$data_arr["text"][$i];
$hits = &$data_arr["hits"][$i];
$sumval = &$data_arr['voters'][$i];
if ($maxval > 0 && $sumval > 0) {
$width = ceil( $hits*$polls_graphwidth/$maxval );
$percent = round( 100*$hits/$sumval, 1 );
} else {
$width = 0;
$percent = 0;
}
?>
<tr class="<?php echo $tabclass_arr[$tabcnt];?>">
<td width='100%' colspan='2'>
<b><?php echo stripslashes($text); ?></b>
</td>
</tr>
<tr class="<?php echo $tabclass_arr[$tabcnt];?>">
<td>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr class='abelpolls'>
<td align="right" width="25">
<b>
<?php echo $hits; ?>
</b>
</td>
<td align="left" width="2">
</td>
<td width="30" align="left">
<?php echo $percent; ?>%
</td>
<?php
$tdclass='';
if ($polls_barcolor==0) {
if ($colorx < $polls_maxcolors) {
$colorx = ++$colorx;
} else {
$colorx = 1;
}
$tdclass = "polls_color_".$colorx;
} else {
$tdclass = "polls_color_".$polls_barcolor;
}
?>
<td width="300" align="left">
<div align="left">
<img src='<?php echo $mosConfig_live_site; ?>/components/com_poll/images/blank.png' class='<?php echo $tdclass; ?>' height='<?php echo $polls_barheight; ?>' width='<?php echo $width; ?>' alt="" />
</div>
</td>
</tr>
</table>
</td>
</tr>
<?php
$tabcnt = 1 - $tabcnt;
}
?>
</table>
<br />
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td class='smalldark'>
<?php echo _NUM_VOTERS; ?>
</td>
<td class='smalldark'>
:
<?php echo $sumval; ?>
</td>
</tr>
<tr>
<td class='smalldark'>
<?php echo _FIRST_VOTE; ?>
</td>
<td class='smalldark'>
:
<?php echo $first_vote; ?>
</td>
</tr>
<tr>
<td class='smalldark'>
<?php echo _LAST_VOTE; ?>
</td>
<td class='smalldark'>
:
<?php echo $last_vote; ?>
</td>
</tr>
</table>
<?php
}
}
?>