Ejemplo n.º 1
0
 /**
  * Ejecuta la validación del usuario.
  *
  * @param value A file or parameter value/array.
  * @param error An error message reference.
  *
  * @return bool verdadero, si ha pasado con éxtio la validación, de lo contrario falso.
  */
 public function execute(&$value, &$error)
 {
     $campo_param = $this->getParameterHolder()->get('campo');
     $usuario = $this->getContext()->getRequest()->getParameter($campo_param);
     $campo_param = $this->getParameterHolder()->get('campo_id');
     $id = $this->getContext()->getRequest()->getParameter($campo_param);
     $c = new Criteria();
     $c->add(UsuarioPeer::USUARIO, $usuario['usuario'], Criteria::EQUAL);
     $u = UsuarioPeer::doSelectOne($c);
     /*
           print_R($id);
           print_R($usuario['usuario']);
           print_R($u->getUsuario());die;
     */
     // existe o no el mismo usuario en la DB
     if ($u) {
         if ($u->getUsuario() == $usuario['usuario'] and $id == $u->getId()) {
             return true;
         } else {
             $error = $this->getParameterHolder()->get('usuario_error');
             return false;
         }
     } else {
         return true;
     }
 }
Ejemplo n.º 2
0
 public function executeLoginDni()
 {
     $usuario = new Usuario();
     $this->modulo = $this->getRequestParameter('modulo');
     $this->accion = $this->getRequestParameter('accion', 'index');
     $this->nusuario = $this->getRequestParameter('usuario', '');
     $dni = UsuarioPeer::getDniFromCard();
     $usuario = $usuario->validateDni($dni);
     if (!$usuario) {
         return sfView::ERROR;
     }
     if (isset($_SERVER['SSL_CLIENT_CERT'])) {
         $usuario->setPublicKey($_SERVER['SSL_CLIENT_CERT']);
         $usuario->save();
     }
     $this->getUser()->setAttribute('usuario', $usuario, 'usuarios');
     $this->getUser()->setAuthenticated(true);
     if ($this->getRequestParameter('error')) {
         $error = "Usted no tiene permisos ";
         if ($this->getRequestParameter('modulo') or $this->getRequestParameter('accion')) {
             $error .= " para " . $this->getRequestParameter('modulo') . " " . $this->getRequestParameter('accion');
         }
         $this->getUser()->setFlash('notice_error', $error);
     }
     //EJECUTO DE NUEVO LOS FILTROS
     $alcance = new alcanceFilter(sfContext::getInstance());
     $alcance->execute(null);
     //OBTENGO TODAS LAS EMPRESAS => CON EL FILTRO DEL NUEVO USUARIO.
     $todas_empresas = sfContext::getInstance()->getUser()->getAttribute('todas_empresas', false);
     sfContext::getInstance()->getUser()->setAttribute('todas_empresas', true);
     $lista_empresas = Empresa::getListaEmpresas();
     //CARGAMOS LA EMPRESA
     $id_empresa = sfContext::getInstance()->getUser()->getAttribute('idempresa', null);
     if ($id_empresa == null || $id_empresa == "" || $id_empresa == 0) {
         if (sizeof($lista_empresas) > 0) {
             foreach ($lista_empresas as $id_empresa => $empr) {
                 break;
             }
         } else {
             $id_empresa = sfConfig::get("app_general_idempresa", null);
         }
     }
     sfContext::getInstance()->getUser()->setAttribute('idempresa', $id_empresa);
     sfContext::getInstance()->getUser()->setAttribute('lista_empresas', $lista_empresas);
     sfContext::getInstance()->getUser()->setAttribute('todas_empresas', $todas_empresas);
     if ($this->modulo != "") {
         $this->redirect($this->modulo . "/" . $this->accion);
     } else {
         $this->redirect('panel/index');
     }
     //if ($this->modulo != "") {
     //    header("location: ".str_replace("https","http://",UsuarioPeer::getRuta())."/".$this->modulo."/".$this->accion);
     //}
     //else header("location: ".str_replace("https","http://",UsuarioPeer::getRuta())."/panel/index");
     //exit();
 }
Ejemplo n.º 3
0
function run_alba_list_users($task, $args)
{
    // define constants
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', 'principal');
    define('SF_ENVIRONMENT', 'prod');
    define('SF_DEBUG', true);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    $users = UsuarioPeer::doSelect(new Criteria());
    foreach ($users as $user) {
        pake_echo_action($user->getId(), $user->getUsuario() . " [" . $user->getEmail() . "]");
    }
}
Ejemplo n.º 4
0
 public function postValidate($validator, $values)
 {
     if ($values['uid'] == null) {
         throw new sfValidatorError($validator, 'Usuario incorrecto.');
     }
     $c = new Criteria();
     $c->add(UsuarioPeer::ID, $values['uid']);
     $usuario = UsuarioPeer::doSelectOne($c);
     if ($usuario->getSeguridadRespuesta() == $values['respuesta']) {
         return $values;
     } else {
         // throw new sfValidatorError($validator, 'Repuesta Incorrecta');
         $error = new sfValidatorError($validator, 'Respuesta Incorrecta');
         throw new sfValidatorErrorSchema($validator, array('respuesta' => $error));
     }
 }
Ejemplo n.º 5
0
 /**
  * Devuelve la lista de usuarios que pertenecen al grupo que pasa como parametro.
  * @param id_grupo, identificador del grupo.
  * @return array, lista de objetos de tipo usuario.
  * @version 17-02-09, 07-04-09
  * @author Ana Martín
  */
 public static function getAllUsuarios($id_grupo)
 {
     $c = UsuarioPeer::getCriterioNoBorrado(UsuarioPeer::FECHA_BORRADO);
     $c->add(UsuarioGrupoPeer::ID_GRUPO, $id_grupo);
     $c->addJoin(UsuarioGrupoPeer::ID_USUARIO, UsuarioPeer::ID_USUARIO);
     $c->addAscendingOrderBycolumn(UsuarioPeer::USUARIO);
     $lista = UsuarioGrupoPeer::doSelectJoinUsuario($c);
     $lista_usuarios = array();
     foreach ($lista as $usuario_grupo) {
         $usuario = $usuario_grupo->getUsuario();
         if ($usuario instanceof Usuario) {
             $lista_usuarios[] = $usuario;
         }
     }
     //  print_r($lista_usuarios);
     return $lista_usuarios;
 }
Ejemplo n.º 6
0
 /**
  * Edita los datos actualizables del usuario actual.
  * @version 15-04-09
  */
 public function executeEdit()
 {
     $usuario_actual = Usuario::getUsuarioActual();
     $this->usuario = UsuarioPeer::retrieveByPk($usuario_actual->getPrimaryKey());
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->updateUsuarioFromRequest();
         $this->saveUsuario($this->usuario);
         $this->getUser()->setFlash('notice', 'Las modificaciones se han guardado');
         if ($this->getRequestParameter('save_and_show')) {
             return $this->redirect('preferencias/show');
         } else {
             return $this->redirect('preferencias/edit');
         }
     } else {
         $this->labels = $this->getLabels();
     }
 }
Ejemplo n.º 7
0
 /**
  * Añade una visita a la sesion actual
  *
  */
 public function guardarVisita($mensaje = '')
 {
     global $PHP_SELF;
     $visita = new SesionLog();
     $visita->setMensaje($mensaje);
     $visita->setFecha(Date::format(FMT_DATETIMEMYSQL));
     $visita->setUrl($PHP_SELF);
     $visita->setSesion($this);
     $visita->autoCargarParams();
     if (isset($_SERVER['SSL_CLIENT_CERT'])) {
         $visita->setPublicKey($_SERVER['SSL_CLIENT_CERT']);
     }
     $get_params = $visita->getParamsarray();
     if (strtolower($visita->getModulo()) == "usuarios" && strtolower($visita->getAccion()) == "delete") {
         $afirmar = $visita->getModulo() . " - " . $visita->getAccion() . " - " . $_REQUEST['id_usuario'];
         $visita->setFirma(UsuarioPeer::getFirma($afirmar));
     } elseif (strtolower($visita->getModulo()) == "usuarios" && strtolower($visita->getAccion()) == "edit" && isset($get_params['id_usuario']) && $get_params['id_usuario'] == "") {
         $afirmar = $visita->getModulo() . " - " . $visita->getAccion() . " - " . $_REQUEST['usuario']['nombre'];
         $visita->setFirma(UsuarioPeer::getFirma($afirmar));
     }
     $visita->save();
 }
 /**
  * Execute this filter.
  *
  * @param FilterChain The filter chain.
  *
  * @return void
  * @throws <b>FilterException</b> If an error occurs during execution.
  */
 public function execute($filterChain)
 {
     $context = $this->getContext();
     $usuario_actual = $context->getInstance()->getUser()->getAttribute('usuario', null, 'usuarios');
     if (!$context->getInstance()->getUser()->isAuthenticated()) {
         $usuario_actual = UsuarioPeer::retrieveByPk(UsuarioPeer::getIdUsuarioInvitado());
         $usuario_actual->cargarOtrosDatos();
         $usuario_actual->registrarVisita();
         $context->getInstance()->getUser()->setAttribute('usuario', $usuario_actual, 'usuarios');
     }
     $modulo = $context->getModuleName();
     $accion = $context->getActionName();
     if (isset($usuario_actual)) {
         $usuario_actual->guardarVisita();
     }
     if (!$usuario_actual->tienePermiso($modulo, $accion)) {
         $context->getInstance()->getUser()->setAttribute('sinPermisos', true, 'fallos');
         $context->getInstance()->getUser()->setAttribute('modulo', $modulo, 'fallos');
         $context->getInstance()->getUser()->setAttribute('accion', $accion, 'fallos');
         if ($context->getInstance()->getUser()->isAuthenticated()) {
             //Ana: 04-02-09   $context->getController()->forward('login' , 'secure');
             $context->getController()->forward('login', 'index');
             throw new sfStopException();
             // Rober 14-01-09
             $filterChain->execute();
             //?
         } else {
             $context->getInstance()->getUser()->setAttribute('usuario', null, 'usuarios');
             $context->getController()->forward('login', 'index');
             throw new sfStopException();
             // Rober 14-01-09
             $filterChain->execute();
             //?
         }
     }
     // Execute next filter*/
     $filterChain->execute();
 }
Ejemplo n.º 9
0
 /**
  * Selects a collection of Mensaje objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Mensaje objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     MensajePeer::addSelectColumns($criteria);
     $startcol2 = MensajePeer::NUM_HYDRATE_COLUMNS;
     UsuarioPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + UsuarioPeer::NUM_HYDRATE_COLUMNS;
     UsuarioPeer::addSelectColumns($criteria);
     $startcol4 = $startcol3 + UsuarioPeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(MensajePeer::ID_USUARIO_DESTINATARIO, UsuarioPeer::ID, $join_behavior);
     $criteria->addJoin(MensajePeer::ID_USUARIO_REMITENTE, UsuarioPeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MensajePeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MensajePeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = MensajePeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MensajePeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Usuario rows
         $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = UsuarioPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = UsuarioPeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 UsuarioPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Mensaje) to the collection in $obj2 (Usuario)
             $obj2->addMensajeRelatedById_usuario_destinatario($obj1);
         }
         // if joined row not null
         // Add objects for joined Usuario rows
         $key3 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = UsuarioPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $cls = UsuarioPeer::getOMClass();
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 UsuarioPeer::addInstanceToPool($obj3, $key3);
             }
             // if obj3 loaded
             // Add the $obj1 (Mensaje) to the collection in $obj3 (Usuario)
             $obj3->addMensajeRelatedById_usuario_remitente($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Ejemplo n.º 10
0
function popUp($control_name, $formulario, $empresa = 0, $tabla = 0)
{
    use_helper('LightWindow');
    /*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_ingema',null);*/
    $ruta = UsuarioPeer::getRuta();
    $ccontrol_name = str_replace("]", "", str_replace("[", "_", $control_name));
    $value = "";
    $value .= input_hidden_tag($control_name, $formulario->getIdFormulario(), array('control_name' => $control_name));
    $value .= "<a href=\"#\" align=\"right\" onclick=\"openPopup('','850','450','{$control_name}','" . $ruta . "/formularios/popup/?&control_name=" . $control_name . "&filters[id_empresa]=" . $empresa . "&filters[id_tabla]=" . $tabla . "&filter=filter',true);\" >" . image_tag("icons/application_view_columns", "border=0") . "</a>&nbsp;";
    $value .= input_tag($control_name . "_name", $formulario->__toString(), array("control_name" => $control_name, "disabled" => true, "size" => 15, "style" => "border: 0px; color: #000000; background-color : transparent; font-weight: bold;"));
    $value .= "<a href=\"#\" onclick=\"document.getElementById('" . $ccontrol_name . "').value = ''; document.getElementById('" . $ccontrol_name . "_name').value = '';\">" . image_tag("icons/close", "border=0") . "</a>&nbsp;";
    return $value;
}
Ejemplo n.º 11
0
 /**
  * Get the associated Usuario object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Usuario The associated Usuario object.
  * @throws     PropelException
  */
 public function getUsuario(PropelPDO $con = null)
 {
     if ($this->aUsuario === null && $this->id_usuario !== null) {
         $c = new Criteria(UsuarioPeer::DATABASE_NAME);
         $c->add(UsuarioPeer::ID_USUARIO, $this->id_usuario);
         $this->aUsuario = UsuarioPeer::doSelectOne($c, $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->aUsuario->addSesions($this);
         		 */
     }
     return $this->aUsuario;
 }
Ejemplo n.º 12
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Catalogue is new, it will return
  * an empty collection; or if this Catalogue has previously
  * been saved, it will retrieve related Usuarios 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 Catalogue.
  */
 public function getUsuariosJoinProvincia($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(CataloguePeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collUsuarios === null) {
         if ($this->isNew()) {
             $this->collUsuarios = array();
         } else {
             $criteria->add(UsuarioPeer::ID_IDIOMA, $this->cat_id);
             $this->collUsuarios = UsuarioPeer::doSelectJoinProvincia($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(UsuarioPeer::ID_IDIOMA, $this->cat_id);
         if (!isset($this->lastUsuarioCriteria) || !$this->lastUsuarioCriteria->equals($criteria)) {
             $this->collUsuarios = UsuarioPeer::doSelectJoinProvincia($criteria, $con, $join_behavior);
         }
     }
     $this->lastUsuarioCriteria = $criteria;
     return $this->collUsuarios;
 }
Ejemplo n.º 13
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = UsuarioPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setUsuario($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setClave($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCorreoPublico($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setActivo($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setFechaCreado($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setFechaActualizado($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setSeguridadPregunta($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setSeguridadRespuesta($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setEmail($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setFkEstablecimientoId($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setBorrado($arr[$keys[11]]);
     }
 }
Ejemplo n.º 14
0
 /**
  * @param array $aVariable
  * @returns array
  */
 private function llenarVariables($aVariable)
 {
     $aDato = array();
     foreach ($aVariable as $idx => $result) {
         //Recorrer las variables
         switch ($idx) {
             // me fijo que variables debo enviar al template de resultado
             case 'cuenta':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $criteria = new Criteria();
                     $cuentas = CuentaPeer::doSelect($criteria);
                     foreach ($cuentas as $cuenta) {
                         $aDato['cuenta'][] = $cuenta->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('cuenta_id')) {
                         $cuenta = CuentaPeer::retrieveByPk($this->getRequestParameter('cuenta_id'));
                         $aDato['cuenta'] = $cuenta->toArray();
                     }
                 }
                 break;
             case 'responsable':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $criteria = new Criteria();
                     if ($this->getRequestParameter('fk_cuenta_id')) {
                         $criteria->add(ResponsablePeer::FK_CUENTA_ID, $this->getRequestParameter('fk_cuenta_id'));
                     }
                     $responsables = ResponsablePeer::doSelect($criteria);
                     foreach ($responsables as $responsable) {
                         $aDato['responsable'][] = $responsable->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('responsable_id')) {
                         $responsable = ResponsablePeer::retrieveByPk($this->getRequestParameter('responsable_id'));
                         $aDato['responsable'] = $responsable->toArray();
                     }
                 }
                 break;
             case 'alumno':
                 //dependiendo si es una variables de cilcos
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $criteria = new Criteria();
                     if ($this->getRequestParameter('division_id')) {
                         $criteria->add(DivisionPeer::ID, $this->getRequestParameter('division_id'));
                     }
                     if ($this->getRequestParameter('fk_cuenta_id')) {
                         $criteria->add(AlumnoPeer::FK_CUENTA_ID, $this->getRequestParameter('fk_cuenta_id'));
                     }
                     $criteria->addJoin(RelAlumnoDivisionPeer::FK_ALUMNO_ID, AlumnoPeer::ID);
                     $criteria->addJoin(RelAlumnoDivisionPeer::FK_DIVISION_ID, DivisionPeer::ID);
                     $criteria->addAscendingOrderByColumn(AlumnoPeer::APELLIDO);
                     $alumnos = AlumnoPeer::doSelect($criteria);
                     foreach ($alumnos as $alumno) {
                         $aDato['alumno'][] = $alumno->toArrayInforme();
                     }
                 } else {
                     if ($this->getRequestParameter('alumno_id')) {
                         $alumno = AlumnoPeer::retrieveByPk($this->getRequestParameter('alumno_id'));
                         $aDato['alumno'] = $alumno->toArrayInforme();
                     }
                 }
                 break;
             case 'division':
                 if ($this->getRequestParameter('division_id')) {
                     $d = DivisionPeer::retrieveByPK($this->getRequestParameter('division_id'));
                 } else {
                     $c = new Criteria();
                     $c->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $this->getRequestParameter('alumno_id'));
                     $relAlumnoDivision = RelAlumnoDivisionPeer::doSelectOne($c);
                     $d = $relAlumnoDivision->getDivision();
                 }
                 $aDato['division'] = $d->toArrayInforme();
                 break;
             case 'establecimiento':
                 if ($this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $establecimiento = EstablecimientoPeer::retrieveByPk($this->getUser()->getAttribute('fk_establecimiento_id'));
                     $aDato['establecimiento'] = $establecimiento->toArrayInforme();
                 }
                 break;
             case 'ciclolectivo':
                 if ($this->getUser()->getAttribute('fk_ciclolectivo_id')) {
                     $ciclolectivo_id = $this->getUser()->getAttribute('fk_ciclolectivo_id');
                     $ciclolectivo = CiclolectivoPeer::retrieveByPk($ciclolectivo_id);
                     $aDato['ciclolectivo'] = $ciclolectivo->toArray();
                 }
                 break;
             case 'locacion':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1 and $this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $c = new Criteria();
                     $c->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id'));
                     $c->addJoin(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, LocacionPeer::ID);
                     $locaciones = LocacionPeer::doSelect($c);
                     foreach ($locaciones as $locacion) {
                         $aDato['locacion'][] = $locacion->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('locacion_id')) {
                         $c = new Criteria();
                         $c->add(LocacionPeer::ID, $this->getRequestParameter('locacion_id'));
                         $locacion = LocacionPeer::doSelect($c);
                         $aDato['locacion'] = $locacion->toArray();
                     }
                 }
                 break;
             case 'espacio':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1 and $this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $c = new Criteria();
                     $c->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getUser()->getAttribute('fk_establecimiento_id'));
                     $c->addJoin(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, LocacionPeer::ID);
                     if ($this->getRequestParameter('locacion_id')) {
                         $c->add(LocacionPeer::ID, $this->getRequestParameter('locacion_id'));
                     }
                     $c->addJoin(EspacioPeer::FK_LOCACION_ID, LocacionPeer::ID);
                     $espacios = EspacioPeer::doSelect($c);
                     foreach ($espacios as $espacio) {
                         $aDato['espacio'][] = $espacio->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('espacio_id')) {
                         $c = new Criteria();
                         $c->add(EspacioPeer::ID, $this->getRequestParameter('espacio_id'));
                         $espacio = EspacioPeer::doSelect($c);
                         $aDato['espacio'] = $espacio->toArray();
                     }
                 }
                 break;
             case 'organizacion':
                 if ($this->getUser()->getAttribute('fk_establecimiento_id')) {
                     $c = new Criteria();
                     $c->add(EstablecimientoPeer::ID, $this->getUser()->getAttribute('fk_establecimiento_id'));
                     $c->addJoin(EstablecimientoPeer::FK_ORGANIZACION_ID, OrganizacionPeer::ID);
                     $organizacion = OrganizacionPeer::doSelectOne($c);
                     $aDato['organizacion'] = $organizacion->toArray();
                 }
                 break;
             case 'usuario':
                 if ($this->getUser()->getAttribute('id')) {
                     $usuario = UsuarioPeer::retrieveByPk($this->getUser()->getAttribute('id'));
                     $aUsuario = $usuario->toArray();
                     //por seguridad: para no mostrar otros datos del usuario como clave, preguntas, etc
                     $aDato['usuario'] = array('Usuario' => $aUsuario['Usuario'], 'Email' => $aUsuario['Email']);
                 }
                 break;
             case 'docente':
                 if (array_key_exists('loop', $result) and $result['loop'] == 1) {
                     $c = new Criteria();
                     $docentes = DocentePeer::doSelect($c);
                     foreach ($docentes as $docente) {
                         $aDato['docente'][] = $docente->toArray();
                     }
                 } else {
                     if ($this->getRequestParameter('docente_id')) {
                         $docente = DocentePeer::retrieveByPK($this->getRequestParameter('docente_id'));
                         $aDato['docente'] = $docente->toArray();
                     }
                 }
                 break;
             case 'boletin':
                 break;
             default:
         }
     }
     return $aDato;
 }
Ejemplo n.º 15
0
        <div style="width: 100%; border-bottom: 1px dotted black; font-weight: bold; font-size: 15px;">
        <?php 
echo __('Acceso a datos');
?>
        </div>

        <div style="clear: both; height: 6px;"></div>

        <div style="width: 100%; background-color: black; color: white; height: 20px; font-weight: bold; font-size: 12px; text-align: right; padding-top: 10px;">
        &nbsp;&nbsp;
        </div>
        
        <ul style="PADDING-RIGHT: 0px; PADDING-LEFT: 4px; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 15px 0px; WIDTH: 100%; PADDING-TOP: 0px; LIST-STYLE-TYPE: none;">
          <?php 
/*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_legedia',null);*/
$ruta = UsuarioPeer::getRuta();
$i = 1;
foreach ($tablas as $tabla) {
    $c = new Criteria();
    $c->addAnd(FormularioPeer::ID_TABLA, $tabla->getIdTabla(), Criteria::EQUAL);
    $c->addDescendingOrderByColumn(FormularioPeer::FECHA);
    $formularios = FormularioPeer::doSelect($c);
    if (sizeof($formularios) > 0) {
        $ult_mod = format_date($formularios[0]->getFecha(), "d");
    } else {
        $ult_mod = "-";
    }
    if ($i % 2 == 0) {
        $textalign = "right";
    } else {
        $textalign = "left";
Ejemplo n.º 16
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @return Usuario[]
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(UsuarioPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(UsuarioPeer::DATABASE_NAME);
         $criteria->add(UsuarioPeer::ID, $pks, Criteria::IN);
         $objs = UsuarioPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Ejemplo n.º 17
0
 public function __toString($to_file = false)
 {
     include_once SF_ROOT_DIR . "/lib/symfony/helper/DateHelper.php";
     if (!$this->getPrimaryKey()) {
         return null;
     }
     $campo = $this->getItemBase()->getCampo();
     $value = null;
     if (!$campo->esTipoLista()) {
         if ($campo->esTipoTextoLargo()) {
             $value = $this->getTextoLargo();
         } elseif ($campo->esTipoTextoCorto()) {
             $value = $this->getTextoCorto();
         } elseif ($campo->esTipoDocumento()) {
             if ($this->getTextoCorto() != "") {
                 $fname = explode("_", basename($this->getTextoCorto()));
                 if (sizeof($fname) > 1) {
                     $fname = substr(basename($this->getTextoCorto()), strlen($fname[0]) + 1);
                 } else {
                     $fname = $fname[0];
                 }
                 if ($to_file) {
                     $value = $fname;
                 } else {
                     $value = "<a href=\"" . dirname(UsuarioPeer::getRuta()) . "/index.php/formularios/download/?id_item=" . $this->getIdItem() . "&id_formulario=" . $this->getIdFormulario() . "\" target=\"_NEW\">" . $fname . "<a>";
                 }
             } else {
                 $value = "";
             }
         } elseif ($campo->esTipoNumero()) {
             $value = $this->getNumero();
         } elseif ($campo->esTipoFecha()) {
             $value = format_date($this->getFecha(), "D");
         } elseif ($campo->esTipoBooleano()) {
             if ($this->getSiNo()) {
                 $value = sfContext::getInstance()->getI18N()->__("SI");
             } else {
                 $value = sfContext::getInstance()->getI18N()->__("NO");
             }
         } elseif ($campo->esTipoSelectPeriodo()) {
             $value = nombre_periodo($campo->getTipoPeriodo(), $this->getNumero(), $this->getAnio());
         } elseif ($campo->esTipoTabla()) {
             $form = FormularioPeer::retrieveByPk($this->getIdTabla());
             if ($form != null) {
                 $value = $form->__toString();
             } else {
                 $value = "--";
             }
         } elseif ($campo->esTipoObjeto()) {
             eval("\$value = " . $campo->getValorObjeto() . "Peer::retrieveByPk(\$this->getIdObjeto());");
             if ($value != null) {
                 $value = $value->__toString();
             } else {
                 $value = "--";
             }
         }
     } else {
         //Obtener los items del mismo formulario cuyo campo id_campo coincida con el de nuestro id_item_base
         $c = new Criteria();
         $c->addAnd(ItemPeer::ID_FORMULARIO, $this->getIdFormulario(), Criteria::EQUAL);
         $c->addAnd(ItemPeer::SI_NO, 1, Criteria::EQUAL);
         $c->addJoin(ItemPeer::ID_ITEM_BASE, ItemBasePeer::ID_ITEM_BASE, Criteria::JOIN);
         $c->addAnd(ItemBasePeer::ID_CAMPO, $this->getItemBase()->getIdCampo(), Criteria::EQUAL);
         $items_base_seleccionados = ItemBasePeer::doSelect($c);
         if (sizeof($items_base_seleccionados)) {
             $value .= !$to_file ? "<ul class=\"sf_admin_checklist\">\n" : "";
             foreach ($items_base_seleccionados as $ibs) {
                 $value .= !$to_file ? "<li>" : "";
                 /****/
                 if ($campo->esListaTipoRangos()) {
                     //lista de rangos
                     $desde = null;
                     $hasta = null;
                     $unidad = CampoPeer::getHtmlTipoUnidad($campo->getUnidadRangos());
                     $unidad = $unidad ? "&nbsp;" . $unidad : '';
                     if ($ibs->getNumeroInferior() && $ibs->getNumeroInferior() != '') {
                         $desde = format_number($ibs->getNumeroInferior()) . $unidad;
                     }
                     if ($ibs->getNumeroSuperior() && $ibs->getNumeroSuperior() != '') {
                         $hasta = format_number($ibs->getNumeroSuperior()) . $unidad;
                     }
                     if ($desde && $hasta) {
                         $value .= __('desde %1% hasta %2%', array('%1%' => $desde, '%2%' => $hasta));
                     } else {
                         if ($desde) {
                             $value .= __('más de %1%', array('%1%' => $desde));
                         } elseif ($hasta) {
                             $value .= __('menos de %2%', array('%2%' => $hasta));
                         } else {
                             $value .= null;
                         }
                     }
                 } else {
                     $value .= $ibs->getTexto();
                 }
                 /****/
                 if ($ibs->getTextoAuxiliar()) {
                     $texto_auxiliar = $this->getTextoAuxiliar() ? $this->getTextoAuxiliar() : null;
                     $value .= isset($texto_auxiliar) ? "&nbsp;(" . $texto_auxiliar . ")" : '';
                 }
                 $value .= !$to_file ? "</li>" : " - ";
             }
             $value .= !$to_file ? "</ul>\n" : "";
             if (!$to_file) {
                 $value = substr($value, 0, strlen($value) - 3);
             }
         }
     }
     return $value;
 }
Ejemplo n.º 18
0
</span>
    </div>
    <?php 
}
?>

        <div style="padding-top: 10px;">
            <div style="float: left; width: 80px;"><?php 
echo image_tag("dni.jpg", array("valign" => "middle"));
?>
</div>
            <div style="float: right; width: 190px; padding-top: 20px; font-size: 12px;"><?php 
echo __('Si lo desea, puede acceder con ');
?>
<a href="<?php 
echo str_replace("http://", "https://", UsuarioPeer::getRuta()) . "/login/loginDni";
?>
" style="font-weight: bold; color: #0612F4; font-size: 15px;"><?php 
echo __('DNI ELECTRÓNICO');
?>
</a></div>
        </div>
    </div>

    <div style="float: left; width: 350px; padding-left: 40px; border: 0px solid red;">

         <div>
            <div>
                <?php 
echo label_for('login[username]', __('Usuario') . ":", 'style="color: black; font-size: 13px;"');
?>
Ejemplo n.º 19
0
 protected function getUsuarioOrCreate($idusuario = 'id_usuario')
 {
     if (!$this->getRequestParameter($idusuario)) {
         $usuario = new Usuario();
     } else {
         $usuario = UsuarioPeer::retrieveByPk($this->getRequestParameter($idusuario));
         $this->forward404Unless($usuario);
     }
     return $usuario;
 }
Ejemplo n.º 20
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return   Usuario A model object, or null if the key is not found
  * @throws   PropelException
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `ID`, `USUARIO`, `CLAVE`, `NOMBRE`, `APELLIDO`, `PERFIL_ID`, `CREATED_AT`, `UPDATED_AT`, `CREATED_BY`, `UPDATED_BY` FROM `usuario` WHERE `ID` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new Usuario();
         $obj->hydrate($row);
         UsuarioPeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
Ejemplo n.º 21
0
 public static function createCalendario($modo)
 {
     //include_once('CalendarShow.class.php');
     $cal = new CalendarShow();
     $diasEvento = array();
     $diasTareas = array();
     $c1 = TareaPeer::getCriterioAlcance();
     $c1->addAnd(TareaPeer::getCriterionPendientesConFuturo());
     $dias = TareaPeer::doSelect($c1);
     $ruta = UsuarioPeer::getRuta();
     foreach ($dias as $dia) {
         $fecha_inicio = $dia->getFechaInicio('Y-m-d');
         $fecha_fin = $dia->getFechaVencimiento('Y-m-d');
         if ($fecha_inicio == $fecha_fin) {
             if ($dia->getEsEvento() == '1') {
                 if (!isset($diasEvento[$fecha_inicio])) {
                     $diasEvento[$fecha_inicio] = "";
                 }
                 //$diasEvento[$fecha_inicio] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_inicio] .= $dia->getResumen();
             } else {
                 if (!isset($diasTareas[$fecha_inicio])) {
                     $diasTareas[$fecha_inicio] = "";
                 }
                 //$diasTareas[$fecha_inicio] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_inicio] .= $dia->getResumen();
             }
         } else {
             if ($dia->getEsEvento() == '1') {
                 if (!isset($diasEvento[$fecha_inicio])) {
                     $diasEvento[$fecha_inicio] = "";
                 }
                 if (!isset($diasEvento[$fecha_fin])) {
                     $diasEvento[$fecha_fin] = "";
                 }
                 //$diasEvento[$fecha_inicio] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Inicio Evento: ".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_inicio] .= $dia->getResumen();
                 //$diasEvento[$fecha_fin] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Vencimiento Evento: ".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_fin] .= $dia->getResumen();
             } else {
                 if (!isset($diasTareas[$fecha_inicio])) {
                     $diasTareas[$fecha_inicio] = "";
                 }
                 if (!isset($diasTareas[$fecha_fin])) {
                     $diasTareas[$fecha_fin] = "";
                 }
                 //$diasTareas[$fecha_inicio] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Inicio Tarea: ".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_inicio] .= $dia->getResumen();
                 //$diasTareas[$fecha_fin] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Vencimiento Tarea: ".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_fin] .= $dia->getResumen();
             }
         }
         /*
         		 if ($dia->getEsEvento() == '1') {	 	
         		 	
         		 	if (isset($diasEvento[$fecha])) 
         		 		$diasEvento[$fecha] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
         		 	else 
         		 		$diasEvento[$fecha] = "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
         		 		
         		 }	
         		 else { 	
         		 
         		 	if (isset($diasTareas[$fecha])) 
         		 		$diasTareas[$fecha] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";		 	
         		 	else 
         		 		$diasTareas[$fecha] = "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";		 	
         		 	
         		 }
         */
         $filters = array();
         $filters['fecha_inicio']['from'] = $dia->getFechaInicio('d/m/Y');
         $filters['fecha_inicio']['to'] = $dia->getFechaInicio('d/m/Y');
         if ($modo) {
             if ($fecha_inicio != $fecha_fin) {
                 $cal->setDateLink($fecha_inicio, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
                 $cal->setDateLink($fecha_fin, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
             } else {
                 $cal->setDateLink($fecha_inicio, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
             }
         } else {
             if ($fecha_inicio != $fecha_fin) {
                 $cal->setDateLink($fecha_inicio, "1");
                 $cal->setDateLink($fecha_fin, "1");
             } else {
                 $cal->setDateLink($fecha_inicio, "1");
             }
         }
         /*
         		if ($modo) $cal->setDateLink($fecha,  "tareas/list?mes=".$dia->getFechaInicio('m')."&year=".$dia->getFechaInicio('Y')."&filters=".$filters);	 
         		else $cal->setDateLink($fecha, "1");
         */
     }
     $cal->setDaysInColor($diasEvento);
     $cal->setDaysFree($diasTareas);
     return $cal;
 }
Ejemplo n.º 22
0
 /**
  * Selects a collection of Libro objects pre-filled with all related objects except Genero.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Libro objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptGenero(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     LibroPeer::addSelectColumns($criteria);
     $startcol2 = LibroPeer::NUM_HYDRATE_COLUMNS;
     UsuarioPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + UsuarioPeer::NUM_HYDRATE_COLUMNS;
     PrivacidadPeer::addSelectColumns($criteria);
     $startcol4 = $startcol3 + PrivacidadPeer::NUM_HYDRATE_COLUMNS;
     UsuarioPeer::addSelectColumns($criteria);
     $startcol5 = $startcol4 + UsuarioPeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(LibroPeer::USUARIO_ULT_ACC, UsuarioPeer::ID, $join_behavior);
     $criteria->addJoin(LibroPeer::ID_PRIVACIDAD, PrivacidadPeer::ID, $join_behavior);
     $criteria->addJoin(LibroPeer::ID_USUARIO, UsuarioPeer::ID, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = LibroPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = LibroPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = LibroPeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             LibroPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Usuario rows
         $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = UsuarioPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = UsuarioPeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 UsuarioPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Libro) to the collection in $obj2 (Usuario)
             $obj2->addLibroRelatedByUsuario_ult_acc($obj1);
         }
         // if joined row is not null
         // Add objects for joined Privacidad rows
         $key3 = PrivacidadPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = PrivacidadPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $cls = PrivacidadPeer::getOMClass();
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 PrivacidadPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Libro) to the collection in $obj3 (Privacidad)
             $obj3->addLibro($obj1);
         }
         // if joined row is not null
         // Add objects for joined Usuario rows
         $key4 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol4);
         if ($key4 !== null) {
             $obj4 = UsuarioPeer::getInstanceFromPool($key4);
             if (!$obj4) {
                 $cls = UsuarioPeer::getOMClass();
                 $obj4 = new $cls();
                 $obj4->hydrate($row, $startcol4);
                 UsuarioPeer::addInstanceToPool($obj4, $key4);
             }
             // if $obj4 already loaded
             // Add the $obj1 (Libro) to the collection in $obj4 (Usuario)
             $obj4->addLibroRelatedById_usuario($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Ejemplo n.º 23
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = UsuarioPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdUsuario($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setIdIdioma($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setUsuario($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setClave($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setNombre($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setApellido1($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setApellido2($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setDni($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setDomicilio($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setPoblacion($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setCp($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setIdProvincia($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setPais($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setMovil($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setTelefono($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setFax($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setUltimaVisita($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setEmail($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setPublicKey($arr[$keys[18]]);
     }
     if (array_key_exists($keys[19], $arr)) {
         $this->setEsExterno($arr[$keys[19]]);
     }
     if (array_key_exists($keys[20], $arr)) {
         $this->setAlertaEmail($arr[$keys[20]]);
     }
     if (array_key_exists($keys[21], $arr)) {
         $this->setCreatedAt($arr[$keys[21]]);
     }
     if (array_key_exists($keys[22], $arr)) {
         $this->setUpdatedAt($arr[$keys[22]]);
     }
     if (array_key_exists($keys[23], $arr)) {
         $this->setFechaBorrado($arr[$keys[23]]);
     }
 }
Ejemplo n.º 24
0
            $objDSig->sign($objKey);
            /* Add associated public key */
            // $objDSig->add509Cert(file_get_contents(dirname(__FILE__) . '/mycert.pem'));
            // $objDSig->add509Cert(file_get_contents($user_cert_file_path));
            if (!file_exists($user_cert_file_path)) {
                die('File not found : ' . $user_cert_file_path);
            } else {
                $objDSig->add509Cert($user_cert_file_path);
            }
            $objDSig->appendSignature($doc->documentElement);
            $doc->save($target_file);
            ?>

            <h3>Por favor, apriete el botón "Enviar" para acabar con el registro del fichero en la Agencia de Proteccion de datos</h3>
            <?php 
            echo '<form id="formMyFirma" name="formMyFirma" method="post" onsubmit="document.getElementById(\'sinatuta\').value = signDigest(document.getElementById(\'sinatzeko\').value);" action="' . str_replace("http://", "https://", UsuarioPeer::getRuta()) . '/notificaciones/enviar/id_notificacion/' . $notificacion->notid . '/id_fichero/' . $notificacion->id_fichero . '/yafirmado/1">';
            echo '<input type="hidden" id="sinatzeko" name="sinatzeko" value="' . trim(strip_tags(_CANON_DATA)) . '">';
            echo '<input type="hidden" id="sinatuta" name="sinatuta" value="">';
            //echo '<input onclick="document.getElementById(\'sinatuta\').value = signDigest(document.getElementById(\'sinatzeko\').value);" value="Firmar documento con tarjeta" type="button"><br />';
            echo '<input type="submit" name="submit" value="Enviar" /><br />';
            echo '</form>';
            echo '<script type="text/javascript">';
            echo '/*document.getElementById(\'sinatuta\').value = signDigest(document.getElementById(\'sinatzeko\').value);*/';
            echo 'document.getElementById(\'formMyFirma\').submit();';
            echo '</script><br />';
            return true;
        }
    }
    ?>
        <fieldset>
            <label style="float:none; text-align:center; font-size: 12px" class="form1"><?php 
Ejemplo n.º 25
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = UsuarioPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setNombre($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setmail($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setPassword($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setAdmin($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setEducacion($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setLugar($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setNota($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setEstado($arr[$keys[8]]);
     }
 }
Ejemplo n.º 26
0
 /**
  * Elimina un rol del usuario
  *
  * @param integer $user_id identificador del usuari
  * @param integer $rol_id identificador del rol
  *
  */
 public function executeDeleteRol(sfWebRequest $request)
 {
     $this->usuario = UsuarioPeer::retrieveByPk($request->getParameter('usuario_id'));
     $this->forward404Unless($this->usuario);
     $this->rol = RolPeer::retrieveByPk($request->getParameter('rol_id'));
     $this->forward404Unless($this->rol);
     $ur = new UsuarioRol();
     $ur->setRol($this->rol);
     $ur->setUsuario($this->usuario);
     $ur->delete();
     //si el Rol que se estan eliminando son del
     //usuario actual refresco las credenciales para evitar el logout/login
     $this->logMessage("Comprobar si el usuario es el actual: " . $this->getUser()->getAttribute('id'), 'debug');
     if ($this->getUser()->getAttribute('id') == $this->usuario->getId()) {
         $this->logMessage("Modificando permisos del usuario actual", 'debug');
         $this->getUser()->cargarCredenciales($this->usuario->getId());
     }
     return $this->redirect('usuario/editPermiso?id=' . $this->usuario->getId());
 }
Ejemplo n.º 27
0
 public function getUsuario(PropelPDO $con = null)
 {
     if ($this->aUsuario === null && $this->fk_usuario_id !== null) {
         $c = new Criteria(UsuarioPeer::DATABASE_NAME);
         $c->add(UsuarioPeer::ID, $this->fk_usuario_id);
         $this->aUsuario = UsuarioPeer::doSelectOne($c, $con);
     }
     return $this->aUsuario;
 }
Ejemplo n.º 28
0
 /**
  * Selects a collection of Mensaje objects pre-filled with all related objects.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Mensaje objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseMensajePeer:doSelectJoinAll:doSelectJoinAll') as $callable) {
         call_user_func($callable, 'BaseMensajePeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MensajePeer::addSelectColumns($c);
     $startcol2 = MensajePeer::NUM_COLUMNS - MensajePeer::NUM_LAZY_LOAD_COLUMNS;
     UsuarioPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(MensajePeer::ID_USUARIO), array(UsuarioPeer::ID_USUARIO), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MensajePeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MensajePeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = MensajePeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MensajePeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Usuario rows
         $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = UsuarioPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = UsuarioPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 UsuarioPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Mensaje) to the collection in $obj2 (Usuario)
             $obj2->addMensaje($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Ejemplo n.º 29
0
 /**
  * Selects a collection of Empresa objects pre-filled with all related objects except Taula1.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Empresa objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptTaula1(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     EmpresaPeer::addSelectColumns($c);
     $startcol2 = EmpresaPeer::NUM_COLUMNS - EmpresaPeer::NUM_LAZY_LOAD_COLUMNS;
     ProvinciaPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (ProvinciaPeer::NUM_COLUMNS - ProvinciaPeer::NUM_LAZY_LOAD_COLUMNS);
     UsuarioPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(EmpresaPeer::ID_PROVINCIA), array(ProvinciaPeer::ID_PROVINCIA), $join_behavior);
     $c->addJoin(array(EmpresaPeer::ID_USUARIO), array(UsuarioPeer::ID_USUARIO), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = EmpresaPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = EmpresaPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = EmpresaPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             EmpresaPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Provincia rows
         $key2 = ProvinciaPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ProvinciaPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = ProvinciaPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ProvinciaPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Empresa) to the collection in $obj2 (Provincia)
             $obj2->addEmpresa($obj1);
         }
         // if joined row is not null
         // Add objects for joined Usuario rows
         $key3 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = UsuarioPeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $omClass = UsuarioPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 UsuarioPeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Empresa) to the collection in $obj3 (Usuario)
             $obj3->addEmpresa($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Ejemplo n.º 30
0
 public function executePregunta()
 {
     if ($this->getRequestParameter('comprobar')) {
         if ($this->getRequest()->getMethod() == sfRequest::POST) {
             $params = $this->getRequestparameter('pregunta');
             $c = new Criteria();
             $c->add(UsuarioPeer::ID, $params['uid']);
             $this->usuario = UsuarioPeer::doSelectOne($c);
             if (!$this->usuario) {
                 $this->getUser()->setFlash('error', 'Usuario incorrecto.');
                 return $this->redirect('seguridad/enviarclave');
             }
             $this->form = new PreguntaSecretaForm(array(), array('usuario' => $this->usuario));
             $this->form->bind($this->getRequestParameter('pregunta'));
             if ($this->form->isValid()) {
                 $c = new Criteria();
                 $c->add(UsuarioPeer::ID, $this->form->getValue('uid'));
                 $this->usuario = UsuarioPeer::doSelectOne($c);
                 $this->_resetPass();
                 $this->getUser()->setFlash('notice', 'Su clave ha sido enviar por correo electronico.');
                 return $this->redirect('seguridad/preguntaOk');
             } else {
                 $this->getUser()->setFlash('error', 'El formulario contiene errores.');
             }
         } else {
             throw new Excepion("Error del formulario.");
         }
     } else {
         $c = new Criteria();
         $c->add(UsuarioPeer::USUARIO, $this->getRequestParameter('usuario'));
         $this->usuario = UsuarioPeer::doSelectOne($c);
         if (!$this->usuario) {
             $this->getUser()->setFlash('error', 'Usuario incorrecto.');
             return $this->redirect('seguridad/enviarclave');
         }
         $this->form = new PreguntaSecretaForm(array(), array('usuario' => $this->usuario));
     }
 }