public function actionMostrar() { $resultado = $_GET['id_matriz']; $matriz = Matriz::model()->findByPk($resultado); $niveles = Nivel::model()->findAll(); $aspecto = Aspecto::model()->findAllByAttributes(array('id_matriz' => $matriz->id_matriz)); if (count($aspecto) != 0) { $count = count($niveles); $div = '<br /><br /><center>' . $matriz->nombre_matriz . '</center><br />'; $div .= '<table class="normal" style="padding-left:40px"><tr> <th>Aspectos</th>'; foreach ($niveles as $data) { $div .= '<th>' . $data->nombre_nivel . '</th>'; } $div .= '</tr>'; foreach ($aspecto as $data2) { $div .= '<tr><td>' . $data2->nombre_aspecto . '</td>'; $caracteristica = Caracteristica::model()->findAllByAttributes(array('id_aspecto' => $data2->id_aspecto)); foreach ($caracteristica as $data3) { $div .= '<td><a href="#" title="' . $data3->definicion_caracteristica . '">' . $data3->nombre_caracteristica . '</a></td>'; } $div .= '</tr>'; } $div .= '</table>'; } else { $div = '<br /><br /><center><p><b>**Matriz sin aspectos**</b></p></center>'; } $return['message'] = $div; echo json_encode($return); }
echo $form->labelEx($model, 'descripcion_pregunta'); ?> <?php echo $form->textField($model, 'descripcion_pregunta', array('size' => 60, 'maxlength' => 600)); ?> <?php echo $form->error($model, 'descripcion_pregunta'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_caracteristica'); ?> <?php echo $form->dropDownList($model, 'id_caracteristica', CHtml::listData(Caracteristica::model()->findAll(), 'id_caracteristica', 'nombre_caracteristica'), array('multiple' => true)); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_aspecto'); ?> <?php echo $form->dropDownList($model, 'id_aspecto', CHtml::listData(Aspecto::model()->findAll(), 'id_aspecto', 'nombre_aspecto')); ?> </div> <div class="row">
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Caracteristica the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Caracteristica::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }