Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/05/2011, 12:33
jajigos
 
Fecha de Ingreso: mayo-2011
Mensajes: 1
Antigüedad: 13 años, 7 meses
Puntos: 0
Información Error con modulo mod_prop_search_js en joomla

Buenas tardes, monte un modulo en joomla y me aparece en la pantalla el modulo funcionando con el siguiente error, Warning: Invalid argument supplied for foreach() in /home/********/public_html/libraries/joomla/html/html/select.php on line 68, que debo hacer para corregirlo?

Adjunto el codigo

1<?php
2/**
3* @version $Id: select.php 14401 2010-01-26 14:10:00Z louis $
4* @package Joomla.Framework
5* @subpackage HTML
6* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
7* @license GNU/GPL, see LICENSE.php
8* Joomla! is free software. This version may have been modified pursuant
9* to the GNU General Public License, and as distributed it includes or
10* is derivative of works licensed under the GNU General Public License or
11* other free or open source software licenses.
12* See COPYRIGHT.php for copyright notices and details.
13*/
14defined('JPATH_BASE') or die();
15/**
16* Utility class for creating HTML select lists
17 *
18* @static
19 * @package Joomla.Framework
20* @subpackage HTML
21* @since 1.5
22*/
23class JHTMLSelect
24{
25 /**
26 * @param string The value of the option
27 * @param string The text for the option28
28 * @param string The returned object property name for the value29
29 * @param string The returned object property name for the text
30 * @return object
31 */
32 function option( $value, $text='', $value_name='value', $text_name='text', $disable=false )
33 {
34 $obj = new stdClass;
35 $obj->$value_name = $value;
36 $obj->$text_name = trim( $text ) ? $text : $value;
37 $obj->disable = $disable;
38 return $obj;
39 }
40
41 /**
42 * @param string The text for the option
43 * @param string The returned object property name for the value
44 * @param string The returned object property name for the text
45 * @return object
46 */
47 function optgroup( $text, $value_name = 'value', $text_name = 'text' )
48 {
49 $obj = new stdClass;
50 $obj->$value_name = '<OPTGROUP>';
51 $obj->$text_name = $text;
52 return $obj;
53 }
54
55 /**
56 * Generates just the option tags for an HTML select list
57 *
58 * @param array An array of objects
59 * @param string The name of the object variable for the option value
60 * @param string The name of the object variable for the option text
61 * @param mixed The key that is selected (accepts an array or a string)
62 * @returns string HTML for the select list
63 */
64 function options( $arr, $key = 'value', $text = 'text', $selected = null, $translate = false )
65 {
66 $html = '';
67
68 foreach($arr as $i => $option)
69 {
70 $element =& $arr[$i]; // since current doesn't return a reference, need to do this
71
72 $isArray = is_array( $element );
73 $extra = '';
74 if ($isArray)
75 {
76 $k = $element[$key];
77 $t = $element[$text];
78 $id = ( isset( $element['id'] ) ? $element['id'] : null );
79 if(isset($element['disable']) && $element['disable']) {
80 $extra .= ' disabled="disabled"';
81 }
82 }
83 else
84 {
85 $k = $element->$key;
86 $t = $element->$text;
87 $id = ( isset( $element->id ) ? $element->id : null );
88 if(isset( $element->disable ) && $element->disable) {
89 $extra .= ' disabled="disabled"';
90 }
91 }
92
93 // This is real dirty, open to suggestions,
94 // barring doing a propper object to handle it
95 if ($k === '<OPTGROUP>') {
96 $html .= '<optgroup label="' . $t . '">';
97 } else if ($k === '</OPTGROUP>') {
98 $html .= '</optgroup>';
99 }
100 else
{
//if no string after hypen - take hypen out
$splitText = explode( ' - ', $t, 2 );
$t = $splitText[0];
if(isset($splitText[1])){ $t .= ' - '. $splitText[1]; }

//$extra = '';
//$extra .= $id ? ' id="' . $arr[$i]->id . '"' : '';
if (is_array( $selected ))
{
foreach ($selected as $val)
{
$k2 = is_object( $val ) ? $val->$key : $val;
if ($k == $k2)
{
$extra .= ' selected="selected"';
break;
}
}
} else {
$extra .= ( (string)$k == (string)$selected ? ' selected="selected"' : '' );
}

//if flag translate text
if ($translate) {
$t = JText::_( $t );
}

// ensure ampersands are encoded
$k = JFilterOutput::ampReplace($k);
$t = JFilterOutput::ampReplace($t);

$html .= '<option value="'. $k .'" '. $extra .'>' . $t . '</option>';
}
}

return $html;
}

/**
* Generates an HTML select list
*
* @param array An array of objects
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param string The name of the object variable for the option value
* @param string The name of the object variable for the option text
* @param mixed The key that is selected (accepts an array or a string)
* @returns string HTML for the select list
*/
function genericlist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false )
{
if ( is_array( $arr ) ) {
reset( $arr );
}

if (is_array($attribs)) {
$attribs = JArrayHelper::toString($attribs);
}

$id = $name;

if ( $idtag ) {
$id = $idtag;
}

$id = str_replace('[','',$id);
$id = str_replace(']','',$id);

$html = '<select name="'. $name .'" id="'. $id .'" '. $attribs .'>';
$html .= JHTMLSelect::Options( $arr, $key, $text, $selected, $translate );
$html .= '</select>';

return $html;
}

/**
* Generates a select list of integers
*
* @param int The start integer
* @param int The end integer
* @param int The increment
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @param string The printf format to be applied to the number
* @returns string HTML for the select list
*/
function integerlist( $start, $end, $inc, $name, $attribs = null, $selected = null, $format = "" )
{
$start = intval( $start );
$end = intval( $end );
$inc = intval( $inc );
$arr = array();

for ($i=$start; $i <= $end; $i+=$inc)
{
$fi = $format ? sprintf( "$format", $i ) : "$i";
$arr[] = JHTML::_('select.option', $fi, $fi );
}

return JHTML::_('select.genericlist', $arr, $name, $attribs, 'value', 'text', $selected );
}

/**
* Generates an HTML radio list
*
* @param array An array of objects
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @param string The name of the object variable for the option value
* @param string The name of the object variable for the option text
* @returns string HTML for the select list
*/
function radiolist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = null, $idtag = false, $translate = false )
{
reset( $arr );
$html = '';

if (is_array($attribs)) {
$attribs = JArrayHelper::toString($attribs);
}

$id_text = $name;
if ( $idtag ) {
$id_text = $idtag;
}

for ($i=0, $n=count( $arr ); $i < $n; $i++ )
{
$k = $arr[$i]->$key;
$t = $translate ? JText::_( $arr[$i]->$text ) : $arr[$i]->$text;
$id = ( isset($arr[$i]->id) ? @$arr[$i]->id : null);

$extra = '';
$extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : '';
if (is_array( $selected ))
{
foreach ($selected as $val)
{
$k2 = is_object( $val ) ? $val->$key : $val;
if ($k == $k2)
{
$extra .= " selected=\"selected\"";
break;
}
}
} else {
$extra .= ((string)$k == (string)$selected ? " checked=\"checked\"" : '');
}
$html .= "\n\t<input type=\"radio\" name=\"$name\" id=\"$id_text$k\" value=\"".$k."\"$extra $attribs />";
$html .= "\n\t<label for=\"$id_text$k\">$t</label>";
}
$html .= "\n";
return $html;
}

/**
* Generates a yes/no radio list
*
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
function booleanlist( $name, $attribs = null, $selected = null, $yes='yes', $no='no', $id=false )
{
$arr = array(
JHTML::_('select.option', '0', JText::_( $no ) ),
JHTML::_('select.option', '1', JText::_( $yes ) )
);
return JHTML::_('select.radiolist', $arr, $name, $attribs, 'value', 'text', (int) $selected, $id );
}
}


De antemano muchas Gracias por su colaboracion

Última edición por jajigos; 19/05/2011 a las 12:38