<?php //die; error_reporting(E_ALL); ini_set("display_errors", 1); include_once "../../data/config.php"; //echo "<pre>"; print_r($_GET); echo "</pre>"; if (array_key_exists("id", $_GET)) { $libros = LibroQuery::create()->findOneById($_GET['id']); $nombreLibro = $libros->getNombre(); //echo "<pre>"; print_r($libros->getTexto()); echo "</pre>";die; $filename = SITE_PATH . "/libros/libro_" . $_GET['id'] . ".txt"; if (file_exists($filename)) { $texto = file_get_contents($filename); $texto = base64_decode($texto); } else { $texto = ""; } $idlibro = $_GET['id']; } else { $nombreLibro = ""; $texto = ""; $idlibro = ""; } ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
/** * Get the associated Libro object * * @param PropelPDO Optional Connection object. * @return Libro The associated Libro object. * @throws PropelException */ public function getLibro(PropelPDO $con = null) { if ($this->aLibro === null && $this->id_libro !== null) { $this->aLibro = LibroQuery::create()->findPk($this->id_libro, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aLibro->addSlider_maes($this); */ } return $this->aLibro; }
<?php //die; error_reporting(E_ALL); ini_set("display_errors", 1); include_once "../../data/config.php"; //$libros = LibroQuery::create()->findOneById($_GET['id']); //$usuarios = UsuarioQuery::create()->find(); $idusuario = $_SESSION['userid']; $usuario = UsuarioQuery::create()->findOneById($idusuario); $audiolibros = AudiolibroQuery::create()->find(); $idLibro = $_GET['id']; $libro = LibroQuery::create()->findOneById($idLibro); //echo $libro->getEs_editable(); //$options = "<option value = ''>Seleccione un libro</option> "; $listaaudios = ""; //$arr=array(); foreach ($audiolibros as $reg) { //if(!array_key_exists($reg->getId(), $arr)){ //$arr[$reg->getId()] = ""; $listaaudios .= "<li>" . $reg->getNombre() . "</li>"; //$options .= "<option value = '".$reg->getId()."'>".$reg->getNombre()."</option> "; //$options .= "<option value = '".$reg->getId()."'>".$reg->getNombre()."</option> "; //$options .= "<option value = '".$reg->getId()."'>".$reg->getNombre()."</option> "; //} } //echo $listaLibros; //$listaLibros = ""; //$libros = LibroQuery::create()->find(); ?> <table>
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Genero is new, it will return * an empty collection; or if this Genero has previously * been saved, it will retrieve related Libros from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in Genero. * * @param Criteria $criteria optional Criteria object to narrow the query * @param PropelPDO $con optional connection object * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array Libro[] List of Libro objects */ public function getLibrosJoinUsuarioRelatedById_usuario($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = LibroQuery::create(null, $criteria); $query->joinWith('UsuarioRelatedById_usuario', $join_behavior); return $this->getLibros($query, $con); }
<?php //die; error_reporting(E_ALL); ini_set("display_errors", 1); include_once "../../data/config.php"; $libros = LibroQuery::create()->filterById_usuario($_SESSION['userid'])->filterByEs_editable("s")->find(); //$usuarios = UsuarioQuery::create()->find(); $misproyectos = Libro_colaboradorQuery::create()->filterByIdusuario($_SESSION['userid'])->find(); //filterByIdusuario($_SESSION['userid']); //$listaLibros = ""; ?> <!DOCTYPE HTML> <html> <head> <title>Proyecto lectura</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <!---start-wrap---->
file_put_contents(SITE_PATH . "/libros_version/libro_" . $idLibro . "_" . $libroVersion->getId() . ".txt", base64_decode($datos->texto)); echo json_encode(array('msg' => "Libro guardado correctamente", 'idlibro' => $idLibro)); break; case "marcarActividad": $fecha = date("Y-m-d"); $hora = date("h:i:s"); $libroObj = LibroQuery::create()->findOneById($datos->idlibro); $libroObj->setFecha_ult_acc($fecha); $libroObj->setHora_ult_acc($hora); $libroObj->setUsuario_ult_acc($_SESSION['userid']); $libroObj->save(); echo json_encode(array('fecha' => $fecha . " " . $hora)); break; case "VerificarActividad": $fechaActual = date("Y-m-d"); $horaActual = date("h:i:s"); $libroObj = LibroQuery::create()->findOneById($datos->idlibro); $usuario = $libroObj->getUsuario()->getNombre(); //diferencia $desde = $libroObj->getFecha_ult_acc() . " " . $libroObj->getHora_ult_acc(); $hasta = $fechaActual . " " . $horaActual; $segundos = strtotime($hasta) - strtotime($desde); $diferencia_minutos = intval($segundos / 60); echo json_encode(array('diferencia_minutos' => $diferencia_minutos, 'usuario_bloqueador' => $libroObj->getUsuario()->getNombre())); break; case "vistaPrevia": $texto = file_get_contents(SITE_PATH . "/libros/libro_" . $datos->idlibro . ".txt"); $html = base64_decode($texto); echo json_encode(array('html' => $html)); break; }
<?php error_reporting(E_ALL); ini_set("display_errors", 1); include_once "../../data/config.php"; $libros = LibroQuery::create()->find(); //$libros = LibroQuery::create()->findOneById(1); //$libros->getId(); //$libros->getNombre(); $listaLibros = '<option value = "">Seleccione un libro</option>'; foreach ($libros as $reg) { $listaLibros .= '<option value = "' . $reg->getId() . '">' . $reg->getNombre() . '</option>'; } $clasificados = ClasificadosQuery::create()->find(); //$clasificados->getTexto_corto(); ?> <div class="section group" id="formulario_clasificados"> <div class="box box-default box-solid collapsed-box"> <!--box box-warning--> <div class="box-header with-border"> <h3 class="box-title" id="titulo_formulario">Nuevo clasificado (para que otros usuarios colaboren en su proyecto)</h3> <div class="box-tools pull-right"> <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button> </div><!-- /.box-tools --> </div><!-- /.box-header --> <div class="box-body" > <input type="hidden" id="accion" value="n"/> <input type="hidden" id="id" value=""/> <div class="form-group"> <label>Texto corto</label> <input type="text" class="form-control" placeholder="Texto corto" id="texto_corto"> </div>
} $promedioPuntaje = round($puntaje / $calificacionLibro->count(), 1); $html = "<b>Puntaje actual: " . $promedioPuntaje . " <a href='#' title='Puntaje actual " . $promedioPuntaje . "'>★</a></b>"; echo json_encode(array('html' => $html)); break; case "bloquear": $libro = LibroQuery::create()->findOneById($datos->libro); $libro->setDebaja("s"); include 'notificacion_data.php'; $mesajeNotificacion = "Tu libro '" . $libro->getNombre() . "' ha sido bloqueado por el administrador."; guardarNotificacion($libro->getId_usuario(), $mesajeNotificacion, 9); $libro->save(); echo json_encode(array('msg' => "Libro bloqueado correctamente.")); break; case "verificar": $libro = LibroQuery::create()->findOneById($datos->libro); $libro->setEstado("v"); include 'notificacion_data.php'; $mesajeNotificacion = "<span onclick=\"refreshDivs('cuerpocentro','pages/layout/perfillibro.php?id=" . $datos->libro . "')\">Tu libro '" . $libro->getNombre() . "' ha sido marcado como verificado por el administrador.</span>"; guardarNotificacion($libro->getId_usuario(), $mesajeNotificacion, 10); $libro->save(); echo json_encode(array('msg' => "Libro verificado correctamente.")); break; case "nuevo_comentario": $comentario = new Comentario(); $comentario->setId_usuario($_SESSION['userid']); $comentario->setId_libro($datos->libro); $comentario->setComentario($datos->comentario); $comentario->save(); echo json_encode(array('error' => 0, 'msg' => "Comentario ingresado correctamente ")); break;
<?php //die; error_reporting(E_ALL); ini_set("display_errors", 1); include_once "../../data/config.php"; //include("perfilpublico"); //include("perfilprivado"); //refreshDivs('cuerpocentro','pages/layout/perfilsesion.php', 'id=".$reg->getId()."')\ $idusuario = $_SESSION['userid']; //$libros = LibroQuery::create()->find(); //$usuarios = UsuarioQuery::create()->find(); //$audiolibros = AudiolibroQuery::create()->find(); $libros = LibroQuery::create()->filterById_usuario($idusuario)->find(); //$libros= LibroQuery::create()->findOneById($idLibro); $usuario = UsuarioQuery::create()->findOneById($idusuario); $user = UsuarioQuery::create()->find(); // ES PARA LLAMAR TODOS LOS USUARIOS //$options = "<option value = ''>Seleccione un libro</option> "; //$arr=array(); ?> <div class="wrappers"> <!-- Content Wrappers. Contains page content --> <div class="content-wrappers"> <section class="content"> <div class="row"> <div class="col-md-3"> <!-- Perfil general con imagen --> <div class="box box-primary">
<?php //die; error_reporting(E_ALL); ini_set("display_errors", 1); include_once "data/config.php"; $libros = LibroQuery::create()->limit(5)->find(); $listaLibros = ""; foreach ($libros as $reg) { $listaLibros .= "<li>" . $reg->getNombre() . "</li>"; } //$sliderItem = Slider_maeQuery::create()->findOneById(1); //$sliderItem->getLibro()->getImage(); //$sliderItem->getLibro()->getNombre(); //Armo los slider $categoriasSlider = Slider_categQuery::create()->limit(4)->find(); $sliders = ""; foreach ($categoriasSlider as $categ) { $sliderMae = Slider_maeQuery::create()->filterById_categoria($categ->getId())->find(); $sliders .= '<div class="col-md-3"> <div><!-- class="box box-solid"--> <div class="box-header"> <h3 class="box-title">' . $categ->getDescrp() . '</h3> </div> <div class="box-body"> <div id="carousel-example-generic-' . $categ->getId() . '" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> '; $pos = 0; $active = ' class="active"'; foreach ($sliderMae as $sliderItem) {
// $audiolibroObj->setHash($datosaudio->hasharchivo); //echo $hasharchivo; // guardamos el archivo a la carpeta files $destino = "../../pdf/" . $idPdf . '.pdf'; if (copy($_FILES['pdf']['tmp_name'], $destino)) { //$status = "Archivo subido: ".$archivo.""; $status = "Libro subido correctamente"; //header('Location: subirmp3.php?upload=1'); } else { $status = "Error al subir el PDF"; } } else { $status = "Error al subir el PDF"; } echo $status; break; case "obtener_datos": $libro = LibroQuery::create()->findOneById($_POST["id"]); //echo $clasificadosObj->toArray(); echo json_encode(array('nombre' => $libro->getNombre(), 'genero' => $libro->getId_genero(), 'autor' => $libro->getAutor(), 'sinopsis' => $libro->getSinopsis(), 'privacidad' => $libro->getId_privacidad())); break; case "publicar_libro": $generar_fisico = "s"; $idlibro = $_POST["id"]; include 'generarlibropdf.php'; $libro = LibroQuery::create()->findOneById($_POST["id"]); $libro->setEs_editable("n"); $libro->save(); echo json_encode(array('msg' => 'Libro publicado correctamente')); break; }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(LibroPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = LibroQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $con->commit(); $this->setDeleted(true); } else { $con->commit(); } } catch (Exception $e) { $con->rollBack(); throw $e; } }
<?php //die; error_reporting(E_ALL); ini_set("display_errors", 1); include_once "../../data/config.php"; $idusuario = $_SESSION['userid']; $usuario = UsuarioQuery::create()->findOneById($idusuario); //$libros = LibroQuery::create()->find(); $libros = LibroQuery::create()->filterByDebaja(NULL)->find(); //$libros = LibroQuery::create()->findOneById(1); //$usuarios = UsuarioQuery::create()->find(); $generos = GeneroQuery::create()->find(); $options = "<option value = ''>Seleccione un genero</option> "; //$listaLibros = ""; foreach ($generos as $reg) { //$listaGeneros .= "<li>".$reg->getNombre()."</li>"; //$options .= "<option value = '".$reg->getId()."'>".$reg->getNombre()."</option> "; //$options .= "<option value = '".$reg->getId()."'>".$reg->getNombre()."</option> "; $options .= "<option value = '" . $reg->getId() . "'>" . $reg->getNombre() . "</option> "; } $privacidad = PrivacidadQuery::create()->orderById("DESC")->find(); foreach ($privacidad as $reg) { //$listaGeneros .= "<li>".$reg->getNombre()."</li>"; //$options .= "<option value = '".$reg->getId()."'>".$reg->getNombre()."</option> "; //$options .= "<option value = '".$reg->getId()."'>".$reg->getNombre()."</option> "; $privacidadopcion .= "<option value = '" . $reg->getId() . "'>" . $reg->getNombre() . "</option> "; } //echo $listaGeneros; ?>