function Respuesta($id, $titulo, $margen) { $respuesta = Foro::model()->find("id = " . $id); ?> <li class="message message-reply animated bounceInRight" style="padding-left:<?php echo $margen; ?> px"> <img style="width:40px;" src="<?php echo $respuesta->usuario->foto != "" ? Yii::app()->baseUrl . '/fotos/' . $respuesta->usuario->foto : Yii::app()->baseUrl . '/themes/bootstrap/img/avatars/male.png'; ?> " class="online"> <span class="message-text"><strong><?php echo $respuesta->autor; ?> </strong> <br/> <h4><?php echo $respuesta->titulo; ?> </h4> <?php echo $respuesta->mensaje; ?> </span> <br/> <?php if (!Yii::app()->user->isGuest) { ?> <ul class="list-inline font-xs"> <li> <?php echo CHtml::link('<i class="fa fa-edit"></i> Editar', array('foro/update', 'id' => $respuesta->id), array("class" => "text-warning")); ?> </li> <?php if ($respuesta->estatus_did == 2) { ?> <li> <?php echo CHtml::link('<i class="fa fa-thumbs-o-up"></i> Publicar', array('foro/cambiarvisibilidad', 'id' => $respuesta->id, 'estatus' => 1, 'foro' => $_GET["id"]), array("class" => "text-warning")); ?> </li> <li> <?php echo CHtml::link('<i class="fa fa-thumbs-o-down"></i> Rechazar', array('foro/cambiarvisibilidad', 'id' => $respuesta->id, 'estatus' => 3, 'foro' => $_GET["id"]), array("class" => "text-warning")); ?> </li> <?php } else { if ($respuesta->estatus_did == 3) { ?> <li> <?php echo CHtml::link('<i class="fa fa-thumbs-o-up"></i> Publicar', array('foro/cambiarvisibilidad', 'id' => $respuesta->id, 'estatus' => 1, 'foro' => $_GET["id"]), array("class" => "text-warning")); ?> </li> <?php } else { if ($respuesta->estatus_did == 1) { ?> <li> <?php echo CHtml::link('<i class="fa fa-thumbs-o-down"></i> Rechazar', array('foro/cambiarvisibilidad', 'id' => $respuesta->id, 'estatus' => 3, 'foro' => $_GET["id"]), array("class" => "text-warning")); ?> </li> <?php } } } ?> <li class="pull-right"> <?php echo $respuesta->estatus_did == 1 ? '<span class="label label-success">Publicado</span>' : '<span class="label label-danger">No Publicado</span>'; ?> </li> </ul> <?php } ?> <?php $masrespuestas = Foro::model()->findAll("identificador = " . $id); if (count($masrespuestas) > 0) { $margen = $margen + 30; foreach ($masrespuestas as $masrespuesta) { Respuesta($masrespuesta->id, $masrespuesta->titulo, $margen); } } else { $margen -= 30; } ?> </li> <?php }
function Respuesta($id, $titulo, $margen) { $respuesta = Foro::model()->find("id = " . $id); ?> <li class="message message-reply animated bounceInRight" style="padding-left:<?php echo $margen; ?> px"> <img style="width:40px;" src="<?php echo $respuesta->usuario->foto != "" ? Yii::app()->baseUrl . '/administracion/fotos/' . $respuesta->usuario->foto : Yii::app()->baseUrl . '/administracion/themes/bootstrap/img/avatars/male.png'; ?> " class="online"> <span class="message-text"><strong><?php echo $respuesta->autor; ?> </strong> <br/> <h4><?php echo $respuesta->titulo; ?> </h4> <?php echo $respuesta->mensaje; ?> </span> <br/> <?php if (!Yii::app()->user->isGuest) { ?> <ul class="list-inline font-xs text-right"> <li> <?php echo CHtml::link('<i class="fa fa-reply"></i> Responder', array('foro/create', 'id' => $id, 'foro' => $_GET["id"]), array("class" => "text-success")); ?> </li> </ul> <?php } ?> <?php $masrespuestas = Foro::model()->findAll("estatus_did = 1 and identificador = " . $id); if (count($masrespuestas) > 0) { $margen = $margen + 30; foreach ($masrespuestas as $masrespuesta) { Respuesta($masrespuesta->id, $masrespuesta->titulo, $margen); } } else { $margen -= 30; } ?> </li> <?php }