Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/10/2013, 09:10
LissT
 
Fecha de Ingreso: octubre-2013
Ubicación: Ecuador
Mensajes: 5
Antigüedad: 10 años, 6 meses
Puntos: 0
Array con Html

Por favor necesito que me ayuden con el siguiente codigo, lo que necesito es mostrar los datos del array en html: pero al ejecutar el codigo solo me muestra un dato de todos los satos que tengo en el array:
public function executeShowResult(dmWebRequest $request)
{
$query = $this->getShowQuery();
$test = Doctrine::getTable('Test')
->createQuery('t')
->select('COUNT(tr.value) val_voted,t.name,s.name,e.name,tr.value')
->innerJoin('t.TestResult tr')
->innerJoin('tr.Stimulus s')
->innerJoin('tr.Emotion e')
->where('t.id = ?', $request->getParameter('test'))
->groupBy('s.name, e.name, tr.value')
->orderBy('s.id, e.id, tr.value')
->execute();

$result = array();
foreach ($test as $item) //n1
{
$result[$item->name] = array(); //n2
foreach ($item->getTestResult() as $tr) //n3

{
if(!isset($result[$item->name][$tr->getStimulus()->name]))
$result[$item->name][$tr->getStimulus()->name]= array(
1=>array(),
2=>array(),
3=>array(),
4=>array(),
5=>array(),
);
}
$result[$item->name][$tr->getStimulus()->name][$tr->value][$tr->getEmotion()->name] = $tr->val_voted;
//$result[$item->name][$tr->getStimulus()->name][$tr->value] = $tr->val_voted;
}


// echo('<pre>');
//die(print_r($result));
// $this->test1 = $result;
//echo('</pre>');


$html= '<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">';
foreach ($test as $result=> $a){
$html.= '<tr>';
$html.= '<td>'.$result->name[].'</td>';
$html.= '<td>'.$tr->getStimulus()->name .'</td>';
$html.= '<td>'.$tr->value .'</td>';
$html.= '<td>'.$tr->getEmotion()->name.'</td>';
$html.= '<td>'.$tr->val_voted.'</td>';
$html.= '</tr>';
}

$html.='</table>';
echo $html.'<br>';

}
}



el array es el siguiente:

Array
(
[celular] => Array
(
["Cholular"] => Array
(
[1] => Array
(
[Deseo] => 1
)

[2] => Array
(
[Aceptación] => 1
)

[3] => Array
(
[Satisfaccion] => 1
[Inspiracion] => 1
[Sorpresa Agradable] => 1
[Interes] => 1
[Rechazo] => 1
[Disgusto] => 1
[Verguenza] => 1
[Susto] => 1
)

[4] => Array
(
)

[5] => Array
(
)

)

[Diem] => Array
(
[1] => Array
(
)

[2] => Array
(
)

[3] => Array
(
[Deseo] => 1
[Aceptación] => 1
[Satisfaccion] => 1
[Inspiracion] => 1
[Sorpresa Agradable] => 1
[Interes] => 1
[Rechazo] => 1
)

[4] => Array
(
)

[5] => Array
(
)

)

)

)
1
y lo unico que se muestra en el html es lo siguiente:
Test 1 Diem 3 Rechazo 1