function stop() { if ($this->estado == 1) { //solo se puede parar si esta en curso //obtener el tiempo en curso de la tarea actual $tiempo = new Tiempo(); $db = new conexion(); $sql = "SELECT * FROM " . $tiempo->tabla . " \n\t\t\t\t\t\tWHERE id_tarea = " . $this->id . " AND \n\t\t\t\t\t\t\t\tfin = '0000-00-00 00:00:00'"; $t = $db->select($sql); $tiempo2 = new Tiempo($t[0]['id']); $tiempo2->parar(); $this->setEstado(0); $this->dbsave(); return $this->getTiempos(); } }