/**
  * Returns a new NotificacionQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return    NotificacionQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof NotificacionQuery) {
         return $criteria;
     }
     $query = new NotificacionQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
<?php

//echo "sarasa1";die;
error_reporting(E_ALL);
ini_set("display_errors", 1);
include_once "../../data/config.php";
$notificaciones = NotificacionQuery::create()->filterById_receptor($_SESSION['userid'])->find();
if ($_GET['verleid'] == "n") {
    $notificaciones = NotificacionQuery::create()->filterByLeido("n")->filterById_receptor($_SESSION['userid'])->find();
} else {
    $checked = "checked";
    $notificaciones = NotificacionQuery::create()->filterById_receptor($_SESSION['userid'])->find();
}
//print_r($notificaciones->toArray());die;
?>

<div class="box">
    <div class="box-header"><h3 class="box-title">Notificaciones</h3></div>
    <div class="box-body">
        <input <?php 
echo $checked;
?>
 type="checkbox" id="listado_notificaciones_ver_leidos" value="s" onclick="listadonotificacionesverleidos()"> Ver notificaciones leidas
        <table id="lista_notificaciones" class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>Descripcion</th>
                    <th>Emisor</th>
                    <th>Leido</th>
                </tr>
            </thead>
Example #3
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Usuario is new, it will return
  * an empty collection; or if this Usuario has previously
  * been saved, it will retrieve related NotificacionsRelatedById_receptor 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 Usuario.
  *
  * @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 Notificacion[] List of Notificacion objects
  */
 public function getNotificacionsRelatedById_receptorJoinTipo_notificacion($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $query = NotificacionQuery::create(null, $criteria);
     $query->joinWith('Tipo_notificacion', $join_behavior);
     return $this->getNotificacionsRelatedById_receptor($query, $con);
 }
<?php

error_reporting(E_ALL);
ini_set("display_errors", 0);
include_once "../../data/config.php";
//echo "<pre>";print_r(json_decode($_POST['json']));  echo "</pre>";
$datos = json_decode($_POST['json']);
//$libros = LibroQuery::create()->find();
//$usuarios = UsuarioQuery::create()->find();
switch ($datos->accion) {
    case "marcar_leida":
        //Edit
        $notificacion = NotificacionQuery::create()->findOneById($datos->id);
        $notificacion->setLeido("s");
        $notificacion->save();
        break;
}
function guardarNotificacion($idReceptor, $descripcion, $idTipoNotif)
{
    $notificacion = new Notificacion();
    $notificacion->setId_emisor($_SESSION['userid']);
    $notificacion->setId_receptor($idReceptor);
    $notificacion->setDescripcion($descripcion);
    $notificacion->setId_tipo_notificacion($idTipoNotif);
    $notificacion->setLeido("n");
    $notificacion->save();
    //echo json_encode(array( 'error' => 0, 'respuesta' => "Notificacion guardada correctamente"));
    return true;
}
 /**
  * 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(NotificacionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = NotificacionQuery::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;
     }
 }
Example #6
0
//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><a href='#' onclick=\"refreshDivs('cuerpocentro','pages/layout/perfillibro.php','id=" . $reg->getId() . "')\">" . $reg->getNombre() . "</a></li>";
}
$clasificados = ClasificadosQuery::create()->limit(5)->find();
$listaClasificados = "";
foreach ($clasificados as $reg) {
    $listaClasificados .= "<li><a href='#' onclick = \"refreshDivs('cuerpocentro','pages/layout/clasificados_lista.php');formateartabla();\">" . $reg->getTexto_corto() . "</a></li>";
}
$notificaciones = NotificacionQuery::create()->limit(5)->find();
$listaNotificaciones = "";
foreach ($notificaciones as $reg) {
    $listaNotificaciones .= "<li><a href='#'>" . $reg->getDescripcion() . "</a></li>";
}
//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 with-border">
                            <h3 class="box-title">' . $categ->getDescrp() . '</h3>
                        </div>
                        <div class="box-body">