public function actionEdit($id) { $model = Tareas::model()->findByPk($id); /* echo '<pre>'; print_r($_POST); echo '</pre>'; Yii::app()->end(); */ if (isset($_POST['Tareas'])) { $model->attributes = $_POST['Tareas']; //print_r($_POST); if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('edit', array('model' => $model)); }
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = Tareas::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php //include 'Usuarios.php'; //include 'Listas.php'; //$usuario = new Usuarios(); //$usuario -> add_user('egoitz','barrena'); //$lista = new Listas(); //$lista -> add_lista('lista1'); include 'Tareas.php'; $tarea = new Tareas(); $tarea->add_tarea('dsadsadsa', '1');
public function actionDelete($id) { $model = Tareas::model()->findByPk($id); $model->delete(); $this->redirect(array('index')); }
$resultados["contra"] = $usuarioLogueado["password"]; $proyecto = new Proyecto(); $proyecto->Listar($idUsuario); $max = count($proyecto->Listado); for ($i = 0; $i < $max; $i++) { $proFila = $proyecto->Listado[$i]; $idProyecto = $proFila["idProyecto"]; $entregas = new Entregas(); $entregas->Listar($idProyecto); $max2 = count($entregas->Listado); $resultados[$i] = array(['idProyecto' => utf8_encode($proFila["idProyecto"]), 'nombre' => utf8_encode($proFila["nombre"]), 'descripcion' => utf8_encode($proFila["descripcion"])]); for ($j = 0; $j < $max2; $j++) { $enFila = $entregas->Listado[$j]; $idEntrega = $enFila["idEntrega"]; $resultados[$i]["entregas"][$j] = array(['idEntrega' => utf8_encode($enFila["idEntrega"]), 'inicio' => utf8_encode($enFila["inicio"]), 'fechaEntrega' => utf8_encode($enFila["fechaEntrega"]), 'titulo' => utf8_encode($enFila["titulo"]), 'descripcion' => utf8_encode($enFila["descr"])]); $tareas = new Tareas(); $tareas->Listar($idEntrega); $max3 = count($tareas->Listado); for ($k = 0; $k < $max3; $k++) { $tarFila = $tareas->Listado[$k]; $idTarea = $tarFila["idTarea"]; //numero de comentarios $comentarios = new Comentario(); $comentarios->Listar($tarFila["idTarea"]); $max4 = count($comentarios->Listado); $resultados[$i]["entregas"][$j]["tareas"][$k] = array(['inicio' => $tarFila["inicio"], 'entrega' => utf8_encode($tarFila["entrega"]), 'progreso' => utf8_encode($tarFila["progreso"]), 'titulo' => utf8_encode($tarFila["titulo"]), 'descripcion' => utf8_encode($tarFila["descripcion"]), 'numComentarios' => $max4, 'idTarea' => utf8_encode($tarFila["idTarea"])]); } } } } else { $resultados["validacion"] = "error";
<?php include '../backend/classes/Conector.php'; include '../backend/classes/Proyecto.php'; include '../backend/classes/Tareas.php'; if (isset($_GET["idEntrega"])) { $idEntrega = $_GET["idEntrega"]; $entrega = new Tareas(); $entrega->ListarPorEntrega($idEntrega); $max = count($entrega->Listado); if (empty($max)) { echo "Esta entrega no tiene tareas"; } for ($i = 0; $i < $max; $i++) { $entregaFila = $entrega->Listado[$i]; echo '<li>'; //echo '<a href="http://localhost/SENIOR/frontend/loadTareas?idEntrega='.$entregaFila["idEntrega"].'">'; echo $entregaFila["titulo"]; //echo '</a>'; echo '</li>'; } } else { echo "no hay entregas para mostrar"; }