?> <fieldset> <h2><?php echo __('filters'); ?> </h2> <div class="form-row"> <?php echo label_for('filters[id_empresa]', __('empresa'), ''); ?> <div class="content"> <?php $id_empresa = isset($filters['id_empresa']) ? $filters['id_empresa'] : null; $c = EmpresaPeer::getCriterioAlcance(); $empresas = EmpresaPeer::doSelect($c); $value = select_empresas('filters[id_empresa]', objects_for_select($empresas, 'getIdEmpresa', '__toString', $id_empresa, array('include_blank' => true)), array('control_name' => 'filters[id_empresa]', 'include_blank' => true)); echo $value ? $value : " "; ?> </div> </div> </fieldset> <ul class="sf_admin_actions"> <li><?php echo button_to(__('reset'), 'tablas/list?filter=filter', 'class=sf_admin_action_reset_filter'); ?> </li>
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @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(EmpresaPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(EmpresaPeer::DATABASE_NAME); $criteria->add(EmpresaPeer::ID_EMPRESA, $pks, Criteria::IN); $objs = EmpresaPeer::doSelect($criteria, $con); } return $objs; }
public static function getListaEmpresas() { $array_empresas = array(); //$c=new Criteria(); $c = EmpresaPeer::getCriterioAlcance(); $lista_empresas = EmpresaPeer::doSelect($c); foreach ($lista_empresas as $empresa) { $array_empresas[$empresa->getIdEmpresa()] = $empresa->getNombre(); } return $array_empresas; }
/** * Gets an array of Empresa objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Usuario has previously been saved, it will retrieve * related Empresas from storage. If this Usuario is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Empresa[] * @throws PropelException */ public function getEmpresas($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(UsuarioPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEmpresas === null) { if ($this->isNew()) { $this->collEmpresas = array(); } else { $criteria->add(EmpresaPeer::ID_USUARIO, $this->id_usuario); EmpresaPeer::addSelectColumns($criteria); $this->collEmpresas = EmpresaPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // 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(EmpresaPeer::ID_USUARIO, $this->id_usuario); EmpresaPeer::addSelectColumns($criteria); if (!isset($this->lastEmpresaCriteria) || !$this->lastEmpresaCriteria->equals($criteria)) { $this->collEmpresas = EmpresaPeer::doSelect($criteria, $con); } } } $this->lastEmpresaCriteria = $criteria; return $this->collEmpresas; }
public function setEmpresaSesion($empresa = null) { if (!$empresa || !sfContext::getInstance()->getUser()->isAuthenticated()) { $this->setEmpresaSesionNull(); return false; } $c = clone EmpresaPeer::getCriterioAlcance(); $empresas = EmpresaPeer::doSelect($c); $comprobacion = true; $resultado = false; if ($comprobacion) { sfContext::getInstance()->getUser()->setAttribute('empresa_sesion', $empresa, 'sesion'); sfContext::getInstance()->getUser()->setAttribute('empresas_sesion', $empresas, 'sesion'); $resultado = true; } else { $this->setEmpresaSesionNull(); } return $resultado; }