function inicializar()
 {
     // Titulo del template
     $this->asignar('accion_usuarios', "Modificación");
     // Cargar los datos del Usuario
     $usuario = new Usuario(intval($_GET['id']));
     $this->asignarArray($usuario->toArray());
     // Asigno clave vacia para que se pueda modificar
     $this->asignar('clave', "");
     // Roles
     $this->asignar('options_rol', ComboRol());
     // Seteo que el nombre de usuario no se pueda modificar
     $this->asignar('modificable', "readonly");
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Usuario_intereses'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Usuario_intereses'][$this->getPrimaryKey()] = true;
     $keys = Usuario_interesesPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getId_usuario(), $keys[2] => $this->getId_genero());
     if ($includeForeignObjects) {
         if (null !== $this->aUsuario) {
             $result['Usuario'] = $this->aUsuario->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aGenero) {
             $result['Genero'] = $this->aGenero->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Solicitud_amistad'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Solicitud_amistad'][$this->getPrimaryKey()] = true;
     $keys = Solicitud_amistadPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getId_usuario_solicitado(), $keys[2] => $this->getId_usuario_solicitante(), $keys[3] => $this->getestado());
     if ($includeForeignObjects) {
         if (null !== $this->aUsuarioRelatedById_usuario_solicitado) {
             $result['UsuarioRelatedById_usuario_solicitado'] = $this->aUsuarioRelatedById_usuario_solicitado->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUsuarioRelatedById_usuario_solicitante) {
             $result['UsuarioRelatedById_usuario_solicitante'] = $this->aUsuarioRelatedById_usuario_solicitante->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['PedidoProveedor'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['PedidoProveedor'][$this->getPrimaryKey()] = true;
     $keys = PedidoProveedorPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getFecha(), $keys[2] => $this->getDescripcion(), $keys[3] => $this->getEstado(), $keys[4] => $this->getUsuarioId(), $keys[5] => $this->getProveedorId(), $keys[6] => $this->getSerie(), $keys[7] => $this->getDocumento());
     if ($includeForeignObjects) {
         if (null !== $this->aUsuario) {
             $result['Usuario'] = $this->aUsuario->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aProveedor) {
             $result['Proveedor'] = $this->aProveedor->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collDetallePedidoProveedors) {
             $result['DetallePedidoProveedors'] = $this->collDetallePedidoProveedors->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Notificacion'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Notificacion'][$this->getPrimaryKey()] = true;
     $keys = NotificacionPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getId_emisor(), $keys[2] => $this->getId_receptor(), $keys[3] => $this->getDescripcion(), $keys[4] => $this->getId_tipo_notificacion(), $keys[5] => $this->getLeido());
     if ($includeForeignObjects) {
         if (null !== $this->aUsuarioRelatedById_emisor) {
             $result['UsuarioRelatedById_emisor'] = $this->aUsuarioRelatedById_emisor->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUsuarioRelatedById_receptor) {
             $result['UsuarioRelatedById_receptor'] = $this->aUsuarioRelatedById_receptor->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aTipo_notificacion) {
             $result['Tipo_notificacion'] = $this->aTipo_notificacion->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
function ActualizarDatos()
{
    session_start();
    if (!isset($_SESSION['Usuario'])) {
        Respoder(false, 'Debe iniciar sesión', null);
    }
    $user = new Usuario();
    $user->get('idUsuario', $_SESSION['Usuario']['idUsuario']);
    if (!$user->md_estado) {
        Respoder(false, 'No se pudo obtener el usuario', null);
    }
    if (!(($user->dni = filter_input(INPUT_POST, 'dni', FILTER_VALIDATE_INT)) && ($user->nombres = filter_input(INPUT_POST, 'nombres', FILTER_SANITIZE_STRING)) && ($user->apellidos = filter_input(INPUT_POST, 'apellidos', FILTER_SANITIZE_STRING)) && ($user->email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)))) {
        Respoder(false, 'Error al recibir parámetros', null);
    }
    $uAux = new Usuario();
    if ($user->dni != $_SESSION['Usuario']['dni'] && $uAux->get('dni', $user->dni)) {
        Respoder(false, 'Este DNI no está disponible', null);
    }
    if ($user->email != $_SESSION['Usuario']['email'] && $uAux->get('email', $user->email)) {
        Respoder(false, 'Este email no está disponible', null);
    }
    if ($user->edit()) {
        $_SESSION['Usuario'] = $user->toArray();
        Respoder(true, 'Información actualizada', null);
    } else {
        Respoder(false, $user->md_mensaje, $user->md_detalle);
    }
}
Exemple #7
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Transaccion'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Transaccion'][$this->getPrimaryKey()] = true;
     $keys = TransaccionPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getSerie(), $keys[2] => $this->getDocumento(), $keys[3] => $this->getClienteId(), $keys[4] => $this->getUsuarioId(), $keys[5] => $this->getTipoTransaccionId(), $keys[6] => $this->getNoTarjeta(), $keys[7] => $this->getTotal(), $keys[8] => $this->getDireccion(), $keys[9] => $this->getTipoPagoId());
     if ($includeForeignObjects) {
         if (null !== $this->aCliente) {
             $result['Cliente'] = $this->aCliente->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUsuario) {
             $result['Usuario'] = $this->aUsuario->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aTipoTransaccion) {
             $result['TipoTransaccion'] = $this->aTipoTransaccion->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aTipoPago) {
             $result['TipoPago'] = $this->aTipoPago->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
 protected function cambiarContra()
 {
     $Usuario = $this->checkAccess();
     $ipts = $this->getFilterInputs('post', array('pass' => array('string', 40, 40), 'nuevoPass' => array('string', 40, 40), 'nuevoPass2' => array('string', 40, 40)));
     if ($Usuario['password'] != $ipts['pass']) {
         $this->responder(false, 'Contraseña incorrecta');
     }
     if ($ipts['nuevoPass'] != $ipts['nuevoPass']) {
         $this->responder(false, 'Las contraseñas no coinciden');
     }
     $mysqli = $this->getMysqli();
     $user = new Usuario($mysqli, $Usuario['id']);
     $user->get();
     $user->password = $ipts['nuevoPass'];
     if (!$user->edit()) {
         $this->responder(false, 'Error al guardar cambios', $user->md_detalle);
     }
     $_SESSION['Usuario'] = $user->toArray();
     $this->responder(true, 'Cambios guardados');
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Libro'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Libro'][$this->getPrimaryKey()] = true;
     $keys = LibroPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getNombre(), $keys[2] => $this->getFecha(), $keys[3] => $this->getId_genero(), $keys[4] => $this->getAutor(), $keys[5] => $this->getImage(), $keys[6] => $this->getSinopsis(), $keys[7] => $this->getFecha_ult_acc(), $keys[8] => $this->getHora_ult_acc(), $keys[9] => $this->getUsuario_ult_acc(), $keys[10] => $this->getId_privacidad(), $keys[11] => $this->getEs_editable(), $keys[12] => $this->getId_usuario(), $keys[13] => $this->getDebaja(), $keys[14] => $this->getEstado());
     if ($includeForeignObjects) {
         if (null !== $this->aUsuarioRelatedByUsuario_ult_acc) {
             $result['UsuarioRelatedByUsuario_ult_acc'] = $this->aUsuarioRelatedByUsuario_ult_acc->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aPrivacidad) {
             $result['Privacidad'] = $this->aPrivacidad->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aGenero) {
             $result['Genero'] = $this->aGenero->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUsuarioRelatedById_usuario) {
             $result['UsuarioRelatedById_usuario'] = $this->aUsuarioRelatedById_usuario->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collAudiolibros) {
             $result['Audiolibros'] = $this->collAudiolibros->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collCalificacions) {
             $result['Calificacions'] = $this->collCalificacions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collComentarios) {
             $result['Comentarios'] = $this->collComentarios->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLibro_colaboradors) {
             $result['Libro_colaboradors'] = $this->collLibro_colaboradors->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLibro_versions) {
             $result['Libro_versions'] = $this->collLibro_versions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSolicituds) {
             $result['Solicituds'] = $this->collSolicituds->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSlider_maes) {
             $result['Slider_maes'] = $this->collSlider_maes->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collPostulantess) {
             $result['Postulantess'] = $this->collPostulantess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collClasificadoss) {
             $result['Clasificadoss'] = $this->collClasificadoss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }