/** * Get the associated Empresa object * * @param PropelPDO Optional Connection object. * @return Empresa The associated Empresa object. * @throws PropelException */ public function getEmpresa(PropelPDO $con = null) { if ($this->aEmpresa === null && $this->id_empresa !== null) { $c = new Criteria(EmpresaPeer::DATABASE_NAME); $c->add(EmpresaPeer::ID_EMPRESA, $this->id_empresa); $this->aEmpresa = EmpresaPeer::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->aEmpresa->addTareas($this); */ } return $this->aEmpresa; }
protected function processFilters($pre_filter = false) { if ($this->getRequest()->hasParameter('filter')) { $filters = $this->getRequestParameter('filters'); $reset_filter = $this->getRequestParameter('reset_filter', null); if ($reset_filter != null) { $this->getUser()->getAttributeHolder()->removeNamespace('sf/formulario/filters'); } //Si no tenemos filtro de empresa y talba=> lo ponemos nosotros if (!isset($filters['id_empresa']) && $filters['id_empresa'] == '') { $id_empresa_sel = sfContext::getInstance()->getUser()->getAttribute('idempresa', null); if ($id_empresa_sel == null || $id_empresa_sel == "") { $c1 = EmpresaPeer::getCriterioAlcance(); $empresa = EmpresaPeer::doSelectOne($c1); $id_empresa_sel = $empresa->getPrimaryKey(); } $filters['id_empresa'] = $id_empresa_sel; } if (!isset($filters['id_tabla']) && $filters['id_tabla'] == '') { $c1 = TablaPeer::getCriterioAlcance(); $c1->add(TablaPeer::ID_EMPRESA, $filters['id_empresa']); $tabla = TablaPeer::doSelectOne($c1); if ($tabla != null) { $filters['id_tabla'] = $tabla->getPrimaryKey(); } } if (!isset($filters['no_realizacion'])) { $filters['no_realizacion'] = 1; } if (sizeof($filters) == 2 && isset($filters['id_empresa']) && isset($filters['id_tabla'])) { //SOLO VIENE FILTRADOR POR EMPRESA Y TABLA => ENTONCES CARGAMOS POR SI ACASO LOS FILTROS ANTERIORES $filters_temp = $this->getUser()->getAttributeHolder()->getAll('sf/formulario/filters'); $filters_temp['id_empresa'] = $filters['id_empresa']; $filters_temp['id_tabla'] = $filters['id_tabla']; $filters = $filters_temp; } if (isset($filters['ultimo_contacto']['from']) && $filters['ultimo_contacto']['from'] !== '') { $filters['ultimo_contacto']['from'] = sfContext::getInstance()->getI18N()->getTimestampForCulture($filters['ultimo_contacto']['from'], $this->getUser()->getCulture()); } if (isset($filters['ultimo_contacto']['to']) && $filters['ultimo_contacto']['to'] !== '') { $filters['ultimo_contacto']['to'] = sfContext::getInstance()->getI18N()->getTimestampForCulture($filters['ultimo_contacto']['to'], $this->getUser()->getCulture()); } //Buscamos los posibles filtros de los campos de fechas. foreach ($filters as $key => $campo) { if (is_array($campo)) { foreach ($campo as $key2 => $campo2) { if (is_array($filters[$key][$key2]) && isset($filters[$key][$key2]['from']) && isset($filters[$key][$key2]['to'])) { $filters[$key][$key2]['from'] = sfContext::getInstance()->getI18N()->getTimestampForCulture($filters[$key][$key2]['from'], $this->getUser()->getCulture()); $filters[$key][$key2]['to'] = sfContext::getInstance()->getI18N()->getTimestampForCulture($filters[$key][$key2]['to'], $this->getUser()->getCulture()); } } } } $this->getUser()->getAttributeHolder()->removeNamespace('sf/formulario/filters'); $this->getUser()->getAttributeHolder()->add($filters, 'sf/formulario/filters'); } elseif ($pre_filter) { //marcar todas las casillas checkbox, ¿no? $filters = array(); if ($this->getRequestParameter('id_empresa') && $this->getRequestParameter('id_empresa') != '') { $filters['id_empresa'] = $this->getRequestParameter('id_empresa'); } $this->getUser()->getAttributeHolder()->removeNamespace('sf/formulario/filters'); $this->getUser()->getAttributeHolder()->add($filters, 'sf/formulario/filters'); } else { //filtros por defecto. $id_empresa_sel = sfContext::getInstance()->getUser()->getAttribute('idempresa', null); $filters = array(); if ($id_empresa_sel == null || $id_empresa_sel == "") { $c1 = EmpresaPeer::getCriterioAlcance(); $empresa = EmpresaPeer::doSelectOne($c1); $id_empresa_sel = $empresa->getPrimaryKey(); } $filters['id_empresa'] = $id_empresa_sel; $c1 = TablaPeer::getCriterioAlcance(); $c1->add(TablaPeer::ID_EMPRESA, $id_empresa_sel); $tabla = TablaPeer::doSelectOne($c1); if ($tabla != null) { $filters['id_tabla'] = $tabla->getPrimaryKey(); } $this->getUser()->getAttributeHolder()->removeNamespace('sf/formulario/filters'); $this->getUser()->getAttributeHolder()->add($filters, 'sf/formulario/filters'); } }
protected function getEmpresaOr404($id_empresa = 'id_empresa') { if (!$this->getRequestParameter($id_empresa)) { return $this->forward404(); } else { $c = $this->getCriterio(); $c->addAnd(EmpresaPeer::ID_EMPRESA, $this->getRequestParameter($id_empresa)); $empresa = EmpresaPeer::doSelectOne($c); $this->forward404Unless($empresa); return $empresa; } }
<fieldset style="clear:both"> <legend class="form1"> <span class="number">0</span> <?php echo __('Persona física que actúa en representación del responsable del fichero ante la AEPD'); ?> </legend> <fieldset style="margin-top:-3px;"> <legend><?php echo __('Datos del responsable del fichero (del Apartado 1)'); ?> </legend> <div class="flerro"> <div id="txt01_div" class="fcell" style="float:left"><?php $c = new Criteria(); $c->addAnd(EmpresaPeer::ID_USUARIO, $user_id, Criteria::EQUAL); $empresa = EmpresaPeer::doSelectOne($c); echo __('Razón social o Nombre y apellidos'); ?> <br /> <input id="txt01" type="text" name="razsocial_0" class="text required" size="60" value="<?php echo $empresa->getNombre(); ?> " /> </div> <div id="txt02_div" class="fcell"><?php echo __('CIF/NIF/NIE'); ?> <br /> <input id="txt02" type="text" name="cif_0" class="cif required" maxlength="9" size="30" value="<?php echo $empresa->getCif(); ?>