public function actionUnidadNegocioMacroproceso() { $model = UnidadNegocioMacroproceso::model()->findAllByAttributes(array('id_macroproceso' => $_POST['idMacroproceso'])); $array = array(); foreach ($model as $value) { $unidadNegocio = UnidadNegocio::model()->findByPk($value->id_unidad_negocio); $array1 = array("id_unidad_negocio" => $unidadNegocio->id_unidad_negocio, "nombre" => $unidadNegocio->nombre); array_push($array, $array1); } $json = json_encode($array); echo $json; }
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete() { $id = $_POST['idDeleteMacroproceso']; $modelUnidadNegMacroproceso = UnidadNegocioMacroproceso::model()->findAllByAttributes(array('id_macroproceso' => $id)); if (count($modelUnidadNegMacroproceso) != 0) { foreach ($modelUnidadNegMacroproceso as $value) { $value->delete(); echo $value->nombre_responsable; } } $this->loadModel($id)->delete(); $this->redirect(array('default/index')); }
$unidadesNegocio = $unidadNegocio->findAll(); foreach ($unidadesNegocio as $value) { ?> <tr> <td> <?php echo $value->nombre; ?> </td> <td class="text-left"> <?php $unidadesNegocioMacroproceso = UnidadNegocioMacroproceso::model()->findAllByAttributes(array('id_unidad_negocio' => $value->id_unidad_negocio)); ?> <ul> <?php foreach ($unidadesNegocioMacroproceso as $value1) { $macroproceso = Macroproceso::model()->findByPk($value1->id_macroproceso); ?> <li><?php echo $macroproceso->nombre . ": " . $value1->nombre_responsable; ?> </li> <?php } ?>