Ejemplo n.º 1
0
 public function store()
 {
     if (parent::store()) {
         // para cada amigo que no tenga bloqueado, crear una notificacion de que escribí el mensaje.
         if ($amigos = perfil_amigo::get_todos_mis_seguidores()) {
             foreach ($amigos as $amigo) {
                 if ($amigo->get('bloqueo_destino') == false) {
                     $notificacion = new perfil_notificacion();
                     $notificacion->set('origen', $this);
                     $notificacion->set('destino', $amigo->get('origen'));
                     // al que lo origina, por eso es un seguidor!
                     $notificacion->set('fecha', new Date());
                     // si el usuario está tagueado en la foto, mandar un mensaje adicional.
                     $notificacion->set('tipo', new perfil_notificacion_tipo(3));
                     $notificacion->set('enviado', 0);
                     $notificacion->store();
                 }
             }
         }
         // lo agregamos para que salga en nuestro propio timeline.
         $notificacion = new perfil_notificacion();
         $notificacion->set('origen', $this);
         $notificacion->set('destino', $this->get('perfil'));
         $notificacion->set('fecha', new Date());
         $notificacion->set('tipo', new perfil_notificacion_tipo(3));
         $notificacion->set('enviado', 1);
         $notificacion->store();
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
 public function store()
 {
     global $ari;
     $is_new = true;
     if ($this->id > ID_UNDEFINED) {
         $is_new = false;
     }
     if (parent::store()) {
         // le mandamos una notificacion al destinatario de que lo estan siguiendo
         if ($is_new) {
             $notificacion = new perfil_notificacion();
             $notificacion->set('origen', $this->get('origen'));
             $notificacion->set('destino', $this->get('destino'));
             $notificacion->set('fecha', new Date());
             $notificacion->set('tipo', new perfil_notificacion_tipo(1));
             $notificacion->set('enviado', 0);
             $notificacion->store();
         }
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 3
0
 public function store()
 {
     $is_new = true;
     if ($this->id > ID_UNDEFINED) {
         $is_new = false;
     }
     if (parent::store()) {
         if (!$is_new) {
             // para cada seguidor no bloqueado, crear notificacion, el usuario ha actualizado sus datos de perfil.
             if ($amigos = perfil_amigo::get_todos_mis_seguidores()) {
                 foreach ($amigos as $amigo) {
                     if ($amigo->get('bloqueo_destino') == false) {
                         $notificacion = new perfil_notificacion();
                         $notificacion->set('origen', $this);
                         $notificacion->set('destino', $amigo->get('origen'));
                         $notificacion->set('fecha', new Date());
                         $notificacion->set('tipo', new perfil_notificacion_tipo(2));
                         $notificacion->set('enviado', 0);
                         $notificacion->store();
                     }
                 }
             }
         }
         return true;
     } else {
         return false;
     }
 }