/**
  * Returns a new AudiolibroQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return    AudiolibroQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof AudiolibroQuery) {
         return $criteria;
     }
     $query = new AudiolibroQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
예제 #2
0
<?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>
예제 #3
0
//$libros = LibroQuery::create()->find();
//$usuarios = UsuarioQuery::create()->find();
switch ($_POST["accion"]) {
    case "e":
        //Edit
        $audiolibroObj = AudiolibroQuery::create()->findOneBy($_POST["id"]);
        //$usuarioObj = UsuarioQuery::create()->findOneById($datos->id);
        //echo $usuarioObj->toArray();
        $audiolibroObj->setNombre($_POST["nombreaudio"]);
        //$audiolibroObj->setHash($datosaudio->hasharchivo);
        $audiolibroObj->save();
        echo json_encode(array('error' => 0, 'msg' => "Audiolibro modificado correctamente"));
        break;
    case "d":
        //Delete
        $audiolibroObj = AudiolibroQuery::create()->findOneBy($_POST["id"]);
        //$objTerapia = TerapiasQuery::create()->findOneById($_GET["id"]);
        if ($audiolibroObj != null) {
            $audiolibroObj->delete();
        }
        echo json_encode(array('error' => 0, 'msg' => "Audiolibro borrado correctamente"));
        break;
    case "n":
        //New
        $audiolibroObj = new Audiolibro();
        $audiolibroObj->setNombre($_POST["nombreaudio"]);
        $audiolibroObj->setIdlibro($_POST["vinculolibro"]);
        $audiolibroObj->save();
        $idLibro = $audiolibroObj->getId();
        // obtenemos los datos del archivo
        $tamano = $_FILES["mp3"]['size'];
예제 #4
0
//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);
$idLibro = $_GET['id'];
$libro = LibroQuery::create()->findOneById($idLibro);
if ($libro->getDebaja() != NULL) {
    echo "<h1>El libro al que esta intentando acceder se encuentra bloqueado por el administrador</h1>";
    die;
}
$audiolibros = AudiolibroQuery::create()->filterByIdlibro($idLibro)->find();
//obtengo la puntuación del libro
$puntaje = 0;
$calificacionLibro = CalificacionQuery::create()->filterById_libro($idLibro)->find();
foreach ($calificacionLibro as $reg) {
    $puntaje += $reg->getPuntuacion();
}
$cantidadVotos = $calificacionLibro->count();
if ($cantidadVotos != 0) {
    $promedioPuntaje = round($puntaje / $cantidadVotos, 1);
}
$votoPropio = CalificacionQuery::create()->filterById_libro($idLibro)->filterById_usuario($idusuario)->find()->count();
//echo $libro->getEs_editable();
//$options = "<option value = ''>Seleccione un libro</option> ";
$listaaudios = "";
//$arr=array();
예제 #5
0
 /**
  * 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(AudiolibroPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = AudiolibroQuery::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;
     }
 }
 /**
  * Get the associated Audiolibro object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Audiolibro The associated Audiolibro object.
  * @throws     PropelException
  */
 public function getAudiolibro(PropelPDO $con = null)
 {
     if ($this->aAudiolibro === null && $this->id_audiolibro !== null) {
         $this->aAudiolibro = AudiolibroQuery::create()->findPk($this->id_audiolibro, $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->aAudiolibro->addLista_audiolibros($this);
         		 */
     }
     return $this->aAudiolibro;
 }
예제 #7
0
 /**
  * Returns the number of related Audiolibro objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Audiolibro objects.
  * @throws     PropelException
  */
 public function countAudiolibros(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if (null === $this->collAudiolibros || null !== $criteria) {
         if ($this->isNew() && null === $this->collAudiolibros) {
             return 0;
         } else {
             $query = AudiolibroQuery::create(null, $criteria);
             if ($distinct) {
                 $query->distinct();
             }
             return $query->filterByLibro($this)->count($con);
         }
     } else {
         return count($this->collAudiolibros);
     }
 }
예제 #8
0
 function traerAudiolibros($busqueda)
 {
     $audiolibroObj = AudiolibroQuery::create()->findOneBy($_POST["id"]);
 }